2021-12-05 17:54:36 +00:00
|
|
|
#include "BossSpiderQueenEnemyServer.h"
|
|
|
|
|
|
|
|
#include "GeneralUtils.h"
|
|
|
|
|
|
|
|
#include "MissionComponent.h"
|
|
|
|
#include "EntityManager.h"
|
|
|
|
#include "Entity.h"
|
|
|
|
#include "dZoneManager.h"
|
2022-07-05 06:00:10 +00:00
|
|
|
|
|
|
|
#include "DestroyableComponent.h"
|
|
|
|
#include "ControllablePhysicsComponent.h"
|
|
|
|
#include "BaseCombatAIComponent.h"
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
#include "GameMessages.h"
|
|
|
|
#include "SkillComponent.h"
|
2023-03-04 07:16:37 +00:00
|
|
|
#include "eReplicaComponentType.h"
|
2023-03-20 13:10:52 +00:00
|
|
|
#include "RenderComponent.h"
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
//----------------------------------------------------------------
|
|
|
|
//--On Startup, process necessary AI events
|
|
|
|
//----------------------------------------------------------------
|
|
|
|
void BossSpiderQueenEnemyServer::OnStartup(Entity* self) {
|
|
|
|
// Make immune to stuns
|
|
|
|
//self:SetStunImmunity{ StateChangeType = "PUSH", bImmuneToStunAttack = true, bImmuneToStunMove = true, bImmuneToStunTurn = true, bImmuneToStunUseItem = true, bImmuneToStunEquip = true, bImmuneToStunInteract = true, bImmuneToStunJump = true }
|
2022-07-25 02:26:51 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
// Make immune to knockbacks and pulls
|
|
|
|
//self:SetStatusImmunity{ StateChangeType = "PUSH", bImmuneToPullToPoint = true, bImmuneToKnockback = true, bImmuneToInterrupt = true }
|
|
|
|
|
|
|
|
//Get our components:
|
2023-03-04 07:16:37 +00:00
|
|
|
destroyable = static_cast<DestroyableComponent*>(self->GetComponent(eReplicaComponentType::DESTROYABLE));
|
|
|
|
controllable = static_cast<ControllablePhysicsComponent*>(self->GetComponent(eReplicaComponentType::CONTROLLABLE_PHYSICS));
|
|
|
|
combat = static_cast<BaseCombatAIComponent*>(self->GetComponent(eReplicaComponentType::BASE_COMBAT_AI));
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
if (!destroyable || !controllable) return;
|
|
|
|
|
|
|
|
// Determine Spider Boss health transition thresholds
|
|
|
|
int spiderBossHealth = destroyable->GetMaxHealth();
|
|
|
|
int transitionTickHealth = spiderBossHealth / 3;
|
|
|
|
|
|
|
|
int Stage2HealthThreshold = spiderBossHealth - transitionTickHealth;
|
|
|
|
int Stage3HealthThreshold = spiderBossHealth - (2 * transitionTickHealth);
|
|
|
|
ThresholdTable = { Stage2HealthThreshold, Stage3HealthThreshold };
|
|
|
|
|
|
|
|
originRotation = controllable->GetRotation();
|
|
|
|
combat->SetStunImmune(true);
|
|
|
|
|
|
|
|
m_CurrentBossStage = 1;
|
|
|
|
|
|
|
|
// Obtain faction and collision group to save for subsequent resets
|
|
|
|
}
|
|
|
|
|
|
|
|
void BossSpiderQueenEnemyServer::OnDie(Entity* self, Entity* killer) {
|
2023-10-22 21:53:54 +00:00
|
|
|
if (Game::zoneManager->GetZoneID().GetMapID() == instanceZoneID && killer) {
|
2021-12-05 17:54:36 +00:00
|
|
|
auto* missionComponent = killer->GetComponent<MissionComponent>();
|
|
|
|
if (missionComponent == nullptr)
|
|
|
|
return;
|
|
|
|
|
|
|
|
missionComponent->CompleteMission(instanceMissionID);
|
|
|
|
}
|
|
|
|
|
|
|
|
// There is suppose to be a 0.1 second delay here but that may be admitted?
|
2023-07-15 20:56:33 +00:00
|
|
|
auto* controller = Game::entityManager->GetZoneControlEntity();
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"SetColGroup", 10, 0, 0, "", UNASSIGNED_SYSTEM_ADDRESS);
|
|
|
|
|
|
|
|
self->SetPosition({ 10000, 0, 10000 });
|
|
|
|
|
2023-07-15 20:56:33 +00:00
|
|
|
Game::entityManager->SerializeEntity(self);
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
controller->OnFireEventServerSide(self, "ClearProperty");
|
|
|
|
}
|
|
|
|
|
|
|
|
void BossSpiderQueenEnemyServer::WithdrawSpider(Entity* self, const bool withdraw) {
|
|
|
|
const auto withdrawn = self->GetBoolean(u"isWithdrawn");
|
|
|
|
|
|
|
|
if (withdrawn == withdraw) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (withdraw) {
|
|
|
|
//Move spider away from battle zone
|
|
|
|
// Disabled because we cant option the reset collition group right now
|
|
|
|
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"SetColGroup", 10, 0, 0, "", UNASSIGNED_SYSTEM_ADDRESS);
|
|
|
|
|
|
|
|
//First rotate for anim
|
|
|
|
NiQuaternion rot = NiQuaternion::IDENTITY;
|
2022-07-25 02:26:51 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
controllable->SetStatic(false);
|
|
|
|
|
|
|
|
controllable->SetRotation(rot);
|
2022-07-25 02:26:51 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
controllable->SetStatic(true);
|
2022-07-25 02:26:51 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
controllable->SetDirtyPosition(true);
|
2022-07-25 02:26:51 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
rot = controllable->GetRotation();
|
|
|
|
|
2023-07-15 20:56:33 +00:00
|
|
|
Game::entityManager->SerializeEntity(self);
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
auto* baseCombatAi = self->GetComponent<BaseCombatAIComponent>();
|
|
|
|
|
|
|
|
baseCombatAi->SetDisabled(true);
|
|
|
|
|
|
|
|
float animTime = PlayAnimAndReturnTime(self, spiderWithdrawAnim);
|
|
|
|
float withdrawTime = animTime - 0.25f;
|
|
|
|
|
|
|
|
combat->SetStunImmune(false);
|
|
|
|
combat->Stun(withdrawTime + 6.0f);
|
|
|
|
combat->SetStunImmune(true);
|
|
|
|
|
|
|
|
//TODO: Set faction to -1 and set immunity
|
|
|
|
destroyable->SetFaction(-1);
|
|
|
|
destroyable->SetIsImmune(true);
|
2023-07-15 20:56:33 +00:00
|
|
|
Game::entityManager->SerializeEntity(self);
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
self->AddTimer("WithdrawComplete", withdrawTime + 1.0f);
|
|
|
|
waitForIdle = true;
|
|
|
|
} else {
|
|
|
|
controllable->SetStatic(false);
|
2022-07-25 02:26:51 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
//Cancel all remaining timers for say idle anims:
|
|
|
|
self->CancelAllTimers();
|
2022-07-25 02:26:51 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
auto* baseCombatAi = self->GetComponent<BaseCombatAIComponent>();
|
|
|
|
|
|
|
|
baseCombatAi->SetDisabled(false);
|
|
|
|
|
|
|
|
// Move the Spider to its ground location
|
|
|
|
// preparing its stage attacks, and removing invulnerability
|
|
|
|
//destroyable->SetIsImmune(false);
|
2022-07-25 02:26:51 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
// Run the advance animation and prepare a timer for resuming AI
|
|
|
|
float animTime = PlayAnimAndReturnTime(self, spiderAdvanceAnim);
|
|
|
|
animTime += 1.f;
|
|
|
|
|
|
|
|
float attackPause = animTime - 0.4f;
|
|
|
|
|
|
|
|
destroyable->SetFaction(4);
|
|
|
|
destroyable->SetIsImmune(false);
|
2022-07-25 02:26:51 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
//Advance stage
|
|
|
|
m_CurrentBossStage++;
|
|
|
|
|
|
|
|
//Reset the current wave death counter
|
|
|
|
m_DeathCounter = 0;
|
2022-07-25 02:26:51 +00:00
|
|
|
|
2023-07-15 20:56:33 +00:00
|
|
|
Game::entityManager->SerializeEntity(self);
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
// Prepare a timer for post leap attack
|
|
|
|
self->AddTimer("AdvanceAttack", attackPause);
|
|
|
|
|
2022-07-25 02:26:51 +00:00
|
|
|
// Prepare a timer for post leap
|
2021-12-05 17:54:36 +00:00
|
|
|
self->AddTimer("AdvanceComplete", animTime);
|
|
|
|
}
|
|
|
|
|
|
|
|
self->SetBoolean(u"isWithdrawn", withdraw);
|
|
|
|
}
|
|
|
|
|
|
|
|
void BossSpiderQueenEnemyServer::SpawnSpiderWave(Entity* self, int spiderCount) {
|
2022-07-25 02:26:51 +00:00
|
|
|
// The Spider Queen Boss is withdrawing and requesting the spawn
|
2021-12-05 17:54:36 +00:00
|
|
|
// of a hatchling wave
|
|
|
|
|
|
|
|
// Clamp invalid Spiderling number requests to the maximum amount of eggs available
|
|
|
|
if ((spiderCount > maxSpiderEggCnt) || (spiderCount < 0))
|
|
|
|
spiderCount = maxSpiderEggCnt;
|
|
|
|
|
|
|
|
// Reset our wave manager reference variables
|
|
|
|
hatchCounter = spiderCount;
|
|
|
|
hatchList = {};
|
|
|
|
|
|
|
|
// Run the wave manager
|
|
|
|
SpiderWaveManager(self);
|
|
|
|
}
|
|
|
|
|
|
|
|
void BossSpiderQueenEnemyServer::SpiderWaveManager(Entity* self) {
|
|
|
|
auto SpiderEggNetworkID = self->GetI64(u"SpiderEggNetworkID");
|
|
|
|
|
|
|
|
std::vector<LWOOBJID> spiderEggs{};
|
|
|
|
|
2023-07-15 20:56:33 +00:00
|
|
|
auto spooders = Game::entityManager->GetEntitiesInGroup("EGG");
|
2021-12-05 17:54:36 +00:00
|
|
|
for (auto spodder : spooders) {
|
|
|
|
spiderEggs.push_back(spodder->GetObjectID());
|
|
|
|
}
|
2022-07-25 02:26:51 +00:00
|
|
|
|
|
|
|
// Select a number of random spider eggs from the list equal to the
|
2021-12-05 17:54:36 +00:00
|
|
|
// current number needed to complete the current wave
|
2023-03-30 13:01:15 +00:00
|
|
|
if (!spiderEggs.empty()) {
|
|
|
|
for (int i = 0; i < hatchCounter; i++) {
|
|
|
|
// Select a random spider egg
|
|
|
|
auto randomEggLoc = GeneralUtils::GenerateRandomNumber<int>(0, spiderEggs.size() - 1);
|
|
|
|
auto randomEgg = spiderEggs[randomEggLoc];
|
|
|
|
|
|
|
|
//Just a quick check to try and prevent dupes:
|
|
|
|
for (auto en : hatchList) {
|
|
|
|
if (en == randomEgg) {
|
|
|
|
randomEggLoc++;
|
2023-10-23 14:56:12 +00:00
|
|
|
randomEgg = spiderEggs.at(randomEggLoc % spiderEggs.size());
|
2023-03-30 13:01:15 +00:00
|
|
|
}
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|
2022-07-25 02:26:51 +00:00
|
|
|
|
2023-03-30 13:01:15 +00:00
|
|
|
if (randomEgg) {
|
2023-07-15 20:56:33 +00:00
|
|
|
auto* eggEntity = Game::entityManager->GetEntity(randomEgg);
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2023-03-30 13:01:15 +00:00
|
|
|
if (eggEntity == nullptr) {
|
|
|
|
continue;
|
|
|
|
}
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2023-03-30 13:01:15 +00:00
|
|
|
// Prep the selected spider egg
|
|
|
|
eggEntity->OnFireEventServerSide(self, "prepEgg");
|
2022-07-25 02:26:51 +00:00
|
|
|
|
2023-03-30 13:01:15 +00:00
|
|
|
// Add the prepped egg to our hatchList
|
|
|
|
hatchList.push_back(eggEntity->GetObjectID());
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2023-03-30 13:01:15 +00:00
|
|
|
// Decrement the hatchCounter
|
|
|
|
hatchCounter = hatchCounter - 1;
|
|
|
|
}
|
2022-07-25 02:26:51 +00:00
|
|
|
|
2023-03-30 13:01:15 +00:00
|
|
|
// Remove it from our spider egg list
|
|
|
|
spiderEggs[randomEggLoc] = LWOOBJID_EMPTY;
|
2022-07-25 02:26:51 +00:00
|
|
|
|
2023-03-30 13:01:15 +00:00
|
|
|
if (spiderEggs.size() <= 0 || (hatchCounter <= 0)) {
|
|
|
|
break;
|
|
|
|
}
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|
|
|
|
}
|
2022-07-25 02:26:51 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
if (hatchCounter > 0) {
|
|
|
|
// We still have more eggs to hatch, poll the SpiderWaveManager again
|
|
|
|
self->AddTimer("PollSpiderWaveManager", 1.0f);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
// We have successfully readied a full wave
|
|
|
|
// initiate hatching!
|
|
|
|
for (auto egg : hatchList) {
|
2023-07-15 20:56:33 +00:00
|
|
|
auto* eggEntity = Game::entityManager->GetEntity(egg);
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
if (eggEntity == nullptr) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
eggEntity->OnFireEventServerSide(self, "hatchEgg");
|
|
|
|
|
|
|
|
auto time = PlayAnimAndReturnTime(self, spiderWithdrawIdle);
|
|
|
|
combat->SetStunImmune(false);
|
|
|
|
combat->Stun(time += 6.0f);
|
|
|
|
combat->SetStunImmune(true);
|
2022-07-25 02:26:51 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
self->AddTimer("checkForSpiders", 6.0f);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
hatchList.clear();
|
2022-07-25 02:26:51 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void BossSpiderQueenEnemyServer::ToggleForSpecial(Entity* self, const bool state) {
|
|
|
|
self->SetBoolean(u"stoppedFlag", state);
|
|
|
|
|
|
|
|
combat->SetDisabled(state);
|
|
|
|
}
|
|
|
|
|
|
|
|
void BossSpiderQueenEnemyServer::RunRainOfFire(Entity* self) {
|
|
|
|
if (self->GetBoolean(u"stoppedFlag")) {
|
|
|
|
self->AddTimer("ROF", GeneralUtils::GenerateRandomNumber<float>(10, 20));
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ToggleForSpecial(self, true);
|
|
|
|
|
|
|
|
impactList.clear();
|
|
|
|
|
|
|
|
auto index = 0u;
|
|
|
|
for (const auto& rofGroup : ROFTargetGroupIDTable) {
|
2023-07-17 22:55:33 +00:00
|
|
|
const auto spawners = Game::zoneManager->GetSpawnersInGroup(rofGroup);
|
2022-07-25 02:26:51 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
std::vector<LWOOBJID> spawned;
|
|
|
|
|
|
|
|
for (auto* spawner : spawners) {
|
|
|
|
for (const auto* node : spawner->m_Info.nodes) {
|
|
|
|
spawned.insert(spawned.end(), node->entities.begin(), node->entities.end());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (index == 0) {
|
|
|
|
impactList.insert(impactList.end(), spawned.begin(), spawned.end());
|
2023-10-23 14:56:12 +00:00
|
|
|
} else if (!spawned.empty()) {
|
2021-12-05 17:54:36 +00:00
|
|
|
const auto randomIndex = GeneralUtils::GenerateRandomNumber<int32_t>(0, spawned.size() - 1);
|
|
|
|
|
|
|
|
impactList.push_back(spawned[randomIndex]);
|
|
|
|
}
|
|
|
|
|
|
|
|
index++;
|
|
|
|
}
|
|
|
|
|
|
|
|
const auto animTime = PlayAnimAndReturnTime(self, spiderROFAnim);
|
|
|
|
|
|
|
|
self->AddTimer("StartROF", animTime);
|
|
|
|
}
|
|
|
|
|
2022-07-25 02:26:51 +00:00
|
|
|
void BossSpiderQueenEnemyServer::RainOfFireManager(Entity* self) {
|
2021-12-05 17:54:36 +00:00
|
|
|
if (!impactList.empty()) {
|
2023-07-15 20:56:33 +00:00
|
|
|
auto* entity = Game::entityManager->GetEntity(impactList[0]);
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
impactList.erase(impactList.begin());
|
|
|
|
|
|
|
|
if (entity == nullptr) {
|
2023-10-21 23:31:55 +00:00
|
|
|
LOG("Failed to find impact!");
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
auto* skillComponent = entity->GetComponent<SkillComponent>();
|
|
|
|
|
|
|
|
if (skillComponent == nullptr) {
|
2023-10-21 23:31:55 +00:00
|
|
|
LOG("Failed to find impact skill component!");
|
2022-07-25 02:26:51 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
skillComponent->CalculateBehavior(1376, 32168, LWOOBJID_EMPTY, true);
|
|
|
|
|
|
|
|
self->AddTimer("PollROFManager", 0.5f);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ToggleForSpecial(self, false);
|
2022-07-25 02:26:51 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
self->AddTimer("ROF", GeneralUtils::GenerateRandomNumber<float>(20, 40));
|
|
|
|
}
|
|
|
|
|
|
|
|
void BossSpiderQueenEnemyServer::RapidFireShooterManager(Entity* self) {
|
|
|
|
if (attackTargetTable.empty()) {
|
|
|
|
const auto animationTime = PlayAnimAndReturnTime(self, spiderJeerAnim);
|
|
|
|
|
|
|
|
self->AddTimer("RFSTauntComplete", animationTime);
|
|
|
|
|
|
|
|
ToggleForSpecial(self, false);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const auto target = attackTargetTable[0];
|
2022-07-25 02:26:51 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
auto* skillComponent = self->GetComponent<SkillComponent>();
|
|
|
|
|
|
|
|
skillComponent->CalculateBehavior(1394, 32612, target, true);
|
|
|
|
|
|
|
|
attackTargetTable.erase(attackTargetTable.begin());
|
|
|
|
|
|
|
|
self->AddTimer("PollRFSManager", 0.3f);
|
|
|
|
}
|
|
|
|
|
2022-07-25 02:26:51 +00:00
|
|
|
void BossSpiderQueenEnemyServer::RunRapidFireShooter(Entity* self) {
|
2021-12-05 17:54:36 +00:00
|
|
|
const auto targets = self->GetTargetsInPhantom();
|
|
|
|
|
|
|
|
if (self->GetBoolean(u"stoppedFlag")) {
|
|
|
|
self->AddTimer("RFS", GeneralUtils::GenerateRandomNumber<float>(5, 10));
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (targets.empty()) {
|
2023-10-21 23:31:55 +00:00
|
|
|
LOG("Failed to find RFS targets");
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
self->AddTimer("RFS", GeneralUtils::GenerateRandomNumber<float>(5, 10));
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ToggleForSpecial(self, true);
|
|
|
|
|
|
|
|
const auto randomTarget = GeneralUtils::GenerateRandomNumber<int32_t>(0, targets.size() - 1);
|
|
|
|
|
|
|
|
auto attackFocus = targets[randomTarget];
|
|
|
|
|
|
|
|
attackTargetTable.push_back(attackFocus);
|
|
|
|
|
|
|
|
auto* skillComponent = self->GetComponent<SkillComponent>();
|
|
|
|
|
|
|
|
skillComponent->CalculateBehavior(1480, 36652, attackFocus, true);
|
|
|
|
|
|
|
|
RapidFireShooterManager(self);
|
|
|
|
|
|
|
|
PlayAnimAndReturnTime(self, spiderSingleShot);
|
|
|
|
|
|
|
|
self->AddTimer("RFS", GeneralUtils::GenerateRandomNumber<float>(10, 15));
|
|
|
|
}
|
|
|
|
|
|
|
|
void BossSpiderQueenEnemyServer::OnTimerDone(Entity* self, const std::string timerName) {
|
|
|
|
if (timerName == "PollSpiderWaveManager") {
|
|
|
|
//Call the manager again to attempt to finish prepping a Spiderling wave
|
|
|
|
//Run the wave manager
|
|
|
|
SpiderWaveManager(self);
|
|
|
|
} else if (timerName == "disableWaitForIdle") { waitForIdle = false; } else if (timerName == "checkForSpiders") {
|
|
|
|
//Don't do anything if we ain't withdrawn:
|
|
|
|
const auto withdrawn = self->GetBoolean(u"isWithdrawn");
|
|
|
|
if (!withdrawn) return;
|
|
|
|
|
|
|
|
NiQuaternion rot = NiQuaternion::IDENTITY;
|
|
|
|
|
|
|
|
//First rotate for anim
|
|
|
|
controllable->SetStatic(false);
|
|
|
|
controllable->SetRotation(rot);
|
|
|
|
controllable->SetStatic(true);
|
2023-07-15 20:56:33 +00:00
|
|
|
Game::entityManager->SerializeEntity(self);
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
//Play the Spider Boss' mountain idle anim
|
|
|
|
auto time = PlayAnimAndReturnTime(self, spiderWithdrawIdle);
|
|
|
|
combat->SetStunImmune(false);
|
|
|
|
combat->Stun(time);
|
|
|
|
combat->SetStunImmune(true);
|
|
|
|
|
|
|
|
rot = controllable->GetRotation();
|
|
|
|
|
|
|
|
//If there are still baby spiders, don't do anyhting either
|
2023-07-15 20:56:33 +00:00
|
|
|
const auto spiders = Game::entityManager->GetEntitiesInGroup("BabySpider");
|
2022-07-25 02:26:51 +00:00
|
|
|
if (spiders.size() > 0)
|
2021-12-05 17:54:36 +00:00
|
|
|
self->AddTimer("checkForSpiders", time);
|
|
|
|
else
|
|
|
|
WithdrawSpider(self, false);
|
|
|
|
} else if (timerName == "PollROFManager") {
|
|
|
|
//Call the manager again to attempt to initiate an impact on another random location
|
|
|
|
//Run the ROF Manager
|
|
|
|
RainOfFireManager(self);
|
2022-07-25 02:26:51 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
} else if (timerName == "PollRFSManager") {
|
|
|
|
//Call the manager again to attempt to initiate a rapid fire shot at the next sequential target
|
|
|
|
//Run the ROF Manager
|
|
|
|
RapidFireShooterManager(self);
|
2022-07-25 02:26:51 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
} else if (timerName == "StartROF") {
|
|
|
|
//Re-enable Spider Boss
|
|
|
|
//ToggleForSpecial(self, false);
|
2022-07-25 02:26:51 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
RainOfFireManager(self);
|
2022-07-25 02:26:51 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
} else if (timerName == "PollSpiderSkillManager") {
|
|
|
|
//Call the skill manager again to attempt to run the current Spider Boss
|
|
|
|
//stage's special attack again
|
|
|
|
//SpiderSkillManager(self, true);
|
|
|
|
PlayAnimAndReturnTime(self, spiderJeerAnim);
|
2022-07-25 02:26:51 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
} else if (timerName == "RFS") {
|
|
|
|
RunRapidFireShooter(self);
|
|
|
|
} else if (timerName == "ROF") {
|
|
|
|
RunRainOfFire(self);
|
2022-07-25 02:26:51 +00:00
|
|
|
} else if (timerName == "RFSTauntComplete") {
|
|
|
|
//Determine an appropriate random time to check our manager again
|
2021-12-05 17:54:36 +00:00
|
|
|
// local spiderCooldownDelay = math.random(s1DelayMin, s1DelayMax)
|
|
|
|
|
|
|
|
//Set a timer based on our random cooldown determination
|
|
|
|
//to pulse the SpiderSkillManager again
|
|
|
|
|
|
|
|
//GAMEOBJ:GetTimer():AddTimerWithCancel(spiderCooldownDelay, "PollSpiderSkillManager", self)
|
|
|
|
|
|
|
|
//Re-enable Spider Boss
|
|
|
|
//ToggleForSpecial(self, false);
|
2022-07-25 02:26:51 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
} else if (timerName == "WithdrawComplete") {
|
|
|
|
//Play the Spider Boss' mountain idle anim
|
|
|
|
PlayAnimAndReturnTime(self, spiderWithdrawIdle);
|
|
|
|
|
|
|
|
//The Spider Boss has retreated, hatch a wave!
|
|
|
|
int currentStage = m_CurrentBossStage;
|
|
|
|
|
|
|
|
//Prepare a Spiderling wave and initiate egg hatch events
|
|
|
|
//self->SetVar(u"SpiderWaveCount", )
|
|
|
|
|
|
|
|
//TODO: Actually spawn the spiders here
|
|
|
|
hatchCounter = 2;
|
|
|
|
if (currentStage > 1) hatchCounter++;
|
|
|
|
|
|
|
|
SpawnSpiderWave(self, spiderWaveCntTable[currentStage - 1]);
|
2022-07-25 02:26:51 +00:00
|
|
|
|
|
|
|
} else if (timerName == "AdvanceAttack") {
|
2021-12-05 17:54:36 +00:00
|
|
|
//TODO: Can we even do knockbacks yet? @Wincent01
|
|
|
|
// Yes ^
|
|
|
|
|
|
|
|
//Fire the melee smash skill to throw players back
|
|
|
|
/*local landingTarget = self:GetVar("LandingTarget") or false
|
2022-07-25 02:26:51 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
if((landingTarget) and (landingTarget:Exists())) {
|
|
|
|
local advSmashFlag = landingTarget:CastSkill{skillID = bossLandingSkill}
|
|
|
|
landingTarget:PlayEmbeddedEffectOnAllClientsNearObject{radius = 100, fromObjectID = landingTarget, effectName = "camshake-bridge"}
|
|
|
|
}*/
|
2022-07-25 02:26:51 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
auto landingTarget = self->GetI64(u"LandingTarget");
|
2023-07-15 20:56:33 +00:00
|
|
|
auto landingEntity = Game::entityManager->GetEntity(landingTarget);
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
auto* skillComponent = self->GetComponent<SkillComponent>();
|
|
|
|
|
|
|
|
if (skillComponent != nullptr) {
|
|
|
|
skillComponent->CalculateBehavior(bossLandingSkill, 37739, LWOOBJID_EMPTY);
|
|
|
|
}
|
2022-07-25 02:26:51 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
if (landingEntity) {
|
|
|
|
auto* landingSkill = landingEntity->GetComponent<SkillComponent>();
|
|
|
|
|
|
|
|
if (landingSkill != nullptr) {
|
|
|
|
landingSkill->CalculateBehavior(bossLandingSkill, 37739, LWOOBJID_EMPTY, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
GameMessages::SendPlayEmbeddedEffectOnAllClientsNearObject(self, u"camshake-bridge", self->GetObjectID(), 100.0f);
|
2022-07-25 02:26:51 +00:00
|
|
|
|
|
|
|
} else if (timerName == "AdvanceComplete") {
|
2021-12-05 17:54:36 +00:00
|
|
|
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"SetColGroup", 11, 0, 0, "", UNASSIGNED_SYSTEM_ADDRESS);
|
|
|
|
|
|
|
|
//Wind up, telegraphing next round
|
|
|
|
float animTime = PlayAnimAndReturnTime(self, spiderJeerAnim);
|
|
|
|
self->AddTimer("AdvanceTauntComplete", animTime);
|
2022-07-25 02:26:51 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
} else if (timerName == "AdvanceTauntComplete") {
|
2022-07-25 02:26:51 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
//Declare a default special Spider Boss skill cooldown
|
|
|
|
int spiderCooldownDelay = 10;
|
|
|
|
|
|
|
|
if (m_CurrentBossStage == 2) {
|
|
|
|
spiderCooldownDelay = GeneralUtils::GenerateRandomNumber<int>(s1DelayMin, s1DelayMax);
|
|
|
|
} else if (m_CurrentBossStage == 3) {
|
|
|
|
spiderCooldownDelay = GeneralUtils::GenerateRandomNumber<int>(s2DelayMin, s2DelayMax);
|
|
|
|
}
|
|
|
|
|
|
|
|
//Set a timer based on our random cooldown determination
|
|
|
|
//to pulse the SpiderSkillManager
|
|
|
|
self->AddTimer("PollSpiderSkillManager", spiderCooldownDelay);
|
2022-07-25 02:26:51 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
//Remove current status immunity
|
|
|
|
/*self:SetStatusImmunity{ StateChangeType = "POP", bImmuneToSpeed = true, bImmuneToBasicAttack = true, bImmuneToDOT = true}
|
2022-07-25 02:26:51 +00:00
|
|
|
|
|
|
|
self:SetStunned{StateChangeType = "POP",
|
2021-12-05 17:54:36 +00:00
|
|
|
bCantMove = true,
|
|
|
|
bCantJump = true,
|
|
|
|
bCantTurn = true,
|
|
|
|
bCantAttack = true,
|
|
|
|
bCantUseItem = true,
|
|
|
|
bCantEquip = true,
|
|
|
|
bCantInteract = true,
|
|
|
|
bIgnoreImmunity = true}*/
|
|
|
|
|
|
|
|
destroyable->SetIsImmune(false);
|
|
|
|
destroyable->SetFaction(4);
|
|
|
|
|
2023-07-15 20:56:33 +00:00
|
|
|
Game::entityManager->SerializeEntity(self);
|
2022-07-25 02:26:51 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
} else if (timerName == "Clear") {
|
2023-07-15 20:56:33 +00:00
|
|
|
Game::entityManager->FireEventServerSide(self, "ClearProperty");
|
2021-12-05 17:54:36 +00:00
|
|
|
self->CancelAllTimers();
|
|
|
|
} else if (timerName == "UnlockSpecials") {
|
|
|
|
//We no longer need to lock specials
|
|
|
|
self->SetBoolean(u"bSpecialLock", false);
|
2022-07-25 02:26:51 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
//Did we queue a spcial attack?
|
|
|
|
if (self->GetBoolean(u"bSpecialQueued")) {
|
|
|
|
self->SetBoolean(u"bSpecialQueued", false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void BossSpiderQueenEnemyServer::OnHitOrHealResult(Entity* self, Entity* attacker, int32_t damage) {
|
|
|
|
if (m_CurrentBossStage > 0 && !self->HasTimer("RFS")) {
|
|
|
|
self->AddTimer("RFS", 5.0f);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_CurrentBossStage > 0 && !self->HasTimer("ROF")) {
|
|
|
|
self->AddTimer("ROF", 10.0f);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_CurrentBossStage > ThresholdTable.size()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
int currentThreshold = ThresholdTable[m_CurrentBossStage - 1];
|
|
|
|
|
|
|
|
if (destroyable->GetHealth() <= currentThreshold) {
|
|
|
|
auto isWithdrawn = self->GetBoolean(u"isWithdrawn");
|
|
|
|
|
|
|
|
if (!isWithdrawn) {
|
|
|
|
self->CancelAllTimers();
|
|
|
|
|
|
|
|
self->SetBoolean(u"isSpecialAttacking", false);
|
|
|
|
self->SetBoolean(u"bSpecialLock", false);
|
|
|
|
|
|
|
|
WithdrawSpider(self, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void BossSpiderQueenEnemyServer::OnUpdate(Entity* self) {
|
|
|
|
auto isWithdrawn = self->GetBoolean(u"isWithdrawn");
|
|
|
|
|
|
|
|
if (!isWithdrawn) return;
|
|
|
|
|
|
|
|
if (controllable->GetRotation() == NiQuaternion::IDENTITY) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
controllable->SetStatic(false);
|
|
|
|
controllable->SetRotation(NiQuaternion::IDENTITY);
|
|
|
|
controllable->SetStatic(true);
|
|
|
|
|
2023-07-15 20:56:33 +00:00
|
|
|
Game::entityManager->SerializeEntity(self);
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------
|
|
|
|
//--Utility function capable of playing a priority
|
|
|
|
//-- animation on a targetand returning either the
|
|
|
|
//-- anim time, or a desired default
|
|
|
|
//----------------------------------------------
|
|
|
|
float BossSpiderQueenEnemyServer::PlayAnimAndReturnTime(Entity* self, const std::u16string& animID) {
|
|
|
|
//TODO: Get the actual animation time
|
|
|
|
|
|
|
|
// Get the anim time
|
2023-03-20 13:10:52 +00:00
|
|
|
float animTimer = RenderComponent::GetAnimationTime(self, animID);
|
2022-07-25 02:26:51 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
// If we have an animation play it
|
|
|
|
if (animTimer > 0) {
|
2023-03-20 13:10:52 +00:00
|
|
|
animTimer = RenderComponent::PlayAnimation(self, animID);
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|
2022-07-25 02:26:51 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
// If the anim time is less than the the default time use default
|
|
|
|
if (animTimer < defaultAnimPause) {
|
|
|
|
animTimer = defaultAnimPause;
|
|
|
|
}
|
2022-07-25 02:26:51 +00:00
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
return animTimer;
|
|
|
|
}
|