master
parent
82e32f285d
commit
90cc9fe340
|
|
@ -9,15 +9,14 @@ import com.game.Global;
|
|||
import java.util.Random;
|
||||
import extend.mj.uitl.WinCard;
|
||||
|
||||
|
||||
public class RoomCard {
|
||||
public List<Integer> cardList;
|
||||
EXRoom room;
|
||||
public ArrayList<Integer> subCardList;
|
||||
public List<Integer> cardList;
|
||||
EXRoom room;
|
||||
public ArrayList<Integer> subCardList;
|
||||
|
||||
public RoomCard(EXRoom table) {
|
||||
this.cardList = new ArrayList<Integer>();
|
||||
subCardList = new ArrayList<>();
|
||||
subCardList = new ArrayList<>();
|
||||
this.room = table;
|
||||
}
|
||||
|
||||
|
|
@ -28,27 +27,32 @@ public class RoomCard {
|
|||
this.shuffle();
|
||||
}
|
||||
|
||||
|
||||
private void initCard() {
|
||||
boolean queyimen = false;
|
||||
if (room.config.getBoolean(Config.ROOM_CONFIG_QUEYIMEN) != null) {
|
||||
queyimen = room.config.getBoolean(Config.ROOM_CONFIG_QUEYIMEN);
|
||||
}
|
||||
|
||||
for (int index = 1; index <= 9; index++) {
|
||||
for (int index2 = 0; index2 < 4; index2++) {
|
||||
this.cardList.add(100 + index);
|
||||
this.cardList.add(200 + index);
|
||||
this.cardList.add(300 + index);
|
||||
if (!queyimen) {
|
||||
this.cardList.add(300 + index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
boolean laizi = room.config.getBoolean(Config.ROOM_CONFIG_HONGZHONG);
|
||||
boolean laizi8 = room.config.getBoolean(Config.ROOM_CONFIG_HONGZHONG8);
|
||||
if(laizi) {
|
||||
int laiziNum = laizi8 ? 8 :4;
|
||||
if (laizi) {
|
||||
int laiziNum = laizi8 ? 8 : 4;
|
||||
WinCard.zhongWinNum = laiziNum;
|
||||
for(int i =0;i<laiziNum;++i) {
|
||||
for (int i = 0; i < laiziNum; ++i) {
|
||||
this.cardList.add(Config.HONGZHONG);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// this.cardList.add(102);
|
||||
// this.cardList.add(102);
|
||||
// this.cardList.add(102);
|
||||
|
|
@ -67,19 +71,18 @@ public class RoomCard {
|
|||
}
|
||||
|
||||
private void shuffle() {
|
||||
for(int i = 0; i < 100; i++)
|
||||
{
|
||||
for (int i = 0; i < 100; i++) {
|
||||
Math.random();
|
||||
Collections.shuffle(this.cardList);
|
||||
}
|
||||
}
|
||||
|
||||
public void reInitCards(List<Integer> cards) {
|
||||
//从底牌移除
|
||||
for(Integer card : cards) {
|
||||
for(int i = cardList.size() - 1;i >= 0;i--) {
|
||||
if(cardList.get(i).intValue() == card.intValue()) {
|
||||
if(cardList.remove(i) > 0) {
|
||||
// 从底牌移除
|
||||
for (Integer card : cards) {
|
||||
for (int i = cardList.size() - 1; i >= 0; i--) {
|
||||
if (cardList.get(i).intValue() == card.intValue()) {
|
||||
if (cardList.remove(i) > 0) {
|
||||
this.subCardList.add(card);
|
||||
}
|
||||
break;
|
||||
|
|
@ -102,15 +105,15 @@ public class RoomCard {
|
|||
// }
|
||||
|
||||
public int pop() {
|
||||
Global.logger.info("pop cardlist size=>"+this.cardList.size()+":sub size==>"+subCardList.size());
|
||||
Global.logger.info("pop cardlist size=>" + this.cardList.size() + ":sub size==>" + subCardList.size());
|
||||
int card = 0;
|
||||
if (this.cardList.size() == 0) {
|
||||
if(this.subCardList.size() > 0) {
|
||||
if (this.subCardList.size() > 0) {
|
||||
card = this.subCardList.remove(0);
|
||||
}else {
|
||||
} else {
|
||||
this.room.bankerSeat = this.room.activeSeat;
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
card = this.cardList.remove(0);
|
||||
}
|
||||
return card;
|
||||
|
|
@ -118,15 +121,15 @@ public class RoomCard {
|
|||
}
|
||||
|
||||
public int popsub() {
|
||||
Global.logger.info("pop sub cardlist size=>"+this.cardList.size()+":sub size==>"+subCardList.size());
|
||||
Global.logger.info("pop sub cardlist size=>" + this.cardList.size() + ":sub size==>" + subCardList.size());
|
||||
int card = 0;
|
||||
if (this.subCardList.size() == 0) {
|
||||
if (this.cardList.size() == 0) {
|
||||
this.room.bankerSeat = this.room.activeSeat;
|
||||
}else {
|
||||
} else {
|
||||
card = this.cardList.remove(0);
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
card = this.subCardList.remove(0);
|
||||
}
|
||||
return card;
|
||||
|
|
@ -141,16 +144,15 @@ public class RoomCard {
|
|||
public List<Integer> deal(boolean isw) {
|
||||
List<Integer> dealCards = new ArrayList<Integer>();
|
||||
|
||||
|
||||
if (isw){
|
||||
if (isw) {
|
||||
|
||||
boolean laizi8 = room.config.getBoolean(Config.ROOM_CONFIG_HONGZHONG8);
|
||||
Random randomno = new Random();
|
||||
//boolean value = randomno.nextBoolean();
|
||||
if (laizi8){
|
||||
for (int ia = 0; ia<3;ia++){
|
||||
// boolean value = randomno.nextBoolean();
|
||||
if (laizi8) {
|
||||
for (int ia = 0; ia < 3; ia++) {
|
||||
int indexhh = this.cardList.indexOf(Config.HONGZHONG);
|
||||
//Global.logger.info("hongzhongid:"+indexhh+"card"+this.cardList);
|
||||
// Global.logger.info("hongzhongid:"+indexhh+"card"+this.cardList);
|
||||
dealCards.add(Config.HONGZHONG);
|
||||
this.cardList.remove(indexhh);
|
||||
Collections.shuffle(this.cardList);
|
||||
|
|
@ -159,31 +161,29 @@ public class RoomCard {
|
|||
for (int index = 0; index < 10; index++) {
|
||||
dealCards.add(this.pop());
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
int flag = 1;
|
||||
//if (value){
|
||||
// flag = 2;
|
||||
//}
|
||||
for (int ia = 0; ia<flag;ia++){
|
||||
// if (value){
|
||||
// flag = 2;
|
||||
// }
|
||||
for (int ia = 0; ia < flag; ia++) {
|
||||
int indexhh = this.cardList.indexOf(Config.HONGZHONG);
|
||||
//Global.logger.info("hongzhongid:"+indexhh+"card"+this.cardList);
|
||||
// Global.logger.info("hongzhongid:"+indexhh+"card"+this.cardList);
|
||||
dealCards.add(Config.HONGZHONG);
|
||||
this.cardList.remove(indexhh);
|
||||
Collections.shuffle(this.cardList);
|
||||
}
|
||||
for (int index = 0; index < 13-flag; index++) {
|
||||
for (int index = 0; index < 13 - flag; index++) {
|
||||
dealCards.add(this.pop());
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
} else {
|
||||
for (int index = 0; index < 13; index++) {
|
||||
dealCards.add(this.pop());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// dealCards.add(101);
|
||||
// dealCards.add(101);
|
||||
// dealCards.add(101);
|
||||
|
|
|
|||
Loading…
Reference in New Issue