Implement emotions

This commit is contained in:
henriquenakashima 2020-09-26 18:24:46 -04:00
parent 08c395cf51
commit 11df4f1164
25 changed files with 369 additions and 40 deletions

View file

@ -46,15 +46,16 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
HeroId.NPCGuard,
};
HCardId[] cardIds = new HCardId[10] {
HCardId.IronskinDraught,
HCardId[] cardIds = new HCardId[11] {
HCardId.Eagerness,
HCardId.Eagerness,
HCardId.LeadShot,
HCardId.LeadShot,
HCardId.SmokeBomb,
HCardId.SwordSlash,
HCardId.SwordSlash,
HCardId.Eagerness,
HCardId.SwordSlash,
HCardId.ShieldBlock,
HCardId.Eagerness,
HCardId.SwordSlash,
HCardId.ShieldBlock,
};
@ -265,10 +266,6 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
// Start of hero turn
OnBattleStateChanged();
// TODO: Play emotions from hand
if (this.heroEnergy.MaxEnergy < 9) {
this.heroEnergy.DropOneEmotion();
}
foreach (BattleHero hero in this.heroes) {
hero.ResetBlock();
}
@ -293,6 +290,7 @@ 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();
}
@ -332,11 +330,12 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
yield return card.Use(this, this, battlePlayerControls);
if (card.IsPermanent()) {
this.playArea.AddPlayedHeroPermanent(card);
} else if (card.IsEphemeral()) {
this.heroDeck.MoveCardToOblivion(card);
} else {
this.heroDeck.MoveCardToDiscard(card);
}
yield return new WaitForSeconds(0.5f);
OnBattleStateChanged();
CheckState();
}
@ -347,6 +346,8 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
yield return card.Use(this, this);
if (card.IsPermanent()) {
this.playArea.AddPlayedMonsterPermanent(card);
} else if (card.IsEphemeral()) {
this.monsterDeck.MoveCardToOblivion(card);
} else {
this.monsterDeck.MoveCardToDiscard(card);
}
@ -421,8 +422,22 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
}
// IBattleEffectResolver
public void DropEmotion(DropEmotionEffect effect) {
if (!this.state.CanPlayEmotion(effect.Team)) {
throw new System.InvalidOperationException("Cannot play emotion");
}
this.state.NotifyPlayedEmotion(effect.Team);
EnergyPool pool = (effect.Team == TeamChoice.Heroes ? this.heroEnergy : this.monsterEnergy);
pool.MaxEnergy += effect.Amount;
pool.Energy += effect.Amount;
}
public void IncreaseHeroMaxEnergy(IncreaseMaxEnergyEffect effect) {
this.heroEnergy.MaxEnergy += effect.Amount;
if (effect.Immediate) {
this.heroEnergy.Energy += effect.Amount;
}
}
public void IncreaseMaxHP(IncreaseMaxHPEffect effect) {