using System.Collections; using System.Collections.Generic; using UnityEngine; using System; public class CanAttackTargetDefendingPermanentClass : ICardEffect, ICanAttackTargetDefendingPermanentEffect { Func AttackerCondition { get; set; } Func DefenderCondition { get; set; } Func CardEffectCondition { get; set; } public void SetUpCanAttackTargetDefendingPermanentClass(Func attackerCondition, Func defenderCondition, Func cardEffectCondition) { this.AttackerCondition = attackerCondition; this.DefenderCondition = defenderCondition; this.CardEffectCondition = cardEffectCondition; } public bool CanAttackTargetDefendingPermanent(Permanent Attacker, Permanent Defender, ICardEffect cardEffect) { if (Attacker != null && Defender != null) { if (Attacker.TopCard != null && Defender.TopCard != null) { if (AttackerCondition != null && DefenderCondition != null && CardEffectCondition != null) { if (AttackerCondition(Attacker) && DefenderCondition(Defender) && CardEffectCondition(cardEffect)) { return true; } } } } return false; } }