Move ParticipantActivity to BattleState

This commit is contained in:
henriquenakashima 2020-10-13 23:19:09 -04:00
parent 04d00ebede
commit 86715b790d
3 changed files with 14 additions and 11 deletions

View file

@ -20,7 +20,6 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
private HandPlayability<HeroCard> heroHandPlayability;
private HandPlayability<MonsterCard> monsterHandPlayability;
private TurnIntentions<MonsterCard> monsterIntentions;
private ParticipantActivity participantActivity;
private delegate void BattleStateChangedAction();
private event BattleStateChangedAction OnBattleStateChanged;
@ -39,8 +38,6 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
this.battleSprites.Init(this.state.Heroes, this.state.Monsters, this.state);
this.participantActivity = new ParticipantActivity();
this.heroHandPlayability = new HandPlayability<HeroCard>(
this.state, this.state.HeroEnergy, TeamChoice.Heroes, this.state.HeroDeck);
this.OnBattleStateChanged += this.heroHandPlayability.NotifyBattleStateChanged;
@ -116,7 +113,6 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
yield return RunMonsterTurn();
this.state.Clock.AdvanceToStep(RoundStep.EndOfRound);
this.participantActivity.NextRound();
}
private IEnumerator RunHeroTurn() {
@ -153,7 +149,7 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
}
// End of hero turn
yield return this.state.PlayArea.UseHeroDefaults(this.state.Heroes, this.participantActivity, UseHeroDefault);
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);
@ -253,7 +249,7 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
this.state.HeroEnergy.PayForCard(card);
this.state.HeroDeck.RemoveCardFromHand(card);
this.participantActivity.NotifyParticipantUsedCard(card.Owner, card);
this.state.ParticipantActivity.NotifyParticipantUsedCard(card.Owner, card);
yield return card.Use(this, this.state, this.battlePlayerControls);
if (card.Type == CardType.Default) {
// Already added to playArea by effect
@ -283,6 +279,7 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
public IEnumerator UseMonsterCard(MonsterCard card) {
this.state.MonsterEnergy.PayForCard(card);
this.state.MonsterDeck.RemoveCardFromHand(card);
this.state.ParticipantActivity.NotifyParticipantUsedCard(card.Owner, card);
yield return card.Use(this, this.state);
if (card.IsPermanent()) {
this.state.PlayArea.AddPlayedMonsterPermanent(card);