forked from tanglewoodforest/src
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfight.h
More file actions
355 lines (276 loc) · 9.17 KB
/
fight.h
File metadata and controls
355 lines (276 loc) · 9.17 KB
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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
#ifndef twf_fight_h
#define twf_fight_h
/*
* ATTACK ROUTINES
*/
#define ATT_GARROTE -3
#define ATT_BACKSTAB -2
#define ATT_CHARGE -1
#define ATT_PHYSICAL 0
#define ATT_FIRE 1
#define ATT_COLD 2
#define ATT_ACID 3
#define ATT_SHOCK 4
#define ATT_MAGIC 5
#define ATT_MIND 6
#define ATT_SOUND 7
//#define MAX_ATTACK 8
/*
#define ATT_LEAP 0
#define ATT_DEFAULT 1
#define ATT_KICK 2
#define ATT_PUNCH 3
#define ATT_BITE 4
#define ATT_SPIN_KICK 5
#define ATT_BASH 6
#define ATT_BACKSTAB 7
#define ATT_FLEE 8
#define ATT_GARROTE 9
#define ATT_CHARGE 10
#define ATT_GOUGE 11
#define ATT_MELEE 12
*/
bool attack ( char_data*, char_data*, const char*, const char *,
obj_data*, int, int, int = ATT_PHYSICAL );
char_data* get_victim ( char_data*, const char *, const char * );
void add_round ( species_data*, int );
int player_round ( char_data*, char_data* );
int mob_round ( char_data*, char_data* );
bool set_fighting ( char_data*, char_data* );
void init_attack ( char_data*, char_data* = 0 );
void react_attack ( char_data*, char_data* );
void renter_combat ( char_data* );
void stop_fight ( char_data*, bool = false );
void set_attack ( char_data*, char_data* );
bool jump_feet ( char_data* );
void leap_message ( char_data*, char_data* );
void fight_round ( char_data* );
bool can_kill ( char_data*, char_data* = 0, bool = true );
bool can_pkill ( char_data*, char_data* = 0, bool = true );
bool in_sanctuary ( char_data*, bool = true );
char_data *opponent ( char_data* );
char_data *opponent2 ( char_data* );
char_data *opponent3 ( char_data* );
bool can_defend ( char_data*, char_data* );
bool damage_weapon ( char_data*, obj_data*& );
void update_aggression ( char_data* );
void update_aggression ( room_data* );
bool is_fighting ( char_data*, const char* = empty_string );
bool not_fighting ( char_data*, const char* = empty_string );
void get_wield( char_data *ch, obj_data *& wield, obj_data *& secondary, obj_data *& shield );
bool join_fight( char_data* victim, char_data* ch, char_data* rch );
bool trigger_attack( char_data* ch, char_data* victim );
const char *attack_noun ( int );
const char *attack_verb ( int );
bool uses_claws ( char_data* );
/*
* DAMAGE ROUTINES
*/
const char* condition_short ( char_data* );
const char* condition_short ( char_data*, char_data* );
const char* word_physical ( int );
#define cd char_data
bool damage_fire ( cd*, cd*, int, const char*, bool = false,
const char* = "fire" );
bool damage_cold ( cd*, cd*, int, const char*, bool = false,
const char* = "cold" );
bool damage_mind ( cd*, cd*, int, const char*, bool = false,
const char* = "a mind attack" );
bool damage_physical ( cd*, cd*, int, const char*, bool = false,
const char* = "physical damage" );
bool damage_shock ( cd*, cd*, int, const char*, bool = false,
const char* = "electricity" );
bool damage_magic ( cd*, cd*, int, const char*, bool = false,
const char* = "magic" );
bool damage_acid ( cd*, cd*, int, const char*, bool = false,
const char* = "acid" );
bool damage_sound ( cd*, cd*, int, const char*, bool = false,
const char* = "sound" );
bool inflict ( cd*, cd*, int, const char*, bool = false );
void dam_message ( cd*, cd*, int, const char*, const char* );
void dam_local ( cd*, cd*, int, const char*, bool, const char* );
#undef cd
extern const index_data physical_index [];
extern const index_data shock_index [];
extern const index_data fire_index [];
extern const index_data cold_index [];
extern const index_data acid_index [];
extern const index_data sound_index [];
/*
* DEATH
*/
void death_message ( char_data* );
/*
* EXP ROUTINES
*/
void add_exp ( char_data*, int, const char* = 0 );
int exp_for_level ( int );
int death_exp ( char_data*, char_data* );
void disburse_exp ( char_data* );
inline int exp_for_level( char_data* ch )
{
return exp_for_level( ch->Level( ) );
}
/*
* ENEMY ROUTINES
*/
bool is_enemy ( char_data*, char_data* );
int damage_done ( char_data*, char_data* );
void clear_enemies ( char_data* );
void record_damage ( char_data*, char_data*, int = 0 );
void share_enemies ( char_data*, char_data* );
/*
* FLEE ROUTINES
*/
void check_wimpy ( char_data* );
bool attempt_flee ( char_data*, exit_data* = 0 );
/*
* WEAPONS
*/
const char* weapon_class( const obj_clss_data* );
const char* weapon_class( const obj_data* );
/*
* SPAM ROUTINES
*/
void spam_char ( char_data*, const char* );
template < class T >
void spam_char( char_data* ch, const char* text, T item )
{
if( !ch->link
|| !is_set( ch->pcdata->message, MSG_MISSES ) )
return;
fsend( ch, text, item );
}
template < class S, class T >
void spam_char( char_data* ch, const char* text, S item1, T item2 )
{
if( !ch->link
|| !is_set( ch->pcdata->message, MSG_MISSES ) )
return;
fsend( ch, text, item1, item2 );
}
template < class S, class T, class U >
void spam_char( char_data* ch, const char* text, S item1, T item2, U item3 )
{
if( !ch->link
|| !is_set( ch->pcdata->message, MSG_MISSES ) )
return;
fsend( ch, text, item1, item2, item3 );
}
template < class S, class T, class U, class V >
void spam_char( char_data* ch, const char* text, S item1, T item2, U item3, V item4 )
{
if( !ch->link
|| !is_set( ch->pcdata->message, MSG_MISSES ) )
return;
fsend( ch, text, item1, item2, item3, item4 );
}
void spam_room( char_data*, const char* );
template < class T >
void spam_room( char_data *ch, const char *text, T item )
{
clear_send_buffers( );
for( int i = 0; i < *ch->array; ++i ) {
char_data *rch = character( ch->array->list[i] );
if( !rch
|| !rch->link
|| rch == ch
|| !rch->Can_See()
|| !is_set( rch->pcdata->message, MSG_MISSES )
|| rch == (char_data*) item )
continue;
fsend( rch, text,
buffer( 0, item ) );
}
}
template < class S, class T >
void spam_room( char_data *ch, const char *text, S item1, T item2 )
{
clear_send_buffers( );
for( int i = 0; i < *ch->array; ++i ) {
char_data *rch = character( ch->array->list[i] );
if( !rch
|| !rch->link
|| rch == ch
|| !rch->Can_See()
|| !is_set( rch->pcdata->message, MSG_MISSES )
|| rch == (char_data*) item1
|| rch == (char_data*) item2 )
continue;
fsend( rch, text,
buffer( 0, item1 ),
buffer( 1, item2 ) );
}
}
template < class S, class T, class U >
void spam_room( char_data *ch, const char *text, S item1, T item2, U item3 )
{
clear_send_buffers( );
for( int i = 0; i < *ch->array; ++i ) {
char_data *rch = character( ch->array->list[i] );
if( !rch
|| !rch->link
|| rch == ch
|| !rch->Can_See()
|| !is_set( rch->pcdata->message, MSG_MISSES )
|| rch == (char_data*) item1
|| rch == (char_data*) item2
|| rch == (char_data*) item3 )
continue;
fsend( rch, text,
buffer( 0, item1 ),
buffer( 1, item2 ),
buffer( 2, item3 ) );
}
}
template < class S, class T, class U, class V >
void spam_room( char_data *ch, const char *text, S item1, T item2, U item3, V item4 )
{
clear_send_buffers( );
for( int i = 0; i < *ch->array; ++i ) {
char_data *rch = character( ch->array->list[i] );
if( !rch
|| !rch->link
|| rch == ch
|| !rch->Can_See()
|| !is_set( rch->pcdata->message, MSG_MISSES )
|| rch == (char_data*) item1
|| rch == (char_data*) item2
|| rch == (char_data*) item3
|| rch == (char_data*) item4 )
continue;
fsend( rch, text,
buffer( 0, item1 ),
buffer( 1, item2 ),
buffer( 2, item3 ),
buffer( 3, item4 ) );
}
}
template < class S, class T, class U, class V, class W >
void spam_room( char_data *ch, const char *text,
S item1, T item2, U item3, V item4, W item5 )
{
clear_send_buffers( );
for( int i = 0; i < *ch->array; ++i ) {
char_data *rch = character( ch->array->list[i] );
if( !rch
|| !rch->link
|| rch == ch
|| !rch->Can_See()
|| !is_set( rch->pcdata->message, MSG_MISSES )
|| rch == (char_data*) item1
|| rch == (char_data*) item2
|| rch == (char_data*) item3
|| rch == (char_data*) item4
|| rch == (char_data*) item5 )
continue;
fsend( rch, text,
buffer( 0, item1 ),
buffer( 1, item2 ),
buffer( 2, item3 ),
buffer( 3, item4 ),
buffer( 4, item5 ) );
}
}
//void spam_room ( const char*, char_data*, char_data*, thing_data* = 0 );
#endif // twf_fight_h