mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-28 21:07:59 +03:00
Merge branch 'combatparalysis' into 'master'
Some checks failed
Build and test / Ubuntu (push) Has been cancelled
Build and test / MacOS (push) Has been cancelled
Build and test / Read .env file and expose it as output (push) Has been cancelled
Build and test / Windows (2019) (push) Has been cancelled
Build and test / Windows (2022) (push) Has been cancelled
Some checks failed
Build and test / Ubuntu (push) Has been cancelled
Build and test / MacOS (push) Has been cancelled
Build and test / Read .env file and expose it as output (push) Has been cancelled
Build and test / Windows (2019) (push) Has been cancelled
Build and test / Windows (2022) (push) Has been cancelled
Put combat actions on hold when the actor is incapacitated (#7979) Closes #7979 See merge request OpenMW/openmw!4597
This commit is contained in:
commit
5891088eba
1 changed files with 10 additions and 9 deletions
|
@ -171,11 +171,16 @@ namespace MWMechanics
|
|||
currentCell = actor.getCell();
|
||||
}
|
||||
|
||||
const MWWorld::Class& actorClass = actor.getClass();
|
||||
MWMechanics::CreatureStats& stats = actorClass.getCreatureStats(actor);
|
||||
if (stats.isParalyzed() || stats.getKnockedDown())
|
||||
return false;
|
||||
|
||||
bool forceFlee = false;
|
||||
if (!canFight(actor, target))
|
||||
{
|
||||
storage.stopAttack();
|
||||
actor.getClass().getCreatureStats(actor).setAttackingOrSpell(false);
|
||||
stats.setAttackingOrSpell(false);
|
||||
storage.mActionCooldown = 0.f;
|
||||
// Continue combat if target is player or player follower/escorter and an attack has been attempted
|
||||
const auto& playerFollowersAndEscorters
|
||||
|
@ -184,18 +189,14 @@ namespace MWMechanics
|
|||
= (std::find(playerFollowersAndEscorters.begin(), playerFollowersAndEscorters.end(), target)
|
||||
!= playerFollowersAndEscorters.end());
|
||||
if ((target == MWMechanics::getPlayer() || targetSidesWithPlayer)
|
||||
&& ((actor.getClass().getCreatureStats(actor).getHitAttemptActorId()
|
||||
== target.getClass().getCreatureStats(target).getActorId())
|
||||
|| (target.getClass().getCreatureStats(target).getHitAttemptActorId()
|
||||
== actor.getClass().getCreatureStats(actor).getActorId())))
|
||||
&& ((stats.getHitAttemptActorId() == target.getClass().getCreatureStats(target).getActorId())
|
||||
|| (target.getClass().getCreatureStats(target).getHitAttemptActorId() == stats.getActorId())))
|
||||
forceFlee = true;
|
||||
else // Otherwise end combat
|
||||
return true;
|
||||
}
|
||||
|
||||
const MWWorld::Class& actorClass = actor.getClass();
|
||||
actorClass.getCreatureStats(actor).setMovementFlag(CreatureStats::Flag_Run, true);
|
||||
|
||||
stats.setMovementFlag(CreatureStats::Flag_Run, true);
|
||||
float& actionCooldown = storage.mActionCooldown;
|
||||
std::unique_ptr<Action>& currentAction = storage.mCurrentAction;
|
||||
|
||||
|
@ -323,7 +324,7 @@ namespace MWMechanics
|
|||
{
|
||||
storage.mUseCustomDestination = false;
|
||||
storage.stopAttack();
|
||||
actor.getClass().getCreatureStats(actor).setAttackingOrSpell(false);
|
||||
stats.setAttackingOrSpell(false);
|
||||
currentAction = std::make_unique<ActionFlee>();
|
||||
actionCooldown = currentAction->getActionCooldown();
|
||||
storage.startFleeing();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue