CanNotSuspend.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System;
  4. using System.Linq;
  5. using UnityEngine;
  6. public partial class CardEffectFactory
  7. {
  8. #region Static effect that can't suspend
  9. public static CanNotSuspendClass CantSuspendStaticEffect(Func<Permanent, bool> permanentCondition, bool isInheritedEffect, CardSource card,
  10. Func<bool> condition, string effectName)
  11. {
  12. CanNotSuspendClass canNotUnsuspendClass = new CanNotSuspendClass();
  13. canNotUnsuspendClass.SetUpICardEffect(effectName, CanUseCondition, card);
  14. canNotUnsuspendClass.SetUpCanNotSuspendClass(PermanentCondition: PermanentCondition);
  15. if (isInheritedEffect)
  16. {
  17. canNotUnsuspendClass.SetIsInheritedEffect(true);
  18. }
  19. bool CanUseCondition(Hashtable hashtable)
  20. {
  21. return condition == null || condition();
  22. }
  23. bool PermanentCondition(Permanent permanent)
  24. {
  25. if (CardEffectCommons.IsPermanentExistsOnBattleArea(permanent))
  26. {
  27. if (!permanent.TopCard.CanNotBeAffected(canNotUnsuspendClass))
  28. {
  29. if (permanentCondition == null || permanentCondition(permanent))
  30. {
  31. return true;
  32. }
  33. }
  34. }
  35. return false;
  36. }
  37. return canNotUnsuspendClass;
  38. }
  39. #endregion
  40. }