diff options
author | Your Name <you@example.com> | 2021-06-12 15:32:53 -0400 |
---|---|---|
committer | Your Name <you@example.com> | 2021-06-12 15:32:53 -0400 |
commit | 01293baa64fa905c5763020bd6c0b4903d41fc78 (patch) | |
tree | 4c49a63852fd84ead388a8fd092d64d2df7f9e1b /src/item.cc | |
parent | b27700a7e0b281ece3dea23060c17e0cae28715d (diff) | |
download | dmtool-01293baa64fa905c5763020bd6c0b4903d41fc78.tar.gz dmtool-01293baa64fa905c5763020bd6c0b4903d41fc78.tar.bz2 dmtool-01293baa64fa905c5763020bd6c0b4903d41fc78.zip |
Verified some creature attacks
Diffstat (limited to 'src/item.cc')
-rw-r--r-- | src/item.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/item.cc b/src/item.cc index 3bb9895..5ecdb0c 100644 --- a/src/item.cc +++ b/src/item.cc @@ -11,8 +11,12 @@ using namespace std; namespace entry { shared_ptr<Item> Item::create(const nlohmann::json& data) { - if(data["type"] == "weapons") { - return utils::loadDFromJson<Item, Weapon>(data); + if(data["type"] == "weapons" || data["type"] == "spell attack") { + auto w = utils::loadDFromJson<Item, Weapon>(data); + if(! data["text"].empty()) { + w->Entry::setText(data["text"]); + } + return w; } else if(data["type"] == "armor") { return utils::loadDFromJson<Item, Armor>(data); } |