OnSuspend.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System;
  4. using System.Linq;
  5. using UnityEngine;
  6. public partial class CardEffectCommons
  7. {
  8. #region Can trigger "when this permanent suspends" effect
  9. public static bool CanTriggerWhenSelfPermanentSuspends(Hashtable hashtable, CardSource card)
  10. {
  11. return CanTriggerWhenPermanentSuspends(hashtable, (permanent) => permanent.cardSources.Contains(card));
  12. }
  13. #endregion
  14. #region Can trigger "when permanent suspends" effect
  15. public static bool CanTriggerWhenPermanentSuspends(Hashtable hashtable, Func<Permanent, bool> permanentCondition)
  16. {
  17. List<Permanent> permanents = GetPermanentsFromHashtable(hashtable);
  18. if (permanents != null)
  19. {
  20. foreach (Permanent Permanent in permanents)
  21. {
  22. if (IsPermanentExistsOnBattleArea(Permanent))
  23. {
  24. if (permanentCondition != null)
  25. {
  26. if (permanentCondition(Permanent))
  27. {
  28. return true;
  29. }
  30. }
  31. }
  32. }
  33. }
  34. return false;
  35. }
  36. #endregion
  37. }