Skip to content

Commit

Permalink
Allow GetEffect to detect 0 magnitude spells
Browse files Browse the repository at this point in the history
  • Loading branch information
Assumeru committed Aug 5, 2024
1 parent 5d57ad7 commit fe50b1a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@
Bug #8063: menu_background.bik video with audio freezes the game forever
Bug #8064: Lua move360 script doesn't respect the enableZoom/disableZoom Camera interface setting
Bug #8085: Don't search in scripts or shaders directories for "Select directories you wish to add" menu in launcher
Bug #8097: GetEffect doesn't detect 0 magnitude spells
Feature #1415: Infinite fall failsafe
Feature #2566: Handle NAM9 records for manual cell references
Feature #3501: OpenMW-CS: Instance Editing - Shortcuts for axial locking
Expand Down
14 changes: 7 additions & 7 deletions apps/openmw/mwscript/miscextensions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -603,15 +603,15 @@ namespace MWScript
key = ESM::MagicEffect::effectGmstIdToIndex(effect);

const MWMechanics::CreatureStats& stats = ptr.getClass().getCreatureStats(ptr);

const MWMechanics::MagicEffects& effects = stats.getMagicEffects();

for (const auto& activeEffect : effects)
for (const auto& spell : stats.getActiveSpells())
{
if (activeEffect.first.mId == key && activeEffect.second.getModifier() > 0)
for (const auto& effect : spell.getEffects())
{
runtime.push(1);
return;
if (effect.mFlags & ESM::ActiveEffect::Flag_Applied && effect.mEffectId == key)
{
runtime.push(1);
return;
}
}
}
runtime.push(0);
Expand Down

0 comments on commit fe50b1a

Please sign in to comment.