Changeset 60

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

[svn] * Prevent creatures from moving if they are dead (if they were fleeing for example).
* Critters now flee from attacker when taking damage.

Original author: Seline
Date: 2008-10-19 10:20:53-05:00

Files:
1 modified

Legend:

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

    r59 r60  
    501501        if ( pVictim->GetCreatureType() == CREATURE_TYPE_CRITTER) 
    502502        { 
    503             pVictim->setDeathState(JUST_DIED); 
    504             pVictim->SetHealth(0); 
     503            // critters run away when hit 
     504            pVictim->GetMotionMaster()->MoveFleeing(this); 
    505505 
    506506            // allow loot only if has loot_id in creature_template 
    507             CreatureInfo const* cInfo = ((Creature*)pVictim)->GetCreatureInfo(); 
    508             if(cInfo && cInfo->lootid) 
    509                 pVictim->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); 
    510  
    511             // some critters required for quests 
    512             if(GetTypeId() == TYPEID_PLAYER) 
    513                 ((Player*)this)->KilledMonster(pVictim->GetEntry(),pVictim->GetGUID()); 
     507            if(damage >= pVictim->GetHealth()) 
     508            { 
     509                pVictim->setDeathState(JUST_DIED); 
     510                pVictim->SetHealth(0); 
     511 
     512                CreatureInfo const* cInfo = ((Creature*)pVictim)->GetCreatureInfo(); 
     513                if(cInfo && cInfo->lootid) 
     514                    pVictim->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); 
     515 
     516                // some critters required for quests 
     517                if(GetTypeId() == TYPEID_PLAYER) 
     518                    ((Player*)this)->KilledMonster(pVictim->GetEntry(),pVictim->GetGUID()); 
     519            } 
     520            else 
     521                pVictim->ModifyHealth(- (int32)damage); 
    514522 
    515523            return damage; 
     
    612620        pVictim->CombatStop(); 
    613621        pVictim->getHostilRefManager().deleteReferences(); 
     622 
     623        // stop movement 
     624        pVictim->StopMoving(); 
    614625 
    615626        bool damageFromSpiritOfRedemtionTalent = spellProto && spellProto->Id == 27795;