Resolve AI Casting bug in Sapphiron AI

This commit is contained in:
郑佩茹
2022-09-25 10:48:31 -06:00
parent 13c17bee17
commit 757e1ee0b3
2 changed files with 67 additions and 15 deletions

View File

@@ -18,7 +18,7 @@ REPLACE INTO `creature_template` (`entry`, `modelid1`, `name`, `subname`, `minle
(351015, 15942, "Tomb Horror", "", 61, 61, 21, 1.0, 1.42857, 20.0, 1.0, 1, 0, 27.35, 2000, 2700, 1.0, 1.0, 1, 64, 2048, 0, 6, 72, 351015, 0, 0, 1, 19891, 'SmartAI', 1, 1.0, 35.0, 1.0, 1.15, 1.0, 144, 1, 1023393531, 0, 0, ''),
(351016, 16594, "Naxxramas Cultist", "", 61, 61, 21, 1.0, 1.42857, 20.0, 1.0, 1, 0, 30.75, 2000, 3700, 1.0, 1.0, 8, 32832, 2048, 0, 7, 72, 351016, 0, 0, 1206, 9596, 'SmartAI', 0, 1.0, 12.0, 10.0, 2.2, 1.0, 144, 1, 1023391483, 0, 0, ''),
(351017, 16598, "Naxxramas Acolyte", "", 61, 61, 21, 1.0, 1.42857, 20.0, 1.0, 1, 0, 30.75, 2000, 3700, 1.0, 1.0, 8, 32832, 2048, 0, 7, 72, 351017, 0, 0, 1248, 9661, 'SmartAI', 0, 1.0, 12.0, 10.0, 2.2, 1.0, 144, 1, 1023391483, 0, 0, ''),
(351018, 16033, "Sapphiron", "", 63, 63, 21, 1.0, 2.14286, 20.0, 1.0, 3, 0, 63.0, 1800, 1700, 1.0, 1.0, 1, 0, 2048, 0, 6, 76, 351018, 0, 0, 246755, 322238, '', 0, 1.0, 950.0, 2.0, 1.3, 1.0, 188, 1, 2093694843, 16, 1073741825, 'boss_sapphiron_40'),
(351018, 16033, "Sapphiron", "", 63, 63, 21, 1.0, 2.14286, 20.0, 1.0, 3, 0, 63.0, 1800, 1700, 1.0, 1.0, 1, 0, 2048, 0, 6, 76, 351018, 0, 0, 246755, 322238, '', 0, 1.0, 950.0, 2.0, 1.3, 1.0, 188, 1, 2093694843, 16, 1073741825, 'boss_sapphiron'),
(351019, 15945, "Kel'Thuzad", "", 63, 63, 21, 1.0, 1.14286, 20.0, 1.0, 3, 0, 62.5, 2500, 2000, 1.0, 1.0, 2, 0, 2048, 0, 6, 76, 351019, 0, 0, 1002755, 1457838, '', 0, 1.0, 1200.0, 600.0, 1.3, 1.0, 0, 1, 2093694843, 0, 3221225473, 'boss_kelthuzad_40'),
(351020, 16110, "Loatheb", "", 63, 63, 21, 0.8, 2.0, 20.0, 1.0, 3, 0, 50.0, 1250, 1700, 1.0, 1.0, 1, 64, 2048, 0, 6, 76, 351020, 0, 0, 1292142, 1579285, '', 0, 1.0, 1600.0, 2.0, 1.5, 1.0, 180, 1, 2093694843, 0, 1073741825, 'boss_loatheb_40'),
(351021, 9760, "Patchwork Golem", "", 61, 61, 21, 1.0, 1.42857, 20.0, 1.0, 1, 0, 37.5, 2500, 3700, 1.0, 1.0, 1, 64, 2048, 0, 6, 72, 351021, 0, 0, 3798, 4965, 'SmartAI', 0, 1.0, 28.0, 2.0, 1.15, 1.0, 144, 1, 1022066674, 0, 0, ''),

View File

@@ -46,7 +46,15 @@ enum Spells
SPELL_FROST_EXPLOSION = 28524,
// Visuals
SPELL_SAPPHIRON_DIES = 29357
SPELL_SAPPHIRON_DIES = 29357,
// 10 and 25 Man Spells
SPELL_FROST_AURA_10 = 28531,
SPELL_FROST_AURA_25 = 55799,
SPELL_TAIL_SWEEP_10 = 55697,
SPELL_TAIL_SWEEP_25 = 55696,
SPELL_LIFE_DRAIN_10 = 28542,
SPELL_LIFE_DRAIN_25 = 55665,
};
enum Misc
@@ -75,10 +83,18 @@ enum Events
EVENT_HUNDRED_CLUB = 14
};
// Unlike other Naxx 40 scripts, this overwrites all versions of the UI
// This is due to AI casting used in the spell script
class boss_sapphiron_40 : public CreatureScript
{
private:
static boolean isNaxx40Sapp(uint32 entry)
{
return (entry == NPC_SAPPHIRON_40);
}
public:
boss_sapphiron_40() : CreatureScript("boss_sapphiron_40") { }
boss_sapphiron_40() : CreatureScript("boss_sapphiron") { }
CreatureAI* GetAI(Creature* pCreature) const override
{
@@ -159,7 +175,14 @@ public:
{
BossAI::EnterCombat(who);
EnterCombatSelfFunction();
if (isNaxx40Sapp(me->GetEntry()))
{
me->CastSpell(me, SPELL_FROST_AURA, true);
}
else
{
me->CastSpell(me, RAID_MODE(SPELL_FROST_AURA_10, SPELL_FROST_AURA_25), true);
}
events.ScheduleEvent(EVENT_BERSERK, 900000);
events.ScheduleEvent(EVENT_CLEAVE, 5000);
events.ScheduleEvent(EVENT_TAIL_SWEEP, 10000);
@@ -259,11 +282,25 @@ public:
events.RepeatEvent(10000);
return;
case EVENT_TAIL_SWEEP:
if (isNaxx40Sapp(me->GetEntry()))
{
me->CastSpell(me, SPELL_TAIL_SWEEP, false);
}
else
{
me->CastSpell(me, RAID_MODE(SPELL_TAIL_SWEEP_10, SPELL_TAIL_SWEEP_25), false);
}
events.RepeatEvent(10000);
return;
case EVENT_LIFE_DRAIN:
if (isNaxx40Sapp(me->GetEntry()))
{
me->CastCustomSpell(SPELL_LIFE_DRAIN, SPELLVALUE_MAX_TARGETS, 5, me, false);
}
else
{
me->CastCustomSpell(RAID_MODE(SPELL_LIFE_DRAIN_10, SPELL_LIFE_DRAIN_25), SPELLVALUE_MAX_TARGETS, RAID_MODE(2, 5), me, false);
}
events.RepeatEvent(24000);
return;
case EVENT_BLIZZARD:
@@ -281,7 +318,14 @@ public:
{
cr->GetMotionMaster()->MoveRandom(40);
}
if (isNaxx40Sapp(me->GetEntry()))
{
events.RepeatEvent(6500);
}
else
{
events.RepeatEvent(RAID_MODE(8000, 6500));
}
return;
}
case EVENT_FLIGHT_START:
@@ -305,7 +349,14 @@ public:
me->SetDisableGravity(true);
currentTarget.Clear();
events.ScheduleEvent(EVENT_FLIGHT_ICEBOLT, 3000);
if (isNaxx40Sapp(me->GetEntry()))
{
iceboltCount = 3;
}
else
{
iceboltCount = RAID_MODE(2, 3);
}
return;
case EVENT_FLIGHT_ICEBOLT:
{
@@ -413,14 +464,15 @@ public:
};
};
class spell_sapphiron_frost_explosion : public SpellScriptLoader
// This will overwrite the declared 10 and 25 man frost explosion to handle all versions of the spell script
class spell_sapphiron_frost_explosion_40 : public SpellScriptLoader
{
public:
spell_sapphiron_frost_explosion() : SpellScriptLoader("spell_sapphiron_frost_explosion") { }
spell_sapphiron_frost_explosion_40() : SpellScriptLoader("spell_sapphiron_frost_explosion") { }
class spell_sapphiron_frost_explosion_SpellScript : public SpellScript
class spell_sapphiron_frost_explosion_40_SpellScript : public SpellScript
{
PrepareSpellScript(spell_sapphiron_frost_explosion_SpellScript);
PrepareSpellScript(spell_sapphiron_frost_explosion_40_SpellScript);
void FilterTargets(std::list<WorldObject*>& targets)
{
@@ -445,18 +497,18 @@ public:
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sapphiron_frost_explosion_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sapphiron_frost_explosion_40_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_sapphiron_frost_explosion_SpellScript();
return new spell_sapphiron_frost_explosion_40_SpellScript();
}
};
void AddSC_boss_sapphiron_40()
{
new boss_sapphiron_40();
// new spell_sapphiron_frost_explosion();
new spell_sapphiron_frost_explosion_40();
}