Finish merging BattleClock and BattleState

This commit is contained in:
henriquenakashima 2020-10-13 00:25:55 -04:00
parent 658978682b
commit 5962ea9fd6
4 changed files with 17 additions and 25 deletions

View file

@ -154,7 +154,6 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
private IEnumerator RunBattleRound() {
this.state.Clock.AdvanceRound();
this.state.AdvanceToTeamTurn(TeamChoice.Heroes);
this.damageTriggers.RemoveAll(t => t.Expiration == TriggerExpiration.StartOfNextHeroTurn);
@ -162,7 +161,7 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
monsterEnergy.Replenish();
if (STABLE_HAND_STYLE) {
if (this.state.Round > 1) {
if (this.state.Clock.Now.RoundNumber > 1) {
this.heroDeck.DrawCards(3);
this.monsterDeck.DrawCards(3);
}
@ -173,7 +172,6 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
yield return RunHeroTurn();
this.state.AdvanceToTeamTurn(TeamChoice.Monsters);
yield return RunMonsterTurn();
this.state.Clock.AdvanceToStep(RoundStep.EndOfRound);
@ -183,6 +181,7 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
private IEnumerator RunHeroTurn() {
// Start of hero turn
this.state.Clock.AdvanceToStep(RoundStep.StartOfHeroTurn);
this.state.ClearEmotionPlayed();
OnBattleStateChanged();
this.monsterIntentions.ResumeIntentions();
@ -224,15 +223,16 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
}
private IEnumerator RunMonsterTurn() {
this.state.Clock.AdvanceToStep(RoundStep.StartOfMonsterTurn);
OnBattleStateChanged();
yield return new WaitForSeconds(0.5f);
// Start of monster turn
this.state.Clock.AdvanceToStep(RoundStep.StartOfMonsterTurn);
this.state.ClearEmotionPlayed();
foreach (BattleMonster monster in this.monsters) {
monster.ResetBlock();
}
OnBattleStateChanged();
yield return new WaitForSeconds(0.5f);
// Monsters play an emotion
List<MonsterCard> monsterHand = this.monsterDeck.GetHandPile();