blob: 54284c75dcd6c224d51a3b749e91bd4f5fe7e64a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#include "armor.h"
#include "creature.h"
#include "entry.h"
#include "rules.h"
#include <string>
#include <sstream>
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<const Item&>(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<const Substantial&>(a));
return text.str();
}
}
|