diff --git a/Assets/Battle/BattleController.cs b/Assets/Battle/BattleController.cs index cf1460e..a715015 100644 --- a/Assets/Battle/BattleController.cs +++ b/Assets/Battle/BattleController.cs @@ -6,6 +6,9 @@ using UnityEngine.SceneManagement; public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffectResolver, MonsterViewpoint { + private bool STABLE_HAND_STYLE = false; + private int STARTING_INSIGHT = 1; + // Inspector public public HeroInfoUI heroUIPrefab; public GameObject uiCanvas; @@ -59,7 +62,7 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe this.monsterEnergyUI.Init(this.monsterEnergy); this.monsterEnergy.OnEnergyChanged += this.monsterEnergyUI.NotifyEnergyChanged; - this.insightLevel = new InsightLevel(1); + this.insightLevel = new InsightLevel(STARTING_INSIGHT); this.heroes = new BattleHero[parameters.HeroIds.Length]; this.heroSprites = new Dictionary(); @@ -171,6 +174,11 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe } private IEnumerator RunBattleRounds() { + if (STABLE_HAND_STYLE) { + this.heroDeck.DrawCards(7); + this.monsterDeck.DrawCards(7); + } + while (true) { yield return RunBattleRound(); } @@ -184,8 +192,15 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe heroEnergy.Replenish(); monsterEnergy.Replenish(); - this.heroDeck.DrawHand(); - this.monsterDeck.DrawHand(); + if (STABLE_HAND_STYLE) { + if (this.state.Round > 1) { + this.heroDeck.DrawCards(2); + this.monsterDeck.DrawCards(2); + } + } else { + this.heroDeck.DrawCards(5); + this.monsterDeck.DrawCards(5); + } yield return RunHeroTurn(); @@ -218,7 +233,11 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe } // End of hero turn - this.heroDeck.DiscardHand(); + if (STABLE_HAND_STYLE) { + this.heroDeck.DiscardInExcessOf(7); + } else { + this.heroDeck.DiscardHand(); + } foreach (BattleHero hero in this.heroes) { hero.TickStatuses(); } @@ -246,7 +265,11 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe } // End of monster turn - this.monsterDeck.DiscardHand(); + if (STABLE_HAND_STYLE) { + this.monsterDeck.DiscardInExcessOf(7); + } else { + this.monsterDeck.DiscardHand(); + } foreach (BattleMonster monster in this.monsters) { monster.TickStatuses(); } diff --git a/Assets/Battle/BattleDeck.cs b/Assets/Battle/BattleDeck.cs index 13e5b1a..8f736f2 100644 --- a/Assets/Battle/BattleDeck.cs +++ b/Assets/Battle/BattleDeck.cs @@ -1,6 +1,7 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Linq; using UnityEngine; public class BattleDeck where BaseCardT : BaseCard @@ -43,8 +44,8 @@ public class BattleDeck where BaseCardT : BaseCard return discardPile; } - public void DrawHand() { - for (int i = 0; i < DEFAULT_HAND_DRAWN; i++) { + public void DrawCards(int number) { + for (int i = 0; i < number; i++) { DrawCardInternal(); } TriggerHandPileChanged(); @@ -52,9 +53,7 @@ public class BattleDeck where BaseCardT : BaseCard } public void DrawCard() { - DrawCardInternal(); - TriggerHandPileChanged(); - TriggerDrawPileChanged(); + DrawCards(1); } private void DrawCardInternal() { @@ -88,10 +87,19 @@ public class BattleDeck where BaseCardT : BaseCard } public void DiscardHand() { - this.discardPile.InsertRange(0, this.handPile); - this.handPile.Clear(); - TriggerHandPileChanged(); - TriggerDiscardPileChanged(); + DiscardInExcessOf(0); + } + + public void DiscardInExcessOf(int max) { + int numberToDiscard = this.handPile.Count - max; + + if (numberToDiscard > 0) { + IEnumerable rangeToDiscard = this.handPile.GetRange(0, numberToDiscard); + this.discardPile.InsertRange(0, rangeToDiscard.Reverse()); + this.handPile.RemoveRange(0, numberToDiscard); + TriggerHandPileChanged(); + TriggerDiscardPileChanged(); + } } public void PutCardOnTopOfDrawPile(BaseCardT card) { diff --git a/Assets/Battle/BattlePlayerControls.cs b/Assets/Battle/BattlePlayerControls.cs index 60b1909..84ec369 100644 --- a/Assets/Battle/BattlePlayerControls.cs +++ b/Assets/Battle/BattlePlayerControls.cs @@ -39,7 +39,7 @@ public class BattlePlayerControls : MonoBehaviour this.heroHandControls.OnCardClicked += OnHeroCardClicked; this.monsterHandControls = new HandControls( monsterDeck, this.uiCanvas, this.cardPrefab, HandControlsPosition.Top, - TeamChoice.Monsters, 1, monsterHandPlayability, this.scale); + TeamChoice.Monsters, insightLevel.Level, monsterHandPlayability, this.scale); this.monsterHandControls.OnCardClicked += OnMonsterCardClicked; this.cardsInPlayUIs = new Dictionary();