Show
Ignore:
Timestamp:
11/19/08 13:39:45 (17 years ago)
Author:
yumileroy
Message:

[svn] Set target in combat even if spell does not hit target.
Call AI function only when spell hits target.
Move combat check from dealdamge to attackerstateupdate to remove redundant check.

Original author: megamage
Date: 2008-10-31 14:00:49-05:00

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/game/Unit.cpp

    r139 r140  
    520520            return damage; 
    521521        } 
    522  
    523         if(!pVictim->isInCombat() && ((Creature*)pVictim)->AI()) 
    524             ((Creature*)pVictim)->AI()->AttackStart(this); 
    525522    } 
    526523 
     
    539536 
    540537        duel_hasEnded = true; 
    541     } 
    542     //Get in CombatState 
    543     if(pVictim != this && damagetype != DOT) 
    544     { 
    545         SetInCombatWith(pVictim); 
    546         pVictim->SetInCombatWith(this); 
    547  
    548         if(Player* attackedPlayer = pVictim->GetCharmerOrOwnerPlayerOrPlayerItself()) 
    549             SetContestedPvP(attackedPlayer); 
    550538    } 
    551539 
     
    21512139    if(IsNonMeleeSpellCasted(false)) 
    21522140        return; 
     2141 
     2142    if(!pVictim->isInCombat() && pVictim->GetTypeId() != TYPEID_PLAYER && ((Creature*)pVictim)->AI()) 
     2143        ((Creature*)pVictim)->AI()->AttackStart(this); 
     2144 
     2145    SetInCombatWith(pVictim); 
     2146    pVictim->SetInCombatWith(this); 
     2147 
     2148    if(Player* attackedPlayer = pVictim->GetCharmerOrOwnerPlayerOrPlayerItself()) 
     2149        SetContestedPvP(attackedPlayer); 
    21532150 
    21542151    uint32 hitInfo;