mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-18 11:25:42 +00:00
fix(Scripts/Karazhan): fixing the Aran drink routine and reset behavior (#17849)
* fix(Scripts/Karazhan) Fixed drinking behavior * fix(Scripts/Karazhan) Cleanup comments * fix(Scripts/Karazhan) Cleanup whitespace
This commit is contained in:
@@ -107,9 +107,12 @@ struct boss_shade_of_aran : public BossAI
|
||||
void Reset() override
|
||||
{
|
||||
BossAI::Reset();
|
||||
// Reset the mana of the boss fully before resetting drinking
|
||||
// If this was omitted, the boss would start drinking on reset if the mana was low on a wipe
|
||||
me->SetPower(POWER_MANA, me->GetMaxPower(POWER_MANA));
|
||||
_drinkScheduler.CancelAll();
|
||||
_lastSuperSpell = 0;
|
||||
|
||||
_lastSuperSpell = 0;
|
||||
_currentNormalSpell = 0;
|
||||
|
||||
_drinking = false;
|
||||
@@ -203,27 +206,28 @@ struct boss_shade_of_aran : public BossAI
|
||||
void OnPowerUpdate(Powers /*power*/, int32 /*gain*/, int32 /*updateVal*/, uint32 currentPower) override
|
||||
{
|
||||
// Should drink at 10%, need 10% mana for mass polymorph
|
||||
if (!_hasDrunk && me->GetMaxPower(POWER_MANA) && (currentPower * 100 / me->GetMaxPower(POWER_MANA)) < 13)
|
||||
if (!_hasDrunk && me->GetMaxPower(POWER_MANA) && (currentPower * 100 / me->GetMaxPower(POWER_MANA)) < 13.5)
|
||||
{
|
||||
_drinking = true;
|
||||
_hasDrunk = true;
|
||||
me->InterruptNonMeleeSpells(true);
|
||||
me->RemoveAurasDueToSpell(SPELL_ARCANE_MISSILE);
|
||||
Talk(SAY_DRINK);
|
||||
me->SetReactState(REACT_PASSIVE);
|
||||
|
||||
// Start drinking after conjuring drinks
|
||||
_drinkScheduler.Schedule(1s, GROUP_DRINKING, [this](TaskContext)
|
||||
_drinkScheduler.Schedule(0s, GROUP_DRINKING, [this](TaskContext)
|
||||
{
|
||||
me->InterruptNonMeleeSpells(true);
|
||||
me->RemoveAurasDueToSpell(SPELL_ARCANE_MISSILE);
|
||||
Talk(SAY_DRINK);
|
||||
DoCastAOE(SPELL_MASS_POLY);
|
||||
}).Schedule(2s, GROUP_DRINKING, [this](TaskContext)
|
||||
// If we set drinking earlier it will break when someone attacks aran while casting poly
|
||||
_drinking = true;
|
||||
}).Schedule(3s, GROUP_DRINKING, [this](TaskContext)
|
||||
{
|
||||
DoCastSelf(SPELL_CONJURE);
|
||||
}).Schedule(4s, GROUP_DRINKING, [this](TaskContext)
|
||||
}).Schedule(6s, GROUP_DRINKING, [this](TaskContext)
|
||||
{
|
||||
me->SetStandState(UNIT_STAND_STATE_SIT);
|
||||
DoCastSelf(SPELL_DRINK);
|
||||
}).Schedule(10s, GROUP_DRINKING, [this](TaskContext)
|
||||
}).Schedule(12s, GROUP_DRINKING, [this](TaskContext)
|
||||
{
|
||||
me->SetStandState(UNIT_STAND_STATE_STAND);
|
||||
me->SetReactState(REACT_AGGRESSIVE);
|
||||
@@ -303,7 +307,20 @@ struct boss_shade_of_aran : public BossAI
|
||||
DoCastSelf(SPELL_BLINK_CENTER, true);
|
||||
|
||||
std::vector<uint32> superSpells = { SPELL_SUMMON_BLIZZARD, SPELL_AEXPLOSION, SPELL_FLAME_WREATH };
|
||||
_lastSuperSpell = Acore::Containers::SelectRandomContainerElementIf(superSpells, [&](uint32 superSpell) -> bool { return superSpell != _lastSuperSpell; });
|
||||
|
||||
// Workaround for SelectRandomContainerElementIf
|
||||
std::vector<uint32> allowedSpells;
|
||||
std::copy_if(superSpells.begin(), superSpells.end(), std::back_inserter(allowedSpells), [&](uint32 superSpell) -> bool { return superSpell != _lastSuperSpell; });
|
||||
_lastSuperSpell = allowedSpells[urand(0, allowedSpells.size() - 1)];
|
||||
|
||||
// SelectRandomContainerElementIf produces unexpected output. Reintroduce when issue is resolved:
|
||||
// Sample results:
|
||||
// Selected Super Spell: 3722304989
|
||||
// superSpells elements : 29969 29973 30004
|
||||
// _lastSuperSpell = Acore::Containers::SelectRandomContainerElementIf(superSpells, [&](uint32 superSpell) -> bool { return superSpell != _lastSuperSpell; });
|
||||
|
||||
me->InterruptNonMeleeSpells(true); // Super spell should have prio over normal spells
|
||||
|
||||
switch (_lastSuperSpell)
|
||||
{
|
||||
case SPELL_AEXPLOSION:
|
||||
|
||||
Reference in New Issue
Block a user