mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 23:53:52 +00:00
Merged pull request #1899
This commit is contained in:
commit
57922a272c
3 changed files with 11 additions and 13 deletions
|
@ -253,7 +253,7 @@ namespace MWClass
|
|||
|
||||
// For AI actors, get combat targets to use in the ray cast. Only those targets will return a positive hit result.
|
||||
std::vector<MWWorld::Ptr> targetActors;
|
||||
if (!ptr.isEmpty() && ptr.getClass().isActor() && ptr != MWMechanics::getPlayer())
|
||||
if (!ptr.isEmpty() && ptr.getClass().isActor())
|
||||
ptr.getClass().getCreatureStats(ptr).getAiSequence().getCombatTargets(targetActors);
|
||||
|
||||
std::pair<MWWorld::Ptr, osg::Vec3f> result = MWBase::Environment::get().getWorld()->getHitContact(ptr, dist, targetActors);
|
||||
|
@ -325,9 +325,6 @@ namespace MWClass
|
|||
if (MWMechanics::blockMeleeAttack(ptr, victim, weapon, damage, attackStrength))
|
||||
damage = 0;
|
||||
|
||||
if (victim == MWMechanics::getPlayer() && MWBase::Environment::get().getWorld()->getGodModeState())
|
||||
damage = 0;
|
||||
|
||||
MWMechanics::diseaseContact(victim, ptr);
|
||||
|
||||
victim.getClass().onHit(victim, damage, healthdmg, weapon, ptr, hitPosition, true);
|
||||
|
@ -376,11 +373,6 @@ namespace MWClass
|
|||
ptr.getRefData().getLocals().setVarByInt(script, "onpchitme", 1);
|
||||
}
|
||||
|
||||
bool godmode = object == MWMechanics::getPlayer() && MWBase::Environment::get().getWorld()->getGodModeState();
|
||||
|
||||
if (godmode)
|
||||
damage = 0;
|
||||
|
||||
if (!successful)
|
||||
{
|
||||
// Missed
|
||||
|
@ -415,7 +407,7 @@ namespace MWClass
|
|||
|
||||
if(ishealth)
|
||||
{
|
||||
if (!attacker.isEmpty() && !godmode)
|
||||
if (!attacker.isEmpty())
|
||||
{
|
||||
damage = scaleDamage(damage, attacker, ptr);
|
||||
MWBase::Environment::get().getWorld()->spawnBloodEffect(ptr, hitPosition);
|
||||
|
|
|
@ -992,6 +992,10 @@ namespace MWClass
|
|||
if(getEncumbrance(ptr) > getCapacity(ptr))
|
||||
return 0.f;
|
||||
|
||||
const MWMechanics::CreatureStats& stats = ptr.getClass().getCreatureStats(ptr);
|
||||
if (stats.isParalyzed() || stats.getKnockedDown() || stats.isDead())
|
||||
return 0.f;
|
||||
|
||||
const NpcCustomData *npcdata = static_cast<const NpcCustomData*>(ptr.getRefData().getCustomData());
|
||||
const GMST& gmst = getGmst();
|
||||
const MWMechanics::MagicEffects &mageffects = npcdata->mNpcStats.getMagicEffects();
|
||||
|
@ -1013,7 +1017,7 @@ namespace MWClass
|
|||
x += mageffects.get(ESM::MagicEffect::Jump).getMagnitude() * 64;
|
||||
x *= encumbranceTerm;
|
||||
|
||||
if(ptr.getClass().getCreatureStats(ptr).getStance(MWMechanics::CreatureStats::Stance_Run))
|
||||
if(stats.getStance(MWMechanics::CreatureStats::Stance_Run))
|
||||
x *= gmst.fJumpRunMultiplier->getFloat();
|
||||
x *= npcdata->mNpcStats.getFatigueTerm();
|
||||
x -= -627.2f;/*gravity constant*/
|
||||
|
|
|
@ -1824,6 +1824,7 @@ void CharacterController::update(float duration)
|
|||
else if(!cls.getCreatureStats(mPtr).isDead())
|
||||
{
|
||||
bool onground = world->isOnGround(mPtr);
|
||||
bool incapacitated = (cls.getCreatureStats(mPtr).isParalyzed() || cls.getCreatureStats(mPtr).getKnockedDown());
|
||||
bool inwater = world->isSwimming(mPtr);
|
||||
bool sneak = cls.getCreatureStats(mPtr).getStance(MWMechanics::CreatureStats::Stance_Sneak);
|
||||
bool flying = world->isFlying(mPtr);
|
||||
|
@ -1942,7 +1943,7 @@ void CharacterController::update(float duration)
|
|||
cls.getCreatureStats(mPtr).setFatigue(fatigue);
|
||||
}
|
||||
|
||||
if(sneak || inwater || flying)
|
||||
if(sneak || inwater || flying || incapacitated)
|
||||
vec.z() = 0.0f;
|
||||
|
||||
bool inJump = true;
|
||||
|
@ -2021,7 +2022,8 @@ void CharacterController::update(float duration)
|
|||
const int acrobaticsSkill = cls.getSkill(mPtr, ESM::Skill::Acrobatics);
|
||||
if (healthLost > (acrobaticsSkill * fatigueTerm))
|
||||
{
|
||||
cls.getCreatureStats(mPtr).setKnockedDown(true);
|
||||
if (!godmode)
|
||||
cls.getCreatureStats(mPtr).setKnockedDown(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue