Browse Source

优化转蛋房间参数级牌规则0随机打几1固定打2判断

johnclot69 2 months ago
parent
commit
56172f8148

+ 2 - 0
incubator-game/src/main/java/com/incubator/game/data/po/RoomPO.java

@@ -38,6 +38,8 @@ public class RoomPO {
 	 * 20:20分钟 30:30分钟 40:40分钟 60:60分钟
 	 */
 	public int modev;
+	/** 级牌 0随机打几 1固定打2 **/
+	public int tc;
 
 	//**************************配置相关***************************
 

+ 29 - 11
incubator-game/src/main/java/com/incubator/game/handler/room/CreatRoomHandler.java

@@ -44,33 +44,39 @@ public class CreatRoomHandler extends NetHandler {
 		}
 
 		// 玩法类型 1掼蛋 2转蛋 3复式掼蛋
-		int type = request.getDataValue("ty", Integer.class, 1);
+		int type = request.getDataValue("ty", Integer.class, 0);
 
 		// 玩法 mode 1连续打 2按局数 3按时间
-		int mode = request.getDataValue("mode", Integer.class, 1);
+		int mode = request.getDataValue("mode", Integer.class, 0);
 		// 玩法具体 modev  14A必打
-		int modev = request.getDataValue("modev", Integer.class, 14);
+		int modev = request.getDataValue("modev", Integer.class, 0);
 
 
 		// 胜利规则 vic 1有头游无末游过A结束 2游头游过A结束 33局不过A判负结束 43局不过A用2开始
-		int vic = request.getDataValue("vic", Integer.class, 1);
+		int vic = request.getDataValue("vic", Integer.class, 0);
 		// 进贡 jing 0进贡 1不进贡
-		int jing = request.getDataValue("jing", Integer.class, 0);
+		int jing = request.getDataValue("jing", Integer.class, -1);
 		// 升级 lv  1-123级 2-124级 3-135级 4-246级
 		int lv = request.getDataValue("lv", Integer.class, 0);
 		// 套圈 lp 0套圈 1不套圈
-		int lp = request.getDataValue("lp", Integer.class, 0);
+		int lp = request.getDataValue("lp", Integer.class, -1);
 
 		// 队友 team 0固定队友 1随机搭档 2均匀分配
-		int team = request.getDataValue("team", Integer.class, 0);
+		int team = request.getDataValue("team", Integer.class, -1);
+		// 级牌 tc 0随机打几 1固定打2
+		int tc = request.getDataValue("tc", Integer.class, -1);
+		// 翻倍 dv 0不翻倍 1加倍 2翻倍
+		int dv = request.getDataValue("dv", Integer.class, -1);
+		// 积分 pv 0:123 1:124
+		int pv = request.getDataValue("pv", Integer.class, -1);
 
 
 		// 记牌器 count 0允许 1禁用
-		int count = request.getDataValue("count", Integer.class, 0);
+		int count = request.getDataValue("count", Integer.class, -1);
 		// 超时 ot 1过 2等待 3托管
 		int ot = request.getDataValue("ot", Integer.class, 0);
 		// 语音 vc 0允许 1禁用
-		int vc = request.getDataValue("vc", Integer.class, 0);
+		int vc = request.getDataValue("vc", Integer.class, -1);
 		// 旁观 pgr 1第一视角 2上帝视角 3上帝&第一视角 4旁观视角
 		int pgr = request.getDataValue("pgr", Integer.class, 0);
 
@@ -84,11 +90,23 @@ public class CreatRoomHandler extends NetHandler {
 				break;
 			case 2:
 				// 转蛋
-				jsonData = RoomUtil.zdRoomRule(type, mode, modev, lv, team);
+				if (mode == 1) {
+					Log.info("转蛋参数错误,转蛋没有连续打");
+					response.setCode(CommonProto.Code.PARAMETER_ERR_VALUE);
+					response.setMessage("转蛋参数错误...");
+					return;
+				}
+				jsonData = RoomUtil.zdRoomRule(type, mode, modev, lv, team, tc, dv, pv);
 				break;
 			case 3:
 				// 复式掼蛋
-				jsonData = RoomUtil.fsgdRoomRule(type, mode, modev, lv, vic, lp);
+				if (mode == 1 || mode == 3) {
+					Log.info("复式掼蛋参数错误,复式掼蛋没有连续打和按时间");
+					response.setCode(CommonProto.Code.PARAMETER_ERR_VALUE);
+					response.setMessage("复式掼蛋参数错误...");
+					return;
+				}
+				jsonData = RoomUtil.fsgdRoomRule(type, mode, modev, lv, vic, lp, tc);
 				// 房间最大局数
 				jsonData.put("maxRound", 8);
 				break;

+ 10 - 5
incubator-game/src/main/java/com/incubator/game/room/ZDRoom.java

@@ -33,7 +33,8 @@ public class ZDRoom extends Room {
         this.data.gameType = jsonData.getInteger("gameType");
         this.data.ownerId = player != null? player.getId() : "";
         this.data.maxNum = 4;
-
+        // 级牌 0随机打几 1固定打2
+        this.data.tc = jsonData.getInteger("tc");
         this.data.mode = jsonData.getInteger("mode");
         this.data.modev = jsonData.getInteger("modev");
 
@@ -55,12 +56,10 @@ public class ZDRoom extends Room {
             this.data.maxRound = 9999;
         }
 
+
         this.data.playerMap = new Player[this.data.maxNum];
         // 是否有进还贡规则
         this.data.isTribute = false;
-        // 初始化级牌点数
-        this.data.curLevelIndex = RandomUtil.getIndex(GDUtils.levelPoint.length);
-        this.data.curLevelPoint = GDUtils.levelPoint[this.data.curLevelIndex];
         // 初始化牌库
         this.initCardList();
     }
@@ -385,7 +384,13 @@ public class ZDRoom extends Room {
             // 随机定庄
             this.data.zhuangPos = RandomUtil.getIndex(this.data.maxNum);
             // 随机打几
-            this.data.curLevelIndex = RandomUtil.getIndex(GDUtils.levelPoint.length);
+            if (this.data.tc == 0) {
+                this.data.curLevelIndex = RandomUtil.getIndex(GDUtils.levelPoint.length);
+            }
+            // 固定打2
+            if (this.data.tc == 1) {
+                this.data.curLevelIndex = 0;
+            }
             this.data.curLevelPoint = GDUtils.levelPoint[this.data.curLevelIndex];
             // 发牌
             this.doSendCard();

+ 13 - 4
incubator-game/src/main/java/com/incubator/game/util/RoomUtil.java

@@ -71,9 +71,12 @@ public final class RoomUtil {
      * @param modev
      * @param lv
      * @param team
+     * @param tc
+     * @param dv
+     * @param pv
      * @return
      */
-    public static JSONObject zdRoomRule(int type, int mode, int modev, int lv, int team) {
+    public static JSONObject zdRoomRule(int type, int mode, int modev, int lv, int team, int tc, int dv, int pv) {
         JSONObject jsonData = new JSONObject();
 
         // 1掼蛋 2转蛋 3复式掼蛋
@@ -83,9 +86,14 @@ public final class RoomUtil {
         // 玩法2 4:4局 6:6局 8:8局 10:10局
         jsonData.put("modev", modev);
 
-
         // 队友 0固定队友 1随机搭档 2均匀分配
-        jsonData.put("team", 4);
+        jsonData.put("team", team);
+        // 级牌 0随机打几 1固定打2
+        jsonData.put("tc", tc);
+        // 翻倍 0不翻倍 1加倍 2翻倍
+        jsonData.put("dv", dv);
+        // 积分 0:123 1:124
+        jsonData.put("pv", pv);
 
         return jsonData;
     }
@@ -99,9 +107,10 @@ public final class RoomUtil {
      * @param lv
      * @param vic
      * @param lp
+     * @param tc
      * @return
      */
-    public static JSONObject fsgdRoomRule(int type, int mode, int modev, int lv, int vic, int lp) {
+    public static JSONObject fsgdRoomRule(int type, int mode, int modev, int lv, int vic, int lp, int tc) {
         JSONObject jsonData = new JSONObject();
 
         // 1掼蛋 2转蛋 3复式掼蛋