2021-12-05 17:54:36 +00:00
|
|
|
#include "CharacterComponent.h"
|
2022-02-05 11:28:17 +00:00
|
|
|
#include "DestroyableComponent.h"
|
2021-12-05 17:54:36 +00:00
|
|
|
#include "EntityManager.h"
|
2022-02-05 11:28:17 +00:00
|
|
|
#include "FvRaceSmashEggImagineServer.h"
|
2021-12-05 17:54:36 +00:00
|
|
|
#include "PossessableComponent.h"
|
2022-02-05 11:28:17 +00:00
|
|
|
#include "RacingTaskParam.h"
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
void FvRaceSmashEggImagineServer::OnDie(Entity *self, Entity *killer) {
|
|
|
|
if (killer != nullptr) {
|
|
|
|
auto* destroyableComponent = killer->GetComponent<DestroyableComponent>();
|
|
|
|
if (destroyableComponent != nullptr) {
|
|
|
|
destroyableComponent->SetImagination(destroyableComponent->GetImagination() + 10);
|
|
|
|
EntityManager::Instance()->SerializeEntity(killer);
|
|
|
|
}
|
|
|
|
|
2022-02-05 11:28:17 +00:00
|
|
|
// get possessor to progress statistics and tasks.
|
2021-12-05 17:54:36 +00:00
|
|
|
auto* possessableComponent = killer->GetComponent<PossessableComponent>();
|
|
|
|
if (possessableComponent != nullptr) {
|
|
|
|
|
|
|
|
auto* possessor = EntityManager::Instance()->GetEntity(possessableComponent->GetPossessor());
|
|
|
|
if (possessor != nullptr) {
|
|
|
|
|
2022-02-05 11:28:17 +00:00
|
|
|
auto* missionComponent = possessor->GetComponent<MissionComponent>();
|
2021-12-05 17:54:36 +00:00
|
|
|
auto* characterComponent = possessor->GetComponent<CharacterComponent>();
|
|
|
|
if (characterComponent != nullptr) {
|
|
|
|
characterComponent->UpdatePlayerStatistic(ImaginationPowerUpsCollected);
|
|
|
|
characterComponent->UpdatePlayerStatistic(RacingSmashablesSmashed);
|
|
|
|
}
|
2022-02-05 11:28:17 +00:00
|
|
|
if (missionComponent == nullptr) return;
|
|
|
|
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, self->GetLOT(), (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_SMASH_DRAGON_EGGS);
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|