This is my try at implementing Sudden Death. Implemented for [7681].
I'm not sure it is "unhacky" enough. I couldn't really find any useful way to move code into an aura 262 implementation.
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index d8f6259..03c3bbd 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -3694,8 +3694,12 @@ SpellCastResult Spell::CheckCast(bool strict)
if(target != m_caster)
{
+ // Execute: check override of target aura states by caster aura 262 (52437: Sudden Death)
+ uint32 TargetAuraState = m_spellInfo->TargetAuraState;
+ if (m_spellInfo->SpellIconID == 1648 && m_caster->HasAura(52437))
+ TargetAuraState = 0;
// target state requirements (apply to non-self only), to allow cast affects to self like Dirty Deeds
- if(m_spellInfo->TargetAuraState && !target->HasAuraState(AuraState(m_spellInfo->TargetAuraState)))
+ if(TargetAuraState && !target->HasAuraState(AuraState(m_spellInfo->TargetAuraState)))
return SPELL_FAILED_TARGET_AURASTATE;
// Not allow casting on flying player
@@ -4005,12 +4009,13 @@ SpellCastResult Spell::CheckCast(bool strict)
{
case SPELL_EFFECT_DUMMY:
{
- if(m_spellInfo->SpellIconID == 1648) // Execute
+ /* if(m_spellInfo->SpellIconID == 1648) // Execute
{
if(!m_targets.getUnitTarget() || m_targets.getUnitTarget()->GetHealth() > m_targets.getUnitTarget()->GetMaxHealth()*0.2)
return SPELL_FAILED_BAD_TARGETS;
}
- else if (m_spellInfo->Id == 51582) // Rocket Boots Engaged
+ else */
+ if (m_spellInfo->Id == 51582) // Rocket Boots Engaged
{
if(m_caster->IsInWater())
return SPELL_FAILED_ONLY_ABOVEWATER;
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index 13d1f03..c602259 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -1216,7 +1216,23 @@ void Spell::EffectDummy(uint32 i)
if(!unitTarget)
return;
- uint32 rage = m_caster->GetPower(POWER_RAGE);
+ int32 rageLasting = 0;
+ int32 rage = m_caster->GetPower(POWER_RAGE);
+ int32 currentRage = rage;
+
+ // effect of Sudden Death ranks, independant of proc
+ if (m_caster->HasAura(29723)) rageLasting = 30;
+ else if (m_caster->HasAura(29725)) rageLasting = 70;
+ else if (m_caster->HasAura(29724)) rageLasting = 100;
+ // Sudden Death proc aura
+ bool hasAuraSD = m_caster->HasAura(52437);
+ if (hasAuraSD)
+ {
+ // max of 30 rage consumed, even if target is below 20% health (to the dismay of PvP players)
+ // spell rage cost already substracted (?)
+ rage = std::min(300 - m_powerCost, rage);
+ rageLasting = std::max(rageLasting, currentRage - rage);
+ }
// Glyph of Execution bonus
if (Aura *aura = m_caster->GetDummyAura(58367))
rage+=aura->GetModifier()->m_amount;
@@ -1224,7 +1240,8 @@ void Spell::EffectDummy(uint32 i)
int32 basePoints0 = damage+int32(rage * m_spellInfo->DmgMultiplier[i] +
m_caster->GetTotalAttackPowerValue(BASE_ATTACK)*0.2f);
m_caster->CastCustomSpell(unitTarget, 20647, &basePoints0, NULL, NULL, true, 0);
- m_caster->SetPower(POWER_RAGE,0);
+ m_caster->SetPower(POWER_RAGE,rageLasting);
+ if (hasAuraSD) m_caster->RemoveAurasDueToSpell(52437);
return;
}
// Slam
Notes:
In Spell::CheckCast() i commented the original check for Execute out because i think it is redundant.
All Execute spells require AuraState to be AURA_STATE_HEALTHLESS_20_PERCENT and in my tests (PvE only) it does abort the casting if the target has above 20% health, so why manually calculate percentage again?
Instead, you need to override the targets AuraState requirement when Sudden Death buff is active.
I'm not sure if a may use m_powerCost in Spell::EffectDummy() but it is needed to calculate the proper damage due to the 30 rage consume limitation.
I tried to research as good as i can, but it would be nice of someone could confirm these assumptions:
* The minimum rage remaining after execute is independent of the Sudden Death proc aura, it is a passive bonus to Execute. * If you would have less rage left than Sudden Death [rank] guarantees, you regain it, i.e. it does not affect damage dealt. * Sudden Death limitation of 30 rage consumed in total always applies when proc buff active, even if target is below 20% health which would allow normal Execute. Judging from the exensive whining about this i'm somewhat sure it is like this. * Sudden Death buff is consumed when Execute is used. The tooltip is not clear about this, but in youtube videos the buff never seemed to last the full 10s (hard to tell because of crappy quality) and i read at official forum it is consumed, but that poster was not sure either.