Browse Source

转蛋增加队友规则2均匀分配

johnclot69 2 months ago
parent
commit
08a535cfa8
1 changed files with 12 additions and 1 deletions
  1. 12 1
      incubator-game/src/main/java/com/incubator/game/room/ZDRoom.java

+ 12 - 1
incubator-game/src/main/java/com/incubator/game/room/ZDRoom.java

@@ -1282,7 +1282,18 @@ public class ZDRoom extends Room {
 
         // 均匀分配
         if (this.jsonData.getInteger("team") == 2) {
-
+            // 按局数 并且 局数必须是3的倍数
+            if (this.data.mode != 2 || this.data.maxRound % 3 != 0) {
+                return;
+            }
+            // 保存最后一个玩家
+            Player lastPlayer = this.data.playerMap[this.data.playerMap.length - 1];
+            // 从后向前移动位置
+            for (int i = this.data.playerMap.length - 1; i > 0; i--) {
+                this.data.playerMap[i] = this.data.playerMap[i - 1];
+            }
+            // 将最后一个玩家移动到第一个位置
+            this.data.playerMap[0] = lastPlayer;
         }
     }