forked from mirror/openmw-tes3mp
Encapsulate magic effect magnitude (Feature #1489)
This commit is contained in:
parent
e508450c1c
commit
d8943aef2f
18 changed files with 100 additions and 90 deletions
|
@ -541,11 +541,11 @@ namespace MWClass
|
||||||
float moveSpeed;
|
float moveSpeed;
|
||||||
if(normalizedEncumbrance >= 1.0f)
|
if(normalizedEncumbrance >= 1.0f)
|
||||||
moveSpeed = 0.0f;
|
moveSpeed = 0.0f;
|
||||||
else if(canFly(ptr) || (mageffects.get(ESM::MagicEffect::Levitate).mMagnitude > 0 &&
|
else if(canFly(ptr) || (mageffects.get(ESM::MagicEffect::Levitate).getMagnitude() > 0 &&
|
||||||
world->isLevitationEnabled()))
|
world->isLevitationEnabled()))
|
||||||
{
|
{
|
||||||
float flySpeed = 0.01f*(stats.getAttribute(ESM::Attribute::Speed).getModified() +
|
float flySpeed = 0.01f*(stats.getAttribute(ESM::Attribute::Speed).getModified() +
|
||||||
mageffects.get(ESM::MagicEffect::Levitate).mMagnitude);
|
mageffects.get(ESM::MagicEffect::Levitate).getMagnitude());
|
||||||
flySpeed = gmst.fMinFlySpeed->getFloat() + flySpeed*(gmst.fMaxFlySpeed->getFloat() - gmst.fMinFlySpeed->getFloat());
|
flySpeed = gmst.fMinFlySpeed->getFloat() + flySpeed*(gmst.fMaxFlySpeed->getFloat() - gmst.fMinFlySpeed->getFloat());
|
||||||
flySpeed *= 1.0f - gmst.fEncumberedMoveEffect->getFloat() * normalizedEncumbrance;
|
flySpeed *= 1.0f - gmst.fEncumberedMoveEffect->getFloat() * normalizedEncumbrance;
|
||||||
flySpeed = std::max(0.0f, flySpeed);
|
flySpeed = std::max(0.0f, flySpeed);
|
||||||
|
@ -556,7 +556,7 @@ namespace MWClass
|
||||||
float swimSpeed = walkSpeed;
|
float swimSpeed = walkSpeed;
|
||||||
if(running)
|
if(running)
|
||||||
swimSpeed = runSpeed;
|
swimSpeed = runSpeed;
|
||||||
swimSpeed *= 1.0f + 0.01f * mageffects.get(ESM::MagicEffect::SwiftSwim).mMagnitude;
|
swimSpeed *= 1.0f + 0.01f * mageffects.get(ESM::MagicEffect::SwiftSwim).getMagnitude();
|
||||||
swimSpeed *= gmst.fSwimRunBase->getFloat() + 0.01f*getSkill(ptr, ESM::Skill::Athletics) *
|
swimSpeed *= gmst.fSwimRunBase->getFloat() + 0.01f*getSkill(ptr, ESM::Skill::Athletics) *
|
||||||
gmst.fSwimRunAthleticsMult->getFloat();
|
gmst.fSwimRunAthleticsMult->getFloat();
|
||||||
moveSpeed = swimSpeed;
|
moveSpeed = swimSpeed;
|
||||||
|
@ -617,7 +617,7 @@ namespace MWClass
|
||||||
float Creature::getArmorRating (const MWWorld::Ptr& ptr) const
|
float Creature::getArmorRating (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
// Note this is currently unused. Creatures do not use armor mitigation.
|
// Note this is currently unused. Creatures do not use armor mitigation.
|
||||||
return getCreatureStats(ptr).getMagicEffects().get(ESM::MagicEffect::Shield).mMagnitude;
|
return getCreatureStats(ptr).getMagicEffects().get(ESM::MagicEffect::Shield).getMagnitude();
|
||||||
}
|
}
|
||||||
|
|
||||||
float Creature::getCapacity (const MWWorld::Ptr& ptr) const
|
float Creature::getCapacity (const MWWorld::Ptr& ptr) const
|
||||||
|
@ -632,9 +632,9 @@ namespace MWClass
|
||||||
|
|
||||||
const MWMechanics::CreatureStats& stats = getCreatureStats (ptr);
|
const MWMechanics::CreatureStats& stats = getCreatureStats (ptr);
|
||||||
|
|
||||||
weight -= stats.getMagicEffects().get (MWMechanics::EffectKey (ESM::MagicEffect::Feather)).mMagnitude;
|
weight -= stats.getMagicEffects().get (MWMechanics::EffectKey (ESM::MagicEffect::Feather)).getMagnitude();
|
||||||
|
|
||||||
weight += stats.getMagicEffects().get (MWMechanics::EffectKey (ESM::MagicEffect::Burden)).mMagnitude;
|
weight += stats.getMagicEffects().get (MWMechanics::EffectKey (ESM::MagicEffect::Burden)).getMagnitude();
|
||||||
|
|
||||||
if (weight<0)
|
if (weight<0)
|
||||||
weight = 0;
|
weight = 0;
|
||||||
|
|
|
@ -565,7 +565,7 @@ namespace MWClass
|
||||||
damage = stats.getSkill(weapskill).getModified();
|
damage = stats.getSkill(weapskill).getModified();
|
||||||
damage *= minstrike + ((maxstrike-minstrike)*stats.getAttackStrength());
|
damage *= minstrike + ((maxstrike-minstrike)*stats.getAttackStrength());
|
||||||
|
|
||||||
healthdmg = (otherstats.getMagicEffects().get(ESM::MagicEffect::Paralyze).mMagnitude > 0)
|
healthdmg = (otherstats.getMagicEffects().get(ESM::MagicEffect::Paralyze).getMagnitude() > 0)
|
||||||
|| otherstats.getKnockedDown();
|
|| otherstats.getKnockedDown();
|
||||||
if(stats.isWerewolf())
|
if(stats.isWerewolf())
|
||||||
{
|
{
|
||||||
|
@ -922,11 +922,11 @@ namespace MWClass
|
||||||
float moveSpeed;
|
float moveSpeed;
|
||||||
if(normalizedEncumbrance >= 1.0f)
|
if(normalizedEncumbrance >= 1.0f)
|
||||||
moveSpeed = 0.0f;
|
moveSpeed = 0.0f;
|
||||||
else if(mageffects.get(ESM::MagicEffect::Levitate).mMagnitude > 0 &&
|
else if(mageffects.get(ESM::MagicEffect::Levitate).getMagnitude() > 0 &&
|
||||||
world->isLevitationEnabled())
|
world->isLevitationEnabled())
|
||||||
{
|
{
|
||||||
float flySpeed = 0.01f*(npcdata->mNpcStats.getAttribute(ESM::Attribute::Speed).getModified() +
|
float flySpeed = 0.01f*(npcdata->mNpcStats.getAttribute(ESM::Attribute::Speed).getModified() +
|
||||||
mageffects.get(ESM::MagicEffect::Levitate).mMagnitude);
|
mageffects.get(ESM::MagicEffect::Levitate).getMagnitude());
|
||||||
flySpeed = gmst.fMinFlySpeed->getFloat() + flySpeed*(gmst.fMaxFlySpeed->getFloat() - gmst.fMinFlySpeed->getFloat());
|
flySpeed = gmst.fMinFlySpeed->getFloat() + flySpeed*(gmst.fMaxFlySpeed->getFloat() - gmst.fMinFlySpeed->getFloat());
|
||||||
flySpeed *= 1.0f - gmst.fEncumberedMoveEffect->getFloat() * normalizedEncumbrance;
|
flySpeed *= 1.0f - gmst.fEncumberedMoveEffect->getFloat() * normalizedEncumbrance;
|
||||||
flySpeed = std::max(0.0f, flySpeed);
|
flySpeed = std::max(0.0f, flySpeed);
|
||||||
|
@ -937,7 +937,7 @@ namespace MWClass
|
||||||
float swimSpeed = walkSpeed;
|
float swimSpeed = walkSpeed;
|
||||||
if(running)
|
if(running)
|
||||||
swimSpeed = runSpeed;
|
swimSpeed = runSpeed;
|
||||||
swimSpeed *= 1.0f + 0.01f * mageffects.get(ESM::MagicEffect::SwiftSwim).mMagnitude;
|
swimSpeed *= 1.0f + 0.01f * mageffects.get(ESM::MagicEffect::SwiftSwim).getMagnitude();
|
||||||
swimSpeed *= gmst.fSwimRunBase->getFloat() + 0.01f*npcdata->mNpcStats.getSkill(ESM::Skill::Athletics).getModified()*
|
swimSpeed *= gmst.fSwimRunBase->getFloat() + 0.01f*npcdata->mNpcStats.getSkill(ESM::Skill::Athletics).getModified()*
|
||||||
gmst.fSwimRunAthleticsMult->getFloat();
|
gmst.fSwimRunAthleticsMult->getFloat();
|
||||||
moveSpeed = swimSpeed;
|
moveSpeed = swimSpeed;
|
||||||
|
@ -975,7 +975,7 @@ namespace MWClass
|
||||||
float x = gmst.fJumpAcrobaticsBase->getFloat() +
|
float x = gmst.fJumpAcrobaticsBase->getFloat() +
|
||||||
std::pow(a / 15.0f, gmst.fJumpAcroMultiplier->getFloat());
|
std::pow(a / 15.0f, gmst.fJumpAcroMultiplier->getFloat());
|
||||||
x += 3.0f * b * gmst.fJumpAcroMultiplier->getFloat();
|
x += 3.0f * b * gmst.fJumpAcroMultiplier->getFloat();
|
||||||
x += mageffects.get(ESM::MagicEffect::Jump).mMagnitude * 64;
|
x += mageffects.get(ESM::MagicEffect::Jump).getMagnitude() * 64;
|
||||||
x *= encumbranceTerm;
|
x *= encumbranceTerm;
|
||||||
|
|
||||||
if(ptr.getClass().getCreatureStats(ptr).getStance(MWMechanics::CreatureStats::Stance_Run))
|
if(ptr.getClass().getCreatureStats(ptr).getStance(MWMechanics::CreatureStats::Stance_Run))
|
||||||
|
@ -998,7 +998,7 @@ namespace MWClass
|
||||||
{
|
{
|
||||||
const float acrobaticsSkill = ptr.getClass().getNpcStats (ptr).getSkill(ESM::Skill::Acrobatics).getModified();
|
const float acrobaticsSkill = ptr.getClass().getNpcStats (ptr).getSkill(ESM::Skill::Acrobatics).getModified();
|
||||||
const NpcCustomData *npcdata = static_cast<const NpcCustomData*>(ptr.getRefData().getCustomData());
|
const NpcCustomData *npcdata = static_cast<const NpcCustomData*>(ptr.getRefData().getCustomData());
|
||||||
const float jumpSpellBonus = npcdata->mNpcStats.getMagicEffects().get(ESM::MagicEffect::Jump).mMagnitude;
|
const float jumpSpellBonus = npcdata->mNpcStats.getMagicEffects().get(ESM::MagicEffect::Jump).getMagnitude();
|
||||||
const float fallAcroBase = store.find("fFallAcroBase")->getFloat();
|
const float fallAcroBase = store.find("fFallAcroBase")->getFloat();
|
||||||
const float fallAcroMult = store.find("fFallAcroMult")->getFloat();
|
const float fallAcroMult = store.find("fFallAcroMult")->getFloat();
|
||||||
const float fallDistanceBase = store.find("fFallDistanceBase")->getFloat();
|
const float fallDistanceBase = store.find("fFallDistanceBase")->getFloat();
|
||||||
|
@ -1104,8 +1104,8 @@ namespace MWClass
|
||||||
if(!stats.isWerewolf())
|
if(!stats.isWerewolf())
|
||||||
{
|
{
|
||||||
weight = getContainerStore(ptr).getWeight();
|
weight = getContainerStore(ptr).getWeight();
|
||||||
weight -= stats.getMagicEffects().get(ESM::MagicEffect::Feather).mMagnitude;
|
weight -= stats.getMagicEffects().get(ESM::MagicEffect::Feather).getMagnitude();
|
||||||
weight += stats.getMagicEffects().get(ESM::MagicEffect::Burden).mMagnitude;
|
weight += stats.getMagicEffects().get(ESM::MagicEffect::Burden).getMagnitude();
|
||||||
if(weight < 0.0f)
|
if(weight < 0.0f)
|
||||||
weight = 0.0f;
|
weight = 0.0f;
|
||||||
}
|
}
|
||||||
|
@ -1170,7 +1170,7 @@ namespace MWClass
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float shield = stats.getMagicEffects().get(ESM::MagicEffect::Shield).mMagnitude;
|
float shield = stats.getMagicEffects().get(ESM::MagicEffect::Shield).getMagnitude();
|
||||||
|
|
||||||
return ratings[MWWorld::InventoryStore::Slot_Cuirass] * 0.3f
|
return ratings[MWWorld::InventoryStore::Slot_Cuirass] * 0.3f
|
||||||
+ (ratings[MWWorld::InventoryStore::Slot_CarriedLeft] + ratings[MWWorld::InventoryStore::Slot_Helmet]
|
+ (ratings[MWWorld::InventoryStore::Slot_CarriedLeft] + ratings[MWWorld::InventoryStore::Slot_Helmet]
|
||||||
|
|
|
@ -492,7 +492,7 @@ bool MWDialogue::Filter::getSelectStructBoolean (const SelectWrapper& select) co
|
||||||
case SelectWrapper::Function_PcCorprus:
|
case SelectWrapper::Function_PcCorprus:
|
||||||
|
|
||||||
return player.getClass().getCreatureStats (player).
|
return player.getClass().getCreatureStats (player).
|
||||||
getMagicEffects().get (ESM::MagicEffect::Corprus).mMagnitude!=0;
|
getMagicEffects().get (ESM::MagicEffect::Corprus).getMagnitude()!=0;
|
||||||
|
|
||||||
case SelectWrapper::Function_PcExpelled:
|
case SelectWrapper::Function_PcExpelled:
|
||||||
{
|
{
|
||||||
|
@ -508,7 +508,7 @@ bool MWDialogue::Filter::getSelectStructBoolean (const SelectWrapper& select) co
|
||||||
case SelectWrapper::Function_PcVampire:
|
case SelectWrapper::Function_PcVampire:
|
||||||
|
|
||||||
return player.getClass().getCreatureStats(player).getMagicEffects().
|
return player.getClass().getCreatureStats(player).getMagicEffects().
|
||||||
get(ESM::MagicEffect::Vampirism).mMagnitude > 0;
|
get(ESM::MagicEffect::Vampirism).getMagnitude() > 0;
|
||||||
|
|
||||||
case SelectWrapper::Function_TalkedToPc:
|
case SelectWrapper::Function_TalkedToPc:
|
||||||
|
|
||||||
|
|
|
@ -146,7 +146,7 @@ void getRestorationPerHourOfSleep (const MWWorld::Ptr& ptr, float& health, float
|
||||||
MWMechanics::CreatureStats& stats = ptr.getClass().getCreatureStats (ptr);
|
MWMechanics::CreatureStats& stats = ptr.getClass().getCreatureStats (ptr);
|
||||||
const MWWorld::Store<ESM::GameSetting>& settings = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
const MWWorld::Store<ESM::GameSetting>& settings = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
||||||
|
|
||||||
bool stunted = stats.getMagicEffects ().get(ESM::MagicEffect::StuntedMagicka).mMagnitude > 0;
|
bool stunted = stats.getMagicEffects ().get(ESM::MagicEffect::StuntedMagicka).getMagnitude() > 0;
|
||||||
int endurance = stats.getAttribute (ESM::Attribute::Endurance).getModified ();
|
int endurance = stats.getAttribute (ESM::Attribute::Endurance).getModified ();
|
||||||
|
|
||||||
health = 0.1 * endurance;
|
health = 0.1 * endurance;
|
||||||
|
@ -385,7 +385,7 @@ namespace MWMechanics
|
||||||
int endurance = creatureStats.getAttribute(ESM::Attribute::Endurance).getModified();
|
int endurance = creatureStats.getAttribute(ESM::Attribute::Endurance).getModified();
|
||||||
|
|
||||||
double magickaFactor =
|
double magickaFactor =
|
||||||
creatureStats.getMagicEffects().get (EffectKey (ESM::MagicEffect::FortifyMaximumMagicka)).mMagnitude * 0.1 + 1;
|
creatureStats.getMagicEffects().get (EffectKey (ESM::MagicEffect::FortifyMaximumMagicka)).getMagnitude() * 0.1 + 1;
|
||||||
|
|
||||||
DynamicStat<float> magicka = creatureStats.getMagicka();
|
DynamicStat<float> magicka = creatureStats.getMagicka();
|
||||||
float diff = (static_cast<int>(magickaFactor*intelligence)) - magicka.getBase();
|
float diff = (static_cast<int>(magickaFactor*intelligence)) - magicka.getBase();
|
||||||
|
@ -473,9 +473,9 @@ namespace MWMechanics
|
||||||
for(int i = 0;i < ESM::Attribute::Length;++i)
|
for(int i = 0;i < ESM::Attribute::Length;++i)
|
||||||
{
|
{
|
||||||
AttributeValue stat = creatureStats.getAttribute(i);
|
AttributeValue stat = creatureStats.getAttribute(i);
|
||||||
stat.setModifier(effects.get(EffectKey(ESM::MagicEffect::FortifyAttribute, i)).mMagnitude -
|
stat.setModifier(effects.get(EffectKey(ESM::MagicEffect::FortifyAttribute, i)).getMagnitude() -
|
||||||
effects.get(EffectKey(ESM::MagicEffect::DrainAttribute, i)).mMagnitude -
|
effects.get(EffectKey(ESM::MagicEffect::DrainAttribute, i)).getMagnitude() -
|
||||||
effects.get(EffectKey(ESM::MagicEffect::AbsorbAttribute, i)).mMagnitude);
|
effects.get(EffectKey(ESM::MagicEffect::AbsorbAttribute, i)).getMagnitude());
|
||||||
|
|
||||||
creatureStats.setAttribute(i, stat);
|
creatureStats.setAttribute(i, stat);
|
||||||
}
|
}
|
||||||
|
@ -484,13 +484,13 @@ namespace MWMechanics
|
||||||
for(int i = 0;i < 3;++i)
|
for(int i = 0;i < 3;++i)
|
||||||
{
|
{
|
||||||
DynamicStat<float> stat = creatureStats.getDynamic(i);
|
DynamicStat<float> stat = creatureStats.getDynamic(i);
|
||||||
stat.setModifier(effects.get(ESM::MagicEffect::FortifyHealth+i).mMagnitude -
|
stat.setModifier(effects.get(ESM::MagicEffect::FortifyHealth+i).getMagnitude() -
|
||||||
effects.get(ESM::MagicEffect::DrainHealth+i).mMagnitude);
|
effects.get(ESM::MagicEffect::DrainHealth+i).getMagnitude());
|
||||||
|
|
||||||
|
|
||||||
float currentDiff = creatureStats.getMagicEffects().get(ESM::MagicEffect::RestoreHealth+i).mMagnitude
|
float currentDiff = creatureStats.getMagicEffects().get(ESM::MagicEffect::RestoreHealth+i).getMagnitude()
|
||||||
- creatureStats.getMagicEffects().get(ESM::MagicEffect::DamageHealth+i).mMagnitude
|
- creatureStats.getMagicEffects().get(ESM::MagicEffect::DamageHealth+i).getMagnitude()
|
||||||
- creatureStats.getMagicEffects().get(ESM::MagicEffect::AbsorbHealth+i).mMagnitude;
|
- creatureStats.getMagicEffects().get(ESM::MagicEffect::AbsorbHealth+i).getMagnitude();
|
||||||
stat.setCurrent(stat.getCurrent() + currentDiff * duration, i == 2);
|
stat.setCurrent(stat.getCurrent() + currentDiff * duration, i == 2);
|
||||||
|
|
||||||
creatureStats.setDynamic(i, stat);
|
creatureStats.setDynamic(i, stat);
|
||||||
|
@ -504,27 +504,27 @@ namespace MWMechanics
|
||||||
if (!creature || ptr.get<ESM::Creature>()->mBase->mData.mType == ESM::Creature::Creatures)
|
if (!creature || ptr.get<ESM::Creature>()->mBase->mData.mType == ESM::Creature::Creatures)
|
||||||
{
|
{
|
||||||
Stat<int> stat = creatureStats.getAiSetting(CreatureStats::AI_Fight);
|
Stat<int> stat = creatureStats.getAiSetting(CreatureStats::AI_Fight);
|
||||||
stat.setModifier(creatureStats.getMagicEffects().get(ESM::MagicEffect::FrenzyHumanoid+creature).mMagnitude
|
stat.setModifier(creatureStats.getMagicEffects().get(ESM::MagicEffect::FrenzyHumanoid+creature).getMagnitude()
|
||||||
- creatureStats.getMagicEffects().get(ESM::MagicEffect::CalmHumanoid+creature).mMagnitude);
|
- creatureStats.getMagicEffects().get(ESM::MagicEffect::CalmHumanoid+creature).getMagnitude());
|
||||||
creatureStats.setAiSetting(CreatureStats::AI_Fight, stat);
|
creatureStats.setAiSetting(CreatureStats::AI_Fight, stat);
|
||||||
|
|
||||||
stat = creatureStats.getAiSetting(CreatureStats::AI_Flee);
|
stat = creatureStats.getAiSetting(CreatureStats::AI_Flee);
|
||||||
stat.setModifier(creatureStats.getMagicEffects().get(ESM::MagicEffect::DemoralizeHumanoid+creature).mMagnitude
|
stat.setModifier(creatureStats.getMagicEffects().get(ESM::MagicEffect::DemoralizeHumanoid+creature).getMagnitude()
|
||||||
- creatureStats.getMagicEffects().get(ESM::MagicEffect::RallyHumanoid+creature).mMagnitude);
|
- creatureStats.getMagicEffects().get(ESM::MagicEffect::RallyHumanoid+creature).getMagnitude());
|
||||||
creatureStats.setAiSetting(CreatureStats::AI_Flee, stat);
|
creatureStats.setAiSetting(CreatureStats::AI_Flee, stat);
|
||||||
}
|
}
|
||||||
if (creature && ptr.get<ESM::Creature>()->mBase->mData.mType == ESM::Creature::Undead)
|
if (creature && ptr.get<ESM::Creature>()->mBase->mData.mType == ESM::Creature::Undead)
|
||||||
{
|
{
|
||||||
Stat<int> stat = creatureStats.getAiSetting(CreatureStats::AI_Flee);
|
Stat<int> stat = creatureStats.getAiSetting(CreatureStats::AI_Flee);
|
||||||
stat.setModifier(creatureStats.getMagicEffects().get(ESM::MagicEffect::TurnUndead).mMagnitude);
|
stat.setModifier(creatureStats.getMagicEffects().get(ESM::MagicEffect::TurnUndead).getMagnitude());
|
||||||
creatureStats.setAiSetting(CreatureStats::AI_Flee, stat);
|
creatureStats.setAiSetting(CreatureStats::AI_Flee, stat);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply disintegration (reduces item health)
|
// Apply disintegration (reduces item health)
|
||||||
float disintegrateWeapon = effects.get(ESM::MagicEffect::DisintegrateWeapon).mMagnitude;
|
float disintegrateWeapon = effects.get(ESM::MagicEffect::DisintegrateWeapon).getMagnitude();
|
||||||
if (disintegrateWeapon > 0)
|
if (disintegrateWeapon > 0)
|
||||||
disintegrateSlot(ptr, MWWorld::InventoryStore::Slot_CarriedRight, disintegrateWeapon*duration);
|
disintegrateSlot(ptr, MWWorld::InventoryStore::Slot_CarriedRight, disintegrateWeapon*duration);
|
||||||
float disintegrateArmor = effects.get(ESM::MagicEffect::DisintegrateArmor).mMagnitude;
|
float disintegrateArmor = effects.get(ESM::MagicEffect::DisintegrateArmor).getMagnitude();
|
||||||
if (disintegrateArmor > 0)
|
if (disintegrateArmor > 0)
|
||||||
{
|
{
|
||||||
// According to UESP
|
// According to UESP
|
||||||
|
@ -556,7 +556,7 @@ namespace MWMechanics
|
||||||
DynamicStat<float> health = creatureStats.getHealth();
|
DynamicStat<float> health = creatureStats.getHealth();
|
||||||
for (unsigned int i=0; i<sizeof(damageEffects)/sizeof(int); ++i)
|
for (unsigned int i=0; i<sizeof(damageEffects)/sizeof(int); ++i)
|
||||||
{
|
{
|
||||||
float magnitude = creatureStats.getMagicEffects().get(damageEffects[i]).mMagnitude;
|
float magnitude = creatureStats.getMagicEffects().get(damageEffects[i]).getMagnitude();
|
||||||
|
|
||||||
if (damageEffects[i] == ESM::MagicEffect::SunDamage)
|
if (damageEffects[i] == ESM::MagicEffect::SunDamage)
|
||||||
{
|
{
|
||||||
|
@ -647,7 +647,7 @@ namespace MWMechanics
|
||||||
for (std::map<int, std::string>::iterator it = boundItemsMap.begin(); it != boundItemsMap.end(); ++it)
|
for (std::map<int, std::string>::iterator it = boundItemsMap.begin(); it != boundItemsMap.end(); ++it)
|
||||||
{
|
{
|
||||||
bool found = creatureStats.mBoundItems.find(it->first) != creatureStats.mBoundItems.end();
|
bool found = creatureStats.mBoundItems.find(it->first) != creatureStats.mBoundItems.end();
|
||||||
int magnitude = creatureStats.getMagicEffects().get(it->first).mMagnitude;
|
int magnitude = creatureStats.getMagicEffects().get(it->first).getMagnitude();
|
||||||
if (found != (magnitude > 0))
|
if (found != (magnitude > 0))
|
||||||
{
|
{
|
||||||
std::string itemGmst = it->second;
|
std::string itemGmst = it->second;
|
||||||
|
@ -704,7 +704,7 @@ namespace MWMechanics
|
||||||
for (std::map<int, std::string>::iterator it = summonMap.begin(); it != summonMap.end(); ++it)
|
for (std::map<int, std::string>::iterator it = summonMap.begin(); it != summonMap.end(); ++it)
|
||||||
{
|
{
|
||||||
bool found = creatureMap.find(it->first) != creatureMap.end();
|
bool found = creatureMap.find(it->first) != creatureMap.end();
|
||||||
int magnitude = creatureStats.getMagicEffects().get(it->first).mMagnitude;
|
int magnitude = creatureStats.getMagicEffects().get(it->first).getMagnitude();
|
||||||
if (found != (magnitude > 0))
|
if (found != (magnitude > 0))
|
||||||
{
|
{
|
||||||
if (magnitude > 0)
|
if (magnitude > 0)
|
||||||
|
@ -808,9 +808,9 @@ namespace MWMechanics
|
||||||
for(int i = 0;i < ESM::Skill::Length;++i)
|
for(int i = 0;i < ESM::Skill::Length;++i)
|
||||||
{
|
{
|
||||||
SkillValue& skill = npcStats.getSkill(i);
|
SkillValue& skill = npcStats.getSkill(i);
|
||||||
skill.setModifier(effects.get(EffectKey(ESM::MagicEffect::FortifySkill, i)).mMagnitude -
|
skill.setModifier(effects.get(EffectKey(ESM::MagicEffect::FortifySkill, i)).getMagnitude() -
|
||||||
effects.get(EffectKey(ESM::MagicEffect::DrainSkill, i)).mMagnitude -
|
effects.get(EffectKey(ESM::MagicEffect::DrainSkill, i)).getMagnitude() -
|
||||||
effects.get(EffectKey(ESM::MagicEffect::AbsorbSkill, i)).mMagnitude);
|
effects.get(EffectKey(ESM::MagicEffect::AbsorbSkill, i)).getMagnitude());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -819,7 +819,7 @@ namespace MWMechanics
|
||||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||||
NpcStats &stats = ptr.getClass().getNpcStats(ptr);
|
NpcStats &stats = ptr.getClass().getNpcStats(ptr);
|
||||||
if(world->isSubmerged(ptr) &&
|
if(world->isSubmerged(ptr) &&
|
||||||
stats.getMagicEffects().get(ESM::MagicEffect::WaterBreathing).mMagnitude == 0)
|
stats.getMagicEffects().get(ESM::MagicEffect::WaterBreathing).getMagnitude() == 0)
|
||||||
{
|
{
|
||||||
float timeLeft = 0.0f;
|
float timeLeft = 0.0f;
|
||||||
if(stats.getFatigue().getCurrent() == 0)
|
if(stats.getFatigue().getCurrent() == 0)
|
||||||
|
@ -1128,7 +1128,7 @@ namespace MWMechanics
|
||||||
for(PtrControllerMap::iterator iter(mActors.begin()); iter != mActors.end(); ++iter)
|
for(PtrControllerMap::iterator iter(mActors.begin()); iter != mActors.end(); ++iter)
|
||||||
{
|
{
|
||||||
if (iter->first.getClass().getCreatureStats(iter->first).getMagicEffects().get(
|
if (iter->first.getClass().getCreatureStats(iter->first).getMagicEffects().get(
|
||||||
ESM::MagicEffect::Paralyze).mMagnitude > 0)
|
ESM::MagicEffect::Paralyze).getMagnitude() > 0)
|
||||||
iter->second->skipAnim();
|
iter->second->skipAnim();
|
||||||
iter->second->update(duration);
|
iter->second->update(duration);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1639,7 +1639,7 @@ void CharacterController::updateContinuousVfx()
|
||||||
for (std::vector<int>::iterator it = effects.begin(); it != effects.end(); ++it)
|
for (std::vector<int>::iterator it = effects.begin(); it != effects.end(); ++it)
|
||||||
{
|
{
|
||||||
if (mPtr.getClass().getCreatureStats(mPtr).isDead()
|
if (mPtr.getClass().getCreatureStats(mPtr).isDead()
|
||||||
|| mPtr.getClass().getCreatureStats(mPtr).getMagicEffects().get(MWMechanics::EffectKey(*it)).mMagnitude <= 0)
|
|| mPtr.getClass().getCreatureStats(mPtr).getMagicEffects().get(MWMechanics::EffectKey(*it)).getMagnitude() <= 0)
|
||||||
mAnimation->removeEffect(*it);
|
mAnimation->removeEffect(*it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1649,14 +1649,14 @@ void CharacterController::updateVisibility()
|
||||||
if (!mPtr.getClass().isActor())
|
if (!mPtr.getClass().isActor())
|
||||||
return;
|
return;
|
||||||
float alpha = 1.f;
|
float alpha = 1.f;
|
||||||
if (mPtr.getClass().getCreatureStats(mPtr).getMagicEffects().get(ESM::MagicEffect::Invisibility).mMagnitude)
|
if (mPtr.getClass().getCreatureStats(mPtr).getMagicEffects().get(ESM::MagicEffect::Invisibility).getMagnitude())
|
||||||
{
|
{
|
||||||
if (mPtr.getRefData().getHandle() == "player")
|
if (mPtr.getRefData().getHandle() == "player")
|
||||||
alpha = 0.4f;
|
alpha = 0.4f;
|
||||||
else
|
else
|
||||||
alpha = 0.f;
|
alpha = 0.f;
|
||||||
}
|
}
|
||||||
float chameleon = mPtr.getClass().getCreatureStats(mPtr).getMagicEffects().get(ESM::MagicEffect::Chameleon).mMagnitude;
|
float chameleon = mPtr.getClass().getCreatureStats(mPtr).getMagicEffects().get(ESM::MagicEffect::Chameleon).getMagnitude();
|
||||||
if (chameleon)
|
if (chameleon)
|
||||||
{
|
{
|
||||||
alpha *= std::max(0.2f, (100.f - chameleon)/100.f);
|
alpha *= std::max(0.2f, (100.f - chameleon)/100.f);
|
||||||
|
|
|
@ -59,7 +59,7 @@ namespace MWMechanics
|
||||||
|
|
||||||
if (blockerStats.getKnockedDown() // Used for both knockout or knockdown
|
if (blockerStats.getKnockedDown() // Used for both knockout or knockdown
|
||||||
|| blockerStats.getHitRecovery()
|
|| blockerStats.getHitRecovery()
|
||||||
|| blockerStats.getMagicEffects().get(ESM::MagicEffect::Paralyze).mMagnitude > 0)
|
|| blockerStats.getMagicEffects().get(ESM::MagicEffect::Paralyze).getMagnitude() > 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Don't block when in spellcasting state (shield is equipped, but not visible)
|
// Don't block when in spellcasting state (shield is equipped, but not visible)
|
||||||
|
@ -144,8 +144,8 @@ namespace MWMechanics
|
||||||
void resistNormalWeapon(const MWWorld::Ptr &actor, const MWWorld::Ptr& attacker, const MWWorld::Ptr &weapon, float &damage)
|
void resistNormalWeapon(const MWWorld::Ptr &actor, const MWWorld::Ptr& attacker, const MWWorld::Ptr &weapon, float &damage)
|
||||||
{
|
{
|
||||||
MWMechanics::CreatureStats& stats = actor.getClass().getCreatureStats(actor);
|
MWMechanics::CreatureStats& stats = actor.getClass().getCreatureStats(actor);
|
||||||
float resistance = std::min(100.f, stats.getMagicEffects().get(ESM::MagicEffect::ResistNormalWeapons).mMagnitude
|
float resistance = std::min(100.f, stats.getMagicEffects().get(ESM::MagicEffect::ResistNormalWeapons).getMagnitude()
|
||||||
- stats.getMagicEffects().get(ESM::MagicEffect::WeaknessToNormalWeapons).mMagnitude);
|
- stats.getMagicEffects().get(ESM::MagicEffect::WeaknessToNormalWeapons).getMagnitude());
|
||||||
|
|
||||||
float multiplier = 1.f - resistance / 100.f;
|
float multiplier = 1.f - resistance / 100.f;
|
||||||
|
|
||||||
|
@ -246,8 +246,8 @@ namespace MWMechanics
|
||||||
(stats.getAttribute(ESM::Attribute::Agility).getModified() / 5.0f) +
|
(stats.getAttribute(ESM::Attribute::Agility).getModified() / 5.0f) +
|
||||||
(stats.getAttribute(ESM::Attribute::Luck).getModified() / 10.0f);
|
(stats.getAttribute(ESM::Attribute::Luck).getModified() / 10.0f);
|
||||||
hitchance *= stats.getFatigueTerm();
|
hitchance *= stats.getFatigueTerm();
|
||||||
hitchance += mageffects.get(ESM::MagicEffect::FortifyAttack).mMagnitude -
|
hitchance += mageffects.get(ESM::MagicEffect::FortifyAttack).getMagnitude() -
|
||||||
mageffects.get(ESM::MagicEffect::Blind).mMagnitude;
|
mageffects.get(ESM::MagicEffect::Blind).getMagnitude();
|
||||||
hitchance -= victim.getClass().getCreatureStats(victim).getEvasion();
|
hitchance -= victim.getClass().getCreatureStats(victim).getEvasion();
|
||||||
return hitchance;
|
return hitchance;
|
||||||
}
|
}
|
||||||
|
@ -256,7 +256,7 @@ namespace MWMechanics
|
||||||
{
|
{
|
||||||
for (int i=0; i<3; ++i)
|
for (int i=0; i<3; ++i)
|
||||||
{
|
{
|
||||||
float magnitude = victim.getClass().getCreatureStats(victim).getMagicEffects().get(ESM::MagicEffect::FireShield+i).mMagnitude;
|
float magnitude = victim.getClass().getCreatureStats(victim).getMagicEffects().get(ESM::MagicEffect::FireShield+i).getMagnitude();
|
||||||
|
|
||||||
if (!magnitude)
|
if (!magnitude)
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -213,8 +213,8 @@ namespace MWMechanics
|
||||||
|
|
||||||
void CreatureStats::setMagicEffects(const MagicEffects &effects)
|
void CreatureStats::setMagicEffects(const MagicEffects &effects)
|
||||||
{
|
{
|
||||||
if (effects.get(ESM::MagicEffect::FortifyMaximumMagicka).mMagnitude
|
if (effects.get(ESM::MagicEffect::FortifyMaximumMagicka).getMagnitude()
|
||||||
!= mMagicEffects.get(ESM::MagicEffect::FortifyMaximumMagicka).mMagnitude)
|
!= mMagicEffects.get(ESM::MagicEffect::FortifyMaximumMagicka).getMagnitude())
|
||||||
mRecalcDynamicStats = true;
|
mRecalcDynamicStats = true;
|
||||||
|
|
||||||
mMagicEffects = effects;
|
mMagicEffects = effects;
|
||||||
|
@ -346,7 +346,7 @@ namespace MWMechanics
|
||||||
float evasion = (getAttribute(ESM::Attribute::Agility).getModified() / 5.0f) +
|
float evasion = (getAttribute(ESM::Attribute::Agility).getModified() / 5.0f) +
|
||||||
(getAttribute(ESM::Attribute::Luck).getModified() / 10.0f);
|
(getAttribute(ESM::Attribute::Luck).getModified() / 10.0f);
|
||||||
evasion *= getFatigueTerm();
|
evasion *= getFatigueTerm();
|
||||||
evasion += mMagicEffects.get(ESM::MagicEffect::Sanctuary).mMagnitude;
|
evasion += mMagicEffects.get(ESM::MagicEffect::Sanctuary).getMagnitude();
|
||||||
|
|
||||||
return evasion;
|
return evasion;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,14 +45,14 @@ namespace MWMechanics
|
||||||
|
|
||||||
float resist = 0.f;
|
float resist = 0.f;
|
||||||
if (hasCorprusEffect)
|
if (hasCorprusEffect)
|
||||||
resist = 1.f - 0.01 * (actor.getClass().getCreatureStats(actor).getMagicEffects().get(ESM::MagicEffect::ResistCorprusDisease).mMagnitude
|
resist = 1.f - 0.01 * (actor.getClass().getCreatureStats(actor).getMagicEffects().get(ESM::MagicEffect::ResistCorprusDisease).getMagnitude()
|
||||||
- actor.getClass().getCreatureStats(actor).getMagicEffects().get(ESM::MagicEffect::WeaknessToCorprusDisease).mMagnitude);
|
- actor.getClass().getCreatureStats(actor).getMagicEffects().get(ESM::MagicEffect::WeaknessToCorprusDisease).getMagnitude());
|
||||||
else if (spell->mData.mType == ESM::Spell::ST_Disease)
|
else if (spell->mData.mType == ESM::Spell::ST_Disease)
|
||||||
resist = 1.f - 0.01 * (actor.getClass().getCreatureStats(actor).getMagicEffects().get(ESM::MagicEffect::ResistCommonDisease).mMagnitude
|
resist = 1.f - 0.01 * (actor.getClass().getCreatureStats(actor).getMagicEffects().get(ESM::MagicEffect::ResistCommonDisease).getMagnitude()
|
||||||
- actor.getClass().getCreatureStats(actor).getMagicEffects().get(ESM::MagicEffect::WeaknessToCommonDisease).mMagnitude);
|
- actor.getClass().getCreatureStats(actor).getMagicEffects().get(ESM::MagicEffect::WeaknessToCommonDisease).getMagnitude());
|
||||||
else if (spell->mData.mType == ESM::Spell::ST_Blight)
|
else if (spell->mData.mType == ESM::Spell::ST_Blight)
|
||||||
resist = 1.f - 0.01 * (actor.getClass().getCreatureStats(actor).getMagicEffects().get(ESM::MagicEffect::ResistBlightDisease).mMagnitude
|
resist = 1.f - 0.01 * (actor.getClass().getCreatureStats(actor).getMagicEffects().get(ESM::MagicEffect::ResistBlightDisease).getMagnitude()
|
||||||
- actor.getClass().getCreatureStats(actor).getMagicEffects().get(ESM::MagicEffect::WeaknessToBlightDisease).mMagnitude);
|
- actor.getClass().getCreatureStats(actor).getMagicEffects().get(ESM::MagicEffect::WeaknessToBlightDisease).getMagnitude());
|
||||||
else
|
else
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,11 @@ namespace MWMechanics
|
||||||
return left.mArg<right.mArg;
|
return left.mArg<right.mArg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float EffectParam::getMagnitude() const
|
||||||
|
{
|
||||||
|
return mMagnitude;
|
||||||
|
}
|
||||||
|
|
||||||
EffectParam::EffectParam() : mMagnitude (0) {}
|
EffectParam::EffectParam() : mMagnitude (0) {}
|
||||||
|
|
||||||
EffectParam& EffectParam::operator+= (const EffectParam& param)
|
EffectParam& EffectParam::operator+= (const EffectParam& param)
|
||||||
|
|
|
@ -28,9 +28,14 @@ namespace MWMechanics
|
||||||
|
|
||||||
struct EffectParam
|
struct EffectParam
|
||||||
{
|
{
|
||||||
// Note usually this would be int, but applying partial resistance might introduce decimal point.
|
private:
|
||||||
|
// Note usually this would be int, but applying partial resistance might introduce a decimal point.
|
||||||
float mMagnitude;
|
float mMagnitude;
|
||||||
|
|
||||||
|
public:
|
||||||
|
/// Get the total magnitude including base and modifier.
|
||||||
|
float getMagnitude() const;
|
||||||
|
|
||||||
EffectParam();
|
EffectParam();
|
||||||
|
|
||||||
EffectParam(float magnitude) : mMagnitude(magnitude) {}
|
EffectParam(float magnitude) : mMagnitude(magnitude) {}
|
||||||
|
|
|
@ -613,7 +613,7 @@ namespace MWMechanics
|
||||||
if (playerStats.getDrawState() == MWMechanics::DrawState_Weapon)
|
if (playerStats.getDrawState() == MWMechanics::DrawState_Weapon)
|
||||||
x += MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fDispWeaponDrawn")->getFloat();
|
x += MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fDispWeaponDrawn")->getFloat();
|
||||||
|
|
||||||
x += ptr.getClass().getCreatureStats(ptr).getMagicEffects().get(ESM::MagicEffect::Charm).mMagnitude;
|
x += ptr.getClass().getCreatureStats(ptr).getMagicEffects().get(ESM::MagicEffect::Charm).getMagnitude();
|
||||||
|
|
||||||
int effective_disposition = std::max(0,std::min(int(x),100));//, normally clamped to [0..100] when used
|
int effective_disposition = std::max(0,std::min(int(x),100));//, normally clamped to [0..100] when used
|
||||||
return effective_disposition;
|
return effective_disposition;
|
||||||
|
@ -1144,7 +1144,7 @@ namespace MWMechanics
|
||||||
|
|
||||||
CreatureStats& stats = ptr.getClass().getCreatureStats(ptr);
|
CreatureStats& stats = ptr.getClass().getCreatureStats(ptr);
|
||||||
|
|
||||||
float invisibility = stats.getMagicEffects().get(ESM::MagicEffect::Invisibility).mMagnitude;
|
float invisibility = stats.getMagicEffects().get(ESM::MagicEffect::Invisibility).getMagnitude();
|
||||||
if (invisibility > 0)
|
if (invisibility > 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -1176,13 +1176,13 @@ namespace MWMechanics
|
||||||
Ogre::Vector3 pos2 (observer.getRefData().getPosition().pos);
|
Ogre::Vector3 pos2 (observer.getRefData().getPosition().pos);
|
||||||
float distTerm = fSneakDistBase + fSneakDistMult * pos1.distance(pos2);
|
float distTerm = fSneakDistBase + fSneakDistMult * pos1.distance(pos2);
|
||||||
|
|
||||||
float chameleon = stats.getMagicEffects().get(ESM::MagicEffect::Chameleon).mMagnitude;
|
float chameleon = stats.getMagicEffects().get(ESM::MagicEffect::Chameleon).getMagnitude();
|
||||||
float x = sneakTerm * distTerm * stats.getFatigueTerm() + chameleon + invisibility;
|
float x = sneakTerm * distTerm * stats.getFatigueTerm() + chameleon + invisibility;
|
||||||
|
|
||||||
CreatureStats& observerStats = observer.getClass().getCreatureStats(observer);
|
CreatureStats& observerStats = observer.getClass().getCreatureStats(observer);
|
||||||
int obsAgility = observerStats.getAttribute(ESM::Attribute::Agility).getModified();
|
int obsAgility = observerStats.getAttribute(ESM::Attribute::Agility).getModified();
|
||||||
int obsLuck = observerStats.getAttribute(ESM::Attribute::Luck).getModified();
|
int obsLuck = observerStats.getAttribute(ESM::Attribute::Luck).getModified();
|
||||||
float obsBlind = observerStats.getMagicEffects().get(ESM::MagicEffect::Blind).mMagnitude;
|
float obsBlind = observerStats.getMagicEffects().get(ESM::MagicEffect::Blind).getMagnitude();
|
||||||
int obsSneak = observer.getClass().getSkill(observer, ESM::Skill::Sneak);
|
int obsSneak = observer.getClass().getSkill(observer, ESM::Skill::Sneak);
|
||||||
|
|
||||||
float obsTerm = obsSneak + 0.2 * obsAgility + 0.1 * obsLuck - obsBlind;
|
float obsTerm = obsSneak + 0.2 * obsAgility + 0.1 * obsLuck - obsBlind;
|
||||||
|
|
|
@ -76,7 +76,7 @@ namespace MWMechanics
|
||||||
{
|
{
|
||||||
CreatureStats& stats = actor.getClass().getCreatureStats(actor);
|
CreatureStats& stats = actor.getClass().getCreatureStats(actor);
|
||||||
|
|
||||||
if (stats.getMagicEffects().get(ESM::MagicEffect::Silence).mMagnitude)
|
if (stats.getMagicEffects().get(ESM::MagicEffect::Silence).getMagnitude())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
float y = FLT_MAX;
|
float y = FLT_MAX;
|
||||||
|
@ -114,7 +114,7 @@ namespace MWMechanics
|
||||||
if (spell->mData.mFlags & ESM::Spell::F_Always)
|
if (spell->mData.mFlags & ESM::Spell::F_Always)
|
||||||
return 100;
|
return 100;
|
||||||
|
|
||||||
int castBonus = -stats.getMagicEffects().get(ESM::MagicEffect::Sound).mMagnitude;
|
int castBonus = -stats.getMagicEffects().get(ESM::MagicEffect::Sound).getMagnitude();
|
||||||
|
|
||||||
int actorWillpower = stats.getAttribute(ESM::Attribute::Willpower).getModified();
|
int actorWillpower = stats.getAttribute(ESM::Attribute::Willpower).getModified();
|
||||||
int actorLuck = stats.getAttribute(ESM::Attribute::Luck).getModified();
|
int actorLuck = stats.getAttribute(ESM::Attribute::Luck).getModified();
|
||||||
|
@ -158,16 +158,16 @@ namespace MWMechanics
|
||||||
|
|
||||||
float resistance = 0;
|
float resistance = 0;
|
||||||
if (resistanceEffect != -1)
|
if (resistanceEffect != -1)
|
||||||
resistance += actorEffects->get(resistanceEffect).mMagnitude;
|
resistance += actorEffects->get(resistanceEffect).getMagnitude();
|
||||||
if (weaknessEffect != -1)
|
if (weaknessEffect != -1)
|
||||||
resistance -= actorEffects->get(weaknessEffect).mMagnitude;
|
resistance -= actorEffects->get(weaknessEffect).getMagnitude();
|
||||||
|
|
||||||
if (effectId == ESM::MagicEffect::FireDamage)
|
if (effectId == ESM::MagicEffect::FireDamage)
|
||||||
resistance += actorEffects->get(ESM::MagicEffect::FireShield).mMagnitude;
|
resistance += actorEffects->get(ESM::MagicEffect::FireShield).getMagnitude();
|
||||||
if (effectId == ESM::MagicEffect::ShockDamage)
|
if (effectId == ESM::MagicEffect::ShockDamage)
|
||||||
resistance += actorEffects->get(ESM::MagicEffect::LightningShield).mMagnitude;
|
resistance += actorEffects->get(ESM::MagicEffect::LightningShield).getMagnitude();
|
||||||
if (effectId == ESM::MagicEffect::FrostDamage)
|
if (effectId == ESM::MagicEffect::FrostDamage)
|
||||||
resistance += actorEffects->get(ESM::MagicEffect::FrostShield).mMagnitude;
|
resistance += actorEffects->get(ESM::MagicEffect::FrostShield).getMagnitude();
|
||||||
|
|
||||||
return resistance;
|
return resistance;
|
||||||
}
|
}
|
||||||
|
@ -306,8 +306,8 @@ namespace MWMechanics
|
||||||
if (spell && (spell->mData.mType == ESM::Spell::ST_Disease || spell->mData.mType == ESM::Spell::ST_Blight))
|
if (spell && (spell->mData.mType == ESM::Spell::ST_Disease || spell->mData.mType == ESM::Spell::ST_Blight))
|
||||||
{
|
{
|
||||||
float x = (spell->mData.mType == ESM::Spell::ST_Disease) ?
|
float x = (spell->mData.mType == ESM::Spell::ST_Disease) ?
|
||||||
target.getClass().getCreatureStats(target).getMagicEffects().get(ESM::MagicEffect::ResistCommonDisease).mMagnitude
|
target.getClass().getCreatureStats(target).getMagicEffects().get(ESM::MagicEffect::ResistCommonDisease).getMagnitude()
|
||||||
: target.getClass().getCreatureStats(target).getMagicEffects().get(ESM::MagicEffect::ResistBlightDisease).mMagnitude;
|
: target.getClass().getCreatureStats(target).getMagicEffects().get(ESM::MagicEffect::ResistBlightDisease).getMagnitude();
|
||||||
|
|
||||||
int roll = std::rand()/ (static_cast<double> (RAND_MAX) + 1) * 100; // [0, 99]
|
int roll = std::rand()/ (static_cast<double> (RAND_MAX) + 1) * 100; // [0, 99]
|
||||||
if (roll <= x)
|
if (roll <= x)
|
||||||
|
@ -339,7 +339,7 @@ namespace MWMechanics
|
||||||
bool absorbed = false;
|
bool absorbed = false;
|
||||||
if (spell && caster != target && target.getClass().isActor())
|
if (spell && caster != target && target.getClass().isActor())
|
||||||
{
|
{
|
||||||
int absorb = target.getClass().getCreatureStats(target).getMagicEffects().get(ESM::MagicEffect::SpellAbsorption).mMagnitude;
|
int absorb = target.getClass().getCreatureStats(target).getMagicEffects().get(ESM::MagicEffect::SpellAbsorption).getMagnitude();
|
||||||
int roll = std::rand()/ (static_cast<double> (RAND_MAX) + 1) * 100; // [0, 99]
|
int roll = std::rand()/ (static_cast<double> (RAND_MAX) + 1) * 100; // [0, 99]
|
||||||
absorbed = (roll < absorb);
|
absorbed = (roll < absorb);
|
||||||
if (absorbed)
|
if (absorbed)
|
||||||
|
@ -388,7 +388,7 @@ namespace MWMechanics
|
||||||
// Try reflecting
|
// Try reflecting
|
||||||
if (!reflected && magnitudeMult > 0 && !caster.isEmpty() && caster != target && !(magicEffect->mData.mFlags & ESM::MagicEffect::Unreflectable))
|
if (!reflected && magnitudeMult > 0 && !caster.isEmpty() && caster != target && !(magicEffect->mData.mFlags & ESM::MagicEffect::Unreflectable))
|
||||||
{
|
{
|
||||||
int reflect = target.getClass().getCreatureStats(target).getMagicEffects().get(ESM::MagicEffect::Reflect).mMagnitude;
|
int reflect = target.getClass().getCreatureStats(target).getMagicEffects().get(ESM::MagicEffect::Reflect).getMagnitude();
|
||||||
int roll = std::rand()/ (static_cast<double> (RAND_MAX) + 1) * 100; // [0, 99]
|
int roll = std::rand()/ (static_cast<double> (RAND_MAX) + 1) * 100; // [0, 99]
|
||||||
bool isReflected = (roll < reflect);
|
bool isReflected = (roll < reflect);
|
||||||
if (isReflected)
|
if (isReflected)
|
||||||
|
|
|
@ -300,7 +300,7 @@ void NpcAnimation::updateParts()
|
||||||
MWWorld::InventoryStore &inv = cls.getInventoryStore(mPtr);
|
MWWorld::InventoryStore &inv = cls.getInventoryStore(mPtr);
|
||||||
|
|
||||||
NpcType curType = Type_Normal;
|
NpcType curType = Type_Normal;
|
||||||
if (cls.getCreatureStats(mPtr).getMagicEffects().get(ESM::MagicEffect::Vampirism).mMagnitude > 0)
|
if (cls.getCreatureStats(mPtr).getMagicEffects().get(ESM::MagicEffect::Vampirism).getMagnitude() > 0)
|
||||||
curType = Type_Vampire;
|
curType = Type_Vampire;
|
||||||
if (cls.getNpcStats(mPtr).isWerewolf())
|
if (cls.getNpcStats(mPtr).isWerewolf())
|
||||||
curType = Type_Werewolf;
|
curType = Type_Werewolf;
|
||||||
|
|
|
@ -339,7 +339,7 @@ void RenderingManager::update (float duration, bool paused)
|
||||||
|
|
||||||
MWWorld::Ptr player = world->getPlayerPtr();
|
MWWorld::Ptr player = world->getPlayerPtr();
|
||||||
|
|
||||||
int blind = player.getClass().getCreatureStats(player).getMagicEffects().get(ESM::MagicEffect::Blind).mMagnitude;
|
int blind = player.getClass().getCreatureStats(player).getMagicEffects().get(ESM::MagicEffect::Blind).getMagnitude();
|
||||||
MWBase::Environment::get().getWindowManager()->setScreenFactor(std::max(0.f, 1.f-(blind / 100.f)));
|
MWBase::Environment::get().getWindowManager()->setScreenFactor(std::max(0.f, 1.f-(blind / 100.f)));
|
||||||
setAmbientMode();
|
setAmbientMode();
|
||||||
|
|
||||||
|
@ -611,7 +611,7 @@ void RenderingManager::setAmbientColour(const Ogre::ColourValue& colour)
|
||||||
mAmbientColor = colour;
|
mAmbientColor = colour;
|
||||||
|
|
||||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||||
int nightEye = player.getClass().getCreatureStats(player).getMagicEffects().get(ESM::MagicEffect::NightEye).mMagnitude;
|
int nightEye = player.getClass().getCreatureStats(player).getMagicEffects().get(ESM::MagicEffect::NightEye).getMagnitude();
|
||||||
Ogre::ColourValue final = colour;
|
Ogre::ColourValue final = colour;
|
||||||
final += Ogre::ColourValue(0.7,0.7,0.7,0) * std::min(1.f, (nightEye/100.f));
|
final += Ogre::ColourValue(0.7,0.7,0.7,0) * std::min(1.f, (nightEye/100.f));
|
||||||
|
|
||||||
|
|
|
@ -356,7 +356,7 @@ namespace MWScript
|
||||||
key = ESM::MagicEffect::effectStringToId(effect);
|
key = ESM::MagicEffect::effectStringToId(effect);
|
||||||
|
|
||||||
runtime.push(ptr.getClass().getCreatureStats(ptr).getMagicEffects().get(
|
runtime.push(ptr.getClass().getCreatureStats(ptr).getMagicEffects().get(
|
||||||
MWMechanics::EffectKey(key)).mMagnitude > 0);
|
MWMechanics::EffectKey(key)).getMagnitude() > 0);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -640,7 +640,7 @@ void MWWorld::InventoryStore::rechargeItems(float duration)
|
||||||
|
|
||||||
void MWWorld::InventoryStore::purgeEffect(short effectId)
|
void MWWorld::InventoryStore::purgeEffect(short effectId)
|
||||||
{
|
{
|
||||||
mMagicEffects.add(MWMechanics::EffectKey(effectId), -mMagicEffects.get(MWMechanics::EffectKey(effectId)).mMagnitude);
|
mMagicEffects.add(MWMechanics::EffectKey(effectId), -mMagicEffects.get(MWMechanics::EffectKey(effectId)).getMagnitude());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MWWorld::InventoryStore::clear()
|
void MWWorld::InventoryStore::clear()
|
||||||
|
|
|
@ -816,7 +816,7 @@ namespace MWWorld
|
||||||
const MWMechanics::MagicEffects& effects = iter->first.getClass().getCreatureStats(iter->first).getMagicEffects();
|
const MWMechanics::MagicEffects& effects = iter->first.getClass().getCreatureStats(iter->first).getMagicEffects();
|
||||||
|
|
||||||
bool waterCollision = false;
|
bool waterCollision = false;
|
||||||
if (effects.get(ESM::MagicEffect::WaterWalking).mMagnitude
|
if (effects.get(ESM::MagicEffect::WaterWalking).getMagnitude()
|
||||||
&& cell->hasWater()
|
&& cell->hasWater()
|
||||||
&& !world->isUnderwater(iter->first.getCell(),
|
&& !world->isUnderwater(iter->first.getCell(),
|
||||||
Ogre::Vector3(iter->first.getRefData().getPosition().pos)))
|
Ogre::Vector3(iter->first.getRefData().getPosition().pos)))
|
||||||
|
@ -832,7 +832,7 @@ namespace MWWorld
|
||||||
0xff, OEngine::Physic::CollisionType_Actor);
|
0xff, OEngine::Physic::CollisionType_Actor);
|
||||||
|
|
||||||
// 100 points of slowfall reduce gravity by 90% (this is just a guess)
|
// 100 points of slowfall reduce gravity by 90% (this is just a guess)
|
||||||
float slowFall = 1-std::min(std::max(0.f, (effects.get(ESM::MagicEffect::SlowFall).mMagnitude / 100.f) * 0.9f), 0.9f);
|
float slowFall = 1-std::min(std::max(0.f, (effects.get(ESM::MagicEffect::SlowFall).getMagnitude() / 100.f) * 0.9f), 0.9f);
|
||||||
|
|
||||||
Ogre::Vector3 newpos = MovementSolver::move(iter->first, iter->second, mTimeAccum,
|
Ogre::Vector3 newpos = MovementSolver::move(iter->first, iter->second, mTimeAccum,
|
||||||
world->isFlying(iter->first),
|
world->isFlying(iter->first),
|
||||||
|
|
|
@ -1544,7 +1544,7 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
float telekinesisRangeBonus =
|
float telekinesisRangeBonus =
|
||||||
mPlayer->getPlayer().getClass().getCreatureStats(mPlayer->getPlayer()).getMagicEffects()
|
mPlayer->getPlayer().getClass().getCreatureStats(mPlayer->getPlayer()).getMagicEffects()
|
||||||
.get(ESM::MagicEffect::Telekinesis).mMagnitude;
|
.get(ESM::MagicEffect::Telekinesis).getMagnitude();
|
||||||
telekinesisRangeBonus = feetToGameUnits(telekinesisRangeBonus);
|
telekinesisRangeBonus = feetToGameUnits(telekinesisRangeBonus);
|
||||||
|
|
||||||
float activationDistance = getMaxActivationDistance() + telekinesisRangeBonus;
|
float activationDistance = getMaxActivationDistance() + telekinesisRangeBonus;
|
||||||
|
@ -1811,7 +1811,7 @@ namespace MWWorld
|
||||||
World::isFlying(const MWWorld::Ptr &ptr) const
|
World::isFlying(const MWWorld::Ptr &ptr) const
|
||||||
{
|
{
|
||||||
const MWMechanics::CreatureStats &stats = ptr.getClass().getCreatureStats(ptr);
|
const MWMechanics::CreatureStats &stats = ptr.getClass().getCreatureStats(ptr);
|
||||||
bool isParalyzed = (stats.getMagicEffects().get(ESM::MagicEffect::Paralyze).mMagnitude > 0);
|
bool isParalyzed = (stats.getMagicEffects().get(ESM::MagicEffect::Paralyze).getMagnitude() > 0);
|
||||||
|
|
||||||
if(!ptr.getClass().isActor())
|
if(!ptr.getClass().isActor())
|
||||||
return false;
|
return false;
|
||||||
|
@ -1822,7 +1822,7 @@ namespace MWWorld
|
||||||
if (ptr.getClass().canFly(ptr))
|
if (ptr.getClass().canFly(ptr))
|
||||||
return !isParalyzed;
|
return !isParalyzed;
|
||||||
|
|
||||||
if(stats.getMagicEffects().get(ESM::MagicEffect::Levitate).mMagnitude > 0
|
if(stats.getMagicEffects().get(ESM::MagicEffect::Levitate).getMagnitude() > 0
|
||||||
&& isLevitationEnabled())
|
&& isLevitationEnabled())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -1840,7 +1840,7 @@ namespace MWWorld
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const MWMechanics::CreatureStats &stats = ptr.getClass().getCreatureStats(ptr);
|
const MWMechanics::CreatureStats &stats = ptr.getClass().getCreatureStats(ptr);
|
||||||
if(stats.getMagicEffects().get(ESM::MagicEffect::SlowFall).mMagnitude > 0)
|
if(stats.getMagicEffects().get(ESM::MagicEffect::SlowFall).getMagnitude() > 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -2661,11 +2661,11 @@ namespace MWWorld
|
||||||
const MWMechanics::MagicEffects& effects = ptr.getClass().getCreatureStats(ptr).getMagicEffects();
|
const MWMechanics::MagicEffects& effects = ptr.getClass().getCreatureStats(ptr).getMagicEffects();
|
||||||
float dist=0;
|
float dist=0;
|
||||||
if (type == World::Detect_Creature)
|
if (type == World::Detect_Creature)
|
||||||
dist = effects.get(ESM::MagicEffect::DetectAnimal).mMagnitude;
|
dist = effects.get(ESM::MagicEffect::DetectAnimal).getMagnitude();
|
||||||
else if (type == World::Detect_Key)
|
else if (type == World::Detect_Key)
|
||||||
dist = effects.get(ESM::MagicEffect::DetectKey).mMagnitude;
|
dist = effects.get(ESM::MagicEffect::DetectKey).getMagnitude();
|
||||||
else if (type == World::Detect_Enchantment)
|
else if (type == World::Detect_Enchantment)
|
||||||
dist = effects.get(ESM::MagicEffect::DetectEnchantment).mMagnitude;
|
dist = effects.get(ESM::MagicEffect::DetectEnchantment).getMagnitude();
|
||||||
|
|
||||||
if (!dist)
|
if (!dist)
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue