Argentum Online - Servidor
potion.h
1
#ifndef POTION_H
2
#define POTION_H
3
4
#include "item.h"
5
#include "../entities/components/player_combat_component.h"
6
7
typedef
struct
potion_info
{
8
short
health_var;
9
short
mana_var;
10
}
potion_info_t
;
11
12
inline
void
to_json(nlohmann::json& j,
const
potion_info_t
& p) {
13
j[
"health_var"
] = p.health_var;
14
j[
"mana_var"
] = p.mana_var;
15
}
16
17
inline
void
from_json(
const
nlohmann::json& j,
potion_info_t
& p) {
18
j[
"health_var"
].get_to(p.health_var);
19
j[
"mana_var"
].get_to(p.mana_var);
20
}
21
22
class
Potion
:
public
Item
{
23
private
:
24
potion_info_t
potion_info
;
25
26
public
:
27
Potion
();
28
Potion
(
item_info_t
item_info
,
potion_info_t
potion_info
,
29
uint32_t stack = 0);
30
nlohmann::json get_data()
const override
;
31
void
use(
PlayerCombatComponent
& player_combat_component);
32
~
Potion
();
33
};
34
35
#endif // POTION_H
Item
Definition:
item.h:45
Potion
Definition:
potion.h:22
item_info
Definition:
item.h:21
PlayerCombatComponent
Definition:
player_combat_component.h:14
potion_info
Definition:
potion.h:7
server
game
items
potion.h
Generado por
1.8.19