WhenRemoveField.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  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 would leave the battle area" effects of 1 card
  9. public static bool CanTriggerWhenRemoveField(Hashtable hashtable, CardSource card)
  10. {
  11. return CanTriggerWhenPermanentRemoveField(hashtable, (permanent) => permanent.cardSources.Contains(card));
  12. }
  13. #endregion
  14. #region Can trigger "When this permanent would leave the battle area" effects of 1 permanent
  15. public static bool CanTriggerWhenPermanentRemoveField(Hashtable hashtable, Func<Permanent, bool> permanentCondition)
  16. {
  17. List<Permanent> permanents = GetPermanentsFromHashtable(hashtable);
  18. if (permanentCondition != null)
  19. {
  20. if (permanents.Count((permanent) => permanent != null && permanent.TopCard != null && permanentCondition(permanent)) >= 1)
  21. {
  22. return true;
  23. }
  24. }
  25. return false;
  26. }
  27. #endregion
  28. }