Argentum Online - Servidor
armor.h
1
#ifndef ARMOR_H
2
#define ARMOR_H
3
4
#include "item.h"
5
6
typedef
enum
{ helmet, chest, shield } slot_info_t;
7
8
typedef
struct
armor_info
{
9
uint16_t min_defense;
10
uint16_t max_defense;
11
slot_info_t slot_info;
12
}
armor_info_t
;
13
14
inline
void
to_json(nlohmann::json& j,
const
armor_info_t
& a) {
15
j[
"min_defense"
] = a.min_defense;
16
j[
"max_defense"
] = a.max_defense;
17
j[
"slot_info"
] = a.slot_info;
18
}
19
20
inline
void
from_json(
const
nlohmann::json& j,
armor_info_t
& a) {
21
j[
"min_defense"
].get_to(a.min_defense);
22
j[
"max_defense"
].get_to(a.max_defense);
23
j[
"slot_info"
].get_to(a.slot_info);
24
}
25
26
class
Armor
:
public
Item
{
27
private
:
28
armor_info_t
armor_info
;
29
30
public
:
31
Armor
();
32
Armor
(
item_info_t
item_info
,
armor_info_t
armor_info
, uint32_t stack = 0);
33
int
reduce_damage(
int
damage);
34
nlohmann::json get_data()
const override
;
35
slot_info_t get_slot()
const
;
36
~
Armor
();
37
};
38
39
#endif // ARMOR_H
Item
Definition:
item.h:45
Armor
Definition:
armor.h:26
item_info
Definition:
item.h:21
armor_info
Definition:
armor.h:8
server
game
items
armor.h
Generado por
1.8.19