More heroEnergy and monsterEnergy into BattleState
This commit is contained in:
parent
679fc526cc
commit
f1ef7d7d46
3 changed files with 20 additions and 21 deletions
|
|
@ -28,8 +28,6 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
|
|||
private BattleMonster[] monsters;
|
||||
|
||||
private BattleState state;
|
||||
private EnergyPool heroEnergy;
|
||||
private EnergyPool monsterEnergy;
|
||||
private InsightLevel insightLevel;
|
||||
private HandPlayability<HeroCard> heroHandPlayability;
|
||||
private HandPlayability<MonsterCard> monsterHandPlayability;
|
||||
|
|
@ -51,12 +49,8 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
|
|||
|
||||
this.state = new BattleState();
|
||||
|
||||
this.heroEnergy = new EnergyPool();
|
||||
this.heroEnergyUI.Init(this.heroEnergy);
|
||||
this.heroEnergy.OnEnergyChanged += this.heroEnergyUI.NotifyEnergyChanged;
|
||||
this.monsterEnergy = new EnergyPool();
|
||||
this.monsterEnergyUI.Init(this.monsterEnergy);
|
||||
this.monsterEnergy.OnEnergyChanged += this.monsterEnergyUI.NotifyEnergyChanged;
|
||||
this.heroEnergyUI.Init(this.state.HeroEnergy);
|
||||
this.monsterEnergyUI.Init(this.state.MonsterEnergy);
|
||||
|
||||
this.insightLevel = new InsightLevel(STARTING_INSIGHT);
|
||||
|
||||
|
|
@ -98,14 +92,14 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
|
|||
this.playArea = new PlayArea();
|
||||
|
||||
this.heroHandPlayability = new HandPlayability<HeroCard>(
|
||||
this.state, this.heroEnergy, TeamChoice.Heroes, this.heroDeck);
|
||||
this.state, this.state.HeroEnergy, TeamChoice.Heroes, this.heroDeck);
|
||||
this.OnBattleStateChanged += this.heroHandPlayability.NotifyBattleStateChanged;
|
||||
this.monsterHandPlayability = new HandPlayability<MonsterCard>(
|
||||
this.state, this.monsterEnergy, TeamChoice.Monsters, this.monsterDeck);
|
||||
this.state, this.state.MonsterEnergy, TeamChoice.Monsters, this.monsterDeck);
|
||||
this.OnBattleStateChanged += this.monsterHandPlayability.NotifyBattleStateChanged;
|
||||
|
||||
this.monsterIntentions = new TurnIntentions<MonsterCard>(
|
||||
this.monsterDeck, this.monsterEnergy, this.monsterHandPlayability);
|
||||
this.monsterDeck, this.state.MonsterEnergy, this.monsterHandPlayability);
|
||||
|
||||
this.battlePlayerControls.Init(
|
||||
this.heroDeck, this.monsterDeck, this.playArea, this.insightLevel,
|
||||
|
|
@ -157,8 +151,8 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
|
|||
|
||||
this.damageTriggers.RemoveAll(t => t.Expiration == TriggerExpiration.StartOfNextHeroTurn);
|
||||
|
||||
heroEnergy.Replenish();
|
||||
monsterEnergy.Replenish();
|
||||
this.state.HeroEnergy.Replenish();
|
||||
this.state.MonsterEnergy.Replenish();
|
||||
|
||||
if (STABLE_HAND_STYLE) {
|
||||
if (this.state.Clock.Now.RoundNumber > 1) {
|
||||
|
|
@ -287,7 +281,7 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
|
|||
throw new System.InvalidOperationException("Cannot use card " + card.GetDisplayName());
|
||||
}
|
||||
|
||||
this.heroEnergy.PayForCard(card);
|
||||
this.state.HeroEnergy.PayForCard(card);
|
||||
this.heroDeck.RemoveCardFromHand(card);
|
||||
this.participantActivity.NotifyParticipantUsedCard(card.Owner, card);
|
||||
yield return card.Use(this, this, battlePlayerControls);
|
||||
|
|
@ -317,7 +311,7 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
|
|||
}
|
||||
|
||||
public IEnumerator UseMonsterCard(MonsterCard card) {
|
||||
this.monsterEnergy.PayForCard(card);
|
||||
this.state.MonsterEnergy.PayForCard(card);
|
||||
this.monsterDeck.RemoveCardFromHand(card);
|
||||
yield return card.Use(this, this);
|
||||
if (card.IsPermanent()) {
|
||||
|
|
@ -384,9 +378,6 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
|
|||
: this.monsters.Cast<BattleParticipant>().ToArray());
|
||||
}
|
||||
|
||||
public EnergyPool HeroEnergy {get => this.heroEnergy;}
|
||||
public EnergyPool MonsterEnergy {get => this.monsterEnergy;}
|
||||
|
||||
// IBattleEffectApplier
|
||||
public void Apply(IBattleEffect effect) {
|
||||
effect.Apply(this);
|
||||
|
|
@ -399,15 +390,15 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
|
|||
}
|
||||
|
||||
this.state.NotifyPlayedEmotion(effect.Team);
|
||||
EnergyPool pool = (effect.Team == TeamChoice.Heroes ? this.heroEnergy : this.monsterEnergy);
|
||||
EnergyPool pool = (effect.Team == TeamChoice.Heroes ? this.state.HeroEnergy : this.state.MonsterEnergy);
|
||||
pool.MaxEnergy += effect.Amount;
|
||||
pool.Energy += effect.Amount;
|
||||
}
|
||||
|
||||
public void IncreaseHeroMaxEnergy(IncreaseMaxEnergyEffect effect) {
|
||||
this.heroEnergy.MaxEnergy += effect.Amount;
|
||||
this.state.HeroEnergy.MaxEnergy += effect.Amount;
|
||||
if (effect.Immediate) {
|
||||
this.heroEnergy.Energy += effect.Amount;
|
||||
this.state.HeroEnergy.Energy += effect.Amount;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue