From 6a6f07689ebed12eb61dda86aff4d8c3aa82f9aa Mon Sep 17 00:00:00 2001 From: henriquenakashima Date: Thu, 24 Sep 2020 00:24:49 -0400 Subject: [PATCH] Implement Whirlwind --- Assets/Battle/BattleController.cs | 228 +++++++++++++++--- Assets/Battle/BattleHero.cs | 2 +- Assets/Battle/BattleMonster.cs | 2 +- Assets/Battle/BattleParticipant.cs | 10 +- Assets/Battle/BattleScene.unity | 4 +- Assets/Battle/CardsMonsters/WhirlwindMCard.cs | 19 ++ .../CardsMonsters/WhirlwindMCard.cs.meta | 11 + Assets/Battle/Effects/DrawCardsEffect.cs | 5 - Assets/Battle/Effects/MassDamageEffect.cs | 23 ++ .../Battle/Effects/MassDamageEffect.cs.meta | 11 + Assets/Battle/Effects/RotateEffect.cs | 21 ++ Assets/Battle/Effects/RotateEffect.cs.meta | 11 + Assets/Battle/IBattleEffectResolver.cs | 2 + Assets/Battle/MonsterCardDatabase.cs | 2 + .../Battle/Targeting/OtheHeroTargetPolicy.cs | 2 +- Assets/Battle/TeamChoice.cs | 4 + Assets/Battle/TeamChoice.cs.meta | 11 + Assets/Battle/Triggers/DamageTrigger.cs | 14 ++ 18 files changed, 330 insertions(+), 52 deletions(-) create mode 100644 Assets/Battle/CardsMonsters/WhirlwindMCard.cs create mode 100644 Assets/Battle/CardsMonsters/WhirlwindMCard.cs.meta create mode 100644 Assets/Battle/Effects/MassDamageEffect.cs create mode 100644 Assets/Battle/Effects/MassDamageEffect.cs.meta create mode 100644 Assets/Battle/Effects/RotateEffect.cs create mode 100644 Assets/Battle/Effects/RotateEffect.cs.meta create mode 100644 Assets/Battle/TeamChoice.cs create mode 100644 Assets/Battle/TeamChoice.cs.meta diff --git a/Assets/Battle/BattleController.cs b/Assets/Battle/BattleController.cs index 9efd160..418e39e 100644 --- a/Assets/Battle/BattleController.cs +++ b/Assets/Battle/BattleController.cs @@ -5,31 +5,34 @@ using UnityEngine; public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffectResolver, MonsterViewpoint { - public HeroId[] heroIds; - public MonsterId[] monsterIds; - public CardId[] cardIds; - public MCardId[] mCardIds; - public int[] mCardOwnerIndexes; - + // Inspector public public HeroInfoUI heroUIPrefab; public GameObject uiCanvas; public BattlePlayerControls battlePlayerControls; public EnergyUI heroEnergyUI; public EnergyUI monsterEnergyUI; + // Input + private HeroId[] heroIds; + private MonsterId[] monsterIds; + private CardId[] cardIds; + private MCardId[] mCardIds; + private int[] mCardOwnerIndexes; + + // Private private HeroCardDatabase heroCardDatabase; private MonsterCardDatabase monsterCardDatabase; private BattleDeck heroDeck; private BattleDeck monsterDeck; private PlayArea playArea; - public BattleHero[] heroes; - private GameObject[] heroSprites; - private HeroInfoUI[] heroUIs; + private BattleHero[] heroes; + private Dictionary heroSprites; + private Dictionary heroUIs; - public BattleMonster[] monsters; - private GameObject[] monsterSprites; - private HeroInfoUI[] monsterUIs; + private BattleMonster[] monsters; + private Dictionary monsterSprites; + private Dictionary monsterUIs; private bool heroTurn; private bool heroPassedTurn; @@ -38,6 +41,62 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe private InsightLevel insightLevel; void Awake() { + this.heroIds = new HeroId[3] { + HeroId.Brute, + HeroId.Alchemist, + HeroId.Shaman, + }; + + this.cardIds = new CardId[10] { + CardId.CrashingPunch, + CardId.CrashingPunch, + CardId.CrashingPunch, + CardId.Cover, + CardId.Cover, + CardId.Cover, + CardId.Thunderstorm, + CardId.Scarring, + CardId.Scarring, + CardId.Meditate, + }; + + this.monsterIds = new MonsterId[3] { + MonsterId.Golem, + MonsterId.Bat, + MonsterId.Bat, + }; + + this.mCardIds = new MCardId[10] { + MCardId.GraniteDefense, + MCardId.GraniteDefense, + MCardId.GolemCharge, + MCardId.GolemFist, + + MCardId.VampireFangs, + MCardId.VampireFangs, + MCardId.Whirlwind, + + MCardId.VampireFangs, + MCardId.VampireFangs, + MCardId.Whirlwind, + }; + this.mCardOwnerIndexes = new int[10] { + 0, 0, 0, 0, + 1, 1, 1, + 2, 2, 2, + }; + // this.mCardIds = new MCardId[5] { + // MCardId.Whirlwind, + // MCardId.Whirlwind, + // MCardId.Whirlwind, + // MCardId.Whirlwind, + // MCardId.Whirlwind, + // }; + // this.mCardOwnerIndexes = new int[5] { + // 1, 1, + // 2, 2, 2, + // }; + this.heroCardDatabase = new HeroCardDatabase(); this.monsterCardDatabase = new MonsterCardDatabase(); @@ -51,45 +110,51 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe this.insightLevel = new InsightLevel(1); heroes = new BattleHero[3]; - heroSprites = new GameObject[3]; - heroUIs = new HeroInfoUI[3]; + heroSprites = new Dictionary(); + heroUIs = new Dictionary(); for (int i = 0; i < 3; i++) { HeroId id = heroIds[i]; - heroes[i] = new BattleHero(id); - heroes[i].Init(); + BattleHero hero = new BattleHero(id); + hero.Init(); + heroes[i] = hero; - heroSprites[i] = HeroDatabase.createHeroSprite(id); - heroSprites[i].name = "Hero" + i + "_Sprite"; - heroSprites[i].transform.position = new Vector3(-1 + -3 + 3 * i, -1.8f, 0); - BattleParticipantSprite bps = heroSprites[i].AddComponent(); - bps.Init(battlePlayerControls, heroes[i]); + GameObject sprite = HeroDatabase.createHeroSprite(id); + heroSprites[hero] = sprite; + sprite.name = "Hero" + i + "_Sprite"; + PositionSprite(TeamChoice.Heroes, sprite, i); + BattleParticipantSprite bps = sprite.AddComponent(); + bps.Init(battlePlayerControls, hero); bps.OnSpriteClicked += battlePlayerControls.NotifyParticipantSpriteClicked; - heroes[i].OnDeath += bps.NotifyDeath; + hero.OnDeath += bps.NotifyDeath; - heroUIs[i] = (HeroInfoUI) Instantiate(heroUIPrefab.gameObject, uiCanvas.transform).GetComponent(typeof(HeroInfoUI)); - heroUIs[i].Init(heroSprites[i], heroes[i]); + HeroInfoUI heroUI = (HeroInfoUI) Instantiate(heroUIPrefab.gameObject, uiCanvas.transform).GetComponent(typeof(HeroInfoUI)); + heroUI.Init(sprite, hero); + heroUIs[hero] = heroUI; } monsters = new BattleMonster[3]; - monsterSprites = new GameObject[3]; - monsterUIs = new HeroInfoUI[3]; + monsterSprites = new Dictionary(); + monsterUIs = new Dictionary(); for (int i = 0; i < 3; i++) { MonsterId id = monsterIds[i]; - monsters[i] = MonsterDatabase.createMonsterScript(id); - monsters[i].Init(); + BattleMonster monster = MonsterDatabase.createMonsterScript(id); + monster.Init(); + monsters[i] = monster; - monsterSprites[i] = MonsterDatabase.createMonsterSprite(id); - monsterSprites[i].name = "Monster" + i + "_Sprite"; - monsterSprites[i].transform.position = new Vector3(+1 + -3 + 3 * i, 1.2f, 0); - BattleParticipantSprite bps = monsterSprites[i].AddComponent(); - bps.Init(battlePlayerControls, monsters[i]); + GameObject sprite = MonsterDatabase.createMonsterSprite(id); + monsterSprites[monster] = sprite; + sprite.name = "Monster" + i + "_Sprite"; + PositionSprite(TeamChoice.Monsters, sprite, i); + BattleParticipantSprite bps = sprite.AddComponent(); + bps.Init(battlePlayerControls, monster); bps.OnSpriteClicked += battlePlayerControls.NotifyParticipantSpriteClicked; - monsters[i].OnDeath += bps.NotifyDeath; + monster.OnDeath += bps.NotifyDeath; - monsterUIs[i] = (HeroInfoUI) Instantiate(heroUIPrefab.gameObject, uiCanvas.transform).GetComponent(typeof(HeroInfoUI)); - monsterUIs[i].Init(monsterSprites[i], monsters[i]); + HeroInfoUI monsterUI = (HeroInfoUI) Instantiate(heroUIPrefab.gameObject, uiCanvas.transform).GetComponent(typeof(HeroInfoUI)); + monsterUI.Init(sprite, monster); + monsterUIs[monster] = monsterUI; } BattleParticipant[] cardOwners = new BattleParticipant[this.cardIds.Length]; @@ -121,6 +186,16 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe this.monsterDeck.OnHandPileChanged += this.battlePlayerControls.NotifyMonsterHandPileChanged; } + private void PositionSprite(TeamChoice team, GameObject sprite, int i) { + Vector3 pos; + if (team == TeamChoice.Heroes) { + pos = new Vector3(-1 + -3 + 3 * i, -1.8f, 0); + } else { + pos = new Vector3(+1 + -3 + 3 * i, 1.2f, 0); + } + sprite.transform.position = pos; + } + private BattleParticipant FindHeroByClass(HeroId heroId) { foreach (BattleHero battleHero in this.heroes) { if (battleHero.GetId() == heroId) return battleHero; @@ -298,6 +373,12 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe } } + private BattleParticipant[] GetTeam(TeamChoice team) { + return (team == TeamChoice.Heroes + ? this.heroes.Cast().ToArray() + : this.monsters.Cast().ToArray()); + } + public EnergyPool HeroEnergy {get => this.heroEnergy;} public EnergyPool MonsterEnergy {get => this.monsterEnergy;} @@ -335,7 +416,7 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe public void AcquireCards(AcquireCardsEffect effect) { if (effect.Participant == null) return; - if (effect.Participant.IsHero()) { + if (effect.Participant.Team == TeamChoice.Heroes) { this.AcquireCardsTyped(effect, this.heroDeck, this.heroCardDatabase); } else { this.AcquireCardsTyped(effect, this.monsterDeck, this.monsterCardDatabase); @@ -385,6 +466,24 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe return damageDealt; } + public int DealMassDamage(MassDamageEffect effect) { + int damageDealt = 0; + BattleParticipant[] affectedTeam = GetTeam(effect.Team); + foreach (BattleParticipant bp in affectedTeam) { + damageDealt += bp.DealDamage(effect.Amount); + foreach (DamageTrigger dt in this.damageTriggers) { + if (dt.IsTriggeredBy(effect)) { + EnqueueActivatedTrigger(dt); + } + } + } + + // Do this after the card resolution is over to avoid reentraint effects. + RunActivatedTriggers(); + + return damageDealt; + } + public int Heal(HealEffect effect) { if (effect.Target == null) return 0; @@ -402,6 +501,61 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe effect.Target.AddStatus(effect.Status, effect.Amount); } + public void Rotate(RotateEffect effect) { + if (effect.Positions == 0) return; + + BattleParticipant[] currentPositions = GetTeam(effect.Team); + + int start = int.MaxValue; + int end = int.MinValue; + for (int i = 0; i < currentPositions.Length; i++) { + BattleParticipant bp = currentPositions[i]; + if (bp != null) { + start = System.Math.Min(start, i); + end = System.Math.Max(end, i); + } + } + + int[] newPositions = new int[currentPositions.Length]; + for (int i = start; i <= end; i++) { + if (i < start || i > end) { + newPositions[i] = i; + } else { + int newI = start + TrueMod( + i - start - effect.Positions, + end - start + 1); + newPositions[newI] = i; + } + } + + MoveTeamToNewPositions(effect.Team, newPositions); + } + + private static int TrueMod(int a, int b) { + return (a % b + b) % b; + } + + private void MoveTeamToNewPositions(TeamChoice team, int[] newPositions) { + int n = newPositions.Length; + if (team == TeamChoice.Heroes) { + BattleHero[] newHeroes = new BattleHero[n]; + for (int i = 0; i < n; i++) { + BattleHero hero = this.heroes[i]; + newHeroes[newPositions[i]] = hero; + PositionSprite(team, heroSprites[hero], newPositions[i]); + } + this.heroes = newHeroes; + } else { + BattleMonster[] newMonsters = new BattleMonster[n]; + for (int i = 0; i < n; i++) { + BattleMonster monster = this.monsters[i]; + newMonsters[newPositions[i]] = monster; + PositionSprite(team, monsterSprites[monster], newPositions[i]); + } + this.monsters = newMonsters; + } + } + public void ArmDamageTrigger(DamageTrigger damageTrigger) { this.damageTriggers.Add(damageTrigger); } diff --git a/Assets/Battle/BattleHero.cs b/Assets/Battle/BattleHero.cs index 4f88519..a987362 100644 --- a/Assets/Battle/BattleHero.cs +++ b/Assets/Battle/BattleHero.cs @@ -6,7 +6,7 @@ public class BattleHero: BattleParticipant { HeroId id; - public BattleHero(HeroId id) : base(true) { + public BattleHero(HeroId id) : base(TeamChoice.Heroes) { this.id = id; switch (id) { diff --git a/Assets/Battle/BattleMonster.cs b/Assets/Battle/BattleMonster.cs index 62f058a..8de83a5 100644 --- a/Assets/Battle/BattleMonster.cs +++ b/Assets/Battle/BattleMonster.cs @@ -4,6 +4,6 @@ using UnityEngine; public class BattleMonster: BattleParticipant { - public BattleMonster() : base(false) { + public BattleMonster() : base(TeamChoice.Monsters) { } } diff --git a/Assets/Battle/BattleParticipant.cs b/Assets/Battle/BattleParticipant.cs index e917bda..8c4befe 100644 --- a/Assets/Battle/BattleParticipant.cs +++ b/Assets/Battle/BattleParticipant.cs @@ -9,7 +9,7 @@ public class BattleParticipant public event BattleParticipantUpdateAction OnDeath; public event BattleParticipantUpdateAction OnStatusChanged; - protected bool isHero; + protected TeamChoice team; protected string displayName; protected int hp; protected int maxHP; @@ -17,8 +17,8 @@ public class BattleParticipant protected bool dead; protected Dictionary statuses; - public BattleParticipant(bool isHero) { - this.isHero = isHero; + public BattleParticipant(TeamChoice team) { + this.team = team; this.statuses = new Dictionary(); } @@ -83,8 +83,8 @@ public class BattleParticipant return this.block; } - public bool IsHero() { - return this.isHero; + public TeamChoice Team { + get => this.team; } public void IncreaseMaxHP(int amount) { diff --git a/Assets/Battle/BattleScene.unity b/Assets/Battle/BattleScene.unity index 32ebee5..e3ee6ca 100644 --- a/Assets/Battle/BattleScene.unity +++ b/Assets/Battle/BattleScene.unity @@ -306,8 +306,8 @@ MonoBehaviour: heroIds: 010000000000000002000000 monsterIds: 010000000000000000000000 cardIds: 00000000000000000000000001000000010000000100000004000000030000000300000007000000 - mCardIds: 06000000060000000800000001000000010000000100000005000000050000000800000006000000 - mCardOwnerIndexes: 00000000000000000000000001000000010000000200000000000000000000000000000000000000 + mCardIds: 06000000060000000800000001000000010000000100000005000000050000000200000002000000 + mCardOwnerIndexes: 00000000000000000000000001000000010000000200000000000000000000000100000002000000 heroUIPrefab: {fileID: 6641511084601005557, guid: ef1b469b45cedee418e4c4adf577cd00, type: 3} uiCanvas: {fileID: 35522588} diff --git a/Assets/Battle/CardsMonsters/WhirlwindMCard.cs b/Assets/Battle/CardsMonsters/WhirlwindMCard.cs new file mode 100644 index 0000000..b44aaf7 --- /dev/null +++ b/Assets/Battle/CardsMonsters/WhirlwindMCard.cs @@ -0,0 +1,19 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class WhirlwindMCard : MonsterCard +{ + public WhirlwindMCard(BattleParticipant owner) + : base(owner, MCardId.Whirlwind, "Whirlwind", 4, CardType.Attack, + "Rotate enemies right. Deal 3 damage to all enemies.") { + } + + public override IEnumerator Use(IBattleEffectApplier effectApplier, MonsterViewpoint monsterViewpoint) { + RotateEffect rotateEffect = new RotateEffect(TeamChoice.Heroes, +1); + effectApplier.Apply(rotateEffect); + MassDamageEffect damageEffect = new MassDamageEffect(TeamChoice.Heroes, 3); + effectApplier.Apply(damageEffect); + yield break; + } +} diff --git a/Assets/Battle/CardsMonsters/WhirlwindMCard.cs.meta b/Assets/Battle/CardsMonsters/WhirlwindMCard.cs.meta new file mode 100644 index 0000000..4e6583e --- /dev/null +++ b/Assets/Battle/CardsMonsters/WhirlwindMCard.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 39786db2e19b60d468fa665416a13f37 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Battle/Effects/DrawCardsEffect.cs b/Assets/Battle/Effects/DrawCardsEffect.cs index b905899..c8b0d20 100644 --- a/Assets/Battle/Effects/DrawCardsEffect.cs +++ b/Assets/Battle/Effects/DrawCardsEffect.cs @@ -3,11 +3,6 @@ using System.Collections.Generic; using System.Linq; using UnityEngine; -public enum TeamChoice { - Heroes, - Monsters, -} - public class DrawCardsEffect : IBattleEffect { private int amount; diff --git a/Assets/Battle/Effects/MassDamageEffect.cs b/Assets/Battle/Effects/MassDamageEffect.cs new file mode 100644 index 0000000..f0b6719 --- /dev/null +++ b/Assets/Battle/Effects/MassDamageEffect.cs @@ -0,0 +1,23 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class MassDamageEffect : IBattleEffect +{ + private TeamChoice team; + private int amount; + private int amountDealt; + + public MassDamageEffect(TeamChoice team, int amount) { + this.team = team; + this.amount = amount; + } + + public void Apply(IBattleEffectResolver resolver) { + this.amountDealt = resolver.DealMassDamage(this); + } + + public TeamChoice Team {get => this.team;} + public int Amount {get => this.amount;} + public int AmountDealt {get => this.amountDealt;} +} diff --git a/Assets/Battle/Effects/MassDamageEffect.cs.meta b/Assets/Battle/Effects/MassDamageEffect.cs.meta new file mode 100644 index 0000000..0f2c874 --- /dev/null +++ b/Assets/Battle/Effects/MassDamageEffect.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 441ec218e72296d43968d6b2f8cf1248 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Battle/Effects/RotateEffect.cs b/Assets/Battle/Effects/RotateEffect.cs new file mode 100644 index 0000000..af387a3 --- /dev/null +++ b/Assets/Battle/Effects/RotateEffect.cs @@ -0,0 +1,21 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class RotateEffect : IBattleEffect +{ + private TeamChoice team; + private int positions; + + public RotateEffect(TeamChoice team, int positions) { + this.team = team; + this.positions = positions; + } + + public void Apply(IBattleEffectResolver resolver) { + resolver.Rotate(this); + } + + public TeamChoice Team {get => this.team;} + public int Positions {get => this.positions;} +} diff --git a/Assets/Battle/Effects/RotateEffect.cs.meta b/Assets/Battle/Effects/RotateEffect.cs.meta new file mode 100644 index 0000000..2d83f0d --- /dev/null +++ b/Assets/Battle/Effects/RotateEffect.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a2349d6cbfd005648a535c6976375835 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Battle/IBattleEffectResolver.cs b/Assets/Battle/IBattleEffectResolver.cs index fdc2a4e..09c25b0 100644 --- a/Assets/Battle/IBattleEffectResolver.cs +++ b/Assets/Battle/IBattleEffectResolver.cs @@ -4,6 +4,7 @@ using UnityEngine; public interface IBattleEffectResolver { int DealDamage(DealDamageEffect effect); + int DealMassDamage(MassDamageEffect effect); int Heal(HealEffect effect); void AddBlock(BlockEffect effect); void AddStatus(StatusEffect effect); @@ -12,6 +13,7 @@ public interface IBattleEffectResolver { void ModifyInsight(ModifyInsightEffect effect); void DrawCards(DrawCardsEffect effect); void AcquireCards(AcquireCardsEffect effect); + void Rotate(RotateEffect effect); void ArmDamageTrigger(DamageTrigger damageTrigger); } diff --git a/Assets/Battle/MonsterCardDatabase.cs b/Assets/Battle/MonsterCardDatabase.cs index f400adf..510abfd 100644 --- a/Assets/Battle/MonsterCardDatabase.cs +++ b/Assets/Battle/MonsterCardDatabase.cs @@ -25,6 +25,8 @@ public class MonsterCardDatabase : CardDatabase return new QuickSwiftDeathMCard(owner); case MCardId.VampireFangs: return new VampireFangsMCard(owner); + case MCardId.Whirlwind: + return new WhirlwindMCard(owner); case MCardId.GolemFist: return new GolemFistMCard(owner); case MCardId.GraniteDefense: diff --git a/Assets/Battle/Targeting/OtheHeroTargetPolicy.cs b/Assets/Battle/Targeting/OtheHeroTargetPolicy.cs index 16bed33..209cc25 100644 --- a/Assets/Battle/Targeting/OtheHeroTargetPolicy.cs +++ b/Assets/Battle/Targeting/OtheHeroTargetPolicy.cs @@ -11,6 +11,6 @@ public class OtherHeroTargetPolicy: TargetingPolicy } public override bool CanTarget(BattleParticipant participant) { - return participant.IsHero() && participant != this.owner; + return participant.Team == TeamChoice.Heroes && participant != this.owner; } } diff --git a/Assets/Battle/TeamChoice.cs b/Assets/Battle/TeamChoice.cs new file mode 100644 index 0000000..c9fd134 --- /dev/null +++ b/Assets/Battle/TeamChoice.cs @@ -0,0 +1,4 @@ +public enum TeamChoice { + Heroes, + Monsters, +} diff --git a/Assets/Battle/TeamChoice.cs.meta b/Assets/Battle/TeamChoice.cs.meta new file mode 100644 index 0000000..b23d609 --- /dev/null +++ b/Assets/Battle/TeamChoice.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b44870e4e40630241a69624d781e428f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Battle/Triggers/DamageTrigger.cs b/Assets/Battle/Triggers/DamageTrigger.cs index 8f2b14b..d92a2de 100644 --- a/Assets/Battle/Triggers/DamageTrigger.cs +++ b/Assets/Battle/Triggers/DamageTrigger.cs @@ -13,4 +13,18 @@ public class DamageTrigger : Trigger { public bool IsTriggeredBy(DealDamageEffect effect) { return effect.Amount > 0 && this.observedParticipants.Contains(effect.Target); } + + public bool IsTriggeredBy(MassDamageEffect effect) { + if (effect.Amount <= 0) { + return false; + } + + foreach (BattleParticipant bp in this.observedParticipants) { + if (bp.Team == effect.Team) { + return true; + } + } + + return false; + } } \ No newline at end of file