Browse Source

解决清空出牌堆bug

johnclot69 4 tháng trước cách đây
mục cha
commit
3bf76d7eb1

+ 16 - 2
incubator-game/src/main/java/com/incubator/game/room/JDGDRoom.java

@@ -400,8 +400,8 @@ public class JDGDRoom extends Room implements GRoomInterface {
         logger.info("过...玩家ID:{}, 位置:{}, 手牌大小:{}, 手牌信息: {}", player.getId(), player.data.pos, player.data.remainCards.length, Arrays.toString(player.data.remainCards));
         // 添加过玩家列表
         this.data.passList.add(player.getId());
-        // 3人不出,清空出牌堆
-        if (this.data.passList.size() >= 3) {
+        // 4人房3人不出,清空出牌堆
+        if (this.data.passList.size() >= this.data.maxNum - 1) {
             this.data.curDisCardList = new int[0];
             this.data.curDisCardType = null;
             this.data.passList.clear();
@@ -427,9 +427,11 @@ public class JDGDRoom extends Room implements GRoomInterface {
         if (player == null) {
             return;
         }
+        StringBuilder builder;
         // 头游搭档
         for (Map.Entry<Integer, Player> entry : this.data.result.entrySet()) {
             if (entry.getValue().getId().equals(player.data.teammateId)) {
+                builder = new StringBuilder();
                 switch (entry.getKey()) {
                     case 2:
                         // 搭档2游升3级
@@ -438,6 +440,9 @@ public class JDGDRoom extends Room implements GRoomInterface {
                         } else {
                             this.data.curLevelIndex += 3;
                         }
+                        builder.append("头游玩家: ").append(player.data.name)
+                                .append(", 搭档玩家: ").append(entry.getValue().data.name)
+                                .append(" 2游升3级, ");
                         break;
                     case 3:
                         // 搭档3游升2级
@@ -446,6 +451,9 @@ public class JDGDRoom extends Room implements GRoomInterface {
                         } else {
                             this.data.curLevelIndex += 2;
                         }
+                        builder.append("头游玩家: ").append(player.data.name)
+                                .append(", 搭档玩家: ").append(entry.getValue().data.name)
+                                .append(" 3游升2级, ");
                         break;
                     case 4:
                         // 搭档末游升1级
@@ -454,10 +462,16 @@ public class JDGDRoom extends Room implements GRoomInterface {
                         } else {
                             this.data.curLevelIndex += 1;
                         }
+                        builder.append("头游玩家: ").append(player.data.name)
+                                .append(", 搭档玩家: ").append(entry.getValue().data.name)
+                                .append(" 末游升1级, ");
                         break;
                 }
+                // 原级牌点数
+                int oldLevelPoint = this.data.curLevelPoint;
                 // 设置当前级牌点数
                 this.data.curLevelPoint = JDGDUtils.levelPoint[this.data.curLevelIndex];
+                logger.info(builder + "原级牌点数: {}, 当前级牌点数: {}", oldLevelPoint, this.data.curLevelPoint);
                 // 设置我方玩家级牌点数展示
                 entry.getValue().data.levelPointView[0] = this.data.curLevelPoint;
                 player.data.levelPointView[0] = this.data.curLevelPoint;