ScummVM API documentation
creature.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef ULTIMA_SHARED_WIDGETS_CREATURE_H
23 #define ULTIMA_SHARED_WIDGETS_CREATURE_H
24 
25 #include "ultima/shared/maps/map_widget.h"
26 #include "ultima/shared/maps/map.h"
27 #include "common/serializer.h"
28 
29 namespace Ultima {
30 namespace Shared {
31 
32 class Game;
33 class Map;
34 
35 namespace Maps {
36 
40 class Creature {
41 private:
42  Game *_gameRef;
43 // MapBase *_mapRef;
44 protected:
45  int _hitPoints;
46  bool _isAttacking;
47 protected:
52  virtual uint attackDistance() const { return 0; }
53 
57  virtual void movement() {}
58 
62  virtual void attackParty() {}
63 public:
67  Creature(Game *game, MapBase *) : _gameRef(game), _hitPoints(0), _isAttacking(false) {}
68  Creature(Game *game, MapBase *, int hitPoints) : _gameRef(game),
69  _hitPoints(hitPoints), _isAttacking(false) {}
70 
74  virtual ~Creature() {}
75 
80 
86  virtual void update(bool isPreUpdate);
87 
91  bool isDead() const { return _hitPoints <= 0; }
92 
98  virtual bool subtractHitPoints(uint amount);
99 };
100 
101 } // End of namespace Maps
102 } // End of namespace Shared
103 } // End of namespace Ultima
104 
105 #endif
void synchronize(Common::Serializer &s)
virtual uint attackDistance() const
Definition: creature.h:52
Definition: game.h:42
Definition: serializer.h:79
Creature(Game *game, MapBase *)
Definition: creature.h:67
Definition: detection.h:27
virtual void attackParty()
Definition: creature.h:62
Definition: creature.h:40
bool isDead() const
Definition: creature.h:91
Definition: map_base.h:47
virtual ~Creature()
Definition: creature.h:74
virtual void update(bool isPreUpdate)
virtual void movement()
Definition: creature.h:57
virtual bool subtractHitPoints(uint amount)