mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Scripts/Spells: Added druid's guardian spell scripts (#26111)
* Incapacitating Roar * Stampeding Roar * Thrash * Berserk * Brambles * Bristling Fur * Tiger Dash * Galactic Guardian * Earthwarden * Guardian Of The Elune * Tooth and Claw
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
-- Spell Scripts
|
||||
DELETE FROM `spell_script_names` WHERE `ScriptName` IN
|
||||
('spell_dru_incapacitating_roar',
|
||||
'spell_dru_stampeding_roar',
|
||||
'spell_dru_thrash',
|
||||
'spell_dru_thrash_aura',
|
||||
'spell_dru_berserk',
|
||||
'spell_dru_brambles',
|
||||
'spell_dru_barkskin',
|
||||
'spell_dru_bristling_fur',
|
||||
'spell_dru_tiger_dash',
|
||||
'spell_dru_galactic_guardian',
|
||||
'spell_dru_earthwarden');
|
||||
INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
|
||||
(99, 'spell_dru_incapacitating_roar'), -- Incapacitating Roar (99)
|
||||
(106898, 'spell_dru_stampeding_roar'), -- Stampeding Roar (106898)
|
||||
(77758, 'spell_dru_thrash'), -- Thrash (77758)
|
||||
(192090, 'spell_dru_thrash_aura'), -- Thrash (192090)
|
||||
(50334, 'spell_dru_berserk'), -- Berserk (50334)
|
||||
(203953, 'spell_dru_brambles'), -- Berserk (50334)
|
||||
(22812, 'spell_dru_barkskin'), -- Brambles (203953)
|
||||
(155835, 'spell_dru_bristling_fur'), -- Bristling Fur (155835)
|
||||
(252216, 'spell_dru_tiger_dash'), -- Tiger Dash (252216)
|
||||
(203964, 'spell_dru_galactic_guardian'), -- Galactic Guardian (203964)
|
||||
(203974, 'spell_dru_earthwarden'); -- Earthwarden (203974)
|
||||
|
||||
-- Spell Procs
|
||||
DELETE FROM `spell_proc` WHERE `SpellId` IN
|
||||
(135288, -- Tooth and Claw (135288)
|
||||
135286, -- Tooth and Claw (135286)
|
||||
155578, -- Guardian Of Elune (155578)
|
||||
203974, -- Earthwarden (203974)
|
||||
48484, -- Infected Wounds (48484)
|
||||
345208); -- Infected Wounds (345208)
|
||||
INSERT INTO `spell_proc` (`SpellId`,`SchoolMask`,`SpellFamilyName`,`SpellFamilyMask0`,`SpellFamilyMask1`,`SpellFamilyMask2`,`SpellFamilyMask3`,`ProcFlags`,`SpellTypeMask`,`SpellPhaseMask`,`HitMask`,`AttributesMask`,`DisableEffectsMask`,`ProcsPerMinute`,`Chance`,`Cooldown`,`Charges`) VALUES
|
||||
(135288, 1, 0, 0x0, 0x0, 0x0, 0x0, 0x4, 1, 2, 0x403, 0, 2, 0, 20, 0, 0), -- Tooth and Claw (135288), proc on auto attack
|
||||
(135286, 0, 7, 0x800, 0x0, 0x0, 0x0, 0x10, 1, 2, 0x403, 0x8, 0, 0, 0, 0, 0), -- Tooth and Claw (135286), proc on Maul
|
||||
(155578, 0, 7, 0x0, 0x40, 0x0, 0x0, 0x10, 1, 2, 0x403, 0, 0, 0, 0, 0, 0), -- Guardian Of Elune (155578), proc on Mangle
|
||||
(203974, 0, 7, 0x0, 0x0, 0x08000000, 0x40000000, 0x10, 1, 1, 0x403, 0, 0, 0, 0, 0, 0), -- Earthwarden (203974), proc on Thrash
|
||||
(48484, 1, 7, 0x1000, 0, 0, 0, 0x10, 1, 1, 0x403, 0, 0, 0, 100, 0, 0), -- Infected Wounds (48484) , proc on Rake
|
||||
(345208, 1, 7, 0x800, 0x40, 0, 0, 0x10, 1, 1, 0x403, 0, 0, 0, 100, 0, 0); -- Infected Wounds (345208), proc on Mangle and Maul
|
||||
@@ -35,11 +35,19 @@ enum DruidSpells
|
||||
{
|
||||
SPELL_DRUID_BALANCE_T10_BONUS = 70718,
|
||||
SPELL_DRUID_BALANCE_T10_BONUS_PROC = 70721,
|
||||
SPELL_DRUID_BEAR_FORM = 5487,
|
||||
SPELL_DRUID_BLESSING_OF_CENARIUS = 40452,
|
||||
SPELL_DRUID_BLESSING_OF_ELUNE = 40446,
|
||||
SPELL_DRUID_BLESSING_OF_REMULOS = 40445,
|
||||
SPELL_DRUID_BLESSING_OF_THE_CLAW = 28750,
|
||||
SPELL_DRUID_BLOOD_FRENZY_AURA = 203962,
|
||||
SPELL_DRUID_BLOOD_FRENZY_RAGE_GAIN = 203961,
|
||||
SPELL_DRUID_BRAMBLES_DAMAGE_AURA = 213709,
|
||||
SPELL_DRUID_BRAMBLES_PASSIVE = 203953,
|
||||
SPELL_DRUID_BRAMBLES_REFLECT = 203958,
|
||||
SPELL_DRUID_BRISTLING_FUR_GAIN_RAGE = 204031,
|
||||
SPELL_DRUID_CAT_FORM = 768,
|
||||
SPELL_DRUID_EARTHWARDEN_AURA = 203975,
|
||||
SPELL_DRUID_EXHILARATE = 28742,
|
||||
SPELL_DRUID_FERAL_CHARGE_BEAR = 16979,
|
||||
SPELL_DRUID_FERAL_CHARGE_CAT = 49376,
|
||||
@@ -52,6 +60,7 @@ enum DruidSpells
|
||||
SPELL_DRUID_FORMS_TRINKET_MOONKIN = 37343,
|
||||
SPELL_DRUID_FORMS_TRINKET_NONE = 37344,
|
||||
SPELL_DRUID_FORMS_TRINKET_TREE = 37342,
|
||||
SPELL_DRUID_GALACTIC_GUARDIAN_AURA = 213708,
|
||||
SPELL_DRUID_GORE_PROC = 93622,
|
||||
SPELL_DRUID_IDOL_OF_FERAL_SHADOWS = 34241,
|
||||
SPELL_DRUID_IDOL_OF_WORSHIP = 60774,
|
||||
@@ -75,6 +84,9 @@ enum DruidSpells
|
||||
SPELL_DRUID_SUNFIRE_DAMAGE = 164815,
|
||||
SPELL_DRUID_SURVIVAL_INSTINCTS = 50322,
|
||||
SPELL_DRUID_TRAVEL_FORM = 783,
|
||||
SPELL_DRUID_THRASH_BEAR = 77758,
|
||||
SPELL_DRUID_THRASH_BEAR_AURA = 192090,
|
||||
SPELL_DRUID_THRASH_CAT = 106830,
|
||||
};
|
||||
|
||||
class RaidCheck
|
||||
@@ -94,6 +106,123 @@ private:
|
||||
Unit const* _caster;
|
||||
};
|
||||
|
||||
class spell_dru_base_transformer : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_dru_base_transformer);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
return ValidateSpellInfo({ GetShapeshiftFormSpell() });
|
||||
}
|
||||
|
||||
void HandleOnCast()
|
||||
{
|
||||
// Change into cat form
|
||||
if (GetCaster()->GetShapeshiftForm() != GetShapeshiftForm())
|
||||
GetCaster()->CastSpell(GetCaster(), GetShapeshiftFormSpell(), true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
BeforeCast += SpellCastFn(spell_dru_base_transformer::HandleOnCast);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual bool ToCatForm() const = 0;
|
||||
|
||||
ShapeshiftForm GetShapeshiftForm() const { return ToCatForm() ? FORM_CAT_FORM : FORM_BEAR_FORM; }
|
||||
uint32 GetShapeshiftFormSpell() const { return ToCatForm() ? SPELL_DRUID_CAT_FORM : SPELL_DRUID_BEAR_FORM; }
|
||||
};
|
||||
|
||||
// 22812 - Barkskin
|
||||
class spell_dru_barkskin : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_dru_barkskin);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
return ValidateSpellInfo({ SPELL_DRUID_BRAMBLES_PASSIVE });
|
||||
}
|
||||
|
||||
void HandlePeriodic(AuraEffect const* /*aurEff*/)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
if (target->HasAura(SPELL_DRUID_BRAMBLES_PASSIVE))
|
||||
target->CastSpell(target, SPELL_DRUID_BRAMBLES_DAMAGE_AURA, true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectPeriodic += AuraEffectPeriodicFn(spell_dru_barkskin::HandlePeriodic, EFFECT_2, SPELL_AURA_PERIODIC_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
// 77758 - Berserk
|
||||
class spell_dru_berserk : public spell_dru_base_transformer
|
||||
{
|
||||
protected:
|
||||
bool ToCatForm() const override { return false; }
|
||||
};
|
||||
|
||||
// 203953 - Brambles - SPELL_DRUID_BRAMBLES_PASSIVE
|
||||
class spell_dru_brambles : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_dru_brambles);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
return ValidateSpellInfo({ SPELL_DRUID_BRAMBLES_REFLECT, SPELL_DRUID_BRAMBLES_DAMAGE_AURA });
|
||||
}
|
||||
|
||||
void HandleAbsorb(AuraEffect* /*aurEff*/, DamageInfo& /*dmgInfo*/, uint32& /*absorbAmount*/)
|
||||
{
|
||||
// Prevent Removal
|
||||
PreventDefaultAction();
|
||||
}
|
||||
|
||||
void HandleAfterAbsorb(AuraEffect* /*aurEff*/, DamageInfo& dmgInfo, uint32& absorbAmount)
|
||||
{
|
||||
// reflect back damage to the attacker
|
||||
Unit* target = GetTarget();
|
||||
if (Unit* attacker = dmgInfo.GetAttacker())
|
||||
target->CastCustomSpell(SPELL_DRUID_BRAMBLES_REFLECT, SPELLVALUE_BASE_POINT0, absorbAmount, attacker, TRIGGERED_FULL_MASK);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectAbsorb += AuraEffectAbsorbFn(spell_dru_brambles::HandleAbsorb, EFFECT_0);
|
||||
AfterEffectAbsorb += AuraEffectAbsorbFn(spell_dru_brambles::HandleAfterAbsorb, EFFECT_0);
|
||||
}
|
||||
};
|
||||
|
||||
// 155835 - Bristling Fur
|
||||
class spell_dru_bristling_fur : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_dru_bristling_fur);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
return ValidateSpellInfo({ SPELL_DRUID_BRISTLING_FUR_GAIN_RAGE });
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect* /*aurEff*/, ProcEventInfo& eventInfo)
|
||||
{
|
||||
// BristlingFurRage = 100 * Damage / MaxHealth.
|
||||
if (DamageInfo* damageInfo = eventInfo.GetDamageInfo())
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
uint32 rage = 100.0f * (float)damageInfo->GetDamage() / (float)target->GetMaxHealth();
|
||||
if (rage > 0)
|
||||
target->CastCustomSpell(SPELL_DRUID_BRISTLING_FUR_GAIN_RAGE, SPELLVALUE_BASE_POINT0, rage, target, TRIGGERED_FULL_MASK);
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectProc += AuraEffectProcFn(spell_dru_bristling_fur::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
// 1850 - Dash
|
||||
class spell_dru_dash : public SpellScriptLoader
|
||||
{
|
||||
@@ -123,6 +252,28 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
// 203974 - Earthwarden
|
||||
class spell_dru_earthwarden : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_dru_earthwarden);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
return ValidateSpellInfo({ SPELL_DRUID_THRASH_CAT, SPELL_DRUID_THRASH_BEAR, SPELL_DRUID_EARTHWARDEN_AURA });
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect* /*aurEff*/, ProcEventInfo& /*eventInfo*/)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
target->CastSpell(target, SPELL_DRUID_EARTHWARDEN_AURA, true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectProc += AuraEffectProcFn(spell_dru_earthwarden::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
// 22568 - Ferocious Bite
|
||||
class spell_dru_ferocious_bite : public SpellScript
|
||||
{
|
||||
@@ -290,6 +441,36 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
// 203964 - Galactic Guardian
|
||||
class spell_dru_galactic_guardian : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_dru_galactic_guardian);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
return ValidateSpellInfo({ SPELL_DRUID_GALACTIC_GUARDIAN_AURA });
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect* /*aurEff*/, ProcEventInfo& eventInfo)
|
||||
{
|
||||
if (DamageInfo* damageInfo = eventInfo.GetDamageInfo())
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
|
||||
// free automatic moonfire on target
|
||||
target->CastSpell(damageInfo->GetVictim(), SPELL_DRUID_MOONFIRE_DAMAGE, true);
|
||||
|
||||
// Cast aura
|
||||
target->CastSpell(damageInfo->GetVictim(), SPELL_DRUID_GALACTIC_GUARDIAN_AURA, true);
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectProc += AuraEffectProcFn(spell_dru_galactic_guardian::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
// 210706 - Gore
|
||||
class spell_dru_gore : public AuraScript
|
||||
{
|
||||
@@ -355,6 +536,13 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
// 99 - Incapacitating Roar
|
||||
class spell_dru_incapacitating_roar : public spell_dru_base_transformer
|
||||
{
|
||||
protected:
|
||||
bool ToCatForm() const override { return false; }
|
||||
};
|
||||
|
||||
// 29166 - Innervate
|
||||
class spell_dru_innervate : public SpellScriptLoader
|
||||
{
|
||||
@@ -616,6 +804,11 @@ public:
|
||||
{
|
||||
PrepareSpellScript(spell_dru_moonfire_SpellScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
return ValidateSpellInfo({ SPELL_DRUID_MOONFIRE_DAMAGE });
|
||||
}
|
||||
|
||||
void HandleOnHit(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
GetCaster()->CastSpell(GetHitUnit(), SPELL_DRUID_MOONFIRE_DAMAGE, true);
|
||||
@@ -697,26 +890,10 @@ public:
|
||||
};
|
||||
|
||||
// 5215 - Prowl
|
||||
class spell_dru_prowl : public SpellScript
|
||||
class spell_dru_prowl : public spell_dru_base_transformer
|
||||
{
|
||||
PrepareSpellScript(spell_dru_prowl);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
return ValidateSpellInfo({ SPELL_DRUID_CAT_FORM });
|
||||
}
|
||||
|
||||
void HandleOnCast()
|
||||
{
|
||||
// Change into cat form
|
||||
if (GetCaster()->GetShapeshiftForm() != FORM_CAT_FORM)
|
||||
GetCaster()->CastSpell(GetCaster(), SPELL_DRUID_CAT_FORM);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
BeforeCast += SpellCastFn(spell_dru_prowl::HandleOnCast);
|
||||
}
|
||||
protected:
|
||||
bool ToCatForm() const override { return true; }
|
||||
};
|
||||
|
||||
// 1079 - Rip
|
||||
@@ -906,6 +1083,13 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
// 106898 - Stampeding Roar
|
||||
class spell_dru_stampeding_roar : public spell_dru_base_transformer
|
||||
{
|
||||
protected:
|
||||
bool ToCatForm() const override { return false; }
|
||||
};
|
||||
|
||||
// 50286 - Starfall (Dummy)
|
||||
class spell_dru_starfall_dummy : public SpellScriptLoader
|
||||
{
|
||||
@@ -986,25 +1170,6 @@ class spell_dru_survival_instincts : public SpellScriptLoader
|
||||
public:
|
||||
spell_dru_survival_instincts() : SpellScriptLoader("spell_dru_survival_instincts") { }
|
||||
|
||||
class spell_dru_survival_instincts_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_dru_survival_instincts_SpellScript);
|
||||
|
||||
SpellCastResult CheckCast()
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
if (!caster->IsInFeralForm())
|
||||
return SPELL_FAILED_ONLY_SHAPESHIFT;
|
||||
|
||||
return SPELL_CAST_OK;
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnCheckCast += SpellCheckCastFn(spell_dru_survival_instincts_SpellScript::CheckCast);
|
||||
}
|
||||
};
|
||||
|
||||
class spell_dru_survival_instincts_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_dru_survival_instincts_AuraScript);
|
||||
@@ -1033,11 +1198,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const override
|
||||
{
|
||||
return new spell_dru_survival_instincts_SpellScript();
|
||||
}
|
||||
|
||||
AuraScript* GetAuraScript() const override
|
||||
{
|
||||
return new spell_dru_survival_instincts_AuraScript();
|
||||
@@ -1342,6 +1502,124 @@ public:
|
||||
{
|
||||
return new spell_dru_t10_restoration_4p_bonus_dummy_AuraScript();
|
||||
}
|
||||
};
|
||||
|
||||
// 77758 - Thrash
|
||||
class spell_dru_thrash : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_dru_thrash);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
return ValidateSpellInfo({ SPELL_DRUID_THRASH_BEAR_AURA });
|
||||
}
|
||||
|
||||
void HandleOnHitTarget(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (Unit* hitUnit = GetHitUnit())
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
|
||||
caster->CastSpell(hitUnit, SPELL_DRUID_THRASH_BEAR_AURA, TRIGGERED_FULL_MASK);
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_dru_thrash::HandleOnHitTarget, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
|
||||
}
|
||||
};
|
||||
|
||||
// 192090 - Thrash (Aura) - SPELL_DRUID_THRASH_BEAR_AURA
|
||||
class spell_dru_thrash_aura : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_dru_thrash_aura);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
return ValidateSpellInfo({ SPELL_DRUID_BLOOD_FRENZY_AURA, SPELL_DRUID_BLOOD_FRENZY_RAGE_GAIN });
|
||||
}
|
||||
|
||||
void HandlePeriodic(AuraEffect const* /*aurEff*/)
|
||||
{
|
||||
if (Unit* caster = GetCaster())
|
||||
if (caster->HasAura(SPELL_DRUID_BLOOD_FRENZY_AURA))
|
||||
caster->CastSpell(caster, SPELL_DRUID_BLOOD_FRENZY_RAGE_GAIN, true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectPeriodic += AuraEffectPeriodicFn(spell_dru_thrash_aura::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE);
|
||||
}
|
||||
};
|
||||
|
||||
// 1066 - Aquatic Form
|
||||
// 33943 - Flight Form
|
||||
// 40120 - Swift Flight Form
|
||||
// 165961 - Stag Form
|
||||
class spell_dru_travel_form : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_dru_travel_form() : SpellScriptLoader("spell_dru_travel_form") { }
|
||||
|
||||
class spell_dru_travel_form_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_dru_travel_form_AuraScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
return ValidateSpellInfo({ SPELL_DRUID_FORM_STAG, SPELL_DRUID_FORM_AQUATIC, SPELL_DRUID_FORM_FLIGHT, SPELL_DRUID_FORM_SWIFT_FLIGHT });
|
||||
}
|
||||
|
||||
bool Load() override
|
||||
{
|
||||
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
|
||||
}
|
||||
|
||||
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
// If it stays 0, it removes Travel Form dummy in AfterRemove.
|
||||
triggeredSpellId = 0;
|
||||
|
||||
// We should only handle aura interrupts.
|
||||
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_INTERRUPT)
|
||||
return;
|
||||
|
||||
// Check what form is appropriate
|
||||
triggeredSpellId = spell_dru_travel_form::GetFormSpellId(GetTarget()->ToPlayer(), GetCastDifficulty(), true);
|
||||
|
||||
// If chosen form is current aura, just don't remove it.
|
||||
if (triggeredSpellId == m_scriptSpellId)
|
||||
PreventDefaultAction();
|
||||
}
|
||||
|
||||
void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (triggeredSpellId == m_scriptSpellId)
|
||||
return;
|
||||
|
||||
Player* player = GetTarget()->ToPlayer();
|
||||
|
||||
if (triggeredSpellId) // Apply new form
|
||||
player->AddAura(triggeredSpellId, player);
|
||||
else // If not set, simply remove Travel Form dummy
|
||||
player->RemoveAura(SPELL_DRUID_TRAVEL_FORM);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectRemove += AuraEffectRemoveFn(spell_dru_travel_form_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_MOD_SHAPESHIFT, AURA_EFFECT_HANDLE_REAL);
|
||||
AfterEffectRemove += AuraEffectRemoveFn(spell_dru_travel_form_AuraScript::AfterRemove, EFFECT_0, SPELL_AURA_MOD_SHAPESHIFT, AURA_EFFECT_HANDLE_REAL);
|
||||
}
|
||||
|
||||
private:
|
||||
uint32 triggeredSpellId = 0;
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const override
|
||||
{
|
||||
return new spell_dru_travel_form_AuraScript();
|
||||
}
|
||||
|
||||
static uint32 GetFormSpellId(Player const* player, Difficulty difficulty, bool requiresOutdoor)
|
||||
{
|
||||
@@ -1368,7 +1646,6 @@ private:
|
||||
|
||||
return spellInfo->CheckLocation(targetPlayer->GetMapId(), targetPlayer->GetZoneId(), targetPlayer->GetAreaId(), targetPlayer);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// 783 - Travel Form (dummy)
|
||||
@@ -1419,7 +1696,7 @@ public:
|
||||
Player* player = GetTarget()->ToPlayer();
|
||||
|
||||
// Outdoor check already passed - Travel Form (dummy) has SPELL_ATTR0_OUTDOORS_ONLY attribute.
|
||||
uint32 triggeredSpellId = spell_dru_travel_form_dummy::GetFormSpellId(player, GetCastDifficulty(), false);
|
||||
uint32 triggeredSpellId = spell_dru_travel_form::GetFormSpellId(player, GetCastDifficulty(), false);
|
||||
|
||||
player->AddAura(triggeredSpellId, player);
|
||||
}
|
||||
@@ -1449,100 +1726,25 @@ public:
|
||||
{
|
||||
return new spell_dru_travel_form_dummy_AuraScript();
|
||||
}
|
||||
|
||||
static uint32 GetFormSpellId(Player const* player, Difficulty difficulty, bool requiresOutdoor)
|
||||
{
|
||||
// Check what form is appropriate
|
||||
if (player->IsInWater()) // Aquatic form
|
||||
return SPELL_DRUID_FORM_AQUATIC;
|
||||
|
||||
if (player->GetSkillValue(SKILL_RIDING) >= 225 && CheckLocationForForm(player, difficulty, requiresOutdoor, SPELL_DRUID_FORM_FLIGHT) == SPELL_CAST_OK) // Flight form
|
||||
return player->GetSkillValue(SKILL_RIDING) >= 300 ? SPELL_DRUID_FORM_SWIFT_FLIGHT : SPELL_DRUID_FORM_FLIGHT;
|
||||
|
||||
if (CheckLocationForForm(player, difficulty, requiresOutdoor, SPELL_DRUID_FORM_STAG) == SPELL_CAST_OK) // Stag form
|
||||
return SPELL_DRUID_FORM_STAG;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private:
|
||||
static SpellCastResult CheckLocationForForm(Player const* targetPlayer, Difficulty difficulty, bool requireOutdoors, uint32 spell_id)
|
||||
{
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell_id, difficulty);
|
||||
|
||||
if (requireOutdoors && !targetPlayer->GetMap()->IsOutdoors(targetPlayer->GetPhaseShift(), targetPlayer->GetPositionX(), targetPlayer->GetPositionY(), targetPlayer->GetPositionZ()))
|
||||
return SPELL_FAILED_ONLY_OUTDOORS;
|
||||
|
||||
return spellInfo->CheckLocation(targetPlayer->GetMapId(), targetPlayer->GetZoneId(), targetPlayer->GetAreaId(), targetPlayer);
|
||||
}
|
||||
};
|
||||
|
||||
// 1066 - Aquatic Form
|
||||
// 33943 - Flight Form
|
||||
// 40120 - Swift Flight Form
|
||||
// 165961 - Stag Form
|
||||
class spell_dru_travel_form : public SpellScriptLoader
|
||||
// 252216 - Tiger Dash
|
||||
class spell_dru_tiger_dash : public AuraScript
|
||||
{
|
||||
public:
|
||||
spell_dru_travel_form() : SpellScriptLoader("spell_dru_travel_form") { }
|
||||
PrepareAuraScript(spell_dru_tiger_dash);
|
||||
|
||||
class spell_dru_travel_form_AuraScript : public AuraScript
|
||||
void HandlePeriodic(AuraEffect const* aurEff)
|
||||
{
|
||||
PrepareAuraScript(spell_dru_travel_form_AuraScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
if (AuraEffect* effRunSpeed = GetEffect(EFFECT_0))
|
||||
{
|
||||
return ValidateSpellInfo({ SPELL_DRUID_FORM_STAG, SPELL_DRUID_FORM_AQUATIC, SPELL_DRUID_FORM_FLIGHT, SPELL_DRUID_FORM_SWIFT_FLIGHT });
|
||||
int32 reduction = aurEff->GetAmount();
|
||||
effRunSpeed->ChangeAmount(effRunSpeed->GetAmount() - reduction);
|
||||
}
|
||||
}
|
||||
|
||||
bool Load() override
|
||||
{
|
||||
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
|
||||
}
|
||||
|
||||
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
// If it stays 0, it removes Travel Form dummy in AfterRemove.
|
||||
triggeredSpellId = 0;
|
||||
|
||||
// We should only handle aura interrupts.
|
||||
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_INTERRUPT)
|
||||
return;
|
||||
|
||||
// Check what form is appropriate
|
||||
triggeredSpellId = spell_dru_travel_form_dummy::GetFormSpellId(GetTarget()->ToPlayer(), GetCastDifficulty(), true);
|
||||
|
||||
// If chosen form is current aura, just don't remove it.
|
||||
if (triggeredSpellId == m_scriptSpellId)
|
||||
PreventDefaultAction();
|
||||
}
|
||||
|
||||
void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (triggeredSpellId == m_scriptSpellId)
|
||||
return;
|
||||
|
||||
Player* player = GetTarget()->ToPlayer();
|
||||
|
||||
if (triggeredSpellId) // Apply new form
|
||||
player->AddAura(triggeredSpellId, player);
|
||||
else // If not set, simply remove Travel Form dummy
|
||||
player->RemoveAura(SPELL_DRUID_TRAVEL_FORM);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectRemove += AuraEffectRemoveFn(spell_dru_travel_form_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_MOD_SHAPESHIFT, AURA_EFFECT_HANDLE_REAL);
|
||||
AfterEffectRemove += AuraEffectRemoveFn(spell_dru_travel_form_AuraScript::AfterRemove, EFFECT_0, SPELL_AURA_MOD_SHAPESHIFT, AURA_EFFECT_HANDLE_REAL);
|
||||
}
|
||||
|
||||
private:
|
||||
uint32 triggeredSpellId;
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const override
|
||||
void Register() override
|
||||
{
|
||||
return new spell_dru_travel_form_AuraScript();
|
||||
OnEffectPeriodic += AuraEffectPeriodicFn(spell_dru_tiger_dash::HandlePeriodic, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1640,12 +1842,19 @@ public:
|
||||
|
||||
void AddSC_druid_spell_scripts()
|
||||
{
|
||||
RegisterAuraScript(spell_dru_barkskin);
|
||||
RegisterSpellScript(spell_dru_berserk);
|
||||
RegisterAuraScript(spell_dru_brambles);
|
||||
RegisterAuraScript(spell_dru_bristling_fur);
|
||||
new spell_dru_dash();
|
||||
RegisterAuraScript(spell_dru_earthwarden);
|
||||
RegisterSpellScript(spell_dru_ferocious_bite);
|
||||
new spell_dru_flight_form();
|
||||
new spell_dru_forms_trinket();
|
||||
RegisterAuraScript(spell_dru_galactic_guardian);
|
||||
RegisterAuraScript(spell_dru_gore);
|
||||
new spell_dru_idol_lifebloom();
|
||||
RegisterSpellScript(spell_dru_incapacitating_roar);
|
||||
new spell_dru_innervate();
|
||||
new spell_dru_item_t6_trinket();
|
||||
new spell_dru_lifebloom();
|
||||
@@ -1659,6 +1868,7 @@ void AddSC_druid_spell_scripts()
|
||||
new spell_dru_savage_roar();
|
||||
RegisterSpellScript(spell_dru_skull_bash);
|
||||
new spell_dru_stampede();
|
||||
RegisterSpellScript(spell_dru_stampeding_roar);
|
||||
new spell_dru_starfall_dummy();
|
||||
new spell_dru_sunfire();
|
||||
new spell_dru_survival_instincts();
|
||||
@@ -1669,7 +1879,10 @@ void AddSC_druid_spell_scripts()
|
||||
new spell_dru_t10_balance_4p_bonus();
|
||||
new spell_dru_t10_restoration_4p_bonus();
|
||||
new spell_dru_t10_restoration_4p_bonus_dummy();
|
||||
RegisterSpellScript(spell_dru_thrash);
|
||||
RegisterAuraScript(spell_dru_thrash_aura);
|
||||
new spell_dru_travel_form();
|
||||
new spell_dru_travel_form_dummy();
|
||||
RegisterAuraScript(spell_dru_tiger_dash);
|
||||
new spell_dru_wild_growth();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user