IBattleEffectResolver takes in the effects as params
This commit is contained in:
parent
8b539e1b5c
commit
c2e8b526b6
6 changed files with 43 additions and 33 deletions
|
|
@ -186,24 +186,39 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
|
|||
return this.playArea;
|
||||
}
|
||||
|
||||
private void EnqueueActivatedTrigger(Trigger trigger) {
|
||||
this.activatedTriggers.Add(trigger);
|
||||
}
|
||||
|
||||
private void RunActivatedTriggers() {
|
||||
foreach (Trigger t in this.activatedTriggers) {
|
||||
t.Run(this);
|
||||
}
|
||||
this.activatedTriggers.Clear();
|
||||
|
||||
// Cleanup expired triggers
|
||||
this.damageTriggers.RemoveAll(t => t.Expired);
|
||||
}
|
||||
|
||||
// IBattleEffectApplier
|
||||
public void Apply(IBattleEffect effect) {
|
||||
effect.Apply(this);
|
||||
}
|
||||
|
||||
// IBattleEffectResolver
|
||||
public void IncreaseHeroMaxEnergy(int delta) {
|
||||
this.maxEnergy += delta;
|
||||
public void IncreaseHeroMaxEnergy(IncreaseMaxEnergyEffect effect) {
|
||||
this.maxEnergy += effect.Amount;
|
||||
}
|
||||
|
||||
public void IncreaseMaxHP(IncreaseMaxHPEffect effect) {
|
||||
effect.Target.IncreaseMaxHP(effect.Amount);
|
||||
}
|
||||
|
||||
public void AcquireHeroCards(CardId[] cardIds, BattleZone zone, BattleHero owner) {
|
||||
foreach (CardId cardId in cardIds) {
|
||||
BaseCard acquiredCard = CardDatabase.CreateCard(cardId, owner);
|
||||
switch (zone) {
|
||||
public void AcquireHeroCards(AcquireCardsEffect effect) {
|
||||
BattleHero hero = (BattleHero) effect.Participant;
|
||||
foreach (CardId cardId in effect.CardIds) {
|
||||
BaseCard acquiredCard = CardDatabase.CreateCard(cardId, hero);
|
||||
switch (effect.Zone) {
|
||||
case BattleZone.DrawPile:
|
||||
this.GetHeroDeck().PutCardOnTopOfDrawPile(acquiredCard);
|
||||
break;
|
||||
|
|
@ -212,7 +227,7 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
|
|||
}
|
||||
}
|
||||
|
||||
if (zone == BattleZone.DrawPile) {
|
||||
if (effect.Zone == BattleZone.DrawPile) {
|
||||
this.GetHeroDeck().ShuffleDrawPile();
|
||||
}
|
||||
}
|
||||
|
|
@ -239,28 +254,14 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
|
|||
return healedAmount;
|
||||
}
|
||||
|
||||
public void AddBlock(BattleParticipant target, int amount) {
|
||||
target.AddBlock(amount);
|
||||
public void AddBlock(BlockEffect effect) {
|
||||
effect.Target.AddBlock(effect.Amount);
|
||||
}
|
||||
|
||||
public void ArmDamageTrigger(DamageTrigger damageTrigger) {
|
||||
this.damageTriggers.Add(damageTrigger);
|
||||
}
|
||||
|
||||
private void EnqueueActivatedTrigger(Trigger trigger) {
|
||||
this.activatedTriggers.Add(trigger);
|
||||
}
|
||||
|
||||
private void RunActivatedTriggers() {
|
||||
foreach (Trigger t in this.activatedTriggers) {
|
||||
t.Run(this);
|
||||
}
|
||||
this.activatedTriggers.Clear();
|
||||
|
||||
// Cleanup expired triggers
|
||||
this.damageTriggers.RemoveAll(t => t.Expired);
|
||||
}
|
||||
|
||||
// MonsterViewpoint
|
||||
public BattleHero[] Heroes {get => this.heroes;}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue