ImmuneFromDPMinusClass.cs 1.3 KB

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