69 lines
2.2 KiB
C#
69 lines
2.2 KiB
C#
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<HeroCard> heroDeck;
|
|
private BattleDeck<MonsterCard> 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<HeroCard> heroDeck, BattleDeck<MonsterCard> 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<HeroCard> HeroDeck {get => this.heroDeck;}
|
|
public BattleDeck<MonsterCard> MonsterDeck {get => this.monsterDeck;}
|
|
public PlayArea PlayArea {get => this.playArea;}
|
|
public InsightLevel InsightLevel {get => this.insightLevel;}
|
|
}
|