fix(Scripts/Karazhan): Shade of Aran now no longer casts spells whilst he should be drinking (#17282)
* initial * remove redundancy * remove method * space gone * indentación
This commit is contained in:
@@ -103,8 +103,6 @@ struct boss_shade_of_aran : public BossAI
|
|||||||
|
|
||||||
uint32 CurrentNormalSpell;
|
uint32 CurrentNormalSpell;
|
||||||
|
|
||||||
bool Drinking;
|
|
||||||
|
|
||||||
void Reset() override
|
void Reset() override
|
||||||
{
|
{
|
||||||
BossAI::Reset();
|
BossAI::Reset();
|
||||||
@@ -120,7 +118,7 @@ struct boss_shade_of_aran : public BossAI
|
|||||||
_fireCooledDown = true;
|
_fireCooledDown = true;
|
||||||
_frostCooledDown = true;
|
_frostCooledDown = true;
|
||||||
|
|
||||||
Drinking = false;
|
_drinking = false;
|
||||||
|
|
||||||
// Not in progress
|
// Not in progress
|
||||||
instance->SetData(DATA_ARAN, NOT_STARTED);
|
instance->SetData(DATA_ARAN, NOT_STARTED);
|
||||||
@@ -209,7 +207,7 @@ struct boss_shade_of_aran : public BossAI
|
|||||||
}
|
}
|
||||||
}).Schedule(1ms, [this](TaskContext context)
|
}).Schedule(1ms, [this](TaskContext context)
|
||||||
{
|
{
|
||||||
if (!me->IsNonMeleeSpellCast(false))
|
if (!me->IsNonMeleeSpellCast(false) && !_drinking)
|
||||||
{
|
{
|
||||||
Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100, true);
|
Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100, true);
|
||||||
if (!target)
|
if (!target)
|
||||||
@@ -244,6 +242,8 @@ struct boss_shade_of_aran : public BossAI
|
|||||||
}
|
}
|
||||||
context.Repeat(2s);
|
context.Repeat(2s);
|
||||||
}).Schedule(5s, [this](TaskContext context)
|
}).Schedule(5s, [this](TaskContext context)
|
||||||
|
{
|
||||||
|
if (!_drinking)
|
||||||
{
|
{
|
||||||
switch (urand(0, 1))
|
switch (urand(0, 1))
|
||||||
{
|
{
|
||||||
@@ -254,8 +254,11 @@ struct boss_shade_of_aran : public BossAI
|
|||||||
DoCastRandomTarget(SPELL_CHAINSOFICE);
|
DoCastRandomTarget(SPELL_CHAINSOFICE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
context.Repeat(5s, 20s);
|
context.Repeat(5s, 20s);
|
||||||
}).Schedule(35s, [this](TaskContext context)
|
}).Schedule(35s, [this](TaskContext context)
|
||||||
|
{
|
||||||
|
if (!_drinking)
|
||||||
{
|
{
|
||||||
uint8 Available[2];
|
uint8 Available[2];
|
||||||
|
|
||||||
@@ -328,7 +331,53 @@ struct boss_shade_of_aran : public BossAI
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
context.Repeat(35s, 40s);
|
context.Repeat(35s, 40s);
|
||||||
|
}).Schedule(1s, [this](TaskContext context){
|
||||||
|
if (me->GetMaxPower(POWER_MANA) && (me->GetPower(POWER_MANA) * 100 / me->GetMaxPower(POWER_MANA)) < 20)
|
||||||
|
{
|
||||||
|
_drinking = true;
|
||||||
|
me->InterruptNonMeleeSpells(true);
|
||||||
|
Talk(SAY_DRINK);
|
||||||
|
DoCastSelf(SPELL_MASS_POLY, true);
|
||||||
|
DoCastSelf(SPELL_CONJURE, false);
|
||||||
|
me->SetReactState(REACT_PASSIVE);
|
||||||
|
me->SetStandState(UNIT_STAND_STATE_SIT);
|
||||||
|
DoCastSelf(SPELL_DRINK, true);
|
||||||
|
_currentHealth = me->GetHealth();
|
||||||
|
drinkScheduler.Schedule(500ms, GROUP_DRINKING, [this](TaskContext context)
|
||||||
|
{
|
||||||
|
//check for damage to interrupt
|
||||||
|
if (me->GetHealth() < _currentHealth)
|
||||||
|
{
|
||||||
|
me->RemoveAurasDueToSpell(SPELL_DRINK);
|
||||||
|
me->SetStandState(UNIT_STAND_STATE_STAND);
|
||||||
|
me->SetReactState(REACT_AGGRESSIVE);
|
||||||
|
me->SetPower(POWER_MANA, me->GetMaxPower(POWER_MANA) - 32000);
|
||||||
|
DoCastSelf(SPELL_POTION, false);
|
||||||
|
DoCastSelf(SPELL_AOE_PYROBLAST, false);
|
||||||
|
drinkScheduler.CancelGroup(GROUP_DRINKING);
|
||||||
|
_drinking = false;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
context.Repeat(500ms);
|
||||||
|
}
|
||||||
|
}).Schedule(10s, GROUP_DRINKING, [this](TaskContext)
|
||||||
|
{
|
||||||
|
me->SetStandState(UNIT_STAND_STATE_STAND);
|
||||||
|
me->SetReactState(REACT_AGGRESSIVE);
|
||||||
|
me->SetPower(POWER_MANA, me->GetMaxPower(POWER_MANA) - 32000);
|
||||||
|
DoCastSelf(SPELL_POTION, true);
|
||||||
|
DoCastSelf(SPELL_AOE_PYROBLAST, false);
|
||||||
|
drinkScheduler.CancelGroup(GROUP_DRINKING);
|
||||||
|
_drinking = false;
|
||||||
|
});
|
||||||
|
context.Repeat(12s); //semi-arbitrary duration to envelop drinking duration
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
context.Repeat(1s);
|
||||||
|
}
|
||||||
}).Schedule(12min, [this](TaskContext context)
|
}).Schedule(12min, [this](TaskContext context)
|
||||||
{
|
{
|
||||||
for (uint32 i = 0; i < 5; ++i)
|
for (uint32 i = 0; i < 5; ++i)
|
||||||
@@ -389,65 +438,10 @@ struct boss_shade_of_aran : public BossAI
|
|||||||
if (!UpdateVictim())
|
if (!UpdateVictim())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!Drinking && me->GetMaxPower(POWER_MANA) && (me->GetPower(POWER_MANA) * 100 / me->GetMaxPower(POWER_MANA)) < 20)
|
if (_arcaneCooledDown && _fireCooledDown && _frostCooledDown)
|
||||||
{
|
|
||||||
Drinking = true;
|
|
||||||
me->InterruptNonMeleeSpells(false);
|
|
||||||
|
|
||||||
Talk(SAY_DRINK);
|
|
||||||
|
|
||||||
scheduler.DelayAll(10s);
|
|
||||||
DoCastSelf(SPELL_MASS_POLY, true);
|
|
||||||
DoCastSelf(SPELL_CONJURE, false);
|
|
||||||
me->SetReactState(REACT_PASSIVE);
|
|
||||||
me->SetStandState(UNIT_STAND_STATE_SIT);
|
|
||||||
DoCastSelf(SPELL_DRINK, true);
|
|
||||||
_currentHealth = me->GetHealth();
|
|
||||||
drinkScheduler.Schedule(500ms, GROUP_DRINKING, [this](TaskContext context)
|
|
||||||
{
|
|
||||||
//check for damage to interrupt
|
|
||||||
if(CheckDamageDuringDrinking(_currentHealth))
|
|
||||||
{
|
|
||||||
Drinking = false;
|
|
||||||
me->RemoveAurasDueToSpell(SPELL_DRINK);
|
|
||||||
me->SetStandState(UNIT_STAND_STATE_STAND);
|
|
||||||
me->SetReactState(REACT_AGGRESSIVE);
|
|
||||||
me->SetPower(POWER_MANA, me->GetMaxPower(POWER_MANA) - 32000);
|
|
||||||
DoCastSelf(SPELL_POTION, false);
|
|
||||||
DoCastSelf(SPELL_AOE_PYROBLAST, false);
|
|
||||||
drinkScheduler.CancelGroup(GROUP_DRINKING);
|
|
||||||
} else {
|
|
||||||
context.Repeat(500ms);
|
|
||||||
}
|
|
||||||
}).Schedule(10s, GROUP_DRINKING, [this](TaskContext)
|
|
||||||
{
|
|
||||||
me->SetStandState(UNIT_STAND_STATE_STAND);
|
|
||||||
me->SetReactState(REACT_AGGRESSIVE);
|
|
||||||
me->SetPower(POWER_MANA, me->GetMaxPower(POWER_MANA) - 32000);
|
|
||||||
DoCastSelf(SPELL_POTION, true);
|
|
||||||
DoCastSelf(SPELL_AOE_PYROBLAST, false);
|
|
||||||
|
|
||||||
Drinking = false;
|
|
||||||
drinkScheduler.CancelGroup(GROUP_DRINKING);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_arcaneCooledDown && _fireCooledDown && _frostCooledDown && !Drinking)
|
|
||||||
DoMeleeAttackIfReady();
|
DoMeleeAttackIfReady();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CheckDamageDuringDrinking(uint32 oldHealth)
|
|
||||||
{
|
|
||||||
if (Drinking)
|
|
||||||
{
|
|
||||||
if (me->GetHealth() < oldHealth)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SpellHit(Unit* /*pAttacker*/, SpellInfo const* Spell) override
|
void SpellHit(Unit* /*pAttacker*/, SpellInfo const* Spell) override
|
||||||
{
|
{
|
||||||
//We only care about interrupt effects and only if they are durring a spell currently being cast
|
//We only care about interrupt effects and only if they are durring a spell currently being cast
|
||||||
@@ -481,6 +475,7 @@ private:
|
|||||||
bool _arcaneCooledDown;
|
bool _arcaneCooledDown;
|
||||||
bool _fireCooledDown;
|
bool _fireCooledDown;
|
||||||
bool _frostCooledDown;
|
bool _frostCooledDown;
|
||||||
|
bool _drinking;
|
||||||
uint32 _currentHealth;
|
uint32 _currentHealth;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user