diff options
author | Your Name <you@example.com> | 2021-04-13 15:14:34 -0400 |
---|---|---|
committer | Your Name <you@example.com> | 2021-04-13 15:14:34 -0400 |
commit | 2ab51e507d620c4479e07ca0ec47d22c8c66bc90 (patch) | |
tree | 90906ecb043c01034280c767b83a88eb6df6956f /src/armor.cc | |
download | dmtool-2ab51e507d620c4479e07ca0ec47d22c8c66bc90.tar.gz dmtool-2ab51e507d620c4479e07ca0ec47d22c8c66bc90.tar.bz2 dmtool-2ab51e507d620c4479e07ca0ec47d22c8c66bc90.zip |
Initial commit
Diffstat (limited to 'src/armor.cc')
-rw-r--r-- | src/armor.cc | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/armor.cc b/src/armor.cc new file mode 100644 index 0000000..00e1b05 --- /dev/null +++ b/src/armor.cc @@ -0,0 +1,33 @@ +#include "json.hpp" +#include "armor.h" + +using namespace std; + +namespace item { + Armor::Armor(const nlohmann::json& data) : Item(data), acBonus(data["ac"]), armorType(data["type"]), strRequirement(data["strength"]), stealthDis(data["disadvantage"]) {} + + int Armor::getACBonus() const { + return acBonus; + } + + string Armor::getArmorType() const { + return armorType; + } + + int Armor::getStrRequirement() const { + return strRequirement; + } + + bool Armor::stealthDisadvantage() const { + return stealthDis; + } + + nlohmann::json Armor::toJson() const { + auto data = Item::toJson(); + data["ac"] = acBonus; + data["type"] = armorType; + data["strength"] = strRequirement; + data["disadvantage"] = stealthDis; + return data; + } +} |