extracted function CreatureStats::isParalyzed()

sceneinput
dteviot 9 years ago
parent ba79d31929
commit ff5ef7055e

@ -704,8 +704,8 @@ void OMW::Engine::activate()
return;
MWWorld::Ptr player = mEnvironment.getWorld()->getPlayerPtr();
if (player.getClass().getCreatureStats(player).getMagicEffects().get(ESM::MagicEffect::Paralyze).getMagnitude() > 0
|| player.getClass().getCreatureStats(player).getKnockedDown())
const MWMechanics::NpcStats &playerStats = player.getClass().getNpcStats(player);
if (playerStats.isParalyzed() || playerStats.getKnockedDown())
return;
MWWorld::Ptr ptr = mEnvironment.getWorld()->getFacedObject();

@ -1037,8 +1037,7 @@ namespace MWMechanics
> sqrProcessingDistance)
continue;
if (iter->first.getClass().getCreatureStats(iter->first).getMagicEffects().get(
ESM::MagicEffect::Paralyze).getMagnitude() > 0)
if (iter->first.getClass().getCreatureStats(iter->first).isParalyzed())
iter->second->getCharacterController()->skipAnim();
// Handle player last, in case a cell transition occurs by casting a teleportation spell
@ -1426,7 +1425,7 @@ namespace MWMechanics
MWWorld::Ptr ptr = it->first;
if (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr()
|| !isConscious(ptr)
|| ptr.getClass().getCreatureStats(ptr).getMagicEffects().get(ESM::MagicEffect::Paralyze).getMagnitude() > 0)
|| ptr.getClass().getCreatureStats(ptr).isParalyzed())
continue;
MWMechanics::AiSequence& seq = ptr.getClass().getCreatureStats(ptr).getAiSequence();
seq.fastForward(ptr, it->second->getAiState());

@ -60,7 +60,7 @@ namespace MWMechanics
if (blockerStats.getKnockedDown() // Used for both knockout or knockdown
|| blockerStats.getHitRecovery()
|| blockerStats.getMagicEffects().get(ESM::MagicEffect::Paralyze).getMagnitude() > 0)
|| blockerStats.isParalyzed())
return false;
if (!MWBase::Environment::get().getMechanicsManager()->isReadyToBlock(blocker))
@ -250,7 +250,7 @@ namespace MWMechanics
&& (attacker == MWBase::Environment::get().getWorld()->getPlayerPtr())
&& (!MWBase::Environment::get().getMechanicsManager()->awarenessCheck(attacker, victim));
if (!(victimStats.getKnockedDown() ||
victimStats.getMagicEffects().get(ESM::MagicEffect::Paralyze).getMagnitude() > 0
victimStats.isParalyzed()
|| unaware ))
{
defenseTerm = victimStats.getEvasion();
@ -375,7 +375,7 @@ namespace MWMechanics
damage *= minstrike + ((maxstrike-minstrike)*attackStrength);
MWMechanics::CreatureStats& otherstats = victim.getClass().getCreatureStats(victim);
healthdmg = (otherstats.getMagicEffects().get(ESM::MagicEffect::Paralyze).getMagnitude() > 0)
healthdmg = otherstats.isParalyzed()
|| otherstats.getKnockedDown();
bool isWerewolf = (attacker.getClass().isNpc() && attacker.getClass().getNpcStats(attacker).isWerewolf());
if(isWerewolf)

@ -221,6 +221,11 @@ namespace MWMechanics
setAiSetting(index, stat);
}
bool CreatureStats::isParalyzed() const
{
return mMagicEffects.get(ESM::MagicEffect::Paralyze).getMagnitude() > 0;
}
bool CreatureStats::isDead() const
{
return mDead;

@ -155,6 +155,8 @@ namespace MWMechanics
float getFatigueTerm() const;
///< Return effective fatigue
bool isParalyzed() const;
bool isDead() const;
void notifyDied();

@ -1927,16 +1927,15 @@ namespace MWWorld
bool World::isFlying(const MWWorld::Ptr &ptr) const
{
const MWMechanics::CreatureStats &stats = ptr.getClass().getCreatureStats(ptr);
bool isParalyzed = (stats.getMagicEffects().get(ESM::MagicEffect::Paralyze).getMagnitude() > 0);
if(!ptr.getClass().isActor())
return false;
if (ptr.getClass().getCreatureStats(ptr).isDead())
if (stats.isDead())
return false;
if (ptr.getClass().canFly(ptr))
return !isParalyzed;
return !stats.isParalyzed();
if(stats.getMagicEffects().get(ESM::MagicEffect::Levitate).getMagnitude() > 0
&& isLevitationEnabled())

Loading…
Cancel
Save