Skip to content

Commit

Permalink
Botanica: Laj shouldnt target a player after using teleport spell
Browse files Browse the repository at this point in the history
Laj should get CombatMovement again after summoning her minnions
Closes #675
  • Loading branch information
miraco authored and killerwife committed Jul 3, 2024
1 parent 277e707 commit 0861014
Showing 1 changed file with 38 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,29 @@ struct boss_lajAI : public CombatAI
AddCustomAction(LAJ_TELEPORT_SUMMON, true, [&]() { HandleTeleportSummon(); }, TIMER_COMBAT_COMBAT);
}

GuidVector m_spawns;

void Reset() override
{
SetCombatMovement(true);
SetCombatScriptStatus(false);
DespawnGuids(m_spawns);
CombatAI::Reset();
}

void EnterEvadeMode() override
{
SetCombatMovement(true);
SetCombatScriptStatus(false);
DespawnGuids(m_spawns);
CombatAI::EnterEvadeMode();
}

void JustDied(Unit* /*killer*/) override
{
DespawnGuids(m_spawns);
}

void AddTransformCooldowns(uint32 spellId)
{
if (spellId != SPELL_LAJ_ARCANE)
Expand Down Expand Up @@ -113,6 +136,8 @@ struct boss_lajAI : public CombatAI
summoned->AI()->DoCastSpellIfCan(nullptr, SPELL_ROOT_SELF, CAST_TRIGGERED | CAST_AURA_NOT_PRESENT);
if (Unit* target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0, nullptr, SELECT_FLAG_PLAYER))
summoned->AI()->AttackStart(target);

m_spawns.push_back(summoned->GetObjectGuid());
}

void OnSpellCast(SpellEntry const* spellInfo, Unit* /*target*/) override
Expand All @@ -124,7 +149,15 @@ struct boss_lajAI : public CombatAI
case SPELL_LAJ_FROST:
case SPELL_LAJ_NATURE:
case SPELL_LAJ_SHADOW: AddTransformCooldowns(spellInfo->Id); break;
case SPELL_TELEPORT_SELF: SetCombatMovement(false, true); ResetTimer(LAJ_TELEPORT_SUMMON, 4000); break;
case SPELL_TELEPORT_SELF:
// Remove CombatMovement
SetCombatMovement(false, true);
// Remove the target focus
SetCombatScriptStatus(true);
SetMeleeEnabled(false);
m_creature->SetTarget(nullptr);
ResetTimer(LAJ_TELEPORT_SUMMON, 4000);
break;
}
}

Expand All @@ -133,8 +166,10 @@ struct boss_lajAI : public CombatAI
DoSummons();
DoBroadcastText(EMOTE_SUMMON, m_creature);

if (m_creature->GetVictim())
m_creature->GetMotionMaster()->MoveChase(m_creature->GetVictim());
SetCombatScriptStatus(false);

SetMeleeEnabled(true);
SetCombatMovement(true, true);
}
};

Expand Down

0 comments on commit 0861014

Please sign in to comment.