CanNotAttackTargetDefendingPermanentClass.cs 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System;
  5. public class CanNotAttackTargetDefendingPermanentClass : ICardEffect, ICanNotAttackTargetDefendingPermanentEffect
  6. {
  7. Func<Permanent, bool> _attackerCondition = null;
  8. Func<Permanent, bool> _defenderCondition = null;
  9. public void SetUpCanNotAttackTargetDefendingPermanentClass(Func<Permanent, bool> attackerCondition, Func<Permanent, bool> defenderCondition)
  10. {
  11. _attackerCondition = attackerCondition;
  12. _defenderCondition = defenderCondition;
  13. }
  14. public bool CanNotAttackTargetDefendingPermanent(Permanent attacker, Permanent defender)
  15. {
  16. if (CardEffectCommons.IsPermanentExistsOnBattleArea(attacker))
  17. {
  18. if (_attackerCondition == null || _attackerCondition(attacker))
  19. {
  20. if (_defenderCondition == null || _defenderCondition(defender))
  21. {
  22. return true;
  23. }
  24. }
  25. }
  26. return false;
  27. }
  28. }