fix(Scripts/DireMaul): Rewrite Isalien fight (#9377)

This commit is contained in:
Nefertumm
2021-12-03 05:17:12 -08:00
committed by GitHub
parent 6438bade3d
commit 9cc6a9aef2
5 changed files with 165 additions and 2 deletions

View File

@@ -0,0 +1,9 @@
INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1637968467142598700');
DELETE FROM `creature_text` WHERE `CreatureID` = 16097;
INSERT INTO `creature_text` (`CreatureID`, `GroupID`, `ID`, `Text`, `Type`, `Language`, `Probability`, `Emote`, `Duration`, `Sound`, `BroadcastTextId`, `TextRange`, `comment`) VALUES
(16097, 0, 0, 'My torture is ended and now I can join the Goddess. Thank you so very much!', 14, 0, 100, 0, 0, 0, 11860, 0, 'Isalien - ON DEATH');
UPDATE `creature_template` SET `AIName` = '', `ScriptName` = 'boss_isalien' WHERE `entry` = 16097;
DELETE FROM `smart_scripts` WHERE `entryorguid` = 16097 AND `source_type` = 0;

View File

@@ -0,0 +1,141 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by the
* Free Software Foundation; either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "dire_maul.h"
#include "TaskScheduler.h"
enum Texts
{
SAY_DEATH = 0
};
enum Spells
{
SPELL_CALL_EMPYREAN = 27639,
SPELL_MULTI_SHOT = 14443,
SPELL_NET = 12024,
SPELL_STARSHARDS = 27636,
SPELL_REGROWTH = 27637
};
enum Phases
{
PHASE_NONE = 0,
PHASE_REGROWTH
};
enum Points
{
POINT_RANDOM = 1
};
struct boss_isalien : public BossAI
{
boss_isalien(Creature* creature) : BossAI(creature, DATA_ISALIEN) { }
void Reset() override
{
_Reset();
_scheduler.CancelAll();
summons.DespawnAll();
_phase = PHASE_NONE;
_scheduler.SetValidator([this]
{
return !me->HasUnitState(UNIT_STATE_CASTING);
});
}
void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/, DamageEffectType /*type*/, SpellSchoolMask /*school*/) override
{
if (_phase != PHASE_REGROWTH && me->HealthBelowPct(80.f))
{
_phase = PHASE_REGROWTH;
_scheduler.Schedule(25s, 30s, [this](TaskContext context)
{
Position randomPos = me->GetRandomPoint(me->GetPosition(), 15.f);
me->GetMotionMaster()->MovePoint(POINT_RANDOM, randomPos);
context.Schedule(3s, [this](TaskContext /*context*/)
{
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MoveChase(me->GetVictim());
DoCastSelf(SPELL_REGROWTH);
});
context.Repeat(25s, 30s);
});
}
}
void JustSummoned(Creature* summon) override
{
summons.Summon(summon);
}
void EnterCombat(Unit* /*who*/) override
{
_EnterCombat();
_scheduler.Schedule(4s, 5s, [this](TaskContext context)
{
DoCastRandomTarget(SPELL_NET);
context.Repeat(12s, 15s);
})
.Schedule(7s, 12s, [this](TaskContext context)
{
DoCastRandomTarget(SPELL_MULTI_SHOT);
context.Repeat(7s, 12s);
})
.Schedule(20s, 30s, [this](TaskContext context)
{
DoCastAOE(SPELL_STARSHARDS);
context.Repeat(20s, 30s);
})
.Schedule(8s, 10s, [this](TaskContext /*context*/)
{
DoCastAOE(SPELL_CALL_EMPYREAN);
});
}
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
{
return;
}
_scheduler.Update(diff, [this]
{
DoMeleeAttackIfReady();
});
}
void JustDied(Unit* /*killer*/) override
{
_JustDied();
Talk(SAY_DEATH);
}
protected:
TaskScheduler _scheduler;
uint8 _phase;
};
void AddSC_boss_isalien()
{
RegisterDireMaulCreatureAI(boss_isalien);
}

View File

@@ -18,7 +18,9 @@
#ifndef DEF_DIRE_MAUL_H
#define DEF_DIRE_MAUL_H
#include "UnitAI.h"
#include "CreatureAIImpl.h"
constexpr auto DMScriptName = "instance_dire_maul";
enum DataTypes
{
@@ -27,6 +29,7 @@ enum DataTypes
TYPE_PYLONS_STATE = 2,
TYPE_NORTH_WING_PROGRESS = 3,
TYPE_NORTH_WING_BOSSES = 4,
DATA_ISALIEN = 32,
ALL_PYLONS_OFF = 0x1F
};
@@ -43,4 +46,12 @@ enum NpcIds
NPC_HIGHBORNE_SUMMONER = 11466
};
template <class AI, class T>
inline AI* GetDireMaulAI(T* obj)
{
return GetInstanceAI<AI>(obj, DMScriptName);
}
#define RegisterDireMaulCreatureAI(ai_name) RegisterCreatureAIWithFactory(ai_name, GetDireMaulAI)
#endif

View File

@@ -22,7 +22,7 @@
class instance_dire_maul : public InstanceMapScript
{
public:
instance_dire_maul() : InstanceMapScript("instance_dire_maul", 429) { }
instance_dire_maul() : InstanceMapScript(DMScriptName, 429) { }
struct instance_dire_maul_InstanceMapScript : public InstanceScript
{

View File

@@ -42,6 +42,7 @@ void AddSC_boss_mal_ganis();
void AddSC_boss_meathook();
void AddSC_culling_of_stratholme();
void AddSC_instance_culling_of_stratholme();
void AddSC_boss_isalien();
void AddSC_instance_dire_maul(); //Dire Maul
void AddSC_instance_maraudon(); //Maraudon
void AddSC_boss_onyxia(); //Onyxia's Lair
@@ -123,6 +124,7 @@ void AddKalimdorScripts()
AddSC_boss_meathook();
AddSC_culling_of_stratholme();
AddSC_instance_culling_of_stratholme();
AddSC_boss_isalien();
AddSC_instance_dire_maul(); //Dire Maul
AddSC_instance_maraudon(); //Maraudon
AddSC_boss_onyxia(); //Onyxia's Lair