IsMinDP.cs 861 B

123456789101112131415161718192021222324
  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)
  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 (!permanent.TopCard.HasDP && (permanent.BaseDP <= 0)) return false;
  16. List<int> DPs = permanent.TopCard.Owner.GetBattleAreaDigimons()
  17. .Filter(permanent1 => permanent1.TopCard.HasDP || (permanent1.BaseDP > 0))
  18. .Map(permanent1 => permanent1.DP);
  19. return DPs.Count >= 1 && permanent.DP == DPs.Min();
  20. }
  21. }