diff options
author | megamage <none@none> | 2009-04-27 19:14:37 -0500 |
---|---|---|
committer | megamage <none@none> | 2009-04-27 19:14:37 -0500 |
commit | 2b753d0f23593849dc2b440406e6f7006c104c53 (patch) | |
tree | 2314d720fb6210e27e93ccb7a0eed83b5dae8b17 /src/game/Unit.cpp | |
parent | d4c75dddea881d544524ac4373f097f15a603c18 (diff) |
[7723] New AI call EnterCombat called at enter creature to combat (and re-enter if leave by some reason). Author: VladimirMangos
--HG--
branch : trunk
Diffstat (limited to 'src/game/Unit.cpp')
-rw-r--r-- | src/game/Unit.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 7f197c16ac9..01cdcdcbf38 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -9679,7 +9679,7 @@ void Unit::SetInCombatWith(Unit* enemy) Unit* eOwner = enemy->GetCharmerOrOwnerOrSelf(); if(eOwner->IsPvP()) { - SetInCombatState(true); + SetInCombatState(true,enemy); return; } @@ -9689,11 +9689,11 @@ void Unit::SetInCombatWith(Unit* enemy) Unit const* myOwner = GetCharmerOrOwnerOrSelf(); if(((Player const*)eOwner)->duel->opponent == myOwner) { - SetInCombatState(true); + SetInCombatState(true,enemy); return; } } - SetInCombatState(false); + SetInCombatState(false,enemy); } void Unit::CombatStart(Unit* target) @@ -9705,6 +9705,7 @@ void Unit::CombatStart(Unit* target) && !((Creature*)target)->HasReactState(REACT_PASSIVE) && ((Creature*)target)->IsAIEnabled) { ((Creature*)target)->AI()->AttackStart(this); + ((Creature*)target)->AI()->EnterCombat(this); if(((Creature*)target)->GetFormation()) { ((Creature*)target)->GetFormation()->MemberAttackStart((Creature*)target, this); @@ -9729,7 +9730,7 @@ void Unit::CombatStart(Unit* target) } } -void Unit::SetInCombatState(bool PvP) +void Unit::SetInCombatState(bool PvP, Unit* enemy) { // only alive units can be in combat if(!isAlive()) |