Move PlayArea into BattleState

This commit is contained in:
henriquenakashima 2020-10-13 01:00:49 -04:00
parent 12eb97084f
commit cb88ae78b6
2 changed files with 8 additions and 7 deletions

View file

@ -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<int>().ToArray(), mCardOwners);
this.state.SetDecks(heroDeck, monsterDeck);
this.participantActivity = new ParticipantActivity();
this.playArea = new PlayArea();
this.heroHandPlayability = new HandPlayability<HeroCard>(
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);
}