CannotReturnToHandClass.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System;
  5. public class CannotReturnToHandClass : ICardEffect, ICannotReturnToHandEffect
  6. {
  7. public void SetUpCannotReturnToHandClass(Func<Permanent, bool> permanentCondition, Func<ICardEffect, bool> cardEffectCondition)
  8. {
  9. _permanentCondition = permanentCondition;
  10. _cardEffectCondition = cardEffectCondition;
  11. }
  12. Func<Permanent, bool> _permanentCondition { get; set; }
  13. Func<ICardEffect, bool> _cardEffectCondition { get; set; }
  14. public bool CannotReturnToHand(Permanent permanent, ICardEffect cardEffect)
  15. {
  16. if (permanent != null)
  17. {
  18. if (permanent.TopCard != null)
  19. {
  20. if (_permanentCondition != null)
  21. {
  22. if (_permanentCondition(permanent))
  23. {
  24. if (_cardEffectCondition != null)
  25. {
  26. if (_cardEffectCondition(cardEffect))
  27. {
  28. return true;
  29. }
  30. }
  31. }
  32. }
  33. }
  34. }
  35. return false;
  36. }
  37. }