|
@@ -69,8 +69,6 @@ public class GDRoom extends Room {
|
|
|
this.data.curLevelPoint = GDUtils.levelPoint[this.data.curLevelIndex];
|
|
|
// 初始化牌库
|
|
|
this.initCardList();
|
|
|
- //初始化状态
|
|
|
- this.state = 0;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -459,7 +457,7 @@ public class GDRoom extends Room {
|
|
|
}
|
|
|
this.data.result.clear();
|
|
|
}
|
|
|
- if (this.data.towKingList.size() >= 2) {
|
|
|
+ if (this.isTwoKing()) {
|
|
|
this.data.tributeState = 3;
|
|
|
} else {
|
|
|
if (!this.data.tributeList.isEmpty() && !this.isTwoKing() && this.data.tributeState == 0) {
|
|
@@ -503,6 +501,11 @@ public class GDRoom extends Room {
|
|
|
this.state = 2;
|
|
|
this.flag = true;
|
|
|
this.time = 0;
|
|
|
+ // 清理数据
|
|
|
+ this.data.tributeState = 0;
|
|
|
+ this.data.result.clear();
|
|
|
+ this.data.tributeList.clear();
|
|
|
+ this.data.towKingList.clear();
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
Log.error("===游戏开局出错...", e);
|
|
@@ -639,6 +642,7 @@ public class GDRoom extends Room {
|
|
|
}
|
|
|
|
|
|
// 抗贡
|
|
|
+ int num = 0;
|
|
|
for (String[] tributeId : this.data.tributeList) {
|
|
|
// 进贡者
|
|
|
Player tributePlayer = this.actors.getOrDefault(tributeId[0], null);
|
|
@@ -646,7 +650,7 @@ public class GDRoom extends Room {
|
|
|
// 统计手牌数量
|
|
|
Map<Integer, Integer> cardMap = CardUtils.getCardMap(tributePlayer.data.remainCards);
|
|
|
if (!cardMap.isEmpty()) {
|
|
|
- int num = cardMap.getOrDefault(GDUtils.BIGKING, 0);
|
|
|
+ num = cardMap.getOrDefault(GDUtils.BIGKING, 0);
|
|
|
if (num > 0 && !this.data.towKingList.contains(tributeId[0])) {
|
|
|
// 记录信息
|
|
|
this.data.towKingList.add(tributeId[0]);
|
|
@@ -655,9 +659,9 @@ public class GDRoom extends Room {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (this.data.towKingList.size() < 2) {
|
|
|
- this.data.towKingList.clear();
|
|
|
- }
|
|
|
+// if (this.data.towKingList.size() < 2) {
|
|
|
+// this.data.towKingList.clear();
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -666,7 +670,19 @@ public class GDRoom extends Room {
|
|
|
* @return
|
|
|
*/
|
|
|
public boolean isTwoKing() {
|
|
|
- return this.data.towKingList.size() >= 2;
|
|
|
+ int num = 0;
|
|
|
+ for (String[] tributeId : this.data.tributeList) {
|
|
|
+ // 进贡者
|
|
|
+ Player tributePlayer = this.actors.getOrDefault(tributeId[0], null);
|
|
|
+ if (tributePlayer != null) {
|
|
|
+ // 统计手牌数量
|
|
|
+ Map<Integer, Integer> cardMap = CardUtils.getCardMap(tributePlayer.data.remainCards);
|
|
|
+ if (!cardMap.isEmpty()) {
|
|
|
+ num += cardMap.getOrDefault(GDUtils.BIGKING, 0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return num > 0 && num % 2 == 0;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -820,6 +836,7 @@ public class GDRoom extends Room {
|
|
|
this.data.tributeState = 0;
|
|
|
this.data.result.clear();
|
|
|
this.data.tributeList.clear();
|
|
|
+ this.data.towKingList.clear();
|
|
|
// 进还贡数据
|
|
|
Map<String, Object> tributeInfo = new HashMap<>();
|
|
|
tributeInfo.put("tributeList", this.data.tributeList);
|