update
This commit is contained in:
@@ -725,7 +725,24 @@ public static class GameEngine
|
||||
|
||||
// Target counter-attacks if able and still alive.
|
||||
if (target.CurrentHealth > 0 && target.CanAttack && !target.IsExhausted)
|
||||
ApplyDamage(attacker, target.Damage ?? 0);
|
||||
{
|
||||
var canCounterAttack = true;
|
||||
|
||||
if (state.Board is not null && target.Position.HasValue && attacker.Position.HasValue)
|
||||
{
|
||||
var occupancy = state.Board.BuildOccupancyMap();
|
||||
var targetMinRange = target.MinAttackRange ?? 1;
|
||||
var targetMaxRange = target.MaxAttackRange ?? 1;
|
||||
|
||||
canCounterAttack = AttackSystem.CanAttack(
|
||||
target.Position.Value, attacker.Position.Value,
|
||||
targetMinRange, targetMaxRange, target.RequiresLos,
|
||||
state.Board, occupancy);
|
||||
}
|
||||
|
||||
if (canCounterAttack)
|
||||
ApplyDamage(attacker, target.Damage ?? 0);
|
||||
}
|
||||
|
||||
// Consume extra attack or exhaust normally.
|
||||
if (attacker.ExtraAttacksRemaining > 0)
|
||||
|
||||
Reference in New Issue
Block a user