File: unit.h

package info (click to toggle)
attal 0.9.2-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,992 kB
  • ctags: 5,972
  • sloc: cpp: 44,510; sh: 134; makefile: 45
file content (170 lines) | stat: -rw-r--r-- 3,746 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/****************************************************************
**
** Attal : Lords of Doom
**
** unit.h
** manages unit (army)
**
** Version : $Id: unit.h,v 1.9 2004/07/31 19:29:47 audoux Exp $
**
** Author(s) : Pascal Audoux
**
** Date : 09/08/2000
**
** Licence :    
**	This program is free software; you can redistribute it and/or modify
**   	it under the terms of the GNU General Public License as published by
**     	the Free Software Foundation; either version 2, or (at your option)
**      any later version.
**
**	This program is distributed in the hope that it will be useful,
** 	but WITHOUT ANY WARRANTY; without even the implied warranty of
**	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
**	GNU General Public License for more details.
**
****************************************************************/


#ifndef UNIT_H
#define UNIT_H


// generic include files
// include files for QT
#include <qstring.h>
// application specific includes

class Creature;
class GenericFightCell;
class GenericFightMap;

/*              ------------------------------
 *                         Unit
 *              ------------------------------ */

class GenericFightUnit
{

public:
	/** Constructor */
	GenericFightUnit();

	/** Destructor */	
	virtual ~GenericFightUnit();

	/** Set the fight map for unit */
	void setFightMap ( GenericFightMap* map );

	GenericFightMap* getFightMap () { return _map; }

	/** Set race of unit */
	void setCreature( QString name );

	void setCreature( uint race, uint level );

	void setCreature( Creature * creature );

	Creature * getCreature() { return _creature; }

	/** Return race of unit */
	uint getRace() { return _race; }

	/** Return race of unit */
	uint getLevel() { return _level; }

	/** Set nb of creatures */
	void setNumber( uint nb ) { _number = nb; }

	/** return nb of creatures */
	uint getNumber() { return _number; }

	/** Add nb of creatures */
	void addNumber( uint nb ) { _number += nb; }

	/** Set move points */
	void setMove( uint nb ) { _move = nb; }

	/** Return move points */
	uint getMove() { return _move; }

	void setMaxMove();

	/** Set health */
	void setHealth( uint nb ) { _health = nb; }

	/** Return health */
	uint getHealth() { return _health; }
	
	/** Set experience */
	void setExperience( uint nb ) { _experience = nb; }

	/** Return health */
	uint getExperience() { return _experience; }

	/** Display unit */
	void display();

	/** Calculate the damages made by the attack */
	int hit( long int nb );
	
	bool isAlive () { return (_number > 0); }

	/** Go to fight cell */
	void goTo( GenericFightCell * cell );

	/** Return cell of the unit */
	GenericFightCell * getCell() {
		return _currentFightCell;
	}




	/** Return attack points of creature */
	int getAttack();

	/** Return defense points of creature */
	int getDefense();

	/** Return dist attack points of creature */
	int getDistAttack();

	/** Tell if dist attack is allowed for creature  */
	bool isDistAttack();

	/** Return max health points of creature */
	int getMaxHealth();

	/** Return max move points of creature */
	int getMaxMove();

	/** Return morale of creature */
	int getMorale();

	/** Return luck of creature */
	int getLuck();

	/** Return min damages points of creature */
	int getMinDamages();

	/** Return max damages points of creature */
	int getMaxDamages();

	/** Return mantainment cost of creature */
	int getMantCost(int ress);

	/** Is this unit looking to right (important for 2-cells units)*/
	bool isLookingToRight ();


protected:
	uint _number, _move, _health, _experience;
        uint _race, _level;
	GenericFightCell * _currentFightCell;
	Creature * _creature;
	GenericFightMap* _map;
	bool _lookingToRight;

};
 
#endif // UNIT_H