Core/Scripts: Convert spells to new proc system

- Converted Unit::HandleDummyAuraProc function to AuraScripts
  * Extra: DMC: Madness now uses DB texts. yay!
  * Extra: improvements on Imp. Spell Reflection (range and max targets, filter caster with conditions)

- Fixed Glyph of Succubus. (Closes #6599)

- Changed old (not-blizz) behavior of Vampiric Embrace:
  * Before: party heal affected the priest too and self heal was reduced by that amount to not over-heal
  * Now: self heal amount not affected, rather filter the priest out of the party heal using conditions :)

- Solve bug in AQ 3p set bonus, it should only trigger when healing others, not self heals.
- Priest T10 2p bonus (heal) now rolls its effect properly

- Use brand new GetEffectiveHeal to fix #17142
- While we're at it, also close #17034 for good
- Converted Unit::HandleAuraProc function to AuraScripts (#17941)
- Converted Unit::HandleAuraProc function to AuraScripts (cont'd) (#17955)
- Corrected Flametongue weapon damage formula
- Actually check offhand weapon for flametongue in Lava Lash script
- Implemented halved proc chance for Missile Barrage on Arcane Barrage, Fireball, Frostbolt and Frostfire Bolt cast
- Converted Unit::HandleProcTriggerSpell function to AuraScripts (#17956)
- De-hack Earth shield. Fixes #13808
- Updated Honor among Thieves
- Implemented mana proc for Mark of Conquest in case of ranged attack
- Fixed Scent of Blood giving more stacks than the talent rank currently learnt.
- Ported old proc table. Proc system is dead. Long live the proc system!
- Recklessness should get charges removed per cast. Closes #15529
- Use proc system to remove Molten Core charges on Incinerate/Soul Fire cast. Closes #15942

Closes #3463
Closes #5401
Closes #15595
Closes #15974
Closes #16679
Closes #17925
This commit is contained in:
ariel-
2016-09-25 20:48:31 -03:00
parent e641d0c7d7
commit 2ff855054f
28 changed files with 9190 additions and 323 deletions

View File

@@ -60,8 +60,14 @@ enum HunterSpells
SPELL_HUNTER_VIPER_ATTACK_SPEED = 60144,
SPELL_DRAENEI_GIFT_OF_THE_NAARU = 59543,
SPELL_ROAR_OF_SACRIFICE_TRIGGERED = 67481,
SPELL_LOCK_AND_LOAD_TRIGGER = 56453,
SPELL_LOCK_AND_LOAD_MARKER = 67544
SPELL_HUNTER_LOCK_AND_LOAD_TRIGGER = 56453,
SPELL_HUNTER_LOCK_AND_LOAD_MARKER = 67544,
SPELL_HUNTER_KILL_COMMAND_HUNTER = 34027,
SPELL_HUNTER_THRILL_OF_THE_HUNT_MANA = 34720,
SPELL_REPLENISHMENT = 57669,
SPELL_HUNTER_RAPID_RECUPERATION_MANA_R1 = 56654,
SPELL_HUNTER_RAPID_RECUPERATION_MANA_R2 = 58882,
SPELL_HUNTER_GLYPH_OF_MEND_PET_HAPPINESS = 57894
};
// 13161 - Aspect of the Beast
@@ -209,51 +215,56 @@ class spell_hun_chimera_shot : public SpellScriptLoader
flag96 familyFlag = aura->GetSpellInfo()->SpellFamilyFlags;
if (!(familyFlag[1] & 0x00000080 || familyFlag[0] & 0x0000C000))
continue;
if (AuraEffect* aurEff = aura->GetEffect(0))
if (AuraEffect const* aurEff = aura->GetEffect(EFFECT_0))
{
// Serpent Sting - Instantly deals 40% of the damage done by your Serpent Sting.
if (familyFlag[0] & 0x4000)
{
int32 TickCount = aurEff->GetTotalTicks();
spellId = SPELL_HUNTER_CHIMERA_SHOT_SERPENT;
basePoint = (aurEff->GetAmount() + aurEff->GetBonusAmount()) * aurEff->GetDonePct();
ApplyPct(basePoint, TickCount * 40);
basePoint = unitTarget->SpellDamageBonusTaken(caster, aura->GetSpellInfo(), basePoint, DOT, aura->GetStackAmount());
if (Player* modOwner = caster->GetSpellModOwner())
modOwner->ApplySpellMod(aura->GetSpellInfo()->Id, SPELLMOD_DOT, basePoint);
aurEff->SetBonusAmount(caster->SpellDamageBonusDone(unitTarget, aurEff->GetSpellInfo(), 0, DOT));
// first, calculate damage of basic tick (C&P from AuraEffect::HandlePeriodicDamageAurasTick)
basePoint = (aurEff->GetAmount() + aurEff->GetBonusAmount()) * aurEff->GetDonePct();
if (Player* modOwner = caster->GetSpellModOwner())
modOwner->ApplySpellMod<SPELLMOD_DOT>(aurEff->GetSpellInfo()->Id, basePoint);
basePoint = unitTarget->SpellDamageBonusTaken(caster, aurEff->GetSpellInfo(), basePoint, DOT, aura->GetStackAmount());
// then, multiply to get damage potential
basePoint *= aurEff->GetTotalTicks();
ApplyPct(basePoint, 40);
}
// Viper Sting - Instantly restores mana to you equal to 60% of the total amount drained by your Viper Sting.
else if (familyFlag[1] & 0x00000080)
{
int32 TickCount = aura->GetEffect(0)->GetTotalTicks();
spellId = SPELL_HUNTER_CHIMERA_SHOT_VIPER;
// Amount of one aura tick
// Amount of one aura tick (C&P from AuraEffect::HandlePeriodicManaLeechAuraTick)
basePoint = aurEff->GetAmount();
// max value
int32 maxmana = CalculatePct(caster->GetMaxPower(POWER_MANA), basePoint * 2.0f);
ApplyPct(basePoint, caster->GetMaxPower(POWER_MANA));
if (basePoint > maxmana)
basePoint = maxmana;
basePoint = int32(CalculatePct(unitTarget->GetMaxPower(POWER_MANA), aurEff->GetAmount()));
int32 casterBasePoint = aurEff->GetAmount() * unitTarget->GetMaxPower(POWER_MANA) / 50; /// @todo WTF? caster uses unitTarget?
int32 casterBasePoint = CalculatePct(caster->GetMaxPower(POWER_MANA), aurEff->GetAmount() * 2.0f);
if (basePoint > casterBasePoint)
basePoint = casterBasePoint;
ApplyPct(basePoint, TickCount * 60);
basePoint *= aurEff->GetTotalTicks();
ApplyPct(basePoint, 60);
}
// 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 = SPELL_HUNTER_CHIMERA_SHOT_SCORPID;
// ?? nothing say in spell desc (possibly need addition check)
//if (familyFlag & 0x0000010000000000LL || // dot
// familyFlag & 0x0000100000000000LL) // stun
//{
// spellId = 53366; // 53366 Chimera Shot - Wyvern
//}
// Refresh aura duration
aura->RefreshDuration();
}
break;
}
if (spellId)
caster->CastCustomSpell(unitTarget, spellId, &basePoint, 0, 0, true);
caster->CastCustomSpell(spellId, SPELLVALUE_BASE_POINT0, basePoint, unitTarget, TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD));
if (spellId == SPELL_HUNTER_CHIMERA_SHOT_SCORPID && caster->ToPlayer()) // Scorpid Sting - Add 1 minute cooldown
caster->GetSpellHistory()->AddCooldown(spellId, 0, std::chrono::minutes(1));
}
@@ -364,6 +375,76 @@ class spell_hun_glyph_of_arcane_shot : public SpellScriptLoader
}
};
// 57870 - Glyph of Mend Pet
class spell_hun_glyph_of_mend_pet : public SpellScriptLoader
{
public:
spell_hun_glyph_of_mend_pet() : SpellScriptLoader("spell_hun_glyph_of_mend_pet") { }
class spell_hun_glyph_of_mend_pet_AuraScript : public AuraScript
{
PrepareAuraScript(spell_hun_glyph_of_mend_pet_AuraScript);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_HUNTER_GLYPH_OF_MEND_PET_HAPPINESS))
return false;
return true;
}
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
eventInfo.GetActor()->CastSpell(eventInfo.GetProcTarget(), SPELL_HUNTER_GLYPH_OF_MEND_PET_HAPPINESS, true);
}
void Register() override
{
OnEffectProc += AuraEffectProcFn(spell_hun_glyph_of_mend_pet_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_hun_glyph_of_mend_pet_AuraScript();
}
};
// -53290 - Hunting Party
class spell_hun_hunting_party : public SpellScriptLoader
{
public:
spell_hun_hunting_party() : SpellScriptLoader("spell_hun_hunting_party") { }
class spell_hun_hunting_party_AuraScript : public AuraScript
{
PrepareAuraScript(spell_hun_hunting_party_AuraScript);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_REPLENISHMENT))
return false;
return true;
}
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
eventInfo.GetActor()->CastSpell((Unit*)nullptr, SPELL_REPLENISHMENT, true);
}
void Register() override
{
OnEffectProc += AuraEffectProcFn(spell_hun_hunting_party_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_hun_hunting_party_AuraScript();
}
};
// -19572 - Improved Mend Pet
class spell_hun_improved_mend_pet : public SpellScriptLoader
{
@@ -442,6 +523,46 @@ class spell_hun_invigoration : public SpellScriptLoader
}
};
// 58914 - Kill Command
class spell_hun_kill_command_pet : public SpellScriptLoader
{
public:
spell_hun_kill_command_pet() : SpellScriptLoader("spell_hun_kill_command_pet") { }
class spell_hun_kill_command_pet_AuraScript : public AuraScript
{
PrepareAuraScript(spell_hun_kill_command_pet_AuraScript);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_HUNTER_KILL_COMMAND_HUNTER))
return false;
return true;
}
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
{
// prevent charge drop (aura has both proc charge and stacks)
PreventDefaultAction();
if (Unit* owner = eventInfo.GetActor()->GetOwner())
owner->RemoveAuraFromStack(SPELL_HUNTER_KILL_COMMAND_HUNTER);
ModStackAmount(-1);
}
void Register() override
{
OnEffectProc += AuraEffectProcFn(spell_hun_kill_command_pet_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_hun_kill_command_pet_AuraScript();
}
};
// 53478 - Last Stand Pet
class spell_hun_last_stand_pet : public SpellScriptLoader
{
@@ -490,15 +611,15 @@ class spell_hun_lock_and_load : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_LOCK_AND_LOAD_TRIGGER) ||
!sSpellMgr->GetSpellInfo(SPELL_LOCK_AND_LOAD_MARKER))
if (!sSpellMgr->GetSpellInfo(SPELL_HUNTER_LOCK_AND_LOAD_TRIGGER) ||
!sSpellMgr->GetSpellInfo(SPELL_HUNTER_LOCK_AND_LOAD_MARKER))
return false;
return true;
}
bool CheckProc(ProcEventInfo& eventInfo)
{
if (eventInfo.GetActor()->HasAura(SPELL_LOCK_AND_LOAD_MARKER))
if (eventInfo.GetActor()->HasAura(SPELL_HUNTER_LOCK_AND_LOAD_MARKER))
return false;
return true;
@@ -522,8 +643,8 @@ class spell_hun_lock_and_load : public SpellScriptLoader
return;
Unit* caster = eventInfo.GetActor();
caster->CastSpell(caster, SPELL_LOCK_AND_LOAD_TRIGGER, true);
caster->CastSpell(caster, SPELL_LOCK_AND_LOAD_MARKER, true);
caster->CastSpell(caster, SPELL_HUNTER_LOCK_AND_LOAD_TRIGGER, true);
caster->CastSpell(caster, SPELL_HUNTER_LOCK_AND_LOAD_MARKER, true);
}
void Register() override
@@ -753,11 +874,13 @@ class spell_hun_pet_heart_of_the_phoenix : public SpellScriptLoader
{
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() override
@@ -868,6 +991,64 @@ class spell_hun_rapid_recuperation : public SpellScriptLoader
}
};
// -53228 - Rapid Recuperation (talent aura)
class spell_hun_rapid_recuperation_trigger : public SpellScriptLoader
{
public:
spell_hun_rapid_recuperation_trigger() : SpellScriptLoader("spell_hun_rapid_recuperation_trigger") { }
class spell_hun_rapid_recuperation_trigger_AuraScript : public AuraScript
{
PrepareAuraScript(spell_hun_rapid_recuperation_trigger_AuraScript);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_HUNTER_RAPID_RECUPERATION_MANA_R1) ||
!sSpellMgr->GetSpellInfo(SPELL_HUNTER_RAPID_RECUPERATION_MANA_R2))
return false;
return true;
}
void HandleRapidFireProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
{
// Proc only from Rapid Fire
SpellInfo const* spellInfo = eventInfo.GetSpellInfo();
if (!spellInfo || !(spellInfo->SpellFamilyFlags[0] & 0x00000020))
{
PreventDefaultAction();
return;
}
}
void HandleRapidKillingProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
{
static uint32 const triggerSpells[2] = { SPELL_HUNTER_RAPID_RECUPERATION_MANA_R1, SPELL_HUNTER_RAPID_RECUPERATION_MANA_R2 };
PreventDefaultAction();
// Proc only from Rapid Killing
SpellInfo const* spellInfo = eventInfo.GetSpellInfo();
if (!spellInfo || !(spellInfo->SpellFamilyFlags[1] & 0x01000000))
return;
uint8 rank = GetSpellInfo()->GetRank();
uint32 spellId = triggerSpells[rank - 1];
eventInfo.GetActor()->CastSpell((Unit*)nullptr, spellId, true);
}
void Register() override
{
OnEffectProc += AuraEffectProcFn(spell_hun_rapid_recuperation_trigger_AuraScript::HandleRapidFireProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL);
OnEffectProc += AuraEffectProcFn(spell_hun_rapid_recuperation_trigger_AuraScript::HandleRapidKillingProc, EFFECT_1, SPELL_AURA_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_hun_rapid_recuperation_trigger_AuraScript();
}
};
// 23989 - Readiness
class spell_hun_readiness : public SpellScriptLoader
{
@@ -1135,6 +1316,64 @@ class spell_hun_target_only_pet_and_owner : public SpellScriptLoader
}
};
// -34497 - Thrill of the Hunt
class spell_hun_thrill_of_the_hunt : public SpellScriptLoader
{
public:
spell_hun_thrill_of_the_hunt() : SpellScriptLoader("spell_hun_thrill_of_the_hunt") { }
class spell_hun_thrill_of_the_hunt_AuraScript : public AuraScript
{
PrepareAuraScript(spell_hun_thrill_of_the_hunt_AuraScript);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_HUNTER_THRILL_OF_THE_HUNT_MANA))
return false;
return true;
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
SpellInfo const* spellInfo = eventInfo.GetSpellInfo();
if (!spellInfo)
return;
Unit* caster = eventInfo.GetActor();
int32 amount = 0;
// Explosive Shot
if (spellInfo->SpellFamilyFlags[2] & 0x200)
{
if (AuraEffect const* explosiveShot = eventInfo.GetProcTarget()->GetAuraEffect(SPELL_AURA_PERIODIC_DUMMY, SPELLFAMILY_HUNTER, 0x00000000, 0x80000000, 0x00000000, caster->GetGUID()))
{
// due to Lock and Load SpellInfo::CalcPowerCost might return 0, so just calculate it manually
amount = CalculatePct(static_cast<int32>(CalculatePct(caster->GetCreateMana(), explosiveShot->GetSpellInfo()->ManaCostPercentage)), aurEff->GetAmount());
amount /= explosiveShot->GetSpellInfo()->GetMaxTicks();
}
}
else
amount = CalculatePct(static_cast<int32>(spellInfo->CalcPowerCost(caster, spellInfo->GetSchoolMask())), aurEff->GetAmount());
if (!amount)
return;
caster->CastCustomSpell(SPELL_HUNTER_THRILL_OF_THE_HUNT_MANA, SPELLVALUE_BASE_POINT0, amount, (Unit*)nullptr, true);
}
void Register() override
{
OnEffectProc += AuraEffectProcFn(spell_hun_thrill_of_the_hunt_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_hun_thrill_of_the_hunt_AuraScript();
}
};
// 67151 - T9 4P Bonus
class spell_hun_t9_4p_bonus : public SpellScriptLoader
{
@@ -1230,8 +1469,11 @@ void AddSC_hunter_spell_scripts()
new spell_hun_chimera_shot();
new spell_hun_disengage();
new spell_hun_glyph_of_arcane_shot();
new spell_hun_glyph_of_mend_pet();
new spell_hun_hunting_party();
new spell_hun_improved_mend_pet();
new spell_hun_invigoration();
new spell_hun_kill_command_pet();
new spell_hun_last_stand_pet();
new spell_hun_lock_and_load();
new spell_hun_masters_call();
@@ -1241,12 +1483,14 @@ void AddSC_hunter_spell_scripts()
new spell_hun_pet_heart_of_the_phoenix();
new spell_hun_piercing_shots();
new spell_hun_rapid_recuperation();
new spell_hun_rapid_recuperation_trigger();
new spell_hun_readiness();
new spell_hun_roar_of_sacrifice();
new spell_hun_scatter_shot();
new spell_hun_sniper_training();
new spell_hun_tame_beast();
new spell_hun_target_only_pet_and_owner();
new spell_hun_thrill_of_the_hunt();
new spell_hun_t9_4p_bonus();
new spell_hun_viper_attack_speed();
}