mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-18 00:18:43 +01:00
Core/Unit: cleanup UnitState enum
This commit is contained in:
@@ -1786,7 +1786,7 @@ void Creature::setDeathState(DeathState s)
|
||||
SetCannotReachTarget(false);
|
||||
UpdateMovementFlags();
|
||||
|
||||
ClearUnitState(uint32(UNIT_STATE_ALL_STATE & ~UNIT_STATE_IGNORE_PATHFINDING));
|
||||
ClearUnitState(UNIT_STATE_ALL_ERASABLE);
|
||||
|
||||
if (!IsPet())
|
||||
{
|
||||
|
||||
@@ -526,53 +526,55 @@ enum DeathState
|
||||
JUST_RESPAWNED = 4
|
||||
};
|
||||
|
||||
enum UnitState
|
||||
enum UnitState : uint32
|
||||
{
|
||||
UNIT_STATE_DIED = 0x00000001, // player has fake death aura
|
||||
UNIT_STATE_MELEE_ATTACKING = 0x00000002, // player is melee attacking someone
|
||||
//UNIT_STATE_MELEE_ATTACK_BY = 0x00000004, // player is melee attack by someone
|
||||
UNIT_STATE_STUNNED = 0x00000008,
|
||||
UNIT_STATE_ROAMING = 0x00000010,
|
||||
UNIT_STATE_CHASE = 0x00000020,
|
||||
//UNIT_STATE_SEARCHING = 0x00000040,
|
||||
UNIT_STATE_FLEEING = 0x00000080,
|
||||
UNIT_STATE_IN_FLIGHT = 0x00000100, // player is in flight mode
|
||||
UNIT_STATE_FOLLOW = 0x00000200,
|
||||
UNIT_STATE_ROOT = 0x00000400,
|
||||
UNIT_STATE_CONFUSED = 0x00000800,
|
||||
UNIT_STATE_DISTRACTED = 0x00001000,
|
||||
UNIT_STATE_ISOLATED = 0x00002000, // area auras do not affect other players
|
||||
UNIT_STATE_ATTACK_PLAYER = 0x00004000,
|
||||
UNIT_STATE_CASTING = 0x00008000,
|
||||
UNIT_STATE_POSSESSED = 0x00010000,
|
||||
UNIT_STATE_CHARGING = 0x00020000,
|
||||
UNIT_STATE_JUMPING = 0x00040000,
|
||||
UNIT_STATE_MOVE = 0x00100000,
|
||||
UNIT_STATE_ROTATING = 0x00200000,
|
||||
UNIT_STATE_EVADE = 0x00400000,
|
||||
UNIT_STATE_ROAMING_MOVE = 0x00800000,
|
||||
UNIT_STATE_CONFUSED_MOVE = 0x01000000,
|
||||
UNIT_STATE_FLEEING_MOVE = 0x02000000,
|
||||
UNIT_STATE_CHASE_MOVE = 0x04000000,
|
||||
UNIT_STATE_FOLLOW_MOVE = 0x08000000,
|
||||
UNIT_STATE_IGNORE_PATHFINDING = 0x10000000, // do not use pathfinding in any MovementGenerator
|
||||
UNIT_STATE_DIED = 0x00000001, // player has fake death aura
|
||||
UNIT_STATE_MELEE_ATTACKING = 0x00000002, // player is melee attacking someone
|
||||
//UNIT_STATE_MELEE_ATTACK_BY = 0x00000004, // player is melee attack by someone
|
||||
UNIT_STATE_STUNNED = 0x00000008,
|
||||
UNIT_STATE_ROAMING = 0x00000010,
|
||||
UNIT_STATE_CHASE = 0x00000020,
|
||||
//UNIT_STATE_SEARCHING = 0x00000040,
|
||||
UNIT_STATE_FLEEING = 0x00000080,
|
||||
UNIT_STATE_IN_FLIGHT = 0x00000100, // player is in flight mode
|
||||
UNIT_STATE_FOLLOW = 0x00000200,
|
||||
UNIT_STATE_ROOT = 0x00000400,
|
||||
UNIT_STATE_CONFUSED = 0x00000800,
|
||||
UNIT_STATE_DISTRACTED = 0x00001000,
|
||||
UNIT_STATE_ISOLATED = 0x00002000, // area auras do not affect other players
|
||||
UNIT_STATE_ATTACK_PLAYER = 0x00004000,
|
||||
UNIT_STATE_CASTING = 0x00008000,
|
||||
UNIT_STATE_POSSESSED = 0x00010000,
|
||||
UNIT_STATE_CHARGING = 0x00020000,
|
||||
UNIT_STATE_JUMPING = 0x00040000,
|
||||
UNIT_STATE_MOVE = 0x00100000,
|
||||
UNIT_STATE_ROTATING = 0x00200000,
|
||||
UNIT_STATE_EVADE = 0x00400000,
|
||||
UNIT_STATE_ROAMING_MOVE = 0x00800000,
|
||||
UNIT_STATE_CONFUSED_MOVE = 0x01000000,
|
||||
UNIT_STATE_FLEEING_MOVE = 0x02000000,
|
||||
UNIT_STATE_CHASE_MOVE = 0x04000000,
|
||||
UNIT_STATE_FOLLOW_MOVE = 0x08000000,
|
||||
UNIT_STATE_IGNORE_PATHFINDING = 0x10000000, // do not use pathfinding in any MovementGenerator
|
||||
|
||||
UNIT_STATE_ALL_STATE_SUPPORTED = UNIT_STATE_DIED | UNIT_STATE_MELEE_ATTACKING | UNIT_STATE_STUNNED | UNIT_STATE_ROAMING | UNIT_STATE_CHASE
|
||||
| UNIT_STATE_FLEEING | UNIT_STATE_IN_FLIGHT | UNIT_STATE_FOLLOW | UNIT_STATE_ROOT | UNIT_STATE_CONFUSED
|
||||
| UNIT_STATE_DISTRACTED | UNIT_STATE_ISOLATED | UNIT_STATE_ATTACK_PLAYER | UNIT_STATE_CASTING
|
||||
| UNIT_STATE_POSSESSED | UNIT_STATE_CHARGING | UNIT_STATE_JUMPING | UNIT_STATE_MOVE | UNIT_STATE_ROTATING
|
||||
| UNIT_STATE_EVADE | UNIT_STATE_ROAMING_MOVE | UNIT_STATE_CONFUSED_MOVE | UNIT_STATE_FLEEING_MOVE
|
||||
| UNIT_STATE_CHASE_MOVE | UNIT_STATE_FOLLOW_MOVE | UNIT_STATE_IGNORE_PATHFINDING,
|
||||
UNIT_STATE_UNATTACKABLE = UNIT_STATE_IN_FLIGHT,
|
||||
// for real move using movegen check and stop (except unstoppable flight)
|
||||
UNIT_STATE_MOVING = UNIT_STATE_ROAMING_MOVE | UNIT_STATE_CONFUSED_MOVE | UNIT_STATE_FLEEING_MOVE | UNIT_STATE_CHASE_MOVE | UNIT_STATE_FOLLOW_MOVE,
|
||||
UNIT_STATE_CONTROLLED = (UNIT_STATE_CONFUSED | UNIT_STATE_STUNNED | UNIT_STATE_FLEEING),
|
||||
UNIT_STATE_LOST_CONTROL = (UNIT_STATE_CONTROLLED | UNIT_STATE_JUMPING | UNIT_STATE_CHARGING),
|
||||
UNIT_STATE_SIGHTLESS = (UNIT_STATE_LOST_CONTROL | UNIT_STATE_EVADE),
|
||||
UNIT_STATE_CANNOT_AUTOATTACK = (UNIT_STATE_LOST_CONTROL | UNIT_STATE_CASTING),
|
||||
UNIT_STATE_CANNOT_TURN = (UNIT_STATE_LOST_CONTROL | UNIT_STATE_ROTATING),
|
||||
// stay by different reasons
|
||||
UNIT_STATE_NOT_MOVE = UNIT_STATE_ROOT | UNIT_STATE_STUNNED | UNIT_STATE_DIED | UNIT_STATE_DISTRACTED,
|
||||
UNIT_STATE_ALL_STATE = 0xffffffff //(UNIT_STATE_STOPPED | UNIT_STATE_MOVING | UNIT_STATE_IN_COMBAT | UNIT_STATE_IN_FLIGHT)
|
||||
|
||||
UNIT_STATE_UNATTACKABLE = UNIT_STATE_IN_FLIGHT,
|
||||
UNIT_STATE_MOVING = UNIT_STATE_ROAMING_MOVE | UNIT_STATE_CONFUSED_MOVE | UNIT_STATE_FLEEING_MOVE | UNIT_STATE_CHASE_MOVE | UNIT_STATE_FOLLOW_MOVE,
|
||||
UNIT_STATE_CONTROLLED = UNIT_STATE_CONFUSED | UNIT_STATE_STUNNED | UNIT_STATE_FLEEING,
|
||||
UNIT_STATE_LOST_CONTROL = UNIT_STATE_CONTROLLED | UNIT_STATE_JUMPING | UNIT_STATE_CHARGING,
|
||||
UNIT_STATE_SIGHTLESS = UNIT_STATE_LOST_CONTROL | UNIT_STATE_EVADE,
|
||||
UNIT_STATE_CANNOT_AUTOATTACK = UNIT_STATE_LOST_CONTROL | UNIT_STATE_CASTING,
|
||||
UNIT_STATE_CANNOT_TURN = UNIT_STATE_LOST_CONTROL | UNIT_STATE_ROTATING,
|
||||
UNIT_STATE_NOT_MOVE = UNIT_STATE_ROOT | UNIT_STATE_STUNNED | UNIT_STATE_DIED | UNIT_STATE_DISTRACTED,
|
||||
|
||||
UNIT_STATE_ALL_ERASABLE = UNIT_STATE_ALL_STATE_SUPPORTED & ~(UNIT_STATE_IGNORE_PATHFINDING),
|
||||
UNIT_STATE_ALL_STATE = 0xffffffff
|
||||
};
|
||||
|
||||
enum UnitMoveType
|
||||
|
||||
@@ -64,7 +64,7 @@ void HomeMovementGenerator<Creature>::_setTargetLocation(Creature* owner)
|
||||
skipToHome = false;
|
||||
arrived = false;
|
||||
|
||||
owner->ClearUnitState(uint32(UNIT_STATE_ALL_STATE & ~(UNIT_STATE_EVADE | UNIT_STATE_IGNORE_PATHFINDING)));
|
||||
owner->ClearUnitState(UNIT_STATE_ALL_ERASABLE & ~UNIT_STATE_EVADE);
|
||||
}
|
||||
|
||||
bool HomeMovementGenerator<Creature>::DoUpdate(Creature* owner, const uint32 /*time_diff*/)
|
||||
|
||||
@@ -4910,7 +4910,7 @@ void Spell::EffectResurrectPet(SpellEffIndex /*effIndex*/)
|
||||
pet->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_NONE);
|
||||
pet->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
|
||||
pet->setDeathState(ALIVE);
|
||||
pet->ClearUnitState(uint32(UNIT_STATE_ALL_STATE));
|
||||
pet->ClearUnitState(UNIT_STATE_ALL_ERASABLE);
|
||||
pet->SetHealth(pet->CountPctFromMaxHealth(damage));
|
||||
|
||||
// Reset things for when the AI to takes over
|
||||
|
||||
Reference in New Issue
Block a user