aboutsummaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorQAston <none@none>2009-06-24 15:58:44 +0200
committerQAston <none@none>2009-06-24 15:58:44 +0200
commit33b2917bb7cbf4512c5bd58d99ceb795ef7a1a10 (patch)
treedf055da250120e767ab7512eaa2e2e9f55738cd8 /src/game
parent329b020af442240131f9d08d577f694e50bc9064 (diff)
*Fix Ferocious Bite energy to dmg conversion
*Remove duplicated AP coefficients for Hammer of Wrath and Avengers Shield *Correctly do effectaddcombopoints for spells which take them. *Do not proc spelleffects on player login. --HG-- branch : trunk
Diffstat (limited to 'src/game')
-rw-r--r--src/game/Player.cpp23
-rw-r--r--src/game/Player.h3
-rw-r--r--src/game/Spell.cpp21
-rw-r--r--src/game/Spell.h1
-rw-r--r--src/game/SpellAuras.cpp5
-rw-r--r--src/game/SpellEffects.cpp24
-rw-r--r--src/game/Unit.cpp3
7 files changed, 46 insertions, 34 deletions
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 4adac94c946..f5b17016512 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -18624,17 +18624,19 @@ void Player::SendComboPoints()
}
}
-void Player::AddComboPoints(Unit* target, int8 count)
+void Player::AddComboPoints(Unit* target, int8 count, Spell * spell)
{
if(!count)
return;
+ int8 * comboPoints = spell ? &spell->m_comboPointGain : &m_comboPoints;
+
// without combo points lost (duration checked in aura)
RemoveAurasByType(SPELL_AURA_RETAIN_COMBO_POINTS);
if(target->GetGUID() == m_comboTarget)
{
- m_comboPoints += count;
+ *comboPoints += count;
}
else
{
@@ -18643,13 +18645,26 @@ void Player::AddComboPoints(Unit* target, int8 count)
target2->RemoveComboPointHolder(GetGUIDLow());
m_comboTarget = target->GetGUID();
- m_comboPoints = count;
+ *comboPoints = count;
target->AddComboPointHolder(GetGUIDLow());
}
+ if (*comboPoints > 5) *comboPoints = 5;
+ else if (*comboPoints < 0) *comboPoints = 0;
+
+ if (!spell)
+ SendComboPoints();
+}
+
+void Player::GainSpellComboPoints(int8 count)
+{
+ if(!count)
+ return;
+
+ m_comboPoints += count;
if (m_comboPoints > 5) m_comboPoints = 5;
- if (m_comboPoints < 0) m_comboPoints = 0;
+ else if (m_comboPoints < 0) m_comboPoints = 0;
SendComboPoints();
}
diff --git a/src/game/Player.h b/src/game/Player.h
index c3328d0ebd7..9db0f28a9d0 100644
--- a/src/game/Player.h
+++ b/src/game/Player.h
@@ -1292,7 +1292,8 @@ class TRINITY_DLL_SPEC Player : public Unit
uint8 GetComboPoints() { return m_comboPoints; }
const uint64& GetComboTarget() const { return m_comboTarget; }
- void AddComboPoints(Unit* target, int8 count);
+ void AddComboPoints(Unit* target, int8 count, Spell * spell = NULL);
+ void GainSpellComboPoints(int8 count);
void ClearComboPoints();
void SendComboPoints();
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index fbd13bb6ea0..88a7d8508c3 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -363,6 +363,7 @@ Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 origi
m_referencedFromCurrentSpell = false;
m_executedCurrently = false;
m_needComboPoints = NeedsComboPoints(m_spellInfo);
+ m_comboPointGain = 0;
m_delayStart = 0;
m_delayAtDamageCount = 0;
@@ -2730,7 +2731,13 @@ void Spell::cast(bool skipCheck)
((Player*)m_caster)->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL, m_spellInfo->Id);
}
- // this is related to combo points so must be done before takepower
+ if(!m_IsTriggeredSpell)
+ {
+ // Powers have to be taken before SendSpellGo
+ TakePower();
+ TakeReagents(); // we must remove reagents before HandleEffects to allow place crafted item in same slot
+ }
+
// are there any spells need to be triggered after hit?
// handle SPELL_AURA_ADD_TARGET_TRIGGER auras
Unit::AuraEffectList const& targetTriggers = m_caster->GetAurasByType(SPELL_AURA_ADD_TARGET_TRIGGER);
@@ -2748,17 +2755,9 @@ void Spell::cast(bool skipCheck)
}
}
- // this is related to combo points so must be done before takepower
if(m_customAttr & SPELL_ATTR_CU_DIRECT_DAMAGE)
CalculateDamageDoneForAllTargets();
- if(!m_IsTriggeredSpell)
- {
- // Powers have to be taken before SendSpellGo
- TakePower();
- TakeReagents(); // we must remove reagents before HandleEffects to allow place crafted item in same slot
- }
-
// CAST SPELL
SendSpellCooldown();
//SendCastResult(castResult);
@@ -2972,6 +2971,10 @@ void Spell::_handle_finish_phase()
if (m_needComboPoints)
((Player*)m_caster)->ClearComboPoints();
+ // Real add combo points from effects
+ if (m_caster->GetTypeId()==TYPEID_PLAYER)
+ ((Player*)m_caster)->GainSpellComboPoints(m_comboPointGain);
+
// spell log
if(m_needSpellLog)
SendLogExecute();
diff --git a/src/game/Spell.h b/src/game/Spell.h
index adb884d8688..59f21fd6bae 100644
--- a/src/game/Spell.h
+++ b/src/game/Spell.h
@@ -438,6 +438,7 @@ class Spell
uint32 m_glyphIndex;
uint32 m_preCastSpell;
SpellCastTargets m_targets;
+ int8 m_comboPointGain;
UsedSpellMods m_appliedMods;
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index f77f3d01acc..4bbd1f06faa 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -2497,8 +2497,9 @@ void AuraEffect::HandleAuraDummy(bool apply, bool Real, bool changeAmount)
((Player*)m_target)->RemoveAmmo(); // not use ammo and not allow use
return;
case 52916: // Honor Among Thieves
- if (Unit * target = ObjectAccessor::GetUnit(*m_target, m_target->GetUInt64Value(UNIT_FIELD_TARGET)))
- m_target->CastSpell(target, 51699, true);
+ if(m_target->GetTypeId()==TYPEID_PLAYER)
+ if (Unit * target = ObjectAccessor::GetUnit(*m_target,((Player*)m_target)->GetComboTarget()))
+ m_target->CastSpell(target, 51699, true);
return;
}
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index cdc82d09587..ca7bb75dff6 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -517,9 +517,9 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
// converts each extra point of energy into ($f1+$AP/410) additional damage
float ap = m_caster->GetTotalAttackPowerValue(BASE_ATTACK);
float multiple = ap / 410 + m_spellInfo->DmgMultiplier[effect_idx];
- damage += int32(m_caster->GetPower(POWER_ENERGY) * multiple);
+ int32 energy = -(m_caster->ModifyPower(POWER_ENERGY, -30));
+ damage += int32(energy * multiple);
damage += int32(((Player*)m_caster)->GetComboPoints() * ap * 7 / 100);
- m_caster->SetPower(POWER_ENERGY,0);
}
// Rake
else if(m_spellInfo->SpellFamilyFlags[0] & 0x1000)
@@ -660,20 +660,8 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
}
case SPELLFAMILY_PALADIN:
{
- // Avenger's Shield ($m1+0.07*$SPH+0.07*$AP)
- if(m_spellInfo->SpellFamilyFlags[0] & 0x4000)
- {
- float ap = m_caster->GetTotalAttackPowerValue(BASE_ATTACK);
- damage += int32(ap * 0.07f);
- }
- // Hammer of Wrath ($m1+0.15*$SPH+0.15*$AP)
- else if(m_spellInfo->SpellFamilyFlags[1] & 0x00000080)
- {
- float ap = m_caster->GetTotalAttackPowerValue(BASE_ATTACK);
- damage += int32(ap * 0.15f);
- }
// Hammer of the Righteous
- else if(m_spellInfo->SpellFamilyFlags[1]&0x00040000)
+ if(m_spellInfo->SpellFamilyFlags[1]&0x00040000)
{
// Add main hand dps * effect[2] amount
float average = (m_caster->GetFloatValue(UNIT_FIELD_MINDAMAGE) + m_caster->GetFloatValue(UNIT_FIELD_MAXDAMAGE)) / 2;
@@ -4310,7 +4298,7 @@ void Spell::SpellDamageWeaponDmg(uint32 i)
if(m_spellInfo->SpellFamilyFlags[0] & 0x2000000)
{
if(m_caster->GetTypeId()==TYPEID_PLAYER)
- ((Player*)m_caster)->AddComboPoints(unitTarget, 1);
+ ((Player*)m_caster)->AddComboPoints(unitTarget, 1, this);
}
// Fan of Knives
else if(m_spellInfo->SpellFamilyFlags[1] & 0x40000)
@@ -4388,7 +4376,7 @@ void Spell::SpellDamageWeaponDmg(uint32 i)
if(m_spellInfo->SpellFamilyFlags.IsEqual(0,0x00000400))
{
if(m_caster->GetTypeId()==TYPEID_PLAYER)
- ((Player*)m_caster)->AddComboPoints(unitTarget,1);
+ ((Player*)m_caster)->AddComboPoints(unitTarget,1, this);
}
break;
}
@@ -5505,7 +5493,7 @@ void Spell::EffectAddComboPoints(uint32 /*i*/)
if(damage <= 0)
return;
- ((Player*)m_caster)->AddComboPoints(unitTarget, damage);
+ ((Player*)m_caster)->AddComboPoints(unitTarget, damage, this);
}
void Spell::EffectDuel(uint32 i)
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index d310880f3b2..99db7dc3108 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -12501,6 +12501,9 @@ uint32 createProcExtendMask(SpellNonMeleeDamage *damageInfo, SpellMissInfo missC
void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, SpellEntry const * procSpell, uint32 damage , SpellEntry const * procAura)
{
+ // Player is loaded now - do not allow passive spell casts to proc
+ if (GetTypeId() == TYPEID_PLAYER && ((Player*)this)->GetSession()->PlayerLoading())
+ return;
// For melee/ranged based attack need update skills and set some Aura states
if (procFlag & MELEE_BASED_TRIGGER_MASK)
{