mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Achievements: Fixed achievement Safety Dance in Heigan the Unclean's encounter
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
DELETE FROM `spell_script_names` WHERE `spell_id`=29371;
|
||||
INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`)
|
||||
VALUES
|
||||
(29371,'spell_heigan_eruption');
|
||||
@@ -0,0 +1,6 @@
|
||||
DELETE FROM `disables` WHERE `entry` IN (7264,7548);
|
||||
DELETE FROM `achievement_criteria_data` WHERE `criteria_id` IN (7264,7548) AND `type`=11;
|
||||
INSERT INTO `achievement_criteria_data` (`criteria_id`,`type`,`value1`,`value2`,`ScriptName`)
|
||||
VALUES
|
||||
(7264,11,0,0,'achievement_safety_dance'),
|
||||
(7548,11,0,0,'achievement_safety_dance');
|
||||
@@ -42,6 +42,9 @@ enum Phases
|
||||
PHASE_DANCE,
|
||||
};
|
||||
|
||||
#define ACTION_SAFETY_DANCE_FAIL 1
|
||||
#define DATA_SAFETY_DANCE 19962139
|
||||
|
||||
class boss_heigan : public CreatureScript
|
||||
{
|
||||
public:
|
||||
@@ -58,12 +61,35 @@ public:
|
||||
|
||||
uint32 eruptSection;
|
||||
bool eruptDirection;
|
||||
bool safetyDance;
|
||||
Phases phase;
|
||||
|
||||
void KilledUnit(Unit* /*Victim*/)
|
||||
void KilledUnit(Unit* who)
|
||||
{
|
||||
if (!(rand()%5))
|
||||
DoScriptText(SAY_SLAY, me);
|
||||
if (who->GetTypeId() == TYPEID_PLAYER)
|
||||
DoAction(ACTION_SAFETY_DANCE_FAIL);
|
||||
}
|
||||
|
||||
void DoAction(int32 const action)
|
||||
{
|
||||
if (action == ACTION_SAFETY_DANCE_FAIL)
|
||||
SetData(DATA_SAFETY_DANCE, 0);
|
||||
}
|
||||
|
||||
void SetData(uint32 id, uint32 data)
|
||||
{
|
||||
if (id == DATA_SAFETY_DANCE)
|
||||
safetyDance = data ? true : false;
|
||||
}
|
||||
|
||||
uint32 GetData(uint32 type)
|
||||
{
|
||||
if (type == DATA_SAFETY_DANCE)
|
||||
return safetyDance ? 1 : 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void JustDied(Unit* /*Killer*/)
|
||||
@@ -77,6 +103,7 @@ public:
|
||||
_EnterCombat();
|
||||
DoScriptText(SAY_AGGRO, me);
|
||||
EnterPhase(PHASE_FIGHT);
|
||||
safetyDance = true;
|
||||
}
|
||||
|
||||
void EnterPhase(Phases newPhase)
|
||||
@@ -147,7 +174,59 @@ public:
|
||||
|
||||
};
|
||||
|
||||
class spell_heigan_eruption : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_heigan_eruption() : SpellScriptLoader("spell_heigan_eruption") { }
|
||||
|
||||
class spell_heigan_eruption_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_heigan_eruption_SpellScript);
|
||||
|
||||
void HandleScript(SpellEffIndex /*eff*/)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
if (!caster)
|
||||
return;
|
||||
|
||||
if (GetHitDamage() >= int32(GetHitUnit()->GetHealth()))
|
||||
if (InstanceScript* instance = caster->GetInstanceScript())
|
||||
if (Creature* Heigan = ObjectAccessor::GetCreature(*caster, instance->GetData64(DATA_HEIGAN)))
|
||||
Heigan->AI()->DoAction(ACTION_SAFETY_DANCE_FAIL);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffect += SpellEffectFn(spell_heigan_eruption_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_heigan_eruption_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
class achievement_safety_dance : public AchievementCriteriaScript
|
||||
{
|
||||
public:
|
||||
achievement_safety_dance() : AchievementCriteriaScript("achievement_safety_dance")
|
||||
{
|
||||
}
|
||||
|
||||
bool OnCheck(Player* /*player*/, Unit* target)
|
||||
{
|
||||
if (Creature* Heigan = target->ToCreature())
|
||||
if (Heigan->AI()->GetData(DATA_SAFETY_DANCE))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_boss_heigan()
|
||||
{
|
||||
new boss_heigan();
|
||||
new spell_heigan_eruption();
|
||||
new achievement_safety_dance();
|
||||
}
|
||||
|
||||
@@ -132,6 +132,7 @@ public:
|
||||
uint64 uiSir;
|
||||
|
||||
uint64 uiThaddius;
|
||||
uint64 uiHeigan;
|
||||
uint64 uiFeugen;
|
||||
uint64 uiStalagg;
|
||||
|
||||
@@ -155,6 +156,7 @@ public:
|
||||
case 30549: uiBaron = creature->GetGUID(); return;
|
||||
case 16063: uiSir = creature->GetGUID(); return;
|
||||
case 15928: uiThaddius = creature->GetGUID(); return;
|
||||
case 15936: uiHeigan = creature->GetGUID(); return;
|
||||
case 15930: uiFeugen = creature->GetGUID(); return;
|
||||
case 15929: uiStalagg = creature->GetGUID(); return;
|
||||
case 15990: uiKelthuzad = creature->GetGUID(); return;
|
||||
@@ -290,6 +292,8 @@ public:
|
||||
return uiSir;
|
||||
case DATA_THADDIUS:
|
||||
return uiThaddius;
|
||||
case DATA_HEIGAN:
|
||||
return uiHeigan;
|
||||
case DATA_FEUGEN:
|
||||
return uiFeugen;
|
||||
case DATA_STALAGG:
|
||||
|
||||
@@ -58,6 +58,7 @@ enum Data64
|
||||
DATA_BARON,
|
||||
DATA_SIR,
|
||||
DATA_THADDIUS,
|
||||
DATA_HEIGAN,
|
||||
DATA_FEUGEN,
|
||||
DATA_STALAGG,
|
||||
DATA_KELTHUZAD,
|
||||
|
||||
Reference in New Issue
Block a user