Core/Spells: fixed The Quick and the Dead guild perk

This commit is contained in:
Ovahlord committed 2020-04-23 17:04:32 +02:00
1 parent 5905ed2606
commit bc68ecdbcc
4 files changed
+60 -1

No files matched your search

@@ -0,0 +1,4 @@
DELETE FROM `spell_script_names` WHERE `ScriptName`= 'spell_gen_ghost';
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
(8326, 'spell_gen_ghost');
@@ -404,7 +404,7 @@ pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS]=
&AuraEffect::HandleNoImmediateEffect, //337 SPELL_AURA_MOD_VENDOR_ITEMS_PRICES
&AuraEffect::HandleNoImmediateEffect, //338 SPELL_AURA_MOD_DURABILITY_LOSS
&AuraEffect::HandleNULL, //339 SPELL_AURA_INCREASE_SKILL_GAIN_CHANCE
&AuraEffect::HandleNULL, //340 SPELL_AURA_MOD_RESURRECTED_HEALTH_BY_GUILD_MEMBER
&AuraEffect::HandleNoImmediateEffect, //340 SPELL_AURA_MOD_RESURRECTED_HEALTH_BY_GUILD_MEMBER implemented in Spell::EffectResurrect, Spell::EffectResurrectNew and Spell::EffectResurrectWithAura
&AuraEffect::HandleModSpellCategoryCooldown, //341 SPELL_AURA_MOD_SPELL_CATEGORY_COOLDOWN
&AuraEffect::HandleModMeleeRangedSpeedPct, //342 SPELL_AURA_MOD_MELEE_RANGED_HASTE_2
&AuraEffect::HandleNoImmediateEffect, //343 SPELL_AURA_MOD_MELEE_DAMAGE_FROM_CASTER implemented in Unit::MeleeDamageBonusTaken
+13
View File
@@ -287,6 +287,11 @@ void Spell::EffectResurrectNew(SpellEffIndex effIndex)
uint32 health = damage;
uint32 mana = m_spellInfo->Effects[effIndex].MiscValue;
// SPELL_AURA_MOD_RESURRECTED_HEALTH_BY_GUILD_MEMBER bonus
if (m_caster->IsPlayer() && m_caster->ToPlayer()->GetGuildId() == player->GetGuildId() && !m_caster->IsInCombat())
AddPct(health, m_caster->GetTotalAuraModifier(SPELL_AURA_MOD_RESURRECTED_HEALTH_BY_GUILD_MEMBER));
ExecuteLogEffectResurrect(effIndex, player);
player->SetResurrectRequestData(m_caster, health, mana, 0);
SendResurrectRequest(player);
@@ -4068,6 +4073,10 @@ void Spell::EffectResurrect(SpellEffIndex effIndex)
uint32 health = player->CountPctFromMaxHealth(damage);
uint32 mana = CalculatePct(player->GetMaxPower(POWER_MANA), damage);
// SPELL_AURA_MOD_RESURRECTED_HEALTH_BY_GUILD_MEMBER bonus
if (m_caster->IsPlayer() && m_caster->ToPlayer()->GetGuildId() == player->GetGuildId() && !m_caster->IsInCombat())
AddPct(health, m_caster->GetTotalAuraModifier(SPELL_AURA_MOD_RESURRECTED_HEALTH_BY_GUILD_MEMBER));
ExecuteLogEffectResurrect(effIndex, player);
player->SetResurrectRequestData(m_caster, health, mana, 0);
@@ -5547,6 +5556,10 @@ void Spell::EffectResurrectWithAura(SpellEffIndex effIndex)
if (resurrectAura && player->HasAura(resurrectAura))
return;
// SPELL_AURA_MOD_RESURRECTED_HEALTH_BY_GUILD_MEMBER bonus
if (m_caster->IsPlayer() && m_caster->ToPlayer()->GetGuildId() == player->GetGuildId() && !m_caster->IsInCombat())
AddPct(health, m_caster->GetTotalAuraModifier(SPELL_AURA_MOD_RESURRECTED_HEALTH_BY_GUILD_MEMBER));
ExecuteLogEffectResurrect(effIndex, player);
player->SetResurrectRequestData(m_caster, health, mana, resurrectAura);
SendResurrectRequest(player);
@@ -5445,6 +5445,47 @@ class spell_gen_flask_of_battle : public SpellScript
}
};
enum TheQuickAndTheDead
{
SPELL_THE_QUICK_AND_THE_DEAD_PERK = 83950,
SPELL_THE_QUICK_AND_THE_DEAD_BUFF = 84559
};
// 8326 - Ghost
class spell_gen_ghost : public AuraScript
{
PrepareAuraScript(spell_gen_ghost);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo(
{
SPELL_THE_QUICK_AND_THE_DEAD_PERK,
SPELL_THE_QUICK_AND_THE_DEAD_BUFF
});
}
void AfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
if (target->HasAura(SPELL_THE_QUICK_AND_THE_DEAD_PERK))
target->CastSpell(target, SPELL_THE_QUICK_AND_THE_DEAD_BUFF);
}
void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
if (target->HasAura(SPELL_THE_QUICK_AND_THE_DEAD_BUFF))
target->RemoveAurasDueToSpell(SPELL_THE_QUICK_AND_THE_DEAD_BUFF);
}
void Register() override
{
AfterEffectApply += AuraEffectRemoveFn(spell_gen_ghost::AfterApply, EFFECT_0, SPELL_AURA_GHOST, AURA_EFFECT_HANDLE_REAL);
AfterEffectRemove += AuraEffectRemoveFn(spell_gen_ghost::AfterRemove, EFFECT_0, SPELL_AURA_GHOST, AURA_EFFECT_HANDLE_REAL);
}
};
void AddSC_generic_spell_scripts()
{
new spell_gen_absorb0_hitlimit1();
@@ -5573,4 +5614,5 @@ void AddSC_generic_spell_scripts()
RegisterSpellScript(spell_gen_mobile_banking);
RegisterSpellScript(spell_gen_cauldron_of_battle);
RegisterSpellScript(spell_gen_flask_of_battle);
RegisterAuraScript(spell_gen_ghost);
}