Implement both styles of battle

This commit is contained in:
henriquenakashima 2020-09-30 22:48:32 -04:00
parent 6bf1a8672f
commit 838c30af99
3 changed files with 46 additions and 15 deletions

View file

@ -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<BattleHero, GameObject>();
@ -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();
}