Monsters play emotions from hand

This commit is contained in:
henriquenakashima 2020-09-30 19:25:38 -04:00
parent 959458ad74
commit d513657396
8 changed files with 140 additions and 11 deletions

View file

@ -35,6 +35,7 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
private EnergyPool monsterEnergy;
private InsightLevel insightLevel;
private HandPlayability<HeroCard> heroHandPlayability;
private HandPlayability<MonsterCard> monsterHandPlayability;
private delegate void BattleStateChangedAction();
private event BattleStateChangedAction OnBattleStateChanged;
@ -129,6 +130,9 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
this.heroHandPlayability = new HandPlayability<HeroCard>(
this.state, this.heroEnergy, TeamChoice.Heroes, this.heroDeck);
this.OnBattleStateChanged += this.heroHandPlayability.NotifyBattleStateChanged;
this.monsterHandPlayability = new HandPlayability<MonsterCard>(
this.state, this.monsterEnergy, TeamChoice.Monsters, this.monsterDeck);
this.OnBattleStateChanged += this.monsterHandPlayability.NotifyBattleStateChanged;
this.battlePlayerControls.Init(
this.heroDeck, this.monsterDeck, this.playArea, this.insightLevel,
@ -220,10 +224,6 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
yield return new WaitForSeconds(0.5f);
// Start of monster turn
// TODO: Play emotions from hand
if (this.monsterEnergy.MaxEnergy < 9) {
this.monsterEnergy.DropOneEmotion();
}
foreach (BattleMonster monster in this.monsters) {
monster.ResetBlock();
}
@ -288,7 +288,7 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
}
public bool CanUseMonsterCard(MonsterCard card) {
return !this.state.HeroTurn && card.Owner.CanUseCard(card) && this.monsterEnergy.CanPayForCard(card);
return this.monsterHandPlayability.IsPlayable(card);
}
public BattleDeck<HeroCard> GetHeroDeck() {