From 12f7bae526b89aecb024b5f61d2cd77528e5c602 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Sat, 7 Apr 2012 18:37:41 +0200 Subject: [PATCH 1/8] added known spells and selected spell to NpcStats --- apps/openmw/mwmechanics/npcstats.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/openmw/mwmechanics/npcstats.hpp b/apps/openmw/mwmechanics/npcstats.hpp index aeb5f56d5..59bfa2ac0 100644 --- a/apps/openmw/mwmechanics/npcstats.hpp +++ b/apps/openmw/mwmechanics/npcstats.hpp @@ -2,6 +2,7 @@ #define GAME_MWMECHANICS_NPCSTATS_H #include +#include #include "stat.hpp" @@ -25,6 +26,9 @@ namespace MWMechanics bool mSneak; bool mCombat; + std::set mKnownSpells; + std::string mSelectedSpell; // can be an empty string (no spell selected) + NpcStats() : mForceRun (false), mForceSneak (false), mRun (false), mSneak (false), mCombat (false) {} }; From c94d6830145dcad282e8c3ac412308746c8692a2 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Sat, 7 Apr 2012 18:46:50 +0200 Subject: [PATCH 2/8] fill in initial spell list from NPC record --- apps/openmw/mwclass/npc.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/openmw/mwclass/npc.cpp b/apps/openmw/mwclass/npc.cpp index 83a94d27d..2cf4cf41c 100644 --- a/apps/openmw/mwclass/npc.cpp +++ b/apps/openmw/mwclass/npc.cpp @@ -61,6 +61,10 @@ namespace MWClass for (int i=0; i<27; ++i) data->mNpcStats.mSkill[i].setBase (ref->base->npdt52.skills[i]); + for (std::vector::const_iterator iter (ref->base->spells.list.begin()); + iter!=ref->base->spells.list.end(); ++iter) + data->mNpcStats.mKnownSpells.insert (*iter); + // creature stats data->mCreatureStats.mAttributes[0].set (ref->base->npdt52.strength); data->mCreatureStats.mAttributes[1].set (ref->base->npdt52.intelligence); From 750d79eaf032ca8bd21f33899853e5a3595e311c Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Wed, 11 Apr 2012 18:29:36 +0200 Subject: [PATCH 3/8] added spell container class --- apps/openmw/CMakeLists.txt | 2 +- apps/openmw/mwmechanics/spells.cpp | 77 ++++++++++++++++++++++++++++++ apps/openmw/mwmechanics/spells.hpp | 55 +++++++++++++++++++++ 3 files changed, 133 insertions(+), 1 deletion(-) create mode 100644 apps/openmw/mwmechanics/spells.cpp create mode 100644 apps/openmw/mwmechanics/spells.hpp diff --git a/apps/openmw/CMakeLists.txt b/apps/openmw/CMakeLists.txt index c31a9d8fd..79f0948f9 100644 --- a/apps/openmw/CMakeLists.txt +++ b/apps/openmw/CMakeLists.txt @@ -55,7 +55,7 @@ add_openmw_dir (mwclass ) add_openmw_dir (mwmechanics - mechanicsmanager stat creaturestats magiceffects movement + mechanicsmanager stat creaturestats magiceffects movement spells ) # Main executable diff --git a/apps/openmw/mwmechanics/spells.cpp b/apps/openmw/mwmechanics/spells.cpp new file mode 100644 index 000000000..2b28f0c2f --- /dev/null +++ b/apps/openmw/mwmechanics/spells.cpp @@ -0,0 +1,77 @@ + +#include "spells.hpp" + +#include + +#include "../mwworld/environment.hpp" +#include "../mwworld/world.hpp" + +#include "magiceffects.hpp" + +namespace MWMechanics +{ + void Spells::addSpell (const ESM::Spell *spell, MagicEffects& effects) const + { + for (std::vector::const_iterator iter = spell->effects.list.begin(); + iter!=spell->effects.list.end(); ++iter) + { + EffectParam param; + param.mMagnitude = iter->magnMax; /// \todo calculate magnitude + effects.add (EffectKey (*iter), param); + } + } + + Spells::TIterator Spells::begin (ESM::Spell::SpellType type) const + { + assert (type>=0 && type=0 && typegetStore().spells.find (spellId); + + int type = spell->data.type; + + assert (type>=0 && typegetStore().spells.find (spellId); + + int type = spell->data.type; + + TContainer::iterator iter = std::find (mSpells[type].begin(), mSpells[type].end(), spell); + + if (iter!=mSpells[type].end()) + mSpells[type].erase (iter); + } + + MagicEffects Spells::getMagicEffects (MWWorld::Environment& environment) const + { + MagicEffects effects; + + for (int i=ESM::Spell::ST_Ability; i<=ESM::Spell::ST_Curse; ++i) + for (TIterator iter (begin (static_cast (i))); + iter!=end(static_cast (i)); ++iter) + addSpell (*iter, effects); + + return effects; + } + + void Spells::clear() + { + for (int i=0; i + +#include + +namespace MWWorld +{ + struct Environment; +} + +namespace MWMechanics +{ + class MagicEffects; + + /// \brief Spell list + /// + /// This class manages known spells as well as abilities, powers and permanent negative effects like + /// diseaes. + class Spells + { + public: + + typedef std::vector TContainer; + typedef TContainer::const_iterator TIterator; + + private: + + static const int sTypes = 6; + + std::vector mSpells[sTypes]; + + void addSpell (const ESM::Spell *, MagicEffects& effects) const; + + public: + + TIterator begin (ESM::Spell::SpellType type) const; + + TIterator end (ESM::Spell::SpellType type) const; + + void add (const std::string& spell, MWWorld::Environment& environment); + /// \note Adding a spell that is already listed in *this is a no-op. + + void remove (const std::string& spell, MWWorld::Environment& environment); + + MagicEffects getMagicEffects (MWWorld::Environment& environment) const; + ///< Return sum of magic effects resulting from abilities, blights, deseases and curses. + + void clear(); + ///< Remove all spells of al types. + }; +} + +#endif From e04ccfced0867c27f8ab049096abad91f9a65b09 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Wed, 11 Apr 2012 19:03:36 +0200 Subject: [PATCH 4/8] replaced old abilities container in CreatureStats with a Spells object --- apps/openmw/mwmechanics/creaturestats.hpp | 3 +- apps/openmw/mwmechanics/mechanicsmanager.cpp | 55 ++------------------ apps/openmw/mwmechanics/mechanicsmanager.hpp | 2 - 3 files changed, 7 insertions(+), 53 deletions(-) diff --git a/apps/openmw/mwmechanics/creaturestats.hpp b/apps/openmw/mwmechanics/creaturestats.hpp index d2edc031d..ab008da9e 100644 --- a/apps/openmw/mwmechanics/creaturestats.hpp +++ b/apps/openmw/mwmechanics/creaturestats.hpp @@ -6,6 +6,7 @@ #include "stat.hpp" #include "magiceffects.hpp" +#include "spells.hpp" namespace MWMechanics { @@ -14,7 +15,7 @@ namespace MWMechanics Stat mAttributes[8]; DynamicStat mDynamic[3]; // health, magicka, fatigue int mLevel; - std::set mAbilities; + Spells mSpells; MagicEffects mMagicEffects; }; } diff --git a/apps/openmw/mwmechanics/mechanicsmanager.cpp b/apps/openmw/mwmechanics/mechanicsmanager.cpp index 7ed81f785..00453eee5 100644 --- a/apps/openmw/mwmechanics/mechanicsmanager.cpp +++ b/apps/openmw/mwmechanics/mechanicsmanager.cpp @@ -23,7 +23,7 @@ namespace MWMechanics // reset creatureStats.mLevel = player->npdt52.level; - creatureStats.mAbilities.clear(); + creatureStats.mSpells.clear(); creatureStats.mMagicEffects = MagicEffects(); for (int i=0; i<27; ++i) @@ -71,7 +71,7 @@ namespace MWMechanics for (std::vector::const_iterator iter (race->powers.list.begin()); iter!=race->powers.list.end(); ++iter) { - insertSpell (*iter, ptr); + creatureStats.mSpells.add (*iter, mEnvironment); } } @@ -85,7 +85,7 @@ namespace MWMechanics for (std::vector::const_iterator iter (sign->powers.list.begin()); iter!=sign->powers.list.end(); ++iter) { - insertSpell (*iter, ptr); + creatureStats.mSpells.add (*iter, mEnvironment); } } @@ -159,59 +159,14 @@ namespace MWMechanics creatureStats.mDynamic[i].setCurrent (creatureStats.mDynamic[i].getModified()); } - void MechanicsManager::insertSpell (const std::string& id, MWWorld::Ptr& creature) - { - MWMechanics::CreatureStats& creatureStats = - MWWorld::Class::get (creature).getCreatureStats (creature); - - const ESM::Spell *spell = mEnvironment.mWorld->getStore().spells.find (id); - - switch (spell->data.type) - { - case ESM::Spell::ST_Ability: - - if (creatureStats.mAbilities.find (id)==creatureStats.mAbilities.end()) - { - creatureStats.mAbilities.insert (id); - } - - break; - - // TODO ST_SPELL, ST_Blight, ST_Disease, ST_Curse, ST_Power - - default: - - std::cout - << "adding unsupported spell type (" << spell->data.type - << ") to creature: " << id << std::endl; - } - } - void MechanicsManager::adjustMagicEffects (MWWorld::Ptr& creature) { MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get (creature).getCreatureStats (creature); - MagicEffects now; - - for (std::set::const_iterator iter (creatureStats.mAbilities.begin()); - iter!=creatureStats.mAbilities.end(); ++iter) - { - const ESM::Spell *spell = mEnvironment.mWorld->getStore().spells.find (*iter); - - for (std::vector::const_iterator iter = spell->effects.list.begin(); - iter!=spell->effects.list.end(); ++iter) - { - if (iter->range==0) // self - { - EffectParam param; - param.mMagnitude = iter->magnMax; // TODO calculate magnitude - now.add (EffectKey (*iter), param); - } - } - } + MagicEffects now = creatureStats.mSpells.getMagicEffects (mEnvironment); - // TODO add effects from other spell types, active spells and equipment + /// \todo add effects from active spells and equipment MagicEffects diff = MagicEffects::diff (creatureStats.mMagicEffects, now); diff --git a/apps/openmw/mwmechanics/mechanicsmanager.hpp b/apps/openmw/mwmechanics/mechanicsmanager.hpp index 2e2192638..8975329dd 100644 --- a/apps/openmw/mwmechanics/mechanicsmanager.hpp +++ b/apps/openmw/mwmechanics/mechanicsmanager.hpp @@ -37,8 +37,6 @@ namespace MWMechanics ///< build player according to stored class/race/birthsign information. Will /// default to the values of the ESM::NPC object, if no explicit information is given. - void insertSpell (const std::string& id, MWWorld::Ptr& creature); - void adjustMagicEffects (MWWorld::Ptr& creature); public: From 77065390d7de2c09a9972e3fda90c9ed73255644 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Wed, 11 Apr 2012 19:40:42 +0200 Subject: [PATCH 5/8] simplifying Spells class --- apps/openmw/mwmechanics/mechanicsmanager.cpp | 4 +- apps/openmw/mwmechanics/spells.cpp | 53 ++++++++------------ apps/openmw/mwmechanics/spells.hpp | 24 +++++---- 3 files changed, 37 insertions(+), 44 deletions(-) diff --git a/apps/openmw/mwmechanics/mechanicsmanager.cpp b/apps/openmw/mwmechanics/mechanicsmanager.cpp index 00453eee5..414faa414 100644 --- a/apps/openmw/mwmechanics/mechanicsmanager.cpp +++ b/apps/openmw/mwmechanics/mechanicsmanager.cpp @@ -71,7 +71,7 @@ namespace MWMechanics for (std::vector::const_iterator iter (race->powers.list.begin()); iter!=race->powers.list.end(); ++iter) { - creatureStats.mSpells.add (*iter, mEnvironment); + creatureStats.mSpells.add (*iter); } } @@ -85,7 +85,7 @@ namespace MWMechanics for (std::vector::const_iterator iter (sign->powers.list.begin()); iter!=sign->powers.list.end(); ++iter) { - creatureStats.mSpells.add (*iter, mEnvironment); + creatureStats.mSpells.add (*iter); } } diff --git a/apps/openmw/mwmechanics/spells.cpp b/apps/openmw/mwmechanics/spells.cpp index 2b28f0c2f..4e8c6fa5a 100644 --- a/apps/openmw/mwmechanics/spells.cpp +++ b/apps/openmw/mwmechanics/spells.cpp @@ -1,7 +1,7 @@ #include "spells.hpp" -#include +#include #include "../mwworld/environment.hpp" #include "../mwworld/world.hpp" @@ -21,57 +21,48 @@ namespace MWMechanics } } - Spells::TIterator Spells::begin (ESM::Spell::SpellType type) const + Spells::TIterator Spells::begin() const { - assert (type>=0 && type=0 && typegetStore().spells.find (spellId); - - int type = spell->data.type; - - assert (type>=0 && typegetStore().spells.find (spellId); - - int type = spell->data.type; + TContainer::iterator iter = std::find (mSpells.begin(), mSpells.end(), spellId); - TContainer::iterator iter = std::find (mSpells[type].begin(), mSpells[type].end(), spell); - - if (iter!=mSpells[type].end()) - mSpells[type].erase (iter); + if (iter!=mSpells.end()) + mSpells.erase (iter); } - MagicEffects Spells::getMagicEffects (MWWorld::Environment& environment) const + MagicEffects Spells::getMagicEffects (const MWWorld::Environment& environment) const { MagicEffects effects; - for (int i=ESM::Spell::ST_Ability; i<=ESM::Spell::ST_Curse; ++i) - for (TIterator iter (begin (static_cast (i))); - iter!=end(static_cast (i)); ++iter) - addSpell (*iter, effects); + for (TIterator iter = mSpells.begin(); iter!=mSpells.end(); ++iter) + { + const ESM::Spell *spell = environment.mWorld->getStore().spells.find (*iter); + + if (spell->data.type==ESM::Spell::ST_Ability || spell->data.type==ESM::Spell::ST_Blight || + spell->data.type==ESM::Spell::ST_Disease || spell->data.type==ESM::Spell::ST_Curse) + addSpell (spell, effects); + } return effects; } void Spells::clear() { - for (int i=0; i - #include +#include + +namespace ESM +{ + struct Spell; +} namespace MWWorld { @@ -22,29 +26,27 @@ namespace MWMechanics { public: - typedef std::vector TContainer; + typedef std::vector TContainer; typedef TContainer::const_iterator TIterator; private: - static const int sTypes = 6; - - std::vector mSpells[sTypes]; + std::vector mSpells; void addSpell (const ESM::Spell *, MagicEffects& effects) const; public: - TIterator begin (ESM::Spell::SpellType type) const; + TIterator begin() const; - TIterator end (ESM::Spell::SpellType type) const; + TIterator end() const; - void add (const std::string& spell, MWWorld::Environment& environment); + void add (const std::string& spell); /// \note Adding a spell that is already listed in *this is a no-op. - void remove (const std::string& spell, MWWorld::Environment& environment); + void remove (const std::string& spell); - MagicEffects getMagicEffects (MWWorld::Environment& environment) const; + MagicEffects getMagicEffects (const MWWorld::Environment& environment) const; ///< Return sum of magic effects resulting from abilities, blights, deseases and curses. void clear(); From 26a529111c760e639321b87a6659e0875be0fe67 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Wed, 11 Apr 2012 19:45:56 +0200 Subject: [PATCH 6/8] removed old known spell list from NpcStats --- apps/openmw/mwclass/npc.cpp | 2 +- apps/openmw/mwmechanics/npcstats.hpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwclass/npc.cpp b/apps/openmw/mwclass/npc.cpp index 2cf4cf41c..57cc3560a 100644 --- a/apps/openmw/mwclass/npc.cpp +++ b/apps/openmw/mwclass/npc.cpp @@ -63,7 +63,7 @@ namespace MWClass for (std::vector::const_iterator iter (ref->base->spells.list.begin()); iter!=ref->base->spells.list.end(); ++iter) - data->mNpcStats.mKnownSpells.insert (*iter); + data->mCreatureStats.mSpells.add (*iter); // creature stats data->mCreatureStats.mAttributes[0].set (ref->base->npdt52.strength); diff --git a/apps/openmw/mwmechanics/npcstats.hpp b/apps/openmw/mwmechanics/npcstats.hpp index 59bfa2ac0..ece85f893 100644 --- a/apps/openmw/mwmechanics/npcstats.hpp +++ b/apps/openmw/mwmechanics/npcstats.hpp @@ -11,6 +11,8 @@ namespace MWMechanics /// \brief Additional stats for NPCs /// /// For non-NPC-specific stats, see the CreatureStats struct. + /// + /// \note For technical reasons the spell list is also handled by CreatureStats. struct NpcStats { @@ -26,7 +28,6 @@ namespace MWMechanics bool mSneak; bool mCombat; - std::set mKnownSpells; std::string mSelectedSpell; // can be an empty string (no spell selected) NpcStats() : mForceRun (false), mForceSneak (false), mRun (false), mSneak (false), From 52c7ee3b6ae8a9738289a1728cb02ad8d9a49e1f Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Fri, 13 Apr 2012 10:49:45 +0200 Subject: [PATCH 7/8] moved selected spell from NpcStats to Spells --- apps/openmw/mwmechanics/npcstats.hpp | 5 ++--- apps/openmw/mwmechanics/spells.cpp | 13 +++++++++++++ apps/openmw/mwmechanics/spells.hpp | 11 ++++++++++- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwmechanics/npcstats.hpp b/apps/openmw/mwmechanics/npcstats.hpp index ece85f893..b9c672722 100644 --- a/apps/openmw/mwmechanics/npcstats.hpp +++ b/apps/openmw/mwmechanics/npcstats.hpp @@ -12,7 +12,8 @@ namespace MWMechanics /// /// For non-NPC-specific stats, see the CreatureStats struct. /// - /// \note For technical reasons the spell list is also handled by CreatureStats. + /// \note For technical reasons the spell list and the currently selected spell is also handled by + /// CreatureStats, even though they are actually NPC stats. struct NpcStats { @@ -28,8 +29,6 @@ namespace MWMechanics bool mSneak; bool mCombat; - std::string mSelectedSpell; // can be an empty string (no spell selected) - NpcStats() : mForceRun (false), mForceSneak (false), mRun (false), mSneak (false), mCombat (false) {} }; diff --git a/apps/openmw/mwmechanics/spells.cpp b/apps/openmw/mwmechanics/spells.cpp index 4e8c6fa5a..916239a84 100644 --- a/apps/openmw/mwmechanics/spells.cpp +++ b/apps/openmw/mwmechanics/spells.cpp @@ -43,6 +43,9 @@ namespace MWMechanics if (iter!=mSpells.end()) mSpells.erase (iter); + + if (spellId==mSelectedSpell) + mSelectedSpell.clear(); } MagicEffects Spells::getMagicEffects (const MWWorld::Environment& environment) const @@ -65,4 +68,14 @@ namespace MWMechanics { mSpells.clear(); } + + void Spells::setSelectedSpell (const std::string& spellId) + { + mSelectedSpell = spellId; + } + + const std::string Spells::getSelectedSpell() const + { + return mSelectedSpell; + } } diff --git a/apps/openmw/mwmechanics/spells.hpp b/apps/openmw/mwmechanics/spells.hpp index 4c5f21d35..f7606c4ac 100644 --- a/apps/openmw/mwmechanics/spells.hpp +++ b/apps/openmw/mwmechanics/spells.hpp @@ -32,6 +32,7 @@ namespace MWMechanics private: std::vector mSpells; + std::string mSelectedSpell; void addSpell (const ESM::Spell *, MagicEffects& effects) const; @@ -42,15 +43,23 @@ namespace MWMechanics TIterator end() const; void add (const std::string& spell); - /// \note Adding a spell that is already listed in *this is a no-op. + ///< Adding a spell that is already listed in *this is a no-op. void remove (const std::string& spell); + ///< If the spell to be removed is the selected spell, the selected spell will be changed to + /// no spell (empty string). MagicEffects getMagicEffects (const MWWorld::Environment& environment) const; ///< Return sum of magic effects resulting from abilities, blights, deseases and curses. void clear(); ///< Remove all spells of al types. + + void setSelectedSpell (const std::string& spellId); + ///< This function does not verify, if the spell is available. + + const std::string getSelectedSpell() const; + ///< May return an empty string. }; } From b099e1baf583202cbaed50697011d09d50a72dc0 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Fri, 13 Apr 2012 11:12:53 +0200 Subject: [PATCH 8/8] added addspell and removespell script instructions --- apps/openmw/mwscript/docs/vmformat.txt | 6 ++- apps/openmw/mwscript/statsextensions.cpp | 47 ++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwscript/docs/vmformat.txt b/apps/openmw/mwscript/docs/vmformat.txt index df955ec19..705d65814 100644 --- a/apps/openmw/mwscript/docs/vmformat.txt +++ b/apps/openmw/mwscript/docs/vmformat.txt @@ -129,4 +129,8 @@ op 0x2000143: ModWaterLevel op 0x2000144: ToggleWater, twa op 0x2000145: ToggleFogOfWar (tfow) op 0x2000146: TogglePathgrid -opcodes 0x2000147-0x3ffffff unused +op 0x2000147: AddSpell +op 0x2000148: AddSpell, explicit reference +op 0x2000149: RemoveSpell +op 0x200014a: RemoveSpell, explicit reference +opcodes 0x200014b-0x3ffffff unused diff --git a/apps/openmw/mwscript/statsextensions.cpp b/apps/openmw/mwscript/statsextensions.cpp index 0e97a39cf..10641903e 100644 --- a/apps/openmw/mwscript/statsextensions.cpp +++ b/apps/openmw/mwscript/statsextensions.cpp @@ -280,6 +280,38 @@ namespace MWScript } }; + template + class OpAddSpell : public Interpreter::Opcode0 + { + public: + + virtual void execute (Interpreter::Runtime& runtime) + { + MWWorld::Ptr ptr = R()(runtime); + + std::string id = runtime.getStringLiteral (runtime[0].mInteger); + runtime.pop(); + + MWWorld::Class::get (ptr).getCreatureStats (ptr).mSpells.add (id); + } + }; + + template + class OpRemoveSpell : public Interpreter::Opcode0 + { + public: + + virtual void execute (Interpreter::Runtime& runtime) + { + MWWorld::Ptr ptr = R()(runtime); + + std::string id = runtime.getStringLiteral (runtime[0].mInteger); + runtime.pop(); + + MWWorld::Class::get (ptr).getCreatureStats (ptr).mSpells.remove (id); + } + }; + const int numberOfAttributes = 8; const int opcodeGetAttribute = 0x2000027; @@ -311,6 +343,11 @@ namespace MWScript const int opcodeModSkill = 0x20000fa; const int opcodeModSkillExplicit = 0x2000115; + const int opcodeAddSpell = 0x2000147; + const int opcodeAddSpellExplicit = 0x2000148; + const int opcodeRemoveSpell = 0x2000149; + const int opcodeRemoveSpellExplicit = 0x200014a; + void registerExtensions (Compiler::Extensions& extensions) { static const char *attributes[numberOfAttributes] = @@ -381,6 +418,10 @@ namespace MWScript extensions.registerInstruction (mod + skills[i], "l", opcodeModSkill+i, opcodeModSkillExplicit+i); } + + extensions.registerInstruction ("addspell", "c", opcodeAddSpell, opcodeAddSpellExplicit); + extensions.registerInstruction ("removespell", "c", opcodeRemoveSpell, + opcodeRemoveSpellExplicit); } void installOpcodes (Interpreter::Interpreter& interpreter) @@ -436,6 +477,12 @@ namespace MWScript interpreter.installSegment5 (opcodeModSkill+i, new OpModSkill (i)); interpreter.installSegment5 (opcodeModSkillExplicit+i, new OpModSkill (i)); } + + interpreter.installSegment5 (opcodeAddSpell, new OpAddSpell); + interpreter.installSegment5 (opcodeAddSpellExplicit, new OpAddSpell); + interpreter.installSegment5 (opcodeRemoveSpell, new OpRemoveSpell); + interpreter.installSegment5 (opcodeRemoveSpellExplicit, + new OpRemoveSpell); } } }