public void EndTurn() { HideEndTurnButton(); ActivePlayer.EndTurn(); ActivePlayer = ActivePlayer == players[0] ? players[1] : players[0]; CurrentGameState = GameState.NEW_TURN; newTurnPanel.SetActivePlayer(ActivePlayer); newTurnPanel.Activate(); }
public void EndTurn() { if (GameState == GameFieldState.GameOver || GameState == GameFieldState.TurnEnding) { return; } GameState = GameFieldState.TurnEnding; var abilitiesToRemove = new List <Ability>(); foreach (var ability in TemporaryPassiveAbilities.OfType <PassiveAbility>()) { ability.TurnsLeft--; if (ability.TurnsLeft <= 0 && ability.LimitedByTime) { abilitiesToRemove.Add(ability); } } foreach (var ability in abilitiesToRemove) { TemporaryPassiveAbilities.Remove(ability); } EnergyRule = new StandardEnergyRule(); EnergyRule.Reset(); ActivePlayer.EndTurn(this); ActivePlayer.TurnsTaken++; foreach (var pokemon in ActivePlayer.GetAllPokemonCards()) { foreach (var attack in pokemon.Attacks) { attack.Disabled = false; } } foreach (var pokemon in ActivePlayer.GetAllPokemonCards()) { pokemon.AbilityDisabled = false; } NonActivePlayer.EndTurn(this); CheckDeadPokemon(); SwapActivePlayer(); FirstTurn = false; StartNextTurn(); PushGameLogUpdatesToPlayers(); SendEventToPlayers(new GameSyncEvent { Game = this }); }