Move ParticipantActivity to BattleState
This commit is contained in:
parent
04d00ebede
commit
86715b790d
3 changed files with 14 additions and 11 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ public class BattleState: MonsterViewpoint
|
|||
private BattleDeck<MonsterCard> monsterDeck;
|
||||
private PlayArea playArea;
|
||||
private InsightLevel insightLevel;
|
||||
private ParticipantActivity participantActivity;
|
||||
|
||||
private bool playedEmotion;
|
||||
|
||||
|
|
@ -35,6 +36,7 @@ public class BattleState: MonsterViewpoint
|
|||
this.monsterEnergy = new EnergyPool();
|
||||
this.playArea = new PlayArea();
|
||||
this.insightLevel = new InsightLevel(STARTING_INSIGHT);
|
||||
this.participantActivity = new ParticipantActivity(this.clock);
|
||||
|
||||
InitHeroesAndMonsters(parameters);
|
||||
}
|
||||
|
|
@ -139,4 +141,5 @@ public class BattleState: MonsterViewpoint
|
|||
public BattleDeck<MonsterCard> MonsterDeck {get => this.monsterDeck;}
|
||||
public PlayArea PlayArea {get => this.playArea;}
|
||||
public InsightLevel InsightLevel {get => this.insightLevel;}
|
||||
public ParticipantActivity ParticipantActivity {get => this.participantActivity;}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,14 @@ public class ParticipantActivity {
|
|||
|
||||
private Dictionary<BattleParticipant, List<BaseCard>> mCardsUsedThisRound = new Dictionary<BattleParticipant, List<BaseCard>>();
|
||||
|
||||
public ParticipantActivity() {
|
||||
public ParticipantActivity(BattleClock clock) {
|
||||
clock.OnTimeChanged += this.NotifyTimeChanged;
|
||||
}
|
||||
|
||||
private void NotifyTimeChanged(BattleTime now) {
|
||||
if (now.RoundStep == RoundStep.StartOfRound) {
|
||||
mCardsUsedThisRound.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
public void NotifyParticipantUsedCard(BattleParticipant participant, BaseCard card) {
|
||||
|
|
@ -23,8 +30,4 @@ public class ParticipantActivity {
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void NextRound() {
|
||||
mCardsUsedThisRound.Clear();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue