From cb88ae78b6b032f2f634fa0d3604f9c98482f3d6 Mon Sep 17 00:00:00 2001 From: henriquenakashima Date: Tue, 13 Oct 2020 01:00:49 -0400 Subject: [PATCH] Move PlayArea into BattleState --- Assets/Battle/BattleController.cs | 12 +++++------- Assets/Battle/BattleState.cs | 3 +++ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Assets/Battle/BattleController.cs b/Assets/Battle/BattleController.cs index 20788da..1399345 100644 --- a/Assets/Battle/BattleController.cs +++ b/Assets/Battle/BattleController.cs @@ -19,7 +19,6 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe // Private private HeroCardDatabase heroCardDatabase; private MonsterCardDatabase monsterCardDatabase; - private PlayArea playArea; private BattleHero[] heroes; @@ -87,7 +86,6 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe this.monsterCardDatabase, parameters.MCardIds.Cast().ToArray(), mCardOwners); this.state.SetDecks(heroDeck, monsterDeck); this.participantActivity = new ParticipantActivity(); - this.playArea = new PlayArea(); this.heroHandPlayability = new HandPlayability( this.state, this.state.HeroEnergy, TeamChoice.Heroes, this.state.HeroDeck); @@ -100,7 +98,7 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe this.state.MonsterDeck, this.state.MonsterEnergy, this.monsterHandPlayability); this.battlePlayerControls.Init( - this.state.HeroDeck, this.state.MonsterDeck, this.playArea, this.insightLevel, + this.state.HeroDeck, this.state.MonsterDeck, this.state.PlayArea, this.insightLevel, this.heroHandPlayability, this.monsterHandPlayability, this.monsterIntentions, this.uiCanvas.transform.localScale.x); this.insightLevel.OnChanged += this.battlePlayerControls.NotifyInsightLevelChanged; @@ -198,7 +196,7 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe } // End of hero turn - yield return this.playArea.UseHeroDefaults(this.heroes, this.participantActivity, UseHeroDefault); + yield return this.state.PlayArea.UseHeroDefaults(this.heroes, this.participantActivity, UseHeroDefault); if (STABLE_HAND_STYLE) { this.state.HeroDeck.DiscardInExcessOf(3); } else { @@ -286,7 +284,7 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe if (card.Type == CardType.Default) { // Already added to playArea by effect } else if (card.IsPermanent()) { - this.playArea.AddPlayedHeroPermanent(card); + this.state.PlayArea.AddPlayedHeroPermanent(card); } else if (card.IsEphemeral()) { this.state.HeroDeck.MoveCardToOblivion(card); } else { @@ -313,7 +311,7 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe this.state.MonsterDeck.RemoveCardFromHand(card); yield return card.Use(this, this); if (card.IsPermanent()) { - this.playArea.AddPlayedMonsterPermanent(card); + this.state.PlayArea.AddPlayedMonsterPermanent(card); } else if (card.IsEphemeral()) { this.state.MonsterDeck.MoveCardToOblivion(card); } else { @@ -574,7 +572,7 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe } public void SetupDefault(DefaultEffect effect) { - DefaultHeroCard previousDefault = this.playArea.SetupDefault(effect); + DefaultHeroCard previousDefault = this.state.PlayArea.SetupDefault(effect); if (previousDefault != null) { this.state.HeroDeck.MoveCardToDiscard(previousDefault); } diff --git a/Assets/Battle/BattleState.cs b/Assets/Battle/BattleState.cs index d0b4456..db179d2 100644 --- a/Assets/Battle/BattleState.cs +++ b/Assets/Battle/BattleState.cs @@ -12,12 +12,14 @@ public class BattleState private EnergyPool monsterEnergy; private BattleDeck heroDeck; private BattleDeck monsterDeck; + private PlayArea playArea; public BattleState() { this.clock = new BattleClock(); this.buffManager = new BuffManager(this.clock); this.heroEnergy = new EnergyPool(); this.monsterEnergy = new EnergyPool(); + this.playArea = new PlayArea(); } public void SetDecks(BattleDeck heroDeck, BattleDeck monsterDeck) { @@ -57,4 +59,5 @@ public class BattleState public EnergyPool MonsterEnergy {get => this.monsterEnergy;} public BattleDeck HeroDeck {get => this.heroDeck;} public BattleDeck MonsterDeck {get => this.monsterDeck;} + public PlayArea PlayArea {get => this.playArea;} }