@@ -1498,6 +1498,11 @@ bool Npc::implAttack(uint64_t dt) {
14981498 FightAlgo::Action act = fghAlgo.nextFromQueue (*this ,*currentTarget,owner.script ());
14991499
15001500 if (act==FightAlgo::MV_BLOCK) {
1501+ if (!fghAlgo.isInFocusAngle (*this , *currentTarget)) {
1502+ fghAlgo.consumeAction ();
1503+ return true ;
1504+ }
1505+
15011506 switch (ws) {
15021507 case WeaponState::Fist: {
15031508 if (blockFist ())
@@ -1623,6 +1628,20 @@ bool Npc::implAttack(uint64_t dt) {
16231628 }
16241629
16251630 if (act==FightAlgo::MV_JUMPBACK) {
1631+ if (isSwim ()) {
1632+ fghAlgo.consumeAction ();
1633+ return true ;
1634+ }
1635+ if (bodyStateMasked ()==BS_PARADE) {
1636+ fghAlgo.consumeAction ();
1637+ return true ;
1638+ }
1639+ if (!fghAlgo.isInFocusAngle (*this , *currentTarget)) {
1640+ // NOTE: jump-back is ultimate defence, so better to use it only if npc face player directly
1641+ fghAlgo.consumeAction ();
1642+ aiState.loopNextTime = owner.tickCount (); // force ZS_MM_Attack_Loop call
1643+ return true ;
1644+ }
16261645 if (setAnim (Npc::Anim::MoveBack)) {
16271646 implFaiWait (visual.pose ().animationTotalTime ());
16281647 fghAlgo.consumeAction ();
@@ -1834,10 +1853,11 @@ void Npc::takeDamage(Npc &other, const Bullet* b) {
18341853 return ;
18351854
18361855 assert (b==nullptr || !b->isSpell ());
1837- const bool isJumpb = visual.pose ().isJumpBack ();
1838- const bool isBlock = (!other.isMonster () || other.inventory ().activeWeapon ()!=nullptr ) &&
1839- fghAlgo.isInFocusAngle (*this ,other) &&
1840- visual.pose ().isDefence (owner.tickCount ());
1856+ const auto & pose = visual.pose ();
1857+ const bool isJumpb = pose.isJumpBack () && !pose.isDefence (owner.tickCount ());
1858+ const bool isBlock = (!other.isMonster () || other.inventory ().activeWeapon ()!=nullptr ) &&
1859+ fghAlgo.isInFocusAngle (*this ,other) &&
1860+ pose.isDefence (owner.tickCount ());
18411861
18421862 lastHit = &other;
18431863 if (!isPlayer ())
0 commit comments