Created
September 24, 2011 19:48
-
-
Save rsa/1239774 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp | |
| index 33b4162..156f7f6 100644 | |
| --- a/src/game/Spell.cpp | |
| +++ b/src/game/Spell.cpp | |
| @@ -1061,11 +1061,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target) | |
| (m_caster->isVisibleForOrDetect(unit, unit, false) && !m_IsTriggeredSpell)) | |
| { | |
| if (!unit->isInCombat() && unit->GetTypeId() != TYPEID_PLAYER && ((Creature*)unit)->AI()) | |
| - ((Creature*)unit)->AI()->AttackedBy(real_caster); | |
| - | |
| - unit->AddThreat(real_caster); | |
| - unit->SetInCombatWith(real_caster); | |
| - real_caster->SetInCombatWith(unit); | |
| + unit->AttackedBy(real_caster); | |
| } | |
| } | |
| } | |
| diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp | |
| index d96e478..dac5836 100644 | |
| --- a/src/game/Unit.cpp | |
| +++ b/src/game/Unit.cpp | |
| @@ -6277,9 +6277,20 @@ bool Unit::Attack(Unit *victim, bool meleeAttack) | |
| void Unit::AttackedBy(Unit *attacker) | |
| { | |
| + if (IsFriendlyTo(attacker) || attacker->IsFriendlyTo(this)) | |
| + return; | |
| + | |
| // trigger AI reaction | |
| if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->AI()) | |
| + { | |
| ((Creature*)this)->AI()->AttackedBy(attacker); | |
| + if (!isInCombat()) | |
| + { | |
| + AddThreat(attacker); | |
| + SetInCombatWith(attacker); | |
| + attacker->SetInCombatWith(this); | |
| + } | |
| + } | |
| // trigger pet AI reaction | |
| if (attacker->IsHostileTo(this)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Пробуем комплить...