-
Notifications
You must be signed in to change notification settings - Fork 89
/
item.h
127 lines (110 loc) · 3.53 KB
/
item.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
#ifndef _ITEM_H_
#define _ITEM_H_
#include <string>
#include <vector>
#include "itype.h"
#include "mtype.h"
//#include "npc.h"
class player;
class npc;
class item
{
public:
item();
item(itype* it, unsigned int turn);
item(itype* it, unsigned int turn, char let);
void make_corpse(itype* it, mtype* mt, unsigned int turn); // Corpse
item(std::string itemdata, game *g);
~item();
void make(itype* it);
// returns the default container of this item, with this item in it
item in_its_container(std::vector<itype*> *itypes);
nc_color color(player *u);
nc_color color_in_inventory(player *u);
std::string tname(game *g = NULL); // g needed for rotten-test
void use(player &u);
bool burn(int amount = 1); // Returns true if destroyed
// Firearm specifics
int reload_time(player &u);
int clip_size();
int accuracy();
int gun_damage(bool with_ammo = true);
int noise();
int burst_size();
int recoil(bool with_ammo = true);
int range(player *p = NULL);
ammotype ammo_type();
int pick_reload_ammo(player &u, bool interactive);
bool reload(player &u, int index);
std::string save_info(); // Formatted for save files
void load_info(std::string data, game *g);
std::string info(bool showtext = false); // Formatted for human viewing
char symbol();
nc_color color();
int price();
bool invlet_is_okay();
bool stacks_with(item rhs);
void put_in(item payload);
int weight();
int volume();
int volume_contained();
int attack_time();
int damage_bash();
int damage_cut();
bool has_flag(item_flag f);
bool has_technique(technique_id t, player *p = NULL);
std::vector<technique_id> techniques();
bool goes_bad();
bool count_by_charges();
bool craft_has_charges();
bool rotten(game *g);
// Our value as a weapon, given particular skills
int weapon_value(int skills[num_skill_types]);
// As above, but discounts its use as a ranged weapon
int melee_value (int skills[num_skill_types]);
// Returns the data associated with tech, if we are an it_style
style_move style_data(technique_id tech);
bool is_two_handed(player *u);
bool made_of(material mat);
bool conductive(); // Electricity
bool destroyed_at_zero_charges();
// Most of the is_whatever() functions call the same function in our itype
bool is_null(); // True if type is NULL, or points to the null item (id == 0)
bool is_food(player *u);// Some non-food items are food to certain players
bool is_food_container(player *u); // Ditto
bool is_food(); // Ignoring the ability to eat batteries, etc.
bool is_food_container(); // Ignoring the ability to eat batteries, etc.
bool is_drink();
bool is_weap();
bool is_bashing_weapon();
bool is_cutting_weapon();
bool is_gun();
bool is_gunmod();
bool is_bionic();
bool is_ammo();
bool is_armor();
bool is_book();
bool is_container();
bool is_tool();
bool is_software();
bool is_macguffin();
bool is_style();
bool is_other(); // Doesn't belong in other categories
bool is_artifact();
itype* type;
mtype* corpse;
it_ammo* curammo;
std::vector<item> contents;
std::string name;
char invlet; // Inventory letter
int charges;
bool active; // If true, it has active effects to be processed
signed char damage; // How much damage it's sustained; generally, max is 5
char burnt; // How badly we're burnt
unsigned int bday; // The turn on which it was created
int owned; // UID of NPC owner; 0 = player, -1 = unowned
int poison; // How badly poisoned is it?
int mission_id;// Refers to a mission in game's master list
int player_id; // Only give a mission to the right player!
};
#endif