Core/Spells: Arreglada Actitud defensiva del Guerrero

This commit is contained in:
Sistemas
2026-05-29 22:47:37 +02:00
committed by GitHub
parent d5682d7ee7
commit 8bec37e96e
+60 -15
View File
@@ -178,6 +178,8 @@ enum WarriorSpells
SPELL_WARRIOR_FEARLESS = 1271925,
SPELL_WARRIOR_WRECKING_THROW = 384110,
SPELL_WARRIOR_WRECKING_THROW_DAMAGE = 394354,
SPELL_WARRIOR_DEFENSIVE_STANCE = 386208,
SPELL_WARRIOR_DEFENSIVE_STANCE_SPIKE_TALENT = 1280961,
};
enum WarriorMisc
@@ -2783,29 +2785,72 @@ class spell_warr_rend : public AuraScript
}
};
// Defensive Stance - 71
// Defensive Stance - 386208
class spell_warr_defensive_stance : public AuraScript
{
bool Validate(SpellInfo const* /*spellInfo*/) override
{
int32 damageTaken = 0;
return ValidateSpellInfo({ SPELL_WARRIOR_DEFENSIVE_STANCE, SPELL_WARRIOR_DEFENSIVE_STANCE_SPIKE_TALENT });
}
void HandleProc(ProcEventInfo& eventInfo)
void HandleAbsorb(AuraEffect* aurEff, DamageInfo& /*dmgInfo*/, uint32& /*absorbAmount*/)
{
aurEff->SetAmount(-1);
}
bool CheckProc(ProcEventInfo& eventInfo)
{
return eventInfo.GetDamageInfo() != nullptr && eventInfo.GetDamageInfo()->GetDamage() > 0;
}
void PrepareProc(ProcEventInfo& /*eventInfo*/)
{
PreventDefaultAction();
}
void HandleProc(ProcEventInfo& eventInfo)
{
Unit* caster = GetCaster();
if (!caster)
return;
DamageInfo* damageInfo = eventInfo.GetDamageInfo();
uint32 damageTaken = damageInfo->GetDamage();
if (caster->HasAura(SPELL_WARRIOR_DEFENSIVE_STANCE_SPIKE_TALENT))
{
Unit* caster = GetCaster();
if (!caster)
return;
damageTaken = eventInfo.GetDamageInfo() ? eventInfo.GetDamageInfo()->GetDamage() : 0;
if (damageTaken <= 0)
return;
int32 rageAmount = (50.0f * (float)damageTaken) / (float)caster->GetMaxHealth();
caster->ModifyPower(POWER_RAGE, 10 * uint32(rageAmount));
AuraEffect const* thresholdEff = GetEffect(EFFECT_4);
AuraEffect const* reductionEff = GetEffect(EFFECT_5);
if (thresholdEff && reductionEff)
{
float thresholdPct = float(thresholdEff->GetAmount());
float reductionPct = float(reductionEff->GetAmount());
uint32 maxHealth = caster->GetMaxHealth();
if (maxHealth > 0 && float(damageTaken) >= CalculatePct(float(maxHealth), thresholdPct))
{
uint32 absorbAmount = uint32(CalculatePct(float(damageTaken), reductionPct));
if (absorbAmount > 0)
damageInfo->AbsorbDamage(absorbAmount);
}
}
}
void Register() override
damageTaken = damageInfo->GetDamage();
if (damageTaken > 0)
{
OnProc += AuraProcFn(spell_warr_defensive_stance::HandleProc);
int32 rageAmount = int32((50.0f * float(damageTaken)) / float(caster->GetMaxHealth()));
if (rageAmount > 0)
caster->ModifyPower(POWER_RAGE, 10 * rageAmount);
}
}
void Register() override
{
AfterEffectAbsorb += AuraEffectAbsorbFn(spell_warr_defensive_stance::HandleAbsorb, EFFECT_FIRST_FOUND);
DoCheckProc += AuraCheckProcFn(spell_warr_defensive_stance::CheckProc);
DoPrepareProc += AuraProcFn(spell_warr_defensive_stance::PrepareProc);
OnProc += AuraProcFn(spell_warr_defensive_stance::HandleProc);
}
};
//Second wind - 29838 SPELL_WARRIOR_SECOND_WIND__HEALTH