private void drawXNumberOfCards(int numOfCardsToDraw, Player player = null) { if (player == null) { for (int i = 0; i < activeQuest.getPlayerNum(); i++) { //log.log("Drawing " + numOfCardsToDraw + " cards for " + activeQuest.getPlayer(i).getName()); if (activeQuest.getPlayer(i).getHand().Length + numOfCardsToDraw > 12) { userInputState = state.ASKINGFORCARDSTODISCARD; askForCardLimitReached(activeQuest.getPlayer(i), (activeQuest.getPlayer(i).getHand().Length + numOfCardsToDraw) - 12); activePlayerOther = i; return; } } for (int i = 0; i < activeQuest.getPlayerNum(); i++) { for (int j = 0; j < numOfCardsToDraw; j++) { activeQuest.getPlayer(i).addCard(new Card[] { advDeck.drawCard() }); } } } else { log.log("Drawing " + numOfCardsToDraw + " cards for " + player.getName()); if (player.getHand().Length + numOfCardsToDraw > 12) { log.log(player.getName() + "'s hand exceeds the 12 card limit. Asking to discard."); userInputState = state.ASKINGFORCARDSTODISCARD; askForCardLimitReached(player, (player.getHand().Length + numOfCardsToDraw) - 12); activePlayerOther = activeQuest.getPlayerInt(player); return; } for (int j = 0; j < numOfCardsToDraw; j++) { Card newCard = advDeck.drawCard(); log.log("Giving " + player.getName() + " a " + newCard.getName() + " card"); player.addCard(new Card[] { newCard }); } } }
public Card[][] dealRiggedHand(int test, Player[] players, AdvDeck advDeck) { Card[][] result; if (test == 0 || test == 6 || test == 7 || test == 9) { result = new Card[3][]; for (int i = 0; i < 3; i++) { Card[] newHand = new Card[12]; for (int j = 0; j < newHand.Length; j++) { newHand[j] = advDeck.drawCard(); //log.log("Gave " + players[i].getName() + " a " + newHand[j].getName() + " card"); } result[i] = newHand; } } else if (test == 1 || test == 2 || test == 3) { result = new Card[4][]; Card[] player1NewHand = new Card[12]; player1NewHand[0] = advDeck.getCard("saxons"); player1NewHand[1] = advDeck.getCard("boar"); player1NewHand[2] = advDeck.getCard("sword"); player1NewHand[3] = advDeck.getCard("toquestingbeast"); for (int i = 4; i < player1NewHand.Length; i++) { player1NewHand[i] = advDeck.drawCard(); } Card[] player2NewHand = new Card[12]; for (int i = 0; i < player2NewHand.Length; i++) { player2NewHand[i] = advDeck.drawCard(); } Card[] player3NewHand = new Card[12]; player3NewHand[0] = advDeck.getCard("horse"); player3NewHand[1] = advDeck.getCard("excalibur"); for (int i = 2; i < player3NewHand.Length; i++) { player3NewHand[i] = advDeck.drawCard(); } Card[] player4NewHand = new Card[12]; player4NewHand[0] = advDeck.getCard("battleax"); player4NewHand[1] = advDeck.getCard("lance"); for (int i = 2; i < player4NewHand.Length; i++) { player4NewHand[i] = advDeck.drawCard(); } result[0] = player1NewHand; result[1] = player2NewHand; result[2] = player3NewHand; result[3] = player4NewHand; } else if (test == 4) { result = new Card[3][]; Card[] player1NewHand = new Card[12]; player1NewHand[0] = advDeck.getCard("saxons"); player1NewHand[1] = advDeck.getCard("tovalor"); for (int i = 2; i < player1NewHand.Length; i++) { player1NewHand[i] = advDeck.drawCard(); } Card[] player2NewHand = new Card[12]; player2NewHand[0] = advDeck.getCard("amour"); player2NewHand[1] = advDeck.getCard("amour"); for (int i = 2; i < player2NewHand.Length; i++) { player2NewHand[i] = advDeck.drawCard(); } Card[] player3NewHand = new Card[12]; player3NewHand[0] = advDeck.getCard("mordred"); for (int i = 1; i < player3NewHand.Length; i++) { player3NewHand[i] = advDeck.drawCard(); } result[0] = player1NewHand; result[1] = player2NewHand; result[2] = player3NewHand; } else if (test == 5) { result = new Card[3][]; Card[] player1NewHand = new Card[12]; player1NewHand[0] = advDeck.getCard("gawain"); player1NewHand[1] = advDeck.getCard("percival"); for (int i = 2; i < player1NewHand.Length; i++) { player1NewHand[i] = advDeck.drawCard(); } Card[] player2NewHand = new Card[12]; player2NewHand[0] = advDeck.getCard("thieves"); player2NewHand[1] = advDeck.getCard("thieves"); player2NewHand[2] = advDeck.getCard("thieves"); player2NewHand[3] = advDeck.getCard("saxons"); player2NewHand[4] = advDeck.getCard("saxons"); player2NewHand[5] = advDeck.getCard("saxons"); player2NewHand[6] = advDeck.getCard("robberknight"); player2NewHand[7] = advDeck.getCard("robberknight"); player2NewHand[8] = advDeck.getCard("mordred"); for (int i = 9; i < player2NewHand.Length; i++) { player2NewHand[i] = advDeck.drawCard(); } Card[] player3NewHand = new Card[12]; player3NewHand[0] = advDeck.getCard("mordred"); for (int i = 1; i < player3NewHand.Length; i++) { player3NewHand[i] = advDeck.drawCard(); } result[0] = player1NewHand; result[1] = player2NewHand; result[2] = player3NewHand; } else if (test == 7) { result = new Card[3][]; for (int i = 0; i < 3; i++) { Card[] newHand = new Card[12]; for (int j = 0; j < newHand.Length; j++) { newHand[j] = advDeck.drawCard(); //log.log("Gave " + players[i].getName() + " a " + newHand[j].getName() + " card"); } result[i] = newHand; } Card[] player2NewHand = new Card[12]; player2NewHand[0] = advDeck.getCard("thieves"); player2NewHand[1] = advDeck.getCard("thieves"); player2NewHand[2] = advDeck.getCard("thieves"); player2NewHand[3] = advDeck.getCard("saxons"); player2NewHand[4] = advDeck.getCard("saxons"); player2NewHand[5] = advDeck.getCard("saxons"); player2NewHand[6] = advDeck.getCard("robberknight"); player2NewHand[7] = advDeck.getCard("robberknight"); player2NewHand[8] = advDeck.getCard("tovalor"); for (int i = 9; i < player2NewHand.Length; i++) { player2NewHand[i] = advDeck.drawCard(); } result[1] = player2NewHand; } else if (test == 8) { result = new Card[3][]; for (int i = 0; i < 3; i++) { Card[] newHand = new Card[12]; for (int j = 0; j < newHand.Length; j++) { newHand[j] = advDeck.drawCard(); //log.log("Gave " + players[i].getName() + " a " + newHand[j].getName() + " card"); } result[i] = newHand; } Card[] player1NewHand = new Card[12]; player1NewHand[0] = advDeck.getCard("thieves"); player1NewHand[1] = advDeck.getCard("saxons"); player1NewHand[2] = advDeck.getCard("boar"); player1NewHand[3] = advDeck.getCard("toquestingbeast"); for (int i = 4; i < player1NewHand.Length; i++) { player1NewHand[i] = advDeck.drawCard(); } Card[] player2NewHand = new Card[12]; player2NewHand[0] = advDeck.getCard("thieves"); player2NewHand[1] = advDeck.getCard("saxons"); player2NewHand[2] = advDeck.getCard("horse"); player2NewHand[3] = advDeck.getCard("horse"); player2NewHand[4] = advDeck.getCard("lance"); player2NewHand[5] = advDeck.getCard("excalibur"); for (int i = 4; i < player2NewHand.Length; i++) { player2NewHand[i] = advDeck.drawCard(); } result[0] = player1NewHand; result[1] = player2NewHand; } else if (test == 9) { result = new Card[3][]; for (int i = 0; i < 3; i++) { Card[] newHand = new Card[12]; for (int j = 0; j < newHand.Length; j++) { newHand[j] = advDeck.drawCard(); //log.log("Gave " + players[i].getName() + " a " + newHand[j].getName() + " card"); } result[i] = newHand; } Card[] player1NewHand = new Card[12]; player1NewHand[0] = advDeck.getCard("thieves"); player1NewHand[1] = advDeck.getCard("saxons"); player1NewHand[2] = advDeck.getCard("boar"); player1NewHand[3] = advDeck.getCard("greenknight"); for (int i = 4; i < player1NewHand.Length; i++) { player1NewHand[i] = advDeck.drawCard(); } Card[] player2NewHand = new Card[12]; player2NewHand[0] = advDeck.getCard("thieves"); player2NewHand[1] = advDeck.getCard("saxons"); player2NewHand[2] = advDeck.getCard("horse"); player2NewHand[3] = advDeck.getCard("horse"); player2NewHand[4] = advDeck.getCard("lance"); player2NewHand[5] = advDeck.getCard("excalibur"); for (int i = 6; i < player2NewHand.Length; i++) { player2NewHand[i] = advDeck.drawCard(); } result[0] = player1NewHand; result[1] = player2NewHand; } else if (test == 10) { result = new Card[3][]; for (int i = 0; i < 3; i++) { Card[] newHand = new Card[12]; for (int j = 0; j < newHand.Length; j++) { newHand[j] = advDeck.drawCard(); //log.log("Gave " + players[i].getName() + " a " + newHand[j].getName() + " card"); } result[i] = newHand; } Card[] player1NewHand = new Card[12]; player1NewHand[0] = advDeck.getCard("thieves"); player1NewHand[1] = advDeck.getCard("saxons"); player1NewHand[2] = advDeck.getCard("boar"); player1NewHand[3] = advDeck.getCard("greenknight"); for (int i = 4; i < player1NewHand.Length; i++) { player1NewHand[i] = advDeck.drawCard(); } Card[] player2NewHand = new Card[12]; player2NewHand[0] = advDeck.getCard("thieves"); player2NewHand[1] = advDeck.getCard("saxons"); player2NewHand[2] = advDeck.getCard("horse"); player2NewHand[3] = advDeck.getCard("horse"); player2NewHand[4] = advDeck.getCard("lance"); player2NewHand[5] = advDeck.getCard("excalibur"); for (int i = 6; i < player2NewHand.Length; i++) { player2NewHand[i] = advDeck.drawCard(); } result[0] = player1NewHand; result[1] = player2NewHand; } else if (test == 11) { result = new Card[3][]; for (int i = 0; i < 3; i++) { Card[] newHand = new Card[12]; for (int j = 0; j < newHand.Length; j++) { newHand[j] = advDeck.drawCard(); //log.log("Gave " + players[i].getName() + " a " + newHand[j].getName() + " card"); } result[i] = newHand; } Card[] player1NewHand = new Card[12]; player1NewHand[0] = advDeck.getCard("thieves"); player1NewHand[1] = advDeck.getCard("saxons"); player1NewHand[2] = advDeck.getCard("toquestingbeast"); player1NewHand[3] = advDeck.getCard("greenknight"); for (int i = 4; i < player1NewHand.Length; i++) { player1NewHand[i] = advDeck.drawCard(); } Card[] player2NewHand = new Card[12]; player2NewHand[0] = advDeck.getCard("thieves"); player2NewHand[1] = advDeck.getCard("saxons"); player2NewHand[2] = advDeck.getCard("horse"); player2NewHand[3] = advDeck.getCard("horse"); player2NewHand[4] = advDeck.getCard("lance"); player2NewHand[5] = advDeck.getCard("excalibur"); for (int i = 6; i < player2NewHand.Length; i++) { player2NewHand[i] = advDeck.drawCard(); } result[0] = player1NewHand; result[1] = player2NewHand; } else if (test == 13 || test == 14 || test == 15 || test == 16 || test == 17 || test == 18) { result = new Card[3][]; for (int i = 0; i < 3; i++) { Card[] newHand = new Card[12]; for (int j = 0; j < newHand.Length; j++) { newHand[j] = advDeck.drawCard(); //log.log("Gave " + players[i].getName() + " a " + newHand[j].getName() + " card"); } result[i] = newHand; } return(result); } else { result = new Card[3][]; for (int i = 0; i < 3; i++) { Card[] newHand = new Card[12]; for (int j = 0; j < newHand.Length; j++) { newHand[j] = advDeck.drawCard(); //log.log("Gave " + players[i].getName() + " a " + newHand[j].getName() + " card"); } result[i] = newHand; } } return(result); }