aboutsummaryrefslogtreecommitdiff
path: root/src/game/Unit.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2009-01-25 16:35:14 -0600
committermegamage <none@none>2009-01-25 16:35:14 -0600
commitef88b0445169b09528df6d0d1f2066fed5da79de (patch)
tree6f09f7523d960775d8ea0dc2d2a866a75a5e04da /src/game/Unit.cpp
parent30f6b38941e907c20dbb68f514eaf1345082abd3 (diff)
*Update to Mangos 7183.
--HG-- branch : trunk
Diffstat (limited to 'src/game/Unit.cpp')
-rw-r--r--src/game/Unit.cpp112
1 files changed, 63 insertions, 49 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index b90bd733a6d..e635efa0457 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -4567,7 +4567,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;
@@ -4591,7 +4592,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;
@@ -4913,7 +4914,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;
}
@@ -4931,7 +4932,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
@@ -4962,7 +4963,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;
@@ -4975,7 +4976,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;
@@ -4986,7 +4987,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)
@@ -5000,7 +5001,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;
@@ -5013,7 +5014,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;
@@ -5109,7 +5110,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;
@@ -5168,7 +5169,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)
@@ -5187,7 +5188,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;
@@ -5206,7 +5207,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;
}
@@ -5232,14 +5233,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;
}
@@ -5256,8 +5257,9 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
return false;
// heal amount
- basepoints0 = triggeredByAura->GetModifier()->m_amount*damage/100;
- pVictim->CastCustomSpell(pVictim,15290,&basepoints0,NULL,NULL,true,castItem,triggeredByAura);
+ int32 team = triggerAmount*damage/500;
+ int32 self = triggerAmount*damage/100 - team;
+ pVictim->CastCustomSpell(pVictim,15290,&team,&self,NULL,true,castItem,triggeredByAura);
return true; // no hidden cooldown
}
// Priest Tier 6 Trinket (Ashtongue Talisman of Acumen)
@@ -5291,7 +5293,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;
@@ -5379,7 +5381,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)
@@ -5403,7 +5405,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;
@@ -5455,7 +5457,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;
@@ -5474,7 +5476,8 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
return false;
// mana cost save
- basepoints0 = procSpell->manaCost * 40/100;
+ int32 mana = procSpell->manaCost + procSpell->ManaCostPercentage * GetCreateMana() / 100;
+ basepoints0 = mana * 40/100;
if(basepoints0 <= 0)
return false;
@@ -5493,9 +5496,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
if ( dummySpell->SpellIconID == 3579 )
{
// Proc only from periodic (from trap activation proc another aura of this spell)
- if (!(procFlag & PROC_FLAG_ON_DO_PERIODIC))
- return false;
- if (!roll_chance_i(triggeredByAura->GetModifier()->m_amount))
+ if (!(procFlag & PROC_FLAG_ON_DO_PERIODIC) || !roll_chance_i(triggerAmount))
return false;
triggered_spell_id = 56453;
target = this;
@@ -5516,7 +5517,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);
@@ -5536,7 +5537,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;
}
@@ -5544,7 +5545,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;
}
@@ -5620,7 +5621,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;
@@ -5628,13 +5629,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;
}
@@ -5645,13 +5646,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;
}
@@ -5704,14 +5705,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;
}
}
@@ -5864,7 +5865,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;
@@ -5876,7 +5877,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;
}
@@ -5886,14 +5887,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;
@@ -6027,14 +6028,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;
@@ -6043,7 +6044,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
@@ -6059,7 +6060,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;
@@ -6067,7 +6068,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;
}
@@ -6089,7 +6090,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;
}
@@ -6747,11 +6748,16 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB
// Need add combopoint AFTER finish movie (or they dropped in finish phase)
break;
}
+ // Bloodthirst (($m/100)% of max health)
+ case 23880:
+ {
+ basepoints0 = int32(GetMaxHealth() * triggerAmount / 10000);
+ break;
+ }
// Shamanistic Rage triggered spell
case 30824:
{
basepoints0 = int32(GetTotalAttackPowerValue(BASE_ATTACK) * triggerAmount / 100);
- trigger_spell_id = 30824;
break;
}
// Enlightenment (trigger only from mana cost spells)
@@ -6806,6 +6812,14 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB
return false;
break;
}
+ // Lock and Load
+ case 56453:
+ {
+ // Proc only from trap activation (from periodic proc another aura of this spell)
+ if (!(procFlags & PROC_FLAG_ON_TRAP_ACTIVATION) || !roll_chance_i(triggerAmount))
+ return false;
+ break;
+ }
}
if( cooldown && GetTypeId()==TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(trigger_spell_id))
@@ -10554,7 +10568,7 @@ bool InitTriggerAuraData()
isTriggerAura[SPELL_AURA_MOD_DAMAGE_FROM_CASTER] = true;
isNonTriggerAura[SPELL_AURA_MOD_POWER_REGEN]=true;
- isNonTriggerAura[SPELL_AURA_RESIST_PUSHBACK]=true;
+ isNonTriggerAura[SPELL_AURA_REDUCE_PUSHBACK]=true;
return true;
}