diff options
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"; |