Merge pull request #8903 from joschiwald/spellscripts_reorder

Misc: Reorder scripts in some script files and some cosmetic stuff
This commit is contained in:
Nay
2013-01-10 23:26:21 -08:00
4 changed files with 957 additions and 942 deletions

View File

@@ -28,21 +28,30 @@
enum DeathKnightSpells
{
DK_SPELL_RUNIC_POWER_ENERGIZE = 49088,
DK_SPELL_ANTI_MAGIC_SHELL_TALENT = 51052,
DK_SPELL_CORPSE_EXPLOSION_TRIGGERED = 43999,
DK_SPELL_CORPSE_EXPLOSION_VISUAL = 51270,
DK_SPELL_GHOUL_EXPLODE = 47496,
DK_SPELL_SCOURGE_STRIKE_TRIGGERED = 70890,
DK_SPELL_BLOOD_BOIL_TRIGGERED = 65658,
DK_SPELL_WILL_OF_THE_NECROPOLIS_TALENT_R1 = 49189,
DK_SPELL_WILL_OF_THE_NECROPOLIS_AURA_R1 = 52284,
DK_SPELL_BLOOD_PRESENCE = 48266,
DK_SPELL_IMPROVED_BLOOD_PRESENCE_TRIGGERED = 63611,
DK_SPELL_UNHOLY_PRESENCE = 48265,
DK_SPELL_IMPROVED_UNHOLY_PRESENCE_TRIGGERED = 63622,
SPELL_DK_ANTI_MAGIC_SHELL_TALENT = 51052,
SPELL_DK_BLACK_ICE_R1 = 49140,
SPELL_DK_BLOOD_BOIL_TRIGGERED = 65658,
SPELL_DK_CORPSE_EXPLOSION_TRIGGERED = 43999,
SPELL_DK_CORPSE_EXPLOSION_VISUAL = 51270,
SPELL_DK_DEATH_COIL_DAMAGE = 47632,
SPELL_DK_DEATH_COIL_HEAL = 47633,
SPELL_DK_DEATH_STRIKE_HEAL = 45470,
SPELL_DK_GHOUL_EXPLODE = 47496,
SPELL_DK_RUNIC_POWER_ENERGIZE = 49088,
SPELL_DK_SCOURGE_STRIKE_TRIGGERED = 70890,
SPELL_DK_WILL_OF_THE_NECROPOLIS_TALENT_R1 = 49189,
SPELL_DK_WILL_OF_THE_NECROPOLIS_AURA_R1 = 52284,
SPELL_DK_BLOOD_PRESENCE = 48266,
SPELL_DK_IMPROVED_BLOOD_PRESENCE_TRIGGERED = 63611,
SPELL_DK_UNHOLY_PRESENCE = 48265,
SPELL_DK_IMPROVED_UNHOLY_PRESENCE_TRIGGERED = 63622,
SPELL_DK_ITEM_SIGIL_VENGEFUL_HEART = 64962,
SPELL_DK_ITEM_T8_MELEE_4P_BONUS = 64736,
DK_SPELL_BLACK_ICE_R1 = 49140,
};
enum DeathKnightSpellIcons
{
DK_ICON_ID_IMPROVED_DEATH_STRIKE = 2751,
};
// 50462 - Anti-Magic Shell (on raid member)
@@ -71,13 +80,13 @@ class spell_dk_anti_magic_shell_raid : public SpellScriptLoader
void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)
{
absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct);
absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct);
}
void Register()
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_anti_magic_shell_raid_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB);
OnEffectAbsorb += AuraEffectAbsorbFn(spell_dk_anti_magic_shell_raid_AuraScript::Absorb, EFFECT_0);
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_anti_magic_shell_raid_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB);
OnEffectAbsorb += AuraEffectAbsorbFn(spell_dk_anti_magic_shell_raid_AuraScript::Absorb, EFFECT_0);
}
};
@@ -105,9 +114,9 @@ class spell_dk_anti_magic_shell_self : public SpellScriptLoader
return true;
}
bool Validate(SpellInfo const* /*spellEntry*/)
bool Validate(SpellInfo const* /*spellInfo*/)
{
if (!sSpellMgr->GetSpellInfo(DK_SPELL_RUNIC_POWER_ENERGIZE))
if (!sSpellMgr->GetSpellInfo(SPELL_DK_RUNIC_POWER_ENERGIZE))
return false;
return true;
}
@@ -128,14 +137,14 @@ class spell_dk_anti_magic_shell_self : public SpellScriptLoader
// damage absorbed by Anti-Magic Shell energizes the DK with additional runic power.
// This, if I'm not mistaken, shows that we get back ~20% of the absorbed damage as runic power.
int32 bp = absorbAmount * 2 / 10;
target->CastCustomSpell(target, DK_SPELL_RUNIC_POWER_ENERGIZE, &bp, NULL, NULL, true, NULL, aurEff);
target->CastCustomSpell(target, SPELL_DK_RUNIC_POWER_ENERGIZE, &bp, NULL, NULL, true, NULL, aurEff);
}
void Register()
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_anti_magic_shell_self_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB);
OnEffectAbsorb += AuraEffectAbsorbFn(spell_dk_anti_magic_shell_self_AuraScript::Absorb, EFFECT_0);
AfterEffectAbsorb += AuraEffectAbsorbFn(spell_dk_anti_magic_shell_self_AuraScript::Trigger, EFFECT_0);
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_anti_magic_shell_self_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB);
OnEffectAbsorb += AuraEffectAbsorbFn(spell_dk_anti_magic_shell_self_AuraScript::Absorb, EFFECT_0);
AfterEffectAbsorb += AuraEffectAbsorbFn(spell_dk_anti_magic_shell_self_AuraScript::Trigger, EFFECT_0);
}
};
@@ -165,14 +174,14 @@ class spell_dk_anti_magic_zone : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellEntry*/)
{
if (!sSpellMgr->GetSpellInfo(DK_SPELL_ANTI_MAGIC_SHELL_TALENT))
if (!sSpellMgr->GetSpellInfo(SPELL_DK_ANTI_MAGIC_SHELL_TALENT))
return false;
return true;
}
void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/)
{
SpellInfo const* talentSpell = sSpellMgr->GetSpellInfo(DK_SPELL_ANTI_MAGIC_SHELL_TALENT);
SpellInfo const* talentSpell = sSpellMgr->GetSpellInfo(SPELL_DK_ANTI_MAGIC_SHELL_TALENT);
amount = talentSpell->Effects[EFFECT_0].CalcValue(GetCaster());
if (Player* player = GetCaster()->ToPlayer())
amount += int32(2 * player->GetTotalAttackPowerValue(BASE_ATTACK));
@@ -196,7 +205,53 @@ class spell_dk_anti_magic_zone : public SpellScriptLoader
}
};
// 49158 Corpse Explosion (51325, 51326, 51327, 51328)
// 48721 - Blood Boil
class spell_dk_blood_boil : public SpellScriptLoader
{
public:
spell_dk_blood_boil() : SpellScriptLoader("spell_dk_blood_boil") { }
class spell_dk_blood_boil_SpellScript : public SpellScript
{
PrepareSpellScript(spell_dk_blood_boil_SpellScript);
bool Validate(SpellInfo const* /*spellInfo*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_DK_BLOOD_BOIL_TRIGGERED))
return false;
return true;
}
bool Load()
{
_executed = false;
return GetCaster()->GetTypeId() == TYPEID_PLAYER && GetCaster()->getClass() == CLASS_DEATH_KNIGHT;
}
void HandleAfterHit()
{
if (_executed || !GetHitUnit())
return;
_executed = true;
GetCaster()->CastSpell(GetCaster(), SPELL_DK_BLOOD_BOIL_TRIGGERED, true);
}
void Register()
{
AfterHit += SpellHitFn(spell_dk_blood_boil_SpellScript::HandleAfterHit);
}
bool _executed;
};
SpellScript* GetSpellScript() const
{
return new spell_dk_blood_boil_SpellScript();
}
};
// 49158 - Corpse Explosion (51325, 51326, 51327, 51328)
class spell_dk_corpse_explosion : public SpellScriptLoader
{
public:
@@ -206,11 +261,11 @@ class spell_dk_corpse_explosion : public SpellScriptLoader
{
PrepareSpellScript(spell_dk_corpse_explosion_SpellScript);
bool Validate(SpellInfo const* /*spellEntry*/)
bool Validate(SpellInfo const* /*spellInfo*/)
{
if (!sSpellMgr->GetSpellInfo(DK_SPELL_CORPSE_EXPLOSION_TRIGGERED) || !sSpellMgr->GetSpellInfo(DK_SPELL_GHOUL_EXPLODE))
if (!sSpellMgr->GetSpellInfo(SPELL_DK_CORPSE_EXPLOSION_TRIGGERED) || !sSpellMgr->GetSpellInfo(SPELL_DK_GHOUL_EXPLODE))
return false;
if (!sSpellMgr->GetSpellInfo(DK_SPELL_CORPSE_EXPLOSION_VISUAL))
if (!sSpellMgr->GetSpellInfo(SPELL_DK_CORPSE_EXPLOSION_VISUAL))
return false;
return true;
}
@@ -223,17 +278,17 @@ class spell_dk_corpse_explosion : public SpellScriptLoader
if (unitTarget->isAlive()) // Living ghoul as a target
{
bp = int32(unitTarget->CountPctFromMaxHealth(25));
unitTarget->CastCustomSpell(unitTarget, DK_SPELL_GHOUL_EXPLODE, &bp, NULL, NULL, false);
unitTarget->CastCustomSpell(unitTarget, SPELL_DK_GHOUL_EXPLODE, &bp, NULL, NULL, false);
}
else // Some corpse
{
bp = GetEffectValue();
GetCaster()->CastCustomSpell(unitTarget, GetSpellInfo()->Effects[EFFECT_1].CalcValue(), &bp, NULL, NULL, true);
// Corpse Explosion (Suicide)
unitTarget->CastSpell(unitTarget, DK_SPELL_CORPSE_EXPLOSION_TRIGGERED, true);
unitTarget->CastSpell(unitTarget, SPELL_DK_CORPSE_EXPLOSION_TRIGGERED, true);
}
// Set corpse look
GetCaster()->CastSpell(unitTarget, DK_SPELL_CORPSE_EXPLOSION_VISUAL, true);
GetCaster()->CastSpell(unitTarget, SPELL_DK_CORPSE_EXPLOSION_VISUAL, true);
}
}
@@ -249,44 +304,74 @@ class spell_dk_corpse_explosion : public SpellScriptLoader
}
};
// 47496 - Explode, Ghoul spell for Corpse Explosion
class spell_dk_ghoul_explode : public SpellScriptLoader
// -47541, 52375, 59134, -62900 - Death Coil
class spell_dk_death_coil : public SpellScriptLoader
{
public:
spell_dk_ghoul_explode() : SpellScriptLoader("spell_dk_ghoul_explode") { }
spell_dk_death_coil() : SpellScriptLoader("spell_dk_death_coil") { }
class spell_dk_ghoul_explode_SpellScript : public SpellScript
class spell_dk_death_coil_SpellScript : public SpellScript
{
PrepareSpellScript(spell_dk_ghoul_explode_SpellScript);
PrepareSpellScript(spell_dk_death_coil_SpellScript);
bool Validate(SpellInfo const* /*spellEntry*/)
bool Validate(SpellInfo const* /*spell*/)
{
if (!sSpellMgr->GetSpellInfo(DK_SPELL_CORPSE_EXPLOSION_TRIGGERED))
if (!sSpellMgr->GetSpellInfo(SPELL_DK_DEATH_COIL_DAMAGE) || !sSpellMgr->GetSpellInfo(SPELL_DK_DEATH_COIL_HEAL))
return false;
return true;
}
void Suicide(SpellEffIndex /*effIndex*/)
void HandleDummy(SpellEffIndex /*effIndex*/)
{
if (Unit* unitTarget = GetHitUnit())
int32 damage = GetEffectValue();
Unit* caster = GetCaster();
if (Unit* target = GetHitUnit())
{
// Corpse Explosion (Suicide)
unitTarget->CastSpell(unitTarget, DK_SPELL_CORPSE_EXPLOSION_TRIGGERED, true);
if (caster->IsFriendlyTo(target))
{
int32 bp = int32(damage * 1.5f);
caster->CastCustomSpell(target, SPELL_DK_DEATH_COIL_HEAL, &bp, NULL, NULL, true);
}
else
{
if (AuraEffect const* auraEffect = caster->GetAuraEffect(SPELL_DK_ITEM_SIGIL_VENGEFUL_HEART, EFFECT_1))
damage += auraEffect->GetBaseAmount();
caster->CastCustomSpell(target, SPELL_DK_DEATH_COIL_DAMAGE, &damage, NULL, NULL, true);
}
}
}
SpellCastResult CheckCast()
{
Unit* caster = GetCaster();
if (Unit* target = GetExplTargetUnit())
{
if (!caster->IsFriendlyTo(target) && !caster->isInFront(target))
return SPELL_FAILED_UNIT_NOT_INFRONT;
if (target->IsFriendlyTo(caster) && target->GetCreatureType() != CREATURE_TYPE_UNDEAD)
return SPELL_FAILED_BAD_TARGETS;
}
else
return SPELL_FAILED_BAD_TARGETS;
return SPELL_CAST_OK;
}
void Register()
{
OnEffectHitTarget += SpellEffectFn(spell_dk_ghoul_explode_SpellScript::Suicide, EFFECT_1, SPELL_EFFECT_SCHOOL_DAMAGE);
OnCheckCast += SpellCheckCastFn(spell_dk_death_coil_SpellScript::CheckCast);
OnEffectHitTarget += SpellEffectFn(spell_dk_death_coil_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const
{
return new spell_dk_ghoul_explode_SpellScript();
return new spell_dk_death_coil_SpellScript();
}
};
// 52751 - Death Gate
class spell_dk_death_gate : public SpellScriptLoader
{
public:
@@ -327,6 +412,41 @@ class spell_dk_death_gate : public SpellScriptLoader
}
};
// 49560 - Death Grip
class spell_dk_death_grip : public SpellScriptLoader
{
public:
spell_dk_death_grip() : SpellScriptLoader("spell_dk_death_grip") { }
class spell_dk_death_grip_SpellScript : public SpellScript
{
PrepareSpellScript(spell_dk_death_grip_SpellScript);
void HandleDummy(SpellEffIndex /*effIndex*/)
{
int32 damage = GetEffectValue();
Position const* pos = GetExplTargetDest();
if (Unit* target = GetHitUnit())
{
if (!target->HasAuraType(SPELL_AURA_DEFLECT_SPELLS)) // Deterrence
target->CastSpell(pos->GetPositionX(), pos->GetPositionY(), pos->GetPositionZ(), damage, true);
}
}
void Register()
{
OnEffectHitTarget += SpellEffectFn(spell_dk_death_grip_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const
{
return new spell_dk_death_grip_SpellScript();
}
};
// 48743 - Death Pact
class spell_dk_death_pact : public SpellScriptLoader
{
public:
@@ -351,22 +471,22 @@ class spell_dk_death_pact : public SpellScriptLoader
return SPELL_FAILED_NO_PET;
}
void FilterTargets(std::list<WorldObject*>& unitList)
void FilterTargets(std::list<WorldObject*>& targetList)
{
Unit* unit_to_add = NULL;
for (std::list<WorldObject*>::iterator itr = unitList.begin(); itr != unitList.end(); ++itr)
Unit* target = NULL;
for (std::list<WorldObject*>::iterator itr = targetList.begin(); itr != targetList.end(); ++itr)
{
if (Unit* unit = (*itr)->ToUnit())
if (unit->GetOwnerGUID() == GetCaster()->GetGUID() && unit->GetCreatureType() == CREATURE_TYPE_UNDEAD)
{
unit_to_add = unit;
break;
}
if (unit->GetOwnerGUID() == GetCaster()->GetGUID() && unit->GetCreatureType() == CREATURE_TYPE_UNDEAD)
{
target = unit;
break;
}
}
unitList.clear();
if (unit_to_add)
unitList.push_back(unit_to_add);
targetList.clear();
if (target)
targetList.push_back(target);
}
void Register()
@@ -382,7 +502,182 @@ class spell_dk_death_pact : public SpellScriptLoader
}
};
// 55090 Scourge Strike (55265, 55270, 55271)
// -49998 - Death Strike
class spell_dk_death_strike : public SpellScriptLoader
{
public:
spell_dk_death_strike() : SpellScriptLoader("spell_dk_death_strike") { }
class spell_dk_death_strike_SpellScript : public SpellScript
{
PrepareSpellScript(spell_dk_death_strike_SpellScript);
bool Validate(SpellInfo const* /*spellInfo*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_DK_DEATH_STRIKE_HEAL))
return false;
return true;
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
if (Unit* target = GetHitUnit())
{
uint32 count = target->GetDiseasesByCaster(caster->GetGUID());
int32 bp = int32(count * caster->CountPctFromMaxHealth(int32(GetSpellInfo()->Effects[EFFECT_0].DamageMultiplier)));
// Improved Death Strike
if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_AURA_ADD_PCT_MODIFIER, SPELLFAMILY_DEATHKNIGHT, DK_ICON_ID_IMPROVED_DEATH_STRIKE, 0))
AddPct(bp, caster->CalculateSpellDamage(caster, aurEff->GetSpellInfo(), 2));
caster->CastCustomSpell(caster, SPELL_DK_DEATH_STRIKE_HEAL, &bp, NULL, NULL, false);
}
}
void Register()
{
OnEffectHitTarget += SpellEffectFn(spell_dk_death_strike_SpellScript::HandleDummy, EFFECT_2, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const
{
return new spell_dk_death_strike_SpellScript();
}
};
// 47496 - Explode, Ghoul spell for Corpse Explosion
class spell_dk_ghoul_explode : public SpellScriptLoader
{
public:
spell_dk_ghoul_explode() : SpellScriptLoader("spell_dk_ghoul_explode") { }
class spell_dk_ghoul_explode_SpellScript : public SpellScript
{
PrepareSpellScript(spell_dk_ghoul_explode_SpellScript);
bool Validate(SpellInfo const* /*spellInfo*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_DK_CORPSE_EXPLOSION_TRIGGERED))
return false;
return true;
}
void Suicide(SpellEffIndex /*effIndex*/)
{
if (Unit* unitTarget = GetHitUnit())
{
// Corpse Explosion (Suicide)
unitTarget->CastSpell(unitTarget, SPELL_DK_CORPSE_EXPLOSION_TRIGGERED, true);
}
}
void Register()
{
OnEffectHitTarget += SpellEffectFn(spell_dk_ghoul_explode_SpellScript::Suicide, EFFECT_1, SPELL_EFFECT_SCHOOL_DAMAGE);
}
};
SpellScript* GetSpellScript() const
{
return new spell_dk_ghoul_explode_SpellScript();
}
};
// 50365, 50371 - Improved Blood Presence
class spell_dk_improved_blood_presence : public SpellScriptLoader
{
public:
spell_dk_improved_blood_presence() : SpellScriptLoader("spell_dk_improved_blood_presence") { }
class spell_dk_improved_blood_presence_AuraScript : public AuraScript
{
PrepareAuraScript(spell_dk_improved_blood_presence_AuraScript);
bool Validate(SpellInfo const* /*spellInfo*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_DK_BLOOD_PRESENCE) || !sSpellMgr->GetSpellInfo(SPELL_DK_IMPROVED_BLOOD_PRESENCE_TRIGGERED))
return false;
return true;
}
void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
if (!target->HasAura(SPELL_DK_BLOOD_PRESENCE) && !target->HasAura(SPELL_DK_IMPROVED_BLOOD_PRESENCE_TRIGGERED))
{
int32 basePoints1 = aurEff->GetAmount();
target->CastCustomSpell(target, SPELL_DK_IMPROVED_BLOOD_PRESENCE_TRIGGERED, NULL, &basePoints1, NULL, true, 0, aurEff);
}
}
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
if (!target->HasAura(SPELL_DK_BLOOD_PRESENCE))
target->RemoveAura(SPELL_DK_IMPROVED_BLOOD_PRESENCE_TRIGGERED);
}
void Register()
{
AfterEffectApply += AuraEffectApplyFn(spell_dk_improved_blood_presence_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
AfterEffectRemove += AuraEffectRemoveFn(spell_dk_improved_blood_presence_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const
{
return new spell_dk_improved_blood_presence_AuraScript();
}
};
// 50391, 50392 - Improved Unholy Presence
class spell_dk_improved_unholy_presence : public SpellScriptLoader
{
public:
spell_dk_improved_unholy_presence() : SpellScriptLoader("spell_dk_improved_unholy_presence") { }
class spell_dk_improved_unholy_presence_AuraScript : public AuraScript
{
PrepareAuraScript(spell_dk_improved_unholy_presence_AuraScript);
bool Validate(SpellInfo const* /*spellInfo*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_DK_UNHOLY_PRESENCE) || !sSpellMgr->GetSpellInfo(SPELL_DK_IMPROVED_UNHOLY_PRESENCE_TRIGGERED))
return false;
return true;
}
void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
if (target->HasAura(SPELL_DK_UNHOLY_PRESENCE) && !target->HasAura(SPELL_DK_IMPROVED_UNHOLY_PRESENCE_TRIGGERED))
{
// Not listed as any effect, only base points set in dbc
int32 basePoints0 = aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue();
target->CastCustomSpell(target, SPELL_DK_IMPROVED_UNHOLY_PRESENCE_TRIGGERED, &basePoints0, &basePoints0, &basePoints0, true, 0, aurEff);
}
}
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
GetTarget()->RemoveAura(SPELL_DK_IMPROVED_UNHOLY_PRESENCE_TRIGGERED);
}
void Register()
{
AfterEffectApply += AuraEffectApplyFn(spell_dk_improved_unholy_presence_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
AfterEffectRemove += AuraEffectRemoveFn(spell_dk_improved_unholy_presence_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const
{
return new spell_dk_improved_unholy_presence_AuraScript();
}
};
// 55090 - Scourge Strike (55265, 55270, 55271)
class spell_dk_scourge_strike : public SpellScriptLoader
{
public:
@@ -399,9 +694,9 @@ class spell_dk_scourge_strike : public SpellScriptLoader
return true;
}
bool Validate(SpellInfo const* /*spellEntry*/)
bool Validate(SpellInfo const* /*spellInfo*/)
{
if (!sSpellMgr->GetSpellInfo(DK_SPELL_SCOURGE_STRIKE_TRIGGERED))
if (!sSpellMgr->GetSpellInfo(SPELL_DK_SCOURGE_STRIKE_TRIGGERED))
return false;
return true;
}
@@ -425,10 +720,10 @@ class spell_dk_scourge_strike : public SpellScriptLoader
{
int32 bp = GetHitDamage() * multiplier;
if (AuraEffect* aurEff = caster->GetAuraEffectOfRankedSpell(DK_SPELL_BLACK_ICE_R1, EFFECT_0))
if (AuraEffect* aurEff = caster->GetAuraEffectOfRankedSpell(SPELL_DK_BLACK_ICE_R1, EFFECT_0))
AddPct(bp, aurEff->GetAmount());
caster->CastCustomSpell(unitTarget, DK_SPELL_SCOURGE_STRIKE_TRIGGERED, &bp, NULL, NULL, true);
caster->CastCustomSpell(unitTarget, SPELL_DK_SCOURGE_STRIKE_TRIGGERED, &bp, NULL, NULL, true);
}
}
@@ -478,8 +773,8 @@ class spell_dk_spell_deflection : public SpellScriptLoader
void Register()
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_spell_deflection_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB);
OnEffectAbsorb += AuraEffectAbsorbFn(spell_dk_spell_deflection_AuraScript::Absorb, EFFECT_0);
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_spell_deflection_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB);
OnEffectAbsorb += AuraEffectAbsorbFn(spell_dk_spell_deflection_AuraScript::Absorb, EFFECT_0);
}
};
@@ -489,52 +784,6 @@ class spell_dk_spell_deflection : public SpellScriptLoader
}
};
// 48721 Blood Boil
class spell_dk_blood_boil : public SpellScriptLoader
{
public:
spell_dk_blood_boil() : SpellScriptLoader("spell_dk_blood_boil") { }
class spell_dk_blood_boil_SpellScript : public SpellScript
{
PrepareSpellScript(spell_dk_blood_boil_SpellScript);
bool Validate(SpellInfo const* /*spellEntry*/)
{
if (!sSpellMgr->GetSpellInfo(DK_SPELL_BLOOD_BOIL_TRIGGERED))
return false;
return true;
}
bool Load()
{
_executed = false;
return GetCaster()->GetTypeId() == TYPEID_PLAYER && GetCaster()->getClass() == CLASS_DEATH_KNIGHT;
}
void HandleAfterHit()
{
if (_executed || !GetHitUnit())
return;
_executed = true;
GetCaster()->CastSpell(GetCaster(), DK_SPELL_BLOOD_BOIL_TRIGGERED, true);
}
void Register()
{
AfterHit += SpellHitFn(spell_dk_blood_boil_SpellScript::HandleAfterHit);
}
bool _executed;
};
SpellScript* GetSpellScript() const
{
return new spell_dk_blood_boil_SpellScript();
}
};
// 52284 - Will of the Necropolis
class spell_dk_will_of_the_necropolis : public SpellScriptLoader
{
@@ -545,14 +794,14 @@ class spell_dk_will_of_the_necropolis : public SpellScriptLoader
{
PrepareAuraScript(spell_dk_will_of_the_necropolis_AuraScript);
bool Validate(SpellInfo const* spellEntry)
bool Validate(SpellInfo const* spellInfo)
{
// can't use other spell than will of the necropolis due to spell_ranks dependency
if (sSpellMgr->GetFirstSpellInChain(DK_SPELL_WILL_OF_THE_NECROPOLIS_AURA_R1) != sSpellMgr->GetFirstSpellInChain(spellEntry->Id))
if (sSpellMgr->GetFirstSpellInChain(SPELL_DK_WILL_OF_THE_NECROPOLIS_AURA_R1) != sSpellMgr->GetFirstSpellInChain(spellInfo->Id))
return false;
uint8 rank = sSpellMgr->GetSpellRank(spellEntry->Id);
if (!sSpellMgr->GetSpellWithRank(DK_SPELL_WILL_OF_THE_NECROPOLIS_TALENT_R1, rank, true))
uint8 rank = sSpellMgr->GetSpellRank(spellInfo->Id);
if (!sSpellMgr->GetSpellWithRank(SPELL_DK_WILL_OF_THE_NECROPOLIS_TALENT_R1, rank, true))
return false;
return true;
@@ -576,7 +825,7 @@ class spell_dk_will_of_the_necropolis : public SpellScriptLoader
{
// min pct of hp is stored in effect 0 of talent spell
uint32 rank = sSpellMgr->GetSpellRank(GetSpellInfo()->Id);
SpellInfo const* talentProto = sSpellMgr->GetSpellInfo(sSpellMgr->GetSpellWithRank(DK_SPELL_WILL_OF_THE_NECROPOLIS_TALENT_R1, rank));
SpellInfo const* talentProto = sSpellMgr->GetSpellInfo(sSpellMgr->GetSpellWithRank(SPELL_DK_WILL_OF_THE_NECROPOLIS_TALENT_R1, rank));
int32 remainingHp = int32(GetTarget()->GetHealth() - dmgInfo.GetDamage());
int32 minHp = int32(GetTarget()->CountPctFromMaxHealth(talentProto->Effects[EFFECT_0].CalcValue(GetCaster())));
@@ -599,271 +848,22 @@ class spell_dk_will_of_the_necropolis : public SpellScriptLoader
}
};
// 50365, 50371 Improved Blood Presence
class spell_dk_improved_blood_presence : public SpellScriptLoader
{
public:
spell_dk_improved_blood_presence() : SpellScriptLoader("spell_dk_improved_blood_presence") { }
class spell_dk_improved_blood_presence_AuraScript : public AuraScript
{
PrepareAuraScript(spell_dk_improved_blood_presence_AuraScript);
bool Validate(SpellInfo const* /*entry*/)
{
if (!sSpellMgr->GetSpellInfo(DK_SPELL_BLOOD_PRESENCE) || !sSpellMgr->GetSpellInfo(DK_SPELL_IMPROVED_BLOOD_PRESENCE_TRIGGERED))
return false;
return true;
}
void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
if (!target->HasAura(DK_SPELL_BLOOD_PRESENCE) && !target->HasAura(DK_SPELL_IMPROVED_BLOOD_PRESENCE_TRIGGERED))
{
int32 basePoints1 = aurEff->GetAmount();
target->CastCustomSpell(target, DK_SPELL_IMPROVED_BLOOD_PRESENCE_TRIGGERED, NULL, &basePoints1, NULL, true, 0, aurEff);
}
}
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
if (!target->HasAura(DK_SPELL_BLOOD_PRESENCE))
target->RemoveAura(DK_SPELL_IMPROVED_BLOOD_PRESENCE_TRIGGERED);
}
void Register()
{
AfterEffectApply += AuraEffectApplyFn(spell_dk_improved_blood_presence_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
AfterEffectRemove += AuraEffectRemoveFn(spell_dk_improved_blood_presence_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const
{
return new spell_dk_improved_blood_presence_AuraScript();
}
};
// 50391, 50392 Improved Unholy Presence
class spell_dk_improved_unholy_presence : public SpellScriptLoader
{
public:
spell_dk_improved_unholy_presence() : SpellScriptLoader("spell_dk_improved_unholy_presence") { }
class spell_dk_improved_unholy_presence_AuraScript : public AuraScript
{
PrepareAuraScript(spell_dk_improved_unholy_presence_AuraScript);
bool Validate(SpellInfo const* /*entry*/)
{
if (!sSpellMgr->GetSpellInfo(DK_SPELL_UNHOLY_PRESENCE) || !sSpellMgr->GetSpellInfo(DK_SPELL_IMPROVED_UNHOLY_PRESENCE_TRIGGERED))
return false;
return true;
}
void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
if (target->HasAura(DK_SPELL_UNHOLY_PRESENCE) && !target->HasAura(DK_SPELL_IMPROVED_UNHOLY_PRESENCE_TRIGGERED))
{
// Not listed as any effect, only base points set in dbc
int32 basePoints0 = aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue();
target->CastCustomSpell(target, DK_SPELL_IMPROVED_UNHOLY_PRESENCE_TRIGGERED, &basePoints0, &basePoints0, &basePoints0, true, 0, aurEff);
}
}
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
GetTarget()->RemoveAura(DK_SPELL_IMPROVED_UNHOLY_PRESENCE_TRIGGERED);
}
void Register()
{
AfterEffectApply += AuraEffectApplyFn(spell_dk_improved_unholy_presence_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
AfterEffectRemove += AuraEffectRemoveFn(spell_dk_improved_unholy_presence_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const
{
return new spell_dk_improved_unholy_presence_AuraScript();
}
};
enum DeathStrike
{
ICON_ID_IMPROVED_DEATH_STRIKE = 2751,
SPELL_DEATH_STRIKE_HEAL = 45470,
};
class spell_dk_death_strike : public SpellScriptLoader
{
public:
spell_dk_death_strike() : SpellScriptLoader("spell_dk_death_strike") { }
class spell_dk_death_strike_SpellScript : public SpellScript
{
PrepareSpellScript(spell_dk_death_strike_SpellScript);
bool Validate(SpellInfo const* /*SpellEntry*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_DEATH_STRIKE_HEAL))
return false;
return true;
}
void HandleDummy(SpellEffIndex /* effIndex */)
{
Unit* caster = GetCaster();
if (Unit* target = GetHitUnit())
{
uint32 count = target->GetDiseasesByCaster(caster->GetGUID());
int32 bp = int32(count * caster->CountPctFromMaxHealth(int32(GetSpellInfo()->Effects[EFFECT_0].DamageMultiplier)));
// Improved Death Strike
if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_AURA_ADD_PCT_MODIFIER, SPELLFAMILY_DEATHKNIGHT, ICON_ID_IMPROVED_DEATH_STRIKE, 0))
AddPct(bp, caster->CalculateSpellDamage(caster, aurEff->GetSpellInfo(), 2));
caster->CastCustomSpell(caster, SPELL_DEATH_STRIKE_HEAL, &bp, NULL, NULL, false);
}
}
void Register()
{
OnEffectHitTarget += SpellEffectFn(spell_dk_death_strike_SpellScript::HandleDummy, EFFECT_2, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const
{
return new spell_dk_death_strike_SpellScript();
}
};
enum DeathCoil
{
SPELL_DEATH_COIL_DAMAGE = 47632,
SPELL_DEATH_COIL_HEAL = 47633,
SPELL_SIGIL_VENGEFUL_HEART = 64962,
};
class spell_dk_death_coil : public SpellScriptLoader
{
public:
spell_dk_death_coil() : SpellScriptLoader("spell_dk_death_coil") { }
class spell_dk_death_coil_SpellScript : public SpellScript
{
PrepareSpellScript(spell_dk_death_coil_SpellScript);
bool Validate(SpellInfo const* /*spell*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_DEATH_COIL_DAMAGE) || !sSpellMgr->GetSpellInfo(SPELL_DEATH_COIL_HEAL))
return false;
return true;
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
int32 damage = GetEffectValue();
Unit* caster = GetCaster();
if (Unit* target = GetHitUnit())
{
if (caster->IsFriendlyTo(target))
{
int32 bp = int32(damage * 1.5f);
caster->CastCustomSpell(target, SPELL_DEATH_COIL_HEAL, &bp, NULL, NULL, true);
}
else
{
if (AuraEffect const* auraEffect = caster->GetAuraEffect(SPELL_SIGIL_VENGEFUL_HEART, EFFECT_1))
damage += auraEffect->GetBaseAmount();
caster->CastCustomSpell(target, SPELL_DEATH_COIL_DAMAGE, &damage, NULL, NULL, true);
}
}
}
SpellCastResult CheckCast()
{
Unit* caster = GetCaster();
if (Unit* target = GetExplTargetUnit())
{
if (!caster->IsFriendlyTo(target) && !caster->isInFront(target))
return SPELL_FAILED_UNIT_NOT_INFRONT;
if (target->IsFriendlyTo(caster) && target->GetCreatureType() != CREATURE_TYPE_UNDEAD)
return SPELL_FAILED_BAD_TARGETS;
}
else
return SPELL_FAILED_BAD_TARGETS;
return SPELL_CAST_OK;
}
void Register()
{
OnCheckCast += SpellCheckCastFn(spell_dk_death_coil_SpellScript::CheckCast);
OnEffectHitTarget += SpellEffectFn(spell_dk_death_coil_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const
{
return new spell_dk_death_coil_SpellScript();
}
};
class spell_dk_death_grip : public SpellScriptLoader
{
public:
spell_dk_death_grip() : SpellScriptLoader("spell_dk_death_grip") { }
class spell_dk_death_grip_SpellScript : public SpellScript
{
PrepareSpellScript(spell_dk_death_grip_SpellScript);
void HandleDummy(SpellEffIndex /*effIndex*/)
{
int32 damage = GetEffectValue();
Position const* pos = GetExplTargetDest();
if (Unit* target = GetHitUnit())
{
if (!target->HasAuraType(SPELL_AURA_DEFLECT_SPELLS)) // Deterrence
target->CastSpell(pos->GetPositionX(), pos->GetPositionY(), pos->GetPositionZ(), damage, true);
}
}
void Register()
{
OnEffectHitTarget += SpellEffectFn(spell_dk_death_grip_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const
{
return new spell_dk_death_grip_SpellScript();
}
};
void AddSC_deathknight_spell_scripts()
{
new spell_dk_anti_magic_shell_raid();
new spell_dk_anti_magic_shell_self();
new spell_dk_anti_magic_zone();
new spell_dk_corpse_explosion();
new spell_dk_ghoul_explode();
new spell_dk_death_gate();
new spell_dk_death_pact();
new spell_dk_scourge_strike();
new spell_dk_spell_deflection();
new spell_dk_blood_boil();
new spell_dk_will_of_the_necropolis();
new spell_dk_corpse_explosion();
new spell_dk_death_coil();
new spell_dk_death_gate();
new spell_dk_death_grip();
new spell_dk_death_pact();
new spell_dk_death_strike();
new spell_dk_ghoul_explode();
new spell_dk_improved_blood_presence();
new spell_dk_improved_unholy_presence();
new spell_dk_death_strike();
new spell_dk_death_coil();
new spell_dk_death_grip();
new spell_dk_scourge_strike();
new spell_dk_spell_deflection();
new spell_dk_will_of_the_necropolis();
}

View File

@@ -32,23 +32,25 @@
enum HunterSpells
{
HUNTER_SPELL_READINESS = 23989,
DRAENEI_SPELL_GIFT_OF_THE_NAARU = 59543,
HUNTER_SPELL_BESTIAL_WRATH = 19574,
HUNTER_PET_SPELL_LAST_STAND_TRIGGERED = 53479,
HUNTER_PET_HEART_OF_THE_PHOENIX = 55709,
HUNTER_PET_HEART_OF_THE_PHOENIX_TRIGGERED = 54114,
HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF = 55711,
HUNTER_PET_SPELL_CARRION_FEEDER_TRIGGERED = 54045,
HUNTER_SPELL_INVIGORATION_TRIGGERED = 53398,
HUNTER_SPELL_MASTERS_CALL_TRIGGERED = 62305,
HUNTER_SPELL_CHIMERA_SHOT_SERPENT = 53353,
HUNTER_SPELL_CHIMERA_SHOT_VIPER = 53358,
HUNTER_SPELL_CHIMERA_SHOT_SCORPID = 53359,
HUNTER_SPELL_ASPECT_OF_THE_BEAST_PET = 61669,
SPELL_HUNTER_ASPECT_OF_THE_BEAST_PET = 61669,
SPELL_HUNTER_BESTIAL_WRATH = 19574,
SPELL_HUNTER_CHIMERA_SHOT_SERPENT = 53353,
SPELL_HUNTER_CHIMERA_SHOT_VIPER = 53358,
SPELL_HUNTER_CHIMERA_SHOT_SCORPID = 53359,
SPELL_HUNTER_INVIGORATION_TRIGGERED = 53398,
SPELL_HUNTER_MASTERS_CALL_TRIGGERED = 62305,
SPELL_HUNTER_PET_LAST_STAND_TRIGGERED = 53479,
SPELL_HUNTER_PET_HEART_OF_THE_PHOENIX = 55709,
SPELL_HUNTER_PET_HEART_OF_THE_PHOENIX_TRIGGERED = 54114,
SPELL_HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF = 55711,
SPELL_HUNTER_PET_CARRION_FEEDER_TRIGGERED = 54045,
SPELL_HUNTER_READINESS = 23989,
SPELL_HUNTER_SNIPER_TRAINING_R1 = 53302,
SPELL_HUNTER_SNIPER_TRAINING_BUFF_R1 = 64418,
SPELL_DRAENEI_GIFT_OF_THE_NAARU = 59543,
};
// 13161 Aspect of the Beast
// 13161 - Aspect of the Beast
class spell_hun_aspect_of_the_beast : public SpellScriptLoader
{
public:
@@ -63,9 +65,9 @@ class spell_hun_aspect_of_the_beast : public SpellScriptLoader
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
}
bool Validate(SpellInfo const* /*entry*/)
bool Validate(SpellInfo const* /*spellInfo*/)
{
if (!sSpellMgr->GetSpellInfo(HUNTER_SPELL_ASPECT_OF_THE_BEAST_PET))
if (!sSpellMgr->GetSpellInfo(SPELL_HUNTER_ASPECT_OF_THE_BEAST_PET))
return false;
return true;
}
@@ -74,14 +76,14 @@ class spell_hun_aspect_of_the_beast : public SpellScriptLoader
{
if (Player* caster = GetCaster()->ToPlayer())
if (Pet* pet = caster->GetPet())
pet->RemoveAurasDueToSpell(HUNTER_SPELL_ASPECT_OF_THE_BEAST_PET);
pet->RemoveAurasDueToSpell(SPELL_HUNTER_ASPECT_OF_THE_BEAST_PET);
}
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Player* caster = GetCaster()->ToPlayer())
if (caster->GetPet())
caster->CastSpell(caster, HUNTER_SPELL_ASPECT_OF_THE_BEAST_PET, true);
caster->CastSpell(caster, SPELL_HUNTER_ASPECT_OF_THE_BEAST_PET, true);
}
void Register()
@@ -97,7 +99,7 @@ class spell_hun_aspect_of_the_beast : public SpellScriptLoader
}
};
// 53209 Chimera Shot
// 53209 - Chimera Shot
class spell_hun_chimera_shot : public SpellScriptLoader
{
public:
@@ -107,9 +109,9 @@ class spell_hun_chimera_shot : public SpellScriptLoader
{
PrepareSpellScript(spell_hun_chimera_shot_SpellScript);
bool Validate(SpellInfo const* /*spellEntry*/)
bool Validate(SpellInfo const* /*spellInfo*/)
{
if (!sSpellMgr->GetSpellInfo(HUNTER_SPELL_CHIMERA_SHOT_SERPENT) || !sSpellMgr->GetSpellInfo(HUNTER_SPELL_CHIMERA_SHOT_VIPER) || !sSpellMgr->GetSpellInfo(HUNTER_SPELL_CHIMERA_SHOT_SCORPID))
if (!sSpellMgr->GetSpellInfo(SPELL_HUNTER_CHIMERA_SHOT_SERPENT) || !sSpellMgr->GetSpellInfo(SPELL_HUNTER_CHIMERA_SHOT_VIPER) || !sSpellMgr->GetSpellInfo(SPELL_HUNTER_CHIMERA_SHOT_SCORPID))
return false;
return true;
}
@@ -138,7 +140,7 @@ class spell_hun_chimera_shot : public SpellScriptLoader
if (familyFlag[0] & 0x4000)
{
int32 TickCount = aurEff->GetTotalTicks();
spellId = HUNTER_SPELL_CHIMERA_SHOT_SERPENT;
spellId = SPELL_HUNTER_CHIMERA_SHOT_SERPENT;
basePoint = caster->SpellDamageBonusDone(unitTarget, aura->GetSpellInfo(), aurEff->GetAmount(), DOT, aura->GetStackAmount());
ApplyPct(basePoint, TickCount * 40);
basePoint = unitTarget->SpellDamageBonusTaken(caster, aura->GetSpellInfo(), basePoint, DOT, aura->GetStackAmount());
@@ -147,7 +149,7 @@ class spell_hun_chimera_shot : public SpellScriptLoader
else if (familyFlag[1] & 0x00000080)
{
int32 TickCount = aura->GetEffect(0)->GetTotalTicks();
spellId = HUNTER_SPELL_CHIMERA_SHOT_VIPER;
spellId = SPELL_HUNTER_CHIMERA_SHOT_VIPER;
// Amount of one aura tick
basePoint = int32(CalculatePct(unitTarget->GetMaxPower(POWER_MANA), aurEff->GetAmount()));
@@ -158,7 +160,7 @@ class spell_hun_chimera_shot : public SpellScriptLoader
}
// Scorpid Sting - Attempts to Disarm the target for 10 sec. This effect cannot occur more than once per 1 minute.
else if (familyFlag[0] & 0x00008000)
spellId = HUNTER_SPELL_CHIMERA_SHOT_SCORPID;
spellId = SPELL_HUNTER_CHIMERA_SHOT_SCORPID;
// ?? nothing say in spell desc (possibly need addition check)
//if (familyFlag & 0x0000010000000000LL || // dot
// familyFlag & 0x0000100000000000LL) // stun
@@ -173,7 +175,7 @@ class spell_hun_chimera_shot : public SpellScriptLoader
}
if (spellId)
caster->CastCustomSpell(unitTarget, spellId, &basePoint, 0, 0, true);
if (spellId == HUNTER_SPELL_CHIMERA_SHOT_SCORPID && caster->ToPlayer()) // Scorpid Sting - Add 1 minute cooldown
if (spellId == SPELL_HUNTER_CHIMERA_SHOT_SCORPID && caster->ToPlayer()) // Scorpid Sting - Add 1 minute cooldown
caster->ToPlayer()->AddSpellCooldown(spellId, 0, uint32(time(NULL) + 60));
}
}
@@ -190,7 +192,38 @@ class spell_hun_chimera_shot : public SpellScriptLoader
}
};
// 53412 Invigoration
// 781 - Disengage
class spell_hun_disengage : public SpellScriptLoader
{
public:
spell_hun_disengage() : SpellScriptLoader("spell_hun_disengage") { }
class spell_hun_disengage_SpellScript : public SpellScript
{
PrepareSpellScript(spell_hun_disengage_SpellScript);
SpellCastResult CheckCast()
{
Unit* caster = GetCaster();
if (caster->GetTypeId() == TYPEID_PLAYER && !caster->isInCombat())
return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW;
return SPELL_CAST_OK;
}
void Register()
{
OnCheckCast += SpellCheckCastFn(spell_hun_disengage_SpellScript::CheckCast);
}
};
SpellScript* GetSpellScript() const
{
return new spell_hun_disengage_SpellScript();
}
};
// 53412 - Invigoration
class spell_hun_invigoration : public SpellScriptLoader
{
public:
@@ -200,9 +233,9 @@ class spell_hun_invigoration : public SpellScriptLoader
{
PrepareSpellScript(spell_hun_invigoration_SpellScript);
bool Validate(SpellInfo const* /*spellEntry*/)
bool Validate(SpellInfo const* /*spellInfo*/)
{
if (!sSpellMgr->GetSpellInfo(HUNTER_SPELL_INVIGORATION_TRIGGERED))
if (!sSpellMgr->GetSpellInfo(SPELL_HUNTER_INVIGORATION_TRIGGERED))
return false;
return true;
}
@@ -212,7 +245,7 @@ class spell_hun_invigoration : public SpellScriptLoader
if (Unit* unitTarget = GetHitUnit())
if (AuraEffect* aurEff = unitTarget->GetDummyAuraEffect(SPELLFAMILY_HUNTER, 3487, 0))
if (roll_chance_i(aurEff->GetAmount()))
unitTarget->CastSpell(unitTarget, HUNTER_SPELL_INVIGORATION_TRIGGERED, true);
unitTarget->CastSpell(unitTarget, SPELL_HUNTER_INVIGORATION_TRIGGERED, true);
}
void Register()
@@ -227,6 +260,7 @@ class spell_hun_invigoration : public SpellScriptLoader
}
};
// 53478 - Last Stand Pet
class spell_hun_last_stand_pet : public SpellScriptLoader
{
public:
@@ -236,9 +270,9 @@ class spell_hun_last_stand_pet : public SpellScriptLoader
{
PrepareSpellScript(spell_hun_last_stand_pet_SpellScript);
bool Validate(SpellInfo const* /*spellEntry*/)
bool Validate(SpellInfo const* /*spellInfo*/)
{
if (!sSpellMgr->GetSpellInfo(HUNTER_PET_SPELL_LAST_STAND_TRIGGERED))
if (!sSpellMgr->GetSpellInfo(SPELL_HUNTER_PET_LAST_STAND_TRIGGERED))
return false;
return true;
}
@@ -247,7 +281,7 @@ class spell_hun_last_stand_pet : public SpellScriptLoader
{
Unit* caster = GetCaster();
int32 healthModSpellBasePoints0 = int32(caster->CountPctFromMaxHealth(30));
caster->CastCustomSpell(caster, HUNTER_PET_SPELL_LAST_STAND_TRIGGERED, &healthModSpellBasePoints0, NULL, NULL, true, NULL);
caster->CastCustomSpell(caster, SPELL_HUNTER_PET_LAST_STAND_TRIGGERED, &healthModSpellBasePoints0, NULL, NULL, true, NULL);
}
void Register()
@@ -263,6 +297,7 @@ class spell_hun_last_stand_pet : public SpellScriptLoader
}
};
// 53271 - Masters Call
class spell_hun_masters_call : public SpellScriptLoader
{
public:
@@ -272,9 +307,9 @@ class spell_hun_masters_call : public SpellScriptLoader
{
PrepareSpellScript(spell_hun_masters_call_SpellScript);
bool Validate(SpellInfo const* spellEntry)
bool Validate(SpellInfo const* spellInfo)
{
if (!sSpellMgr->GetSpellInfo(HUNTER_SPELL_MASTERS_CALL_TRIGGERED) || !sSpellMgr->GetSpellInfo(spellEntry->Effects[EFFECT_0].CalcValue()) || !sSpellMgr->GetSpellInfo(spellEntry->Effects[EFFECT_1].CalcValue()))
if (!sSpellMgr->GetSpellInfo(SPELL_HUNTER_MASTERS_CALL_TRIGGERED) || !sSpellMgr->GetSpellInfo(spellInfo->Effects[EFFECT_0].CalcValue()) || !sSpellMgr->GetSpellInfo(spellInfo->Effects[EFFECT_1].CalcValue()))
return false;
return true;
}
@@ -297,7 +332,7 @@ class spell_hun_masters_call : public SpellScriptLoader
{
// Cannot be processed while pet is dead
TriggerCastFlags castMask = TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_IGNORE_CASTER_AURASTATE);
target->CastSpell(target, HUNTER_SPELL_MASTERS_CALL_TRIGGERED, castMask);
target->CastSpell(target, SPELL_HUNTER_MASTERS_CALL_TRIGGERED, castMask);
}
}
@@ -314,6 +349,170 @@ class spell_hun_masters_call : public SpellScriptLoader
}
};
// 34477 - Misdirection
class spell_hun_misdirection : public SpellScriptLoader
{
public:
spell_hun_misdirection() : SpellScriptLoader("spell_hun_misdirection") { }
class spell_hun_misdirection_AuraScript : public AuraScript
{
PrepareAuraScript(spell_hun_misdirection_AuraScript);
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Unit* caster = GetCaster())
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_DEFAULT)
caster->SetReducedThreatPercent(0, 0);
}
void Register()
{
AfterEffectRemove += AuraEffectRemoveFn(spell_hun_misdirection_AuraScript::OnRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const
{
return new spell_hun_misdirection_AuraScript();
}
};
// 35079 - Misdirection proc
class spell_hun_misdirection_proc : public SpellScriptLoader
{
public:
spell_hun_misdirection_proc() : SpellScriptLoader("spell_hun_misdirection_proc") { }
class spell_hun_misdirection_proc_AuraScript : public AuraScript
{
PrepareAuraScript(spell_hun_misdirection_proc_AuraScript);
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (GetCaster())
GetCaster()->SetReducedThreatPercent(0, 0);
}
void Register()
{
AfterEffectRemove += AuraEffectRemoveFn(spell_hun_misdirection_proc_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const
{
return new spell_hun_misdirection_proc_AuraScript();
}
};
// 54044 - Pet Carrion Feeder
class spell_hun_pet_carrion_feeder : public SpellScriptLoader
{
public:
spell_hun_pet_carrion_feeder() : SpellScriptLoader("spell_hun_pet_carrion_feeder") { }
class spell_hun_pet_carrion_feeder_SpellScript : public SpellScript
{
PrepareSpellScript(spell_hun_pet_carrion_feeder_SpellScript);
bool Load()
{
if (!GetCaster()->isPet())
return false;
return true;
}
bool Validate(SpellInfo const* /*spellInfo*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_HUNTER_PET_CARRION_FEEDER_TRIGGERED))
return false;
return true;
}
SpellCastResult CheckIfCorpseNear()
{
Unit* caster = GetCaster();
float max_range = GetSpellInfo()->GetMaxRange(false);
WorldObject* result = NULL;
// search for nearby enemy corpse in range
Trinity::AnyDeadUnitSpellTargetInRangeCheck check(caster, max_range, GetSpellInfo(), TARGET_CHECK_ENEMY);
Trinity::WorldObjectSearcher<Trinity::AnyDeadUnitSpellTargetInRangeCheck> searcher(caster, result, check);
caster->GetMap()->VisitFirstFound(caster->m_positionX, caster->m_positionY, max_range, searcher);
if (!result)
return SPELL_FAILED_NO_EDIBLE_CORPSES;
return SPELL_CAST_OK;
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
caster->CastSpell(caster, SPELL_HUNTER_PET_CARRION_FEEDER_TRIGGERED, false);
}
void Register()
{
// add dummy effect spell handler to pet's Last Stand
OnEffectHit += SpellEffectFn(spell_hun_pet_carrion_feeder_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
OnCheckCast += SpellCheckCastFn(spell_hun_pet_carrion_feeder_SpellScript::CheckIfCorpseNear);
}
};
SpellScript* GetSpellScript() const
{
return new spell_hun_pet_carrion_feeder_SpellScript();
}
};
// 55709 - Pet Heart of the Phoenix
class spell_hun_pet_heart_of_the_phoenix : public SpellScriptLoader
{
public:
spell_hun_pet_heart_of_the_phoenix() : SpellScriptLoader("spell_hun_pet_heart_of_the_phoenix") { }
class spell_hun_pet_heart_of_the_phoenix_SpellScript : public SpellScript
{
PrepareSpellScript(spell_hun_pet_heart_of_the_phoenix_SpellScript);
bool Load()
{
if (!GetCaster()->isPet())
return false;
return true;
}
bool Validate(SpellInfo const* /*spellInfo*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_HUNTER_PET_HEART_OF_THE_PHOENIX_TRIGGERED) || !sSpellMgr->GetSpellInfo(SPELL_HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF))
return false;
return true;
}
void HandleScript(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
if (Unit* owner = caster->GetOwner())
if (!caster->HasAura(SPELL_HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF))
{
owner->CastCustomSpell(SPELL_HUNTER_PET_HEART_OF_THE_PHOENIX_TRIGGERED, SPELLVALUE_BASE_POINT0, 100, caster, true);
caster->CastSpell(caster, SPELL_HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF, true);
}
}
void Register()
{
// add dummy effect spell handler to pet's Last Stand
OnEffectHitTarget += SpellEffectFn(spell_hun_pet_heart_of_the_phoenix_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const
{
return new spell_hun_pet_heart_of_the_phoenix_SpellScript();
}
};
// 23989 - Readiness
class spell_hun_readiness : public SpellScriptLoader
{
public:
@@ -340,9 +539,9 @@ class spell_hun_readiness : public SpellScriptLoader
///! If spellId in cooldown map isn't valid, the above will return a null pointer.
if (spellInfo &&
spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER &&
spellInfo->Id != HUNTER_SPELL_READINESS &&
spellInfo->Id != HUNTER_SPELL_BESTIAL_WRATH &&
spellInfo->Id != DRAENEI_SPELL_GIFT_OF_THE_NAARU &&
spellInfo->Id != SPELL_HUNTER_READINESS &&
spellInfo->Id != SPELL_HUNTER_BESTIAL_WRATH &&
spellInfo->Id != SPELL_DRAENEI_GIFT_OF_THE_NAARU &&
spellInfo->GetRecoveryTime() > 0)
caster->RemoveSpellCooldown((itr++)->first, true);
else
@@ -363,7 +562,7 @@ class spell_hun_readiness : public SpellScriptLoader
}
};
// 37506 Scatter Shot
// 37506 - Scatter Shot
class spell_hun_scatter_shot : public SpellScriptLoader
{
public:
@@ -399,13 +598,7 @@ class spell_hun_scatter_shot : public SpellScriptLoader
}
};
// 53302, 53303, 53304 Sniper Training
enum eSniperTrainingSpells
{
SPELL_SNIPER_TRAINING_R1 = 53302,
SPELL_SNIPER_TRAINING_BUFF_R1 = 64418,
};
// -53302 - Sniper Training
class spell_hun_sniper_training : public SpellScriptLoader
{
public:
@@ -415,9 +608,9 @@ class spell_hun_sniper_training : public SpellScriptLoader
{
PrepareAuraScript(spell_hun_sniper_training_AuraScript);
bool Validate(SpellInfo const* /*entry*/)
bool Validate(SpellInfo const* /*spellInfo*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_SNIPER_TRAINING_R1) || !sSpellMgr->GetSpellInfo(SPELL_SNIPER_TRAINING_BUFF_R1))
if (!sSpellMgr->GetSpellInfo(SPELL_HUNTER_SNIPER_TRAINING_R1) || !sSpellMgr->GetSpellInfo(SPELL_HUNTER_SNIPER_TRAINING_BUFF_R1))
return false;
return true;
}
@@ -428,7 +621,7 @@ class spell_hun_sniper_training : public SpellScriptLoader
if (aurEff->GetAmount() <= 0)
{
Unit* caster = GetCaster();
uint32 spellId = SPELL_SNIPER_TRAINING_BUFF_R1 + GetId() - SPELL_SNIPER_TRAINING_R1;
uint32 spellId = SPELL_HUNTER_SNIPER_TRAINING_BUFF_R1 + GetId() - SPELL_HUNTER_SNIPER_TRAINING_R1;
if (Unit* target = GetTarget())
if (!target->HasAura(spellId))
{
@@ -464,197 +657,7 @@ class spell_hun_sniper_training : public SpellScriptLoader
}
};
class spell_hun_pet_heart_of_the_phoenix : public SpellScriptLoader
{
public:
spell_hun_pet_heart_of_the_phoenix() : SpellScriptLoader("spell_hun_pet_heart_of_the_phoenix") { }
class spell_hun_pet_heart_of_the_phoenix_SpellScript : public SpellScript
{
PrepareSpellScript(spell_hun_pet_heart_of_the_phoenix_SpellScript);
bool Load()
{
if (!GetCaster()->isPet())
return false;
return true;
}
bool Validate(SpellInfo const* /*spellEntry*/)
{
if (!sSpellMgr->GetSpellInfo(HUNTER_PET_HEART_OF_THE_PHOENIX_TRIGGERED) || !sSpellMgr->GetSpellInfo(HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF))
return false;
return true;
}
void HandleScript(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
if (Unit* owner = caster->GetOwner())
if (!caster->HasAura(HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF))
{
owner->CastCustomSpell(HUNTER_PET_HEART_OF_THE_PHOENIX_TRIGGERED, SPELLVALUE_BASE_POINT0, 100, caster, true);
caster->CastSpell(caster, HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF, true);
}
}
void Register()
{
// add dummy effect spell handler to pet's Last Stand
OnEffectHitTarget += SpellEffectFn(spell_hun_pet_heart_of_the_phoenix_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const
{
return new spell_hun_pet_heart_of_the_phoenix_SpellScript();
}
};
class spell_hun_pet_carrion_feeder : public SpellScriptLoader
{
public:
spell_hun_pet_carrion_feeder() : SpellScriptLoader("spell_hun_pet_carrion_feeder") { }
class spell_hun_pet_carrion_feeder_SpellScript : public SpellScript
{
PrepareSpellScript(spell_hun_pet_carrion_feeder_SpellScript);
bool Load()
{
if (!GetCaster()->isPet())
return false;
return true;
}
bool Validate(SpellInfo const* /*spellEntry*/)
{
if (!sSpellMgr->GetSpellInfo(HUNTER_PET_SPELL_CARRION_FEEDER_TRIGGERED))
return false;
return true;
}
SpellCastResult CheckIfCorpseNear()
{
Unit* caster = GetCaster();
float max_range = GetSpellInfo()->GetMaxRange(false);
WorldObject* result = NULL;
// search for nearby enemy corpse in range
Trinity::AnyDeadUnitSpellTargetInRangeCheck check(caster, max_range, GetSpellInfo(), TARGET_CHECK_ENEMY);
Trinity::WorldObjectSearcher<Trinity::AnyDeadUnitSpellTargetInRangeCheck> searcher(caster, result, check);
caster->GetMap()->VisitFirstFound(caster->m_positionX, caster->m_positionY, max_range, searcher);
if (!result)
return SPELL_FAILED_NO_EDIBLE_CORPSES;
return SPELL_CAST_OK;
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
caster->CastSpell(caster, HUNTER_PET_SPELL_CARRION_FEEDER_TRIGGERED, false);
}
void Register()
{
// add dummy effect spell handler to pet's Last Stand
OnEffectHit += SpellEffectFn(spell_hun_pet_carrion_feeder_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
OnCheckCast += SpellCheckCastFn(spell_hun_pet_carrion_feeder_SpellScript::CheckIfCorpseNear);
}
};
SpellScript* GetSpellScript() const
{
return new spell_hun_pet_carrion_feeder_SpellScript();
}
};
// 34477 Misdirection
class spell_hun_misdirection : public SpellScriptLoader
{
public:
spell_hun_misdirection() : SpellScriptLoader("spell_hun_misdirection") { }
class spell_hun_misdirection_AuraScript : public AuraScript
{
PrepareAuraScript(spell_hun_misdirection_AuraScript);
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Unit* caster = GetCaster())
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_DEFAULT)
caster->SetReducedThreatPercent(0, 0);
}
void Register()
{
AfterEffectRemove += AuraEffectRemoveFn(spell_hun_misdirection_AuraScript::OnRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const
{
return new spell_hun_misdirection_AuraScript();
}
};
// 35079 Misdirection proc
class spell_hun_misdirection_proc : public SpellScriptLoader
{
public:
spell_hun_misdirection_proc() : SpellScriptLoader("spell_hun_misdirection_proc") { }
class spell_hun_misdirection_proc_AuraScript : public AuraScript
{
PrepareAuraScript(spell_hun_misdirection_proc_AuraScript);
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (GetCaster())
GetCaster()->SetReducedThreatPercent(0, 0);
}
void Register()
{
AfterEffectRemove += AuraEffectRemoveFn(spell_hun_misdirection_proc_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const
{
return new spell_hun_misdirection_proc_AuraScript();
}
};
class spell_hun_disengage : public SpellScriptLoader
{
public:
spell_hun_disengage() : SpellScriptLoader("spell_hun_disengage") { }
class spell_hun_disengage_SpellScript : public SpellScript
{
PrepareSpellScript(spell_hun_disengage_SpellScript);
SpellCastResult CheckCast()
{
Unit* caster = GetCaster();
if (caster->GetTypeId() == TYPEID_PLAYER && !caster->isInCombat())
return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW;
return SPELL_CAST_OK;
}
void Register()
{
OnCheckCast += SpellCheckCastFn(spell_hun_disengage_SpellScript::CheckCast);
}
};
SpellScript* GetSpellScript() const
{
return new spell_hun_disengage_SpellScript();
}
};
// 1515 - Tame Beast
class spell_hun_tame_beast : public SpellScriptLoader
{
public:
@@ -706,6 +709,8 @@ class spell_hun_tame_beast : public SpellScriptLoader
}
};
// -24604 - Furious Howl
// 53434 - Call of the Wild
class spell_hun_target_only_pet_and_owner : public SpellScriptLoader
{
public:
@@ -740,17 +745,17 @@ void AddSC_hunter_spell_scripts()
{
new spell_hun_aspect_of_the_beast();
new spell_hun_chimera_shot();
new spell_hun_disengage();
new spell_hun_invigoration();
new spell_hun_last_stand_pet();
new spell_hun_masters_call();
new spell_hun_misdirection();
new spell_hun_misdirection_proc();
new spell_hun_pet_carrion_feeder();
new spell_hun_pet_heart_of_the_phoenix();
new spell_hun_readiness();
new spell_hun_scatter_shot();
new spell_hun_sniper_training();
new spell_hun_pet_heart_of_the_phoenix();
new spell_hun_pet_carrion_feeder();
new spell_hun_misdirection();
new spell_hun_misdirection_proc();
new spell_hun_disengage();
new spell_hun_tame_beast();
new spell_hun_target_only_pet_and_owner();
}

View File

@@ -29,20 +29,25 @@
enum PriestSpells
{
PRIEST_SPELL_GUARDIAN_SPIRIT_HEAL = 48153,
PRIEST_SPELL_PENANCE_R1 = 47540,
PRIEST_SPELL_PENANCE_R1_DAMAGE = 47758,
PRIEST_SPELL_PENANCE_R1_HEAL = 47757,
PRIEST_SPELL_REFLECTIVE_SHIELD_TRIGGERED = 33619,
PRIEST_SPELL_REFLECTIVE_SHIELD_R1 = 33201,
PRIEST_SPELL_VAMPIRIC_TOUCH_DISPEL = 64085,
PRIEST_SPELL_EMPOWERED_RENEW = 63544,
PRIEST_ICON_ID_EMPOWERED_RENEW_TALENT = 3021,
PRIEST_ICON_ID_PAIN_AND_SUFFERING = 2874,
PRIEST_SHADOW_WORD_DEATH = 32409,
SPELL_PRIEST_EMPOWERED_RENEW = 63544,
SPELL_PRIEST_GUARDIAN_SPIRIT_HEAL = 48153,
SPELL_PRIEST_PENANCE_R1 = 47540,
SPELL_PRIEST_PENANCE_R1_DAMAGE = 47758,
SPELL_PRIEST_PENANCE_R1_HEAL = 47757,
SPELL_PRIEST_REFLECTIVE_SHIELD_TRIGGERED = 33619,
SPELL_PRIEST_REFLECTIVE_SHIELD_R1 = 33201,
SPELL_PRIEST_SHADOW_WORD_DEATH = 32409,
SPELL_PRIEST_T9_HEALING_2P = 67201,
SPELL_PRIEST_VAMPIRIC_TOUCH_DISPEL = 64085,
};
// Guardian Spirit
enum PriestSpellIcons
{
PRIEST_ICON_ID_EMPOWERED_RENEW_TALENT = 3021,
PRIEST_ICON_ID_PAIN_AND_SUFFERING = 2874,
};
// -47788 - Guardian Spirit
class spell_pri_guardian_spirit : public SpellScriptLoader
{
public:
@@ -54,9 +59,9 @@ class spell_pri_guardian_spirit : public SpellScriptLoader
uint32 healPct;
bool Validate(SpellInfo const* /*spellEntry*/)
bool Validate(SpellInfo const* /*spellInfo*/)
{
if (!sSpellMgr->GetSpellInfo(PRIEST_SPELL_GUARDIAN_SPIRIT_HEAL))
if (!sSpellMgr->GetSpellInfo(SPELL_PRIEST_GUARDIAN_SPIRIT_HEAL))
return false;
return true;
}
@@ -82,7 +87,7 @@ class spell_pri_guardian_spirit : public SpellScriptLoader
int32 healAmount = int32(target->CountPctFromMaxHealth(healPct));
// remove the aura now, we don't want 40% healing bonus
Remove(AURA_REMOVE_BY_ENEMY_SPELL);
target->CastCustomSpell(target, PRIEST_SPELL_GUARDIAN_SPIRIT_HEAL, &healAmount, NULL, NULL, true);
target->CastCustomSpell(target, SPELL_PRIEST_GUARDIAN_SPIRIT_HEAL, &healAmount, NULL, NULL, true);
absorbAmount = dmgInfo.GetDamage();
}
@@ -99,6 +104,7 @@ class spell_pri_guardian_spirit : public SpellScriptLoader
}
};
// -8129 - Mana Burn
class spell_pri_mana_burn : public SpellScriptLoader
{
public:
@@ -126,6 +132,7 @@ class spell_pri_mana_burn : public SpellScriptLoader
}
};
// -49821 - Mind Sear
class spell_pri_mind_sear : public SpellScriptLoader
{
public:
@@ -152,12 +159,12 @@ class spell_pri_mind_sear : public SpellScriptLoader
}
};
// 47948 - Pain and Suffering (Proc)
class spell_pri_pain_and_suffering_proc : public SpellScriptLoader
{
public:
spell_pri_pain_and_suffering_proc() : SpellScriptLoader("spell_pri_pain_and_suffering_proc") { }
// 47948 Pain and Suffering (proc)
class spell_pri_pain_and_suffering_proc_SpellScript : public SpellScript
{
PrepareSpellScript(spell_pri_pain_and_suffering_proc_SpellScript);
@@ -182,6 +189,7 @@ class spell_pri_pain_and_suffering_proc : public SpellScriptLoader
}
};
// -47540 - Penance
class spell_pri_penance : public SpellScriptLoader
{
public:
@@ -196,18 +204,18 @@ class spell_pri_penance : public SpellScriptLoader
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
}
bool Validate(SpellInfo const* spellEntry)
bool Validate(SpellInfo const* spellInfo)
{
if (!sSpellMgr->GetSpellInfo(PRIEST_SPELL_PENANCE_R1))
if (!sSpellMgr->GetSpellInfo(SPELL_PRIEST_PENANCE_R1))
return false;
// can't use other spell than this penance due to spell_ranks dependency
if (sSpellMgr->GetFirstSpellInChain(PRIEST_SPELL_PENANCE_R1) != sSpellMgr->GetFirstSpellInChain(spellEntry->Id))
if (sSpellMgr->GetFirstSpellInChain(SPELL_PRIEST_PENANCE_R1) != sSpellMgr->GetFirstSpellInChain(spellInfo->Id))
return false;
uint8 rank = sSpellMgr->GetSpellRank(spellEntry->Id);
if (!sSpellMgr->GetSpellWithRank(PRIEST_SPELL_PENANCE_R1_DAMAGE, rank, true))
uint8 rank = sSpellMgr->GetSpellRank(spellInfo->Id);
if (!sSpellMgr->GetSpellWithRank(SPELL_PRIEST_PENANCE_R1_DAMAGE, rank, true))
return false;
if (!sSpellMgr->GetSpellWithRank(PRIEST_SPELL_PENANCE_R1_HEAL, rank, true))
if (!sSpellMgr->GetSpellWithRank(SPELL_PRIEST_PENANCE_R1_HEAL, rank, true))
return false;
return true;
@@ -224,9 +232,9 @@ class spell_pri_penance : public SpellScriptLoader
uint8 rank = sSpellMgr->GetSpellRank(GetSpellInfo()->Id);
if (caster->IsFriendlyTo(unitTarget))
caster->CastSpell(unitTarget, sSpellMgr->GetSpellWithRank(PRIEST_SPELL_PENANCE_R1_HEAL, rank), false, 0);
caster->CastSpell(unitTarget, sSpellMgr->GetSpellWithRank(SPELL_PRIEST_PENANCE_R1_HEAL, rank), false, 0);
else
caster->CastSpell(unitTarget, sSpellMgr->GetSpellWithRank(PRIEST_SPELL_PENANCE_R1_DAMAGE, rank), false, 0);
caster->CastSpell(unitTarget, sSpellMgr->GetSpellWithRank(SPELL_PRIEST_PENANCE_R1_DAMAGE, rank), false, 0);
}
}
@@ -253,7 +261,43 @@ class spell_pri_penance : public SpellScriptLoader
}
};
// Reflective Shield
// 33110 - Prayer of Mending Heal
class spell_pri_prayer_of_mending_heal : public SpellScriptLoader
{
public:
spell_pri_prayer_of_mending_heal() : SpellScriptLoader("spell_pri_prayer_of_mending_heal") { }
class spell_pri_prayer_of_mending_heal_SpellScript : public SpellScript
{
PrepareSpellScript(spell_pri_prayer_of_mending_heal_SpellScript);
void HandleHeal(SpellEffIndex /*effIndex*/)
{
if (Unit* caster = GetOriginalCaster())
{
if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_PRIEST_T9_HEALING_2P, EFFECT_0))
{
int32 heal = GetHitHeal();
AddPct(heal, aurEff->GetAmount());
SetHitHeal(heal);
}
}
}
void Register()
{
OnEffectHitTarget += SpellEffectFn(spell_pri_prayer_of_mending_heal_SpellScript::HandleHeal, EFFECT_0, SPELL_EFFECT_HEAL);
}
};
SpellScript* GetSpellScript() const
{
return new spell_pri_prayer_of_mending_heal_SpellScript();
}
};
// -17 - Reflective Shield
class spell_pri_reflective_shield_trigger : public SpellScriptLoader
{
public:
@@ -263,9 +307,9 @@ class spell_pri_reflective_shield_trigger : public SpellScriptLoader
{
PrepareAuraScript(spell_pri_reflective_shield_trigger_AuraScript);
bool Validate(SpellInfo const* /*spellEntry*/)
bool Validate(SpellInfo const* /*spellInfo*/)
{
if (!sSpellMgr->GetSpellInfo(PRIEST_SPELL_REFLECTIVE_SHIELD_TRIGGERED) || !sSpellMgr->GetSpellInfo(PRIEST_SPELL_REFLECTIVE_SHIELD_R1))
if (!sSpellMgr->GetSpellInfo(SPELL_PRIEST_REFLECTIVE_SHIELD_TRIGGERED) || !sSpellMgr->GetSpellInfo(SPELL_PRIEST_REFLECTIVE_SHIELD_R1))
return false;
return true;
}
@@ -277,10 +321,10 @@ class spell_pri_reflective_shield_trigger : public SpellScriptLoader
return;
if (GetCaster())
if (AuraEffect* talentAurEff = target->GetAuraEffectOfRankedSpell(PRIEST_SPELL_REFLECTIVE_SHIELD_R1, EFFECT_0))
if (AuraEffect* talentAurEff = target->GetAuraEffectOfRankedSpell(SPELL_PRIEST_REFLECTIVE_SHIELD_R1, EFFECT_0))
{
int32 bp = CalculatePct(absorbAmount, talentAurEff->GetAmount());
target->CastCustomSpell(dmgInfo.GetAttacker(), PRIEST_SPELL_REFLECTIVE_SHIELD_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff);
target->CastCustomSpell(dmgInfo.GetAttacker(), SPELL_PRIEST_REFLECTIVE_SHIELD_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff);
}
}
@@ -296,86 +340,7 @@ class spell_pri_reflective_shield_trigger : public SpellScriptLoader
}
};
enum PrayerOfMending
{
SPELL_T9_HEALING_2_PIECE = 67201,
};
// Prayer of Mending Heal
class spell_pri_prayer_of_mending_heal : public SpellScriptLoader
{
public:
spell_pri_prayer_of_mending_heal() : SpellScriptLoader("spell_pri_prayer_of_mending_heal") { }
class spell_pri_prayer_of_mending_heal_SpellScript : public SpellScript
{
PrepareSpellScript(spell_pri_prayer_of_mending_heal_SpellScript);
void HandleHeal(SpellEffIndex /*effIndex*/)
{
if (Unit* caster = GetOriginalCaster())
{
if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_T9_HEALING_2_PIECE, EFFECT_0))
{
int32 heal = GetHitHeal();
AddPct(heal, aurEff->GetAmount());
SetHitHeal(heal);
}
}
}
void Register()
{
OnEffectHitTarget += SpellEffectFn(spell_pri_prayer_of_mending_heal_SpellScript::HandleHeal, EFFECT_0, SPELL_EFFECT_HEAL);
}
};
SpellScript* GetSpellScript() const
{
return new spell_pri_prayer_of_mending_heal_SpellScript();
}
};
class spell_pri_vampiric_touch : public SpellScriptLoader
{
public:
spell_pri_vampiric_touch() : SpellScriptLoader("spell_pri_vampiric_touch") { }
class spell_pri_vampiric_touch_AuraScript : public AuraScript
{
PrepareAuraScript(spell_pri_vampiric_touch_AuraScript);
bool Validate(SpellInfo const* /*spell*/)
{
if (!sSpellMgr->GetSpellInfo(PRIEST_SPELL_VAMPIRIC_TOUCH_DISPEL))
return false;
return true;
}
void HandleDispel(DispelInfo* /*dispelInfo*/)
{
if (Unit* caster = GetCaster())
if (Unit* target = GetUnitOwner())
if (AuraEffect const* aurEff = GetEffect(EFFECT_1))
{
int32 damage = aurEff->GetAmount() * 8;
// backfire damage
caster->CastCustomSpell(target, PRIEST_SPELL_VAMPIRIC_TOUCH_DISPEL, &damage, NULL, NULL, true, NULL, aurEff);
}
}
void Register()
{
AfterDispel += AuraDispelFn(spell_pri_vampiric_touch_AuraScript::HandleDispel);
}
};
AuraScript* GetAuraScript() const
{
return new spell_pri_vampiric_touch_AuraScript();
}
};
// -139 - Renew
class spell_pri_renew : public SpellScriptLoader
{
public:
@@ -401,7 +366,7 @@ class spell_pri_renew : public SpellScriptLoader
heal = GetTarget()->SpellHealingBonusTaken(caster, GetSpellInfo(), heal, DOT);
int32 basepoints0 = empoweredRenewAurEff->GetAmount() * GetEffect(EFFECT_0)->GetTotalTicks() * int32(heal) / 100;
caster->CastCustomSpell(GetTarget(), PRIEST_SPELL_EMPOWERED_RENEW, &basepoints0, NULL, NULL, true, NULL, aurEff);
caster->CastCustomSpell(GetTarget(), SPELL_PRIEST_EMPOWERED_RENEW, &basepoints0, NULL, NULL, true, NULL, aurEff);
}
}
}
@@ -418,6 +383,7 @@ class spell_pri_renew : public SpellScriptLoader
}
};
// -32379 - Shadow Word Death
class spell_pri_shadow_word_death : public SpellScriptLoader
{
public:
@@ -435,7 +401,7 @@ class spell_pri_shadow_word_death : public SpellScriptLoader
if (AuraEffect* aurEff = GetCaster()->GetDummyAuraEffect(SPELLFAMILY_PRIEST, PRIEST_ICON_ID_PAIN_AND_SUFFERING, EFFECT_1))
AddPct(damage, aurEff->GetAmount());
GetCaster()->CastCustomSpell(GetCaster(), PRIEST_SHADOW_WORD_DEATH, &damage, 0, 0, true);
GetCaster()->CastCustomSpell(GetCaster(), SPELL_PRIEST_SHADOW_WORD_DEATH, &damage, 0, 0, true);
}
void Register()
@@ -450,16 +416,57 @@ class spell_pri_shadow_word_death : public SpellScriptLoader
}
};
// -34914 - Vampiric Touch
class spell_pri_vampiric_touch : public SpellScriptLoader
{
public:
spell_pri_vampiric_touch() : SpellScriptLoader("spell_pri_vampiric_touch") { }
class spell_pri_vampiric_touch_AuraScript : public AuraScript
{
PrepareAuraScript(spell_pri_vampiric_touch_AuraScript);
bool Validate(SpellInfo const* /*spell*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_PRIEST_VAMPIRIC_TOUCH_DISPEL))
return false;
return true;
}
void HandleDispel(DispelInfo* /*dispelInfo*/)
{
if (Unit* caster = GetCaster())
if (Unit* target = GetUnitOwner())
if (AuraEffect const* aurEff = GetEffect(EFFECT_1))
{
int32 damage = aurEff->GetAmount() * 8;
// backfire damage
caster->CastCustomSpell(target, SPELL_PRIEST_VAMPIRIC_TOUCH_DISPEL, &damage, NULL, NULL, true, NULL, aurEff);
}
}
void Register()
{
AfterDispel += AuraDispelFn(spell_pri_vampiric_touch_AuraScript::HandleDispel);
}
};
AuraScript* GetAuraScript() const
{
return new spell_pri_vampiric_touch_AuraScript();
}
};
void AddSC_priest_spell_scripts()
{
new spell_pri_guardian_spirit();
new spell_pri_mana_burn();
new spell_pri_mind_sear();
new spell_pri_pain_and_suffering_proc();
new spell_pri_penance();
new spell_pri_reflective_shield_trigger();
new spell_pri_mind_sear();
new spell_pri_prayer_of_mending_heal();
new spell_pri_vampiric_touch();
new spell_pri_reflective_shield_trigger();
new spell_pri_renew();
new spell_pri_shadow_word_death();
new spell_pri_vampiric_touch();
}

View File

@@ -28,13 +28,13 @@
enum RogueSpells
{
ROGUE_SPELL_SHIV_TRIGGERED = 5940,
ROGUE_SPELL_GLYPH_OF_PREPARATION = 56819,
ROGUE_SPELL_PREY_ON_THE_WEAK = 58670,
ROGUE_SPELL_CHEAT_DEATH_COOLDOWN = 31231,
SPELL_ROGUE_CHEAT_DEATH_COOLDOWN = 31231,
SPELL_ROGUE_GLYPH_OF_PREPARATION = 56819,
SPELL_ROGUE_PREY_ON_THE_WEAK = 58670,
SPELL_ROGUE_SHIV_TRIGGERED = 5940,
};
// Cheat Death
// -31228 - Cheat Death
class spell_rog_cheat_death : public SpellScriptLoader
{
public:
@@ -46,9 +46,9 @@ class spell_rog_cheat_death : public SpellScriptLoader
uint32 absorbChance;
bool Validate(SpellInfo const* /*spellEntry*/)
bool Validate(SpellInfo const* /*spellInfo*/)
{
if (!sSpellMgr->GetSpellInfo(ROGUE_SPELL_CHEAT_DEATH_COOLDOWN))
if (!sSpellMgr->GetSpellInfo(SPELL_ROGUE_CHEAT_DEATH_COOLDOWN))
return false;
return true;
}
@@ -68,11 +68,11 @@ class spell_rog_cheat_death : public SpellScriptLoader
void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)
{
Player* target = GetTarget()->ToPlayer();
if (dmgInfo.GetDamage() < target->GetHealth() || target->HasSpellCooldown(ROGUE_SPELL_CHEAT_DEATH_COOLDOWN) || !roll_chance_i(absorbChance))
if (dmgInfo.GetDamage() < target->GetHealth() || target->HasSpellCooldown(SPELL_ROGUE_CHEAT_DEATH_COOLDOWN) || !roll_chance_i(absorbChance))
return;
target->CastSpell(target, ROGUE_SPELL_CHEAT_DEATH_COOLDOWN, true);
target->AddSpellCooldown(ROGUE_SPELL_CHEAT_DEATH_COOLDOWN, 0, time(NULL) + 60);
target->CastSpell(target, SPELL_ROGUE_CHEAT_DEATH_COOLDOWN, true);
target->AddSpellCooldown(SPELL_ROGUE_CHEAT_DEATH_COOLDOWN, 0, time(NULL) + 60);
uint32 health10 = target->CountPctFromMaxHealth(10);
@@ -97,203 +97,7 @@ class spell_rog_cheat_death : public SpellScriptLoader
}
};
// 31130 - Nerves of Steel
class spell_rog_nerves_of_steel : public SpellScriptLoader
{
public:
spell_rog_nerves_of_steel() : SpellScriptLoader("spell_rog_nerves_of_steel") { }
class spell_rog_nerves_of_steel_AuraScript : public AuraScript
{
PrepareAuraScript(spell_rog_nerves_of_steel_AuraScript);
uint32 absorbPct;
bool Load()
{
absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(GetCaster());
return true;
}
void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/)
{
// Set absorbtion amount to unlimited
amount = -1;
}
void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)
{
// reduces all damage taken while stun or fear
if (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_FLEEING) || (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_STUNNED) && GetTarget()->HasAuraWithMechanic(1<<MECHANIC_STUN)))
absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct);
}
void Register()
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_rog_nerves_of_steel_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB);
OnEffectAbsorb += AuraEffectAbsorbFn(spell_rog_nerves_of_steel_AuraScript::Absorb, EFFECT_0);
}
};
AuraScript* GetAuraScript() const
{
return new spell_rog_nerves_of_steel_AuraScript();
}
};
class spell_rog_preparation : public SpellScriptLoader
{
public:
spell_rog_preparation() : SpellScriptLoader("spell_rog_preparation") { }
class spell_rog_preparation_SpellScript : public SpellScript
{
PrepareSpellScript(spell_rog_preparation_SpellScript);
bool Load()
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
}
bool Validate(SpellInfo const* /*spellEntry*/)
{
if (!sSpellMgr->GetSpellInfo(ROGUE_SPELL_GLYPH_OF_PREPARATION))
return false;
return true;
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Player* caster = GetCaster()->ToPlayer();
//immediately finishes the cooldown on certain Rogue abilities
const SpellCooldowns& cm = caster->GetSpellCooldownMap();
for (SpellCooldowns::const_iterator itr = cm.begin(); itr != cm.end();)
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
if (spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE)
{
if (spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_ROGUE_COLDB_SHADOWSTEP || // Cold Blood, Shadowstep
spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_VAN_EVAS_SPRINT) // Vanish, Evasion, Sprint
caster->RemoveSpellCooldown((itr++)->first, true);
else if (caster->HasAura(ROGUE_SPELL_GLYPH_OF_PREPARATION))
{
if (spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_ROGUE_DISMANTLE || // Dismantle
spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_KICK || // Kick
(spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_BLADE_FLURRY && // Blade Flurry
spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_ROGUE_BLADE_FLURRY))
caster->RemoveSpellCooldown((itr++)->first, true);
else
++itr;
}
else
++itr;
}
else
++itr;
}
}
void Register()
{
// add dummy effect spell handler to Preparation
OnEffectHitTarget += SpellEffectFn(spell_rog_preparation_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const
{
return new spell_rog_preparation_SpellScript();
}
};
// 51685-51689 Prey on the Weak
class spell_rog_prey_on_the_weak : public SpellScriptLoader
{
public:
spell_rog_prey_on_the_weak() : SpellScriptLoader("spell_rog_prey_on_the_weak") { }
class spell_rog_prey_on_the_weak_AuraScript : public AuraScript
{
PrepareAuraScript(spell_rog_prey_on_the_weak_AuraScript);
bool Validate(SpellInfo const* /*spellEntry*/)
{
if (!sSpellMgr->GetSpellInfo(ROGUE_SPELL_PREY_ON_THE_WEAK))
return false;
return true;
}
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
{
Unit* target = GetTarget();
Unit* victim = target->getVictim();
if (victim && (target->GetHealthPct() > victim->GetHealthPct()))
{
if (!target->HasAura(ROGUE_SPELL_PREY_ON_THE_WEAK))
{
int32 bp = GetSpellInfo()->Effects[EFFECT_0].CalcValue();
target->CastCustomSpell(target, ROGUE_SPELL_PREY_ON_THE_WEAK, &bp, 0, 0, true);
}
}
else
target->RemoveAurasDueToSpell(ROGUE_SPELL_PREY_ON_THE_WEAK);
}
void Register()
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_rog_prey_on_the_weak_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
AuraScript* GetAuraScript() const
{
return new spell_rog_prey_on_the_weak_AuraScript();
}
};
class spell_rog_shiv : public SpellScriptLoader
{
public:
spell_rog_shiv() : SpellScriptLoader("spell_rog_shiv") { }
class spell_rog_shiv_SpellScript : public SpellScript
{
PrepareSpellScript(spell_rog_shiv_SpellScript);
bool Load()
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
}
bool Validate(SpellInfo const* /*spellEntry*/)
{
if (!sSpellMgr->GetSpellInfo(ROGUE_SPELL_SHIV_TRIGGERED))
return false;
return true;
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
if (Unit* unitTarget = GetHitUnit())
caster->CastSpell(unitTarget, ROGUE_SPELL_SHIV_TRIGGERED, true);
}
void Register()
{
// add dummy effect spell handler to Shiv
OnEffectHitTarget += SpellEffectFn(spell_rog_shiv_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const
{
return new spell_rog_shiv_SpellScript();
}
};
// -2818 - Deadly Poison
class spell_rog_deadly_poison : public SpellScriptLoader
{
public:
@@ -387,6 +191,164 @@ class spell_rog_deadly_poison : public SpellScriptLoader
}
};
// -31130 - Nerves of Steel
class spell_rog_nerves_of_steel : public SpellScriptLoader
{
public:
spell_rog_nerves_of_steel() : SpellScriptLoader("spell_rog_nerves_of_steel") { }
class spell_rog_nerves_of_steel_AuraScript : public AuraScript
{
PrepareAuraScript(spell_rog_nerves_of_steel_AuraScript);
uint32 absorbPct;
bool Load()
{
absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(GetCaster());
return true;
}
void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/)
{
// Set absorbtion amount to unlimited
amount = -1;
}
void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)
{
// reduces all damage taken while stun or fear
if (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_FLEEING) || (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_STUNNED) && GetTarget()->HasAuraWithMechanic(1<<MECHANIC_STUN)))
absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct);
}
void Register()
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_rog_nerves_of_steel_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB);
OnEffectAbsorb += AuraEffectAbsorbFn(spell_rog_nerves_of_steel_AuraScript::Absorb, EFFECT_0);
}
};
AuraScript* GetAuraScript() const
{
return new spell_rog_nerves_of_steel_AuraScript();
}
};
// 14185 - Preparation
class spell_rog_preparation : public SpellScriptLoader
{
public:
spell_rog_preparation() : SpellScriptLoader("spell_rog_preparation") { }
class spell_rog_preparation_SpellScript : public SpellScript
{
PrepareSpellScript(spell_rog_preparation_SpellScript);
bool Load()
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
}
bool Validate(SpellInfo const* /*spellEntry*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_ROGUE_GLYPH_OF_PREPARATION))
return false;
return true;
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Player* caster = GetCaster()->ToPlayer();
//immediately finishes the cooldown on certain Rogue abilities
const SpellCooldowns& cm = caster->GetSpellCooldownMap();
for (SpellCooldowns::const_iterator itr = cm.begin(); itr != cm.end();)
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
if (spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE)
{
if (spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_ROGUE_COLDB_SHADOWSTEP || // Cold Blood, Shadowstep
spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_VAN_EVAS_SPRINT) // Vanish, Evasion, Sprint
caster->RemoveSpellCooldown((itr++)->first, true);
else if (caster->HasAura(SPELL_ROGUE_GLYPH_OF_PREPARATION))
{
if (spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_ROGUE_DISMANTLE || // Dismantle
spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_KICK || // Kick
(spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_BLADE_FLURRY && // Blade Flurry
spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_ROGUE_BLADE_FLURRY))
caster->RemoveSpellCooldown((itr++)->first, true);
else
++itr;
}
else
++itr;
}
else
++itr;
}
}
void Register()
{
// add dummy effect spell handler to Preparation
OnEffectHitTarget += SpellEffectFn(spell_rog_preparation_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const
{
return new spell_rog_preparation_SpellScript();
}
};
// -51685 - Prey on the Weak
class spell_rog_prey_on_the_weak : public SpellScriptLoader
{
public:
spell_rog_prey_on_the_weak() : SpellScriptLoader("spell_rog_prey_on_the_weak") { }
class spell_rog_prey_on_the_weak_AuraScript : public AuraScript
{
PrepareAuraScript(spell_rog_prey_on_the_weak_AuraScript);
bool Validate(SpellInfo const* /*spellInfo*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_ROGUE_PREY_ON_THE_WEAK))
return false;
return true;
}
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
{
Unit* target = GetTarget();
Unit* victim = target->getVictim();
if (victim && (target->GetHealthPct() > victim->GetHealthPct()))
{
if (!target->HasAura(SPELL_ROGUE_PREY_ON_THE_WEAK))
{
int32 bp = GetSpellInfo()->Effects[EFFECT_0].CalcValue();
target->CastCustomSpell(target, SPELL_ROGUE_PREY_ON_THE_WEAK, &bp, 0, 0, true);
}
}
else
target->RemoveAurasDueToSpell(SPELL_ROGUE_PREY_ON_THE_WEAK);
}
void Register()
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_rog_prey_on_the_weak_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
AuraScript* GetAuraScript() const
{
return new spell_rog_prey_on_the_weak_AuraScript();
}
};
// 36554 - Shadowstep
class spell_rog_shadowstep : public SpellScriptLoader
{
public:
@@ -415,13 +377,54 @@ class spell_rog_shadowstep : public SpellScriptLoader
}
};
// 5938 - Shiv
class spell_rog_shiv : public SpellScriptLoader
{
public:
spell_rog_shiv() : SpellScriptLoader("spell_rog_shiv") { }
class spell_rog_shiv_SpellScript : public SpellScript
{
PrepareSpellScript(spell_rog_shiv_SpellScript);
bool Load()
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
}
bool Validate(SpellInfo const* /*spellInfo*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_ROGUE_SHIV_TRIGGERED))
return false;
return true;
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
if (Unit* unitTarget = GetHitUnit())
caster->CastSpell(unitTarget, SPELL_ROGUE_SHIV_TRIGGERED, true);
}
void Register()
{
OnEffectHitTarget += SpellEffectFn(spell_rog_shiv_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const
{
return new spell_rog_shiv_SpellScript();
}
};
void AddSC_rogue_spell_scripts()
{
new spell_rog_cheat_death();
new spell_rog_deadly_poison();
new spell_rog_nerves_of_steel();
new spell_rog_preparation();
new spell_rog_prey_on_the_weak();
new spell_rog_shiv();
new spell_rog_deadly_poison();
new spell_rog_shadowstep();
new spell_rog_shiv();
}