forked from teamnwah/openmw-tes3coop
Merge remote-tracking branch 'miroslavr/master'
This commit is contained in:
commit
de3a26e21b
6 changed files with 31 additions and 14 deletions
|
@ -369,7 +369,7 @@ namespace MWMechanics
|
|||
void Actors::updateNpc (const MWWorld::Ptr& ptr, float duration)
|
||||
{
|
||||
updateDrowning(ptr, duration);
|
||||
calculateNpcStatModifiers(ptr);
|
||||
calculateNpcStatModifiers(ptr, duration);
|
||||
updateEquippedLight(ptr, duration);
|
||||
}
|
||||
|
||||
|
@ -499,6 +499,9 @@ namespace MWMechanics
|
|||
effects.get(EffectKey(ESM::MagicEffect::DrainAttribute, i)).getMagnitude() -
|
||||
effects.get(EffectKey(ESM::MagicEffect::AbsorbAttribute, i)).getMagnitude());
|
||||
|
||||
stat.damage(effects.get(EffectKey(ESM::MagicEffect::DamageAttribute, i)).getMagnitude() * duration * 1.5);
|
||||
stat.restore(effects.get(EffectKey(ESM::MagicEffect::RestoreAttribute, i)).getMagnitude() * duration * 1.5);
|
||||
|
||||
creatureStats.setAttribute(i, stat);
|
||||
}
|
||||
|
||||
|
@ -855,7 +858,7 @@ namespace MWMechanics
|
|||
}
|
||||
}
|
||||
|
||||
void Actors::calculateNpcStatModifiers (const MWWorld::Ptr& ptr)
|
||||
void Actors::calculateNpcStatModifiers (const MWWorld::Ptr& ptr, float duration)
|
||||
{
|
||||
NpcStats &npcStats = ptr.getClass().getNpcStats(ptr);
|
||||
const MagicEffects &effects = npcStats.getMagicEffects();
|
||||
|
@ -867,6 +870,9 @@ namespace MWMechanics
|
|||
skill.setModifier(effects.get(EffectKey(ESM::MagicEffect::FortifySkill, i)).getMagnitude() -
|
||||
effects.get(EffectKey(ESM::MagicEffect::DrainSkill, i)).getMagnitude() -
|
||||
effects.get(EffectKey(ESM::MagicEffect::AbsorbSkill, i)).getMagnitude());
|
||||
|
||||
skill.damage(effects.get(EffectKey(ESM::MagicEffect::DamageSkill, i)).getMagnitude() * duration * 1.5);
|
||||
skill.restore(effects.get(EffectKey(ESM::MagicEffect::RestoreSkill, i)).getMagnitude() * duration * 1.5);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1534,6 +1540,6 @@ namespace MWMechanics
|
|||
adjustMagicEffects(ptr);
|
||||
calculateCreatureStatModifiers(ptr, 0.f);
|
||||
if (ptr.getClass().isNpc())
|
||||
calculateNpcStatModifiers(ptr);
|
||||
calculateNpcStatModifiers(ptr, 0.f);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace MWMechanics
|
|||
void calculateDynamicStats (const MWWorld::Ptr& ptr);
|
||||
|
||||
void calculateCreatureStatModifiers (const MWWorld::Ptr& ptr, float duration);
|
||||
void calculateNpcStatModifiers (const MWWorld::Ptr& ptr);
|
||||
void calculateNpcStatModifiers (const MWWorld::Ptr& ptr, float duration);
|
||||
|
||||
void calculateRestoration (const MWWorld::Ptr& ptr, float duration);
|
||||
|
||||
|
|
|
@ -70,11 +70,13 @@ namespace MWMechanics
|
|||
if (mPermanentSpellEffects.find(lower) != mPermanentSpellEffects.end())
|
||||
{
|
||||
MagicEffects & effects = mPermanentSpellEffects[lower];
|
||||
for (MagicEffects::Collection::const_iterator effectIt = effects.begin(); effectIt != effects.end(); ++effectIt)
|
||||
for (MagicEffects::Collection::const_iterator effectIt = effects.begin(); effectIt != effects.end();)
|
||||
{
|
||||
const ESM::MagicEffect * magicEffect = MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(effectIt->first.mId);
|
||||
if (magicEffect->mData.mFlags & ESM::MagicEffect::Harmful)
|
||||
effects.remove(effectIt->first);
|
||||
effects.remove((effectIt++)->first);
|
||||
else
|
||||
++effectIt;
|
||||
}
|
||||
}
|
||||
mCorprusSpells.erase(corprusIt);
|
||||
|
|
|
@ -236,20 +236,20 @@ namespace MWMechanics
|
|||
{
|
||||
int mBase;
|
||||
int mModifier;
|
||||
int mDamage;
|
||||
float mDamage; // needs to be float to allow continuous damage
|
||||
|
||||
public:
|
||||
AttributeValue() : mBase(0), mModifier(0), mDamage(0) {}
|
||||
|
||||
int getModified() const { return std::max(0, mBase - mDamage + mModifier); }
|
||||
int getModified() const { return std::max(0, mBase - (int) mDamage + mModifier); }
|
||||
int getBase() const { return mBase; }
|
||||
int getModifier() const { return mModifier; }
|
||||
|
||||
void setBase(int base) { mBase = std::max(0, base); }
|
||||
void setModifier(int mod) { mModifier = mod; }
|
||||
|
||||
void damage(int damage) { mDamage += damage; }
|
||||
void restore(int amount) { mDamage -= std::min(mDamage, amount); }
|
||||
void damage(float damage) { mDamage += damage; }
|
||||
void restore(float amount) { mDamage -= std::min(mDamage, amount); }
|
||||
int getDamage() const { return mDamage; }
|
||||
|
||||
void writeState (ESM::StatState<int>& state) const;
|
||||
|
|
|
@ -125,6 +125,9 @@ namespace MWScript
|
|||
{
|
||||
MWWorld::Ptr ptr = R()(runtime);
|
||||
|
||||
if (!ptr.getRefData().isEnabled())
|
||||
return;
|
||||
|
||||
MWBase::Environment::get().getDialogueManager()->startDialogue (ptr);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace ESM
|
|||
T mMod; // Note: can either be the modifier, or the modified value.
|
||||
// A bit inconsistent, but we can't fix this without breaking compatibility.
|
||||
T mCurrent;
|
||||
T mDamage;
|
||||
float mDamage;
|
||||
float mProgress;
|
||||
|
||||
StatState();
|
||||
|
@ -36,8 +36,14 @@ namespace ESM
|
|||
esm.getHNOT (mMod, "STMO");
|
||||
mCurrent = 0;
|
||||
esm.getHNOT (mCurrent, "STCU");
|
||||
mDamage = 0;
|
||||
esm.getHNOT (mDamage, "STDA");
|
||||
|
||||
// mDamage was changed to a float; ensure backwards compatibility
|
||||
T oldDamage = 0;
|
||||
esm.getHNOT(oldDamage, "STDA");
|
||||
mDamage = oldDamage;
|
||||
|
||||
esm.getHNOT (mDamage, "STDF");
|
||||
|
||||
mProgress = 0;
|
||||
esm.getHNOT (mProgress, "STPR");
|
||||
}
|
||||
|
@ -54,7 +60,7 @@ namespace ESM
|
|||
esm.writeHNT ("STCU", mCurrent);
|
||||
|
||||
if (mDamage)
|
||||
esm.writeHNT ("STDA", mDamage);
|
||||
esm.writeHNT ("STDF", mDamage);
|
||||
|
||||
if (mProgress)
|
||||
esm.writeHNT ("STPR", mProgress);
|
||||
|
|
Loading…
Reference in a new issue