mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 19:19:56 +00:00
GetSpellEffects returns true for active abilities (Fixes #2530)
This commit is contained in:
parent
ac88326909
commit
9d86e5b028
3 changed files with 19 additions and 1 deletions
|
@ -143,6 +143,20 @@ namespace MWMechanics
|
||||||
return mSelectedSpell;
|
return mSelectedSpell;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Spells::isSpellActive(const std::string &id) const
|
||||||
|
{
|
||||||
|
TContainer::const_iterator found = mSpells.find(id);
|
||||||
|
if (found != mSpells.end())
|
||||||
|
{
|
||||||
|
const ESM::Spell *spell =
|
||||||
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().find (id);
|
||||||
|
|
||||||
|
return (spell->mData.mType==ESM::Spell::ST_Ability || spell->mData.mType==ESM::Spell::ST_Blight ||
|
||||||
|
spell->mData.mType==ESM::Spell::ST_Disease || spell->mData.mType==ESM::Spell::ST_Curse);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool Spells::hasCommonDisease() const
|
bool Spells::hasCommonDisease() const
|
||||||
{
|
{
|
||||||
for (TIterator iter = mSpells.begin(); iter!=mSpells.end(); ++iter)
|
for (TIterator iter = mSpells.begin(); iter!=mSpells.end(); ++iter)
|
||||||
|
|
|
@ -98,6 +98,9 @@ namespace MWMechanics
|
||||||
const std::string getSelectedSpell() const;
|
const std::string getSelectedSpell() const;
|
||||||
///< May return an empty string.
|
///< May return an empty string.
|
||||||
|
|
||||||
|
bool isSpellActive(const std::string& id) const;
|
||||||
|
///< Are we under the effects of the given spell ID?
|
||||||
|
|
||||||
bool hasCommonDisease() const;
|
bool hasCommonDisease() const;
|
||||||
|
|
||||||
bool hasBlightDisease() const;
|
bool hasBlightDisease() const;
|
||||||
|
|
|
@ -595,7 +595,8 @@ namespace MWScript
|
||||||
std::string id = runtime.getStringLiteral(runtime[0].mInteger);
|
std::string id = runtime.getStringLiteral(runtime[0].mInteger);
|
||||||
runtime.pop();
|
runtime.pop();
|
||||||
|
|
||||||
runtime.push(ptr.getClass().getCreatureStats(ptr).getActiveSpells().isSpellActive(id));
|
const MWMechanics::CreatureStats& stats = ptr.getClass().getCreatureStats(ptr);
|
||||||
|
runtime.push(stats.getActiveSpells().isSpellActive(id) || stats.getSpells().isSpellActive(id));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue