mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-08-06 00:36:39 -04:00
Don't play vfx and sound on fully resisted debuffs
This commit is contained in:
parent
e9a9659abc
commit
25d9c80067
@ -273,13 +273,14 @@ namespace MWMechanics
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool updateSpellWindow = false;
|
bool updateSpellWindow = false;
|
||||||
|
bool playNonLooping = false;
|
||||||
if (ptr.getClass().hasInventoryStore(ptr)
|
if (ptr.getClass().hasInventoryStore(ptr)
|
||||||
&& !(creatureStats.isDead() && !creatureStats.isDeathAnimationFinished()))
|
&& !(creatureStats.isDead() && !creatureStats.isDeathAnimationFinished()))
|
||||||
{
|
{
|
||||||
auto& store = ptr.getClass().getInventoryStore(ptr);
|
auto& store = ptr.getClass().getInventoryStore(ptr);
|
||||||
if (store.getInvListener() != nullptr)
|
if (store.getInvListener() != nullptr)
|
||||||
{
|
{
|
||||||
bool playNonLooping = !store.isFirstEquip();
|
playNonLooping = !store.isFirstEquip();
|
||||||
const auto world = MWBase::Environment::get().getWorld();
|
const auto world = MWBase::Environment::get().getWorld();
|
||||||
for (int slotIndex = 0; slotIndex < MWWorld::InventoryStore::Slots; slotIndex++)
|
for (int slotIndex = 0; slotIndex < MWWorld::InventoryStore::Slots; slotIndex++)
|
||||||
{
|
{
|
||||||
@ -307,9 +308,6 @@ namespace MWMechanics
|
|||||||
applyPurges(ptr);
|
applyPurges(ptr);
|
||||||
ActiveSpellParams& params = mSpells.emplace_back(ActiveSpellParams{ *slot, enchantment, ptr });
|
ActiveSpellParams& params = mSpells.emplace_back(ActiveSpellParams{ *slot, enchantment, ptr });
|
||||||
params.setActiveSpellId(MWBase::Environment::get().getESMStore()->generateId());
|
params.setActiveSpellId(MWBase::Environment::get().getESMStore()->generateId());
|
||||||
for (const auto& effect : params.mEffects)
|
|
||||||
MWMechanics::playEffects(
|
|
||||||
ptr, *world->getStore().get<ESM::MagicEffect>().find(effect.mEffectId), playNonLooping);
|
|
||||||
updateSpellWindow = true;
|
updateSpellWindow = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -327,7 +325,7 @@ namespace MWMechanics
|
|||||||
std::optional<ActiveSpellParams> reflected;
|
std::optional<ActiveSpellParams> reflected;
|
||||||
for (auto it = spellIt->mEffects.begin(); it != spellIt->mEffects.end();)
|
for (auto it = spellIt->mEffects.begin(); it != spellIt->mEffects.end();)
|
||||||
{
|
{
|
||||||
auto result = applyMagicEffect(ptr, caster, *spellIt, *it, duration);
|
auto result = applyMagicEffect(ptr, caster, *spellIt, *it, duration, playNonLooping);
|
||||||
if (result.mType == MagicApplicationResult::Type::REFLECTED)
|
if (result.mType == MagicApplicationResult::Type::REFLECTED)
|
||||||
{
|
{
|
||||||
if (!reflected)
|
if (!reflected)
|
||||||
|
@ -914,7 +914,7 @@ namespace MWMechanics
|
|||||||
}
|
}
|
||||||
|
|
||||||
MagicApplicationResult applyMagicEffect(const MWWorld::Ptr& target, const MWWorld::Ptr& caster,
|
MagicApplicationResult applyMagicEffect(const MWWorld::Ptr& target, const MWWorld::Ptr& caster,
|
||||||
ActiveSpells::ActiveSpellParams& spellParams, ESM::ActiveEffect& effect, float dt)
|
ActiveSpells::ActiveSpellParams& spellParams, ESM::ActiveEffect& effect, float dt, bool playNonLooping)
|
||||||
{
|
{
|
||||||
const auto world = MWBase::Environment::get().getWorld();
|
const auto world = MWBase::Environment::get().getWorld();
|
||||||
bool invalid = false;
|
bool invalid = false;
|
||||||
@ -1032,9 +1032,12 @@ namespace MWMechanics
|
|||||||
oldMagnitude = effect.mMagnitude;
|
oldMagnitude = effect.mMagnitude;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!spellParams.hasFlag(ESM::ActiveSpells::Flag_Equipment)
|
bool isTemporary = spellParams.hasFlag(ESM::ActiveSpells::Flag_Temporary);
|
||||||
&& !spellParams.hasFlag(ESM::ActiveSpells::Flag_Lua))
|
bool isEquipment = spellParams.hasFlag(ESM::ActiveSpells::Flag_Equipment);
|
||||||
playEffects(target, *magicEffect, spellParams.hasFlag(ESM::ActiveSpells::Flag_Temporary));
|
|
||||||
|
if (!spellParams.hasFlag(ESM::ActiveSpells::Flag_Lua))
|
||||||
|
playEffects(target, *magicEffect, (isTemporary || (isEquipment && playNonLooping)));
|
||||||
|
|
||||||
if (effect.mEffectId == ESM::MagicEffect::Soultrap && !target.getClass().isNpc()
|
if (effect.mEffectId == ESM::MagicEffect::Soultrap && !target.getClass().isNpc()
|
||||||
&& target.getType() == ESM::Creature::sRecordId
|
&& target.getType() == ESM::Creature::sRecordId
|
||||||
&& target.get<ESM::Creature>()->mBase->mData.mSoul == 0 && caster == getPlayer())
|
&& target.get<ESM::Creature>()->mBase->mData.mSoul == 0 && caster == getPlayer())
|
||||||
|
@ -28,7 +28,8 @@ namespace MWMechanics
|
|||||||
|
|
||||||
// Applies a tick of a single effect. Returns true if the effect should be removed immediately
|
// Applies a tick of a single effect. Returns true if the effect should be removed immediately
|
||||||
MagicApplicationResult applyMagicEffect(const MWWorld::Ptr& target, const MWWorld::Ptr& caster,
|
MagicApplicationResult applyMagicEffect(const MWWorld::Ptr& target, const MWWorld::Ptr& caster,
|
||||||
ActiveSpells::ActiveSpellParams& spellParams, ESM::ActiveEffect& effect, float dt);
|
ActiveSpells::ActiveSpellParams& spellParams, ESM::ActiveEffect& effect, float dt,
|
||||||
|
bool playNonLoopingEffect = true);
|
||||||
|
|
||||||
// Undoes permanent effects created by ESM::MagicEffect::AppliedOnce
|
// Undoes permanent effects created by ESM::MagicEffect::AppliedOnce
|
||||||
void onMagicEffectRemoved(
|
void onMagicEffectRemoved(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user