Implement Molotov Cocktail

This commit is contained in:
henriquenakashima 2020-10-23 00:16:34 -04:00
parent 938a56231a
commit a37adf2972
17 changed files with 255 additions and 20 deletions

View file

@ -97,6 +97,7 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier
private IEnumerator RunBattleRound() {
this.state.Clock.AdvanceRound();
yield return this.RunActivatedTriggers();
this.state.HeroEnergy.Replenish();
this.state.MonsterEnergy.Replenish();
@ -116,6 +117,7 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier
yield return RunMonsterTurn();
this.state.Clock.AdvanceToStep(RoundStep.EndOfRound);
yield return this.RunActivatedTriggers();
}
private IEnumerator RunHeroTurn() {
@ -129,6 +131,7 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier
hero.ResetBlock();
}
OnBattleStateChanged();
yield return this.RunActivatedTriggers();
// Heroes act until they pass
while (true) {
@ -142,7 +145,7 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier
// TODO: Implement a stack/queue to resolve triggers in order.
// Do this after the card resolution is over to avoid reentraint effects.
this.state.TriggerManager.RunActivatedTriggers(this);
yield return this.RunActivatedTriggers();
CheckState();
OnBattleStateChanged();
}
@ -155,7 +158,7 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier
yield return this.state.PlayArea.UseHeroDefaults(this.state.Heroes, this.state.ParticipantActivity, UseHeroDefault);
// TODO: Implement a stack/queue to resolve triggers in order.
// Do this after the card resolution is over to avoid reentraint effects.
this.state.TriggerManager.RunActivatedTriggers(this);
yield return this.RunActivatedTriggers();
CheckState();
OnBattleStateChanged();
@ -169,6 +172,7 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier
}
this.state.Clock.AdvanceToStep(RoundStep.EndOfHeroTurn);
yield return this.RunActivatedTriggers();
OnBattleStateChanged();
this.monsterIntentions.PauseIntentions();
@ -184,6 +188,7 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier
monster.ResetBlock();
}
OnBattleStateChanged();
yield return this.RunActivatedTriggers();
yield return new WaitForSeconds(0.5f);
// Monsters play an emotion
@ -195,7 +200,7 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier
// TODO: Implement a stack/queue to resolve triggers in order.
// Do this after the card resolution is over to avoid reentraint effects.
this.state.TriggerManager.RunActivatedTriggers(this);
yield return this.RunActivatedTriggers();
CheckState();
OnBattleStateChanged();
}
@ -213,7 +218,7 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier
// TODO: Implement a stack/queue to resolve triggers in order.
// Do this after the card resolution is over to avoid reentraint effects.
this.state.TriggerManager.RunActivatedTriggers(this);
yield return this.RunActivatedTriggers();
CheckState();
OnBattleStateChanged();
}
@ -231,6 +236,12 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier
this.state.Clock.AdvanceToStep(RoundStep.EndOfMonsterTurn);
OnBattleStateChanged();
yield return this.RunActivatedTriggers();
}
private IEnumerator RunActivatedTriggers() {
yield return this.state.TriggerManager.RunActivatedTriggers(
this, this.state, this.battlePlayerControls);
}
private MonsterCard FirstMonsterActionToPlay() {