aboutsummaryrefslogtreecommitdiff
path: root/src/creature.cc
diff options
context:
space:
mode:
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") {