fix(combat): escape occupied login positions
Port retail's radius-aware placement ring so a relogging player is seated beside creatures occupying the saved location, and register the local body in the shared resolved-shadow pipeline. Route new forward movement and jump through AbortAutomaticAttack so repeat combat cancels immediately on movement. Co-Authored-By: Codex <codex@openai.com>
This commit is contained in:
parent
e671b8a5c4
commit
00fe993f6f
11 changed files with 643 additions and 16 deletions
|
|
@ -128,6 +128,57 @@ public sealed class CombatAttackControllerTests
|
|||
Assert.Equal(0f, controller.PowerBarLevel);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MovementAbort_DuringRepeat_SendsCancelAndPreventsNextAttack()
|
||||
{
|
||||
double now = 20d;
|
||||
int cancels = 0;
|
||||
var sent = new List<(AttackHeight Height, float Power)>();
|
||||
var combat = new CombatState();
|
||||
using var controller = new CombatAttackController(
|
||||
combat,
|
||||
canStartAttack: () => true,
|
||||
sendAttack: (height, power) =>
|
||||
{
|
||||
sent.Add((height, power));
|
||||
return true;
|
||||
},
|
||||
sendCancelAttack: () => cancels++,
|
||||
autoRepeatAttack: () => true,
|
||||
now: () => now);
|
||||
combat.SetCombatMode(CombatMode.Melee);
|
||||
|
||||
controller.PressAttack(AttackHeight.Medium);
|
||||
now += 0.5d;
|
||||
controller.ReleaseAttack();
|
||||
Assert.Single(sent);
|
||||
|
||||
controller.HandleMovementInput(
|
||||
InputAction.MovementForward, ActivationType.Press);
|
||||
combat.OnAttackDone(1u, 0u);
|
||||
|
||||
Assert.Equal(1, cancels);
|
||||
Assert.Single(sent);
|
||||
Assert.False(controller.BuildInProgress);
|
||||
Assert.Equal(0f, controller.PowerBarLevel);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MovementAbort_WhileIdle_DoesNotSendCancel()
|
||||
{
|
||||
int cancels = 0;
|
||||
var combat = new CombatState();
|
||||
using var controller = new CombatAttackController(
|
||||
combat,
|
||||
canStartAttack: () => true,
|
||||
sendAttack: (_, _) => true,
|
||||
sendCancelAttack: () => cancels++);
|
||||
|
||||
controller.AbortAutomaticAttack();
|
||||
|
||||
Assert.Equal(0, cancels);
|
||||
}
|
||||
|
||||
private static CombatAttackController Create(
|
||||
CombatState combat,
|
||||
Func<double> now,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue