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