ImmuneFromStackTrashingClass.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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 ImmuneStackTrashingClass : ICardEffect, IImmuneFromStackTrashingEffect
  9. {
  10. Func<Permanent, bool> PermanentCondition { get; set; }
  11. Func<ICardEffect, bool> EffectCondition { get; set; }
  12. public void SetUpImmuneFromStackTrashingClass(Func<Permanent, bool> PermanentCondition, Func<ICardEffect, bool> EffectCondition)
  13. {
  14. this.PermanentCondition = PermanentCondition;
  15. this.EffectCondition = EffectCondition;
  16. }
  17. public bool ImmuneStackTrashing(Permanent permanent, ICardEffect effect)
  18. {
  19. if (permanent != null)
  20. {
  21. if (permanent.TopCard != null)
  22. {
  23. if (EffectCondition != null)
  24. {
  25. if (!EffectCondition(effect))
  26. {
  27. return false;
  28. }
  29. }
  30. if (PermanentCondition != null)
  31. {
  32. if (!PermanentCondition(permanent))
  33. {
  34. return false;
  35. }
  36. }
  37. return true;
  38. }
  39. }
  40. return false;
  41. }
  42. }