converted all tabs to 4 spaces

This commit is contained in:
Yehonal
2016-06-26 19:23:57 +02:00
parent 52f305111c
commit f6eefedcd5
717 changed files with 132388 additions and 132388 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -29,20 +29,20 @@
enum DruidSpells
{
// Ours
SPELL_DRUID_GLYPH_OF_WILD_GROWTH = 62970,
SPELL_DRUID_NURTURING_INSTINCT_R1 = 47179,
SPELL_DRUID_NURTURING_INSTINCT_R2 = 47180,
SPELL_DRUID_FERAL_SWIFTNESS_R1 = 17002,
SPELL_DRUID_FERAL_SWIFTNESS_R2 = 24866,
SPELL_DRUID_FERAL_SWIFTNESS_PASSIVE_1 = 24867,
SPELL_DRUID_FERAL_SWIFTNESS_PASSIVE_2 = 24864,
SPELL_DRUID_BARKSKIN = 22812,
SPELL_DRUID_GLYPH_OF_BARKSKIN = 63057,
SPELL_DRUID_GLYPH_OF_BARKSKIN_TRIGGER = 63058,
// Ours
SPELL_DRUID_GLYPH_OF_WILD_GROWTH = 62970,
SPELL_DRUID_NURTURING_INSTINCT_R1 = 47179,
SPELL_DRUID_NURTURING_INSTINCT_R2 = 47180,
SPELL_DRUID_FERAL_SWIFTNESS_R1 = 17002,
SPELL_DRUID_FERAL_SWIFTNESS_R2 = 24866,
SPELL_DRUID_FERAL_SWIFTNESS_PASSIVE_1 = 24867,
SPELL_DRUID_FERAL_SWIFTNESS_PASSIVE_2 = 24864,
SPELL_DRUID_BARKSKIN = 22812,
SPELL_DRUID_GLYPH_OF_BARKSKIN = 63057,
SPELL_DRUID_GLYPH_OF_BARKSKIN_TRIGGER = 63058,
// Theirs
// Theirs
SPELL_DRUID_ENRAGE_MOD_DAMAGE = 51185,
SPELL_DRUID_GLYPH_OF_TYPHOON = 62135,
SPELL_DRUID_IDOL_OF_FERAL_SHADOWS = 34241,
@@ -72,18 +72,18 @@ class spell_dru_t10_balance_4p_bonus : public SpellScriptLoader
bool CheckProc(ProcEventInfo& eventInfo)
{
return eventInfo.GetActor() && eventInfo.GetProcTarget();
return eventInfo.GetActor() && eventInfo.GetProcTarget();
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
uint32 triggered_spell_id = 71023;
uint32 triggered_spell_id = 71023;
SpellInfo const* triggeredSpell = sSpellMgr->GetSpellInfo(triggered_spell_id);
int32 amount = CalculatePct(eventInfo.GetDamageInfo()->GetDamage(), aurEff->GetAmount()) / triggeredSpell->GetMaxTicks();
eventInfo.GetProcTarget()->CastDelayedSpellWithPeriodicAmount(GetTarget(), triggered_spell_id, SPELL_AURA_PERIODIC_DAMAGE, amount, EFFECT_0);
int32 amount = CalculatePct(eventInfo.GetDamageInfo()->GetDamage(), aurEff->GetAmount()) / triggeredSpell->GetMaxTicks();
eventInfo.GetProcTarget()->CastDelayedSpellWithPeriodicAmount(GetTarget(), triggered_spell_id, SPELL_AURA_PERIODIC_DAMAGE, amount, EFFECT_0);
//GetTarget()->CastCustomSpell(triggered_spell_id, SPELLVALUE_BASE_POINT0, amount, eventInfo.GetProcTarget(), true, NULL, aurEff);
}
@@ -112,14 +112,14 @@ class spell_dru_nurturing_instinct : public SpellScriptLoader
void AfterApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
if (Player* player = GetTarget()->ToPlayer())
player->addSpell(GetSpellInfo()->GetRank() == 1 ? SPELL_DRUID_NURTURING_INSTINCT_R1 : SPELL_DRUID_NURTURING_INSTINCT_R2, SPEC_MASK_ALL, false, true);
if (Player* player = GetTarget()->ToPlayer())
player->addSpell(GetSpellInfo()->GetRank() == 1 ? SPELL_DRUID_NURTURING_INSTINCT_R1 : SPELL_DRUID_NURTURING_INSTINCT_R2, SPEC_MASK_ALL, false, true);
}
void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Player* player = GetTarget()->ToPlayer())
player->removeSpell(GetSpellInfo()->GetRank() == 1 ? SPELL_DRUID_NURTURING_INSTINCT_R1 : SPELL_DRUID_NURTURING_INSTINCT_R2, SPEC_MASK_ALL, true);
if (Player* player = GetTarget()->ToPlayer())
player->removeSpell(GetSpellInfo()->GetRank() == 1 ? SPELL_DRUID_NURTURING_INSTINCT_R1 : SPELL_DRUID_NURTURING_INSTINCT_R2, SPEC_MASK_ALL, true);
}
void Register()
@@ -146,9 +146,9 @@ class spell_dru_feral_swiftness : public SpellScriptLoader
void AfterApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
if (Player* player = GetTarget()->ToPlayer())
if (uint8 rank = player->HasTalent(SPELL_DRUID_FERAL_SWIFTNESS_R1, player->GetActiveSpec()) ? 1 : (player->HasTalent(SPELL_DRUID_FERAL_SWIFTNESS_R2, player->GetActiveSpec()) ? 2 : 0))
player->CastSpell(player, rank == 1 ? SPELL_DRUID_FERAL_SWIFTNESS_PASSIVE_1 : SPELL_DRUID_FERAL_SWIFTNESS_PASSIVE_2, true, NULL, aurEff, GetCasterGUID());
if (Player* player = GetTarget()->ToPlayer())
if (uint8 rank = player->HasTalent(SPELL_DRUID_FERAL_SWIFTNESS_R1, player->GetActiveSpec()) ? 1 : (player->HasTalent(SPELL_DRUID_FERAL_SWIFTNESS_R2, player->GetActiveSpec()) ? 2 : 0))
player->CastSpell(player, rank == 1 ? SPELL_DRUID_FERAL_SWIFTNESS_PASSIVE_1 : SPELL_DRUID_FERAL_SWIFTNESS_PASSIVE_2, true, NULL, aurEff, GetCasterGUID());
}
void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -181,16 +181,16 @@ class spell_dru_omen_of_clarity : public SpellScriptLoader
bool CheckProc(ProcEventInfo& eventInfo)
{
const SpellInfo* spellInfo = eventInfo.GetDamageInfo()->GetSpellInfo();
if (!spellInfo)
return true;
const SpellInfo* spellInfo = eventInfo.GetDamageInfo()->GetSpellInfo();
if (!spellInfo)
return true;
// xinef: no mana cost
if (spellInfo->ManaCost == 0 && spellInfo->ManaCostPercentage == 0)
return false;
// xinef: no mana cost
if (spellInfo->ManaCost == 0 && spellInfo->ManaCostPercentage == 0)
return false;
// xinef: SPELL_ATTR0_CU_NO_INITIAL_THREAT and SPELL_ATTR0_CU_DIRECT_DAMAGE contains spells capable of healing and damaging + some others, but this is taken care of above
return spellInfo->HasAttribute(SpellCustomAttributes(SPELL_ATTR0_CU_DIRECT_DAMAGE|SPELL_ATTR0_CU_NO_INITIAL_THREAT));
// xinef: SPELL_ATTR0_CU_NO_INITIAL_THREAT and SPELL_ATTR0_CU_DIRECT_DAMAGE contains spells capable of healing and damaging + some others, but this is taken care of above
return spellInfo->HasAttribute(SpellCustomAttributes(SPELL_ATTR0_CU_DIRECT_DAMAGE|SPELL_ATTR0_CU_NO_INITIAL_THREAT));
}
void Register()
@@ -216,31 +216,31 @@ class spell_dru_brambles_treant : public SpellScriptLoader
bool CheckProc(ProcEventInfo& eventInfo)
{
if (Player* player = GetUnitOwner()->GetSpellModOwner())
{
int32 amount = 0;
if (player->HasAura(SPELL_DRUID_BARKSKIN, player->GetGUID()))
player->ApplySpellMod(SPELL_DRUID_BARKSKIN, SPELLMOD_CHANCE_OF_SUCCESS, amount);
if (Player* player = GetUnitOwner()->GetSpellModOwner())
{
int32 amount = 0;
if (player->HasAura(SPELL_DRUID_BARKSKIN, player->GetGUID()))
player->ApplySpellMod(SPELL_DRUID_BARKSKIN, SPELLMOD_CHANCE_OF_SUCCESS, amount);
return roll_chance_i(amount);
}
return roll_chance_i(amount);
}
return false;
return false;
}
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
{
// xinef: chance of success stores proper amount of damage increase
// xinef: little hack because GetSpellModOwner will return NULL pointer at this point (early summoning stage)
if (GetUnitOwner()->IsSummon())
if (Unit* owner = GetUnitOwner()->ToTempSummon()->GetSummoner())
if (Player* player = owner->GetSpellModOwner())
player->ApplySpellMod(SPELL_DRUID_BARKSKIN, SPELLMOD_CHANCE_OF_SUCCESS, amount);
}
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
{
// xinef: chance of success stores proper amount of damage increase
// xinef: little hack because GetSpellModOwner will return NULL pointer at this point (early summoning stage)
if (GetUnitOwner()->IsSummon())
if (Unit* owner = GetUnitOwner()->ToTempSummon()->GetSummoner())
if (Player* player = owner->GetSpellModOwner())
player->ApplySpellMod(SPELL_DRUID_BARKSKIN, SPELLMOD_CHANCE_OF_SUCCESS, amount);
}
void Register()
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dru_brambles_treant_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dru_brambles_treant_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
DoCheckProc += AuraCheckProcFn(spell_dru_brambles_treant_AuraScript::CheckProc);
}
};
@@ -262,13 +262,13 @@ class spell_dru_barkskin : public SpellScriptLoader
void AfterApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
if (GetUnitOwner()->HasAura(SPELL_DRUID_GLYPH_OF_BARKSKIN, GetUnitOwner()->GetGUID()))
GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_DRUID_GLYPH_OF_BARKSKIN_TRIGGER, true);
if (GetUnitOwner()->HasAura(SPELL_DRUID_GLYPH_OF_BARKSKIN, GetUnitOwner()->GetGUID()))
GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_DRUID_GLYPH_OF_BARKSKIN_TRIGGER, true);
}
void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
GetUnitOwner()->RemoveAurasDueToSpell(SPELL_DRUID_GLYPH_OF_BARKSKIN_TRIGGER, GetUnitOwner()->GetGUID());
GetUnitOwner()->RemoveAurasDueToSpell(SPELL_DRUID_GLYPH_OF_BARKSKIN_TRIGGER, GetUnitOwner()->GetGUID());
}
void Register()
@@ -295,77 +295,77 @@ class spell_dru_treant_scaling : public SpellScriptLoader
void CalculateResistanceAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
{
// xinef: treant inherits 40% of resistance from owner and 35% of armor (guessed)
if (Unit* owner = GetUnitOwner()->GetOwner())
{
SpellSchoolMask schoolMask = SpellSchoolMask(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue);
int32 modifier = schoolMask == SPELL_SCHOOL_MASK_NORMAL ? 35 : 40;
amount = CalculatePct(std::max<int32>(0, owner->GetResistance(schoolMask)), modifier);
}
// xinef: treant inherits 40% of resistance from owner and 35% of armor (guessed)
if (Unit* owner = GetUnitOwner()->GetOwner())
{
SpellSchoolMask schoolMask = SpellSchoolMask(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue);
int32 modifier = schoolMask == SPELL_SCHOOL_MASK_NORMAL ? 35 : 40;
amount = CalculatePct(std::max<int32>(0, owner->GetResistance(schoolMask)), modifier);
}
}
void CalculateStatAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
{
// xinef: treant inherits 30% of intellect / stamina (guessed)
if (Unit* owner = GetUnitOwner()->GetOwner())
{
Stats stat = Stats(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue);
amount = CalculatePct(std::max<int32>(0, owner->GetStat(stat)), 30);
}
// xinef: treant inherits 30% of intellect / stamina (guessed)
if (Unit* owner = GetUnitOwner()->GetOwner())
{
Stats stat = Stats(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue);
amount = CalculatePct(std::max<int32>(0, owner->GetStat(stat)), 30);
}
}
void CalculateAPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
void CalculateAPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
{
// xinef: treant inherits 105% of SP as AP - 15% of damage increase per hit
if (Unit* owner = GetUnitOwner()->GetOwner())
{
int32 nature = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_NATURE);
amount = CalculatePct(std::max<int32>(0, nature), 105);
// xinef: treant inherits 105% of SP as AP - 15% of damage increase per hit
if (Unit* owner = GetUnitOwner()->GetOwner())
{
int32 nature = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_NATURE);
amount = CalculatePct(std::max<int32>(0, nature), 105);
// xinef: brambles talent
if (AuraEffect const* bramblesEff = owner->GetAuraEffect(SPELL_AURA_ADD_FLAT_MODIFIER, SPELLFAMILY_DRUID, 53, 2))
AddPct(amount, bramblesEff->GetAmount());
}
// xinef: brambles talent
if (AuraEffect const* bramblesEff = owner->GetAuraEffect(SPELL_AURA_ADD_FLAT_MODIFIER, SPELLFAMILY_DRUID, 53, 2))
AddPct(amount, bramblesEff->GetAmount());
}
}
void CalculateSPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
void CalculateSPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
{
// xinef: treant inherits 15% of SP
if (Unit* owner = GetUnitOwner()->GetOwner())
{
int32 nature = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_NATURE);
amount = CalculatePct(std::max<int32>(0, nature), 15);
// xinef: treant inherits 15% of SP
if (Unit* owner = GetUnitOwner()->GetOwner())
{
int32 nature = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_NATURE);
amount = CalculatePct(std::max<int32>(0, nature), 15);
// xinef: Update appropriate player field
if (owner->GetTypeId() == TYPEID_PLAYER)
owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount);
}
// xinef: Update appropriate player field
if (owner->GetTypeId() == TYPEID_PLAYER)
owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount);
}
}
void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, aurEff->GetAuraType(), true, SPELL_BLOCK_TYPE_POSITIVE);
if (aurEff->GetAuraType() == SPELL_AURA_MOD_ATTACK_POWER)
GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_ATTACK_POWER_PCT, true, SPELL_BLOCK_TYPE_POSITIVE);
else if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT)
GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, true, SPELL_BLOCK_TYPE_POSITIVE);
}
void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, aurEff->GetAuraType(), true, SPELL_BLOCK_TYPE_POSITIVE);
if (aurEff->GetAuraType() == SPELL_AURA_MOD_ATTACK_POWER)
GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_ATTACK_POWER_PCT, true, SPELL_BLOCK_TYPE_POSITIVE);
else if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT)
GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, true, SPELL_BLOCK_TYPE_POSITIVE);
}
void Register()
{
if (m_scriptSpellId != 35669)
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dru_treant_scaling_AuraScript::CalculateResistanceAmount, EFFECT_ALL, SPELL_AURA_MOD_RESISTANCE);
if (m_scriptSpellId != 35669)
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dru_treant_scaling_AuraScript::CalculateResistanceAmount, EFFECT_ALL, SPELL_AURA_MOD_RESISTANCE);
if (m_scriptSpellId == 35669 || m_scriptSpellId == 35670)
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dru_treant_scaling_AuraScript::CalculateStatAmount, EFFECT_ALL, SPELL_AURA_MOD_STAT);
if (m_scriptSpellId == 35669 || m_scriptSpellId == 35670)
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dru_treant_scaling_AuraScript::CalculateStatAmount, EFFECT_ALL, SPELL_AURA_MOD_STAT);
if (m_scriptSpellId == 35669)
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dru_treant_scaling_AuraScript::CalculateAPAmount, EFFECT_ALL, SPELL_AURA_MOD_ATTACK_POWER);
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dru_treant_scaling_AuraScript::CalculateSPAmount, EFFECT_ALL, SPELL_AURA_MOD_DAMAGE_DONE);
}
if (m_scriptSpellId == 35669)
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dru_treant_scaling_AuraScript::CalculateAPAmount, EFFECT_ALL, SPELL_AURA_MOD_ATTACK_POWER);
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dru_treant_scaling_AuraScript::CalculateSPAmount, EFFECT_ALL, SPELL_AURA_MOD_DAMAGE_DONE);
}
OnEffectApply += AuraEffectApplyFn(spell_dru_treant_scaling_AuraScript::HandleEffectApply, EFFECT_ALL, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL);
OnEffectApply += AuraEffectApplyFn(spell_dru_treant_scaling_AuraScript::HandleEffectApply, EFFECT_ALL, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL);
}
};
@@ -614,20 +614,20 @@ class spell_dru_lifebloom : public SpellScriptLoader
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
return;
// final heal
// final heal
int32 stack = GetStackAmount();
int32 healAmount = aurEff->GetAmount();
const SpellInfo* finalHeal = sSpellMgr->GetSpellInfo(SPELL_DRUID_LIFEBLOOM_FINAL_HEAL);
const SpellInfo* finalHeal = sSpellMgr->GetSpellInfo(SPELL_DRUID_LIFEBLOOM_FINAL_HEAL);
if (Unit* caster = GetCaster())
{
healAmount = caster->SpellHealingBonusDone(GetTarget(), finalHeal, healAmount, HEAL, 0.0f, stack);
healAmount = GetTarget()->SpellHealingBonusTaken(caster, finalHeal, healAmount, HEAL, stack);
// restore mana
int32 returnmana = (GetSpellInfo()->ManaCostPercentage * caster->GetCreateMana() / 100) * stack / 2;
caster->CastCustomSpell(caster, SPELL_DRUID_LIFEBLOOM_ENERGIZE, &returnmana, NULL, NULL, true, NULL, aurEff, GetCasterGUID());
}
GetTarget()->CastCustomSpell(GetTarget(), SPELL_DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, aurEff, GetCasterGUID());
if (Unit* caster = GetCaster())
{
healAmount = caster->SpellHealingBonusDone(GetTarget(), finalHeal, healAmount, HEAL, 0.0f, stack);
healAmount = GetTarget()->SpellHealingBonusTaken(caster, finalHeal, healAmount, HEAL, stack);
// restore mana
int32 returnmana = (GetSpellInfo()->ManaCostPercentage * caster->GetCreateMana() / 100) * stack / 2;
caster->CastCustomSpell(caster, SPELL_DRUID_LIFEBLOOM_ENERGIZE, &returnmana, NULL, NULL, true, NULL, aurEff, GetCasterGUID());
}
GetTarget()->CastCustomSpell(GetTarget(), SPELL_DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, aurEff, GetCasterGUID());
}
void HandleDispel(DispelInfo* dispelInfo)
@@ -636,19 +636,19 @@ class spell_dru_lifebloom : public SpellScriptLoader
{
if (AuraEffect const* aurEff = GetEffect(EFFECT_1))
{
Unit* caster = GetCaster();
int32 healAmount = GetSpellInfo()->Effects[EFFECT_1].CalcValue(caster ? caster : target, 0, target) * dispelInfo->GetRemovedCharges();
const SpellInfo* finalHeal = sSpellMgr->GetSpellInfo(SPELL_DRUID_LIFEBLOOM_FINAL_HEAL);
if (caster)
{
// healing with bonus
Unit* caster = GetCaster();
int32 healAmount = GetSpellInfo()->Effects[EFFECT_1].CalcValue(caster ? caster : target, 0, target) * dispelInfo->GetRemovedCharges();
const SpellInfo* finalHeal = sSpellMgr->GetSpellInfo(SPELL_DRUID_LIFEBLOOM_FINAL_HEAL);
if (caster)
{
// healing with bonus
healAmount = caster->SpellHealingBonusDone(target, finalHeal, healAmount, HEAL, 0.0f, dispelInfo->GetRemovedCharges());
healAmount = target->SpellHealingBonusTaken(caster, finalHeal, healAmount, HEAL, dispelInfo->GetRemovedCharges());
// mana amount
int32 mana = CalculatePct(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * dispelInfo->GetRemovedCharges() / 2;
caster->CastCustomSpell(caster, SPELL_DRUID_LIFEBLOOM_ENERGIZE, &mana, NULL, NULL, true, NULL, NULL, GetCasterGUID());
}
healAmount = target->SpellHealingBonusTaken(caster, finalHeal, healAmount, HEAL, dispelInfo->GetRemovedCharges());
// mana amount
int32 mana = CalculatePct(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * dispelInfo->GetRemovedCharges() / 2;
caster->CastCustomSpell(caster, SPELL_DRUID_LIFEBLOOM_ENERGIZE, &mana, NULL, NULL, true, NULL, NULL, GetCasterGUID());
}
target->CastCustomSpell(target, SPELL_DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, NULL, GetCasterGUID());
}
}
@@ -1305,7 +1305,7 @@ class spell_dru_t10_restoration_4p_bonus : public SpellScriptLoader
return;
}
tempTargets.sort(Trinity::HealthPctOrderPred());
tempTargets.sort(Trinity::HealthPctOrderPred());
targets.clear();
targets.push_back(tempTargets.front());
}
@@ -1342,7 +1342,7 @@ class spell_dru_wild_growth : public SpellScriptLoader
void FilterTargets(std::list<WorldObject*>& targets)
{
targets.remove_if(Trinity::RaidCheck(GetCaster(), false));
targets.remove_if(Trinity::RaidCheck(GetCaster(), false));
uint32 const maxTargets = GetCaster()->HasAura(SPELL_DRUID_GLYPH_OF_WILD_GROWTH) ? 6 : 5;
@@ -1378,16 +1378,16 @@ class spell_dru_wild_growth : public SpellScriptLoader
void AddSC_druid_spell_scripts()
{
// Ours
new spell_dru_t10_balance_4p_bonus();
new spell_dru_nurturing_instinct();
new spell_dru_feral_swiftness();
new spell_dru_omen_of_clarity();
new spell_dru_brambles_treant();
new spell_dru_barkskin();
new spell_dru_treant_scaling();
// Ours
new spell_dru_t10_balance_4p_bonus();
new spell_dru_nurturing_instinct();
new spell_dru_feral_swiftness();
new spell_dru_omen_of_clarity();
new spell_dru_brambles_treant();
new spell_dru_barkskin();
new spell_dru_treant_scaling();
// Theirs
// Theirs
new spell_dru_dash();
new spell_dru_enrage();
new spell_dru_glyph_of_starfire();

File diff suppressed because it is too large Load Diff

View File

@@ -32,11 +32,11 @@
enum HunterSpells
{
// Ours
SPELL_HUNTER_WYVERN_STING_DOT = 24131,
// Ours
SPELL_HUNTER_WYVERN_STING_DOT = 24131,
// Theirs
SPELL_HUNTER_ASPECT_OF_THE_BEAST = 13161,
// Theirs
SPELL_HUNTER_ASPECT_OF_THE_BEAST = 13161,
SPELL_HUNTER_ASPECT_OF_THE_BEAST_PET = 61669,
SPELL_HUNTER_ASPECT_OF_THE_VIPER = 34074,
SPELL_HUNTER_ASPECT_OF_THE_VIPER_ENERGIZE = 34075,
@@ -74,21 +74,21 @@ class spell_hun_check_pet_los : public SpellScriptLoader
SpellCastResult CheckCast()
{
Unit* pet = GetCaster()->GetGuardianPet();
if (!pet)
pet = GetCaster()->GetCharm();
Unit* pet = GetCaster()->GetGuardianPet();
if (!pet)
pet = GetCaster()->GetCharm();
if (!pet)
return SPELL_FAILED_NO_PET;
if (!pet)
return SPELL_FAILED_NO_PET;
if (!pet->IsAlive())
{
SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_PET_IS_DEAD);
if (!pet->IsAlive())
{
SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_PET_IS_DEAD);
return SPELL_FAILED_CUSTOM_ERROR;
}
}
if (!GetCaster()->IsWithinLOSInMap(pet))
return SPELL_FAILED_LINE_OF_SIGHT;
if (!GetCaster()->IsWithinLOSInMap(pet))
return SPELL_FAILED_LINE_OF_SIGHT;
return SPELL_CAST_OK;
}
@@ -116,8 +116,8 @@ class spell_hun_cower : public SpellScriptLoader
void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/)
{
if (AuraEffect* aurEff = GetUnitOwner()->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_PET, GetSpellInfo()->SpellIconID, EFFECT_0))
AddPct(amount, aurEff->GetAmount());
if (AuraEffect* aurEff = GetUnitOwner()->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_PET, GetSpellInfo()->SpellIconID, EFFECT_0))
AddPct(amount, aurEff->GetAmount());
}
void Register()
@@ -134,29 +134,29 @@ class spell_hun_cower : public SpellScriptLoader
class spell_hun_wyvern_sting : public SpellScriptLoader
{
public:
spell_hun_wyvern_sting() : SpellScriptLoader("spell_hun_wyvern_sting") { }
public:
spell_hun_wyvern_sting() : SpellScriptLoader("spell_hun_wyvern_sting") { }
class spell_hun_wyvern_sting_AuraScript : public AuraScript
{
PrepareAuraScript(spell_hun_wyvern_sting_AuraScript)
class spell_hun_wyvern_sting_AuraScript : public AuraScript
{
PrepareAuraScript(spell_hun_wyvern_sting_AuraScript)
void HandleEffectRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
if (Unit* caster = GetCaster())
caster->CastSpell(GetTarget(), sSpellMgr->GetSpellWithRank(SPELL_HUNTER_WYVERN_STING_DOT, GetSpellInfo()->GetRank()), true);
}
void HandleEffectRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
if (Unit* caster = GetCaster())
caster->CastSpell(GetTarget(), sSpellMgr->GetSpellWithRank(SPELL_HUNTER_WYVERN_STING_DOT, GetSpellInfo()->GetRank()), true);
}
void Register()
{
AfterEffectRemove += AuraEffectRemoveFn(spell_hun_wyvern_sting_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_MOD_STUN, AURA_EFFECT_HANDLE_REAL);
}
};
void Register()
{
AfterEffectRemove += AuraEffectRemoveFn(spell_hun_wyvern_sting_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_MOD_STUN, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const
{
return new spell_hun_wyvern_sting_AuraScript();
}
AuraScript* GetAuraScript() const
{
return new spell_hun_wyvern_sting_AuraScript();
}
};
class spell_hun_animal_handler : public SpellScriptLoader
@@ -170,10 +170,10 @@ class spell_hun_animal_handler : public SpellScriptLoader
void CalculateAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
{
amount = 0;
if (Unit* owner = GetUnitOwner()->GetOwner())
if (AuraEffect const* animalHandlerEff = owner->GetDummyAuraEffect(SPELLFAMILY_HUNTER, 2234, EFFECT_1))
amount = animalHandlerEff->GetAmount();
amount = 0;
if (Unit* owner = GetUnitOwner()->GetOwner())
if (AuraEffect const* animalHandlerEff = owner->GetDummyAuraEffect(SPELLFAMILY_HUNTER, 2234, EFFECT_1))
amount = animalHandlerEff->GetAmount();
}
void Register()
@@ -199,115 +199,115 @@ class spell_hun_generic_scaling : public SpellScriptLoader
void CalculateResistanceAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
{
// xinef: pet inherits 40% of resistance from owner and 35% of armor
if (Unit* owner = GetUnitOwner()->GetOwner())
{
SpellSchoolMask schoolMask = SpellSchoolMask(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue);
int32 modifier = schoolMask == SPELL_SCHOOL_MASK_NORMAL ? 35 : 40;
amount = CalculatePct(std::max<int32>(0, owner->GetResistance(schoolMask)), modifier);
}
// xinef: pet inherits 40% of resistance from owner and 35% of armor
if (Unit* owner = GetUnitOwner()->GetOwner())
{
SpellSchoolMask schoolMask = SpellSchoolMask(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue);
int32 modifier = schoolMask == SPELL_SCHOOL_MASK_NORMAL ? 35 : 40;
amount = CalculatePct(std::max<int32>(0, owner->GetResistance(schoolMask)), modifier);
}
}
void CalculateStatAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
{
if (Unit* owner = GetUnitOwner()->GetOwner())
{
// xinef: by default pet inherits 45% of stamina
int32 modifier = 45;
if (Unit* owner = GetUnitOwner()->GetOwner())
{
// xinef: by default pet inherits 45% of stamina
int32 modifier = 45;
// xinef: Wild Hunt bonus for stamina
if (AuraEffect* wildHuntEff = GetUnitOwner()->GetDummyAuraEffect(SPELLFAMILY_PET, 3748, EFFECT_0))
AddPct(modifier, wildHuntEff->GetAmount());
// xinef: Wild Hunt bonus for stamina
if (AuraEffect* wildHuntEff = GetUnitOwner()->GetDummyAuraEffect(SPELLFAMILY_PET, 3748, EFFECT_0))
AddPct(modifier, wildHuntEff->GetAmount());
amount = CalculatePct(std::max<int32>(0, owner->GetStat(Stats(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue))), modifier);
}
amount = CalculatePct(std::max<int32>(0, owner->GetStat(Stats(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue))), modifier);
}
}
void CalculateAPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
void CalculateAPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
{
if (Unit* owner = GetUnitOwner()->GetOwner())
{
// xinef: by default 22% of RAP
int32 modifier = 22;
// xinef: Wild Hunt bonus for AP
if (AuraEffect* wildHuntEff = GetUnitOwner()->GetDummyAuraEffect(SPELLFAMILY_PET, 3748, EFFECT_1))
AddPct(modifier, wildHuntEff->GetAmount());
if (Unit* owner = GetUnitOwner()->GetOwner())
{
// xinef: by default 22% of RAP
int32 modifier = 22;
// xinef: Wild Hunt bonus for AP
if (AuraEffect* wildHuntEff = GetUnitOwner()->GetDummyAuraEffect(SPELLFAMILY_PET, 3748, EFFECT_1))
AddPct(modifier, wildHuntEff->GetAmount());
float ownerAP = owner->GetTotalAttackPowerValue(RANGED_ATTACK);
float ownerAP = owner->GetTotalAttackPowerValue(RANGED_ATTACK);
// Xinef: Hunter vs. Wild
if (AuraEffect* HvWEff = owner->GetAuraEffect(SPELL_AURA_MOD_ATTACK_POWER_OF_STAT_PERCENT, SPELLFAMILY_HUNTER, 3647, EFFECT_0))
ownerAP += CalculatePct(owner->GetStat(STAT_STAMINA), HvWEff->GetAmount());
// Xinef: Hunter vs. Wild
if (AuraEffect* HvWEff = owner->GetAuraEffect(SPELL_AURA_MOD_ATTACK_POWER_OF_STAT_PERCENT, SPELLFAMILY_HUNTER, 3647, EFFECT_0))
ownerAP += CalculatePct(owner->GetStat(STAT_STAMINA), HvWEff->GetAmount());
amount = CalculatePct(std::max<int32>(0, ownerAP), modifier);
}
amount = CalculatePct(std::max<int32>(0, ownerAP), modifier);
}
}
void CalculateSPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
void CalculateSPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
{
if (Unit* owner = GetUnitOwner()->GetOwner())
{
// xinef: by default 12.87% of RAP
float modifier = 12.87f;
// xinef: Wild Hunt bonus for AP
if (AuraEffect* wildHuntEff = GetUnitOwner()->GetDummyAuraEffect(SPELLFAMILY_PET, 3748, EFFECT_1))
AddPct(modifier, wildHuntEff->GetAmount());
if (Unit* owner = GetUnitOwner()->GetOwner())
{
// xinef: by default 12.87% of RAP
float modifier = 12.87f;
// xinef: Wild Hunt bonus for AP
if (AuraEffect* wildHuntEff = GetUnitOwner()->GetDummyAuraEffect(SPELLFAMILY_PET, 3748, EFFECT_1))
AddPct(modifier, wildHuntEff->GetAmount());
amount = CalculatePct(std::max<int32>(0, owner->GetTotalAttackPowerValue(RANGED_ATTACK)), modifier);
amount = CalculatePct(std::max<int32>(0, owner->GetTotalAttackPowerValue(RANGED_ATTACK)), modifier);
// xinef: Update appropriate player field
if (owner->GetTypeId() == TYPEID_PLAYER)
owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount);
}
// xinef: Update appropriate player field
if (owner->GetTypeId() == TYPEID_PLAYER)
owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount);
}
}
void CalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude)
void CalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude)
{
isPeriodic = true;
amplitude = 2*IN_MILLISECONDS;
}
void HandlePeriodic(AuraEffect const* aurEff)
{
PreventDefaultAction();
if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT && (aurEff->GetMiscValue() == STAT_STAMINA || aurEff->GetMiscValue() == STAT_INTELLECT))
{
int32 currentAmount = aurEff->GetAmount();
int32 newAmount = GetEffect(aurEff->GetEffIndex())->CalculateAmount(GetCaster());
if (newAmount != currentAmount)
{
if (aurEff->GetMiscValue() == STAT_STAMINA)
{
uint32 actStat = GetUnitOwner()->GetHealth();
GetEffect(aurEff->GetEffIndex())->ChangeAmount(newAmount, false);
GetUnitOwner()->SetHealth(std::min<uint32>(GetUnitOwner()->GetMaxHealth(), actStat));
}
else
{
uint32 actStat = GetUnitOwner()->GetPower(POWER_MANA);
GetEffect(aurEff->GetEffIndex())->ChangeAmount(newAmount, false);
GetUnitOwner()->SetPower(POWER_MANA, std::min<uint32>(GetUnitOwner()->GetMaxPower(POWER_MANA), actStat));
}
}
}
else
GetEffect(aurEff->GetEffIndex())->RecalculateAmount();
if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT && (aurEff->GetMiscValue() == STAT_STAMINA || aurEff->GetMiscValue() == STAT_INTELLECT))
{
int32 currentAmount = aurEff->GetAmount();
int32 newAmount = GetEffect(aurEff->GetEffIndex())->CalculateAmount(GetCaster());
if (newAmount != currentAmount)
{
if (aurEff->GetMiscValue() == STAT_STAMINA)
{
uint32 actStat = GetUnitOwner()->GetHealth();
GetEffect(aurEff->GetEffIndex())->ChangeAmount(newAmount, false);
GetUnitOwner()->SetHealth(std::min<uint32>(GetUnitOwner()->GetMaxHealth(), actStat));
}
else
{
uint32 actStat = GetUnitOwner()->GetPower(POWER_MANA);
GetEffect(aurEff->GetEffIndex())->ChangeAmount(newAmount, false);
GetUnitOwner()->SetPower(POWER_MANA, std::min<uint32>(GetUnitOwner()->GetMaxPower(POWER_MANA), actStat));
}
}
}
else
GetEffect(aurEff->GetEffIndex())->RecalculateAmount();
}
void Register()
{
if (m_scriptSpellId != 34902)
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_generic_scaling_AuraScript::CalculateResistanceAmount, EFFECT_ALL, SPELL_AURA_MOD_RESISTANCE);
else
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_generic_scaling_AuraScript::CalculateStatAmount, EFFECT_ALL, SPELL_AURA_MOD_STAT);
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_generic_scaling_AuraScript::CalculateAPAmount, EFFECT_ALL, SPELL_AURA_MOD_ATTACK_POWER);
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_generic_scaling_AuraScript::CalculateSPAmount, EFFECT_ALL, SPELL_AURA_MOD_DAMAGE_DONE);
}
if (m_scriptSpellId != 34902)
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_generic_scaling_AuraScript::CalculateResistanceAmount, EFFECT_ALL, SPELL_AURA_MOD_RESISTANCE);
else
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_generic_scaling_AuraScript::CalculateStatAmount, EFFECT_ALL, SPELL_AURA_MOD_STAT);
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_generic_scaling_AuraScript::CalculateAPAmount, EFFECT_ALL, SPELL_AURA_MOD_ATTACK_POWER);
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_generic_scaling_AuraScript::CalculateSPAmount, EFFECT_ALL, SPELL_AURA_MOD_DAMAGE_DONE);
}
DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_hun_generic_scaling_AuraScript::CalcPeriodic, EFFECT_ALL, SPELL_AURA_ANY);
DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_hun_generic_scaling_AuraScript::CalcPeriodic, EFFECT_ALL, SPELL_AURA_ANY);
OnEffectPeriodic += AuraEffectPeriodicFn(spell_hun_generic_scaling_AuraScript::HandlePeriodic, EFFECT_ALL, SPELL_AURA_ANY);
}
};
@@ -345,39 +345,39 @@ class spell_hun_aspect_of_the_beast : public SpellScriptLoader
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (GetCaster())
if (Player* caster = GetCaster()->ToPlayer())
if (Pet* pet = caster->GetPet())
pet->RemoveAurasDueToSpell(SPELL_HUNTER_ASPECT_OF_THE_BEAST_PET);
if (GetCaster())
if (Player* caster = GetCaster()->ToPlayer())
if (Pet* pet = caster->GetPet())
pet->RemoveAurasDueToSpell(SPELL_HUNTER_ASPECT_OF_THE_BEAST_PET);
}
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (GetCaster())
if (Player* caster = GetCaster()->ToPlayer())
if (caster->GetPet())
caster->CastSpell(caster, SPELL_HUNTER_ASPECT_OF_THE_BEAST_PET, true);
if (GetCaster())
if (Player* caster = GetCaster()->ToPlayer())
if (caster->GetPet())
caster->CastSpell(caster, SPELL_HUNTER_ASPECT_OF_THE_BEAST_PET, true);
}
void OnPetApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
void OnPetApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* pet = GetUnitOwner();
if (Unit* owner = pet->GetOwner())
if (owner->HasAura(SPELL_HUNTER_ASPECT_OF_THE_BEAST))
return;
Unit* pet = GetUnitOwner();
if (Unit* owner = pet->GetOwner())
if (owner->HasAura(SPELL_HUNTER_ASPECT_OF_THE_BEAST))
return;
SetDuration(0);
SetDuration(0);
}
void Register()
{
if (m_scriptSpellId == 13161)
{
AfterEffectApply += AuraEffectApplyFn(spell_hun_aspect_of_the_beast_AuraScript::OnApply, EFFECT_0, SPELL_AURA_UNTRACKABLE, AURA_EFFECT_HANDLE_REAL);
AfterEffectRemove += AuraEffectRemoveFn(spell_hun_aspect_of_the_beast_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_UNTRACKABLE, AURA_EFFECT_HANDLE_REAL);
}
else
AfterEffectApply += AuraEffectApplyFn(spell_hun_aspect_of_the_beast_AuraScript::OnPetApply, EFFECT_0, SPELL_AURA_UNTRACKABLE, AURA_EFFECT_HANDLE_REAL);
if (m_scriptSpellId == 13161)
{
AfterEffectApply += AuraEffectApplyFn(spell_hun_aspect_of_the_beast_AuraScript::OnApply, EFFECT_0, SPELL_AURA_UNTRACKABLE, AURA_EFFECT_HANDLE_REAL);
AfterEffectRemove += AuraEffectRemoveFn(spell_hun_aspect_of_the_beast_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_UNTRACKABLE, AURA_EFFECT_HANDLE_REAL);
}
else
AfterEffectApply += AuraEffectApplyFn(spell_hun_aspect_of_the_beast_AuraScript::OnPetApply, EFFECT_0, SPELL_AURA_UNTRACKABLE, AURA_EFFECT_HANDLE_REAL);
}
};
@@ -409,12 +409,12 @@ class spell_hun_ascpect_of_the_viper : public SpellScriptLoader
return true;
}
bool CheckProc(ProcEventInfo& procInfo)
bool CheckProc(ProcEventInfo& procInfo)
{
SpellInfo const* spellInfo = procInfo.GetDamageInfo()->GetSpellInfo();
// Xinef: cannot proc from volley damage
if (spellInfo && (spellInfo->SpellFamilyFlags[0] & 0x2000) && spellInfo->Effects[EFFECT_0].Effect == SPELL_EFFECT_SCHOOL_DAMAGE)
return false;
// Xinef: cannot proc from volley damage
if (spellInfo && (spellInfo->SpellFamilyFlags[0] & 0x2000) && spellInfo->Effects[EFFECT_0].Effect == SPELL_EFFECT_SCHOOL_DAMAGE)
return false;
return true;
}
@@ -521,21 +521,21 @@ 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)
{
if (caster->ToPlayer()) // Scorpid Sting - Add 1 minute cooldown
{
if (caster->ToPlayer()->HasSpellCooldown(SPELL_HUNTER_CHIMERA_SHOT_SCORPID))
break;
{
if (caster->ToPlayer()) // Scorpid Sting - Add 1 minute cooldown
{
if (caster->ToPlayer()->HasSpellCooldown(SPELL_HUNTER_CHIMERA_SHOT_SCORPID))
break;
caster->ToPlayer()->AddSpellCooldown(SPELL_HUNTER_CHIMERA_SHOT_SCORPID, 0, 60000);
}
caster->ToPlayer()->AddSpellCooldown(SPELL_HUNTER_CHIMERA_SHOT_SCORPID, 0, 60000);
}
spellId = SPELL_HUNTER_CHIMERA_SHOT_SCORPID;
}
}
// Refresh aura duration
aura->RefreshDuration();
aurEff->ChangeAmount(aurEff->CalculateAmount(caster), false);
aurEff->ChangeAmount(aurEff->CalculateAmount(caster), false);
}
break;
}
@@ -736,26 +736,26 @@ class spell_hun_readiness : public SpellScriptLoader
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Player* caster = GetCaster()->ToPlayer();
// immediately finishes the cooldown on your other Hunter abilities except Bestial Wrath
Player* caster = GetCaster()->ToPlayer();
// immediately finishes the cooldown on your other Hunter abilities except Bestial Wrath
PlayerSpellMap const& spellMap = caster->GetSpellMap();
for (PlayerSpellMap::const_iterator itr = spellMap.begin(); itr != spellMap.end(); ++itr)
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
if (spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER &&
spellInfo->Id != SPELL_HUNTER_READINESS &&
spellInfo->Id != SPELL_HUNTER_BESTIAL_WRATH &&
spellInfo->Id != SPELL_DRAENEI_GIFT_OF_THE_NAARU &&
spellInfo->GetRecoveryTime() > 0)
{
SpellCooldowns::iterator citr = caster->GetSpellCooldownMap().find(spellInfo->Id);
if (citr != caster->GetSpellCooldownMap().end() && citr->second.needSendToClient)
caster->RemoveSpellCooldown(spellInfo->Id, true);
else
caster->RemoveSpellCooldown(spellInfo->Id, false);
}
}
PlayerSpellMap const& spellMap = caster->GetSpellMap();
for (PlayerSpellMap::const_iterator itr = spellMap.begin(); itr != spellMap.end(); ++itr)
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
if (spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER &&
spellInfo->Id != SPELL_HUNTER_READINESS &&
spellInfo->Id != SPELL_HUNTER_BESTIAL_WRATH &&
spellInfo->Id != SPELL_DRAENEI_GIFT_OF_THE_NAARU &&
spellInfo->GetRecoveryTime() > 0)
{
SpellCooldowns::iterator citr = caster->GetSpellCooldownMap().find(spellInfo->Id);
if (citr != caster->GetSpellCooldownMap().end() && citr->second.needSendToClient)
caster->RemoveSpellCooldown(spellInfo->Id, true);
else
caster->RemoveSpellCooldown(spellInfo->Id, false);
}
}
}
void Register()
@@ -844,7 +844,7 @@ class spell_hun_sniper_training : public SpellScriptLoader
if (Player* playerTarget = GetUnitOwner()->ToPlayer())
{
int32 baseAmount = aurEff->GetBaseAmount();
int32 amount = playerTarget->isMoving() || aurEff->GetAmount() <= 0 ?
int32 amount = playerTarget->isMoving() || aurEff->GetAmount() <= 0 ?
playerTarget->CalculateSpellDamage(playerTarget, GetSpellInfo(), aurEff->GetEffIndex(), &baseAmount) :
aurEff->GetAmount() - 1;
aurEff->SetAmount(amount);
@@ -888,13 +888,13 @@ class spell_hun_pet_heart_of_the_phoenix : public SpellScriptLoader
return true;
}
SpellCastResult CheckCast()
SpellCastResult CheckCast()
{
Unit* caster = GetCaster();
if (caster->IsAlive())
return SPELL_FAILED_TARGET_NOT_DEAD;
if (caster->HasAura(SPELL_HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF))
return SPELL_FAILED_CASTER_AURASTATE;
return SPELL_FAILED_CASTER_AURASTATE;
return SPELL_CAST_OK;
}
@@ -1182,14 +1182,14 @@ class spell_hun_viper_attack_speed : public SpellScriptLoader
void AddSC_hunter_spell_scripts()
{
// Ours
new spell_hun_check_pet_los();
new spell_hun_cower();
new spell_hun_wyvern_sting();
new spell_hun_animal_handler();
new spell_hun_generic_scaling();
// Ours
new spell_hun_check_pet_los();
new spell_hun_cower();
new spell_hun_wyvern_sting();
new spell_hun_animal_handler();
new spell_hun_generic_scaling();
// Theirs
// Theirs
new spell_hun_aspect_of_the_beast();
new spell_hun_ascpect_of_the_viper();
new spell_hun_chimera_shot();

File diff suppressed because it is too large Load Diff

View File

@@ -30,11 +30,11 @@
enum MageSpells
{
// Ours
// Ours
SPELL_MAGE_BURNOUT_TRIGGER = 44450,
SPELL_MAGE_IMPROVED_BLIZZARD_CHILLED = 12486,
SPELL_MAGE_IMPROVED_BLIZZARD_CHILLED = 12486,
// Theirs
// Theirs
SPELL_MAGE_COLD_SNAP = 11958,
SPELL_MAGE_FOCUS_MAGIC_PROC = 54648,
SPELL_MAGE_FROST_WARDING_R1 = 11189,
@@ -65,28 +65,28 @@ class spell_mage_arcane_blast : public SpellScriptLoader
{
PrepareSpellScript(spell_mage_arcane_blast_SpellScript);
bool Load() { _triggerSpellId = 0; return true; }
bool Load() { _triggerSpellId = 0; return true; }
void HandleTriggerSpell(SpellEffIndex effIndex)
{
_triggerSpellId = GetSpellInfo()->Effects[effIndex].TriggerSpell;
PreventHitDefaultEffect(effIndex);
_triggerSpellId = GetSpellInfo()->Effects[effIndex].TriggerSpell;
PreventHitDefaultEffect(effIndex);
}
void HandleAfterCast()
{
GetCaster()->CastSpell(GetCaster(), _triggerSpellId, TRIGGERED_FULL_MASK);
}
void HandleAfterCast()
{
GetCaster()->CastSpell(GetCaster(), _triggerSpellId, TRIGGERED_FULL_MASK);
}
void Register()
{
OnEffectLaunch += SpellEffectFn(spell_mage_arcane_blast_SpellScript::HandleTriggerSpell, EFFECT_1, SPELL_EFFECT_TRIGGER_SPELL);
OnEffectLaunchTarget += SpellEffectFn(spell_mage_arcane_blast_SpellScript::HandleTriggerSpell, EFFECT_1, SPELL_EFFECT_TRIGGER_SPELL);
AfterCast += SpellCastFn(spell_mage_arcane_blast_SpellScript::HandleAfterCast);
OnEffectLaunchTarget += SpellEffectFn(spell_mage_arcane_blast_SpellScript::HandleTriggerSpell, EFFECT_1, SPELL_EFFECT_TRIGGER_SPELL);
AfterCast += SpellCastFn(spell_mage_arcane_blast_SpellScript::HandleAfterCast);
}
private:
uint32 _triggerSpellId;
private:
uint32 _triggerSpellId;
};
SpellScript* GetSpellScript() const
@@ -106,11 +106,11 @@ class spell_mage_deep_freeze : public SpellScriptLoader
void HandleOnHit()
{
if (Unit* caster = GetCaster())
if (Unit* target = (caster->ToPlayer() ? caster->ToPlayer()->GetSelectedUnit() : NULL))
if (Creature* cTarget = target->ToCreature())
if (cTarget->HasMechanicTemplateImmunity(1 << (MECHANIC_STUN - 1)))
caster->CastSpell(cTarget, 71757, true);
if (Unit* caster = GetCaster())
if (Unit* target = (caster->ToPlayer() ? caster->ToPlayer()->GetSelectedUnit() : NULL))
if (Creature* cTarget = target->ToCreature())
if (cTarget->HasMechanicTemplateImmunity(1 << (MECHANIC_STUN - 1)))
caster->CastSpell(cTarget, 71757, true);
}
void Register()
@@ -136,33 +136,33 @@ class spell_mage_burning_determination : public SpellScriptLoader
bool CheckProc(ProcEventInfo& eventInfo)
{
if (!eventInfo.GetDamageInfo()->GetSpellInfo() || !eventInfo.GetActionTarget())
return false;
if (!eventInfo.GetDamageInfo()->GetSpellInfo() || !eventInfo.GetActionTarget())
return false;
// Need Interrupt or Silenced mechanic
if (!(eventInfo.GetDamageInfo()->GetSpellInfo()->GetAllEffectsMechanicMask() & ((1<<MECHANIC_INTERRUPT)|(1<<MECHANIC_SILENCE))))
return false;
// Need Interrupt or Silenced mechanic
if (!(eventInfo.GetDamageInfo()->GetSpellInfo()->GetAllEffectsMechanicMask() & ((1<<MECHANIC_INTERRUPT)|(1<<MECHANIC_SILENCE))))
return false;
// Xinef: immuned effect should just eat charge
if (eventInfo.GetHitMask() & PROC_EX_IMMUNE)
{
eventInfo.GetActionTarget()->RemoveAurasDueToSpell(54748);
return false;
}
if (Aura* aura = eventInfo.GetActionTarget()->GetAura(54748))
{
if (aura->GetDuration() < aura->GetMaxDuration())
eventInfo.GetActionTarget()->RemoveAurasDueToSpell(54748);
return false;
}
// Xinef: immuned effect should just eat charge
if (eventInfo.GetHitMask() & PROC_EX_IMMUNE)
{
eventInfo.GetActionTarget()->RemoveAurasDueToSpell(54748);
return false;
}
if (Aura* aura = eventInfo.GetActionTarget()->GetAura(54748))
{
if (aura->GetDuration() < aura->GetMaxDuration())
eventInfo.GetActionTarget()->RemoveAurasDueToSpell(54748);
return false;
}
return true;
return true;
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
GetUnitOwner()->CastSpell(GetUnitOwner(), 54748, true);
GetUnitOwner()->CastSpell(GetUnitOwner(), 54748, true);
}
void Register()
@@ -189,15 +189,15 @@ class spell_mage_molten_armor : public SpellScriptLoader
bool CheckProc(ProcEventInfo& eventInfo)
{
const SpellInfo* spellInfo = eventInfo.GetDamageInfo()->GetSpellInfo();
if (!spellInfo || (eventInfo.GetTypeMask() & PROC_FLAG_TAKEN_MELEE_AUTO_ATTACK))
return true;
const SpellInfo* spellInfo = eventInfo.GetDamageInfo()->GetSpellInfo();
if (!spellInfo || (eventInfo.GetTypeMask() & PROC_FLAG_TAKEN_MELEE_AUTO_ATTACK))
return true;
// Xinef: Molten Shields talent
if (AuraEffect* aurEff = eventInfo.GetActionTarget()->GetAuraEffect(SPELL_AURA_ADD_FLAT_MODIFIER, SPELLFAMILY_MAGE, 16, EFFECT_0))
return roll_chance_i(aurEff->GetSpellInfo()->GetRank()*50);
// Xinef: Molten Shields talent
if (AuraEffect* aurEff = eventInfo.GetActionTarget()->GetAuraEffect(SPELL_AURA_ADD_FLAT_MODIFIER, SPELLFAMILY_MAGE, 16, EFFECT_0))
return roll_chance_i(aurEff->GetSpellInfo()->GetRank()*50);
return false;
return false;
}
void Register()
@@ -221,20 +221,20 @@ public:
{
PrepareAuraScript(spell_mage_mirror_image_AuraScript)
void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
GetTarget()->CastSpell((Unit*)NULL, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true);
GetTarget()->CastSpell((Unit*)NULL, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true);
}
void CalcPeriodic(AuraEffect const* /*effect*/, bool& isPeriodic, int32& amplitude)
void CalcPeriodic(AuraEffect const* /*effect*/, bool& isPeriodic, int32& amplitude)
{
isPeriodic = false;
}
void Register()
{
OnEffectApply += AuraEffectApplyFn(spell_mage_mirror_image_AuraScript::HandleEffectApply, EFFECT_2, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_mage_mirror_image_AuraScript::CalcPeriodic, EFFECT_2, SPELL_AURA_PERIODIC_DUMMY);
OnEffectApply += AuraEffectApplyFn(spell_mage_mirror_image_AuraScript::HandleEffectApply, EFFECT_2, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_mage_mirror_image_AuraScript::CalcPeriodic, EFFECT_2, SPELL_AURA_PERIODIC_DUMMY);
}
};
@@ -299,12 +299,12 @@ class spell_mage_burnout_trigger : public SpellScriptLoader
void HandleDummy(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
if (Unit* target = GetHitUnit())
{
int32 newDamage = -(target->ModifyPower(POWER_MANA, -GetEffectValue()));
GetSpell()->ExecuteLogEffectTakeTargetPower(effIndex, target, POWER_MANA, newDamage, 0.0f);
}
PreventHitDefaultEffect(effIndex);
if (Unit* target = GetHitUnit())
{
int32 newDamage = -(target->ModifyPower(POWER_MANA, -GetEffectValue()));
GetSpell()->ExecuteLogEffectTakeTargetPower(effIndex, target, POWER_MANA, newDamage, 0.0f);
}
}
void Register()
@@ -330,108 +330,108 @@ class spell_mage_pet_scaling : public SpellScriptLoader
void CalculateResistanceAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
{
// xinef: mage pet inherits 40% of resistance from owner and 35% of armor (guessed)
if (Unit* owner = GetUnitOwner()->GetOwner())
{
SpellSchoolMask schoolMask = SpellSchoolMask(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue);
int32 modifier = schoolMask == SPELL_SCHOOL_MASK_NORMAL ? 35 : 40;
amount = CalculatePct(std::max<int32>(0, owner->GetResistance(schoolMask)), modifier);
}
// xinef: mage pet inherits 40% of resistance from owner and 35% of armor (guessed)
if (Unit* owner = GetUnitOwner()->GetOwner())
{
SpellSchoolMask schoolMask = SpellSchoolMask(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue);
int32 modifier = schoolMask == SPELL_SCHOOL_MASK_NORMAL ? 35 : 40;
amount = CalculatePct(std::max<int32>(0, owner->GetResistance(schoolMask)), modifier);
}
}
void CalculateStatAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
{
// xinef: mage pet inherits 30% of intellect / stamina
if (Unit* owner = GetUnitOwner()->GetOwner())
{
Stats stat = Stats(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue);
amount = CalculatePct(std::max<int32>(0, owner->GetStat(stat)), 30);
}
// xinef: mage pet inherits 30% of intellect / stamina
if (Unit* owner = GetUnitOwner()->GetOwner())
{
Stats stat = Stats(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue);
amount = CalculatePct(std::max<int32>(0, owner->GetStat(stat)), 30);
}
}
void CalculateAPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
void CalculateAPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
{
// xinef: mage pet inherits 0% AP
// xinef: mage pet inherits 0% AP
}
void CalculateSPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
void CalculateSPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
{
// xinef: mage pet inherits 33% of SP
if (Unit* owner = GetUnitOwner()->GetOwner())
{
int32 frost = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FROST);
amount = CalculatePct(std::max<int32>(0, frost), 33);
// xinef: mage pet inherits 33% of SP
if (Unit* owner = GetUnitOwner()->GetOwner())
{
int32 frost = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FROST);
amount = CalculatePct(std::max<int32>(0, frost), 33);
// xinef: Update appropriate player field
if (owner->GetTypeId() == TYPEID_PLAYER)
owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount);
}
// xinef: Update appropriate player field
if (owner->GetTypeId() == TYPEID_PLAYER)
owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount);
}
}
void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
if (GetUnitOwner()->IsPet())
return;
GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, aurEff->GetAuraType(), true, SPELL_BLOCK_TYPE_POSITIVE);
if (aurEff->GetAuraType() == SPELL_AURA_MOD_ATTACK_POWER)
GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_ATTACK_POWER_PCT, true, SPELL_BLOCK_TYPE_POSITIVE);
else if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT)
GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, true, SPELL_BLOCK_TYPE_POSITIVE);
}
void CalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude)
void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
if (!GetUnitOwner()->IsPet())
return;
if (GetUnitOwner()->IsPet())
return;
GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, aurEff->GetAuraType(), true, SPELL_BLOCK_TYPE_POSITIVE);
if (aurEff->GetAuraType() == SPELL_AURA_MOD_ATTACK_POWER)
GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_ATTACK_POWER_PCT, true, SPELL_BLOCK_TYPE_POSITIVE);
else if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT)
GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, true, SPELL_BLOCK_TYPE_POSITIVE);
}
void CalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude)
{
if (!GetUnitOwner()->IsPet())
return;
isPeriodic = true;
amplitude = 2*IN_MILLISECONDS;
}
void HandlePeriodic(AuraEffect const* aurEff)
{
PreventDefaultAction();
if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT && (aurEff->GetMiscValue() == STAT_STAMINA || aurEff->GetMiscValue() == STAT_INTELLECT))
{
int32 currentAmount = aurEff->GetAmount();
int32 newAmount = GetEffect(aurEff->GetEffIndex())->CalculateAmount(GetCaster());
if (newAmount != currentAmount)
{
if (aurEff->GetMiscValue() == STAT_STAMINA)
{
uint32 actStat = GetUnitOwner()->GetHealth();
GetEffect(aurEff->GetEffIndex())->ChangeAmount(newAmount, false);
GetUnitOwner()->SetHealth(std::min<uint32>(GetUnitOwner()->GetMaxHealth(), actStat));
}
else
{
uint32 actStat = GetUnitOwner()->GetPower(POWER_MANA);
GetEffect(aurEff->GetEffIndex())->ChangeAmount(newAmount, false);
GetUnitOwner()->SetPower(POWER_MANA, std::min<uint32>(GetUnitOwner()->GetMaxPower(POWER_MANA), actStat));
}
}
}
else
GetEffect(aurEff->GetEffIndex())->RecalculateAmount();
if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT && (aurEff->GetMiscValue() == STAT_STAMINA || aurEff->GetMiscValue() == STAT_INTELLECT))
{
int32 currentAmount = aurEff->GetAmount();
int32 newAmount = GetEffect(aurEff->GetEffIndex())->CalculateAmount(GetCaster());
if (newAmount != currentAmount)
{
if (aurEff->GetMiscValue() == STAT_STAMINA)
{
uint32 actStat = GetUnitOwner()->GetHealth();
GetEffect(aurEff->GetEffIndex())->ChangeAmount(newAmount, false);
GetUnitOwner()->SetHealth(std::min<uint32>(GetUnitOwner()->GetMaxHealth(), actStat));
}
else
{
uint32 actStat = GetUnitOwner()->GetPower(POWER_MANA);
GetEffect(aurEff->GetEffIndex())->ChangeAmount(newAmount, false);
GetUnitOwner()->SetPower(POWER_MANA, std::min<uint32>(GetUnitOwner()->GetMaxPower(POWER_MANA), actStat));
}
}
}
else
GetEffect(aurEff->GetEffIndex())->RecalculateAmount();
}
void Register()
{
if (m_scriptSpellId != 35657)
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_mage_pet_scaling_AuraScript::CalculateResistanceAmount, EFFECT_ALL, SPELL_AURA_MOD_RESISTANCE);
if (m_scriptSpellId != 35657)
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_mage_pet_scaling_AuraScript::CalculateResistanceAmount, EFFECT_ALL, SPELL_AURA_MOD_RESISTANCE);
if (m_scriptSpellId == 35657 || m_scriptSpellId == 35658)
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_mage_pet_scaling_AuraScript::CalculateStatAmount, EFFECT_ALL, SPELL_AURA_MOD_STAT);
if (m_scriptSpellId == 35657 || m_scriptSpellId == 35658)
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_mage_pet_scaling_AuraScript::CalculateStatAmount, EFFECT_ALL, SPELL_AURA_MOD_STAT);
if (m_scriptSpellId == 35657)
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_mage_pet_scaling_AuraScript::CalculateAPAmount, EFFECT_ALL, SPELL_AURA_MOD_ATTACK_POWER);
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_mage_pet_scaling_AuraScript::CalculateSPAmount, EFFECT_ALL, SPELL_AURA_MOD_DAMAGE_DONE);
}
if (m_scriptSpellId == 35657)
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_mage_pet_scaling_AuraScript::CalculateAPAmount, EFFECT_ALL, SPELL_AURA_MOD_ATTACK_POWER);
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_mage_pet_scaling_AuraScript::CalculateSPAmount, EFFECT_ALL, SPELL_AURA_MOD_DAMAGE_DONE);
}
OnEffectApply += AuraEffectApplyFn(spell_mage_pet_scaling_AuraScript::HandleEffectApply, EFFECT_ALL, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL);
DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_mage_pet_scaling_AuraScript::CalcPeriodic, EFFECT_ALL, SPELL_AURA_ANY);
OnEffectApply += AuraEffectApplyFn(spell_mage_pet_scaling_AuraScript::HandleEffectApply, EFFECT_ALL, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL);
DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_mage_pet_scaling_AuraScript::CalcPeriodic, EFFECT_ALL, SPELL_AURA_ANY);
OnEffectPeriodic += AuraEffectPeriodicFn(spell_mage_pet_scaling_AuraScript::HandlePeriodic, EFFECT_ALL, SPELL_AURA_ANY);
}
};
@@ -453,15 +453,15 @@ class spell_mage_brain_freeze : public SpellScriptLoader
bool CheckProc(ProcEventInfo& eventInfo)
{
const SpellInfo* spellInfo = eventInfo.GetDamageInfo()->GetSpellInfo();
if (!spellInfo)
return false;
const SpellInfo* spellInfo = eventInfo.GetDamageInfo()->GetSpellInfo();
if (!spellInfo)
return false;
// xinef: Improved Blizzard, generic chilled check
if (spellInfo->SpellFamilyFlags[0] & 0x100000)
return spellInfo->Id == SPELL_MAGE_IMPROVED_BLIZZARD_CHILLED;
// xinef: Improved Blizzard, generic chilled check
if (spellInfo->SpellFamilyFlags[0] & 0x100000)
return spellInfo->Id == SPELL_MAGE_IMPROVED_BLIZZARD_CHILLED;
return true;
return true;
}
void Register()
@@ -498,14 +498,14 @@ class spell_mage_incanters_absorbtion_base_AuraScript : public AuraScript
if (AuraEffect* talentAurEff = target->GetAuraEffectOfRankedSpell(SPELL_MAGE_INCANTERS_ABSORBTION_R1, EFFECT_0))
{
int32 bp = CalculatePct(absorbAmount, talentAurEff->GetAmount());
if (AuraEffect* currentAura = target->GetAuraEffect(SPELL_AURA_MOD_DAMAGE_DONE, SPELLFAMILY_MAGE, 2941, EFFECT_0))
{
bp += int32(currentAura->GetAmount() * (currentAura->GetBase()->GetDuration() / (float)currentAura->GetBase()->GetMaxDuration()));
currentAura->ChangeAmount(bp);
currentAura->GetBase()->RefreshDuration();
}
else
target->CastCustomSpell(target, SPELL_MAGE_INCANTERS_ABSORBTION_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff);
if (AuraEffect* currentAura = target->GetAuraEffect(SPELL_AURA_MOD_DAMAGE_DONE, SPELLFAMILY_MAGE, 2941, EFFECT_0))
{
bp += int32(currentAura->GetAmount() * (currentAura->GetBase()->GetDuration() / (float)currentAura->GetBase()->GetMaxDuration()));
currentAura->ChangeAmount(bp);
currentAura->GetBase()->RefreshDuration();
}
else
target->CastCustomSpell(target, SPELL_MAGE_INCANTERS_ABSORBTION_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff);
}
}
};
@@ -562,22 +562,22 @@ class spell_mage_cold_snap : public SpellScriptLoader
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Player* caster = GetCaster()->ToPlayer();
// immediately finishes the cooldown on Frost spells
Player* caster = GetCaster()->ToPlayer();
// immediately finishes the cooldown on Frost spells
PlayerSpellMap const& spellMap = caster->GetSpellMap();
for (PlayerSpellMap::const_iterator itr = spellMap.begin(); itr != spellMap.end(); ++itr)
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
if (spellInfo->SpellFamilyName == SPELLFAMILY_MAGE && (spellInfo->GetSchoolMask() & SPELL_SCHOOL_MASK_FROST) && spellInfo->Id != SPELL_MAGE_COLD_SNAP && spellInfo->GetRecoveryTime() > 0)
{
SpellCooldowns::iterator citr = caster->GetSpellCooldownMap().find(spellInfo->Id);
if (citr != caster->GetSpellCooldownMap().end() && citr->second.needSendToClient)
caster->RemoveSpellCooldown(spellInfo->Id, true);
else
caster->RemoveSpellCooldown(spellInfo->Id, false);
}
}
PlayerSpellMap const& spellMap = caster->GetSpellMap();
for (PlayerSpellMap::const_iterator itr = spellMap.begin(); itr != spellMap.end(); ++itr)
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
if (spellInfo->SpellFamilyName == SPELLFAMILY_MAGE && (spellInfo->GetSchoolMask() & SPELL_SCHOOL_MASK_FROST) && spellInfo->Id != SPELL_MAGE_COLD_SNAP && spellInfo->GetRecoveryTime() > 0)
{
SpellCooldowns::iterator citr = caster->GetSpellCooldownMap().find(spellInfo->Id);
if (citr != caster->GetSpellCooldownMap().end() && citr->second.needSendToClient)
caster->RemoveSpellCooldown(spellInfo->Id, true);
else
caster->RemoveSpellCooldown(spellInfo->Id, false);
}
}
}
void Register()
@@ -640,9 +640,9 @@ class spell_mage_fire_frost_ward : public SpellScriptLoader
target->CastCustomSpell(target, SPELL_MAGE_FROST_WARDING_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff);
absorbAmount = 0;
// Xinef: trigger Incanters Absorbtion
uint32 damage = dmgInfo.GetDamage();
Trigger(aurEff, dmgInfo, damage);
// Xinef: trigger Incanters Absorbtion
uint32 damage = dmgInfo.GetDamage();
Trigger(aurEff, dmgInfo, damage);
// Xinef: hack for chaos bolt
if (!dmgInfo.GetSpellInfo() || dmgInfo.GetSpellInfo()->SpellIconID != 3178)
@@ -724,8 +724,8 @@ class spell_mage_ice_barrier : public SpellScriptLoader
public:
spell_mage_ice_barrier() : SpellScriptLoader("spell_mage_ice_barrier") { }
static int32 CalculateSpellAmount(Unit* caster, int32 amount, const SpellInfo* spellInfo, const AuraEffect* aurEff)
{
static int32 CalculateSpellAmount(Unit* caster, int32 amount, const SpellInfo* spellInfo, const AuraEffect* aurEff)
{
// +80.68% from sp bonus
float bonus = 0.8068f;
@@ -738,8 +738,8 @@ class spell_mage_ice_barrier : public SpellScriptLoader
bonus *= caster->CalculateLevelPenalty(spellInfo);
amount += int32(bonus);
return amount;
}
return amount;
}
class spell_mage_ice_barrier_AuraScript : public spell_mage_incanters_absorbtion_base_AuraScript
{
@@ -749,7 +749,7 @@ class spell_mage_ice_barrier : public SpellScriptLoader
{
canBeRecalculated = false;
if (Unit* caster = GetCaster())
amount = CalculateSpellAmount(caster, amount, GetSpellInfo(), aurEff);
amount = CalculateSpellAmount(caster, amount, GetSpellInfo(), aurEff);
}
void Register()
@@ -772,14 +772,14 @@ class spell_mage_ice_barrier : public SpellScriptLoader
{
Unit* caster = GetCaster();
if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_AURA_SCHOOL_ABSORB, (SpellFamilyNames)GetSpellInfo()->SpellFamilyName, GetSpellInfo()->SpellIconID, EFFECT_0))
{
int32 newAmount = GetSpellInfo()->Effects[EFFECT_0].CalcValue(caster, NULL, NULL);
newAmount = CalculateSpellAmount(caster, newAmount, GetSpellInfo(), aurEff);
if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_AURA_SCHOOL_ABSORB, (SpellFamilyNames)GetSpellInfo()->SpellFamilyName, GetSpellInfo()->SpellIconID, EFFECT_0))
{
int32 newAmount = GetSpellInfo()->Effects[EFFECT_0].CalcValue(caster, NULL, NULL);
newAmount = CalculateSpellAmount(caster, newAmount, GetSpellInfo(), aurEff);
if (aurEff->GetAmount() > newAmount)
return SPELL_FAILED_AURA_BOUNCED;
}
if (aurEff->GetAmount() > newAmount)
return SPELL_FAILED_AURA_BOUNCED;
}
return SPELL_CAST_OK;
}
@@ -815,15 +815,15 @@ class spell_mage_ignite : public SpellScriptLoader
bool CheckProc(ProcEventInfo& eventInfo)
{
if (!eventInfo.GetActor() || !eventInfo.GetProcTarget())
return false;
if (!eventInfo.GetActor() || !eventInfo.GetProcTarget())
return false;
// Molten Armor
if (SpellInfo const* spellInfo = eventInfo.GetDamageInfo()->GetSpellInfo())
if (spellInfo->SpellFamilyFlags[1] & 0x8)
return false;
// Molten Armor
if (SpellInfo const* spellInfo = eventInfo.GetDamageInfo()->GetSpellInfo())
if (spellInfo->SpellFamilyFlags[1] & 0x8)
return false;
return true;
return true;
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -835,7 +835,7 @@ class spell_mage_ignite : public SpellScriptLoader
int32 amount = int32(CalculatePct(eventInfo.GetDamageInfo()->GetDamage(), pct) / igniteDot->GetMaxTicks());
// Xinef: implement ignite bug
// Xinef: implement ignite bug
eventInfo.GetProcTarget()->CastDelayedSpellWithPeriodicAmount(eventInfo.GetActor(), SPELL_MAGE_IGNITE, SPELL_AURA_PERIODIC_DAMAGE, amount);
//GetTarget()->CastCustomSpell(SPELL_MAGE_IGNITE, SPELLVALUE_BASE_POINT0, amount, eventInfo.GetProcTarget(), true, NULL, aurEff);
}
@@ -1054,11 +1054,11 @@ class spell_mage_summon_water_elemental : public SpellScriptLoader
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
Unit* caster = GetCaster();
if (Creature *pet = ObjectAccessor::GetCreature(*caster, caster->GetPetGUID()))
if (!pet->IsAlive())
pet->ToTempSummon()->UnSummon();
if (Creature *pet = ObjectAccessor::GetCreature(*caster, caster->GetPetGUID()))
if (!pet->IsAlive())
pet->ToTempSummon()->UnSummon();
// Glyph of Eternal Water
if (caster->HasAura(SPELL_MAGE_GLYPH_OF_ETERNAL_WATER))
@@ -1067,15 +1067,15 @@ class spell_mage_summon_water_elemental : public SpellScriptLoader
caster->CastSpell(caster, SPELL_MAGE_SUMMON_WATER_ELEMENTAL_TEMPORARY, true);
if (Creature *pet = ObjectAccessor::GetCreature(*caster, caster->GetPetGUID()))
if (pet->GetCharmInfo() && caster->ToPlayer())
{
pet->m_CreatureSpellCooldowns.clear();
const SpellInfo* spellEntry = sSpellMgr->GetSpellInfo(31707);
pet->GetCharmInfo()->ToggleCreatureAutocast(spellEntry, true);
pet->GetCharmInfo()->SetSpellAutocast(spellEntry, true);
caster->ToPlayer()->CharmSpellInitialize();
}
if (Creature *pet = ObjectAccessor::GetCreature(*caster, caster->GetPetGUID()))
if (pet->GetCharmInfo() && caster->ToPlayer())
{
pet->m_CreatureSpellCooldowns.clear();
const SpellInfo* spellEntry = sSpellMgr->GetSpellInfo(31707);
pet->GetCharmInfo()->ToggleCreatureAutocast(spellEntry, true);
pet->GetCharmInfo()->SetSpellAutocast(spellEntry, true);
caster->ToPlayer()->CharmSpellInitialize();
}
}
void Register()
@@ -1092,18 +1092,18 @@ class spell_mage_summon_water_elemental : public SpellScriptLoader
void AddSC_mage_spell_scripts()
{
// Ours
new spell_mage_arcane_blast();
new spell_mage_deep_freeze();
new spell_mage_burning_determination();
new spell_mage_molten_armor();
new spell_mage_mirror_image();
// Ours
new spell_mage_arcane_blast();
new spell_mage_deep_freeze();
new spell_mage_burning_determination();
new spell_mage_molten_armor();
new spell_mage_mirror_image();
new spell_mage_burnout();
new spell_mage_burnout_trigger();
new spell_mage_pet_scaling();
new spell_mage_brain_freeze();
new spell_mage_pet_scaling();
new spell_mage_brain_freeze();
// Theirs
// Theirs
new spell_mage_blast_wave();
new spell_mage_cold_snap();
new spell_mage_fire_frost_ward();

View File

@@ -99,32 +99,32 @@ class spell_pal_seal_of_command : public SpellScriptLoader
{
PrepareAuraScript(spell_pal_seal_of_command_AuraScript);
bool CheckProc(ProcEventInfo& eventInfo)
bool CheckProc(ProcEventInfo& eventInfo)
{
if (const SpellInfo* procSpell = eventInfo.GetDamageInfo()->GetSpellInfo())
if (procSpell->SpellIconID == 3025) // Righteous Vengeance, should not proc SoC
return false;
if (const SpellInfo* procSpell = eventInfo.GetDamageInfo()->GetSpellInfo())
if (procSpell->SpellIconID == 3025) // Righteous Vengeance, should not proc SoC
return false;
return true;
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
int32 targets = 3;
if (const SpellInfo* procSpell = eventInfo.GetDamageInfo()->GetSpellInfo())
if (procSpell->IsAffectingArea())
targets = 1;
int32 targets = 3;
if (const SpellInfo* procSpell = eventInfo.GetDamageInfo()->GetSpellInfo())
if (procSpell->IsAffectingArea())
targets = 1;
eventInfo.GetActor()->CastCustomSpell(aurEff->GetSpellInfo()->Effects[EFFECT_0].TriggerSpell, SPELLVALUE_MAX_TARGETS, targets, eventInfo.GetActionTarget(), false, NULL, aurEff);
eventInfo.GetActor()->CastCustomSpell(aurEff->GetSpellInfo()->Effects[EFFECT_0].TriggerSpell, SPELLVALUE_MAX_TARGETS, targets, eventInfo.GetActionTarget(), false, NULL, aurEff);
}
void Register()
{
if (m_scriptSpellId == 20375)
{
DoCheckProc += AuraCheckProcFn(spell_pal_seal_of_command_AuraScript::CheckProc);
OnEffectProc += AuraEffectProcFn(spell_pal_seal_of_command_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL);
}
if (m_scriptSpellId == 20375)
{
DoCheckProc += AuraCheckProcFn(spell_pal_seal_of_command_AuraScript::CheckProc);
OnEffectProc += AuraEffectProcFn(spell_pal_seal_of_command_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL);
}
}
};
@@ -133,28 +133,28 @@ class spell_pal_seal_of_command : public SpellScriptLoader
return new spell_pal_seal_of_command_AuraScript();
}
class spell_pal_seal_of_command_SpellScript : public SpellScript
{
PrepareSpellScript(spell_pal_seal_of_command_SpellScript);
class spell_pal_seal_of_command_SpellScript : public SpellScript
{
PrepareSpellScript(spell_pal_seal_of_command_SpellScript);
void FilterTargets(std::list<WorldObject*>& targets)
{
if (const SpellValue* spellValue = GetSpellValue())
if (spellValue->MaxAffectedTargets == 1)
targets.clear();
}
void FilterTargets(std::list<WorldObject*>& targets)
{
if (const SpellValue* spellValue = GetSpellValue())
if (spellValue->MaxAffectedTargets == 1)
targets.clear();
}
void Register()
{
if (m_scriptSpellId == 20424)
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_pal_seal_of_command_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_TARGET_ENEMY);
}
};
void Register()
{
if (m_scriptSpellId == 20424)
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_pal_seal_of_command_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_TARGET_ENEMY);
}
};
SpellScript* GetSpellScript() const
{
return new spell_pal_seal_of_command_SpellScript();
}
SpellScript* GetSpellScript() const
{
return new spell_pal_seal_of_command_SpellScript();
}
};
class spell_pal_divine_intervention : public SpellScriptLoader
@@ -168,8 +168,8 @@ class spell_pal_divine_intervention : public SpellScriptLoader
void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (!GetTarget()->IsInCombat() && GetTarget()->GetTypeId() == TYPEID_PLAYER)
GetTarget()->RemoveAurasDueToSpell(GetTarget()->ToPlayer()->GetTeamId() == TEAM_ALLIANCE ? 57723 : 57724);
if (!GetTarget()->IsInCombat() && GetTarget()->GetTypeId() == TYPEID_PLAYER)
GetTarget()->RemoveAurasDueToSpell(GetTarget()->ToPlayer()->GetTeamId() == TEAM_ALLIANCE ? 57723 : 57724);
}
void Register()
@@ -195,8 +195,8 @@ class spell_pal_seal_of_light : public SpellScriptLoader
bool CheckProc(ProcEventInfo& eventInfo)
{
// xinef: skip divine storm self hit (dummy) and righteous vengeance (0x20000000=
return eventInfo.GetActor() != eventInfo.GetProcTarget() && (!eventInfo.GetDamageInfo()->GetSpellInfo() || !eventInfo.GetDamageInfo()->GetSpellInfo()->SpellFamilyFlags.HasFlag(0x20000000));
// xinef: skip divine storm self hit (dummy) and righteous vengeance (0x20000000=
return eventInfo.GetActor() != eventInfo.GetProcTarget() && (!eventInfo.GetDamageInfo()->GetSpellInfo() || !eventInfo.GetDamageInfo()->GetSpellInfo()->SpellFamilyFlags.HasFlag(0x20000000));
}
void Register()
@@ -224,13 +224,13 @@ class spell_pal_sacred_shield_base : public SpellScriptLoader
{
if (Unit* caster = GetCaster())
{
const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell);
amount = spellInfo->Effects[EFFECT_0].CalcValue();
const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell);
amount = spellInfo->Effects[EFFECT_0].CalcValue();
// +75.00% from sp bonus
amount += CalculatePct(caster->SpellBaseDamageBonusDone(spellInfo->GetSchoolMask()), 75.0f);
// Xinef: removed divine guardian because it will affect triggered spell with increased amount
// Xinef: removed divine guardian because it will affect triggered spell with increased amount
// Arena - Dampening
if (AuraEffect const* dampening = caster->GetAuraEffect(SPELL_GENERIC_ARENA_DAMPENING, EFFECT_0))
AddPct(amount, dampening->GetAmount());
@@ -242,53 +242,53 @@ class spell_pal_sacred_shield_base : public SpellScriptLoader
bool CheckProc(ProcEventInfo& eventInfo)
{
return !(eventInfo.GetHitMask() & PROC_EX_INTERNAL_HOT) && eventInfo.GetDamageInfo()->GetDamage() > 0;
return !(eventInfo.GetHitMask() & PROC_EX_INTERNAL_HOT) && eventInfo.GetDamageInfo()->GetDamage() > 0;
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
if (eventInfo.GetTypeMask() & PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_POS)
if (eventInfo.GetTypeMask() & PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_POS)
{
Unit* caster = eventInfo.GetActor();
const SpellInfo* procSpell = eventInfo.GetDamageInfo()->GetSpellInfo();
if (caster && procSpell->SpellFamilyName == SPELLFAMILY_PALADIN &&
procSpell->SpellFamilyFlags.HasFlag(0x40000000) && caster->GetAuraEffect(SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_PALADIN, 3021, 0)) // need infusion of light
Unit* caster = eventInfo.GetActor();
const SpellInfo* procSpell = eventInfo.GetDamageInfo()->GetSpellInfo();
if (caster && procSpell->SpellFamilyName == SPELLFAMILY_PALADIN &&
procSpell->SpellFamilyFlags.HasFlag(0x40000000) && caster->GetAuraEffect(SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_PALADIN, 3021, 0)) // need infusion of light
{
int32 basepoints = int32(float(eventInfo.GetDamageInfo()->GetDamage())/12.0f);
// Item - Paladin T9 Holy 4P Bonus (Flash of Light)
if (AuraEffect const* aurEffect = caster->GetAuraEffect(67191, EFFECT_0))
AddPct(basepoints, aurEffect->GetAmount());
int32 basepoints = int32(float(eventInfo.GetDamageInfo()->GetDamage())/12.0f);
// Item - Paladin T9 Holy 4P Bonus (Flash of Light)
if (AuraEffect const* aurEffect = caster->GetAuraEffect(67191, EFFECT_0))
AddPct(basepoints, aurEffect->GetAmount());
caster->CastCustomSpell(eventInfo.GetActionTarget(), 66922, &basepoints, NULL, NULL, true, 0, aurEff, caster->GetGUID());
caster->CastCustomSpell(eventInfo.GetActionTarget(), 66922, &basepoints, NULL, NULL, true, 0, aurEff, caster->GetGUID());
return;
}
return;
}
uint32 triggered_spell_id = GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell;
if (eventInfo.GetActionTarget()->HasSpellCooldown(triggered_spell_id))
return;
uint32 triggered_spell_id = GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell;
if (eventInfo.GetActionTarget()->HasSpellCooldown(triggered_spell_id))
return;
uint32 cooldown = eventInfo.GetProcCooldown();
int32 basepoints = aurEff->GetAmount();
uint32 cooldown = eventInfo.GetProcCooldown();
int32 basepoints = aurEff->GetAmount();
// Item - Paladin T8 Holy 4P Bonus
if (Unit* caster = aurEff->GetCaster())
if (AuraEffect const* aurEffect = caster->GetAuraEffect(64895, 0))
cooldown = aurEffect->GetAmount()*IN_MILLISECONDS;
eventInfo.GetActionTarget()->AddSpellCooldown(triggered_spell_id, 0, cooldown);
eventInfo.GetActionTarget()->CastCustomSpell(eventInfo.GetActionTarget(), triggered_spell_id, &basepoints, NULL, NULL, true, NULL, aurEff, eventInfo.GetActionTarget()->GetGUID());
eventInfo.GetActionTarget()->AddSpellCooldown(triggered_spell_id, 0, cooldown);
eventInfo.GetActionTarget()->CastCustomSpell(eventInfo.GetActionTarget(), triggered_spell_id, &basepoints, NULL, NULL, true, NULL, aurEff, eventInfo.GetActionTarget()->GetGUID());
}
void Register()
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pal_sacred_shield_base_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_DUMMY);
DoCheckProc += AuraCheckProcFn(spell_pal_sacred_shield_base_AuraScript::CheckProc);
OnEffectProc += AuraEffectProcFn(spell_pal_sacred_shield_base_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
OnEffectProc += AuraEffectProcFn(spell_pal_sacred_shield_base_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
}
};
@@ -346,17 +346,17 @@ class spell_pal_ardent_defender : public SpellScriptLoader
// Max heal when defense skill denies critical hits from raid bosses
// Formula: max defense at level + 140 (raiting from gear)
uint32 reqDefForMaxHeal = victim->getLevel() * 5 + 140;
float pctFromDefense = (defenseSkillValue - victim->getLevel()*5.0f) / 140.0f;
if (pctFromDefense < 0.0f)
pctFromDefense = 0.0f;
else if (pctFromDefense > 1.0f)
pctFromDefense = 1.0f;
float pctFromDefense = (defenseSkillValue - victim->getLevel()*5.0f) / 140.0f;
if (pctFromDefense < 0.0f)
pctFromDefense = 0.0f;
else if (pctFromDefense > 1.0f)
pctFromDefense = 1.0f;
int32 healAmount = int32(victim->CountPctFromMaxHealth(uint32(healPct * pctFromDefense)));
if (healAmount)
victim->CastCustomSpell(victim, PAL_SPELL_ARDENT_DEFENDER_HEAL, &healAmount, NULL, NULL, true, NULL, aurEff);
if (healAmount)
victim->CastCustomSpell(victim, PAL_SPELL_ARDENT_DEFENDER_HEAL, &healAmount, NULL, NULL, true, NULL, aurEff);
victim->ToPlayer()->AddSpellCooldown(PAL_SPELL_ARDENT_DEFENDER_HEAL, 0, 120000);
victim->ToPlayer()->AddSpellCooldown(PAL_SPELL_ARDENT_DEFENDER_HEAL, 0, 120000);
}
else if (remainingHealth < int32(allowedHealth))
{
@@ -507,11 +507,11 @@ class spell_pal_blessing_of_sanctuary : public SpellScriptLoader
{
Unit* target = GetTarget();
if (Unit* caster = GetCaster())
{
{
// xinef: hack
int32 value = 9;
int32 value = 9;
caster->CastCustomSpell(target, SPELL_PALADIN_BLESSING_OF_SANCTUARY_BUFF, &value, &value, 0, true);
}
}
}
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -629,8 +629,8 @@ class spell_pal_divine_storm : public SpellScriptLoader
void TriggerHeal()
{
Unit* caster = GetCaster();
if (GetHitUnit() != caster)
caster->CastCustomSpell(SPELL_PALADIN_DIVINE_STORM_DUMMY, SPELLVALUE_BASE_POINT0, (GetHitDamage() * healPct) / 100, caster, true);
if (GetHitUnit() != caster)
caster->CastCustomSpell(SPELL_PALADIN_DIVINE_STORM_DUMMY, SPELLVALUE_BASE_POINT0, (GetHitDamage() * healPct) / 100, caster, true);
}
void Register()
@@ -664,7 +664,7 @@ class spell_pal_divine_storm_dummy : public SpellScriptLoader
void CountTargets(std::list<WorldObject*>& targetList)
{
Trinity::Containers::RandomResizeList(targetList, GetSpellValue()->MaxAffectedTargets);
Trinity::Containers::RandomResizeList(targetList, GetSpellValue()->MaxAffectedTargets);
_targetCount = targetList.size();
}
@@ -877,29 +877,29 @@ class spell_pal_hand_of_sacrifice : public SpellScriptLoader
return new spell_pal_hand_of_sacrifice_AuraScript();
}
class spell_pal_hand_of_sacrifice_SpellScript : public SpellScript
{
PrepareSpellScript(spell_pal_hand_of_sacrifice_SpellScript);
class spell_pal_hand_of_sacrifice_SpellScript : public SpellScript
{
PrepareSpellScript(spell_pal_hand_of_sacrifice_SpellScript);
SpellCastResult CheckTarget()
{
Unit* target = GetExplTargetUnit();
if (!target || target->HasAura(SPELL_PALADIN_DIVINE_SACRIFICE))
return SPELL_FAILED_TARGET_AURASTATE;
SpellCastResult CheckTarget()
{
Unit* target = GetExplTargetUnit();
if (!target || target->HasAura(SPELL_PALADIN_DIVINE_SACRIFICE))
return SPELL_FAILED_TARGET_AURASTATE;
return SPELL_CAST_OK;
}
return SPELL_CAST_OK;
}
void Register()
{
OnCheckCast += SpellCheckCastFn(spell_pal_hand_of_sacrifice_SpellScript::CheckTarget);
}
};
void Register()
{
OnCheckCast += SpellCheckCastFn(spell_pal_hand_of_sacrifice_SpellScript::CheckTarget);
}
};
SpellScript* GetSpellScript() const
{
return new spell_pal_hand_of_sacrifice_SpellScript();
};
SpellScript* GetSpellScript() const
{
return new spell_pal_hand_of_sacrifice_SpellScript();
};
};
// 1038 - Hand of Salvation
@@ -1157,11 +1157,11 @@ class spell_pal_lay_on_hands : public SpellScriptLoader
return true;
}
bool Load()
{
_manaAmount = 0;
return true;
}
bool Load()
{
_manaAmount = 0;
return true;
}
SpellCastResult CheckCast()
{
@@ -1171,10 +1171,10 @@ class spell_pal_lay_on_hands : public SpellScriptLoader
if (target->HasAura(SPELL_PALADIN_FORBEARANCE) || target->HasAura(SPELL_PALADIN_AVENGING_WRATH_MARKER) || target->HasAura(SPELL_PALADIN_IMMUNE_SHIELD_MARKER))
return SPELL_FAILED_TARGET_AURASTATE;
// Xinef: Glyph of Divinity
if (Unit* target = GetExplTargetUnit())
if (target->getPowerType() == POWER_MANA)
_manaAmount = target->GetPower(POWER_MANA);
// Xinef: Glyph of Divinity
if (Unit* target = GetExplTargetUnit())
if (target->getPowerType() == POWER_MANA)
_manaAmount = target->GetPower(POWER_MANA);
return SPELL_CAST_OK;
}
@@ -1182,20 +1182,20 @@ class spell_pal_lay_on_hands : public SpellScriptLoader
void HandleScript()
{
Unit* caster = GetCaster();
Unit* target = GetHitUnit();
Unit* target = GetHitUnit();
if (caster == target)
{
caster->CastSpell(caster, SPELL_PALADIN_FORBEARANCE, true);
caster->CastSpell(caster, SPELL_PALADIN_AVENGING_WRATH_MARKER, true);
caster->CastSpell(caster, SPELL_PALADIN_IMMUNE_SHIELD_MARKER, true);
}
// Xinef: Glyph of Divinity
else if (target && caster->HasAura(54939) && GetSpellInfo()->Id != 633 && _manaAmount > 0) // excluding first rank
{
_manaAmount = target->GetPower(POWER_MANA) - _manaAmount;
if (_manaAmount > 0)
caster->CastCustomSpell(54986 /*Energize*/, SPELLVALUE_BASE_POINT1, _manaAmount, caster, true);
}
// Xinef: Glyph of Divinity
else if (target && caster->HasAura(54939) && GetSpellInfo()->Id != 633 && _manaAmount > 0) // excluding first rank
{
_manaAmount = target->GetPower(POWER_MANA) - _manaAmount;
if (_manaAmount > 0)
caster->CastCustomSpell(54986 /*Energize*/, SPELLVALUE_BASE_POINT1, _manaAmount, caster, true);
}
}
void Register()
@@ -1204,7 +1204,7 @@ class spell_pal_lay_on_hands : public SpellScriptLoader
AfterHit += SpellHitFn(spell_pal_lay_on_hands_SpellScript::HandleScript);
}
int32 _manaAmount;
int32 _manaAmount;
};
SpellScript* GetSpellScript() const
@@ -1296,11 +1296,11 @@ class spell_pal_seal_of_righteousness : public SpellScriptLoader
bool CheckProc(ProcEventInfo& eventInfo)
{
Unit* target = eventInfo.GetProcTarget();
if (!target)
return false;
Unit* target = eventInfo.GetProcTarget();
if (!target)
return false;
return target->IsAlive() && !eventInfo.GetTriggerAuraSpell() && (eventInfo.GetDamageInfo()->GetDamage() || (eventInfo.GetHitMask() & PROC_EX_ABSORB));
return target->IsAlive() && !eventInfo.GetTriggerAuraSpell() && (eventInfo.GetDamageInfo()->GetDamage() || (eventInfo.GetHitMask() & PROC_EX_ABSORB));
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -1311,11 +1311,11 @@ class spell_pal_seal_of_righteousness : public SpellScriptLoader
int32 holy = GetTarget()->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_HOLY);
holy += eventInfo.GetProcTarget()->SpellBaseDamageBonusTaken(SPELL_SCHOOL_MASK_HOLY);
// Xinef: Libram of Divine Purpose
if (AuraEffect* aurEff = GetTarget()->GetDummyAuraEffect(SPELLFAMILY_PALADIN, 2025, EFFECT_0))
holy += aurEff->GetAmount();
// Xinef: Libram of Divine Purpose
if (AuraEffect* aurEff = GetTarget()->GetDummyAuraEffect(SPELLFAMILY_PALADIN, 2025, EFFECT_0))
holy += aurEff->GetAmount();
int32 bp = std::max<int32>(0, int32((ap * 0.022f + 0.044f * holy) * GetTarget()->GetAttackTime(BASE_ATTACK) / 1000));
int32 bp = std::max<int32>(0, int32((ap * 0.022f + 0.044f * holy) * GetTarget()->GetAttackTime(BASE_ATTACK) / 1000));
GetTarget()->CastCustomSpell(SPELL_PALADIN_SEAL_OF_RIGHTEOUSNESS, SPELLVALUE_BASE_POINT0, bp, eventInfo.GetProcTarget(), true, NULL, aurEff);
}
@@ -1334,13 +1334,13 @@ class spell_pal_seal_of_righteousness : public SpellScriptLoader
void AddSC_paladin_spell_scripts()
{
// Ours
new spell_pal_seal_of_command();
new spell_pal_divine_intervention();
new spell_pal_seal_of_light();
new spell_pal_sacred_shield_base();
// Ours
new spell_pal_seal_of_command();
new spell_pal_divine_intervention();
new spell_pal_seal_of_light();
new spell_pal_sacred_shield_base();
// Theirs
// Theirs
new spell_pal_ardent_defender();
new spell_pal_avenging_wrath();
new spell_pal_blessing_of_faith();

View File

@@ -46,8 +46,8 @@ enum PriestSpells
SPELL_PRIEST_T9_HEALING_2P = 67201,
SPELL_PRIEST_VAMPIRIC_TOUCH_DISPEL = 64085,
SPELL_GENERIC_ARENA_DAMPENING = 74410,
SPELL_GENERIC_BATTLEGROUND_DAMPENING = 74411
SPELL_GENERIC_ARENA_DAMPENING = 74410,
SPELL_GENERIC_BATTLEGROUND_DAMPENING = 74411
};
enum PriestSpellIcons
@@ -69,73 +69,73 @@ class spell_pri_shadowfiend_scaling : public SpellScriptLoader
void CalculateResistanceAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
{
// xinef: shadowfiend inherits 40% of resistance from owner and 35% of armor (guessed)
if (Unit* owner = GetUnitOwner()->GetOwner())
{
SpellSchoolMask schoolMask = SpellSchoolMask(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue);
int32 modifier = schoolMask == SPELL_SCHOOL_MASK_NORMAL ? 35 : 40;
amount = CalculatePct(std::max<int32>(0, owner->GetResistance(schoolMask)), modifier);
}
// xinef: shadowfiend inherits 40% of resistance from owner and 35% of armor (guessed)
if (Unit* owner = GetUnitOwner()->GetOwner())
{
SpellSchoolMask schoolMask = SpellSchoolMask(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue);
int32 modifier = schoolMask == SPELL_SCHOOL_MASK_NORMAL ? 35 : 40;
amount = CalculatePct(std::max<int32>(0, owner->GetResistance(schoolMask)), modifier);
}
}
void CalculateStatAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
{
// xinef: shadowfiend inherits 30% of intellect / stamina (guessed)
if (Unit* owner = GetUnitOwner()->GetOwner())
{
Stats stat = Stats(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue);
amount = CalculatePct(std::max<int32>(0, owner->GetStat(stat)), 30);
}
// xinef: shadowfiend inherits 30% of intellect / stamina (guessed)
if (Unit* owner = GetUnitOwner()->GetOwner())
{
Stats stat = Stats(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue);
amount = CalculatePct(std::max<int32>(0, owner->GetStat(stat)), 30);
}
}
void CalculateAPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
void CalculateAPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
{
// xinef: shadowfiend inherits 333% of SP as AP - 35.7% of damage increase per hit
if (Unit* owner = GetUnitOwner()->GetOwner())
{
int32 shadow = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_SHADOW);
amount = CalculatePct(std::max<int32>(0, shadow), 300); // xinef: deacrased to 300, including 15% from self buff
}
// xinef: shadowfiend inherits 333% of SP as AP - 35.7% of damage increase per hit
if (Unit* owner = GetUnitOwner()->GetOwner())
{
int32 shadow = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_SHADOW);
amount = CalculatePct(std::max<int32>(0, shadow), 300); // xinef: deacrased to 300, including 15% from self buff
}
}
void CalculateSPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
void CalculateSPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
{
// xinef: shadowfiend inherits 30% of SP
if (Unit* owner = GetUnitOwner()->GetOwner())
{
int32 shadow = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_SHADOW);
amount = CalculatePct(std::max<int32>(0, shadow), 30);
// xinef: shadowfiend inherits 30% of SP
if (Unit* owner = GetUnitOwner()->GetOwner())
{
int32 shadow = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_SHADOW);
amount = CalculatePct(std::max<int32>(0, shadow), 30);
// xinef: Update appropriate player field
if (owner->GetTypeId() == TYPEID_PLAYER)
owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount);
}
// xinef: Update appropriate player field
if (owner->GetTypeId() == TYPEID_PLAYER)
owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount);
}
}
void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, aurEff->GetAuraType(), true, SPELL_BLOCK_TYPE_POSITIVE);
if (aurEff->GetAuraType() == SPELL_AURA_MOD_ATTACK_POWER)
GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_ATTACK_POWER_PCT, true, SPELL_BLOCK_TYPE_POSITIVE);
else if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT)
GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, true, SPELL_BLOCK_TYPE_POSITIVE);
}
void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, aurEff->GetAuraType(), true, SPELL_BLOCK_TYPE_POSITIVE);
if (aurEff->GetAuraType() == SPELL_AURA_MOD_ATTACK_POWER)
GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_ATTACK_POWER_PCT, true, SPELL_BLOCK_TYPE_POSITIVE);
else if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT)
GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, true, SPELL_BLOCK_TYPE_POSITIVE);
}
void Register()
{
if (m_scriptSpellId != 35661)
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pri_shadowfiend_scaling_AuraScript::CalculateResistanceAmount, EFFECT_ALL, SPELL_AURA_MOD_RESISTANCE);
if (m_scriptSpellId != 35661)
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pri_shadowfiend_scaling_AuraScript::CalculateResistanceAmount, EFFECT_ALL, SPELL_AURA_MOD_RESISTANCE);
if (m_scriptSpellId == 35661 || m_scriptSpellId == 35662)
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pri_shadowfiend_scaling_AuraScript::CalculateStatAmount, EFFECT_ALL, SPELL_AURA_MOD_STAT);
if (m_scriptSpellId == 35661 || m_scriptSpellId == 35662)
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pri_shadowfiend_scaling_AuraScript::CalculateStatAmount, EFFECT_ALL, SPELL_AURA_MOD_STAT);
if (m_scriptSpellId == 35661)
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pri_shadowfiend_scaling_AuraScript::CalculateAPAmount, EFFECT_ALL, SPELL_AURA_MOD_ATTACK_POWER);
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pri_shadowfiend_scaling_AuraScript::CalculateSPAmount, EFFECT_ALL, SPELL_AURA_MOD_DAMAGE_DONE);
}
if (m_scriptSpellId == 35661)
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pri_shadowfiend_scaling_AuraScript::CalculateAPAmount, EFFECT_ALL, SPELL_AURA_MOD_ATTACK_POWER);
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pri_shadowfiend_scaling_AuraScript::CalculateSPAmount, EFFECT_ALL, SPELL_AURA_MOD_DAMAGE_DONE);
}
OnEffectApply += AuraEffectApplyFn(spell_pri_shadowfiend_scaling_AuraScript::HandleEffectApply, EFFECT_ALL, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL);
OnEffectApply += AuraEffectApplyFn(spell_pri_shadowfiend_scaling_AuraScript::HandleEffectApply, EFFECT_ALL, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL);
}
};
@@ -166,7 +166,7 @@ class spell_pri_circle_of_healing : public SpellScriptLoader
void FilterTargets(std::list<WorldObject*>& targets)
{
targets.remove_if(Trinity::RaidCheck(GetCaster(), false));
targets.remove_if(Trinity::RaidCheck(GetCaster(), false));
uint32 const maxTargets = GetCaster()->HasAura(SPELL_PRIEST_GLYPH_OF_CIRCLE_OF_HEALING) ? 6 : 5; // Glyph of Circle of Healing
@@ -251,7 +251,7 @@ class spell_pri_divine_hymn : public SpellScriptLoader
void FilterTargets(std::list<WorldObject*>& targets)
{
targets.remove_if(Trinity::RaidCheck(GetCaster(), false));
targets.remove_if(Trinity::RaidCheck(GetCaster(), false));
uint32 const maxTargets = 3;
@@ -381,8 +381,8 @@ class spell_pri_hymn_of_hope : public SpellScriptLoader
void FilterTargets(std::list<WorldObject*>& targets)
{
targets.remove_if(Trinity::PowerCheck(POWER_MANA, false));
targets.remove_if(Trinity::RaidCheck(GetCaster(), false));
targets.remove_if(Trinity::PowerCheck(POWER_MANA, false));
targets.remove_if(Trinity::RaidCheck(GetCaster(), false));
uint32 const maxTargets = 3;
@@ -593,10 +593,10 @@ class spell_pri_pain_and_suffering_proc : public SpellScriptLoader
// Refresh Shadow Word: Pain on target
if (Unit* unitTarget = GetHitUnit())
if (AuraEffect* aur = unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_PRIEST, 0x8000, 0, 0, GetCaster()->GetGUID()))
{
aur->GetBase()->RefreshTimersWithMods();
{
aur->GetBase()->RefreshTimersWithMods();
aur->ChangeAmount(aur->CalculateAmount(aur->GetCaster()), false);
}
}
}
void Register()
@@ -700,9 +700,9 @@ class spell_pri_power_word_shield : public SpellScriptLoader
public:
spell_pri_power_word_shield() : SpellScriptLoader("spell_pri_power_word_shield") { }
static int32 CalculateSpellAmount(Unit* caster, int32 amount, const SpellInfo* spellInfo, const AuraEffect* aurEff)
{
// +80.68% from sp bonus
static int32 CalculateSpellAmount(Unit* caster, int32 amount, const SpellInfo* spellInfo, const AuraEffect* aurEff)
{
// +80.68% from sp bonus
float bonus = 0.8068f;
// Borrowed Time
@@ -719,22 +719,22 @@ class spell_pri_power_word_shield : public SpellScriptLoader
amount += int32(bonus);
// Twin Disciplines
if (AuraEffect const* twinDisciplines = caster->GetAuraEffect(SPELL_AURA_ADD_PCT_MODIFIER, SPELLFAMILY_PRIEST, 0x400000, 0, 0, caster->GetGUID()))
if (AuraEffect const* twinDisciplines = caster->GetAuraEffect(SPELL_AURA_ADD_PCT_MODIFIER, SPELLFAMILY_PRIEST, 0x400000, 0, 0, caster->GetGUID()))
AddPct(amount, twinDisciplines->GetAmount());
// Focused Power, xinef: apply positive modifier only
if (int32 healModifier = caster->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HEALING_DONE_PERCENT))
AddPct(amount, healModifier);
// Focused Power, xinef: apply positive modifier only
if (int32 healModifier = caster->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HEALING_DONE_PERCENT))
AddPct(amount, healModifier);
// Arena - Dampening
// Arena - Dampening
if (AuraEffect const* dampening = caster->GetAuraEffect(SPELL_GENERIC_ARENA_DAMPENING, EFFECT_0))
AddPct(amount, dampening->GetAmount());
// Battleground - Dampening
else if (AuraEffect const* dampening = caster->GetAuraEffect(SPELL_GENERIC_BATTLEGROUND_DAMPENING, EFFECT_0))
AddPct(amount, dampening->GetAmount());
return amount;
}
return amount;
}
class spell_pri_power_word_shield_AuraScript : public AuraScript
{
@@ -753,7 +753,7 @@ class spell_pri_power_word_shield : public SpellScriptLoader
{
canBeRecalculated = false;
if (Unit* caster = GetCaster())
amount = CalculateSpellAmount(caster, amount, GetSpellInfo(), aurEff);
amount = CalculateSpellAmount(caster, amount, GetSpellInfo(), aurEff);
}
void ReflectDamage(AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount)
@@ -766,9 +766,9 @@ class spell_pri_power_word_shield : public SpellScriptLoader
if (AuraEffect* talentAurEff = owner->GetAuraEffectOfRankedSpell(SPELL_PRIEST_REFLECTIVE_SHIELD_R1, EFFECT_0))
{
int32 bp = CalculatePct(absorbAmount, talentAurEff->GetAmount());
// xinef: prevents infinite loop!
if (!dmgInfo.GetSpellInfo() || dmgInfo.GetSpellInfo()->Id != SPELL_PRIEST_REFLECTIVE_SHIELD_TRIGGERED)
target->CastCustomSpell(dmgInfo.GetAttacker(), SPELL_PRIEST_REFLECTIVE_SHIELD_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff);
// xinef: prevents infinite loop!
if (!dmgInfo.GetSpellInfo() || dmgInfo.GetSpellInfo()->Id != SPELL_PRIEST_REFLECTIVE_SHIELD_TRIGGERED)
target->CastCustomSpell(dmgInfo.GetAttacker(), SPELL_PRIEST_REFLECTIVE_SHIELD_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff);
}
}
@@ -792,17 +792,17 @@ class spell_pri_power_word_shield : public SpellScriptLoader
{
Unit* caster = GetCaster();
Unit* target = GetExplTargetUnit();
if (!target)
return SPELL_FAILED_BAD_TARGETS;
if (!target)
return SPELL_FAILED_BAD_TARGETS;
if (AuraEffect* aurEff = target->GetAuraEffect(SPELL_AURA_SCHOOL_ABSORB, (SpellFamilyNames)GetSpellInfo()->SpellFamilyName, GetSpellInfo()->SpellIconID, EFFECT_0))
{
int32 newAmount = GetSpellInfo()->Effects[EFFECT_0].CalcValue(caster, NULL, NULL);
newAmount = CalculateSpellAmount(caster, newAmount, GetSpellInfo(), aurEff);
if (AuraEffect* aurEff = target->GetAuraEffect(SPELL_AURA_SCHOOL_ABSORB, (SpellFamilyNames)GetSpellInfo()->SpellFamilyName, GetSpellInfo()->SpellIconID, EFFECT_0))
{
int32 newAmount = GetSpellInfo()->Effects[EFFECT_0].CalcValue(caster, NULL, NULL);
newAmount = CalculateSpellAmount(caster, newAmount, GetSpellInfo(), aurEff);
if (aurEff->GetAmount() > newAmount)
return SPELL_FAILED_AURA_BOUNCED;
}
if (aurEff->GetAmount() > newAmount)
return SPELL_FAILED_AURA_BOUNCED;
}
return SPELL_CAST_OK;
}
@@ -953,8 +953,8 @@ class spell_pri_vampiric_touch : public SpellScriptLoader
if (Unit* target = GetUnitOwner())
if (AuraEffect const* aurEff = GetEffect(EFFECT_1))
{
int32 damage = aurEff->GetBaseAmount();
damage = aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue(caster, &damage, NULL) * 8;
int32 damage = aurEff->GetBaseAmount();
damage = aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue(caster, &damage, NULL) * 8;
// backfire damage
caster->CastCustomSpell(target, SPELL_PRIEST_VAMPIRIC_TOUCH_DISPEL, &damage, NULL, NULL, true, NULL, aurEff);
}
@@ -962,7 +962,7 @@ class spell_pri_vampiric_touch : public SpellScriptLoader
bool CheckProc(ProcEventInfo& eventInfo)
{
return eventInfo.GetActionTarget() && eventInfo.GetActionTarget()->IsAlive() && GetOwner()->GetGUID() == eventInfo.GetActionTarget()->GetGUID();
return eventInfo.GetActionTarget() && eventInfo.GetActionTarget()->IsAlive() && GetOwner()->GetGUID() == eventInfo.GetActionTarget()->GetGUID();
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -974,7 +974,7 @@ class spell_pri_vampiric_touch : public SpellScriptLoader
void Register()
{
AfterDispel += AuraDispelFn(spell_pri_vampiric_touch_AuraScript::HandleDispel);
DoCheckProc += AuraCheckProcFn(spell_pri_vampiric_touch_AuraScript::CheckProc);
DoCheckProc += AuraCheckProcFn(spell_pri_vampiric_touch_AuraScript::CheckProc);
OnEffectProc += AuraEffectProcFn(spell_pri_vampiric_touch_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_DUMMY);
}
};
@@ -987,10 +987,10 @@ class spell_pri_vampiric_touch : public SpellScriptLoader
void AddSC_priest_spell_scripts()
{
// Ours
new spell_pri_shadowfiend_scaling();
// Ours
new spell_pri_shadowfiend_scaling();
// Theirs
// Theirs
new spell_pri_circle_of_healing();
new spell_pri_divine_aegis();
new spell_pri_divine_hymn();

File diff suppressed because it is too large Load Diff

View File

@@ -32,7 +32,7 @@ enum RogueSpells
{
SPELL_ROGUE_BLADE_FLURRY_EXTRA_ATTACK = 22482,
SPELL_ROGUE_CHEAT_DEATH_COOLDOWN = 31231,
SPELL_ROGUE_CHEATING_DEATH = 45182,
SPELL_ROGUE_CHEATING_DEATH = 45182,
SPELL_ROGUE_GLYPH_OF_PREPARATION = 56819,
SPELL_ROGUE_KILLING_SPREE = 51690,
SPELL_ROGUE_KILLING_SPREE_TELEPORT = 57840,
@@ -62,12 +62,12 @@ public:
void Update(AuraEffect* auraEffect)
{
Unit::AuraApplicationMap const& auras = GetUnitOwner()->GetAppliedAuras();
for (Unit::AuraApplicationMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
if (itr->second->GetBase()->GetCasterGUID() == this->GetCasterGUID() && itr->second->GetBase()->GetSpellInfo()->Dispel == DISPEL_POISON)
return;
Unit::AuraApplicationMap const& auras = GetUnitOwner()->GetAppliedAuras();
for (Unit::AuraApplicationMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
if (itr->second->GetBase()->GetCasterGUID() == this->GetCasterGUID() && itr->second->GetBase()->GetSpellInfo()->Dispel == DISPEL_POISON)
return;
SetDuration(0);
SetDuration(0);
}
void Register()
@@ -94,7 +94,7 @@ class spell_rog_combat_potency : public SpellScriptLoader
bool CheckProc(ProcEventInfo& eventInfo)
{
return eventInfo.GetTypeMask() & PROC_FLAG_DONE_MELEE_AUTO_ATTACK;
return eventInfo.GetTypeMask() & PROC_FLAG_DONE_MELEE_AUTO_ATTACK;
}
void Register()
@@ -137,27 +137,27 @@ class spell_rog_blade_flurry : public SpellScriptLoader
bool CheckProc(ProcEventInfo& eventInfo)
{
Unit* _procTarget = eventInfo.GetActor()->SelectNearbyTarget(eventInfo.GetProcTarget());
if (_procTarget)
_procTargetGUID = _procTarget->GetGUID();
if (_procTarget)
_procTargetGUID = _procTarget->GetGUID();
return _procTarget;
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
// Xinef: no _procTarget but checkproc passed??
// Unit::CalculateAOEDamageReduction (this=0x0, damage=4118, schoolMask=1, caster=0x7ffdad089000)
Unit* procTarget = ObjectAccessor::GetUnit(*GetTarget(), _procTargetGUID);
// Xinef: no _procTarget but checkproc passed??
// Unit::CalculateAOEDamageReduction (this=0x0, damage=4118, schoolMask=1, caster=0x7ffdad089000)
Unit* procTarget = ObjectAccessor::GetUnit(*GetTarget(), _procTargetGUID);
if (procTarget && eventInfo.GetDamageInfo())
{
int32 damage = eventInfo.GetDamageInfo()->GetDamage();
// Xinef: Include AOE Damage Reduction auras
damage = procTarget->CalculateAOEDamageReduction(damage, SPELL_SCHOOL_MASK_NORMAL, GetTarget());
// Xinef: Include AOE Damage Reduction auras
damage = procTarget->CalculateAOEDamageReduction(damage, SPELL_SCHOOL_MASK_NORMAL, GetTarget());
CustomSpellValues values;
values.AddSpellMod(SPELLVALUE_BASE_POINT0, damage);
values.AddSpellMod(SPELLVALUE_FORCED_CRIT_RESULT, int32(eventInfo.GetHitMask() & PROC_EX_CRITICAL_HIT));
GetTarget()->CastCustomSpell(SPELL_ROGUE_BLADE_FLURRY_EXTRA_ATTACK, values, procTarget, TRIGGERED_FULL_MASK, NULL, aurEff);
CustomSpellValues values;
values.AddSpellMod(SPELLVALUE_BASE_POINT0, damage);
values.AddSpellMod(SPELLVALUE_FORCED_CRIT_RESULT, int32(eventInfo.GetHitMask() & PROC_EX_CRITICAL_HIT));
GetTarget()->CastCustomSpell(SPELL_ROGUE_BLADE_FLURRY_EXTRA_ATTACK, values, procTarget, TRIGGERED_FULL_MASK, NULL, aurEff);
}
}
@@ -214,9 +214,9 @@ class spell_rog_cheat_death : public SpellScriptLoader
if (dmgInfo.GetDamage() < target->GetHealth() || target->HasSpellCooldown(SPELL_ROGUE_CHEAT_DEATH_COOLDOWN) || !roll_chance_i(absorbChance))
return;
target->CastSpell(target, SPELL_ROGUE_CHEAT_DEATH_COOLDOWN, true);
target->CastSpell(target, SPELL_ROGUE_CHEATING_DEATH, true);
target->AddSpellCooldown(SPELL_ROGUE_CHEAT_DEATH_COOLDOWN, 0, MINUTE*IN_MILLISECONDS);
target->CastSpell(target, SPELL_ROGUE_CHEAT_DEATH_COOLDOWN, true);
target->CastSpell(target, SPELL_ROGUE_CHEATING_DEATH, true);
target->AddSpellCooldown(SPELL_ROGUE_CHEAT_DEATH_COOLDOWN, 0, MINUTE*IN_MILLISECONDS);
uint32 health10 = target->CountPctFromMaxHealth(10);
@@ -232,7 +232,7 @@ class spell_rog_cheat_death : public SpellScriptLoader
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_rog_cheat_death_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB);
OnEffectAbsorb += AuraEffectAbsorbFn(spell_rog_cheat_death_AuraScript::Absorb, EFFECT_0);
}
}
};
AuraScript* GetAuraScript() const
@@ -346,24 +346,24 @@ class spell_rog_killing_spree : public SpellScriptLoader
{
PrepareSpellScript(spell_rog_killing_spree_SpellScript);
SpellCastResult CheckCast()
SpellCastResult CheckCast()
{
// Kologarn area, Killing Spree should not work
if (GetCaster()->GetMapId() == 603 /*Ulduar*/ && GetCaster()->GetDistance2d(1766.936f, -24.748f) < 50.0f)
return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW;
return SPELL_CAST_OK;
}
// Kologarn area, Killing Spree should not work
if (GetCaster()->GetMapId() == 603 /*Ulduar*/ && GetCaster()->GetDistance2d(1766.936f, -24.748f) < 50.0f)
return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW;
return SPELL_CAST_OK;
}
void FilterTargets(std::list<WorldObject*>& targets)
{
if (targets.empty() || GetCaster()->GetVehicleBase() || GetCaster()->HasUnitState(UNIT_STATE_ROOT))
FinishCast(SPELL_FAILED_OUT_OF_RANGE);
else
{
// Added attribute not breaking stealth, removes auras here
GetCaster()->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_CAST);
GetCaster()->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_SPELL_ATTACK);
}
else
{
// Added attribute not breaking stealth, removes auras here
GetCaster()->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_CAST);
GetCaster()->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_SPELL_ATTACK);
}
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -413,12 +413,12 @@ class spell_rog_killing_spree : public SpellScriptLoader
uint64 guid = Trinity::Containers::SelectRandomContainerElement(_targets);
if (Unit* target = ObjectAccessor::GetUnit(*GetTarget(), guid))
{
// xinef: target may be no longer valid
if (!GetTarget()->IsValidAttackTarget(target))
{
_targets.remove(guid);
continue;
}
// xinef: target may be no longer valid
if (!GetTarget()->IsValidAttackTarget(target))
{
_targets.remove(guid);
continue;
}
GetTarget()->CastSpell(target, SPELL_ROGUE_KILLING_SPREE_TELEPORT, true);
@@ -530,41 +530,41 @@ class spell_rog_preparation : public SpellScriptLoader
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Player* caster = GetCaster()->ToPlayer();
//immediately finishes the cooldown on certain Rogue abilities
Player* caster = GetCaster()->ToPlayer();
//immediately finishes the cooldown on certain Rogue abilities
bool hasGlyph = caster->HasAura(SPELL_ROGUE_GLYPH_OF_PREPARATION);
PlayerSpellMap const& spellMap = caster->GetSpellMap();
for (PlayerSpellMap::const_iterator itr = spellMap.begin(); itr != spellMap.end(); ++itr)
{
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
{
SpellCooldowns::iterator citr = caster->GetSpellCooldownMap().find(spellInfo->Id);
if (citr != caster->GetSpellCooldownMap().end() && citr->second.needSendToClient)
caster->RemoveSpellCooldown(spellInfo->Id, true);
else
caster->RemoveSpellCooldown(spellInfo->Id, false);
}
else if (hasGlyph)
{
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))
{
SpellCooldowns::iterator citr = caster->GetSpellCooldownMap().find(spellInfo->Id);
if (citr != caster->GetSpellCooldownMap().end() && citr->second.needSendToClient)
caster->RemoveSpellCooldown(spellInfo->Id, true);
else
caster->RemoveSpellCooldown(spellInfo->Id, false);
}
}
}
}
bool hasGlyph = caster->HasAura(SPELL_ROGUE_GLYPH_OF_PREPARATION);
PlayerSpellMap const& spellMap = caster->GetSpellMap();
for (PlayerSpellMap::const_iterator itr = spellMap.begin(); itr != spellMap.end(); ++itr)
{
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
{
SpellCooldowns::iterator citr = caster->GetSpellCooldownMap().find(spellInfo->Id);
if (citr != caster->GetSpellCooldownMap().end() && citr->second.needSendToClient)
caster->RemoveSpellCooldown(spellInfo->Id, true);
else
caster->RemoveSpellCooldown(spellInfo->Id, false);
}
else if (hasGlyph)
{
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))
{
SpellCooldowns::iterator citr = caster->GetSpellCooldownMap().find(spellInfo->Id);
if (citr != caster->GetSpellCooldownMap().end() && citr->second.needSendToClient)
caster->RemoveSpellCooldown(spellInfo->Id, true);
else
caster->RemoveSpellCooldown(spellInfo->Id, false);
}
}
}
}
}
void Register()
@@ -600,8 +600,8 @@ class spell_rog_prey_on_the_weak : public SpellScriptLoader
{
Unit* target = GetTarget();
Unit* victim = target->GetVictim();
if (!victim && target->GetTypeId() == TYPEID_PLAYER)
victim = target->ToPlayer()->GetSelectedUnit();
if (!victim && target->GetTypeId() == TYPEID_PLAYER)
victim = target->ToPlayer()->GetSelectedUnit();
if (victim && (target->GetHealthPct() > victim->GetHealthPct()))
{
@@ -813,11 +813,11 @@ class spell_rog_tricks_of_the_trade_proc : public SpellScriptLoader
void AddSC_rogue_spell_scripts()
{
// Ours
new spell_rog_savage_combat();
new spell_rog_combat_potency();
// Ours
new spell_rog_savage_combat();
new spell_rog_combat_potency();
// Theirs
// Theirs
new spell_rog_blade_flurry();
new spell_rog_cheat_death();
new spell_rog_deadly_poison();

View File

@@ -30,10 +30,10 @@
enum ShamanSpells
{
// Ours
SPELL_SHAMAN_GLYPH_OF_FERAL_SPIRIT = 63271,
// Ours
SPELL_SHAMAN_GLYPH_OF_FERAL_SPIRIT = 63271,
// Theirs
// Theirs
SPELL_SHAMAN_ANCESTRAL_AWAKENING_PROC = 52752,
SPELL_SHAMAN_BIND_SIGHT = 6277,
SPELL_SHAMAN_CLEANSING_TOTEM_EFFECT = 52025,
@@ -79,14 +79,14 @@ class spell_sha_totem_of_wrath : public SpellScriptLoader
void HandleAfterCast()
{
if (AuraEffect* aurEff = GetCaster()->GetAuraEffect(63280, EFFECT_0))
if (AuraEffect* aurEff = GetCaster()->GetAuraEffect(63280, EFFECT_0))
if (Creature* totem = GetCaster()->GetMap()->GetCreature(GetCaster()->m_SummonSlot[1])) // Fire totem summon slot
if (SpellInfo const* totemSpell = sSpellMgr->GetSpellInfo(totem->m_spells[0]))
{
int32 bp0 = CalculatePct(totemSpell->Effects[EFFECT_0].CalcValue(), aurEff->GetAmount());
int32 bp1 = CalculatePct(totemSpell->Effects[EFFECT_1].CalcValue(), aurEff->GetAmount());
GetCaster()->CastCustomSpell(GetCaster(), 63283, &bp0, &bp1, NULL, true);
}
}
}
void Register()
@@ -113,8 +113,8 @@ class spell_sha_spirit_walk : public SpellScriptLoader
SpellCastResult CheckCast()
{
if (Unit* owner = GetCaster()->GetOwner())
if (GetCaster()->IsWithinDist(owner, GetSpellInfo()->GetMaxRange(GetSpellInfo()->IsPositive())))
return SPELL_CAST_OK;
if (GetCaster()->IsWithinDist(owner, GetSpellInfo()->GetMaxRange(GetSpellInfo()->IsPositive())))
return SPELL_CAST_OK;
return SPELL_FAILED_OUT_OF_RANGE;
}
@@ -142,17 +142,17 @@ class spell_sha_t10_restoration_4p_bonus : public SpellScriptLoader
bool CheckProc(ProcEventInfo& eventInfo)
{
return eventInfo.GetActor() && eventInfo.GetProcTarget();
return eventInfo.GetActor() && eventInfo.GetProcTarget();
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
uint32 triggered_spell_id = 70809;
uint32 triggered_spell_id = 70809;
SpellInfo const* triggeredSpell = sSpellMgr->GetSpellInfo(triggered_spell_id);
int32 amount = CalculatePct(eventInfo.GetDamageInfo()->GetDamage(), aurEff->GetAmount()) / triggeredSpell->GetMaxTicks();
eventInfo.GetProcTarget()->CastDelayedSpellWithPeriodicAmount(GetTarget(), triggered_spell_id, SPELL_AURA_PERIODIC_HEAL, amount, EFFECT_0);
int32 amount = CalculatePct(eventInfo.GetDamageInfo()->GetDamage(), aurEff->GetAmount()) / triggeredSpell->GetMaxTicks();
eventInfo.GetProcTarget()->CastDelayedSpellWithPeriodicAmount(GetTarget(), triggered_spell_id, SPELL_AURA_PERIODIC_HEAL, amount, EFFECT_0);
}
void Register()
@@ -183,7 +183,7 @@ class spell_sha_totemic_mastery : public SpellScriptLoader
for (uint8 i = SUMMON_SLOT_TOTEM; i < MAX_TOTEM_SLOT; ++i)
if (!GetTarget()->m_SummonSlot[i])
return;
return;
GetTarget()->CastSpell(GetTarget(), 38437, true);
}
@@ -211,111 +211,111 @@ class spell_sha_feral_spirit_scaling : public SpellScriptLoader
void CalculateResistanceAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
{
// xinef: feral spirit inherits 40% of resistance from owner and 35% of armor
if (Unit* owner = GetUnitOwner()->GetOwner())
{
SpellSchoolMask schoolMask = SpellSchoolMask(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue);
int32 modifier = schoolMask == SPELL_SCHOOL_MASK_NORMAL ? 35 : 40;
amount = CalculatePct(std::max<int32>(0, owner->GetResistance(schoolMask)), modifier);
}
// xinef: feral spirit inherits 40% of resistance from owner and 35% of armor
if (Unit* owner = GetUnitOwner()->GetOwner())
{
SpellSchoolMask schoolMask = SpellSchoolMask(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue);
int32 modifier = schoolMask == SPELL_SCHOOL_MASK_NORMAL ? 35 : 40;
amount = CalculatePct(std::max<int32>(0, owner->GetResistance(schoolMask)), modifier);
}
}
void CalculateStatAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
{
// xinef: by default feral spirit inherits 30% of stamina
if (Unit* owner = GetUnitOwner()->GetOwner())
{
Stats stat = Stats(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue);
amount = CalculatePct(std::max<int32>(0, owner->GetStat(stat)), 30);
}
// xinef: by default feral spirit inherits 30% of stamina
if (Unit* owner = GetUnitOwner()->GetOwner())
{
Stats stat = Stats(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue);
amount = CalculatePct(std::max<int32>(0, owner->GetStat(stat)), 30);
}
}
void CalculateAPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
void CalculateAPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
{
// xinef: by default feral spirit inherits 30% of AP
if (Unit* owner = GetUnitOwner()->GetOwner())
{
int32 modifier = 30;
if (AuraEffect const* gofsEff = owner->GetAuraEffect(SPELL_SHAMAN_GLYPH_OF_FERAL_SPIRIT, EFFECT_0))
modifier += gofsEff->GetAmount();
// xinef: by default feral spirit inherits 30% of AP
if (Unit* owner = GetUnitOwner()->GetOwner())
{
int32 modifier = 30;
if (AuraEffect const* gofsEff = owner->GetAuraEffect(SPELL_SHAMAN_GLYPH_OF_FERAL_SPIRIT, EFFECT_0))
modifier += gofsEff->GetAmount();
amount = CalculatePct(std::max<int32>(0, owner->GetTotalAttackPowerValue(BASE_ATTACK)), modifier);
}
amount = CalculatePct(std::max<int32>(0, owner->GetTotalAttackPowerValue(BASE_ATTACK)), modifier);
}
}
void CalculateSPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
void CalculateSPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
{
// xinef: by default feral spirit inherits 30% of AP as SP
if (Unit* owner = GetUnitOwner()->GetOwner())
{
int32 modifier = 30;
if (AuraEffect const* gofsEff = owner->GetAuraEffect(SPELL_SHAMAN_GLYPH_OF_FERAL_SPIRIT, EFFECT_0))
modifier += gofsEff->GetAmount();
// xinef: by default feral spirit inherits 30% of AP as SP
if (Unit* owner = GetUnitOwner()->GetOwner())
{
int32 modifier = 30;
if (AuraEffect const* gofsEff = owner->GetAuraEffect(SPELL_SHAMAN_GLYPH_OF_FERAL_SPIRIT, EFFECT_0))
modifier += gofsEff->GetAmount();
amount = CalculatePct(std::max<int32>(0, owner->GetTotalAttackPowerValue(BASE_ATTACK)), modifier);
amount = CalculatePct(std::max<int32>(0, owner->GetTotalAttackPowerValue(BASE_ATTACK)), modifier);
// xinef: Update appropriate player field
if (owner->GetTypeId() == TYPEID_PLAYER)
owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount);
}
// xinef: Update appropriate player field
if (owner->GetTypeId() == TYPEID_PLAYER)
owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount);
}
}
void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, aurEff->GetAuraType(), true, SPELL_BLOCK_TYPE_POSITIVE);
if (aurEff->GetAuraType() == SPELL_AURA_MOD_ATTACK_POWER)
GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_ATTACK_POWER_PCT, true, SPELL_BLOCK_TYPE_POSITIVE);
else if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT)
GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, true, SPELL_BLOCK_TYPE_POSITIVE);
}
void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, aurEff->GetAuraType(), true, SPELL_BLOCK_TYPE_POSITIVE);
if (aurEff->GetAuraType() == SPELL_AURA_MOD_ATTACK_POWER)
GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_ATTACK_POWER_PCT, true, SPELL_BLOCK_TYPE_POSITIVE);
else if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT)
GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, true, SPELL_BLOCK_TYPE_POSITIVE);
}
void CalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude)
void CalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude)
{
isPeriodic = true;
amplitude = 1*IN_MILLISECONDS;
}
void HandlePeriodic(AuraEffect const* aurEff)
{
PreventDefaultAction();
if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT && (aurEff->GetMiscValue() == STAT_STAMINA || aurEff->GetMiscValue() == STAT_INTELLECT))
{
int32 currentAmount = aurEff->GetAmount();
int32 newAmount = GetEffect(aurEff->GetEffIndex())->CalculateAmount(GetCaster());
if (newAmount != currentAmount)
{
if (aurEff->GetMiscValue() == STAT_STAMINA)
{
uint32 actStat = GetUnitOwner()->GetHealth();
GetEffect(aurEff->GetEffIndex())->ChangeAmount(newAmount, false);
GetUnitOwner()->SetHealth(std::min<uint32>(GetUnitOwner()->GetMaxHealth(), actStat));
}
else
{
uint32 actStat = GetUnitOwner()->GetPower(POWER_MANA);
GetEffect(aurEff->GetEffIndex())->ChangeAmount(newAmount, false);
GetUnitOwner()->SetPower(POWER_MANA, std::min<uint32>(GetUnitOwner()->GetMaxPower(POWER_MANA), actStat));
}
}
}
else
GetEffect(aurEff->GetEffIndex())->RecalculateAmount();
if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT && (aurEff->GetMiscValue() == STAT_STAMINA || aurEff->GetMiscValue() == STAT_INTELLECT))
{
int32 currentAmount = aurEff->GetAmount();
int32 newAmount = GetEffect(aurEff->GetEffIndex())->CalculateAmount(GetCaster());
if (newAmount != currentAmount)
{
if (aurEff->GetMiscValue() == STAT_STAMINA)
{
uint32 actStat = GetUnitOwner()->GetHealth();
GetEffect(aurEff->GetEffIndex())->ChangeAmount(newAmount, false);
GetUnitOwner()->SetHealth(std::min<uint32>(GetUnitOwner()->GetMaxHealth(), actStat));
}
else
{
uint32 actStat = GetUnitOwner()->GetPower(POWER_MANA);
GetEffect(aurEff->GetEffIndex())->ChangeAmount(newAmount, false);
GetUnitOwner()->SetPower(POWER_MANA, std::min<uint32>(GetUnitOwner()->GetMaxPower(POWER_MANA), actStat));
}
}
}
else
GetEffect(aurEff->GetEffIndex())->RecalculateAmount();
}
void Register()
{
if (m_scriptSpellId == 35675 || m_scriptSpellId == 35675)
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_sha_feral_spirit_scaling_AuraScript::CalculateResistanceAmount, EFFECT_ALL, SPELL_AURA_MOD_RESISTANCE);
if (m_scriptSpellId == 35675 || m_scriptSpellId == 35675)
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_sha_feral_spirit_scaling_AuraScript::CalculateResistanceAmount, EFFECT_ALL, SPELL_AURA_MOD_RESISTANCE);
if (m_scriptSpellId == 35674)
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_sha_feral_spirit_scaling_AuraScript::CalculateStatAmount, EFFECT_ALL, SPELL_AURA_MOD_STAT);
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_sha_feral_spirit_scaling_AuraScript::CalculateAPAmount, EFFECT_ALL, SPELL_AURA_MOD_ATTACK_POWER);
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_sha_feral_spirit_scaling_AuraScript::CalculateSPAmount, EFFECT_ALL, SPELL_AURA_MOD_DAMAGE_DONE);
}
if (m_scriptSpellId == 35674)
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_sha_feral_spirit_scaling_AuraScript::CalculateStatAmount, EFFECT_ALL, SPELL_AURA_MOD_STAT);
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_sha_feral_spirit_scaling_AuraScript::CalculateAPAmount, EFFECT_ALL, SPELL_AURA_MOD_ATTACK_POWER);
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_sha_feral_spirit_scaling_AuraScript::CalculateSPAmount, EFFECT_ALL, SPELL_AURA_MOD_DAMAGE_DONE);
}
OnEffectApply += AuraEffectApplyFn(spell_sha_feral_spirit_scaling_AuraScript::HandleEffectApply, EFFECT_ALL, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL);
DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_sha_feral_spirit_scaling_AuraScript::CalcPeriodic, EFFECT_ALL, SPELL_AURA_ANY);
OnEffectApply += AuraEffectApplyFn(spell_sha_feral_spirit_scaling_AuraScript::HandleEffectApply, EFFECT_ALL, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL);
DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_sha_feral_spirit_scaling_AuraScript::CalcPeriodic, EFFECT_ALL, SPELL_AURA_ANY);
OnEffectPeriodic += AuraEffectPeriodicFn(spell_sha_feral_spirit_scaling_AuraScript::HandlePeriodic, EFFECT_ALL, SPELL_AURA_ANY);
}
};
@@ -337,73 +337,73 @@ class spell_sha_fire_elemental_scaling : public SpellScriptLoader
void CalculateResistanceAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
{
// xinef: fire elemental inherits 40% of resistance from owner and 35% of armor
if (Unit* owner = GetUnitOwner()->GetOwner())
{
SpellSchoolMask schoolMask = SpellSchoolMask(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue);
int32 modifier = schoolMask == SPELL_SCHOOL_MASK_NORMAL ? 35 : 40;
amount = CalculatePct(std::max<int32>(0, owner->GetResistance(schoolMask)), modifier);
}
// xinef: fire elemental inherits 40% of resistance from owner and 35% of armor
if (Unit* owner = GetUnitOwner()->GetOwner())
{
SpellSchoolMask schoolMask = SpellSchoolMask(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue);
int32 modifier = schoolMask == SPELL_SCHOOL_MASK_NORMAL ? 35 : 40;
amount = CalculatePct(std::max<int32>(0, owner->GetResistance(schoolMask)), modifier);
}
}
void CalculateStatAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
{
// xinef: fire elemental inherits 30% of intellect / stamina
if (Unit* owner = GetUnitOwner()->GetOwner())
{
Stats stat = Stats(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue);
amount = CalculatePct(std::max<int32>(0, owner->GetStat(stat)), 30);
}
// xinef: fire elemental inherits 30% of intellect / stamina
if (Unit* owner = GetUnitOwner()->GetOwner())
{
Stats stat = Stats(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue);
amount = CalculatePct(std::max<int32>(0, owner->GetStat(stat)), 30);
}
}
void CalculateAPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
void CalculateAPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
{
// xinef: fire elemental inherits 300% / 150% of SP as AP
if (Unit* owner = GetUnitOwner()->GetOwner())
{
int32 fire = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FIRE);
amount = CalculatePct(std::max<int32>(0, fire), (GetUnitOwner()->GetEntry() == NPC_FIRE_ELEMENTAL ? 300 : 150));
}
// xinef: fire elemental inherits 300% / 150% of SP as AP
if (Unit* owner = GetUnitOwner()->GetOwner())
{
int32 fire = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FIRE);
amount = CalculatePct(std::max<int32>(0, fire), (GetUnitOwner()->GetEntry() == NPC_FIRE_ELEMENTAL ? 300 : 150));
}
}
void CalculateSPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
void CalculateSPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
{
// xinef: fire elemental inherits 100% of SP
if (Unit* owner = GetUnitOwner()->GetOwner())
{
int32 fire = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FIRE);
amount = CalculatePct(std::max<int32>(0, fire), 100);
// xinef: fire elemental inherits 100% of SP
if (Unit* owner = GetUnitOwner()->GetOwner())
{
int32 fire = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FIRE);
amount = CalculatePct(std::max<int32>(0, fire), 100);
// xinef: Update appropriate player field
if (owner->GetTypeId() == TYPEID_PLAYER)
owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount);
}
// xinef: Update appropriate player field
if (owner->GetTypeId() == TYPEID_PLAYER)
owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount);
}
}
void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, aurEff->GetAuraType(), true, SPELL_BLOCK_TYPE_POSITIVE);
if (aurEff->GetAuraType() == SPELL_AURA_MOD_ATTACK_POWER)
GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_ATTACK_POWER_PCT, true, SPELL_BLOCK_TYPE_POSITIVE);
else if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT)
GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, true, SPELL_BLOCK_TYPE_POSITIVE);
}
void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, aurEff->GetAuraType(), true, SPELL_BLOCK_TYPE_POSITIVE);
if (aurEff->GetAuraType() == SPELL_AURA_MOD_ATTACK_POWER)
GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_ATTACK_POWER_PCT, true, SPELL_BLOCK_TYPE_POSITIVE);
else if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT)
GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, true, SPELL_BLOCK_TYPE_POSITIVE);
}
void Register()
{
if (m_scriptSpellId != 35665 && m_scriptSpellId != 65225)
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_sha_fire_elemental_scaling_AuraScript::CalculateResistanceAmount, EFFECT_ALL, SPELL_AURA_MOD_RESISTANCE);
if (m_scriptSpellId != 35665 && m_scriptSpellId != 65225)
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_sha_fire_elemental_scaling_AuraScript::CalculateResistanceAmount, EFFECT_ALL, SPELL_AURA_MOD_RESISTANCE);
if (m_scriptSpellId == 35666 || m_scriptSpellId == 65226)
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_sha_fire_elemental_scaling_AuraScript::CalculateStatAmount, EFFECT_ALL, SPELL_AURA_MOD_STAT);
if (m_scriptSpellId == 35666 || m_scriptSpellId == 65226)
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_sha_fire_elemental_scaling_AuraScript::CalculateStatAmount, EFFECT_ALL, SPELL_AURA_MOD_STAT);
if (m_scriptSpellId == 35665 || m_scriptSpellId == 65225)
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_sha_fire_elemental_scaling_AuraScript::CalculateAPAmount, EFFECT_ALL, SPELL_AURA_MOD_ATTACK_POWER);
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_sha_fire_elemental_scaling_AuraScript::CalculateSPAmount, EFFECT_ALL, SPELL_AURA_MOD_DAMAGE_DONE);
}
if (m_scriptSpellId == 35665 || m_scriptSpellId == 65225)
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_sha_fire_elemental_scaling_AuraScript::CalculateAPAmount, EFFECT_ALL, SPELL_AURA_MOD_ATTACK_POWER);
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_sha_fire_elemental_scaling_AuraScript::CalculateSPAmount, EFFECT_ALL, SPELL_AURA_MOD_DAMAGE_DONE);
}
OnEffectApply += AuraEffectApplyFn(spell_sha_fire_elemental_scaling_AuraScript::HandleEffectApply, EFFECT_ALL, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL);
OnEffectApply += AuraEffectApplyFn(spell_sha_fire_elemental_scaling_AuraScript::HandleEffectApply, EFFECT_ALL, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL);
}
};
@@ -658,9 +658,9 @@ class spell_sha_earth_shield : public SpellScriptLoader
{
if (Unit* caster = GetCaster())
{
int32 baseAmount = amount;
int32 baseAmount = amount;
amount = caster->SpellHealingBonusDone(GetUnitOwner(), GetSpellInfo(), amount, HEAL);
// xinef: taken should be calculated at every heal
// xinef: taken should be calculated at every heal
//amount = GetUnitOwner()->SpellHealingBonusTaken(caster, GetSpellInfo(), amount, HEAL);
// Glyph of Earth Shield
@@ -669,17 +669,17 @@ class spell_sha_earth_shield : public SpellScriptLoader
if (AuraEffect* glyphe = caster->GetAuraEffect(SPELL_SHAMAN_GLYPH_OF_EARTH_SHIELD, EFFECT_0))
AddPct(amount, glyphe->GetAmount());
// xinef: Improved Shields
if (baseAmount = amount - baseAmount)
if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_AURA_ADD_PCT_MODIFIER, SPELLFAMILY_SHAMAN, 19, EFFECT_1))
{
ApplyPct(baseAmount, aurEff->GetAmount());
amount += baseAmount;
}
// xinef: Improved Shields
if (baseAmount = amount - baseAmount)
if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_AURA_ADD_PCT_MODIFIER, SPELLFAMILY_SHAMAN, 19, EFFECT_1))
{
ApplyPct(baseAmount, aurEff->GetAmount());
amount += baseAmount;
}
}
}
bool CheckProc(ProcEventInfo& eventInfo)
bool CheckProc(ProcEventInfo& eventInfo)
{
return !GetTarget()->HasSpellCooldown(SPELL_SHAMAN_EARTH_SHIELD_HEAL);
}
@@ -1354,15 +1354,15 @@ class spell_sha_thunderstorm : public SpellScriptLoader
void AddSC_shaman_spell_scripts()
{
// ours
new spell_sha_totem_of_wrath();
new spell_sha_spirit_walk();
new spell_sha_t10_restoration_4p_bonus();
new spell_sha_totemic_mastery();
new spell_sha_feral_spirit_scaling();
new spell_sha_fire_elemental_scaling();
// ours
new spell_sha_totem_of_wrath();
new spell_sha_spirit_walk();
new spell_sha_t10_restoration_4p_bonus();
new spell_sha_totemic_mastery();
new spell_sha_feral_spirit_scaling();
new spell_sha_fire_elemental_scaling();
// theirs
// theirs
new spell_sha_ancestral_awakening_proc();
new spell_sha_astral_shift();
new spell_sha_bloodlust();

View File

@@ -73,42 +73,42 @@ class spell_warl_eye_of_kilrogg : public SpellScriptLoader
{
PrepareAuraScript(spell_warl_eye_of_kilrogg_AuraScript);
void HandleAuraApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
void HandleAuraApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
PreventDefaultAction();
PreventDefaultAction();
if (Player* player = GetTarget()->ToPlayer())
{
{
player->UnsummonPetTemporaryIfAny();
// Glyph of Kilrogg
if (player->HasAura(58081))
if (Unit* charm = player->GetCharm())
{
charm->SetSpeed(MOVE_RUN, 2.14f, true);
if (charm->GetMapId() == 530 || charm->GetMapId() == 571)
{
charm->SetCanFly(true);
charm->SetSpeed(MOVE_FLIGHT, 2.14f, true);
charm->SendMovementFlagUpdate();
}
}
}
// Glyph of Kilrogg
if (player->HasAura(58081))
if (Unit* charm = player->GetCharm())
{
charm->SetSpeed(MOVE_RUN, 2.14f, true);
if (charm->GetMapId() == 530 || charm->GetMapId() == 571)
{
charm->SetCanFly(true);
charm->SetSpeed(MOVE_FLIGHT, 2.14f, true);
charm->SendMovementFlagUpdate();
}
}
}
}
void HandleAuraRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
void HandleAuraRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Player* player = GetTarget()->ToPlayer())
{
if (Unit* charm = player->GetCharm())
charm->ToTempSummon()->UnSummon();
{
if (Unit* charm = player->GetCharm())
charm->ToTempSummon()->UnSummon();
player->ResummonPetTemporaryUnSummonedIfAny();
}
}
}
void Register()
{
OnEffectApply += AuraEffectApplyFn(spell_warl_eye_of_kilrogg_AuraScript::HandleAuraApply, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
OnEffectApply += AuraEffectApplyFn(spell_warl_eye_of_kilrogg_AuraScript::HandleAuraApply, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
AfterEffectRemove += AuraEffectRemoveFn(spell_warl_eye_of_kilrogg_AuraScript::HandleAuraRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
@@ -130,8 +130,8 @@ class spell_warl_shadowflame : public SpellScriptLoader
void HandleSchoolDMG(SpellEffIndex /*effIndex*/)
{
if (Unit* target = GetHitUnit())
GetCaster()->CastSpell(target, (GetSpellInfo()->Id == 47897 ? 47960 : 61291), true);
if (Unit* target = GetHitUnit())
GetCaster()->CastSpell(target, (GetSpellInfo()->Id == 47897 ? 47960 : 61291), true);
}
void Register()
@@ -155,24 +155,24 @@ class spell_warl_seduction : public SpellScriptLoader
{
PrepareAuraScript(spell_warl_seduction_AuraScript);
void HandleAuraApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
void HandleAuraApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Unit* caster = GetCaster())
{
if (Unit* owner = caster->GetOwner())
if (owner->GetAuraEffectDummy(56250))
{
Unit* target = GetTarget();
target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE, 0, target->GetAura(32409)); // SW:D shall not be removed.
target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE_PERCENT);
target->RemoveAurasByType(SPELL_AURA_PERIODIC_LEECH);
}
}
{
if (Unit* owner = caster->GetOwner())
if (owner->GetAuraEffectDummy(56250))
{
Unit* target = GetTarget();
target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE, 0, target->GetAura(32409)); // SW:D shall not be removed.
target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE_PERCENT);
target->RemoveAurasByType(SPELL_AURA_PERIODIC_LEECH);
}
}
}
void Register()
{
OnEffectApply += AuraEffectApplyFn(spell_warl_seduction_AuraScript::HandleAuraApply, EFFECT_0, SPELL_AURA_MOD_STUN, AURA_EFFECT_HANDLE_REAL);
OnEffectApply += AuraEffectApplyFn(spell_warl_seduction_AuraScript::HandleAuraApply, EFFECT_0, SPELL_AURA_MOD_STUN, AURA_EFFECT_HANDLE_REAL);
}
};
@@ -191,10 +191,10 @@ class spell_warl_improved_demonic_tactics : public SpellScriptLoader
{
PrepareAuraScript(spell_warl_improved_demonic_tactics_AuraScript);
bool Load()
{
return GetUnitOwner()->GetTypeId() == TYPEID_PLAYER;
}
bool Load()
{
return GetUnitOwner()->GetTypeId() == TYPEID_PLAYER;
}
void CalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude)
{
@@ -204,10 +204,10 @@ class spell_warl_improved_demonic_tactics : public SpellScriptLoader
void CalculateAmount(AuraEffect const* aurEff, int32& amount, bool& canBeRecalculated)
{
if (aurEff->GetEffIndex() == EFFECT_0)
amount = CalculatePct<int32, float>(GetUnitOwner()->ToPlayer()->GetFloatValue(PLAYER_SPELL_CRIT_PERCENTAGE1 + SPELL_SCHOOL_FROST), GetSpellInfo()->Effects[EFFECT_0].CalcValue());
else
amount = CalculatePct<int32, float>(GetUnitOwner()->ToPlayer()->GetFloatValue(PLAYER_CRIT_PERCENTAGE), GetSpellInfo()->Effects[EFFECT_0].CalcValue());
if (aurEff->GetEffIndex() == EFFECT_0)
amount = CalculatePct<int32, float>(GetUnitOwner()->ToPlayer()->GetFloatValue(PLAYER_SPELL_CRIT_PERCENTAGE1 + SPELL_SCHOOL_FROST), GetSpellInfo()->Effects[EFFECT_0].CalcValue());
else
amount = CalculatePct<int32, float>(GetUnitOwner()->ToPlayer()->GetFloatValue(PLAYER_CRIT_PERCENTAGE), GetSpellInfo()->Effects[EFFECT_0].CalcValue());
}
void HandleEffectCalcSpellMod(AuraEffect const* aurEff, SpellModifier*& spellMod)
@@ -215,7 +215,7 @@ class spell_warl_improved_demonic_tactics : public SpellScriptLoader
if (!spellMod)
{
spellMod = new SpellModifier(aurEff->GetBase());
spellMod->op = SpellModOp(aurEff->GetMiscValue());
spellMod->op = SpellModOp(aurEff->GetMiscValue());
spellMod->type = SPELLMOD_FLAT;
spellMod->spellId = GetId();
spellMod->mask = flag96(0x0, 0x2000, 0x0); // Pet Passive
@@ -227,7 +227,7 @@ class spell_warl_improved_demonic_tactics : public SpellScriptLoader
void HandlePeriodic(AuraEffect const* aurEff)
{
PreventDefaultAction();
GetAura()->GetEffect(aurEff->GetEffIndex())->RecalculateAmount();
GetAura()->GetEffect(aurEff->GetEffIndex())->RecalculateAmount();
}
void Register()
@@ -256,10 +256,10 @@ class spell_warl_ritual_of_summoning : public SpellScriptLoader
SpellCastResult CheckCast()
{
if (GetCaster()->GetTypeId() == TYPEID_PLAYER)
if (GetCaster()->ToPlayer()->InBattleground())
return SPELL_FAILED_NOT_IN_BATTLEGROUND;
return SPELL_CAST_OK;
if (GetCaster()->GetTypeId() == TYPEID_PLAYER)
if (GetCaster()->ToPlayer()->InBattleground())
return SPELL_FAILED_NOT_IN_BATTLEGROUND;
return SPELL_CAST_OK;
}
void Register()
@@ -283,15 +283,15 @@ class spell_warl_demonic_aegis : public SpellScriptLoader
{
PrepareAuraScript(spell_warl_demonic_aegis_AuraScript);
void HandleAuraApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
void HandleAuraApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
// Remove Fel Armor and Demon Armor
GetTarget()->RemoveAurasWithFamily(SPELLFAMILY_WARLOCK, 0, 0x20000020, 0, 0);
// Remove Fel Armor and Demon Armor
GetTarget()->RemoveAurasWithFamily(SPELLFAMILY_WARLOCK, 0, 0x20000020, 0, 0);
}
void Register()
{
OnEffectRemove += AuraEffectRemoveFn(spell_warl_demonic_aegis_AuraScript::HandleAuraApply, EFFECT_0, SPELL_AURA_ADD_PCT_MODIFIER, AURA_EFFECT_HANDLE_REAL);
OnEffectRemove += AuraEffectRemoveFn(spell_warl_demonic_aegis_AuraScript::HandleAuraApply, EFFECT_0, SPELL_AURA_ADD_PCT_MODIFIER, AURA_EFFECT_HANDLE_REAL);
}
};
@@ -312,26 +312,26 @@ class spell_warl_demonic_knowledge : public SpellScriptLoader
void CalculateAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
{
if (Unit* caster = GetCaster())
amount = CalculatePct(caster->GetStat(STAT_STAMINA)+caster->GetStat(STAT_INTELLECT), aurEff->GetBaseAmount());
if (Unit* caster = GetCaster())
amount = CalculatePct(caster->GetStat(STAT_STAMINA)+caster->GetStat(STAT_INTELLECT), aurEff->GetBaseAmount());
}
void CalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude)
void CalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude)
{
isPeriodic = true;
amplitude = 5*IN_MILLISECONDS;
}
void HandlePeriodic(AuraEffect const* aurEff)
{
PreventDefaultAction();
GetEffect(aurEff->GetEffIndex())->RecalculateAmount();
GetEffect(aurEff->GetEffIndex())->RecalculateAmount();
}
void Register()
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_demonic_knowledge_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_MOD_DAMAGE_DONE);
DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_warl_demonic_knowledge_AuraScript::CalcPeriodic, EFFECT_0, SPELL_AURA_MOD_DAMAGE_DONE);
DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_warl_demonic_knowledge_AuraScript::CalcPeriodic, EFFECT_0, SPELL_AURA_MOD_DAMAGE_DONE);
OnEffectPeriodic += AuraEffectPeriodicFn(spell_warl_demonic_knowledge_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_MOD_DAMAGE_DONE);
}
};
@@ -353,102 +353,102 @@ class spell_warl_generic_scaling : public SpellScriptLoader
void CalculateResistanceAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
{
// xinef: pet inherits 40% of resistance from owner and 35% of armor
if (Unit* owner = GetUnitOwner()->GetOwner())
{
SpellSchoolMask schoolMask = SpellSchoolMask(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue);
int32 modifier = schoolMask == SPELL_SCHOOL_MASK_NORMAL ? 35 : 40;
amount = CalculatePct(std::max<int32>(0, owner->GetResistance(schoolMask)), modifier);
}
// xinef: pet inherits 40% of resistance from owner and 35% of armor
if (Unit* owner = GetUnitOwner()->GetOwner())
{
SpellSchoolMask schoolMask = SpellSchoolMask(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue);
int32 modifier = schoolMask == SPELL_SCHOOL_MASK_NORMAL ? 35 : 40;
amount = CalculatePct(std::max<int32>(0, owner->GetResistance(schoolMask)), modifier);
}
}
void CalculateStatAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
{
// xinef: by default warlock pet inherits 75% of stamina and 30% of intellect
if (Unit* owner = GetUnitOwner()->GetOwner())
{
Stats stat = Stats(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue);
int32 modifier = stat == STAT_STAMINA ? 75 : 30;
amount = CalculatePct(std::max<int32>(0, owner->GetStat(stat)), modifier);
}
// xinef: by default warlock pet inherits 75% of stamina and 30% of intellect
if (Unit* owner = GetUnitOwner()->GetOwner())
{
Stats stat = Stats(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue);
int32 modifier = stat == STAT_STAMINA ? 75 : 30;
amount = CalculatePct(std::max<int32>(0, owner->GetStat(stat)), modifier);
}
}
void CalculateAPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
void CalculateAPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
{
// xinef: by default warlock pet inherits 57% of max(SP FIRE, SP SHADOW) as AP
if (Unit* owner = GetUnitOwner()->GetOwner())
{
int32 fire = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FIRE);
int32 shadow = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_SHADOW);
int32 maximum = (fire > shadow) ? fire : shadow;
amount = CalculatePct(std::max<int32>(0, maximum), 57);
}
// xinef: by default warlock pet inherits 57% of max(SP FIRE, SP SHADOW) as AP
if (Unit* owner = GetUnitOwner()->GetOwner())
{
int32 fire = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FIRE);
int32 shadow = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_SHADOW);
int32 maximum = (fire > shadow) ? fire : shadow;
amount = CalculatePct(std::max<int32>(0, maximum), 57);
}
}
void CalculateSPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
void CalculateSPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
{
// xinef: by default warlock pet inherits 15% of max(SP FIRE, SP SHADOW) as SP
if (Unit* owner = GetUnitOwner()->GetOwner())
{
int32 fire = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FIRE);
int32 shadow = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_SHADOW);
int32 maximum = (fire > shadow) ? fire : shadow;
amount = CalculatePct(std::max<int32>(0, maximum), 15);
// xinef: by default warlock pet inherits 15% of max(SP FIRE, SP SHADOW) as SP
if (Unit* owner = GetUnitOwner()->GetOwner())
{
int32 fire = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FIRE);
int32 shadow = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_SHADOW);
int32 maximum = (fire > shadow) ? fire : shadow;
amount = CalculatePct(std::max<int32>(0, maximum), 15);
// xinef: Update appropriate player field
if (owner->GetTypeId() == TYPEID_PLAYER)
owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount);
}
// xinef: Update appropriate player field
if (owner->GetTypeId() == TYPEID_PLAYER)
owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount);
}
}
void CalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude)
void CalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude)
{
isPeriodic = true;
amplitude = 2*IN_MILLISECONDS;
}
void HandlePeriodic(AuraEffect const* aurEff)
{
PreventDefaultAction();
if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT && (aurEff->GetMiscValue() == STAT_STAMINA || aurEff->GetMiscValue() == STAT_INTELLECT))
{
int32 currentAmount = aurEff->GetAmount();
int32 newAmount = GetEffect(aurEff->GetEffIndex())->CalculateAmount(GetCaster());
if (newAmount != currentAmount)
{
if (aurEff->GetMiscValue() == STAT_STAMINA)
{
uint32 actStat = GetUnitOwner()->GetHealth();
GetEffect(aurEff->GetEffIndex())->ChangeAmount(newAmount, false);
GetUnitOwner()->SetHealth(std::min<uint32>(GetUnitOwner()->GetMaxHealth(), actStat));
}
else
{
uint32 actStat = GetUnitOwner()->GetPower(POWER_MANA);
GetEffect(aurEff->GetEffIndex())->ChangeAmount(newAmount, false);
GetUnitOwner()->SetPower(POWER_MANA, std::min<uint32>(GetUnitOwner()->GetMaxPower(POWER_MANA), actStat));
}
}
}
else
GetEffect(aurEff->GetEffIndex())->RecalculateAmount();
if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT && (aurEff->GetMiscValue() == STAT_STAMINA || aurEff->GetMiscValue() == STAT_INTELLECT))
{
int32 currentAmount = aurEff->GetAmount();
int32 newAmount = GetEffect(aurEff->GetEffIndex())->CalculateAmount(GetCaster());
if (newAmount != currentAmount)
{
if (aurEff->GetMiscValue() == STAT_STAMINA)
{
uint32 actStat = GetUnitOwner()->GetHealth();
GetEffect(aurEff->GetEffIndex())->ChangeAmount(newAmount, false);
GetUnitOwner()->SetHealth(std::min<uint32>(GetUnitOwner()->GetMaxHealth(), actStat));
}
else
{
uint32 actStat = GetUnitOwner()->GetPower(POWER_MANA);
GetEffect(aurEff->GetEffIndex())->ChangeAmount(newAmount, false);
GetUnitOwner()->SetPower(POWER_MANA, std::min<uint32>(GetUnitOwner()->GetMaxPower(POWER_MANA), actStat));
}
}
}
else
GetEffect(aurEff->GetEffIndex())->RecalculateAmount();
}
void Register()
{
if (m_scriptSpellId != 34947)
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_generic_scaling_AuraScript::CalculateResistanceAmount, EFFECT_ALL, SPELL_AURA_MOD_RESISTANCE);
if (m_scriptSpellId != 34947)
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_generic_scaling_AuraScript::CalculateResistanceAmount, EFFECT_ALL, SPELL_AURA_MOD_RESISTANCE);
if (m_scriptSpellId == 34947 || m_scriptSpellId == 34956)
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_generic_scaling_AuraScript::CalculateStatAmount, EFFECT_ALL, SPELL_AURA_MOD_STAT);
if (m_scriptSpellId == 34947 || m_scriptSpellId == 34956)
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_generic_scaling_AuraScript::CalculateStatAmount, EFFECT_ALL, SPELL_AURA_MOD_STAT);
if (m_scriptSpellId == 34947)
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_generic_scaling_AuraScript::CalculateAPAmount, EFFECT_ALL, SPELL_AURA_MOD_ATTACK_POWER);
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_generic_scaling_AuraScript::CalculateSPAmount, EFFECT_ALL, SPELL_AURA_MOD_DAMAGE_DONE);
}
if (m_scriptSpellId == 34947)
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_generic_scaling_AuraScript::CalculateAPAmount, EFFECT_ALL, SPELL_AURA_MOD_ATTACK_POWER);
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_generic_scaling_AuraScript::CalculateSPAmount, EFFECT_ALL, SPELL_AURA_MOD_DAMAGE_DONE);
}
DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_warl_generic_scaling_AuraScript::CalcPeriodic, EFFECT_ALL, SPELL_AURA_ANY);
DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_warl_generic_scaling_AuraScript::CalcPeriodic, EFFECT_ALL, SPELL_AURA_ANY);
OnEffectPeriodic += AuraEffectPeriodicFn(spell_warl_generic_scaling_AuraScript::HandlePeriodic, EFFECT_ALL, SPELL_AURA_ANY);
}
};
@@ -470,78 +470,78 @@ class spell_warl_infernal_scaling : public SpellScriptLoader
void CalculateResistanceAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
{
// xinef: pet inherits 40% of resistance from owner and 35% of armor
if (Unit* owner = GetUnitOwner()->GetOwner())
{
SpellSchoolMask schoolMask = SpellSchoolMask(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue);
int32 modifier = schoolMask == SPELL_SCHOOL_MASK_NORMAL ? 35 : 40;
amount = CalculatePct(std::max<int32>(0, owner->GetResistance(schoolMask)), modifier);
}
// xinef: pet inherits 40% of resistance from owner and 35% of armor
if (Unit* owner = GetUnitOwner()->GetOwner())
{
SpellSchoolMask schoolMask = SpellSchoolMask(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue);
int32 modifier = schoolMask == SPELL_SCHOOL_MASK_NORMAL ? 35 : 40;
amount = CalculatePct(std::max<int32>(0, owner->GetResistance(schoolMask)), modifier);
}
}
void CalculateStatAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
{
// xinef: by default warlock pet inherits 75% of stamina and 30% of intellect
if (Unit* owner = GetUnitOwner()->GetOwner())
{
Stats stat = Stats(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue);
int32 modifier = stat == STAT_STAMINA ? 75 : 30;
amount = CalculatePct(std::max<int32>(0, owner->GetStat(stat)), modifier);
}
// xinef: by default warlock pet inherits 75% of stamina and 30% of intellect
if (Unit* owner = GetUnitOwner()->GetOwner())
{
Stats stat = Stats(aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].MiscValue);
int32 modifier = stat == STAT_STAMINA ? 75 : 30;
amount = CalculatePct(std::max<int32>(0, owner->GetStat(stat)), modifier);
}
}
void CalculateAPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
void CalculateAPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
{
// xinef: by default warlock pet inherits 57% of max(SP FIRE, SP SHADOW) as AP
if (Unit* owner = GetUnitOwner()->GetOwner())
{
int32 fire = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FIRE);
int32 shadow = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_SHADOW);
int32 maximum = (fire > shadow) ? fire : shadow;
amount = CalculatePct(std::max<int32>(0, maximum), 57);
}
// xinef: by default warlock pet inherits 57% of max(SP FIRE, SP SHADOW) as AP
if (Unit* owner = GetUnitOwner()->GetOwner())
{
int32 fire = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FIRE);
int32 shadow = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_SHADOW);
int32 maximum = (fire > shadow) ? fire : shadow;
amount = CalculatePct(std::max<int32>(0, maximum), 57);
}
}
void CalculateSPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
void CalculateSPAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
{
// xinef: by default warlock pet inherits 15% of max(SP FIRE, SP SHADOW) as SP
if (Unit* owner = GetUnitOwner()->GetOwner())
{
int32 fire = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FIRE);
int32 shadow = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_SHADOW);
int32 maximum = (fire > shadow) ? fire : shadow;
amount = CalculatePct(std::max<int32>(0, maximum), 15);
// xinef: by default warlock pet inherits 15% of max(SP FIRE, SP SHADOW) as SP
if (Unit* owner = GetUnitOwner()->GetOwner())
{
int32 fire = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FIRE);
int32 shadow = owner->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_SHADOW);
int32 maximum = (fire > shadow) ? fire : shadow;
amount = CalculatePct(std::max<int32>(0, maximum), 15);
// xinef: Update appropriate player field
if (owner->GetTypeId() == TYPEID_PLAYER)
owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount);
}
// xinef: Update appropriate player field
if (owner->GetTypeId() == TYPEID_PLAYER)
owner->SetUInt32Value(PLAYER_PET_SPELL_POWER, (uint32)amount);
}
}
void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, aurEff->GetAuraType(), true, SPELL_BLOCK_TYPE_POSITIVE);
if (aurEff->GetAuraType() == SPELL_AURA_MOD_ATTACK_POWER)
GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_ATTACK_POWER_PCT, true, SPELL_BLOCK_TYPE_POSITIVE);
else if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT)
GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, true, SPELL_BLOCK_TYPE_POSITIVE);
}
void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, aurEff->GetAuraType(), true, SPELL_BLOCK_TYPE_POSITIVE);
if (aurEff->GetAuraType() == SPELL_AURA_MOD_ATTACK_POWER)
GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_ATTACK_POWER_PCT, true, SPELL_BLOCK_TYPE_POSITIVE);
else if (aurEff->GetAuraType() == SPELL_AURA_MOD_STAT)
GetUnitOwner()->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, true, SPELL_BLOCK_TYPE_POSITIVE);
}
void Register()
{
if (m_scriptSpellId != 36186)
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_infernal_scaling_AuraScript::CalculateResistanceAmount, EFFECT_ALL, SPELL_AURA_MOD_RESISTANCE);
if (m_scriptSpellId != 36186)
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_infernal_scaling_AuraScript::CalculateResistanceAmount, EFFECT_ALL, SPELL_AURA_MOD_RESISTANCE);
if (m_scriptSpellId == 36186 || m_scriptSpellId == 36188)
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_infernal_scaling_AuraScript::CalculateStatAmount, EFFECT_ALL, SPELL_AURA_MOD_STAT);
if (m_scriptSpellId == 36186 || m_scriptSpellId == 36188)
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_infernal_scaling_AuraScript::CalculateStatAmount, EFFECT_ALL, SPELL_AURA_MOD_STAT);
if (m_scriptSpellId == 36186)
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_infernal_scaling_AuraScript::CalculateAPAmount, EFFECT_ALL, SPELL_AURA_MOD_ATTACK_POWER);
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_infernal_scaling_AuraScript::CalculateSPAmount, EFFECT_ALL, SPELL_AURA_MOD_DAMAGE_DONE);
}
if (m_scriptSpellId == 36186)
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_infernal_scaling_AuraScript::CalculateAPAmount, EFFECT_ALL, SPELL_AURA_MOD_ATTACK_POWER);
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_infernal_scaling_AuraScript::CalculateSPAmount, EFFECT_ALL, SPELL_AURA_MOD_DAMAGE_DONE);
}
OnEffectApply += AuraEffectApplyFn(spell_warl_infernal_scaling_AuraScript::HandleEffectApply, EFFECT_ALL, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL);
OnEffectApply += AuraEffectApplyFn(spell_warl_infernal_scaling_AuraScript::HandleEffectApply, EFFECT_ALL, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL);
}
};
@@ -765,10 +765,10 @@ class spell_warl_everlasting_affliction : public SpellScriptLoader
if (Unit* unitTarget = GetHitUnit())
// Refresh corruption on target
if (AuraEffect* aur = unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_WARLOCK, 0x2, 0, 0, GetCaster()->GetGUID()))
{
{
aur->GetBase()->RefreshTimersWithMods();
aur->ChangeAmount(aur->CalculateAmount(aur->GetCaster()), false);
}
aur->ChangeAmount(aur->CalculateAmount(aur->GetCaster()), false);
}
}
void Register()
@@ -1104,7 +1104,7 @@ class spell_warl_fel_synergy : public SpellScriptLoader
bool CheckProc(ProcEventInfo& eventInfo)
{
// Xinef: Added charm check
// Xinef: Added charm check
return (GetTarget()->GetGuardianPet() || GetTarget()->GetCharm()) && eventInfo.GetDamageInfo()->GetDamage();
}
@@ -1211,8 +1211,8 @@ class spell_warl_unstable_affliction : public SpellScriptLoader
if (Unit* caster = GetCaster())
if (AuraEffect const* aurEff = GetEffect(EFFECT_0))
{
int32 damage = aurEff->GetBaseAmount();
damage = aurEff->GetSpellInfo()->Effects[EFFECT_0].CalcValue(caster, &damage, NULL) * 9;
int32 damage = aurEff->GetBaseAmount();
damage = aurEff->GetSpellInfo()->Effects[EFFECT_0].CalcValue(caster, &damage, NULL) * 9;
// backfire damage and silence
caster->CastCustomSpell(dispelInfo->GetDispeller(), SPELL_WARLOCK_UNSTABLE_AFFLICTION_DISPEL, &damage, NULL, NULL, true, NULL, aurEff);
}
@@ -1394,18 +1394,18 @@ class spell_warl_glyph_of_shadowflame : public SpellScriptLoader
void AddSC_warlock_spell_scripts()
{
// Ours
new spell_warl_eye_of_kilrogg();
new spell_warl_shadowflame();
new spell_warl_seduction();
new spell_warl_improved_demonic_tactics();
new spell_warl_ritual_of_summoning();
new spell_warl_demonic_aegis();
new spell_warl_demonic_knowledge();
new spell_warl_generic_scaling();
new spell_warl_infernal_scaling();
// Ours
new spell_warl_eye_of_kilrogg();
new spell_warl_shadowflame();
new spell_warl_seduction();
new spell_warl_improved_demonic_tactics();
new spell_warl_ritual_of_summoning();
new spell_warl_demonic_aegis();
new spell_warl_demonic_knowledge();
new spell_warl_generic_scaling();
new spell_warl_infernal_scaling();
// Theirs
// Theirs
new spell_warl_banish();
new spell_warl_create_healthstone();
new spell_warl_curse_of_doom();

View File

@@ -29,12 +29,12 @@
enum WarriorSpells
{
// Ours
SPELL_WARRIOR_INTERVENE_TRIGGER = 59667,
SPELL_WARRIOR_SPELL_REFLECTION = 23920,
SPELL_WARRIOR_IMPROVED_SPELL_REFLECTION_TRIGGER = 59725,
// Ours
SPELL_WARRIOR_INTERVENE_TRIGGER = 59667,
SPELL_WARRIOR_SPELL_REFLECTION = 23920,
SPELL_WARRIOR_IMPROVED_SPELL_REFLECTION_TRIGGER = 59725,
// Theirs
// Theirs
SPELL_WARRIOR_BLOODTHIRST = 23885,
SPELL_WARRIOR_BLOODTHIRST_DAMAGE = 23881,
SPELL_WARRIOR_CHARGE = 34846,
@@ -87,9 +87,9 @@ class spell_warr_mocking_blow : public SpellScriptLoader
void HandleOnHit()
{
if (Unit* target = GetHitUnit())
if (target->IsImmunedToSpellEffect(GetSpellInfo(), EFFECT_1))
SetHitDamage(0);
if (Unit* target = GetHitUnit())
if (target->IsImmunedToSpellEffect(GetSpellInfo(), EFFECT_1))
SetHitDamage(0);
}
void Register()
@@ -140,23 +140,23 @@ class spell_warr_improved_spell_reflection : public SpellScriptLoader
{
PrepareAuraScript(spell_warr_improved_spell_reflection_AuraScript);
bool CheckProc(ProcEventInfo& eventInfo)
bool CheckProc(ProcEventInfo& eventInfo)
{
return eventInfo.GetDamageInfo()->GetSpellInfo() && eventInfo.GetDamageInfo()->GetSpellInfo()->Id == SPELL_WARRIOR_SPELL_REFLECTION;
return eventInfo.GetDamageInfo()->GetSpellInfo() && eventInfo.GetDamageInfo()->GetSpellInfo()->Id == SPELL_WARRIOR_SPELL_REFLECTION;
}
void OnProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
CustomSpellValues values;
values.AddSpellMod(SPELLVALUE_MAX_TARGETS, aurEff->GetAmount());
values.AddSpellMod(SPELLVALUE_RADIUS_MOD, 2000); // Base range = 100, final range = 20 value / 10000.0f = 0.2f
eventInfo.GetActor()->CastCustomSpell(SPELL_WARRIOR_IMPROVED_SPELL_REFLECTION_TRIGGER, values, eventInfo.GetActor(), TRIGGERED_FULL_MASK, NULL);
CustomSpellValues values;
values.AddSpellMod(SPELLVALUE_MAX_TARGETS, aurEff->GetAmount());
values.AddSpellMod(SPELLVALUE_RADIUS_MOD, 2000); // Base range = 100, final range = 20 value / 10000.0f = 0.2f
eventInfo.GetActor()->CastCustomSpell(SPELL_WARRIOR_IMPROVED_SPELL_REFLECTION_TRIGGER, values, eventInfo.GetActor(), TRIGGERED_FULL_MASK, NULL);
}
void Register()
{
DoCheckProc += AuraCheckProcFn(spell_warr_improved_spell_reflection_AuraScript::CheckProc);
DoCheckProc += AuraCheckProcFn(spell_warr_improved_spell_reflection_AuraScript::CheckProc);
OnEffectProc += AuraEffectProcFn(spell_warr_improved_spell_reflection_AuraScript::OnProc, EFFECT_1, SPELL_AURA_DUMMY);
}
};
@@ -178,15 +178,15 @@ class spell_warr_improved_spell_reflection_trigger : public SpellScriptLoader
void FilterTargets(std::list<WorldObject*>& unitList)
{
GetCaster()->RemoveAurasDueToSpell(SPELL_WARRIOR_SPELL_REFLECTION);
unitList.sort(Trinity::ObjectDistanceOrderPred(GetCaster()));
while (unitList.size() > GetSpellValue()->MaxAffectedTargets)
unitList.pop_back();
GetCaster()->RemoveAurasDueToSpell(SPELL_WARRIOR_SPELL_REFLECTION);
unitList.sort(Trinity::ObjectDistanceOrderPred(GetCaster()));
while (unitList.size() > GetSpellValue()->MaxAffectedTargets)
unitList.pop_back();
}
void Register()
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_warr_improved_spell_reflection_trigger_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_CASTER_AREA_PARTY);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_warr_improved_spell_reflection_trigger_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_CASTER_AREA_PARTY);
}
};
@@ -202,7 +202,7 @@ class spell_warr_improved_spell_reflection_trigger : public SpellScriptLoader
void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes mode)
{
if (!IsExpired())
if (!IsExpired())
{
// aura remove - remove auras from all party members
std::list<Unit*> PartyMembers;
@@ -210,11 +210,11 @@ class spell_warr_improved_spell_reflection_trigger : public SpellScriptLoader
for (std::list<Unit*>::iterator itr = PartyMembers.begin(); itr != PartyMembers.end(); ++itr)
{
if ((*itr)->GetGUID() != GetOwner()->GetGUID())
if (Aura* aur = (*itr)->GetAura(59725, GetCasterGUID()))
{
aur->SetDuration(0);
aur->Remove();
}
if (Aura* aur = (*itr)->GetAura(59725, GetCasterGUID()))
{
aur->SetDuration(0);
aur->Remove();
}
}
}
}
@@ -292,11 +292,11 @@ class spell_warr_deep_wounds : public SpellScriptLoader
Unit* caster = GetCaster();
if (Unit* target = GetHitUnit())
{
// include target dependant auras
damage = target->MeleeDamageBonusTaken(caster, damage, BASE_ATTACK, GetSpellInfo());
// include target dependant auras
damage = target->MeleeDamageBonusTaken(caster, damage, BASE_ATTACK, GetSpellInfo());
// apply percent damage mods
ApplyPct(damage, 16.0f * GetSpellInfo()->GetRank() / 6.0f);
target->CastDelayedSpellWithPeriodicAmount(caster, SPELL_WARRIOR_DEEP_WOUNDS_RANK_PERIODIC, SPELL_AURA_PERIODIC_DAMAGE, damage, EFFECT_0);
target->CastDelayedSpellWithPeriodicAmount(caster, SPELL_WARRIOR_DEEP_WOUNDS_RANK_PERIODIC, SPELL_AURA_PERIODIC_DAMAGE, damage, EFFECT_0);
//caster->CastCustomSpell(target, SPELL_WARRIOR_DEEP_WOUNDS_RANK_PERIODIC, &damage, NULL, NULL, true);
}
@@ -755,7 +755,7 @@ class spell_warr_sweeping_strikes : public SpellScriptLoader
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
{
PreventDefaultAction();
int32 damage = eventInfo.GetDamageInfo()->GetDamage();
int32 damage = eventInfo.GetDamageInfo()->GetDamage();
GetTarget()->CastCustomSpell(_procTarget, SPELL_WARRIOR_SWEEPING_STRIKES_EXTRA_ATTACK, &damage, 0, 0, true, NULL, aurEff);
}
@@ -980,13 +980,13 @@ class spell_warr_retaliation : public SpellScriptLoader
void AddSC_warrior_spell_scripts()
{
// Ours
new spell_warr_mocking_blow();
new spell_warr_intervene();
new spell_warr_improved_spell_reflection();
new spell_warr_improved_spell_reflection_trigger();
// Ours
new spell_warr_mocking_blow();
new spell_warr_intervene();
new spell_warr_improved_spell_reflection();
new spell_warr_improved_spell_reflection_trigger();
// Theirs
// Theirs
new spell_warr_bloodthirst();
new spell_warr_bloodthirst_heal();
new spell_warr_charge();
@@ -994,12 +994,12 @@ void AddSC_warrior_spell_scripts()
new spell_warr_damage_shield();
new spell_warr_deep_wounds();
new spell_warr_execute();
new spell_warr_glyph_of_sunder_armor();
new spell_warr_glyph_of_sunder_armor();
new spell_warr_intimidating_shout();
new spell_warr_last_stand();
new spell_warr_overpower();
new spell_warr_rend();
new spell_warr_retaliation();
new spell_warr_retaliation();
new spell_warr_shattering_throw();
new spell_warr_slam();
new spell_warr_sweeping_strikes();