ScummVM API documentation
party.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_ULTIMA1_CORE_PARTY_H
23#define ULTIMA_ULTIMA1_CORE_PARTY_H
24
25#include "ultima/shared/core/party.h"
26#include "ultima/ultima1/spells/blink.h"
27#include "ultima/ultima1/spells/create.h"
28#include "ultima/ultima1/spells/destroy.h"
29#include "ultima/ultima1/spells/kill_magic_missile.h"
30#include "ultima/ultima1/spells/ladder_down.h"
31#include "ultima/ultima1/spells/ladder_up.h"
32#include "ultima/ultima1/spells/open_unlock.h"
33#include "ultima/ultima1/spells/prayer.h"
34#include "ultima/ultima1/spells/steal.h"
35
36namespace Ultima {
37namespace Ultima1 {
38
39enum WeaponType {
40 WEAPON_HANDS = 0, WEAPON_DAGGER = 1, WEAPON_MACE = 2, WEAPON_AXE = 3, WEAPON_ROPE_SPIKES = 4,
41 WEAPON_SWORD = 5, WEAPON_GREAT_SWORD = 6, WEAPON_BOW_ARROWS = 7, WEAPON_AMULET = 8,
42 WEAPON_WAND = 9, WEAPON_STAFF = 10, WEAPON_TRIANGLE = 11, WEAPON_PISTOL = 12,
43 WEAPON_LIGHT_SWORD = 13, WEAPON_PHAZOR = 14, WEAPON_BLASTER = 15
44};
45
46enum ArmorType {
47 ARMOR_SKIN = 0, ARMOR_LEATHER_armour = 1, ARMOR_CHAIN_MAIL = 2, ARMOR_PLATE_MAIL = 3,
48 ARMOR_VACUUM_SUIT = 4, ARMOR_REFLECT_SUIT = 5
49};
50
51class Ultima1Game;
52class Character;
53
57class Weapon : public Shared::Weapon {
58private:
59 Ultima1Game *_game;
60 Character *_character;
61 WeaponType _type;
62public:
66 Weapon(Ultima1Game *game, Character *c, WeaponType weaponType);
67
71 void changeQuantity(int delta) override {
72 if (_type != WEAPON_HANDS)
73 _quantity = (uint)CLIP((int)_quantity + delta, 0, 9999);
74 }
75
79 uint getMagicDamage() const;
80
84 uint getBuyCost() const;
85
89 uint getSellCost() const;
90};
91
95class Armour : public Shared::Armour {
96private:
97// Ultima1Game *_game;
98 Character *_character;
99 ArmorType _type;
100public:
104 Armour(Ultima1Game *game, Character *c, ArmorType armorType);
105
109 void changeQuantity(int delta) override {
110 if (_type != ARMOR_SKIN)
111 _quantity = (uint)CLIP((int)_quantity + delta, 0, 9999);
112 }
113
117 uint getBuyCost() const;
118
122 uint getSellCost() const;
123};
124
125
130private:
131// Ultima1Game *_game;
132
133 Weapon _weaponHands;
134 Weapon _weaponDagger;
135 Weapon _weaponMace;
136 Weapon _weaponAxe;
137 Weapon _weaponRopeSpikes;
138 Weapon _weaponSword;
139 Weapon _weaponGreatSword;
140 Weapon _weaponBowArrows;
141 Weapon _weaponAmulet;
142 Weapon _weaponWand;
143 Weapon _weaponStaff;
144 Weapon _weaponTriangle;
145 Weapon _weaponPistol;
146 Weapon _weaponLightSword;
147 Weapon _weaponPhazor;
148 Weapon _weaponBlaster;
149
150 Armour _armourSkin;
151 Armour _armourLeatherArmor;
152 Armour _armourChainMail;
153 Armour _armourPlateMail;
154 Armour _armourVacuumSuit;
155 Armour _armourReflectSuit;
156
157 Spells::Blink _spellBlink;
158 Spells::Create _spellCreate;
159 Spells::Destroy _spellDestroy;
160 Spells::Kill _spellKill;
161 Spells::LadderDown _spellLadderDown;
162 Spells::LadderUp _spellLadderUp;
163 Spells::MagicMissile _spellMagicMissile;
164 Spells::Open _spellOpen;
165 Spells::Prayer _spellPrayer;
166 Spells::Steal _spellSteal;
167 Spells::Unlock _spellUnlock;
168public:
173 virtual ~Character() {}
174
178 void setup();
179
183 Weapon *equippedWeapon() const { return static_cast<Weapon *>(_weapons[_equippedWeapon]); }
184
188 Armour *equippedArmour() const { return static_cast<Armour *>(_armour[_equippedArmour]); }
189
193 Spells::Spell *equippedSpell() const { return static_cast<Spells::Spell *>(_spells[_equippedSpell]); }
194};
195
199class Party : public Shared::Party {
200public:
205
209 void setup();
210
214 operator Character *() const { return static_cast<Character *>(_characters.front()); }
215
219 operator Character &() const { return *static_cast<Character *>(_characters.front()); }
220};
221
222} // End of namespace Ultima1
223} // End of namespace Ultima
224
225#endif
Definition: character.h:102
Definition: character.h:141
Definition: party.h:36
Definition: character.h:88
Definition: party.h:95
uint getSellCost() const
void changeQuantity(int delta) override
Definition: party.h:109
Armour(Ultima1Game *game, Character *c, ArmorType armorType)
Definition: party.h:129
Character(Ultima1Game *game)
Armour * equippedArmour() const
Definition: party.h:188
Spells::Spell * equippedSpell() const
Definition: party.h:193
Weapon * equippedWeapon() const
Definition: party.h:183
Definition: party.h:199
Party(Ultima1Game *game)
Definition: create.h:34
Definition: destroy.h:34
Definition: kill_magic_missile.h:57
Definition: ladder_down.h:34
Definition: ladder_up.h:34
Definition: kill_magic_missile.h:73
Definition: open_unlock.h:56
Definition: prayer.h:34
Definition: spell.h:46
Definition: steal.h:34
Definition: open_unlock.h:67
Definition: game.h:42
Definition: party.h:57
void changeQuantity(int delta) override
Definition: party.h:71
uint getMagicDamage() const
uint getSellCost() const
Weapon(Ultima1Game *game, Character *c, WeaponType weaponType)
T CLIP(T v, T amin, T amax)
Definition: util.h:69