Browse Source

解决4人模式的问题

johnclot69 3 months ago
parent
commit
5ce6e4b6c7

+ 2 - 2
incubator-game/src/main/java/com/incubator/game/contest/Contest.java

@@ -143,8 +143,8 @@ public class Contest {
 //        logger.debug("检测: 官方比赛主线程执行...");
         switch (this.state) {
             case 0:
-                logger.debug("检测: 官方比赛主线程执行...等待开始...比赛id : {}, {}, 人数 : {}, 比赛开始时间 : {}",
-                        this.data.contestId, this.prop.desc, this.actors.size(), DateUtils.formatFullDate(new Date(this.data.startTime)));
+//                logger.debug("检测: 官方比赛主线程执行...等待开始...比赛id : {}, {}, 人数 : {}, 比赛开始时间 : {}",
+//                        this.data.contestId, this.prop.desc, this.actors.size(), DateUtils.formatFullDate(new Date(this.data.startTime)));
                 // 等待开始
                 if (this.checkReadyStart()) {
                     this.state = 1;

+ 1 - 1
incubator-game/src/main/java/com/incubator/game/handler/jdgd/JDGDDisCardHandler.java

@@ -85,7 +85,7 @@ public class JDGDDisCardHandler extends NetHandler {
         }
 
         // 判断玩家出牌牌型
-        JDGDUtils.CardType disCardType = JDGDUtils.determineCardType(disCardList, 2);
+        JDGDUtils.CardType disCardType = JDGDUtils.determineCardType(disCardList, room.data.curLevelPoint);
         if (disCardType == JDGDUtils.CardType.INVALID) {
             logger.info("牌型错误");
             response.setCode(9);

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

@@ -244,7 +244,8 @@ public class JDGDRoom extends Room implements GRoomInterface {
                 if (this.data.maxNum >= 4) {
                     Integer[] nextPos = this.getNextPos(player.data.pos);
                     Player tmpPlayer = this.data.playerMap.get(nextPos[1]);
-                    player.data.teammateId = tmpPlayer != null ? tmpPlayer.data.teammateId : null;
+//                    player.data.teammateId = tmpPlayer != null ? tmpPlayer.data.teammateId : null;
+                    player.data.teammateId = tmpPlayer.getId();
                 }
                 // 发牌
                 for (int i = 0; i < 27; i++) {
@@ -372,6 +373,21 @@ public class JDGDRoom extends Room implements GRoomInterface {
         return nextPlayer;
     }
 
+    /**
+     * 获取当前未出完牌玩家数量
+     *
+     * @return
+     */
+    public int getCanOpPlayer() {
+        int cnt = 0;
+        for (Player temPlayer : this.data.playerMap.values()) {
+            if (temPlayer != null && temPlayer.data.state == 2) {
+                cnt += 1;
+            }
+        }
+        return cnt;
+    }
+
     /**
      * 判断玩家出的牌是否可以压过上一手牌
      *
@@ -496,7 +512,7 @@ public class JDGDRoom extends Room implements GRoomInterface {
         // 添加过玩家列表
         this.data.passList.add(player.getId());
         // 4人房3人不出,清空出牌堆
-        if (this.data.passList.size() >= this.data.maxNum - 1) {
+        if (this.data.passList.size() >= this.getCanOpPlayer() - 1) {
             this.data.curDisCardList = new int[0];
             this.data.curDisCardType = null;
             this.data.passList.clear();