From 8d8fe14fac79337e6620a7474ec8659008205dea Mon Sep 17 00:00:00 2001 From: Andrio Celos Date: Thu, 15 Jun 2023 23:03:12 +1000 Subject: [PATCH] Fix incorrect turn time after a special attack --- TableturfBattleServer/Game.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/TableturfBattleServer/Game.cs b/TableturfBattleServer/Game.cs index fbdecea..27fcd25 100644 --- a/TableturfBattleServer/Game.cs +++ b/TableturfBattleServer/Game.cs @@ -189,6 +189,7 @@ public class Game { } else if (this.State == GameState.Ongoing && this.Players.All(p => p.Move != null)) { var moves = new Move?[this.Players.Count]; var placements = new List(); + var anySpecialAttacks = false; var specialSpacesActivated = new List(); if (this.Board == null) throw new InvalidOperationException("No board?!"); @@ -212,8 +213,10 @@ public class Game { player.Passes++; player.SpecialPoints++; } else { - if (move.IsSpecialAttack) + if (move.IsSpecialAttack) { + anySpecialAttacks = true; player.SpecialPoints -= move.Card.SpecialCost; + } if (placementData == null || move.Card.Size != placementData.Value.cardSize) { if (placementData != null) placements.Add(placementData.Value.placement); @@ -292,7 +295,7 @@ public class Game { foreach (var player in this.Players) player.ClearMoves(); } else { this.TurnNumber++; - this.TurnTimeLeft = this.TurnTimeLimit + 4 + coveringMoves + (specialSpacesActivated.Count > 0 ? 1 : 0); // Extra seconds for the animations. + this.TurnTimeLeft = this.TurnTimeLimit + (anySpecialAttacks ? 6 : 4) + coveringMoves + (specialSpacesActivated.Count > 0 ? 1 : 0); // Extra seconds for the animations. // Draw cards. foreach (var player in this.Players) {