aboutsummaryrefslogtreecommitdiff
path: root/src/creature.cc
diff options
context:
space:
mode:
authorYour Name <you@example.com>2021-05-18 16:26:49 -0400
committerYour Name <you@example.com>2021-05-18 16:26:49 -0400
commit38e33d8756a5b652965be8ada478b5c4238b857c (patch)
treed4e3b166103c4c0cc8d3a4ed963333a2982bb366 /src/creature.cc
parente044fc4255aa64ef1dbc3d20ed87ed6e2f61a6bd (diff)
downloaddmtool-38e33d8756a5b652965be8ada478b5c4238b857c.tar.gz
dmtool-38e33d8756a5b652965be8ada478b5c4238b857c.tar.bz2
dmtool-38e33d8756a5b652965be8ada478b5c4238b857c.zip
Added spellcasting command
Diffstat (limited to 'src/creature.cc')
-rw-r--r--src/creature.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/creature.cc b/src/creature.cc
index 9366bac..7060c10 100644
--- a/src/creature.cc
+++ b/src/creature.cc
@@ -80,6 +80,14 @@ namespace creature {
inventory.push_back(item);
}
+ void Creature::addSpellcasting() {
+ if(getSpellcasting()) {
+ throw runtime_error("Creature " + getName() + " already has spellcasting");
+ }
+ std::shared_ptr<entry::Feature> sc(new entry::Spellcasting());
+ features.push_back(sc);
+ }
+
shared_ptr<entry::Spellcasting> Creature::getSpellcasting() const {
for(auto f : getFeatures()) {
if(f->getType() == "spells") {