using System; using System.Collections; using System.Collections.Generic; using UnityEngine; public class BattleState { private bool playedEmotion; private BattleClock clock; private BuffManager buffManager; private EnergyPool heroEnergy; private EnergyPool monsterEnergy; private BattleDeck heroDeck; private BattleDeck monsterDeck; private PlayArea playArea; private InsightLevel insightLevel; private int STARTING_INSIGHT = 3; public BattleState() { this.clock = new BattleClock(); this.buffManager = new BuffManager(this.clock); this.heroEnergy = new EnergyPool(); this.monsterEnergy = new EnergyPool(); this.playArea = new PlayArea(); this.insightLevel = new InsightLevel(STARTING_INSIGHT); } public void SetDecks(BattleDeck heroDeck, BattleDeck monsterDeck) { this.heroDeck = heroDeck; this.monsterDeck = monsterDeck; } public bool IsTeamsTurnToPlay(TeamChoice team) { if (team == TeamChoice.Heroes) { return this.clock.Now.RoundStep == RoundStep.StartOfHeroTurn; } else { return this.clock.Now.RoundStep == RoundStep.StartOfMonsterTurn; } } public bool CanPlayEmotion(TeamChoice team) { return !playedEmotion && IsTeamsTurnToPlay(team); } public void NotifyPlayedEmotion(TeamChoice team) { if (!CanPlayEmotion(team)) { throw new System.InvalidOperationException("BattleState received NotifyPlayedEmotion but " + "cannot play emotion"); } playedEmotion = true; } public void ClearEmotionPlayed() { this.playedEmotion = false; } public BattleClock Clock {get => this.clock;} public BuffManager BuffManager {get => this.buffManager;} public EnergyPool HeroEnergy {get => this.heroEnergy;} public EnergyPool MonsterEnergy {get => this.monsterEnergy;} public BattleDeck HeroDeck {get => this.heroDeck;} public BattleDeck MonsterDeck {get => this.monsterDeck;} public PlayArea PlayArea {get => this.playArea;} public InsightLevel InsightLevel {get => this.insightLevel;} }