blob: dc81689077ddc21d7274222d83957bc2aa4b63e5 (
plain)
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
|
#pragma once
#include "item.h"
#include "rules.h"
#include <nlohmann/json.hpp>
#include <set>
namespace creature {
class Creature;
}
namespace entry {
class Weapon;
class Damage;
struct weaponImpl;
std::vector<rules::Ability> getAbilityOptions(const Weapon& w);
std::vector<Damage> rollDmg(const Weapon& w, bool versatile=false);
// Prints for both versatile options (if applicable)
std::string formatDmg(const Weapon& w, const creature::Creature& c);
// Prints for just the dmg provided
std::string formatDmg(const Weapon& w, const creature::Creature& c, const std::vector<Damage>& dmg);
struct Damage {
int dmg_die_count;
int dmg_die_sides;
std::string dmg_type;
bool is_or;
int rolled = 0;
};
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Damage, dmg_die_count, dmg_die_sides, dmg_type, is_or);
class Weapon : public Item {
public:
Weapon();
std::vector<Damage> getDamage(void) const;
std::set<std::string> getProperties(void) const;
std::string getWeaponType(void) const;
std::pair<int, int> getRange(void) const;
int getReach(void) const;
int getToHitBonus(const creature::Creature& c) const;
int getDamageBonus(const creature::Creature& c) const;
virtual std::string getText() const override;
virtual std::string getText(const creature::Creature& c) const override;
NLOHMANN_FRIEND_DECLARES(Weapon);
private:
std::shared_ptr<weaponImpl> data;
};
}
|