22 #ifndef ULTIMA4_GAME_CREATURE_H 23 #define ULTIMA4_GAME_CREATURE_H 25 #include "ultima/ultima4/game/object.h" 26 #include "ultima/ultima4/map/movement.h" 27 #include "ultima/ultima4/filesys/savegame.h" 28 #include "ultima/ultima4/core/types.h" 33 class CombatController;
37 typedef unsigned short CreatureId;
41 #define MAX_CREATURES 128 45 #define MAX_CREATURES_ON_MAP 4 46 #define MAX_CREATURE_DISTANCE 16 110 MATTR_STEALFOOD = 0x1,
111 MATTR_STEALGOLD = 0x2,
112 MATTR_CASTS_SLEEP = 0x4,
116 MATTR_NONATTACKABLE = 0x40,
118 MATTR_CAMOUFLAGE = 0x100,
119 MATTR_NOATTACK = 0x200,
120 MATTR_AMBUSHES = 0x400,
121 MATTR_RANDOMRANGED = 0x800,
122 MATTR_INCORPOREAL = 0x1000,
123 MATTR_NOCHEST = 0x2000,
124 MATTR_DIVIDES = 0x4000,
125 MATTR_SPAWNSONDEATH = 0x8000,
126 MATTR_FORCE_OF_NATURE = 0x10000
130 MATTR_STATIONARY = 0x1,
135 MATTR_TELEPORT = 0x20,
136 MATTR_CANMOVECREATURES = 0x40,
137 MATTR_CANMOVEAVATAR = 0x80
138 } CreatureMovementAttrib;
144 MSTAT_HEAVILYWOUNDED,
145 MSTAT_LIGHTLYWOUNDED,
175 return _rangedHitTile;
178 return _rangedMissTile;
180 CreatureId getId()
const {
183 CreatureId getLeader()
const {
186 virtual int getHp()
const {
189 virtual int getXp()
const {
193 return _worldRangedTile;
195 SlowedType getSlowedType()
const {
198 int getEncounterSize()
const {
199 return _encounterSize;
201 byte getResists()
const {
215 virtual void setHp(
int points) {
220 bool isGood()
const {
221 return _mAttr & MATTR_GOOD;
223 bool isEvil()
const {
226 bool isUndead()
const {
227 return _mAttr & MATTR_UNDEAD;
229 bool leavesChest()
const {
230 return !isAquatic() && !(_mAttr & MATTR_NOCHEST);
232 bool isAquatic()
const {
233 return _mAttr & MATTR_WATER;
235 bool wanders()
const {
236 return _movementAttr & MATTR_WANDERS;
238 bool isStationary()
const {
239 return _movementAttr & MATTR_STATIONARY;
242 return _movementAttr & MATTR_FLIES;
244 bool teleports()
const {
245 return _movementAttr & MATTR_TELEPORT;
248 return _movementAttr & MATTR_SWIMS;
251 return _movementAttr & MATTR_SAILS;
254 return !(flies() || swims() || sails());
256 bool divides()
const {
257 return _mAttr & MATTR_DIVIDES;
259 bool spawnsOnDeath()
const {
260 return _mAttr & MATTR_SPAWNSONDEATH;
262 bool canMoveOntoCreatures()
const {
263 return _movementAttr & MATTR_CANMOVECREATURES;
265 bool canMoveOntoPlayer()
const {
266 return _movementAttr & MATTR_CANMOVEAVATAR;
268 bool isAttackable()
const;
269 bool willAttack()
const {
270 return !(_mAttr & MATTR_NOATTACK);
272 bool stealsGold()
const {
273 return _mAttr & MATTR_STEALGOLD;
275 bool stealsFood()
const {
276 return _mAttr & MATTR_STEALFOOD;
278 bool negates()
const {
279 return _mAttr & MATTR_NEGATE;
281 bool camouflages()
const {
282 return _mAttr & MATTR_CAMOUFLAGE;
284 bool ambushes()
const {
285 return _mAttr & MATTR_AMBUSHES;
287 bool isIncorporeal()
const {
288 return _mAttr & MATTR_INCORPOREAL;
290 bool hasRandomRanged()
const {
291 return _mAttr & MATTR_RANDOMRANGED;
293 bool leavesTile()
const {
296 bool castsSleep()
const {
297 return _mAttr & MATTR_CASTS_SLEEP;
299 bool isForceOfNature()
const {
300 return _mAttr & MATTR_FORCE_OF_NATURE;
302 int getDamage()
const;
304 return _camouflageTile;
306 void setRandomRanged();
307 int setInitialHp(
int hp = -1);
329 virtual void addStatus(StatusType status);
330 void applyTileEffect(TileEffect effect);
331 virtual int getAttackBonus()
const;
332 virtual int getDefense()
const;
335 virtual CreatureStatus getState()
const;
336 StatusType getStatus()
const;
337 bool isAsleep()
const;
345 Creature *nearestOpponent(
int *dist,
bool ranged);
346 virtual void putToSleep();
347 virtual void removeStatus(StatusType status);
348 virtual void setStatus(StatusType status);
349 virtual void wakeUp();
360 virtual bool applyDamage(
int damage,
bool byplayer =
true);
361 virtual bool dealDamage(
Creature *m,
int damage);
378 CreatureAttrib _mAttr;
379 CreatureMovementAttrib _movementAttr;
380 SlowedType _slowedType;
423 Creature *randomForDungeon(
int dnglevel);
439 CreatureMap _creatures;
442 bool isCreature(
Object *punknown);
444 #define creatureMgr (CreatureMgr::getInstance())
virtual void addStatus(StatusType status)
Definition: creature.h:389
Definition: detection.h:27
Definition: combat_controller.h:59
Definition: map_tile.h:34
Definition: creature.h:159
Creature(MapTile tile=MapTile(0))
virtual bool applyDamage(int damage, bool byplayer=true)