mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-23 17:09:42 +00:00
extracted function CreatureStats::isParalyzed()
This commit is contained in:
parent
ba79d31929
commit
ff5ef7055e
6 changed files with 16 additions and 11 deletions
|
@ -704,8 +704,8 @@ void OMW::Engine::activate()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
MWWorld::Ptr player = mEnvironment.getWorld()->getPlayerPtr();
|
MWWorld::Ptr player = mEnvironment.getWorld()->getPlayerPtr();
|
||||||
if (player.getClass().getCreatureStats(player).getMagicEffects().get(ESM::MagicEffect::Paralyze).getMagnitude() > 0
|
const MWMechanics::NpcStats &playerStats = player.getClass().getNpcStats(player);
|
||||||
|| player.getClass().getCreatureStats(player).getKnockedDown())
|
if (playerStats.isParalyzed() || playerStats.getKnockedDown())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
MWWorld::Ptr ptr = mEnvironment.getWorld()->getFacedObject();
|
MWWorld::Ptr ptr = mEnvironment.getWorld()->getFacedObject();
|
||||||
|
|
|
@ -1037,8 +1037,7 @@ namespace MWMechanics
|
||||||
> sqrProcessingDistance)
|
> sqrProcessingDistance)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (iter->first.getClass().getCreatureStats(iter->first).getMagicEffects().get(
|
if (iter->first.getClass().getCreatureStats(iter->first).isParalyzed())
|
||||||
ESM::MagicEffect::Paralyze).getMagnitude() > 0)
|
|
||||||
iter->second->getCharacterController()->skipAnim();
|
iter->second->getCharacterController()->skipAnim();
|
||||||
|
|
||||||
// Handle player last, in case a cell transition occurs by casting a teleportation spell
|
// 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;
|
MWWorld::Ptr ptr = it->first;
|
||||||
if (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr()
|
if (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr()
|
||||||
|| !isConscious(ptr)
|
|| !isConscious(ptr)
|
||||||
|| ptr.getClass().getCreatureStats(ptr).getMagicEffects().get(ESM::MagicEffect::Paralyze).getMagnitude() > 0)
|
|| ptr.getClass().getCreatureStats(ptr).isParalyzed())
|
||||||
continue;
|
continue;
|
||||||
MWMechanics::AiSequence& seq = ptr.getClass().getCreatureStats(ptr).getAiSequence();
|
MWMechanics::AiSequence& seq = ptr.getClass().getCreatureStats(ptr).getAiSequence();
|
||||||
seq.fastForward(ptr, it->second->getAiState());
|
seq.fastForward(ptr, it->second->getAiState());
|
||||||
|
|
|
@ -60,7 +60,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).getMagnitude() > 0)
|
|| blockerStats.isParalyzed())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!MWBase::Environment::get().getMechanicsManager()->isReadyToBlock(blocker))
|
if (!MWBase::Environment::get().getMechanicsManager()->isReadyToBlock(blocker))
|
||||||
|
@ -250,7 +250,7 @@ namespace MWMechanics
|
||||||
&& (attacker == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
&& (attacker == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||||
&& (!MWBase::Environment::get().getMechanicsManager()->awarenessCheck(attacker, victim));
|
&& (!MWBase::Environment::get().getMechanicsManager()->awarenessCheck(attacker, victim));
|
||||||
if (!(victimStats.getKnockedDown() ||
|
if (!(victimStats.getKnockedDown() ||
|
||||||
victimStats.getMagicEffects().get(ESM::MagicEffect::Paralyze).getMagnitude() > 0
|
victimStats.isParalyzed()
|
||||||
|| unaware ))
|
|| unaware ))
|
||||||
{
|
{
|
||||||
defenseTerm = victimStats.getEvasion();
|
defenseTerm = victimStats.getEvasion();
|
||||||
|
@ -375,7 +375,7 @@ namespace MWMechanics
|
||||||
damage *= minstrike + ((maxstrike-minstrike)*attackStrength);
|
damage *= minstrike + ((maxstrike-minstrike)*attackStrength);
|
||||||
|
|
||||||
MWMechanics::CreatureStats& otherstats = victim.getClass().getCreatureStats(victim);
|
MWMechanics::CreatureStats& otherstats = victim.getClass().getCreatureStats(victim);
|
||||||
healthdmg = (otherstats.getMagicEffects().get(ESM::MagicEffect::Paralyze).getMagnitude() > 0)
|
healthdmg = otherstats.isParalyzed()
|
||||||
|| otherstats.getKnockedDown();
|
|| otherstats.getKnockedDown();
|
||||||
bool isWerewolf = (attacker.getClass().isNpc() && attacker.getClass().getNpcStats(attacker).isWerewolf());
|
bool isWerewolf = (attacker.getClass().isNpc() && attacker.getClass().getNpcStats(attacker).isWerewolf());
|
||||||
if(isWerewolf)
|
if(isWerewolf)
|
||||||
|
|
|
@ -221,6 +221,11 @@ namespace MWMechanics
|
||||||
setAiSetting(index, stat);
|
setAiSetting(index, stat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CreatureStats::isParalyzed() const
|
||||||
|
{
|
||||||
|
return mMagicEffects.get(ESM::MagicEffect::Paralyze).getMagnitude() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
bool CreatureStats::isDead() const
|
bool CreatureStats::isDead() const
|
||||||
{
|
{
|
||||||
return mDead;
|
return mDead;
|
||||||
|
|
|
@ -155,6 +155,8 @@ namespace MWMechanics
|
||||||
float getFatigueTerm() const;
|
float getFatigueTerm() const;
|
||||||
///< Return effective fatigue
|
///< Return effective fatigue
|
||||||
|
|
||||||
|
bool isParalyzed() const;
|
||||||
|
|
||||||
bool isDead() const;
|
bool isDead() const;
|
||||||
|
|
||||||
void notifyDied();
|
void notifyDied();
|
||||||
|
|
|
@ -1927,16 +1927,15 @@ namespace MWWorld
|
||||||
bool World::isFlying(const MWWorld::Ptr &ptr) const
|
bool 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).getMagnitude() > 0);
|
|
||||||
|
|
||||||
if(!ptr.getClass().isActor())
|
if(!ptr.getClass().isActor())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (ptr.getClass().getCreatureStats(ptr).isDead())
|
if (stats.isDead())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (ptr.getClass().canFly(ptr))
|
if (ptr.getClass().canFly(ptr))
|
||||||
return !isParalyzed;
|
return !stats.isParalyzed();
|
||||||
|
|
||||||
if(stats.getMagicEffects().get(ESM::MagicEffect::Levitate).getMagnitude() > 0
|
if(stats.getMagicEffects().get(ESM::MagicEffect::Levitate).getMagnitude() > 0
|
||||||
&& isLevitationEnabled())
|
&& isLevitationEnabled())
|
||||||
|
|
Loading…
Reference in a new issue