aboutsummaryrefslogtreecommitdiff
path: root/src/test.cc
diff options
context:
space:
mode:
authorYour Name <you@example.com>2021-04-19 13:46:14 -0400
committerYour Name <you@example.com>2021-04-19 13:46:14 -0400
commit2cae1aa33f80ce0844fb54a84ce103146a7fe7ad (patch)
tree26945223a2672c5a80975a7b1998622da6edcc28 /src/test.cc
parent4618763c0e3a723bf4bb43c7b9edbce87240e0af (diff)
downloaddmtool-2cae1aa33f80ce0844fb54a84ce103146a7fe7ad.tar.gz
dmtool-2cae1aa33f80ce0844fb54a84ce103146a7fe7ad.tar.bz2
dmtool-2cae1aa33f80ce0844fb54a84ce103146a7fe7ad.zip
Started earnest work on cli
Diffstat (limited to 'src/test.cc')
-rw-r--r--src/test.cc53
1 files changed, 0 insertions, 53 deletions
diff --git a/src/test.cc b/src/test.cc
deleted file mode 100644
index 3c47537..0000000
--- a/src/test.cc
+++ /dev/null
@@ -1,53 +0,0 @@
-#include "creature.h"
-#include "feature.h"
-#include <iostream>
-#include <sstream>
-#include "rules.h"
-#include "utils.h"
-#include "item.h"
-#include "armor.h"
-#include "weapon.h"
-#include "spellcasting.h"
-
-using namespace std;
-
-template<typename T> vector<string> mapItems(const vector<shared_ptr<T>>& items) {
- vector<string> out;
- for(auto i : items) {
- out.push_back(i->getName());
- }
- return out;
-}
-
-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<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";
- }
- cout << "\nSkills:\n";
- for(auto skill : c.getSkills()) {
- cout << skill.first << " (+" << skill.second << ")\n";
- }
- cout << "\nSaves:\n";
- for(auto save : c.getSaves()) {
- cout << save.first << " (+" << save.second << ")\n";
- }
- cout << "\nFeatures:\n";
- for(auto f: c.getFeatures()) {
- cout << f->getText(c) << "\n";
- }
- cout << "\nInventory:\n";
- for(auto i : c.getInventory()) {
- cout << i->getText(c) << "\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";
-
- //cout << "Increasing str by 4...\n";
- //c.setScore("str", c.getScore("str") + 4);
- cout << "Saving to out.json...\n";
- utils::saveJson(c.toJson(), "out.json");
-}