ScummVM API documentation
weapon.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 ULTIMA4_GAME_WEAPON_H
23
#define ULTIMA4_GAME_WEAPON_H
24
25
#include "ultima/ultima4/filesys/savegame.h"
26
27
namespace
Ultima
{
28
namespace
Ultima4 {
29
30
class
ConfigElement;
31
class
Weapons;
32
33
class
Weapon
{
34
friend
class
Weapons
;
35
public
:
37
enum
Flags
{
38
WEAP_LOSE
= 0x0001,
39
WEAP_LOSEWHENRANGED
= 0x0002,
40
WEAP_CHOOSEDISTANCE
= 0x0004,
41
WEAP_ALWAYSHITS
= 0x0008,
42
WEAP_MAGIC
= 0x0010,
43
WEAP_ATTACKTHROUGHOBJECTS
= 0x0040,
44
WEAP_ABSOLUTERANGE
= 0x0080,
45
WEAP_RETURNS
= 0x0100,
46
WEAP_DONTSHOWTRAVEL
= 0x0200
47
};
48
49
public
:
50
WeaponType getType()
const
{
51
return
_type;
52
}
53
const
Common::String
&getName()
const
{
54
return
_name;
55
}
56
const
Common::String
&getAbbrev()
const
{
57
return
_abbr;
58
}
59
bool
canReady(ClassType klass)
const
{
60
return
(_canUse & (1 << klass)) != 0;
61
}
62
int
getRange()
const
{
63
return
_range;
64
}
65
int
getDamage()
const
{
66
return
_damage;
67
}
68
const
Common::String
&getHitTile()
const
{
69
return
_hitTile;
70
}
71
const
Common::String
&getMissTile()
const
{
72
return
_missTile;
73
}
74
const
Common::String
&leavesTile()
const
{
75
return
_leaveTile;
76
}
77
unsigned
short
getFlags()
const
{
78
return
_flags;
79
}
80
81
bool
loseWhenUsed()
const
{
82
return
_flags &
WEAP_LOSE
;
83
}
84
bool
loseWhenRanged()
const
{
85
return
_flags &
WEAP_LOSEWHENRANGED
;
86
}
87
bool
canChooseDistance()
const
{
88
return
_flags &
WEAP_CHOOSEDISTANCE
;
89
}
90
bool
alwaysHits()
const
{
91
return
_flags &
WEAP_ALWAYSHITS
;
92
}
93
bool
isMagic()
const
{
94
return
_flags &
WEAP_MAGIC
;
95
}
96
bool
canAttackThroughObjects()
const
{
97
return
_flags &
WEAP_ATTACKTHROUGHOBJECTS
;
98
}
99
bool
rangeAbsolute()
const
{
100
return
_flags &
WEAP_ABSOLUTERANGE
;
101
}
102
bool
returns()
const
{
103
return
_flags &
WEAP_RETURNS
;
104
}
105
bool
showTravel()
const
{
106
return
!(_flags &
WEAP_DONTSHOWTRAVEL
);
107
}
108
109
private
:
110
Weapon
(WeaponType weaponType,
const
ConfigElement
&conf);
111
112
WeaponType _type;
113
Common::String
_name;
114
Common::String
_abbr;
115
byte _canUse;
116
int
_range;
117
int
_damage;
118
Common::String
_hitTile;
119
Common::String
_missTile;
120
Common::String
_leaveTile;
121
unsigned
short
_flags;
122
};
123
124
class
Weapons
:
public
Common::Array
<Weapon *> {
125
private
:
126
bool
_confLoaded;
127
128
void
loadConf();
129
public
:
133
Weapons
();
134
138
~
Weapons
();
139
143
const
Weapon
*
get
(WeaponType w);
144
148
const
Weapon
*
get
(
const
Common::String
&name);
149
};
150
151
extern
Weapons
*g_weapons;
152
153
}
// End of namespace Ultima4
154
}
// End of namespace Ultima
155
156
#endif
Common::String
Definition:
str.h:59
Ultima::Ultima4::ConfigElement
Definition:
config.h:126
Common::Array
Definition:
array.h:52
Ultima::Ultima4::Weapon::WEAP_MAGIC
Definition:
weapon.h:42
Ultima::Ultima4::Weapon::WEAP_ABSOLUTERANGE
Definition:
weapon.h:44
Ultima
Definition:
detection.h:27
Ultima::Ultima4::Weapon::WEAP_LOSEWHENRANGED
Definition:
weapon.h:39
Ultima::Ultima4::Weapon::WEAP_RETURNS
Definition:
weapon.h:45
Ultima::Ultima4::Weapon::WEAP_ALWAYSHITS
Definition:
weapon.h:41
Ultima::Ultima4::Weapon::WEAP_DONTSHOWTRAVEL
Definition:
weapon.h:46
Ultima::Ultima4::Weapon::WEAP_CHOOSEDISTANCE
Definition:
weapon.h:40
Ultima::Ultima4::Weapon
Definition:
weapon.h:33
Ultima::Ultima4::Weapons
Definition:
weapon.h:124
Ultima::Ultima4::Weapon::Flags
Flags
Definition:
weapon.h:37
Ultima::Ultima4::Weapon::WEAP_ATTACKTHROUGHOBJECTS
Definition:
weapon.h:43
Ultima::Ultima4::Weapon::WEAP_LOSE
Definition:
weapon.h:38
engines
ultima
ultima4
game
weapon.h
Generated on Wed Sep 9 2026 09:21:19 for ScummVM API documentation by
1.8.13