aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreeston <treeston.mmoc@gmail.com>2017-06-25 03:41:16 +0200
committerariel- <ariel-@users.noreply.github.com>2017-06-24 22:41:16 -0300
commit489478b74d96c2ea940a2316fd11f8e81991cf07 (patch)
tree5faa936414542c9c7442d6386fc22b2d1d508ffc
parent641c2036abed70adff5c384e1679c5c3c986bd72 (diff)
Core/Entities: Extend combo point system to all Units and fix numerous quirks with rogue CP and vehicles (Malygos P3) (#19914)
- Implement Wolverine Bite (fixes #752) - General combo point system cleanup
-rw-r--r--src/server/game/AI/PlayerAI/PlayerAI.cpp4
-rw-r--r--src/server/game/Entities/Player/Player.cpp102
-rw-r--r--src/server/game/Entities/Player/Player.h13
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp103
-rw-r--r--src/server/game/Entities/Unit/Unit.h28
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.cpp5
-rw-r--r--src/server/game/Spells/Spell.cpp32
-rw-r--r--src/server/game/Spells/Spell.h12
-rw-r--r--src/server/game/Spells/SpellEffects.cpp17
-rw-r--r--src/server/game/Spells/SpellInfo.cpp6
10 files changed, 161 insertions, 161 deletions
diff --git a/src/server/game/AI/PlayerAI/PlayerAI.cpp b/src/server/game/AI/PlayerAI/PlayerAI.cpp
index 589b7162c3f..34b98cd3fe7 100644
--- a/src/server/game/AI/PlayerAI/PlayerAI.cpp
+++ b/src/server/game/AI/PlayerAI/PlayerAI.cpp
@@ -955,7 +955,7 @@ PlayerAI::TargetedSpell SimpleCharmedPlayerAI::SelectAppropriateCastForSpec()
if (victim->HasUnitState(UNIT_STATE_CASTING))
VerifyAndPushSpellCast(spells, SPELL_KICK, TARGET_VICTIM, 25);
- uint8 const cp = (me->GetComboTarget() == victim->GetGUID()) ? me->GetComboPoints() : 0;
+ uint8 const cp = me->GetComboPoints(victim);
if (cp >= 4)
VerifyAndPushSpellCast(spells, finisher, TARGET_VICTIM, 10);
if (cp <= 4)
@@ -1267,7 +1267,7 @@ PlayerAI::TargetedSpell SimpleCharmedPlayerAI::SelectAppropriateCastForSpec()
VerifyAndPushSpellCast(spells, SPELL_DASH, TARGET_NONE, 5);
if (Unit* victim = me->GetVictim())
{
- uint8 const cp = (me->GetComboTarget() == victim->GetGUID()) ? me->GetComboPoints() : 0;
+ uint8 const cp = me->GetComboPoints(victim);
if (victim->HasUnitState(UNIT_STATE_CASTING) && cp >= 1)
VerifyAndPushSpellCast(spells, SPELL_MAIM, TARGET_VICTIM, 25);
if (!me->IsWithinMeleeRange(victim))
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index f7766a7fcc0..b4d93f01d09 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -186,8 +186,6 @@ Player::Player(WorldSession* session): Unit(true)
if (!GetSession()->HasPermission(rbac::RBAC_PERM_CAN_FILTER_WHISPERS))
SetAcceptWhispers(true);
- m_comboPoints = 0;
-
m_usedTalentCount = 0;
m_questRewardTalentCount = 0;
@@ -7219,14 +7217,14 @@ void Player::DuelComplete(DuelCompleteType type)
}
// cleanup combo points
- if (GetComboTarget() == duel->opponent->GetGUID())
+ if (GetComboTarget() == duel->opponent)
ClearComboPoints();
- else if (GetComboTarget() == duel->opponent->GetPetGUID())
+ else if (GetComboTargetGUID() == duel->opponent->GetPetGUID())
ClearComboPoints();
- if (duel->opponent->GetComboTarget() == GetGUID())
+ if (duel->opponent->GetComboTarget() == this)
duel->opponent->ClearComboPoints();
- else if (duel->opponent->GetComboTarget() == GetPetGUID())
+ else if (duel->opponent->GetComboTargetGUID() == GetPetGUID())
duel->opponent->ClearComboPoints();
//cleanups
@@ -22380,92 +22378,6 @@ Player* Player::GetSelectedPlayer() const
return nullptr;
}
-void Player::SendComboPoints()
-{
- Unit* combotarget = ObjectAccessor::GetUnit(*this, m_comboTarget);
- if (combotarget)
- {
- WorldPacket data;
- if (m_unitMovedByMe != this)
- {
- data.Initialize(SMSG_PET_UPDATE_COMBO_POINTS, m_unitMovedByMe->GetPackGUID().size()+combotarget->GetPackGUID().size()+1);
- data << m_unitMovedByMe->GetPackGUID();
- }
- else
- data.Initialize(SMSG_UPDATE_COMBO_POINTS, combotarget->GetPackGUID().size()+1);
- data << combotarget->GetPackGUID();
- data << uint8(m_comboPoints);
- SendDirectMessage(&data);
- }
-}
-
-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)
- *comboPoints += count;
- else
- {
- if (m_comboTarget)
- if (Unit* target2 = ObjectAccessor::GetUnit(*this, m_comboTarget))
- target2->RemoveComboPointHolder(GetGUID());
-
- // Spells will always add value to m_comboPoints eventualy, so it must be cleared first
- if (spell)
- m_comboPoints = 0;
-
- m_comboTarget = target->GetGUID();
- *comboPoints = count;
-
- target->AddComboPointHolder(GetGUID());
- }
-
- 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;
- else if (m_comboPoints < 0) m_comboPoints = 0;
-
- SendComboPoints();
-}
-
-void Player::ClearComboPoints()
-{
- if (!m_comboTarget)
- return;
-
- // without combopoints lost (duration checked in aura)
- RemoveAurasByType(SPELL_AURA_RETAIN_COMBO_POINTS);
-
- m_comboPoints = 0;
-
- SendComboPoints();
-
- if (Unit* target = ObjectAccessor::GetUnit(*this, m_comboTarget))
- target->RemoveComboPointHolder(GetGUID());
-
- m_comboTarget.Clear();
-}
-
void Player::SetGroup(Group* group, int8 subgroup)
{
if (group == nullptr)
@@ -22533,7 +22445,7 @@ void Player::SendInitialPacketsBeforeAddToMap()
// SMSG_UPDATE_WORLD_STATE
// SMSG_POWER_UPDATE
- SetMover(this);
+ SetMovedUnit(this);
}
void Player::SendInitialPacketsAfterAddToMap()
@@ -23804,10 +23716,10 @@ void Player::SetClientControl(Unit* target, bool allowMove)
SetViewpoint(target, allowMove);
if (allowMove)
- SetMover(target);
+ SetMovedUnit(target);
}
-void Player::SetMover(Unit* target)
+void Player::SetMovedUnit(Unit* target)
{
m_unitMovedByMe->m_playerMovingMe = nullptr;
m_unitMovedByMe = target;
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index 8120c4bc531..210909db73f 100644
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -1348,14 +1348,6 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
void SetTarget(ObjectGuid /*guid*/) override { } /// Used for serverside target changes, does not apply to players
void SetSelection(ObjectGuid guid) { SetGuidValue(UNIT_FIELD_TARGET, guid); }
- uint8 GetComboPoints() const { return m_comboPoints; }
- ObjectGuid GetComboTarget() const { return m_comboTarget; }
-
- void AddComboPoints(Unit* target, int8 count, Spell* spell = nullptr);
- void GainSpellComboPoints(int8 count);
- void ClearComboPoints();
- void SendComboPoints();
-
void SendMailResult(uint32 mailId, MailResponseType mailAction, MailResponseResult mailError, uint32 equipError = 0, ObjectGuid::LowType item_guid = 0, uint32 item_count = 0) const;
void SendNewMail() const;
void UpdateNextMailTimeAndUnreads();
@@ -1943,7 +1935,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
void SetClientControl(Unit* target, bool allowMove);
- void SetMover(Unit* target);
+ void SetMovedUnit(Unit* target);
void SetSeer(WorldObject* target) { m_seer = target; }
void SetViewpoint(WorldObject* target, bool apply);
@@ -2272,9 +2264,6 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
uint32 m_ExtraFlags;
- ObjectGuid m_comboTarget;
- int8 m_comboPoints;
-
QuestStatusMap m_QuestStatus;
QuestStatusSaveMap m_QuestStatusSave;
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index aac3257e865..bb43c34182a 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -283,7 +283,7 @@ Unit::Unit(bool isWorldObject) :
i_AI(nullptr), i_disabledAI(nullptr), m_AutoRepeatFirstCast(false), m_procDeep(0),
m_removedAurasCount(0), i_motionMaster(new MotionMaster(this)), m_regenTimer(0), m_ThreatManager(this),
m_vehicle(nullptr), m_vehicleKit(nullptr), m_unitTypeMask(UNIT_MASK_NONE), m_Diminishing(),
- m_HostileRefManager(this), m_spellHistory(new SpellHistory(this))
+ m_HostileRefManager(this), m_comboTarget(nullptr), m_comboPoints(0), m_spellHistory(new SpellHistory(this))
{
m_objectType |= TYPEMASK_UNIT;
m_objectTypeId = TYPEID_UNIT;
@@ -9751,7 +9751,7 @@ int32 Unit::CalculateSpellDamage(Unit const* target, SpellInfo const* spellProto
int32 Unit::CalcSpellDuration(SpellInfo const* spellProto)
{
- uint8 comboPoints = m_playerMovingMe ? m_playerMovingMe->GetComboPoints() : 0;
+ uint8 comboPoints = GetComboPoints();
int32 minduration = spellProto->GetDuration();
int32 maxduration = spellProto->GetMaxDuration();
@@ -10676,6 +10676,7 @@ void Unit::CleanupBeforeRemoveFromMap(bool finalCleanup)
m_Events.KillAllEvents(false); // non-delatable (currently cast spells) will not deleted now but it will deleted at call in Map::RemoveAllObjectsInRemoveList
CombatStop();
+ ClearComboPoints();
ClearComboPointHolders();
DeleteThreatList();
getHostileRefManager().deleteReferences();
@@ -11196,9 +11197,14 @@ void Unit::ProcSkillsAndReactives(bool isVictim, Unit* procTarget, uint32 typeMa
// Overpower on victim dodge
if ((hitMask & PROC_HIT_DODGE) && GetTypeId() == TYPEID_PLAYER && getClass() == CLASS_WARRIOR)
{
- ToPlayer()->AddComboPoints(procTarget, 1);
+ AddComboPoints(procTarget, 1);
StartReactiveTimer(REACTIVE_OVERPOWER);
}
+ else if ((hitMask & PROC_HIT_CRITICAL) && IsHunterPet())
+ {
+ AddComboPoints(procTarget, 1);
+ StartReactiveTimer(REACTIVE_WOLVERINE_BITE);
+ }
}
}
}
@@ -11499,20 +11505,83 @@ void Unit::RestoreDisplayId()
SetDisplayId(GetNativeDisplayId());
}
-void Unit::ClearComboPointHolders()
+void Unit::AddComboPoints(Unit* target, int8 count)
{
- while (!m_ComboPointHolders.empty())
+ if (!count)
+ return;
+
+ // remove Premed-like effects
+ // (NB: this Aura removes the already-added CP when it expires from duration - now that we've added CP, this shouldn't happen anymore)
+ RemoveAurasByType(SPELL_AURA_RETAIN_COMBO_POINTS);
+
+ if (target && target != m_comboTarget)
{
- ObjectGuid guid = *m_ComboPointHolders.begin();
+ if (m_comboTarget)
+ m_comboTarget->RemoveComboPointHolder(this);
+ m_comboTarget = target;
+ m_comboPoints = count;
+ target->AddComboPointHolder(this);
+ }
+ else
+ m_comboPoints = std::max<int8>(std::min<int8>(m_comboPoints + count, 5),0);
- Player* player = ObjectAccessor::GetPlayer(*this, guid);
- if (player && player->GetComboTarget() == GetGUID()) // recheck for safe
- player->ClearComboPoints(); // remove also guid from m_ComboPointHolders;
- else
- m_ComboPointHolders.erase(guid); // or remove manually
+ SendComboPoints();
+}
+
+void Unit::ClearComboPoints()
+{
+ if (!m_comboTarget)
+ return;
+
+ // remove Premed-like effects
+ // (NB: this Aura retains the CP while it's active - now that CP have reset, it shouldn't be there anymore)
+ RemoveAurasByType(SPELL_AURA_RETAIN_COMBO_POINTS);
+
+ m_comboPoints = 0;
+ SendComboPoints();
+ m_comboTarget->RemoveComboPointHolder(this);
+ m_comboTarget = nullptr;
+}
+
+void Unit::SendComboPoints()
+{
+ if (m_cleanupDone)
+ return;
+
+ PackedGuid const packGUID = m_comboTarget ? m_comboTarget->GetPackGUID() : PackedGuid();
+ if (Player* playerMe = ToPlayer())
+ {
+ WorldPacket data;
+ data.Initialize(SMSG_UPDATE_COMBO_POINTS, packGUID.size() + 1);
+ data << packGUID;
+ data << uint8(m_comboPoints);
+ playerMe->SendDirectMessage(&data);
+ }
+ Player* movingMe = GetPlayerMovingMe();
+ ObjectGuid ownerGuid = GetCharmerOrOwnerGUID();
+ Player* owner = nullptr;
+ if (ownerGuid.IsPlayer())
+ owner = ObjectAccessor::GetPlayer(*this, ownerGuid);
+ if (movingMe || owner)
+ {
+ WorldPacket data;
+ data.Initialize(SMSG_PET_UPDATE_COMBO_POINTS, GetPackGUID().size() + packGUID.size() + 1);
+ data << GetPackGUID();
+ data << packGUID;
+ data << uint8(m_comboPoints);
+ if (movingMe)
+ movingMe->SendDirectMessage(&data);
+ if (owner && owner != movingMe)
+ owner->SendDirectMessage(&data);
}
}
+void Unit::ClearComboPointHolders()
+{
+ while (!m_ComboPointHolders.empty())
+ (*m_ComboPointHolders.begin())->ClearComboPoints(); // this also removes it from m_comboPointHolders
+}
+
void Unit::ClearAllReactives()
{
for (uint8 i = 0; i < MAX_REACTIVE; ++i)
@@ -11523,7 +11592,9 @@ void Unit::ClearAllReactives()
if (getClass() == CLASS_HUNTER && HasAuraState(AURA_STATE_HUNTER_PARRY))
ModifyAuraState(AURA_STATE_HUNTER_PARRY, false);
if (getClass() == CLASS_WARRIOR && GetTypeId() == TYPEID_PLAYER)
- ToPlayer()->ClearComboPoints();
+ ClearComboPoints();
+ if (IsHunterPet())
+ ClearComboPoints();
}
void Unit::UpdateReactives(uint32 p_time)
@@ -11551,7 +11622,13 @@ void Unit::UpdateReactives(uint32 p_time)
break;
case REACTIVE_OVERPOWER:
if (getClass() == CLASS_WARRIOR && GetTypeId() == TYPEID_PLAYER)
- ToPlayer()->ClearComboPoints();
+ ClearComboPoints();
+ break;
+ case REACTIVE_WOLVERINE_BITE:
+ if (IsHunterPet())
+ ClearComboPoints();
+ break;
+ default:
break;
}
}
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index 32f2f1c1870..73ca8add151 100644
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -912,12 +912,13 @@ struct TC_GAME_API CharmInfo
enum ReactiveType
{
- REACTIVE_DEFENSE = 0,
- REACTIVE_HUNTER_PARRY = 1,
- REACTIVE_OVERPOWER = 2
+ REACTIVE_DEFENSE = 0,
+ REACTIVE_HUNTER_PARRY = 1,
+ REACTIVE_OVERPOWER = 2,
+ REACTIVE_WOLVERINE_BITE = 3,
+ MAX_REACTIVE
};
-#define MAX_REACTIVE 3
#define SUMMON_SLOT_PET 0
#define SUMMON_SLOT_TOTEM 1
#define MAX_TOTEM_SLOT 5
@@ -1794,8 +1795,19 @@ class TC_GAME_API Unit : public WorldObject
void SetControlled(bool apply, UnitState state);
- void AddComboPointHolder(ObjectGuid lowguid) { m_ComboPointHolders.insert(lowguid); }
- void RemoveComboPointHolder(ObjectGuid lowguid) { m_ComboPointHolders.erase(lowguid); }
+ ///-----------Combo point system-------------------
+ // This unit having CP on other units
+ uint8 GetComboPoints(Unit const* who = nullptr) const { return (who && m_comboTarget != who) ? 0 : m_comboPoints; }
+ uint8 GetComboPoints(ObjectGuid const& guid) const { return (m_comboTarget && m_comboTarget->GetGUID() == guid) ? m_comboPoints : 0; }
+ Unit* GetComboTarget() const { return m_comboTarget; }
+ ObjectGuid GetComboTargetGUID() const { return m_comboTarget ? m_comboTarget->GetGUID() : ObjectGuid::Empty; }
+ void AddComboPoints(Unit* target, int8 count);
+ void AddComboPoints(int8 count) { AddComboPoints(nullptr, count); }
+ void ClearComboPoints();
+ void SendComboPoints();
+ // Other units having CP on this unit
+ void AddComboPointHolder(Unit* unit) { m_ComboPointHolders.insert(unit); }
+ void RemoveComboPointHolder(Unit* unit) { m_ComboPointHolders.erase(unit); }
void ClearComboPointHolders();
///----------Pet responses methods-----------------
@@ -2014,7 +2026,9 @@ class TC_GAME_API Unit : public WorldObject
FollowerRefManager m_FollowingRefManager;
- GuidSet m_ComboPointHolders;
+ Unit* m_comboTarget;
+ int8 m_comboPoints;
+ std::unordered_set<Unit*> m_ComboPointHolders;
RedirectThreatInfo _redirectThreadInfo;
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index 5347d056eba..eedbd4f90b9 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -4332,9 +4332,8 @@ void AuraEffect::HandleAuraRetainComboPoints(AuraApplication const* aurApp, uint
// combo points was added in SPELL_EFFECT_ADD_COMBO_POINTS handler
// remove only if aura expire by time (in case combo points amount change aura removed without combo points lost)
- if (!(apply) && GetBase()->GetDuration() == 0 && target->ToPlayer()->GetComboTarget())
- if (Unit* unit = ObjectAccessor::GetUnit(*target, target->ToPlayer()->GetComboTarget()))
- target->ToPlayer()->AddComboPoints(unit, -GetAmount());
+ if (!(apply) && GetBase()->GetDuration() == 0)
+ target->ToPlayer()->AddComboPoints(-GetAmount());
}
/*********************************************************/
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index ae65161538b..8309bf00fd3 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -2931,7 +2931,7 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const* triggered
m_powerCost = m_CastItem ? 0 : m_spellInfo->CalcPowerCost(m_caster, m_spellSchoolMask, this);
// Set combo point requirement
- if ((_triggeredCastFlags & TRIGGERED_IGNORE_COMBO_POINTS) || m_CastItem || !m_caster->m_playerMovingMe)
+ if ((_triggeredCastFlags & TRIGGERED_IGNORE_COMBO_POINTS) || m_CastItem)
m_needComboPoints = false;
uint32 param1 = 0, param2 = 0;
@@ -3497,16 +3497,13 @@ void Spell::_handle_immediate_phase()
void Spell::_handle_finish_phase()
{
- if (m_caster->m_playerMovingMe)
- {
- // Take for real after all targets are processed
- if (m_needComboPoints)
- m_caster->m_playerMovingMe->ClearComboPoints();
+ // Take for real after all targets are processed
+ if (m_needComboPoints)
+ m_caster->ClearComboPoints();
- // Real add combo points from effects
- if (m_comboPointGain)
- m_caster->m_playerMovingMe->GainSpellComboPoints(m_comboPointGain);
- }
+ // Real add combo points from effects
+ if (m_comboTarget && m_comboPointGain)
+ m_caster->AddComboPoints(m_comboTarget, m_comboPointGain);
if (m_caster->m_extraAttacks && m_spellInfo->HasEffect(SPELL_EFFECT_ADD_EXTRA_ATTACKS))
{
@@ -5733,11 +5730,20 @@ SpellCastResult Spell::CheckCast(bool strict, uint32* param1 /*= nullptr*/, uint
return SPELL_FAILED_ITEM_ALREADY_ENCHANTED;
}
- // check if caster has at least 1 combo point for spells that require combo points
+ // check if caster has at least 1 combo point on target for spells that require combo points
if (m_needComboPoints)
- if (Player* plrCaster = m_caster->ToPlayer())
- if (!plrCaster->GetComboPoints())
+ {
+ if (m_spellInfo->NeedsExplicitUnitTarget())
+ {
+ if (!m_caster->GetComboPoints(m_targets.GetUnitTarget()))
return SPELL_FAILED_NO_COMBO_POINTS;
+ }
+ else
+ {
+ if (!m_caster->GetComboPoints())
+ return SPELL_FAILED_NO_COMBO_POINTS;
+ }
+ }
// all ok
return SPELL_CAST_OK;
diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h
index 6d9bd44e9f1..eedf891a1ff 100644
--- a/src/server/game/Spells/Spell.h
+++ b/src/server/game/Spells/Spell.h
@@ -492,6 +492,18 @@ class TC_GAME_API Spell
uint32 m_glyphIndex;
uint32 m_preCastSpell;
SpellCastTargets m_targets;
+
+ void AddComboPointGain(Unit* target, int8 amount)
+ {
+ if (target != m_comboTarget)
+ {
+ m_comboTarget = target;
+ m_comboPointGain = amount;
+ }
+ else
+ m_comboPointGain += amount;
+ }
+ Unit* m_comboTarget;
int8 m_comboPointGain;
SpellCustomErrors m_customError;
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index 1b2847599f8..2201e39059b 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -3153,10 +3153,8 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
{
// Hemorrhage
if (m_spellInfo->SpellFamilyFlags[0] & 0x2000000)
- {
- if (m_caster->GetTypeId() == TYPEID_PLAYER)
- m_caster->ToPlayer()->AddComboPoints(unitTarget, 1, this);
- }
+ AddComboPointGain(unitTarget, 1);
+
// 50% more damage with daggers
if (m_caster->GetTypeId() == TYPEID_PLAYER)
if (Item* item = m_caster->ToPlayer()->GetWeaponForAttack(m_attackType, true))
@@ -3211,10 +3209,8 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
{
// Mangle (Cat): CP
if (m_spellInfo->SpellFamilyFlags[1] & 0x400)
- {
- if (m_caster->GetTypeId() == TYPEID_PLAYER)
- m_caster->ToPlayer()->AddComboPoints(unitTarget, 1, this);
- }
+ AddComboPointGain(unitTarget, 1);
+
// Shred, Maul - Rend and Tear
else if (m_spellInfo->SpellFamilyFlags[0] & 0x00008800 && unitTarget->HasAuraState(AURA_STATE_BLEEDING))
{
@@ -3984,13 +3980,10 @@ void Spell::EffectAddComboPoints(SpellEffIndex /*effIndex*/)
if (!unitTarget)
return;
- if (!m_caster->m_playerMovingMe)
- return;
-
if (damage <= 0)
return;
- m_caster->m_playerMovingMe->AddComboPoints(unitTarget, damage, this);
+ AddComboPointGain(unitTarget, damage);
}
void Spell::EffectDuel(SpellEffIndex effIndex)
diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp
index 2a0b972e631..9e393f2fcad 100644
--- a/src/server/game/Spells/SpellInfo.cpp
+++ b/src/server/game/Spells/SpellInfo.cpp
@@ -449,10 +449,8 @@ int32 SpellEffectInfo::CalcValue(Unit const* caster, int32 const* bp, Unit const
if (caster)
{
// bonus amount from combo points
- if (caster->m_playerMovingMe)
- if (uint8 comboPoints = caster->m_playerMovingMe->GetComboPoints())
- if (float comboDamage = PointsPerComboPoint)
- value += comboDamage* comboPoints;
+ if (uint8 comboPoints = caster->GetComboPoints())
+ value += PointsPerComboPoint * comboPoints;
value = caster->ApplyEffectModifiers(_spellInfo, _effIndex, value);