#include <Unit.h>
Inheritance diagram for Unit:
Public Member Functions | |
virtual void | Update (uint32 iDeltaMs) |
Update unit state depending on time passed. | |
virtual void | ReceiveDamage (Unit *iAttacker, uint32 iDamage) |
virtual void | GenerateLoot ()=0 |
virtual void | GiveXP (uint32 iXP, Unit *iVictim, bool iGroup=true) |
virtual void | RemoveInRangeObject (Object *Obj, bool SP=false, bool HandleAware=1) |
void | SetAttackTimer () |
bool | IsAttackReady () const |
Check if unit is ready to attack again. | |
bool | CanReachWithAttack (Unit *iVictim) const |
Check if victim is reachable with current weapon. | |
void | RemoveAttacker (Unit *iAttacker) |
Remove an attacker from attackers list. | |
void | DealDamage (Unit *iVictim, uint32 iDamage) |
Combat. | |
void | SpellNonMeleeDamageLog (Unit *iVictim, uint32 iSpellID, uint32 iDamage) |
void | AttackStart (Unit *iVictim) |
Notify all in-range players that the attack has started. | |
void | AttackStop (uint64 iVictimGuid) |
Notify all in-range players that the attack has stopped. | |
bool | IsAlive () |
Check if unit is alive. | |
bool | IsDead () |
Check if unit is dead. | |
void | SetDeathState (UnitDeathState iState) |
Set corpse state :). | |
UnitDeathState | GetDeathState () |
Get current corpse state. | |
bool | IsInFront (Unit *iTarget, float iDistance) |
Public Attributes | |
char * | Name |
max 12 characters name (24 bytes for UTF-8) | |
char * | Appearance |
Appearance. | |
Protected Member Functions | |
Unit () | |
Protected Attributes | |
uint32 | AuraCheck |
Temporary affection. | |
Timer | AttackTimer |
timer for attack | |
ObjectVector | Attackers |
The list of units attacking this unit. | |
UnitDeathState | DeathState |
How dead we are. |
Unit::Unit | ( | ) | [protected] |
There aren't any objects of Unit type, it is meant to be a common parent for several other classes, so the constructor is private and also this class has virtual pure functions.
virtual void Unit::GenerateLoot | ( | ) | [pure virtual] |
This function is called directly before a unit is killed, so that its pockets doesn't turn out to be dissapointly empty :) If this is a player or some other object that already has something in his pockets, it can safely do nothing here.
Implemented in Player.
void Unit::GiveXP | ( | uint32 | iXP, | |
Unit * | iVictim, | |||
bool | iGroup = true | |||
) | [virtual] |
Give experience points to player
Reimplemented in Player.
bool Unit::IsInFront | ( | Unit * | iTarget, | |
float | iDistance | |||
) |
Use it to Check if a Unit is in front of this one
void Unit::ReceiveDamage | ( | Unit * | iAttacker, | |
uint32 | iDamage | |||
) | [virtual] |
Receive damage from another unit. This is a important function which is overrided by most children classes because different creatures react differently to the damage they take. Also note that this is the ULTIMATE damage, e.g. all resistances, parry etc is already subtracted from the attack power. Also this function is responsible to call GiveXP() on the respective attacker unit after this unit is killed (and it is NOT neccessary that this is the iAttacker unit).
Reimplemented in Player.
virtual void Unit::RemoveInRangeObject | ( | Object * | Obj, | |
bool | SP = false , |
|||
bool | HandleAware = 1 | |||
) | [inline, virtual] |
Override RemoveInRangeObject() to get a chance to remove the object from the list of attackers, if it's there.
void Unit::SetAttackTimer | ( | ) | [inline] |
Set up the attack timer: unit will be ready to attack only when this timer expires.
void Unit::SpellNonMeleeDamageLog | ( | Unit * | iVictim, | |
uint32 | iSpellID, | |||
uint32 | iDamage | |||
) |
Send a message to client to display messages like "Wolf suffers 15 fire damage from your fireball". Only for damages from spells.