From a9dea3688223792125f483bf99ac3f808a9370fb Mon Sep 17 00:00:00 2001 From: gsemaj Date: Wed, 13 Apr 2022 15:09:43 -0400 Subject: [PATCH] (WIP) onRoamStart hook implementation --- src/MobAI.cpp | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/src/MobAI.cpp b/src/MobAI.cpp index cc73de5..2a7661b 100644 --- a/src/MobAI.cpp +++ b/src/MobAI.cpp @@ -448,8 +448,7 @@ void Mob::deadStep(time_t currTime) { std::cout << "respawning mob " << id << " with HP = " << maxHealth << std::endl; - hp = maxHealth; - state = AIState::ROAMING; + transition(AIState::ROAMING, id); // if mob is a group leader/follower, spawn where the group is. if (groupLeader != 0) { @@ -720,19 +719,7 @@ void Mob::retreatStep(time_t currTime) { // if we got there //if (distance <= mob->data["m_iIdleRange"]) { if (distance <= 10) { // retreat back to the spawn point - state = AIState::ROAMING; - hp = maxHealth; - killedTime = 0; - nextAttack = 0; - cbf = 0; - - // cast a return home heal spell, this is the right way(tm) - std::vector targetData = {1, 0, 0, 0, 0}; - for (auto& pwr : Abilities::Powers) - if (pwr.skillType == Abilities::SkillTable[110].skillType) - pwr.handle(id, targetData, 110, Abilities::SkillTable[110].durationTime[0], Abilities::SkillTable[110].powerIntensity[0]); - // clear outlying debuffs - clearDebuff(this); + transition(AIState::ROAMING, id); } } @@ -741,7 +728,18 @@ void Mob::onInactive() { } void Mob::onRoamStart() { - // stub + hp = maxHealth; + killedTime = 0; + nextAttack = 0; + cbf = 0; + + // cast a return home heal spell, this is the right way(tm) + std::vector targetData = { 1, 0, 0, 0, 0 }; + for (auto& pwr : Abilities::Powers) + if (pwr.skillType == Abilities::SkillTable[110].skillType) + pwr.handle(id, targetData, 110, Abilities::SkillTable[110].durationTime[0], Abilities::SkillTable[110].powerIntensity[0]); + // clear outlying debuffs + clearDebuff(this); } void Mob::onCombatStart(EntityRef src) {