mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-30 22:15:32 +00:00
Merge pull request #1019 from Allofich/bound
Don't allow re-casting of bound equipment spells
This commit is contained in:
commit
f3f02fe154
1 changed files with 18 additions and 0 deletions
|
@ -356,6 +356,14 @@ namespace MWMechanics
|
||||||
|
|
||||||
bool castByPlayer = (!caster.isEmpty() && caster == getPlayer());
|
bool castByPlayer = (!caster.isEmpty() && caster == getPlayer());
|
||||||
|
|
||||||
|
ActiveSpells targetSpells;
|
||||||
|
if (target.getClass().isActor())
|
||||||
|
targetSpells = target.getClass().getCreatureStats(target).getActiveSpells();
|
||||||
|
|
||||||
|
bool canCastAnEffect = false; // For bound equipment.If this remains false
|
||||||
|
// throughout the iteration of this spell's
|
||||||
|
// effects, we display a "can't re-cast" message
|
||||||
|
|
||||||
for (std::vector<ESM::ENAMstruct>::const_iterator effectIt (effects.mList.begin());
|
for (std::vector<ESM::ENAMstruct>::const_iterator effectIt (effects.mList.begin());
|
||||||
effectIt!=effects.mList.end(); ++effectIt)
|
effectIt!=effects.mList.end(); ++effectIt)
|
||||||
{
|
{
|
||||||
|
@ -366,6 +374,16 @@ namespace MWMechanics
|
||||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find (
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find (
|
||||||
effectIt->mEffectID);
|
effectIt->mEffectID);
|
||||||
|
|
||||||
|
// Re-casting a bound equipment effect has no effect if the spell is still active
|
||||||
|
if (magicEffect->mData.mFlags & ESM::MagicEffect::NonRecastable && targetSpells.isSpellActive(mId))
|
||||||
|
{
|
||||||
|
if (effectIt == (effects.mList.end() - 1) && !canCastAnEffect && castByPlayer)
|
||||||
|
MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicCannotRecast}");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
canCastAnEffect = true;
|
||||||
|
|
||||||
if (!checkEffectTarget(effectIt->mEffectID, target, castByPlayer))
|
if (!checkEffectTarget(effectIt->mEffectID, target, castByPlayer))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue