forked from cataclysmbnteam/Cataclysm-BN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mattack_actors.h
202 lines (161 loc) · 6.89 KB
/
mattack_actors.h
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
#pragma once
#ifndef CATA_SRC_MATTACK_ACTORS_H
#define CATA_SRC_MATTACK_ACTORS_H
#include <climits>
#include <map>
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "bodypart.h"
#include "damage.h"
#include "magic.h"
#include "mattack_common.h"
#include "translations.h"
#include "type_id.h"
#include "weighted_list.h"
class Creature;
class JsonObject;
class monster;
struct mon_effect_data;
class leap_actor : public mattack_actor
{
public:
float max_range;
// Jump has to be at least this tiles long
float min_range;
// Don't leap without a hostile target creature
bool allow_no_target;
int move_cost;
// Range below which we don't consider jumping at all
float min_consider_range;
// Don't jump if distance to target is more than this
float max_consider_range;
leap_actor() = default;
~leap_actor() override = default;
void load_internal( const JsonObject &obj, const std::string &src ) override;
bool call( monster & ) const override;
std::unique_ptr<mattack_actor> clone() const override;
};
class mon_spellcasting_actor : public mattack_actor
{
public:
// is the spell beneficial to target itself?
bool self;
spell spell_data;
int move_cost;
mon_spellcasting_actor() = default;
~mon_spellcasting_actor() override = default;
void load_internal( const JsonObject &obj, const std::string &src ) override;
bool call( monster & ) const override;
std::unique_ptr<mattack_actor> clone() const override;
};
class melee_actor : public mattack_actor
{
public:
// Maximum damage from the attack
damage_instance damage_max_instance = damage_instance::physical( 9, 0, 0, 0 );
// Minimum multiplier on damage above (rolled per attack)
float min_mul = 0.5f;
// Maximum multiplier on damage above (also per attack)
float max_mul = 1.0f;
// Cost in moves (for attacker)
int move_cost = 100;
// If non-negative, the attack will use a different accuracy from mon's
// regular melee attack.
int accuracy = INT_MIN;
/**
* If empty, regular melee roll body part selection is used.
* If non-empty, a body part is selected from the map to be targeted,
* with a chance proportional to the value.
*/
weighted_float_list<body_part> body_parts;
/** Extra effects applied on damaging hit. */
std::vector<mon_effect_data> effects;
/** Message for missed attack against the player. */
translation miss_msg_u;
/** Message for 0 damage hit against the player. */
translation no_dmg_msg_u;
/** Message for damaging hit against the player. */
translation hit_dmg_u;
/** Message for missed attack against a non-player. */
translation miss_msg_npc;
/** Message for 0 damage hit against a non-player. */
translation no_dmg_msg_npc;
/** Message for damaging hit against a non-player. */
translation hit_dmg_npc;
melee_actor();
~melee_actor() override = default;
virtual Creature *find_target( monster &z ) const;
virtual void on_damage( monster &z, Creature &target, dealt_damage_instance &dealt ) const;
void load_internal( const JsonObject &obj, const std::string &src ) override;
bool call( monster & ) const override;
std::unique_ptr<mattack_actor> clone() const override;
};
class bite_actor : public melee_actor
{
public:
// one_in( this - damage dealt ) chance of getting infected
// i.e. the higher is this, the lower chance of infection
int no_infection_chance;
bite_actor();
~bite_actor() override = default;
void on_damage( monster &z, Creature &target, dealt_damage_instance &dealt ) const override;
void load_internal( const JsonObject &obj, const std::string &src ) override;
std::unique_ptr<mattack_actor> clone() const override;
};
class gun_actor : public mattack_actor
{
public:
// Item type of the gun we're using
itype_id gun_type;
/** Specific ammo type to use or for gun default if unspecified */
itype_id ammo_type = itype_id::NULL_ID();
/*@{*/
/** Balanced against player. If fake_skills unspecified defaults to GUN 4, WEAPON 8 */
std::map<skill_id, int> fake_skills;
int fake_str = 16;
int fake_dex = 8;
int fake_int = 8;
int fake_per = 12;
/*@}*/
/** Specify weapon mode to use at different engagement distances */
std::map<std::pair<int, int>, gun_mode_id> ranges;
int max_ammo = INT_MAX; /** limited also by monster starting_ammo */
/** Description of the attack being run */
std::string description;
/** Message to display (if any) for failures to fire excluding lack of ammo */
std::string failure_msg;
/** Sound (if any) when either starting_ammo depleted or max_ammo reached */
std::string no_ammo_sound;
/** Number of moves required for each attack */
int move_cost = 150;
/** Should moving vehicles be targeted */
bool target_moving_vehicles = false;
/*@{*/
/** Turrets may need to expend moves targeting before firing on certain targets */
int targeting_cost = 100; /** Moves consumed before first attack can be made */
bool require_targeting_player = true; /** By default always give player some warning */
bool require_targeting_npc = false;
bool require_targeting_monster = false;
int targeting_timeout = 8; /** Default turns after which targeting is lost and needs repeating */
int targeting_timeout_extend = 3; /** Increase timeout by this many turns after each shot */
std::string targeting_sound;
int targeting_volume = 6; /** If set to zero don't emit any targeting sounds */
bool laser_lock = false; /** Does switching between targets incur further targeting penalty */
bool no_crits =
false; /** If true then ranged shots no longer able to crit and your shots more likely going to hit body or limbs rather then head. */
/*@}*/
/** If true then disable this attack completely if not brightly lit */
bool require_sunlight = false;
bool try_target( monster &z, Creature &target ) const;
void shoot( monster &z, const tripoint &target, const gun_mode_id &mode,
int inital_recoil = 0 ) const;
int get_max_range() const;
gun_actor();
~gun_actor() override = default;
void load_internal( const JsonObject &obj, const std::string &src ) override;
bool call( monster & ) const override;
std::unique_ptr<mattack_actor> clone() const override;
};
#endif // CATA_SRC_MATTACK_ACTORS_H