Browse Source

找服务接口

Administrator 2 months ago
parent
commit
06c11f8aa2
1 changed files with 21 additions and 1 deletions
  1. 21 1
      incubator-game/src/main/java/com/incubator/game/util/GDUtils.java

+ 21 - 1
incubator-game/src/main/java/com/incubator/game/util/GDUtils.java

@@ -657,6 +657,20 @@ public final class GDUtils {
         // 替换赖子牌为当前级牌或其他牌点
         List<Integer> adjustedPrevious = replaceWildCardsWithTrump(previousPoints, wildCardCountPrevious, curLevel, 5);
         List<Integer> adjustedCurrent = replaceWildCardsWithTrump(currentPoints, wildCardCountCurrent, curLevel, 5);
+
+        // 判断是否为循环顺子(A-2-3-4-5)
+        boolean isPreviousCycle = isCycleStraight(adjustedPrevious);
+        boolean isCurrentCycle = isCycleStraight(adjustedCurrent);
+
+        // 如果上一手牌是循环顺子,当前牌不是循环顺子,则当前牌更大
+        if (isPreviousCycle && !isCurrentCycle) {
+            return 1;
+        }
+        // 如果当前牌是循环顺子,上一手牌不是循环顺子,则上一手牌更大
+        if (isCurrentCycle && !isPreviousCycle) {
+            return -1;
+        }
+
         // 获取每手牌的最小点数
         int minPreviousStraight = getMinStraightValue(adjustedPrevious);
         int minCurrentStraight = getMinStraightValue(adjustedCurrent);
@@ -686,7 +700,13 @@ public final class GDUtils {
         // 如果顺子的最小点数和最大点数都相同,返回0
         return 0;
     }
-
+    /**
+     * 判断是否为循环顺子(A-2-3-4-5)
+     */
+    private static boolean isCycleStraight(List<Integer> points) {
+        // 判断是否包含 A、2、3、4、5
+        return points.contains(14) && points.contains(2) && points.contains(3) && points.contains(4) && points.contains(5);
+    }
  /*   *//**
      * 获取顺子的最大点数(即顺子中的最大牌)
      *