From 3f876e89cd7e9da88d386a18c93be21e8b0d1b6b Mon Sep 17 00:00:00 2001 From: DiSlord Date: Sun, 25 Jan 2009 17:35:53 +0300 Subject: [PATCH] Replace some variables Signed-off-by: DiSlord --- src/game/Unit.cpp | 85 ++++++++++++++++++++++++----------------------- 1 file changed, 43 insertions(+), 42 deletions(-) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 929fd2a29..d374dc06c 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -4372,7 +4372,8 @@ bool Unit::HandleHasteAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const * procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown) { SpellEntry const *dummySpell = triggeredByAura->GetSpellProto (); - uint32 effIndex = triggeredByAura->GetEffIndex (); + uint32 effIndex = triggeredByAura->GetEffIndex(); + int32 triggerAmount = triggeredByAura->GetModifier()->m_amount; Item* castItem = triggeredByAura->GetCastItemGUID() && GetTypeId()==TYPEID_PLAYER ? ((Player*)this)->GetItemByGuid(triggeredByAura->GetCastItemGUID()) : NULL; @@ -4396,7 +4397,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu return false; // return damage % to attacker but < 50% own total health - basepoints0 = triggeredByAura->GetModifier()->m_amount*int32(damage)/100; + basepoints0 = triggerAmount*int32(damage)/100; if(basepoints0 > GetMaxHealth()/2) basepoints0 = GetMaxHealth()/2; @@ -4718,7 +4719,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu case 48504: { triggered_spell_id = 48503; - basepoints0 = triggeredByAura->GetModifier()->m_amount; + basepoints0 = triggerAmount; target = this; break; } @@ -4736,7 +4737,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu case 31872: { // Roll chane - if (!roll_chance_i(triggeredByAura->GetModifier()->m_amount)) + if (!roll_chance_i(triggerAmount)) return false; // Remove any stun effect on target @@ -4767,7 +4768,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu return false; // mana reward - basepoints0 = (triggeredByAura->GetModifier()->m_amount * GetMaxPower(POWER_MANA) / 100); + basepoints0 = (triggerAmount * GetMaxPower(POWER_MANA) / 100); target = this; triggered_spell_id = 29442; break; @@ -4780,7 +4781,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu // mana cost save int32 cost = procSpell->manaCost + procSpell->ManaCostPercentage * GetCreateMana() / 100; - basepoints0 = cost * triggeredByAura->GetModifier()->m_amount/100; + basepoints0 = cost * triggerAmount/100; if( basepoints0 <=0 ) return false; @@ -4791,7 +4792,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu // Hot Streak if (dummySpell->SpellIconID == 2999) { - if (triggeredByAura->GetEffIndex()!=0) + if (effIndex!=0) return true; Aura *counter = GetAura(triggeredByAura->GetId(), 1); if (!counter) @@ -4805,7 +4806,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu if (mod->m_amount < 100) // not enough return true; // Crititcal counted -> roll chance - if (roll_chance_i(triggeredByAura->GetModifier()->m_amount)) + if (roll_chance_i(triggerAmount)) CastSpell(this, 48108, true, castItem, triggeredByAura); } mod->m_amount = 25; @@ -4818,7 +4819,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu return false; int32 cost = procSpell->manaCost + procSpell->ManaCostPercentage * GetCreateMana() / 100; - basepoints0 = cost * triggeredByAura->GetModifier()->m_amount/100; + basepoints0 = cost * triggerAmount/100; if( basepoints0 <=0 ) return false; triggered_spell_id = 44450; @@ -4914,7 +4915,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu if (dummySpell->SpellIconID == 3214) { triggered_spell_id = 59653; - basepoints0 = GetShieldBlockValue() * triggeredByAura->GetModifier()->m_amount / 100; + basepoints0 = GetShieldBlockValue() * triggerAmount / 100; break; } break; @@ -4971,7 +4972,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu if (!target) return false; triggered_spell_id = 54181; - basepoints0 = damage * triggeredByAura->GetModifier()->m_amount / 100; + basepoints0 = damage * triggerAmount / 100; break; } switch(dummySpell->Id) @@ -4990,7 +4991,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu case 30296: { // health - basepoints0 = int32(damage*triggeredByAura->GetModifier()->m_amount/100); + basepoints0 = int32(damage*triggerAmount/100); target = this; triggered_spell_id = 30294; break; @@ -5009,7 +5010,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu return false; // heal amount - basepoints0 = damage * triggeredByAura->GetModifier()->m_amount/100; + basepoints0 = damage * triggerAmount/100; triggered_spell_id = 37382; break; } @@ -5035,14 +5036,14 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu return false; // energize amount - basepoints0 = triggeredByAura->GetModifier()->m_amount*damage/100; + basepoints0 = triggerAmount*damage/100; pVictim->CastCustomSpell(pVictim,34919,&basepoints0,NULL,NULL,true,castItem,triggeredByAura); return true; // no hidden cooldown } // Divine Aegis if (dummySpell->SpellIconID == 2820) { - basepoints0 = damage * triggeredByAura->GetModifier()->m_amount/100; + basepoints0 = damage * triggerAmount/100; triggered_spell_id = 47753; break; } @@ -5059,7 +5060,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu return false; // heal amount - basepoints0 = triggeredByAura->GetModifier()->m_amount*damage/100; + basepoints0 = triggerAmount*damage/100; pVictim->CastCustomSpell(pVictim,15290,&basepoints0,NULL,NULL,true,castItem,triggeredByAura); return true; // no hidden cooldown } @@ -5094,7 +5095,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu return false; // heal amount - basepoints0 = damage * triggeredByAura->GetModifier()->m_amount/100; + basepoints0 = damage * triggerAmount/100; target = this; triggered_spell_id = 39373; break; @@ -5182,7 +5183,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu if (!procSpell) return false; // Only 0 aura can proc - if (triggeredByAura->GetEffIndex()!=0) + if (effIndex!=0) return true; // Wrath crit if (procSpell->SpellFamilyFlags & 0x0000000000000001LL) @@ -5206,7 +5207,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu else if (dummySpell->SpellIconID == 2860) { triggered_spell_id = 48504; - basepoints0 = triggeredByAura->GetModifier()->m_amount * damage / 100; + basepoints0 = triggerAmount * damage / 100; break; } break; @@ -5258,7 +5259,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu return false; // energy cost save - basepoints0 = procSpell->manaCost * triggeredByAura->GetModifier()->m_amount/100; + basepoints0 = procSpell->manaCost * triggerAmount/100; if(basepoints0 <= 0) return false; @@ -5319,7 +5320,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu case SPELLFAMILY_PALADIN: { // Seal of Righteousness - melee proc dummy (addition ${$MWS*(0.022*$AP+0.044*$SPH)} damage) - if (dummySpell->SpellFamilyFlags&0x000000008000000LL && triggeredByAura->GetEffIndex()==0) + if (dummySpell->SpellFamilyFlags&0x000000008000000LL && effIndex==0) { triggered_spell_id = 25742; float ap = GetTotalAttackPowerValue(BASE_ATTACK); @@ -5339,7 +5340,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu if (dummySpell->SpellIconID == 3025) { // 4 damage tick - basepoints0 = triggeredByAura->GetModifier()->m_amount*damage/400; + basepoints0 = triggerAmount*damage/400; triggered_spell_id = 61840; break; } @@ -5347,7 +5348,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu if (dummySpell->SpellIconID == 3030) { // 4 healing tick - basepoints0 = triggeredByAura->GetModifier()->m_amount*damage/400; + basepoints0 = triggerAmount*damage/400; triggered_spell_id = 54203; break; } @@ -5423,7 +5424,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu return false; // heal amount - basepoints0 = triggeredByAura->GetModifier()->m_amount*damage/100; + basepoints0 = triggerAmount*damage/100; target = this; triggered_spell_id = 31786; break; @@ -5431,13 +5432,13 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu // Seal of Blood do damage trigger case 31892: { - if (triggeredByAura->GetEffIndex() == 0) // 0 effect - is proc on enemy + if (effIndex == 0) // 0 effect - is proc on enemy triggered_spell_id = 31893; - else if (triggeredByAura->GetEffIndex() == 1) // 1 effect - is proc on self + else if (effIndex == 1) // 1 effect - is proc on self { // add spell damage from prev effect (27%) damage += CalculateDamage(BASE_ATTACK, false) * 27 / 100; - basepoints0 = triggeredByAura->GetModifier()->m_amount * damage / 100; + basepoints0 = triggerAmount * damage / 100; target = this; triggered_spell_id = 32221; } @@ -5448,13 +5449,13 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu // Seal of the Martyr do damage trigger case 53720: { - if (triggeredByAura->GetEffIndex() == 0) // 0 effect - is proc on enemy + if (effIndex == 0) // 0 effect - is proc on enemy triggered_spell_id = 53719; - else if (triggeredByAura->GetEffIndex() == 1) // 1 effect - is proc on self + else if (effIndex == 1) // 1 effect - is proc on self { // add spell damage from prev effect (27%) damage += CalculateDamage(BASE_ATTACK, false) * 27 / 100; - basepoints0 = triggeredByAura->GetModifier()->m_amount * damage / 100; + basepoints0 = triggerAmount * damage / 100; target = this; triggered_spell_id = 53718; } @@ -5507,14 +5508,14 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu case 54936: { triggered_spell_id = 54957; - basepoints0 = triggeredByAura->GetModifier()->m_amount*damage/100; + basepoints0 = triggerAmount*damage/100; break; } // Glyph of Holy Light case 54937: { triggered_spell_id = 54968; - basepoints0 = triggeredByAura->GetModifier()->m_amount*damage/100; + basepoints0 = triggerAmount*damage/100; break; } } @@ -5667,7 +5668,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu // Not proc from self heals if (this==pVictim) return false; - basepoints0 = triggeredByAura->GetModifier()->m_amount * damage / 100; + basepoints0 = triggerAmount * damage / 100; target = this; triggered_spell_id = 55533; break; @@ -5679,7 +5680,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu target = GetOwner(); if(!target) return false; - basepoints0 = triggeredByAura->GetModifier()->m_amount * damage / 100; + basepoints0 = triggerAmount * damage / 100; triggered_spell_id = 58879; break; } @@ -5689,14 +5690,14 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu { // TODO: frite dummy fot triggered spell triggered_spell_id = 52759; - basepoints0 = triggeredByAura->GetModifier()->m_amount * damage / 100; + basepoints0 = triggerAmount * damage / 100; target = this; break; } // Earth Shield if(dummySpell->SpellFamilyFlags & 0x0000040000000000LL) { - basepoints0 = triggeredByAura->GetModifier()->m_amount; + basepoints0 = triggerAmount; target = this; triggered_spell_id = 379; break; @@ -5830,14 +5831,14 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu { if (GetTypeId() != TYPEID_PLAYER || !((Player*)this)->isHonorOrXPTarget(pVictim)) return false; - basepoints0 = triggeredByAura->GetModifier()->m_amount * damage / 100; + basepoints0 = triggerAmount * damage / 100; triggered_spell_id = 53168; break; } // Butchery if (dummySpell->SpellIconID == 2664) { - basepoints0 = triggeredByAura->GetModifier()->m_amount; + basepoints0 = triggerAmount; triggered_spell_id = 50163; target = this; break; @@ -5846,7 +5847,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu if (dummySpell->Id == 49028) { // 1 dummy aura for dismiss rune blade - if (triggeredByAura->GetEffIndex()!=2) + if (effIndex!=2) return false; // TODO: wite script for this "fights on its own, doing the same attacks" // NOTE: Trigger here on every attack and spell cast @@ -5862,7 +5863,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu // Vendetta if (dummySpell->SpellFamilyFlags & 0x0000000000010000LL) { - basepoints0 = triggeredByAura->GetModifier()->m_amount * GetMaxHealth() / 100; + basepoints0 = triggerAmount * GetMaxHealth() / 100; triggered_spell_id = 50181; target = this; break; @@ -5870,7 +5871,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu // Necrosis if (dummySpell->SpellIconID == 2709) { - basepoints0 = triggeredByAura->GetModifier()->m_amount * damage / 100; + basepoints0 = triggerAmount * damage / 100; triggered_spell_id = 51460; break; } @@ -5892,7 +5893,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu { if (!roll_chance_f(GetUnitCriticalChance(BASE_ATTACK, pVictim))) return false; - basepoints0 = triggeredByAura->GetModifier()->m_amount * damage / 100; + basepoints0 = triggerAmount * damage / 100; triggered_spell_id = 50526; break; }