From 38e33d8756a5b652965be8ada478b5c4238b857c Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 18 May 2021 16:26:49 -0400 Subject: Added spellcasting command --- src/creature.cc | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/creature.cc') 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 sc(new entry::Spellcasting()); + features.push_back(sc); + } + shared_ptr Creature::getSpellcasting() const { for(auto f : getFeatures()) { if(f->getType() == "spells") { -- cgit v1.2.3