#include "armor.h" #include "creature.h" #include "entry.h" #include "rules.h" #include #include using namespace std; namespace entry{ string getTextHelper(const Armor& a, string dexBonusLight, string dexBonusMedium) { stringstream text; text << "AC: " << a.getACBonus(); if(a.getArmorType() == "light") { text << " + dex" << dexBonusLight; } else if(a.getArmorType() == "medium") { text << " + dex max 2" << dexBonusMedium; } if(a.getStrRequirement() > 0) { text << ", Mininum str: " << a.getStrRequirement(); } if(a.stealthDisadvantage()) { text << ", Imposes stealth disadvantage"; } text << ". " << genText(static_cast(a)); return text.str(); } string Armor::getText() const { return getTextHelper(*this, "", ""); } string genText(const Armor& a, const creature::Creature& c) { stringstream text; text << genText(static_cast(a), c); int dex = c.getBonus(rules::Ability::Dex()); string dexBonusLight = " (i.e., " + to_string(a.getACBonus() + dex) + ")"; string dexBonusMedium = " (i.e., " + to_string(a.getACBonus() + ((dex > 2)? 2 : dex)) + ")"; text << ": " << getTextHelper(a, dexBonusLight, dexBonusMedium); return text.str(); } }