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

[svn] Implemented player on player and player on creature possession:
* Implemented packet and vision forwarding through possessed units
* Added new OnPossess? script call alerting scripts on when possession is applied/removed
* Moved fall damage and fall under map calculations into the Player class
* Added new PossessedAI that is applied only while possession on creature is active
* Implemented summon possessed spell effect
* Fixed Eyes of the Beast

Original author: gvcoman
Date: 2008-11-05 20:51:05-06:00

Files:
1 modified

Legend:

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

    r173 r174  
    4747#include "OutdoorPvPMgr.h" 
    4848#include "GameEvent.h" 
     49#include "PossessedAI.h" 
    4950// apply implementation of the singletons 
    5051#include "Policies/SingletonImp.h" 
     
    118119 
    119120Creature::Creature() : 
    120 Unit(), i_AI(NULL), 
     121Unit(), i_AI(NULL), i_AI_possessed(NULL), 
    121122lootForPickPocketed(false), lootForBody(false), m_groupLootTimer(0), lootingGroupLeaderGUID(0), 
    122123m_lootMoney(0), m_lootRecipient(0), 
     
    146147    delete i_AI; 
    147148    i_AI = NULL; 
     149 
     150    DeletePossessedAI(); 
    148151} 
    149152 
     
    365368 
    366369                //Call AI respawn virtual function 
    367                 i_AI->JustRespawned(); 
     370                AI()->JustRespawned(); 
    368371 
    369372                MapManager::Instance().GetMap(GetMapId(), this)->Add(this); 
     
    429432                // do not allow the AI to be changed during update 
    430433                m_AI_locked = true; 
    431                 i_AI->UpdateAI(diff); 
     434                AI()->UpdateAI(diff); 
    432435                m_AI_locked = false; 
    433436            } 
     
    526529    } 
    527530 
     531    // don't allow AI switch when possessed 
     532    if (isPossessed()) 
     533        return false; 
     534 
    528535    CreatureAI * oldAI = i_AI; 
    529536    i_motionMaster.Initialize(); 
     
    532539        delete oldAI; 
    533540    return true; 
     541} 
     542 
     543void Creature::InitPossessedAI() 
     544{ 
     545    if (!isPossessed()) return; 
     546 
     547    if (!i_AI_possessed) 
     548        i_AI_possessed = new PossessedAI(*this); 
     549 
     550    // Signal the old AI that it's been disabled 
     551    i_AI->OnPossess(true); 
     552} 
     553 
     554void Creature::DeletePossessedAI() 
     555{ 
     556    if (!i_AI_possessed) return; 
     557 
     558    delete i_AI_possessed; 
     559    i_AI_possessed = NULL; 
     560 
     561    // Signal the old AI that it's been re-enabled 
     562    i_AI->OnPossess(false); 
    534563} 
    535564