diff options
author | Your Name <you@example.com> | 2021-04-29 14:17:08 -0400 |
---|---|---|
committer | Your Name <you@example.com> | 2021-04-29 14:17:08 -0400 |
commit | 5a813a75412ac9b8fadb90c9abd46dd95aee8e9b (patch) | |
tree | 75c5466d459c793430a6481cd276a624cd843794 /src/spellcasting.cc | |
parent | cd57ad6e208728bafcbc8c7d7b85d88603706978 (diff) | |
download | dmtool-5a813a75412ac9b8fadb90c9abd46dd95aee8e9b.tar.gz dmtool-5a813a75412ac9b8fadb90c9abd46dd95aee8e9b.tar.bz2 dmtool-5a813a75412ac9b8fadb90c9abd46dd95aee8e9b.zip |
Removed data files from repo
Diffstat (limited to 'src/spellcasting.cc')
-rw-r--r-- | src/spellcasting.cc | 32 |
1 files changed, 7 insertions, 25 deletions
diff --git a/src/spellcasting.cc b/src/spellcasting.cc index e36fd5b..9b39741 100644 --- a/src/spellcasting.cc +++ b/src/spellcasting.cc @@ -12,47 +12,29 @@ namespace entry { return genText(*this, c); } - string toOrdinal(size_t number) { - string suffix = "th"; - if (number % 100 < 11 || number % 100 > 13) { - switch (number % 10) { - case 1: - suffix = "st"; - break; - case 2: - suffix = "nd"; - break; - case 3: - suffix = "rd"; - break; - } - } - return to_string(number) + suffix; - } - string genText(const Spellcasting& s, const creature::Creature& c) { stringstream text; text << genText(static_cast<const Feature&>(s), c); - text << ": Spellcasting ability: " << s.getAbility().getFull(); + text << ": The " << c.getCreatureName() << "'s spellcasting ability is " << s.getAbility().getFull(); text << " (spell save DC " << 8 + c.getBonus(s.getAbility()) + c.getProficiency(); text << ", +" << c.getBonus(s.getAbility()) + c.getProficiency() << " to hit with spell attacks)."; if(s.isInnate()) { - text << " (spellcasting is innate)."; + text << " Spellcasting is innate."; } int levelNumber = 0; for(auto level : s.getSpellsBySlot()) { - text << "\n"; + text << endl; if(level.numSlots == 0) { if(s.isInnate()) { - text << "At will: "; + text << " At will: "; } else { - text << "Cantrips: "; + text << " Cantrips: "; } } else { if(s.isInnate()) { - text << level.numSlots << "/day each: "; + text << " " << level.numSlots << "/day each: "; } else { - text << toOrdinal(levelNumber) << " level (" << level.numSlots << " slots): "; + text << " " << utils::toOrdinal(levelNumber) << " level (" << level.numSlots << " slots): "; } } vector<string> names; |