30 lines
No EOL
901 B
C#
30 lines
No EOL
901 B
C#
using System.Collections.Generic;
|
|
|
|
public class DamageTrigger : Trigger {
|
|
|
|
private List<BattleParticipant> observedParticipants;
|
|
|
|
public DamageTrigger(List<BattleParticipant> observedParticipants, TriggeredEffect callback,
|
|
TriggerExpiration expiration, TriggerRepetition repetition)
|
|
: base(callback, expiration, repetition) {
|
|
this.observedParticipants = observedParticipants;
|
|
}
|
|
|
|
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;
|
|
}
|
|
} |