master
parent
914bc3923d
commit
109fbe2324
|
|
@ -3,10 +3,12 @@ package extend.pk;
|
||||||
public class CardObj implements Comparable<CardObj>{
|
public class CardObj implements Comparable<CardObj>{
|
||||||
public int card;
|
public int card;
|
||||||
public int cardMod;
|
public int cardMod;
|
||||||
|
public int cardCount;
|
||||||
|
|
||||||
public CardObj(int card) {
|
public CardObj(int card) {
|
||||||
this.card = card;
|
this.card = card;
|
||||||
this.cardMod = card % 100;
|
this.cardMod = card % 100;
|
||||||
|
this.cardCount = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -265,95 +265,95 @@ public class EXGameController extends GameController {
|
||||||
TObject param = new TObject();
|
TObject param = new TObject();
|
||||||
TArray addPlayerList = new TArray();
|
TArray addPlayerList = new TArray();
|
||||||
|
|
||||||
int numOne = 0;
|
// int numOne = 0;
|
||||||
int numTwo = 0;
|
// int numTwo = 0;
|
||||||
if (room.discard.config == CardConfig.ZHA) {
|
// if (room.discard.config == CardConfig.ZHA) {
|
||||||
// 拿ct.card_list第一位数字
|
// // 拿ct.card_list第一位数字
|
||||||
numTwo = ct.card_list.get(0).card % 100;
|
// numTwo = ct.card_list.get(0).card % 100;
|
||||||
Jedis jediss = Redis.use("group1_db11").getJedis();
|
// Jedis jediss = Redis.use("group1_db11").getJedis();
|
||||||
|
//
|
||||||
String playingGroupIdKeys = "g{" + owner.getRoom().groupId + "}:play:" + owner.getRoom().groupPid;
|
// String playingGroupIdKeys = "g{" + owner.getRoom().groupId + "}:play:" + owner.getRoom().groupPid;
|
||||||
try {
|
// try {
|
||||||
String score = jediss.hget(playingGroupIdKeys, "hp_times");
|
// String score = jediss.hget(playingGroupIdKeys, "hp_times");
|
||||||
|
//
|
||||||
// 循环除当前用户外的用户手牌最后一位数
|
// // 循环除当前用户外的用户手牌最后一位数
|
||||||
for (Entry<Integer, Player> entry : room.playerMapBySeat.entrySet()) {
|
// for (Entry<Integer, Player> entry : room.playerMapBySeat.entrySet()) {
|
||||||
EXPlayer player = (EXPlayer) entry.getValue();
|
// EXPlayer player = (EXPlayer) entry.getValue();
|
||||||
|
//
|
||||||
if (player.playerid != owner.playerid) {
|
// if (player.playerid != owner.playerid) {
|
||||||
// 扣分
|
// // 扣分
|
||||||
TObject minusPlayerScoreList = new TObject();
|
// TObject minusPlayerScoreList = new TObject();
|
||||||
minusPlayerScoreList.putInt("seat", player.seat);
|
// minusPlayerScoreList.putInt("seat", player.seat);
|
||||||
minusPlayerScoreList.putInt("pomSore", -10 * Integer.parseInt(score) / 1000);
|
// minusPlayerScoreList.putInt("pomSore", -10 * Integer.parseInt(score) / 1000);
|
||||||
addPlayerList.addTObject(minusPlayerScoreList);
|
// addPlayerList.addTObject(minusPlayerScoreList);
|
||||||
pb.addZhaScoreCommand(player.seat, ct, -10 * Integer.parseInt(score) / 1000);
|
// pb.addZhaScoreCommand(player.seat, ct, -10 * Integer.parseInt(score) / 1000);
|
||||||
|
//
|
||||||
Map<Integer, List> maps = new HashMap();
|
// Map<Integer, List> maps = new HashMap();
|
||||||
maps.put(player.seat, player.cardInhand);
|
// maps.put(player.seat, player.cardInhand);
|
||||||
// 循环
|
// // 循环
|
||||||
for (Entry<Integer, List> entry1 : maps.entrySet()) {
|
// for (Entry<Integer, List> entry1 : maps.entrySet()) {
|
||||||
List<Integer> cardInhand = entry1.getValue();
|
// List<Integer> cardInhand = entry1.getValue();
|
||||||
for (int i = 0; i < cardInhand.size(); i++) {
|
// for (int i = 0; i < cardInhand.size(); i++) {
|
||||||
CardObj cardObj = CardObj.class.cast(cardInhand.get(i)); // 明确获取 CardObj 对象
|
// CardObj cardObj = CardObj.class.cast(cardInhand.get(i)); // 明确获取 CardObj 对象
|
||||||
int cardValue = cardObj.card % 100;
|
// int cardValue = cardObj.card % 100;
|
||||||
cardLists.add(cardValue);
|
// cardLists.add(cardValue);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
Map<Integer, List<Integer>> map = cardLists.stream()
|
// Map<Integer, List<Integer>> map = cardLists.stream()
|
||||||
.collect(Collectors.groupingBy(Integer::intValue));
|
// .collect(Collectors.groupingBy(Integer::intValue));
|
||||||
for (Entry<Integer, List<Integer>> entry2 : map.entrySet()) {
|
// for (Entry<Integer, List<Integer>> entry2 : map.entrySet()) {
|
||||||
|
//
|
||||||
if (entry2.getValue().size() == 4) {
|
// if (entry2.getValue().size() == 4) {
|
||||||
numOne = entry2.getValue().get(0);
|
// numOne = entry2.getValue().get(0);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (numTwo > numOne) {
|
// if (numTwo > numOne) {
|
||||||
cardLists.clear();
|
// cardLists.clear();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
Map<Integer, List<Integer>> map = cardLists.stream()
|
// Map<Integer, List<Integer>> map = cardLists.stream()
|
||||||
.collect(Collectors.groupingBy(Integer::intValue));
|
// .collect(Collectors.groupingBy(Integer::intValue));
|
||||||
for (Entry<Integer, List<Integer>> entry2 : map.entrySet()) {
|
// for (Entry<Integer, List<Integer>> entry2 : map.entrySet()) {
|
||||||
if (entry2.getValue().size() == 4) {
|
// if (entry2.getValue().size() == 4) {
|
||||||
numOne = entry2.getValue().get(0);
|
// numOne = entry2.getValue().get(0);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (room.maxPlayers == 3) {
|
// if (room.maxPlayers == 3) {
|
||||||
// 存储当前用户的座位号和分数
|
// // 存储当前用户的座位号和分数
|
||||||
addPlayerScoreList.putInt("seat", owner.seat);
|
// addPlayerScoreList.putInt("seat", owner.seat);
|
||||||
addPlayerScoreList.putInt("pomSore", 20 * Integer.parseInt(score) / 1000);
|
// addPlayerScoreList.putInt("pomSore", 20 * Integer.parseInt(score) / 1000);
|
||||||
addPlayerList.addTObject(addPlayerScoreList);
|
// addPlayerList.addTObject(addPlayerScoreList);
|
||||||
pb.addZhaScoreCommand(owner.seat, ct, 20 * Integer.parseInt(score) / 1000);
|
// pb.addZhaScoreCommand(owner.seat, ct, 20 * Integer.parseInt(score) / 1000);
|
||||||
|
//
|
||||||
} else {
|
// } else {
|
||||||
// 存储当前用户的座位号和分数
|
// // 存储当前用户的座位号和分数
|
||||||
addPlayerScoreList.putInt("seat", owner.seat);
|
// addPlayerScoreList.putInt("seat", owner.seat);
|
||||||
addPlayerScoreList.putInt("pomSore", 10 * Integer.parseInt(score) / 1000);
|
// addPlayerScoreList.putInt("pomSore", 10 * Integer.parseInt(score) / 1000);
|
||||||
addPlayerList.addTObject(addPlayerScoreList);
|
// addPlayerList.addTObject(addPlayerScoreList);
|
||||||
pb.addZhaScoreCommand(owner.seat, ct, 10 * Integer.parseInt(score) / 1000);
|
// pb.addZhaScoreCommand(owner.seat, ct, 10 * Integer.parseInt(score) / 1000);
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
} catch (Exception e) {
|
// } catch (Exception e) {
|
||||||
Global.logger.error(e);
|
// Global.logger.error(e);
|
||||||
} finally {
|
// } finally {
|
||||||
jediss.close();
|
// jediss.close();
|
||||||
}
|
// }
|
||||||
param.putTArray("PlayerScoreList", addPlayerList);
|
// param.putTArray("PlayerScoreList", addPlayerList);
|
||||||
|
//
|
||||||
if (numTwo > numOne && room.discard.config == CardConfig.ZHA) {
|
// if (numTwo > numOne && room.discard.config == CardConfig.ZHA) {
|
||||||
owner.room.broadCastToClient(0, Config.GAME_EVT_BOMB_SCORE, param);
|
// owner.room.broadCastToClient(0, Config.GAME_EVT_BOMB_SCORE, param);
|
||||||
owner.room.broadCastToClientOfSpectator(Config.GAME_EVT_BOMB_SCORE, param);
|
// owner.room.broadCastToClientOfSpectator(Config.GAME_EVT_BOMB_SCORE, param);
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -371,7 +371,7 @@ public class EXGameController extends GameController {
|
||||||
cg.card_list = new ArrayList<>();
|
cg.card_list = new ArrayList<>();
|
||||||
cg.config = CardConfig.ZHA;
|
cg.config = CardConfig.ZHA;
|
||||||
cg.min_card = entry.getKey();
|
cg.min_card = entry.getKey();
|
||||||
cg.len = 1;
|
cg.len = 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return cg;
|
return cg;
|
||||||
|
|
@ -492,7 +492,6 @@ public class EXGameController extends GameController {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Collections.sort(player.cardInhand);
|
Collections.sort(player.cardInhand);
|
||||||
|
|
||||||
if (!existXingyunhao && (existGeneral || existBlack)) {
|
if (!existXingyunhao && (existGeneral || existBlack)) {
|
||||||
|
|
@ -599,8 +598,6 @@ public class EXGameController extends GameController {
|
||||||
player.black_white_rate + white_rate, maxDanPai, maxDuizi, maxSanZhang);
|
player.black_white_rate + white_rate, maxDanPai, maxDuizi, maxSanZhang);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Collections.sort(player.cardInhand);
|
Collections.sort(player.cardInhand);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -779,10 +776,9 @@ public class EXGameController extends GameController {
|
||||||
|
|
||||||
obj.putInt("winscore", player.score.round_score);
|
obj.putInt("winscore", player.score.round_score);
|
||||||
player.hp_info(obj);
|
player.hp_info(obj);
|
||||||
obj.putInt("thisboomnum", player.boomnum);
|
obj.putInt("roundBonusScore", player.roundBonusScore);
|
||||||
obj.putInt("piao", player.piao);
|
obj.putInt("roundCardScore", player.roundCardScore);
|
||||||
obj.putTArray("cards", CardUtil.toTArray(player.cardInhand));
|
obj.putTArray("cards", CardUtil.toTArray(player.cardInhand));
|
||||||
obj.putBoolean("chuntian", player.chuntian);
|
|
||||||
|
|
||||||
obj.putTArray("handCards", CardUtil.toTArray(player.cardInhand));
|
obj.putTArray("handCards", CardUtil.toTArray(player.cardInhand));
|
||||||
obj.putTArray("outCards", CardUtil.toTArray(player.outCards));
|
obj.putTArray("outCards", CardUtil.toTArray(player.outCards));
|
||||||
|
|
@ -799,8 +795,6 @@ public class EXGameController extends GameController {
|
||||||
} finally {
|
} finally {
|
||||||
jedis.close();
|
jedis.close();
|
||||||
}
|
}
|
||||||
obj.putInt("daniao", player.daniaoScore);
|
|
||||||
obj.putInt("award", player.bonusScore);
|
|
||||||
|
|
||||||
// if(owner.endType == Constant.END_TYPE_ENTRUST) {
|
// if(owner.endType == Constant.END_TYPE_ENTRUST) {
|
||||||
// obj.putInt("entrust", player.entrust ? 1 : 0);
|
// obj.putInt("entrust", player.entrust ? 1 : 0);
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@ public class EXPlayBack extends BasePlayBack{
|
||||||
ITArray cardInhand = CardUtil.toTArray(player.cardInhand);
|
ITArray cardInhand = CardUtil.toTArray(player.cardInhand);
|
||||||
obj.putTArray("hand_card", cardInhand);
|
obj.putTArray("hand_card", cardInhand);
|
||||||
obj.putInt("score", player.score.total_score);
|
obj.putInt("score", player.score.total_score);
|
||||||
obj.putInt("piao", player.piao);
|
|
||||||
|
|
||||||
player.hp_info(obj);
|
player.hp_info(obj);
|
||||||
return obj;
|
return obj;
|
||||||
|
|
|
||||||
|
|
@ -3,16 +3,12 @@ package extend.pk;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.game.Global;
|
|
||||||
import com.game.data.Player;
|
import com.game.data.Player;
|
||||||
import com.game.data.Room;
|
import com.game.data.Room;
|
||||||
import com.game.data.Score;
|
import com.game.data.Score;
|
||||||
import com.taurus.core.entity.ITObject;
|
import com.taurus.core.entity.ITObject;
|
||||||
|
|
||||||
import com.taurus.core.plugin.redis.Redis;
|
|
||||||
import extend.pk.uitl.CardUtil;
|
import extend.pk.uitl.CardUtil;
|
||||||
import redis.clients.jedis.Jedis;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -20,14 +16,14 @@ import redis.clients.jedis.Jedis;
|
||||||
*/
|
*/
|
||||||
public class EXPlayer extends Player {
|
public class EXPlayer extends Player {
|
||||||
|
|
||||||
/**默认action时间 20s*/
|
/** 默认action时间 20s */
|
||||||
public static final int DEFAULT_ACTION_TIME = 20000;
|
public static final int DEFAULT_ACTION_TIME = 20000;
|
||||||
/**默认托管时间 1s*/
|
/** 默认托管时间 1s */
|
||||||
public static final int DEFAULT_ENTRUST_TIME = 1000;
|
public static final int DEFAULT_ENTRUST_TIME = 1000;
|
||||||
/**
|
/**
|
||||||
* 默认准备时间 20s
|
* 默认准备时间 20s
|
||||||
*/
|
*/
|
||||||
public static final int DEFAULT_READY_TIME = 20000;
|
public static final int DEFAULT_READY_TIME = 20000;
|
||||||
|
|
||||||
// 手牌
|
// 手牌
|
||||||
public List<CardObj> cardInhand;
|
public List<CardObj> cardInhand;
|
||||||
|
|
@ -35,37 +31,21 @@ public class EXPlayer extends Player {
|
||||||
// 手牌
|
// 手牌
|
||||||
public List<CardObj> nextCardInhand = new ArrayList<CardObj>();
|
public List<CardObj> nextCardInhand = new ArrayList<CardObj>();
|
||||||
|
|
||||||
|
// 打出的牌
|
||||||
//打出的牌
|
|
||||||
public List<CardObj> outCards;
|
public List<CardObj> outCards;
|
||||||
|
|
||||||
public CardGroup last_outcard;
|
public CardGroup last_outcard;
|
||||||
public boolean pass;
|
public boolean pass;
|
||||||
|
|
||||||
// 放作弊场第一张牌是否关闭
|
// 放作弊场第一张牌是否关闭
|
||||||
public int open = 0;
|
public int open = 0;
|
||||||
|
public SettleLog settleLog;
|
||||||
/**春天 */
|
public int roundBonusScore = 0;// 当局彩头得分 7炸以上
|
||||||
public boolean chuntian;
|
public int roundCardScore = 0;// 当局牌型得分
|
||||||
|
|
||||||
/**是否有红桃10*/
|
|
||||||
public boolean isHaveRedTen;
|
|
||||||
|
|
||||||
public SettleLog settleLog;
|
|
||||||
|
|
||||||
public int boomnum = 0;
|
|
||||||
public int piao = -1;
|
|
||||||
public int daniaoScore = 0;
|
|
||||||
public int bonusScore = 0;
|
|
||||||
public int awardScore = 0;
|
|
||||||
|
|
||||||
public boolean isChoice = false;
|
|
||||||
|
|
||||||
|
|
||||||
public EXPlayer(int playerid, Room table, String session_id) {
|
public EXPlayer(int playerid, Room table, String session_id) {
|
||||||
super(playerid, table, session_id);
|
super(playerid, table, session_id);
|
||||||
cardInhand = new ArrayList<>();
|
cardInhand = new ArrayList<>();
|
||||||
outCards = new ArrayList<>();
|
outCards = new ArrayList<>();
|
||||||
|
|
||||||
settleLog = new SettleLog();
|
settleLog = new SettleLog();
|
||||||
settleLog.put(Config.SETTLE_WIN_COUNT, 0);
|
settleLog.put(Config.SETTLE_WIN_COUNT, 0);
|
||||||
|
|
@ -82,12 +62,11 @@ public class EXPlayer extends Player {
|
||||||
public ITObject getReloadInfo() {
|
public ITObject getReloadInfo() {
|
||||||
ITObject playerData = super.getReloadInfo();
|
ITObject playerData = super.getReloadInfo();
|
||||||
playerData.putInt("card_size", this.cardInhand.size());
|
playerData.putInt("card_size", this.cardInhand.size());
|
||||||
playerData.putInt("piao", this.piao);
|
if (last_outcard != null) {
|
||||||
if(last_outcard!=null) {
|
|
||||||
playerData.putTObject("last_outcard", last_outcard.toObject(false));
|
playerData.putTObject("last_outcard", last_outcard.toObject(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.room.isplaying == false) {
|
if (this.room.isplaying == false) {
|
||||||
playerData.putTArray("cards", CardUtil.toTArray(this.cardInhand));
|
playerData.putTArray("cards", CardUtil.toTArray(this.cardInhand));
|
||||||
|
|
||||||
playerData.putTArray("handCards", CardUtil.toTArray(this.cardInhand));
|
playerData.putTArray("handCards", CardUtil.toTArray(this.cardInhand));
|
||||||
|
|
@ -95,7 +74,6 @@ public class EXPlayer extends Player {
|
||||||
|
|
||||||
playerData.putInt("score", score.total_score);
|
playerData.putInt("score", score.total_score);
|
||||||
playerData.putInt("winscore", score.round_score);
|
playerData.putInt("winscore", score.round_score);
|
||||||
playerData.putInt("thisboomnum", boomnum);
|
|
||||||
playerData.putInt("open", open);
|
playerData.putInt("open", open);
|
||||||
}
|
}
|
||||||
return playerData;
|
return playerData;
|
||||||
|
|
@ -108,7 +86,6 @@ public class EXPlayer extends Player {
|
||||||
return playerData;
|
return playerData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void clear() {
|
public void clear() {
|
||||||
super.clear();
|
super.clear();
|
||||||
|
|
||||||
|
|
@ -121,13 +98,9 @@ public class EXPlayer extends Player {
|
||||||
this.outCards.clear();
|
this.outCards.clear();
|
||||||
this.last_outcard = null;
|
this.last_outcard = null;
|
||||||
this.pass = false;
|
this.pass = false;
|
||||||
this.chuntian =false;
|
|
||||||
this.isHaveRedTen=false;
|
|
||||||
this.open = 0;
|
this.open = 0;
|
||||||
this.boomnum = 0;
|
this.roundBonusScore = 0;
|
||||||
this.piao = -1;
|
this.roundCardScore = 0;
|
||||||
this.daniaoScore = 0;
|
|
||||||
this.isChoice=false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public EXRoom getRoom() {
|
public EXRoom getRoom() {
|
||||||
|
|
|
||||||
|
|
@ -35,8 +35,6 @@ public class EXRoom extends Room {
|
||||||
|
|
||||||
public Map<Integer, CardConfig> card_config_map;
|
public Map<Integer, CardConfig> card_config_map;
|
||||||
|
|
||||||
public int piaoCount = 0;
|
|
||||||
|
|
||||||
public List<List<CardObj>> supCards;
|
public List<List<CardObj>> supCards;
|
||||||
public List<CardObj> targetCards;
|
public List<CardObj> targetCards;
|
||||||
public int adminSeat = 0;
|
public int adminSeat = 0;
|
||||||
|
|
@ -46,15 +44,12 @@ public class EXRoom extends Room {
|
||||||
public EXRoom(String roomid, Map<String, String> redis_room_map) {
|
public EXRoom(String roomid, Map<String, String> redis_room_map) {
|
||||||
super(roomid, redis_room_map);
|
super(roomid, redis_room_map);
|
||||||
|
|
||||||
card = new RoomCard(this, this.config.getInt(Config.ROOM_CONFIG_CARDNUM) == 1 ? 15 : 16, maxPlayers);
|
card = new RoomCard(this, 52, maxPlayers);
|
||||||
card_config_map = new HashMap<Integer, CardConfig>();
|
card_config_map = new HashMap<Integer, CardConfig>();
|
||||||
card_config_map.put(CardConfig.DAN.type, CardConfig.DAN);
|
card_config_map.put(CardConfig.DAN.type, CardConfig.DAN);
|
||||||
card_config_map.put(CardConfig.DUIZI.type, CardConfig.DUIZI);
|
card_config_map.put(CardConfig.DUIZI.type, CardConfig.DUIZI);
|
||||||
card_config_map.put(CardConfig.ZHA.type, CardConfig.ZHA);
|
card_config_map.put(CardConfig.ZHA.type, CardConfig.ZHA);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
this.isEntrust = true;
|
this.isEntrust = true;
|
||||||
|
|
||||||
this.supCards = new ArrayList<>();
|
this.supCards = new ArrayList<>();
|
||||||
|
|
@ -126,10 +121,8 @@ public class EXRoom extends Room {
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
score = score * this.hpData.getInt("times") / 1000;
|
score = score * this.hpData.getInt("times") / 1000;
|
||||||
|
|
||||||
|
|
||||||
destPlayer.score.round_log.put(type, destPlayer.score.round_log.get(type) + score);
|
destPlayer.score.round_log.put(type, destPlayer.score.round_log.get(type) + score);
|
||||||
fromPlayer.score.round_log.put(type, fromPlayer.score.round_log.get(type) - score);
|
fromPlayer.score.round_log.put(type, fromPlayer.score.round_log.get(type) - score);
|
||||||
destPlayer.score.round_score += score;
|
destPlayer.score.round_score += score;
|
||||||
|
|
@ -137,8 +130,6 @@ public class EXRoom extends Room {
|
||||||
fromPlayer.score.round_score -= score;
|
fromPlayer.score.round_score -= score;
|
||||||
fromPlayer.score.total_score -= score;
|
fromPlayer.score.total_score -= score;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -149,7 +140,6 @@ public class EXRoom extends Room {
|
||||||
public void addAllBombScore(EXPlayer destPlayer) {
|
public void addAllBombScore(EXPlayer destPlayer) {
|
||||||
|
|
||||||
destPlayer.settleLog.add(Config.SETTLE_BOMB_COUNT);
|
destPlayer.settleLog.add(Config.SETTLE_BOMB_COUNT);
|
||||||
destPlayer.boomnum++;
|
|
||||||
|
|
||||||
TArray seatData = TArray.newInstance();
|
TArray seatData = TArray.newInstance();
|
||||||
for (Entry<Integer, Player> entry : this.playerMapByPlaying.entrySet()) {
|
for (Entry<Integer, Player> entry : this.playerMapByPlaying.entrySet()) {
|
||||||
|
|
@ -172,144 +162,46 @@ public class EXRoom extends Room {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 变更游戏积分
|
* 变更游戏积分
|
||||||
*
|
*
|
||||||
* @param destPlayer 目标玩家,将接收其他玩家的分数
|
* @param destPlayer 目标玩家,将接收其他玩家的分数
|
||||||
*/
|
*/
|
||||||
public void addAllScore(Player destPlayer) {
|
public void addAllScore(Player destPlayer) {
|
||||||
|
|
||||||
// 将目标玩家转换为扩展玩家类型
|
// 将目标玩家转换为扩展玩家类型
|
||||||
EXPlayer dp = (EXPlayer) destPlayer;
|
EXPlayer dp = (EXPlayer) destPlayer;
|
||||||
|
|
||||||
// 标记是否有玩家达到春天条件
|
|
||||||
boolean bSpring = false;
|
|
||||||
|
|
||||||
// 遍历所有参与游戏的玩家
|
|
||||||
for (Entry<Integer, Player> entry : this.playerMapByPlaying.entrySet()) {
|
|
||||||
|
|
||||||
// 将当前玩家转换为扩展玩家类型
|
|
||||||
EXPlayer fromPlayer = (EXPlayer) entry.getValue();
|
|
||||||
|
|
||||||
// 确保当前玩家不是目标玩家
|
|
||||||
if (fromPlayer != destPlayer) {
|
|
||||||
|
|
||||||
// 检查当前玩家手中是否有超过一张牌
|
|
||||||
if (fromPlayer.cardInhand.size() > 1) {
|
|
||||||
|
|
||||||
// 计算基础分数
|
|
||||||
int size = fromPlayer.cardInhand.size();
|
|
||||||
int score = size;
|
|
||||||
|
|
||||||
// 计算出牌数量
|
|
||||||
int outCard = (this.config.getInt(Config.ROOM_CONFIG_CARDNUM) == 1 ? 15 : 16) - size;
|
|
||||||
|
|
||||||
// 检查是否达到春天条件
|
|
||||||
if (size == (this.config.getInt(Config.ROOM_CONFIG_CARDNUM) == 1 ? 15 : 16)) {
|
|
||||||
fromPlayer.chuntian = true;
|
|
||||||
score = size * 2;
|
|
||||||
bSpring = true;
|
|
||||||
|
|
||||||
} else if (outCard < 2 && this.config.getInt(Config.ROOM_CONFIG_SPECIL_ADD) == 1 ) {
|
|
||||||
// 只出一张牌多10分
|
|
||||||
score += 10;
|
|
||||||
} else if (outCard < 4 && this.config.getInt(Config.ROOM_CONFIG_SPECIL_ADD) == 1 ) {
|
|
||||||
// 出2-3张牌多5分
|
|
||||||
score += 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
// 遍历所有参与游戏的玩家
|
||||||
|
for (Entry<Integer, Player> entry : this.playerMapByPlaying.entrySet()) {
|
||||||
|
|
||||||
// 加上目标玩家的飘分
|
// 将当前玩家转换为扩展玩家类型
|
||||||
if (dp.piao > 0) {
|
EXPlayer fromPlayer = (EXPlayer) entry.getValue();
|
||||||
score += dp.piao;
|
// 确保当前玩家不是目标玩家
|
||||||
}
|
if (fromPlayer != destPlayer) {
|
||||||
|
|
||||||
// 加上当前玩家的飘分
|
// 更新目标玩家和当前玩家的分数
|
||||||
if (fromPlayer.piao > 0) {
|
this.addScore(destPlayer, fromPlayer, 2, EXScore.WIN);
|
||||||
score += fromPlayer.piao;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新目标玩家和当前玩家的分数
|
// 设置玩家的当初最大分数
|
||||||
this.addScore(destPlayer, fromPlayer, score, EXScore.WIN);
|
for (Entry<Integer, Player> entry : this.playerMapByPlaying.entrySet()) {
|
||||||
}
|
EXPlayer player = (EXPlayer) entry.getValue();
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 设置玩家的当初最大分数
|
// 为目标玩家增加胜利次数记录
|
||||||
for (Entry<Integer, Player> entry : this.playerMapByPlaying.entrySet()) {
|
if (destPlayer == player) {
|
||||||
EXPlayer player = (EXPlayer) entry.getValue();
|
player.settleLog.add(Config.SETTLE_WIN_COUNT);
|
||||||
|
}
|
||||||
|
|
||||||
// 为目标玩家增加胜利次数记录
|
// 更新玩家的最高分数记录
|
||||||
if (destPlayer == player) {
|
if (player.score.round_score > player.settleLog.get(Config.SETTLE_MAX_SCORE)) {
|
||||||
player.settleLog.add(Config.SETTLE_WIN_COUNT);
|
player.settleLog.put(Config.SETTLE_MAX_SCORE, player.score.round_score);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 更新玩家的最高分数记录
|
|
||||||
if (player.score.round_score > player.settleLog.get(Config.SETTLE_MAX_SCORE)) {
|
|
||||||
player.settleLog.put(Config.SETTLE_MAX_SCORE, player.score.round_score);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// // 增加玩家春天的个数
|
|
||||||
// if (bSpring) {
|
|
||||||
// dp.settleLog.add(Config.SETTLE_CHUNTIAN_COUNT);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// 检查是否启用总分模式
|
|
||||||
// if (totalType()) {
|
|
||||||
// // 检查房间配置中是否设置了大鸟分,并获取设置值
|
|
||||||
// if (config.containsKey(Config.ROOM_CONFIG_DANIAO) && config.getInt(Config.ROOM_CONFIG_DANIAO) > 0) {
|
|
||||||
//
|
|
||||||
// int daniao = this.config.getInt(Config.ROOM_CONFIG_DANIAO);
|
|
||||||
// if (daniao == 1)
|
|
||||||
// daniao = 10;
|
|
||||||
// else if (daniao == 2)
|
|
||||||
// daniao = 20;
|
|
||||||
// else if (daniao == 3)
|
|
||||||
// daniao = 50;
|
|
||||||
//
|
|
||||||
// // 初始化最大总分数和最大总分出现次数
|
|
||||||
// int maxTotalScore = 0;
|
|
||||||
// int maxTotalCount = 0;
|
|
||||||
//
|
|
||||||
// // 遍历所有玩家,找出最大总分数和出现次数
|
|
||||||
// for (Entry<Integer, Player> entry : this.playerMapBySeat.entrySet()) {
|
|
||||||
//
|
|
||||||
// Player player = entry.getValue();
|
|
||||||
//
|
|
||||||
// if (player.score.total_score > maxTotalScore) {
|
|
||||||
//
|
|
||||||
// maxTotalScore = player.score.total_score;
|
|
||||||
// maxTotalCount = 1;
|
|
||||||
// } else if (player.score.total_score == maxTotalScore && maxTotalScore > 0) {
|
|
||||||
//
|
|
||||||
// maxTotalCount++;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // 如果存在大赢家
|
|
||||||
// if (maxTotalScore > 0 && maxTotalCount > 0) {
|
|
||||||
//
|
|
||||||
// // 根据大赢家和非大赢家更新玩家分数
|
|
||||||
// for (Entry<Integer, Player> entry : this.playerMapBySeat.entrySet()) {
|
|
||||||
//
|
|
||||||
// EXPlayer player = (EXPlayer) entry.getValue();
|
|
||||||
//
|
|
||||||
// if (player.score.total_score == maxTotalScore) {
|
|
||||||
//
|
|
||||||
// player.score.total_score += daniao;
|
|
||||||
// player.daniaoScore = daniao;
|
|
||||||
// } else {
|
|
||||||
//
|
|
||||||
// player.score.total_score -= daniao * maxTotalCount;
|
|
||||||
// player.daniaoScore = -daniao * maxTotalCount;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void roomResult() {
|
protected void roomResult() {
|
||||||
|
|
@ -335,13 +227,9 @@ public void addAllScore(Player destPlayer) {
|
||||||
obj.putInt("seat", player.seat);
|
obj.putInt("seat", player.seat);
|
||||||
obj.putInt("score", player.score.total_score);
|
obj.putInt("score", player.score.total_score);
|
||||||
|
|
||||||
|
|
||||||
obj.putInt("winscore", player.score.round_score);
|
obj.putInt("winscore", player.score.round_score);
|
||||||
player.hp_info(obj);
|
player.hp_info(obj);
|
||||||
obj.putInt("thisboomnum", player.boomnum);
|
|
||||||
obj.putInt("piao", player.piao);
|
|
||||||
obj.putTArray("cards", CardUtil.toTArray(player.cardInhand));
|
obj.putTArray("cards", CardUtil.toTArray(player.cardInhand));
|
||||||
obj.putBoolean("chuntian", player.chuntian);
|
|
||||||
|
|
||||||
obj.putTArray("handCards", CardUtil.toTArray(player.cardInhand));
|
obj.putTArray("handCards", CardUtil.toTArray(player.cardInhand));
|
||||||
obj.putTArray("outCards", CardUtil.toTArray(player.outCards));
|
obj.putTArray("outCards", CardUtil.toTArray(player.outCards));
|
||||||
|
|
@ -350,7 +238,6 @@ public void addAllScore(Player destPlayer) {
|
||||||
Jedis jedis = Redis.use("group1_db11").getJedis();
|
Jedis jedis = Redis.use("group1_db11").getJedis();
|
||||||
String playingGroupIdKey = "g{" + owner.groupId + "}:play:" + owner.groupPid;
|
String playingGroupIdKey = "g{" + owner.groupId + "}:play:" + owner.groupPid;
|
||||||
try {
|
try {
|
||||||
// int score = player.room.hpData.getInt("times") / 1000;
|
|
||||||
|
|
||||||
obj.putInt("total_score", player.score.total_score);
|
obj.putInt("total_score", player.score.total_score);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
@ -358,12 +245,7 @@ public void addAllScore(Player destPlayer) {
|
||||||
} finally {
|
} finally {
|
||||||
jedis.close();
|
jedis.close();
|
||||||
}
|
}
|
||||||
obj.putInt("daniao", player.daniaoScore);
|
|
||||||
obj.putInt("award", player.bonusScore);
|
|
||||||
|
|
||||||
// if(owner.endType == Constant.END_TYPE_ENTRUST) {
|
|
||||||
// obj.putInt("entrust", player.entrust ? 1 : 0);
|
|
||||||
// }
|
|
||||||
|
|
||||||
int jieShan = owner.hpData.getInt("JieShan");
|
int jieShan = owner.hpData.getInt("JieShan");
|
||||||
if (owner.endType == Constant.END_TYPE_ENTRUST && player.entrust_round < jieShan) {
|
if (owner.endType == Constant.END_TYPE_ENTRUST && player.entrust_round < jieShan) {
|
||||||
|
|
@ -371,7 +253,6 @@ public void addAllScore(Player destPlayer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
obj.putTObject("settle_log", player.settleLog.toTObject());
|
obj.putTObject("settle_log", player.settleLog.toTObject());
|
||||||
// obj.putInt("total_score", player.score.total_score);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
info.addTObject(obj);
|
info.addTObject(obj);
|
||||||
|
|
@ -385,10 +266,6 @@ public void addAllScore(Player destPlayer) {
|
||||||
mp.putTArray("info", info);
|
mp.putTArray("info", info);
|
||||||
mp.putInt("xipai_score", owner.xi_pai_score);
|
mp.putInt("xipai_score", owner.xi_pai_score);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return mp;
|
return mp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -397,7 +274,7 @@ public void addAllScore(Player destPlayer) {
|
||||||
addAllScore(win);
|
addAllScore(win);
|
||||||
|
|
||||||
this.chooseover = 0;
|
this.chooseover = 0;
|
||||||
//拿结算数据
|
// 拿结算数据
|
||||||
|
|
||||||
ITObject mp = getRoomResultData(this, true);
|
ITObject mp = getRoomResultData(this, true);
|
||||||
|
|
||||||
|
|
@ -414,7 +291,7 @@ public void addAllScore(Player destPlayer) {
|
||||||
obj.putBoolean("entrust", player.entrust);
|
obj.putBoolean("entrust", player.entrust);
|
||||||
info.addTObject(obj);
|
info.addTObject(obj);
|
||||||
|
|
||||||
if (player.entrust == true){
|
if (player.entrust == true) {
|
||||||
player.entrust_round++;
|
player.entrust_round++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -186,80 +186,15 @@ public class EXPlayerDiscardState extends StateBase<EXPlayer> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if(owner.getRoom().firstCard != 0 && CardUtil.getCard1(owner.getRoom().firstCard, list) == null) {
|
|
||||||
// EXMainServer.gameCtr.sendPutError(owner,Config.PUT_ERROR_MUST_OUT_MIN);
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
CardGroup ct = CardCheck.getType(list, owner.room.config);
|
CardGroup ct = CardCheck.getType(list, owner.room.config);
|
||||||
|
|
||||||
if (ct == null) {
|
if (ct == null) {
|
||||||
|
|
||||||
// if (CardCheck.isConfig4_2_and_4_3(owner.room.config)) {
|
|
||||||
// //四带三摆尾
|
|
||||||
// if (list.size() == owner.cardInhand.size()) { //最后一把
|
|
||||||
// Map<Integer, Integer> cardMap =CardUtil.getCardNumMap(list);
|
|
||||||
//
|
|
||||||
// if (ct == null) {
|
|
||||||
// if(owner.room.config.containsKey(Config.ROOM_CONFIG_SIDAI_3) && owner.room.config.getBoolean(Config.ROOM_CONFIG_SIDAI_3)) {
|
|
||||||
//// if (list.size() == 5 || list.size() == 6) {
|
|
||||||
//// ct = CardCheck.checkSiWithThree(cardMap,owner.room.config);
|
|
||||||
//// }
|
|
||||||
// if (list.size() == 5 ) {
|
|
||||||
// ct = CardCheck.checkSiWithThree(cardMap,owner.room.config);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (ct != null) {
|
|
||||||
// for(CardObj cardObj : owner.cardInhand) {
|
|
||||||
// ct.card_list.add(cardObj);
|
|
||||||
// }
|
|
||||||
// ct.card_list_mp = CardUtil.toTArray(ct.card_list);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (ct == null) {
|
if (ct == null) {
|
||||||
EXMainServer.gameCtr.sendPutError(owner, Config.PUT_ERROR_INVALID_TYPE);
|
EXMainServer.gameCtr.sendPutError(owner, Config.PUT_ERROR_INVALID_TYPE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 验证客户端发过来的类型
|
|
||||||
if (!CardCheck.tryType(ct, owner.cardInhand.size(), owner.room.config)) {
|
|
||||||
|
|
||||||
// tryType 判断3条a判断不出来, 所以
|
|
||||||
if (!(ct.config.type == Config.TYPE_ZHA && card_list.size() == 3 &&
|
|
||||||
|
|
||||||
CardUtil.checkCard(RoomCard.CARD_A, list, 3))) {
|
|
||||||
|
|
||||||
EXMainServer.gameCtr.sendPutError(owner, Config.PUT_ERROR_INVALID_TYPE);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 如果炸弹不允许拆分,则检测非炸弹和4带三的牌型,看他们是否拆分了炸弹
|
|
||||||
|
|
||||||
if (ct.config.type != Config.TYPE_ZHA) {
|
|
||||||
|
|
||||||
Map<Integer, Integer> hangCardMap = CardUtil.getCardNumMap(owner.cardInhand);
|
|
||||||
Map<Integer, Integer> cardMap = CardUtil.getCardNumMap(list);
|
|
||||||
for (Map.Entry<Integer, Integer> entry : cardMap.entrySet()) {
|
|
||||||
|
|
||||||
int handNum = hangCardMap.get(entry.getKey());
|
|
||||||
|
|
||||||
// 4张牌 不能出现在处大赞的牌型中
|
|
||||||
if (handNum >= 4) {
|
|
||||||
|
|
||||||
EXMainServer.gameCtr.sendPutError(owner, Config.PUT_ERROR_BOMB_CHAI);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
doAction(owner, ct, false);
|
doAction(owner, ct, false);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -354,23 +289,23 @@ public class EXPlayerDiscardState extends StateBase<EXPlayer> {
|
||||||
outcard = CardCheck.tryCompete(room.discard, ct, room.config);
|
outcard = CardCheck.tryCompete(room.discard, ct, room.config);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果玩家的下家只有一张牌,玩家出单张必须是最大的
|
// // 如果玩家的下家只有一张牌,玩家出单张必须是最大的
|
||||||
if (outcard && ct.config.type == Config.TYPE_DANPAI) {
|
// if (outcard && ct.config.type == Config.TYPE_DANPAI) {
|
||||||
|
//
|
||||||
EXPlayer playerNext = (EXPlayer) room.playerMapBySeat.get(owner.nextSeat);
|
// EXPlayer playerNext = (EXPlayer) room.playerMapBySeat.get(owner.nextSeat);
|
||||||
if (playerNext != null && playerNext.cardInhand.size() == 1) {
|
// if (playerNext != null && playerNext.cardInhand.size() == 1) {
|
||||||
|
//
|
||||||
Map<Integer, Integer> cardMap = CardUtil.getCardNumMap(owner.cardInhand);
|
// Map<Integer, Integer> cardMap = CardUtil.getCardNumMap(owner.cardInhand);
|
||||||
for (Integer number : cardMap.keySet()) {
|
// for (Integer number : cardMap.keySet()) {
|
||||||
|
//
|
||||||
if (ct.min_card < number) {
|
// if (ct.min_card < number) {
|
||||||
|
//
|
||||||
EXMainServer.gameCtr.sendPutError(owner, Config.PUT_ERROR_MUST_OUT_MAX);
|
// EXMainServer.gameCtr.sendPutError(owner, Config.PUT_ERROR_MUST_OUT_MAX);
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
if (!outcard) {
|
if (!outcard) {
|
||||||
EXMainServer.gameCtr.sendPutError(owner, Config.PUT_ERROR_INVALID_TYPE);
|
EXMainServer.gameCtr.sendPutError(owner, Config.PUT_ERROR_INVALID_TYPE);
|
||||||
|
|
@ -380,11 +315,6 @@ public class EXPlayerDiscardState extends StateBase<EXPlayer> {
|
||||||
EXMainServer.gameCtr.outCard(owner, ct);
|
EXMainServer.gameCtr.outCard(owner, ct);
|
||||||
|
|
||||||
if (owner.cardInhand.size() == 0) {
|
if (owner.cardInhand.size() == 0) {
|
||||||
// 如果最后一手牌是炸弹 则需要添加炸弹分
|
|
||||||
if (ct.config.type == Config.TYPE_ZHA) {
|
|
||||||
|
|
||||||
room.addAllBombScore(owner);// 炸弹玩家增加积分
|
|
||||||
}
|
|
||||||
this.over(owner);
|
this.over(owner);
|
||||||
} else {
|
} else {
|
||||||
this.toNextState(owner);
|
this.toNextState(owner);
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,11 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import com.game.Global;
|
|
||||||
import com.taurus.core.entity.ITArray;
|
import com.taurus.core.entity.ITArray;
|
||||||
import com.taurus.core.entity.ITObject;
|
import com.taurus.core.entity.ITObject;
|
||||||
|
|
||||||
import com.taurus.core.entity.TArray;
|
import com.taurus.core.entity.TArray;
|
||||||
import com.taurus.core.entity.TObject;
|
import com.taurus.core.entity.TObject;
|
||||||
|
|
||||||
import extend.pk.CardGroup;
|
import extend.pk.CardGroup;
|
||||||
import extend.pk.CardObj;
|
import extend.pk.CardObj;
|
||||||
import extend.pk.Config;
|
import extend.pk.Config;
|
||||||
|
|
@ -38,12 +37,6 @@ public class CardCheck {
|
||||||
|
|
||||||
Map<Integer, List<CardObj>> cardMap = CardUtil.getCardListMap(cardInhand);
|
Map<Integer, List<CardObj>> cardMap = CardUtil.getCardListMap(cardInhand);
|
||||||
int handCardSize = cardInhand.size();
|
int handCardSize = cardInhand.size();
|
||||||
// 如果有炸弹 并且玩家手上仅剩下炸弹 就不用找了 直接出牌就可以了
|
|
||||||
cg = selectZha(cardMap, out, roomConfig);
|
|
||||||
if (cg != null && cg.card_list.size() == handCardSize) {
|
|
||||||
cg.card_list_mp = CardUtil.toTArray(cg.card_list);
|
|
||||||
return cg;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 如果别的玩家出的是一张单牌,则寻找一个合适的单牌,如果找不到就用炸弹,炸弹没有则过
|
// 如果别的玩家出的是一张单牌,则寻找一个合适的单牌,如果找不到就用炸弹,炸弹没有则过
|
||||||
if (out.config.type == Config.TYPE_DANPAI) {
|
if (out.config.type == Config.TYPE_DANPAI) {
|
||||||
|
|
@ -56,7 +49,6 @@ public class CardCheck {
|
||||||
|
|
||||||
// 如果别的玩家出的是不能带牌的牌型(对子,顺子,连队)则寻找合适的牌型,如果找不到就用炸弹,炸弹没有则过
|
// 如果别的玩家出的是不能带牌的牌型(对子,顺子,连队)则寻找合适的牌型,如果找不到就用炸弹,炸弹没有则过
|
||||||
else if (out.config.type == Config.TYPE_DUIZI) {
|
else if (out.config.type == Config.TYPE_DUIZI) {
|
||||||
|
|
||||||
CardGroup tempCg = selectWithoutCardType(handCardSize, cardMap, out, roomConfig);
|
CardGroup tempCg = selectWithoutCardType(handCardSize, cardMap, out, roomConfig);
|
||||||
if (tempCg != null) {
|
if (tempCg != null) {
|
||||||
cg = tempCg;
|
cg = tempCg;
|
||||||
|
|
@ -89,7 +81,8 @@ public class CardCheck {
|
||||||
* @param roomConfig
|
* @param roomConfig
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private static CardGroup selectZha(Map<Integer, List<CardObj>> cardMap, CardGroup out, ITObject roomConfig) {
|
private static CardGroup selectZha(Map<Integer, List<CardObj>> cardMap, CardGroup out, ITObject roomConfig,
|
||||||
|
int len) {
|
||||||
|
|
||||||
CardGroup cg = null;
|
CardGroup cg = null;
|
||||||
|
|
||||||
|
|
@ -100,7 +93,7 @@ public class CardCheck {
|
||||||
|
|
||||||
for (Map.Entry<Integer, List<CardObj>> entry : cardMap.entrySet()) {
|
for (Map.Entry<Integer, List<CardObj>> entry : cardMap.entrySet()) {
|
||||||
|
|
||||||
if (entry.getValue().size() == 4 || (entry.getKey() == RoomCard.CARD_A && entry.getValue().size() == 3)) {
|
if (entry.getValue().size() >= 4) {
|
||||||
|
|
||||||
if (entry.getKey() > minValue) {
|
if (entry.getKey() > minValue) {
|
||||||
|
|
||||||
|
|
@ -108,7 +101,7 @@ public class CardCheck {
|
||||||
|
|
||||||
cg.config = CardConfig.ZHA;
|
cg.config = CardConfig.ZHA;
|
||||||
cg.min_card = entry.getKey();
|
cg.min_card = entry.getKey();
|
||||||
cg.len = 1;
|
cg.len = len;
|
||||||
|
|
||||||
cg.card_list = new ArrayList<>();
|
cg.card_list = new ArrayList<>();
|
||||||
for (CardObj cardObj : entry.getValue()) {
|
for (CardObj cardObj : entry.getValue()) {
|
||||||
|
|
@ -144,19 +137,16 @@ public class CardCheck {
|
||||||
List<CardObj> listCard = cardMap.get(i);
|
List<CardObj> listCard = cardMap.get(i);
|
||||||
if (listCard != null && listCard.size() >= 1) {
|
if (listCard != null && listCard.size() >= 1) {
|
||||||
// 如果是炸弹 并且不能拆分炸弹,则不能用它作为单牌来处理
|
// 如果是炸弹 并且不能拆分炸弹,则不能用它作为单牌来处理
|
||||||
if ((listCard.size() == 4 || (i == RoomCard.CARD_A && listCard.size() == 3))) {
|
|
||||||
|
|
||||||
} else {
|
cg = new CardGroup();
|
||||||
cg = new CardGroup();
|
|
||||||
|
|
||||||
cg.config = CardConfig.DAN;
|
cg.config = CardConfig.DAN;
|
||||||
cg.min_card = i;
|
cg.min_card = i;
|
||||||
cg.len = 1;
|
cg.len = 1;
|
||||||
|
|
||||||
cg.card_list = new ArrayList<>();
|
cg.card_list = new ArrayList<>();
|
||||||
cg.card_list.add(listCard.get(0));
|
cg.card_list.add(listCard.get(0));
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -165,21 +155,15 @@ public class CardCheck {
|
||||||
List<CardObj> listCard = cardMap.get(i);
|
List<CardObj> listCard = cardMap.get(i);
|
||||||
if (listCard != null && listCard.size() >= 1) {
|
if (listCard != null && listCard.size() >= 1) {
|
||||||
|
|
||||||
// 如果是炸弹 并且不能拆分炸弹,则不能用它作为单牌来处理
|
cg = new CardGroup();
|
||||||
if ((listCard.size() == 4 || (i == RoomCard.CARD_A && listCard.size() == 3))) {
|
|
||||||
|
|
||||||
} else {
|
cg.config = CardConfig.DAN;
|
||||||
|
cg.min_card = i;
|
||||||
|
cg.len = 1;
|
||||||
|
|
||||||
cg = new CardGroup();
|
cg.card_list = new ArrayList<>();
|
||||||
|
cg.card_list.add(listCard.get(0));
|
||||||
cg.config = CardConfig.DAN;
|
break;
|
||||||
cg.min_card = i;
|
|
||||||
cg.len = 1;
|
|
||||||
|
|
||||||
cg.card_list = new ArrayList<>();
|
|
||||||
cg.card_list.add(listCard.get(0));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -223,7 +207,7 @@ public class CardCheck {
|
||||||
List<CardObj> list = cardMap.get(i);
|
List<CardObj> list = cardMap.get(i);
|
||||||
|
|
||||||
// 如果牌值对应的牌为空 或者他是炸弹,则之前找到的牌取消
|
// 如果牌值对应的牌为空 或者他是炸弹,则之前找到的牌取消
|
||||||
if (list == null || ((list.size() == 4 || (i == RoomCard.CARD_A && list.size() == 3)))) {
|
if (list == null || (list.size() >= 4)) {
|
||||||
count = 0;
|
count = 0;
|
||||||
card_list.clear();
|
card_list.clear();
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -290,7 +274,7 @@ public class CardCheck {
|
||||||
List<CardObj> list = cardMap.get(i);
|
List<CardObj> list = cardMap.get(i);
|
||||||
|
|
||||||
// 如果牌值对应的牌为空 或者他是炸弹,则之前找到的牌取消
|
// 如果牌值对应的牌为空 或者他是炸弹,则之前找到的牌取消
|
||||||
if (list == null || ((list.size() == 4 || (i == RoomCard.CARD_A && list.size() == 3)))) {
|
if (list == null || (list.size() >= 4)) {
|
||||||
count = 0;
|
count = 0;
|
||||||
card_list.clear();
|
card_list.clear();
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -326,7 +310,7 @@ public class CardCheck {
|
||||||
for (Map.Entry<Integer, List<CardObj>> entry : reservedCardMap.entrySet()) {
|
for (Map.Entry<Integer, List<CardObj>> entry : reservedCardMap.entrySet()) {
|
||||||
|
|
||||||
int num = entry.getValue().size();
|
int num = entry.getValue().size();
|
||||||
if (num == 4 || (entry.getKey() == RoomCard.CARD_A && num == 3)) {
|
if (num >= 4) {
|
||||||
|
|
||||||
CardUtil.removeCard(tem_list, entry.getValue());
|
CardUtil.removeCard(tem_list, entry.getValue());
|
||||||
}
|
}
|
||||||
|
|
@ -412,20 +396,10 @@ public class CardCheck {
|
||||||
} else if (len == 4) {
|
} else if (len == 4) {
|
||||||
|
|
||||||
cg = checkFour(cardMap, roomConfig);
|
cg = checkFour(cardMap, roomConfig);
|
||||||
} else if (len == 5) {
|
} else if (len >= 5) {
|
||||||
|
cg = checkZha(cardMap, roomConfig, len);
|
||||||
// if (isConfig4_2_and_4_3(roomConfig) && getMaxCardNum(cardMap) == 4) {// 四带一
|
|
||||||
// return null;// 不能判为三带二
|
|
||||||
// }
|
|
||||||
|
|
||||||
cg = checkFive(cardMap, roomConfig, bSpecial);
|
|
||||||
} else {
|
} else {
|
||||||
if (bSpecial) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cg == null) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cg != null) {
|
if (cg != null) {
|
||||||
|
|
@ -466,7 +440,7 @@ public class CardCheck {
|
||||||
} else if (len == 4) {
|
} else if (len == 4) {
|
||||||
|
|
||||||
cg = checkFour(cardMap, roomConfig);
|
cg = checkFour(cardMap, roomConfig);
|
||||||
} else if (len == 5) {
|
} else if (len >= 5) {
|
||||||
|
|
||||||
// if (isConfig4_2_and_4_3(roomConfig) && getMaxCardNum(cardMap) == 4) {// 四带一
|
// if (isConfig4_2_and_4_3(roomConfig) && getMaxCardNum(cardMap) == 4) {// 四带一
|
||||||
// return null;// 不能判为三带二
|
// return null;// 不能判为三带二
|
||||||
|
|
@ -475,15 +449,9 @@ public class CardCheck {
|
||||||
if (cardInhand.size() == 5 && getMaxCardNum(cardMap) == 4) {
|
if (cardInhand.size() == 5 && getMaxCardNum(cardMap) == 4) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
cg = checkFive(cardMap, roomConfig, bSpecial);
|
cg = checkZha(cardMap, roomConfig, len);
|
||||||
} else {
|
} else {
|
||||||
if (bSpecial) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cg == null) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cg != null) {
|
if (cg != null) {
|
||||||
|
|
@ -565,22 +533,21 @@ public class CardCheck {
|
||||||
cg.card_list = new ArrayList<>();
|
cg.card_list = new ArrayList<>();
|
||||||
cg.config = CardConfig.ZHA;
|
cg.config = CardConfig.ZHA;
|
||||||
cg.min_card = entry.getKey();
|
cg.min_card = entry.getKey();
|
||||||
cg.len = 1;
|
cg.len = 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return cg;
|
return cg;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static CardGroup checkFive(Map<Integer, Integer> cardMap, ITObject roomConfig, boolean bSpecial) {
|
private static CardGroup checkZha(Map<Integer, Integer> cardMap, ITObject roomConfig, int len) {
|
||||||
CardGroup cg = null;
|
CardGroup cg = null;
|
||||||
for (Map.Entry<Integer, Integer> entry : cardMap.entrySet()) {
|
for (Map.Entry<Integer, Integer> entry : cardMap.entrySet()) {
|
||||||
if (entry.getValue() == 4) {
|
if (entry.getValue() >= 4) {
|
||||||
|
|
||||||
cg = new CardGroup();
|
cg = new CardGroup();
|
||||||
cg.card_list = new ArrayList<>();
|
cg.card_list = new ArrayList<>();
|
||||||
cg.config = CardConfig.ZHA;
|
cg.config = CardConfig.ZHA;
|
||||||
cg.min_card = entry.getKey();
|
cg.min_card = entry.getKey();
|
||||||
cg.len = 1;
|
cg.len = len;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -610,7 +577,7 @@ public class CardCheck {
|
||||||
cg.card_list = out_list;
|
cg.card_list = out_list;
|
||||||
cg.config = CardConfig.ZHA;
|
cg.config = CardConfig.ZHA;
|
||||||
cg.min_card = entry.getKey();
|
cg.min_card = entry.getKey();
|
||||||
cg.len = 1;
|
cg.len = 4;
|
||||||
|
|
||||||
for (CardObj cardObj : cardInhand) {
|
for (CardObj cardObj : cardInhand) {
|
||||||
|
|
||||||
|
|
@ -722,9 +689,11 @@ public class CardCheck {
|
||||||
int size = cardInhand.size();
|
int size = cardInhand.size();
|
||||||
CardConfig config = other.config;
|
CardConfig config = other.config;
|
||||||
Map<Integer, List<CardObj>> cardMap = null;
|
Map<Integer, List<CardObj>> cardMap = null;
|
||||||
|
Map<Integer, List<CardObj>> cardCountMap = null;
|
||||||
|
|
||||||
int len = other.len;
|
int len = other.len;
|
||||||
|
|
||||||
if (size >= len * config.repeat_num) {
|
if (len < 4) {
|
||||||
|
|
||||||
int min_card = other.min_card + 1;// 最小的数字是9 加一,下一位玩家需要出的牌时从10开始
|
int min_card = other.min_card + 1;// 最小的数字是9 加一,下一位玩家需要出的牌时从10开始
|
||||||
|
|
||||||
|
|
@ -734,7 +703,7 @@ public class CardCheck {
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
cardMap = CardUtil.getCardListMap(cardInhand);
|
cardMap = CardUtil.getCardListMap(cardInhand);
|
||||||
int max = len > 1 ? 14 : 15;
|
int max = 15;
|
||||||
for (int i = min_card; i <= max; ++i) {
|
for (int i = min_card; i <= max; ++i) {
|
||||||
|
|
||||||
List<CardObj> list = cardMap.get(i);
|
List<CardObj> list = cardMap.get(i);
|
||||||
|
|
@ -742,7 +711,7 @@ public class CardCheck {
|
||||||
if (cardMap.containsKey(i) && list.size() >= config.repeat_num) {
|
if (cardMap.containsKey(i) && list.size() >= config.repeat_num) {
|
||||||
|
|
||||||
// 不出炸牌
|
// 不出炸牌
|
||||||
if (other.config.type != Config.TYPE_ZHA && list.size() >= 4) {
|
if (other.config.type != Config.TYPE_ZHA) {
|
||||||
count = 0;
|
count = 0;
|
||||||
card_list.clear();
|
card_list.clear();
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -758,34 +727,7 @@ public class CardCheck {
|
||||||
ct.card_list = card_list;
|
ct.card_list = card_list;
|
||||||
ct.len = len;
|
ct.len = len;
|
||||||
ct.min_card = card_list.get(0).cardMod;
|
ct.min_card = card_list.get(0).cardMod;
|
||||||
if (config.with_card_num > 0) {
|
|
||||||
List<CardObj> tem_list = new ArrayList<CardObj>();
|
|
||||||
tem_list.addAll(cardInhand);
|
|
||||||
CardUtil.removeCard(tem_list, card_list);
|
|
||||||
|
|
||||||
// 不把炸牌带出去
|
|
||||||
int rcard_size = 0;
|
|
||||||
rcard: for (int k = 0; k < tem_list.size(); ++k) {
|
|
||||||
int card = tem_list.get(k).cardMod;
|
|
||||||
List<CardObj> tem_list1 = cardMap.get(card);
|
|
||||||
if (tem_list1.size() >= 4) {
|
|
||||||
CardUtil.removeCard(tem_list, tem_list1);
|
|
||||||
rcard_size += 4;
|
|
||||||
break rcard;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
int with_card_size = config.with_card_num * len;
|
|
||||||
if (rcard_size == 0) {
|
|
||||||
with_card_size = tem_list.size() < with_card_size ? tem_list.size()
|
|
||||||
: with_card_size;
|
|
||||||
}
|
|
||||||
if (tem_list.size() < with_card_size) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
for (int k = 0; k < with_card_size; ++k) {
|
|
||||||
card_list.add(tem_list.get(k));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ct;
|
return ct;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -808,7 +750,51 @@ public class CardCheck {
|
||||||
CardGroup ct = new CardGroup();
|
CardGroup ct = new CardGroup();
|
||||||
ct.config = CardConfig.ZHA;
|
ct.config = CardConfig.ZHA;
|
||||||
ct.card_list = list;
|
ct.card_list = list;
|
||||||
ct.len = 1;
|
ct.len = 4;
|
||||||
|
ct.min_card = card;
|
||||||
|
return ct;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 如果上家出的是炸弹
|
||||||
|
if (other.config.type == Config.TYPE_ZHA) {
|
||||||
|
if (cardMap == null) {
|
||||||
|
cardMap = CardUtil.getCardListMap(cardInhand);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Entry<Integer, List<CardObj>> entry : cardMap.entrySet()) {
|
||||||
|
int card = entry.getKey();
|
||||||
|
List<CardObj> list = entry.getValue();
|
||||||
|
// 与上家出的炸弹牌数一致,点数大
|
||||||
|
if (list.size() == len && card > other.config.min_card_num) {
|
||||||
|
CardGroup ct = new CardGroup();
|
||||||
|
ct.config = CardConfig.ZHA;
|
||||||
|
ct.card_list = list;
|
||||||
|
ct.len = len;
|
||||||
|
ct.min_card = card;
|
||||||
|
return ct;
|
||||||
|
}
|
||||||
|
// 比上家出的炸弹牌数多
|
||||||
|
if (list.size() >= len) {
|
||||||
|
CardGroup ct = new CardGroup();
|
||||||
|
ct.config = CardConfig.ZHA;
|
||||||
|
ct.card_list = list;
|
||||||
|
ct.len = list.size();
|
||||||
|
ct.min_card = card;
|
||||||
|
return ct;
|
||||||
|
}
|
||||||
|
|
||||||
|
int sameCount = CardUtil.getSameCardCountMap(cardInhand, card);
|
||||||
|
int otherCount = 0;
|
||||||
|
if (sameCount == 4) {
|
||||||
|
otherCount = 3;
|
||||||
|
}
|
||||||
|
// 4张同花额外增加3个
|
||||||
|
if ((list.size() + otherCount) >= len && card > other.config.min_card_num) {
|
||||||
|
CardGroup ct = new CardGroup();
|
||||||
|
ct.config = CardConfig.ZHA;
|
||||||
|
ct.card_list = list;
|
||||||
|
ct.len = list.size();
|
||||||
ct.min_card = card;
|
ct.min_card = card;
|
||||||
return ct;
|
return ct;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ public enum CardConfig {
|
||||||
DAN("单牌", Config.TYPE_DANPAI, 1, 1, 1, 1, 0),
|
DAN("单牌", Config.TYPE_DANPAI, 1, 1, 1, 1, 0),
|
||||||
DUIZI("对子", Config.TYPE_DUIZI, 1, 2, 2, 2, 0),
|
DUIZI("对子", Config.TYPE_DUIZI, 1, 2, 2, 2, 0),
|
||||||
SAN("三不带", Config.TYPE_3, 1, 3, 3, 3, 0),
|
SAN("三不带", Config.TYPE_3, 1, 3, 3, 3, 0),
|
||||||
ZHA("炸弹", Config.TYPE_ZHA, 1, 4, 4, 24, 0);
|
ZHA("炸弹", Config.TYPE_ZHA, 4, 4, 4, 24, 0);
|
||||||
|
|
||||||
public final int type;
|
public final int type;
|
||||||
public final String name;
|
public final String name;
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,15 @@
|
||||||
package extend.pk.uitl;
|
package extend.pk.uitl;
|
||||||
|
|
||||||
import com.game.Global;
|
|
||||||
import com.taurus.core.entity.ITArray;
|
|
||||||
import com.taurus.core.entity.TArray;
|
|
||||||
import extend.pk.CardObj;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.taurus.core.entity.ITArray;
|
||||||
|
import com.taurus.core.entity.TArray;
|
||||||
|
|
||||||
|
import extend.pk.CardObj;
|
||||||
|
|
||||||
public class CardUtil {
|
public class CardUtil {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -64,263 +64,6 @@ public class CardUtil {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final boolean checkGoodCard(int eventCard, List<CardObj> cardList, int num) {
|
|
||||||
int result = 0;
|
|
||||||
for (CardObj card : cardList) {
|
|
||||||
if (card.cardMod == eventCard) {
|
|
||||||
result++;
|
|
||||||
if (result >= num)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final boolean checkShunZi(int eventCard, List<CardObj> cardList) {
|
|
||||||
int result = 0;
|
|
||||||
if (checkGoodCard(eventCard + 1, cardList, 1)) {
|
|
||||||
result++;
|
|
||||||
if (checkGoodCard(eventCard + 2, cardList, 1)) {
|
|
||||||
result++;
|
|
||||||
if (checkGoodCard(eventCard + 3, cardList, 1)) {
|
|
||||||
result++;
|
|
||||||
if (checkGoodCard(eventCard + 4, cardList, 1)) {
|
|
||||||
result++;
|
|
||||||
if (checkGoodCard(eventCard + 5, cardList, 1)) {
|
|
||||||
result++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (checkGoodCard(eventCard - 1, cardList, 1)) {
|
|
||||||
result++;
|
|
||||||
if (checkGoodCard(eventCard - 2, cardList, 1)) {
|
|
||||||
result++;
|
|
||||||
if (checkGoodCard(eventCard - 3, cardList, 1)) {
|
|
||||||
result++;
|
|
||||||
if (checkGoodCard(eventCard - 4, cardList, 1)) {
|
|
||||||
result++;
|
|
||||||
if (checkGoodCard(eventCard - 5, cardList, 1)) {
|
|
||||||
result++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result >= 5) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final boolean checkSevenShunzi(int eventCard, List<CardObj> cardList) {
|
|
||||||
int result = 0;
|
|
||||||
if (checkGoodCard(eventCard + 1, cardList, 1)) {
|
|
||||||
result++;
|
|
||||||
if (checkGoodCard(eventCard + 2, cardList, 1)) {
|
|
||||||
result++;
|
|
||||||
if (checkGoodCard(eventCard + 3, cardList, 1)) {
|
|
||||||
result++;
|
|
||||||
if (checkGoodCard(eventCard + 4, cardList, 1)) {
|
|
||||||
result++;
|
|
||||||
if (checkGoodCard(eventCard + 5, cardList, 1)) {
|
|
||||||
result++;
|
|
||||||
if (checkGoodCard(eventCard + 6, cardList, 1)) {
|
|
||||||
result++;
|
|
||||||
if (checkGoodCard(eventCard + 7, cardList, 1)) {
|
|
||||||
result++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (checkGoodCard(eventCard - 1, cardList, 1)) {
|
|
||||||
result++;
|
|
||||||
if (checkGoodCard(eventCard - 2, cardList, 1)) {
|
|
||||||
result++;
|
|
||||||
if (checkGoodCard(eventCard - 3, cardList, 1)) {
|
|
||||||
result++;
|
|
||||||
if (checkGoodCard(eventCard - 4, cardList, 1)) {
|
|
||||||
result++;
|
|
||||||
if (checkGoodCard(eventCard - 5, cardList, 1)) {
|
|
||||||
result++;
|
|
||||||
if (checkGoodCard(eventCard - 6, cardList, 1)) {
|
|
||||||
result++;
|
|
||||||
if (checkGoodCard(eventCard - 7, cardList, 1)) {
|
|
||||||
result++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result >= 6) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final boolean checkSanTiao(int eventCard, List<CardObj> cardList) {
|
|
||||||
int result = 0;
|
|
||||||
if (checkGoodCard(eventCard, cardList, 2)) {
|
|
||||||
|
|
||||||
if (checkGoodCard(eventCard, cardList, 3)) {
|
|
||||||
result++;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result >= 2) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final boolean checkFenJi(int eventCard, List<CardObj> cardList) {
|
|
||||||
int result = 0;
|
|
||||||
if (checkGoodCard(eventCard, cardList, 2)) {
|
|
||||||
result++;
|
|
||||||
if (checkGoodCard(eventCard + 1, cardList, 3)) {
|
|
||||||
result++;
|
|
||||||
}
|
|
||||||
if (checkGoodCard(eventCard - 1, cardList, 3)) {
|
|
||||||
result++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result >= 2) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final boolean checkFourDui(int eventCard, List<CardObj> cardList) {
|
|
||||||
int result = 0;
|
|
||||||
if (checkGoodCard(eventCard, cardList, 1)) {
|
|
||||||
result++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (checkGoodCard(eventCard + 1, cardList, 2)) {
|
|
||||||
result++;
|
|
||||||
if (checkGoodCard(eventCard + 2, cardList, 2)) {
|
|
||||||
result++;
|
|
||||||
if (checkGoodCard(eventCard + 3, cardList, 2)) {
|
|
||||||
result++;
|
|
||||||
if (checkGoodCard(eventCard + 4, cardList, 2)) {
|
|
||||||
result++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (checkGoodCard(eventCard - 1, cardList, 2)) {
|
|
||||||
result++;
|
|
||||||
if (checkGoodCard(eventCard - 2, cardList, 2)) {
|
|
||||||
result++;
|
|
||||||
if (checkGoodCard(eventCard - 3, cardList, 2)) {
|
|
||||||
result++;
|
|
||||||
if (checkGoodCard(eventCard - 4, cardList, 2)) {
|
|
||||||
result++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result >= 4) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final boolean checkSixDui(int eventCard, List<CardObj> cardList) {
|
|
||||||
int result = 0;
|
|
||||||
if (checkGoodCard(eventCard, cardList, 1)) {
|
|
||||||
result++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (checkGoodCard(eventCard + 1, cardList, 2)) {
|
|
||||||
result++;
|
|
||||||
if (checkGoodCard(eventCard + 2, cardList, 2)) {
|
|
||||||
result++;
|
|
||||||
if (checkGoodCard(eventCard + 3, cardList, 2)) {
|
|
||||||
result++;
|
|
||||||
if (checkGoodCard(eventCard + 4, cardList, 2)) {
|
|
||||||
result++;
|
|
||||||
if (checkGoodCard(eventCard + 5, cardList, 2)) {
|
|
||||||
result++;
|
|
||||||
if (checkGoodCard(eventCard + 6, cardList, 2)) {
|
|
||||||
result++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (checkGoodCard(eventCard - 1, cardList, 2)) {
|
|
||||||
result++;
|
|
||||||
if (checkGoodCard(eventCard - 2, cardList, 2)) {
|
|
||||||
result++;
|
|
||||||
if (checkGoodCard(eventCard - 3, cardList, 2)) {
|
|
||||||
result++;
|
|
||||||
if (checkGoodCard(eventCard - 4, cardList, 2)) {
|
|
||||||
result++;
|
|
||||||
if (checkGoodCard(eventCard - 5, cardList, 2)) {
|
|
||||||
result++;
|
|
||||||
if (checkGoodCard(eventCard - 6, cardList, 2)) {
|
|
||||||
result++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result >= 6) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final boolean checkQPai(int eventCard, List<CardObj> cardList) {
|
|
||||||
int result = 0;
|
|
||||||
if (eventCard >= 12) {
|
|
||||||
result++;
|
|
||||||
for (CardObj card : cardList) {
|
|
||||||
if (card.cardMod >= 12) {
|
|
||||||
result++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result >= 5) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final boolean checkKPai(int eventCard, List<CardObj> cardList) {
|
|
||||||
int result = 0;
|
|
||||||
if (eventCard >= 14) {
|
|
||||||
result++;
|
|
||||||
for (CardObj card : cardList) {
|
|
||||||
if (card.cardMod >= 14) {
|
|
||||||
|
|
||||||
result++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result >= 1) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TArray to list
|
* TArray to list
|
||||||
*
|
*
|
||||||
|
|
@ -406,6 +149,22 @@ public class CardUtil {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取牌的同一花色的数量MAP
|
||||||
|
*
|
||||||
|
* @param cardList
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static final int getSameCardCountMap(List<CardObj> cardList, int dealCard) {
|
||||||
|
int sameCard = 0;
|
||||||
|
for (CardObj card : cardList) {
|
||||||
|
if (card.card == dealCard) {
|
||||||
|
sameCard++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sameCard;
|
||||||
|
}
|
||||||
|
|
||||||
static public void removeCard(List<CardObj> cardList, List<CardObj> cards) {
|
static public void removeCard(List<CardObj> cardList, List<CardObj> cards) {
|
||||||
for (int i = 0; i < cards.size(); i++) {
|
for (int i = 0; i < cards.size(); i++) {
|
||||||
for (int j = 0; j < cardList.size(); j++) {
|
for (int j = 0; j < cardList.size(); j++) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue