diff options
author | Your Name <you@example.com> | 2021-04-16 11:23:27 -0400 |
---|---|---|
committer | Your Name <you@example.com> | 2021-04-16 11:23:27 -0400 |
commit | 4618763c0e3a723bf4bb43c7b9edbce87240e0af (patch) | |
tree | a18aa4bf7da05ac02b4e37b199aeeb82da977aea /src/test.cc | |
parent | dfce4d0398a8bafbb7ad7a31345af181c0269c09 (diff) | |
download | dmtool-4618763c0e3a723bf4bb43c7b9edbce87240e0af.tar.gz dmtool-4618763c0e3a723bf4bb43c7b9edbce87240e0af.tar.bz2 dmtool-4618763c0e3a723bf4bb43c7b9edbce87240e0af.zip |
Rebased feature/item on entry
Diffstat (limited to 'src/test.cc')
-rw-r--r-- | src/test.cc | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/src/test.cc b/src/test.cc index 1ce3d90..3c47537 100644 --- a/src/test.cc +++ b/src/test.cc @@ -7,6 +7,7 @@ #include "item.h" #include "armor.h" #include "weapon.h" +#include "spellcasting.h" using namespace std; @@ -20,7 +21,7 @@ template<typename T> vector<string> mapItems(const vector<shared_ptr<T>>& items) int main(int argc, char *argv[]) { creature::Creature c(utils::loadJson(argv[argc-1])); - cout << c.getCreatureName() << " " << c.getGivenName() << ", a cr " << c.getCR() << " " << c.getAlignment() << " " << c.getSize() << " " << c.getType() << ", has " << c.getHP() << " hp, ac " << creature::getAC(c) << " (" << utils::join(mapItems(creature::getItems<item::Armor>(c)), ", ") << "), speaks " << c.getLanguages() << ", has " << utils::join(c.getSenses(), ", ") << ", speed " << c.getSpeed() << ", and wields " << utils::join(mapItems(creature::getItems<item::Weapon>(c)), ", ") << ".\n Stats:\n"; + cout << c.getCreatureName() << " " << c.getGivenName() << ", a cr " << c.getCR() << " " << c.getAlignment() << " " << c.getSize() << " " << c.getType() << ", has " << c.getHP() << " hp, ac " << creature::getAC(c) << " (" << utils::join(mapItems(creature::getItems<entry::Armor>(c)), ", ") << "), speaks " << c.getLanguages() << ", has " << utils::join(c.getSenses(), ", ") << ", speed " << c.getSpeed() << ", and wields " << utils::join(mapItems(creature::getItems<entry::Weapon>(c)), ", ") << ".\n Stats:\n"; for(auto ability : abilities) { cout << ability << ": " << c.getScore(ability) << " (" << c.getBonus(ability) << ")\n"; } @@ -34,21 +35,14 @@ int main(int argc, char *argv[]) { } cout << "\nFeatures:\n"; for(auto f: c.getFeatures()) { - cout << f->getName() << " (" << f->getType() << "):\n"; - cout << f->getText() << "\n\n"; + cout << f->getText(c) << "\n"; } - cout << "\nWeapons:\n"; - for(auto w : creature::getItems<item::Weapon>(c)) { - cout << w->getName() << " (" << w->getCost() << " cp, i.e., " << utils::getCostString(w->getCost()) << ", " << w->getWeight() << "lbs): "; - cout << item::genActionText(*w, c); - } - cout << "\nArmor:\n"; - for(auto a : creature::getItems<item::Armor>(c)) { - cout << a->getName() << " (" << a->getCost() << " cp, i.e., " << utils::getCostString(a->getCost()) << ", " << a->getWeight() << "lbs): "; - cout << "AC bonus: " << a->getACBonus() << "; type: " << a->getArmorType() << "; strReq: " << a->getStrRequirement() << "; stealthDis: " << a->stealthDisadvantage() << "\n"; + cout << "\nInventory:\n"; + for(auto i : c.getInventory()) { + cout << i->getText(c) << "\n"; } - cout << "We strike him with mace, dealing 5 fire damage!\n"; + cout << "\nWe strike him with mace, dealing 5 fire damage!\n"; c.applyDamage(5, "fire", vector<string>()); cout << "Now he has " << c.getHP() << " out of " << c.getHPMax() << " hp.\n"; |