mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-20 08:11:32 +00:00
Fix reported spellcasting discrepancies
Make ExplodeSpell behavior closer to Cast behavior (#5242) Nullify on-self absorb spells in a different way (#5241) Allow casting permanent spells through Cast/ExplodeSpell
This commit is contained in:
parent
7a4caaf5bf
commit
42cc27194b
3 changed files with 43 additions and 9 deletions
|
@ -188,6 +188,8 @@
|
||||||
Bug #5226: Reputation should be capped
|
Bug #5226: Reputation should be capped
|
||||||
Bug #5229: Crash if mesh controller node has no data node
|
Bug #5229: Crash if mesh controller node has no data node
|
||||||
Bug #5239: OpenMW-CS does not support non-ASCII characters in path names
|
Bug #5239: OpenMW-CS does not support non-ASCII characters in path names
|
||||||
|
Bug #5241: On-self absorb spells cannot be detected
|
||||||
|
Bug #5242: ExplodeSpell behavior differs from Cast behavior
|
||||||
Feature #1774: Handle AvoidNode
|
Feature #1774: Handle AvoidNode
|
||||||
Feature #2229: Improve pathfinding AI
|
Feature #2229: Improve pathfinding AI
|
||||||
Feature #3025: Analogue gamepad movement controls
|
Feature #3025: Analogue gamepad movement controls
|
||||||
|
|
|
@ -447,9 +447,9 @@ namespace MWMechanics
|
||||||
if (!checkEffectTarget(effectIt->mEffectID, target, caster, castByPlayer))
|
if (!checkEffectTarget(effectIt->mEffectID, target, caster, castByPlayer))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// caster needs to be an actor that's not the target for linked effects (e.g. Absorb)
|
// caster needs to be an actor for linked effects (e.g. Absorb)
|
||||||
if (magicEffect->mData.mFlags & ESM::MagicEffect::CasterLinked
|
if (magicEffect->mData.mFlags & ESM::MagicEffect::CasterLinked
|
||||||
&& (caster.isEmpty() || !caster.getClass().isActor() || caster == target))
|
&& (caster.isEmpty() || !caster.getClass().isActor()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// If player is healing someone, show the target's HP bar
|
// If player is healing someone, show the target's HP bar
|
||||||
|
@ -552,6 +552,20 @@ namespace MWMechanics
|
||||||
effect.mArg = MWMechanics::EffectKey(*effectIt).mArg;
|
effect.mArg = MWMechanics::EffectKey(*effectIt).mArg;
|
||||||
effect.mMagnitude = magnitude;
|
effect.mMagnitude = magnitude;
|
||||||
|
|
||||||
|
// Avoid applying absorb effects if the caster is the target
|
||||||
|
// We still need the spell to be added
|
||||||
|
if (caster == target)
|
||||||
|
{
|
||||||
|
for (int i=0; i<5; ++i)
|
||||||
|
{
|
||||||
|
if (effectIt->mEffectID == ESM::MagicEffect::AbsorbAttribute+i)
|
||||||
|
{
|
||||||
|
effect.mMagnitude = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool hasDuration = !(magicEffect->mData.mFlags & ESM::MagicEffect::NoDuration);
|
bool hasDuration = !(magicEffect->mData.mFlags & ESM::MagicEffect::NoDuration);
|
||||||
if (hasDuration && effectIt->mDuration == 0)
|
if (hasDuration && effectIt->mDuration == 0)
|
||||||
{
|
{
|
||||||
|
@ -614,6 +628,7 @@ namespace MWMechanics
|
||||||
else
|
else
|
||||||
caster.getClass().getCreatureStats(caster).getActiveSpells().addSpell("", true,
|
caster.getClass().getCreatureStats(caster).getActiveSpells().addSpell("", true,
|
||||||
absorbEffects, mSourceName, target.getClass().getCreatureStats(target).getActorId());
|
absorbEffects, mSourceName, target.getClass().getCreatureStats(target).getActorId());
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1109,12 +1109,6 @@ namespace MWScript
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (spell->mData.mType != ESM::Spell::ST_Spell && spell->mData.mType != ESM::Spell::ST_Power)
|
|
||||||
{
|
|
||||||
runtime.getContext().report("spellcasting failed: you can only cast spells and powers.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ptr == MWMechanics::getPlayer())
|
if (ptr == MWMechanics::getPlayer())
|
||||||
{
|
{
|
||||||
MWWorld::InventoryStore& store = ptr.getClass().getInventoryStore(ptr);
|
MWWorld::InventoryStore& store = ptr.getClass().getInventoryStore(ptr);
|
||||||
|
@ -1152,9 +1146,32 @@ namespace MWScript
|
||||||
{
|
{
|
||||||
MWWorld::Ptr ptr = R()(runtime);
|
MWWorld::Ptr ptr = R()(runtime);
|
||||||
|
|
||||||
std::string spell = runtime.getStringLiteral (runtime[0].mInteger);
|
std::string spellId = runtime.getStringLiteral (runtime[0].mInteger);
|
||||||
runtime.pop();
|
runtime.pop();
|
||||||
|
|
||||||
|
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().search(spellId);
|
||||||
|
if (!spell)
|
||||||
|
{
|
||||||
|
runtime.getContext().report("spellcasting failed: cannot find spell \""+spellId+"\"");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ptr == MWMechanics::getPlayer())
|
||||||
|
{
|
||||||
|
MWWorld::InventoryStore& store = ptr.getClass().getInventoryStore(ptr);
|
||||||
|
store.setSelectedEnchantItem(store.end());
|
||||||
|
MWBase::Environment::get().getWindowManager()->setSelectedSpell(spellId, int(MWMechanics::getSpellSuccessChance(spellId, ptr)));
|
||||||
|
MWBase::Environment::get().getWindowManager()->updateSpellWindow();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ptr.getClass().isActor())
|
||||||
|
{
|
||||||
|
MWMechanics::AiCast castPackage(ptr.getCellRef().getRefId(), spellId, true);
|
||||||
|
ptr.getClass().getCreatureStats (ptr).getAiSequence().stack(castPackage, ptr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
MWMechanics::CastSpell cast(ptr, ptr, false, true);
|
MWMechanics::CastSpell cast(ptr, ptr, false, true);
|
||||||
cast.mHitPosition = ptr.getRefData().getPosition().asVec3();
|
cast.mHitPosition = ptr.getRefData().getPosition().asVec3();
|
||||||
cast.mAlwaysSucceed = true;
|
cast.mAlwaysSucceed = true;
|
||||||
|
|
Loading…
Reference in a new issue