IsMinDP.cs 1.0 KB

1234567891011121314151617181920212223242526
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System;
  4. using System.Linq;
  5. using UnityEngine;
  6. using System.Security;
  7. public partial class CardEffectCommons
  8. {
  9. public static bool IsMinDP(Permanent permanent, Player owner, Func<Permanent, bool> condition = null)
  10. {
  11. if (permanent == null) return false;
  12. if (permanent.TopCard == null) return false;
  13. if (permanent.TopCard.Owner != owner) return false;
  14. if (!IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, permanent.TopCard)) return false;
  15. if (condition != null && !condition(permanent)) return false;
  16. if (!permanent.TopCard.HasDP && (permanent.BaseDP <= 0)) return false;
  17. List<int> DPs = permanent.TopCard.Owner.GetBattleAreaDigimons()
  18. .Filter(permanent1 => condition == null || (condition != null && condition(permanent1)))
  19. .Filter(permanent1 => permanent1.TopCard.HasDP || (permanent1.BaseDP > 0))
  20. .Map(permanent1 => permanent1.DP);
  21. return DPs.Count >= 1 && permanent.DP == DPs.Min();
  22. }
  23. }