diff options
author | QAston <none@none> | 2009-07-13 15:38:48 +0200 |
---|---|---|
committer | QAston <none@none> | 2009-07-13 15:38:48 +0200 |
commit | aee2b181601deae514865f1350194f0c589b7db0 (patch) | |
tree | d703f80895470962e8ac6ccb337f07a8be29b4d8 /src | |
parent | 3b6aacb512e6751ac67fed80e16c7f1b77a4d610 (diff) |
*Set pvp flag for spells with SPELL_ATTR_EX3_NO_INITIAL_AGGRO if needed.
--HG--
branch : trunk
Diffstat (limited to 'src')
-rw-r--r-- | src/game/Spell.cpp | 8 | ||||
-rw-r--r-- | src/game/Unit.cpp | 22 | ||||
-rw-r--r-- | src/game/Unit.h | 2 |
3 files changed, 16 insertions, 16 deletions
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index fe64070caea..5e0fce39f98 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -1192,11 +1192,9 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target) if( !m_caster->IsFriendlyTo(unit) && !IsPositiveSpell(m_spellInfo->Id)) { - if( !(m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_NO_INITIAL_AGGRO) ) - { - m_caster->CombatStart(unit); - } - else if(m_customAttr & SPELL_ATTR_CU_AURA_CC) + m_caster->CombatStart(unit, !(m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_NO_INITIAL_AGGRO)); + + if(m_customAttr & SPELL_ATTR_CU_AURA_CC) { if(!unit->IsStandState()) unit->SetStandState(UNIT_STAND_STATE_STAND); diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 1be089e66bc..02e6f8fd440 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -10455,20 +10455,22 @@ void Unit::SetInCombatWith(Unit* enemy) SetInCombatState(false,enemy); } -void Unit::CombatStart(Unit* target) +void Unit::CombatStart(Unit* target, bool initialAggro) { - if(!target->IsStandState()/* && !target->hasUnitState(UNIT_STAT_STUNNED)*/) - target->SetStandState(UNIT_STAND_STATE_STAND); - - if(!target->isInCombat() && target->GetTypeId() != TYPEID_PLAYER - && !((Creature*)target)->HasReactState(REACT_PASSIVE) && ((Creature*)target)->IsAIEnabled) + if (initialAggro) { - ((Creature*)target)->AI()->AttackStart(this); - } + if(!target->IsStandState()/* && !target->hasUnitState(UNIT_STAT_STUNNED)*/) + target->SetStandState(UNIT_STAND_STATE_STAND); - SetInCombatWith(target); - target->SetInCombatWith(this); + if(!target->isInCombat() && target->GetTypeId() != TYPEID_PLAYER + && !((Creature*)target)->HasReactState(REACT_PASSIVE) && ((Creature*)target)->IsAIEnabled) + { + ((Creature*)target)->AI()->AttackStart(this); + } + SetInCombatWith(target); + target->SetInCombatWith(this); + } Unit *who = target->GetCharmerOrOwnerOrSelf(); if(who->GetTypeId() == TYPEID_PLAYER) SetContestedPvP((Player*)who); diff --git a/src/game/Unit.h b/src/game/Unit.h index 67a8b427287..ed51e606996 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -1275,7 +1275,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject bool isInFlight() const { return hasUnitState(UNIT_STAT_IN_FLIGHT); } bool isInCombat() const { return HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); } - void CombatStart(Unit* target); + void CombatStart(Unit* target, bool initialAggro = true); void SetInCombatState(bool PvP, Unit* enemy = NULL); void SetInCombatWith(Unit* enemy); void ClearInCombat(); |