Repository navigation
Expand file tree
/
Copy pathattack.h
More file actions
118 lines (97 loc) · 3.21 KB
/
Copy pathattack.h
File metadata and controls
118 lines (97 loc) · 3.21 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
#ifndef _ATTACK_H_
#define _ATTACK_H_
#include "enum.h"
#include "dice.h"
#include "geometry.h" // For Tripoint
#include "damage_set.h"
#include "field.h"
#include "skill.h"
#include <string>
#include <vector>
#include <istream>
Body_part random_body_part_to_hit();
struct Stats;
class Item;
class Field_type;
class Field_pool;
/* TODO: Special effects. It'd be nice to specify that an attack (or an item
* from which attacks are derived) has the ability to knock the target
* back a tile or two, to poison them, to stun them, etc.
* TODO: Special effects bound to damage type. Like in Cataclysm 1. Bashing
* could stun the target, cutting could cause bleeding or something, and
* piercing could "skewer" them, reducing speed but also possibly yanking
* the attacker's weapon out of their hands.
*/
enum Melee_hit_type
{
MELEE_HIT_NULL = 0,
MELEE_HIT_GRAZE,
MELEE_HIT_NORMAL,
MELEE_HIT_CRITICAL,
MELEE_HIT_MAX
};
enum Ranged_attack_type
{
RANGED_ATT_NULL = 0,
RANGED_ATT_THROW,
RANGED_ATT_FIRE,
RANGED_ATT_OTHER,
RANGED_ATT_MAX
};
struct Attack
{
std::string verb_second;
std::string verb_third;
int weight; // For monster attacks - how likely this attack is to be used
int speed;
int to_hit;
int damage[DAMAGE_MAX];
bool using_weapon;
Attack();
~Attack();
bool load_data(std::istream &data, std::string owner_name = "unknown");
void use_weapon(Item weapon, Stats stats); // Stats is only used for speed
void adjust_with_stats(Stats stats); // Adjusts damage
void adjust_with_skills(Skill_set skills); // Adjusts damage, speed, to_hit
Damage_set roll_damage(Melee_hit_type hit_type = MELEE_HIT_NORMAL);
int roll_damage_type(Damage_type type,
Melee_hit_type hit_type = MELEE_HIT_NORMAL);
};
enum Ranged_hit_type
{
RANGED_HIT_NULL = 0,
RANGED_HIT_GRAZE, // Damage is between 0 and full
RANGED_HIT_NORMAL, // Damage is between 80% and 100%
RANGED_HIT_CRITICAL, // Damage is between 100% and 150%
RANGED_HIT_HEADSHOT, // Damage is between 300% and 500%
RANGED_HIT_MAX
};
struct Ranged_attack
{
Ranged_attack();
~Ranged_attack();
Ranged_attack_type type; // Fire, throw, or other (i.e. natural)
std::string verb_second;
std::string verb_third;
int weight; // Monster attacks - how likely this attack is to be used
int speed; // AP used
int charge_time; // Monster attacks - how frequently can we use this?
int range; // Max range of the attack
int rounds; // How many rounds are fired?
int pellets; // How many pellets included per round? Mainly for shot.
Dice variance; // In 1/10ths of a degree
int damage [DAMAGE_MAX];
int armor_divisor[DAMAGE_MAX];// Times 10; 20 = halve the armor, 5 = double it
/* TODO: Add the following as they're implemented:
* Status_effect this causes (Blinding, stunning, etc)
* Other???
*/
// Field_pool that we leave in our wake
Field_pool wake_field;
// Field_pool that is created at the tile hit
Field_pool target_field;
bool load_data(std::istream &data, std::string owner_name = "unknown");
int roll_variance();
Damage_set roll_damage(Ranged_hit_type hit = RANGED_HIT_NORMAL);
};
#endif