IsMinCost.cs 1.0 KB

123456789101112131415161718192021222324252627
  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 IsMinCost(Permanent permanent, Player owner, bool IsDigimonOnly)
  10. {
  11. if (permanent == null) return false;
  12. if (permanent.TopCard == null) return false;
  13. if (permanent.TopCard.Owner != owner) return false;
  14. if (!IsPermanentExistsOnOwnerBattleArea(permanent, permanent.TopCard)) return false;
  15. if (!permanent.IsDigimon && !permanent.IsTamer) return false;
  16. if (!permanent.TopCard.HasPlayCost) return false;
  17. List<int> costs = permanent.TopCard.Owner.GetBattleAreaPermanents().Filter(permanent1 =>
  18. (permanent1.IsDigimon || permanent1.IsTamer)
  19. && (IsDigimonOnly && permanent1.IsDigimon)
  20. && permanent1.TopCard.HasPlayCost)
  21. .Map(permanent1 => permanent1.TopCard.GetCostItself);
  22. return costs.Count >= 1 && permanent.TopCard.GetCostItself == costs.Min();
  23. }
  24. }