|
|
|
@ -7,6 +7,7 @@
|
|
|
|
|
#include <boost/format.hpp>
|
|
|
|
|
|
|
|
|
|
#include <components/misc/rng.hpp>
|
|
|
|
|
#include <components/settings/settings.hpp>
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
Start of tes3mp addition
|
|
|
|
@ -504,6 +505,9 @@ namespace MWMechanics
|
|
|
|
|
MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicTargetResisted}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (target == getPlayer() && MWBase::Environment::get().getWorld()->getGodModeState())
|
|
|
|
|
magnitudeMult = 0;
|
|
|
|
|
|
|
|
|
|
// If player is attempting to cast a harmful spell, show the target's HP bar
|
|
|
|
|
if (castByPlayer && target != caster)
|
|
|
|
|
MWBase::Environment::get().getWindowManager()->setEnemy(target);
|
|
|
|
@ -582,9 +586,12 @@ namespace MWMechanics
|
|
|
|
|
ActiveSpells::ActiveEffect effect_ = effect;
|
|
|
|
|
effect_.mMagnitude *= -1;
|
|
|
|
|
absorbEffects.push_back(effect_);
|
|
|
|
|
// Also make sure to set casterActorId = target, so that the effect on the caster gets purged when the target dies
|
|
|
|
|
caster.getClass().getCreatureStats(caster).getActiveSpells().addSpell("", true,
|
|
|
|
|
absorbEffects, mSourceName, target.getClass().getCreatureStats(target).getActorId());
|
|
|
|
|
if (reflected && Settings::Manager::getBool("classic reflected absorb attribute behavior", "Game"))
|
|
|
|
|
target.getClass().getCreatureStats(target).getActiveSpells().addSpell("", true,
|
|
|
|
|
absorbEffects, mSourceName, caster.getClass().getCreatureStats(caster).getActorId());
|
|
|
|
|
else
|
|
|
|
|
caster.getClass().getCreatureStats(caster).getActiveSpells().addSpell("", true,
|
|
|
|
|
absorbEffects, mSourceName, target.getClass().getCreatureStats(target).getActorId());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -928,7 +935,8 @@ namespace MWMechanics
|
|
|
|
|
const float normalizedEncumbrance = mCaster.getClass().getNormalizedEncumbrance(mCaster);
|
|
|
|
|
|
|
|
|
|
float fatigueLoss = spell->mData.mCost * (fFatigueSpellBase + normalizedEncumbrance * fFatigueSpellMult);
|
|
|
|
|
fatigue.setCurrent(fatigue.getCurrent() - fatigueLoss); stats.setFatigue(fatigue);
|
|
|
|
|
fatigue.setCurrent(fatigue.getCurrent() - fatigueLoss);
|
|
|
|
|
stats.setFatigue(fatigue);
|
|
|
|
|
|
|
|
|
|
bool fail = false;
|
|
|
|
|
|
|
|
|
@ -951,9 +959,7 @@ namespace MWMechanics
|
|
|
|
|
(dedicatedAttack && dedicatedAttack->success == false))
|
|
|
|
|
{
|
|
|
|
|
if (mCaster == getPlayer())
|
|
|
|
|
{
|
|
|
|
|
MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicSkillFail}");
|
|
|
|
|
}
|
|
|
|
|
fail = true;
|
|
|
|
|
}
|
|
|
|
|
/*
|
|
|
|
@ -1178,8 +1184,6 @@ namespace MWMechanics
|
|
|
|
|
|
|
|
|
|
bool receivedMagicDamage = false;
|
|
|
|
|
|
|
|
|
|
bool godmode = actor == MWMechanics::getPlayer() && MWBase::Environment::get().getWorld()->getGodModeState();
|
|
|
|
|
|
|
|
|
|
switch (effectKey.mId)
|
|
|
|
|
{
|
|
|
|
|
case ESM::MagicEffect::DamageAttribute:
|
|
|
|
@ -1202,40 +1206,25 @@ namespace MWMechanics
|
|
|
|
|
adjustDynamicStat(creatureStats, effectKey.mId-ESM::MagicEffect::RestoreHealth, magnitude);
|
|
|
|
|
break;
|
|
|
|
|
case ESM::MagicEffect::DamageHealth:
|
|
|
|
|
if (!godmode)
|
|
|
|
|
{
|
|
|
|
|
receivedMagicDamage = true;
|
|
|
|
|
adjustDynamicStat(creatureStats, effectKey.mId-ESM::MagicEffect::DamageHealth, -magnitude);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
receivedMagicDamage = true;
|
|
|
|
|
adjustDynamicStat(creatureStats, effectKey.mId-ESM::MagicEffect::DamageHealth, -magnitude);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ESM::MagicEffect::DamageMagicka:
|
|
|
|
|
case ESM::MagicEffect::DamageFatigue:
|
|
|
|
|
if (!godmode)
|
|
|
|
|
{
|
|
|
|
|
adjustDynamicStat(creatureStats, effectKey.mId-ESM::MagicEffect::DamageHealth, -magnitude);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
adjustDynamicStat(creatureStats, effectKey.mId-ESM::MagicEffect::DamageHealth, -magnitude);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ESM::MagicEffect::AbsorbHealth:
|
|
|
|
|
if (!godmode)
|
|
|
|
|
{
|
|
|
|
|
if (magnitude > 0.f)
|
|
|
|
|
receivedMagicDamage = true;
|
|
|
|
|
adjustDynamicStat(creatureStats, effectKey.mId-ESM::MagicEffect::AbsorbHealth, -magnitude);
|
|
|
|
|
}
|
|
|
|
|
if (magnitude > 0.f)
|
|
|
|
|
receivedMagicDamage = true;
|
|
|
|
|
adjustDynamicStat(creatureStats, effectKey.mId-ESM::MagicEffect::AbsorbHealth, -magnitude);
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ESM::MagicEffect::AbsorbMagicka:
|
|
|
|
|
case ESM::MagicEffect::AbsorbFatigue:
|
|
|
|
|
if (!godmode)
|
|
|
|
|
{
|
|
|
|
|
adjustDynamicStat(creatureStats, effectKey.mId-ESM::MagicEffect::AbsorbHealth, -magnitude);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
adjustDynamicStat(creatureStats, effectKey.mId-ESM::MagicEffect::AbsorbHealth, -magnitude);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ESM::MagicEffect::DisintegrateArmor:
|
|
|
|
@ -1258,6 +1247,7 @@ namespace MWMechanics
|
|
|
|
|
if (disintegrateSlot(actor, priorities[i], magnitude))
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case ESM::MagicEffect::DisintegrateWeapon:
|
|
|
|
@ -1280,12 +1270,9 @@ namespace MWMechanics
|
|
|
|
|
if (weather > 1)
|
|
|
|
|
damageScale *= fMagicSunBlockedMult;
|
|
|
|
|
|
|
|
|
|
if (!godmode)
|
|
|
|
|
{
|
|
|
|
|
adjustDynamicStat(creatureStats, 0, -magnitude * damageScale);
|
|
|
|
|
if (magnitude * damageScale > 0.f)
|
|
|
|
|
receivedMagicDamage = true;
|
|
|
|
|
}
|
|
|
|
|
adjustDynamicStat(creatureStats, 0, -magnitude * damageScale);
|
|
|
|
|
if (magnitude * damageScale > 0.f)
|
|
|
|
|
receivedMagicDamage = true;
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
@ -1295,12 +1282,8 @@ namespace MWMechanics
|
|
|
|
|
case ESM::MagicEffect::FrostDamage:
|
|
|
|
|
case ESM::MagicEffect::Poison:
|
|
|
|
|
{
|
|
|
|
|
if (!godmode)
|
|
|
|
|
{
|
|
|
|
|
adjustDynamicStat(creatureStats, 0, -magnitude);
|
|
|
|
|
receivedMagicDamage = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
adjustDynamicStat(creatureStats, 0, -magnitude);
|
|
|
|
|
receivedMagicDamage = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|