Enforce CanMove and CanUseAbility suppression in game flow
This commit is contained in:
@@ -177,6 +177,9 @@ public static class AbilitySystem
|
|||||||
var units = player.Field.OfType<FieldCard>().ToList(); // snapshot
|
var units = player.Field.OfType<FieldCard>().ToList(); // snapshot
|
||||||
foreach (var unit in units)
|
foreach (var unit in units)
|
||||||
{
|
{
|
||||||
|
// SetCanUseAbility(false) suppresses triggered ability firing for this unit.
|
||||||
|
if (!unit.CanUseAbility) continue;
|
||||||
|
|
||||||
var abilities = ParseAbilities(unit.AbilitiesJson);
|
var abilities = ParseAbilities(unit.AbilitiesJson);
|
||||||
for (int i = 0; i < abilities.Length; i++)
|
for (int i = 0; i < abilities.Length; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -554,7 +554,8 @@ public static class GameEngine
|
|||||||
var unit = GetFieldCard(player, unitInstanceId);
|
var unit = GetFieldCard(player, unitInstanceId);
|
||||||
|
|
||||||
if (unit.Position is null) throw new GameException("UNIT_NOT_ON_BOARD");
|
if (unit.Position is null) throw new GameException("UNIT_NOT_ON_BOARD");
|
||||||
if (unit.CurrentMp <= 0) throw new GameException("NO_MP");
|
if (!unit.CanMove) throw new GameException("UNIT_CANNOT_MOVE");
|
||||||
|
if (unit.CurrentMp <= 0) throw new GameException("NO_MP");
|
||||||
|
|
||||||
var from = unit.Position.Value;
|
var from = unit.Position.Value;
|
||||||
var targetTile = board.GetTile(targetPos) ?? throw new GameException("TILE_OUT_OF_BOUNDS");
|
var targetTile = board.GetTile(targetPos) ?? throw new GameException("TILE_OUT_OF_BOUNDS");
|
||||||
|
|||||||
Reference in New Issue
Block a user