forked from teamnwah/openmw-tes3coop
Implement RemoveSpellEffects instruction
This commit is contained in:
parent
366801f3d5
commit
7d8ca91286
6 changed files with 37 additions and 2 deletions
|
@ -150,6 +150,12 @@ namespace MWMechanics
|
|||
mSpellsChanged = true;
|
||||
}
|
||||
|
||||
void ActiveSpells::removeEffects(const std::string &id)
|
||||
{
|
||||
mSpells.erase(Misc::StringUtils::lowerCase(id));
|
||||
mSpellsChanged = true;
|
||||
}
|
||||
|
||||
void ActiveSpells::visitEffectSources(EffectSourceVisitor &visitor) const
|
||||
{
|
||||
for (TContainer::const_iterator it = begin(); it != end(); ++it)
|
||||
|
|
|
@ -81,7 +81,10 @@ namespace MWMechanics
|
|||
void addSpell (const std::string& id, bool stack, std::vector<Effect> effects,
|
||||
const std::string& displayName, const std::string& casterHandle);
|
||||
|
||||
/// Remove all active effects with this id
|
||||
/// Removes the active effects from this spell/potion/.. with \a id
|
||||
void removeEffects (const std::string& id);
|
||||
|
||||
/// Remove all active effects with this effect id
|
||||
void purgeEffect (short effectId);
|
||||
|
||||
/// Remove all active effects, if roll succeeds (for each effect)
|
||||
|
|
|
@ -362,4 +362,6 @@ op 0x2000227: Cast
|
|||
op 0x2000228: Cast, explicit
|
||||
op 0x2000229: ExplodeSpell
|
||||
op 0x200022a: ExplodeSpell, explicit
|
||||
opcodes 0x200022b-0x3ffffff unused
|
||||
op 0x200022b: RemoveSpellEffects
|
||||
op 0x200022c: RemoveSpellEffects, explicit
|
||||
opcodes 0x200022d-0x3ffffff unused
|
||||
|
|
|
@ -459,6 +459,22 @@ namespace MWScript
|
|||
}
|
||||
};
|
||||
|
||||
template<class R>
|
||||
class OpRemoveSpellEffects : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWWorld::Ptr ptr = R()(runtime);
|
||||
|
||||
std::string spellid = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
MWWorld::Class::get (ptr).getCreatureStats (ptr).getActiveSpells().removeEffects(spellid);
|
||||
}
|
||||
};
|
||||
|
||||
template<class R>
|
||||
class OpGetSpell : public Interpreter::Opcode0
|
||||
{
|
||||
|
@ -1135,6 +1151,9 @@ namespace MWScript
|
|||
interpreter.installSegment5 (Compiler::Stats::opcodeRemoveSpell, new OpRemoveSpell<ImplicitRef>);
|
||||
interpreter.installSegment5 (Compiler::Stats::opcodeRemoveSpellExplicit,
|
||||
new OpRemoveSpell<ExplicitRef>);
|
||||
interpreter.installSegment5 (Compiler::Stats::opcodeRemoveSpellEffects, new OpRemoveSpellEffects<ImplicitRef>);
|
||||
interpreter.installSegment5 (Compiler::Stats::opcodeRemoveSpellEffectsExplicit,
|
||||
new OpRemoveSpellEffects<ExplicitRef>);
|
||||
|
||||
interpreter.installSegment5 (Compiler::Stats::opcodeGetSpell, new OpGetSpell<ImplicitRef>);
|
||||
interpreter.installSegment5 (Compiler::Stats::opcodeGetSpellExplicit, new OpGetSpell<ExplicitRef>);
|
||||
|
|
|
@ -391,6 +391,8 @@ namespace Compiler
|
|||
extensions.registerInstruction ("addspell", "c", opcodeAddSpell, opcodeAddSpellExplicit);
|
||||
extensions.registerInstruction ("removespell", "c", opcodeRemoveSpell,
|
||||
opcodeRemoveSpellExplicit);
|
||||
extensions.registerInstruction ("removespelleffects", "c", opcodeRemoveSpellEffects,
|
||||
opcodeRemoveSpellEffectsExplicit);
|
||||
extensions.registerFunction ("getspell", 'l', "c", opcodeGetSpell, opcodeGetSpellExplicit);
|
||||
|
||||
extensions.registerInstruction("pcraiserank","/S",opcodePCRaiseRank);
|
||||
|
|
|
@ -369,6 +369,9 @@ namespace Compiler
|
|||
const int opcodeIsWerewolfExplicit = 0x20001fe;
|
||||
|
||||
const int opcodeGetWerewolfKills = 0x20001e2;
|
||||
|
||||
const int opcodeRemoveSpellEffects = 0x200022b;
|
||||
const int opcodeRemoveSpellEffectsExplicit = 0x200022c;
|
||||
}
|
||||
|
||||
namespace Transformation
|
||||
|
|
Loading…
Reference in a new issue