Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions src/tel/discord/rtab/GameController.java
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public GameController(TextChannel gameChannel, String[] record, TextChannel resu
try
{
List<String> list = Files.readAllLines(Paths.get("scores","scores"+channel.getId()+".csv"));
if(Integer.parseInt(list.get(0).split("#")[2]) >= 1_000_000_000)
if(Integer.parseInt(list.getFirst().split("#")[2]) >= 1_000_000_000)
gameStatus = GameStatus.SEASON_OVER;
else
channel.sendMessage("Ready to play!").queue();
Expand Down Expand Up @@ -551,7 +551,7 @@ private void addBotQuestion()
{
//Didn't get players? How about a bot?
if(players.size() == 1)
channel.sendMessage(players.get(0).getSafeMention()+", would you like to play against a bot? (Y/N)").queue();
channel.sendMessage(players.getFirst().getSafeMention()+", would you like to play against a bot? (Y/N)").queue();
else
channel.sendMessage("Would you like to play against a bot? (Y/N)").queue();
gameStatus = GameStatus.ADD_BOT_QUESTION;
Expand Down Expand Up @@ -1358,9 +1358,9 @@ private void timeOutTurn(int player)
//Find a bomb to destroy them with
int bombChosen;
//If their own bomb is still out there, let's just use that one
if(!pickedSpaces[players.get(player).myBombs.get(0)])
if(!pickedSpaces[players.get(player).myBombs.getFirst()])
{
bombChosen = players.get(player).myBombs.get(0);
bombChosen = players.get(player).myBombs.getFirst();
}
//Otherwise look for someone else's bomb
else
Expand Down Expand Up @@ -1971,7 +1971,7 @@ void gameOver()
{
try { Thread.sleep(1000); } catch (InterruptedException e) { Thread.currentThread().interrupt(); }
//If environmental credit, add to wager pool
if(next.bountyCredit.get(0) == -1)
if(next.bountyCredit.getFirst() == -1)
{
channel.sendMessage(String.format("**%s** defeated by no one in particular - **$%,d bounty** added to wager pool."
,next.getName(),next.bounty)).queue();
Expand Down Expand Up @@ -2177,22 +2177,22 @@ public void runFinalEndGameTasks()
currentTurn = 0;
for(int i=0; i<3; i++)
{
channel.sendMessage("**" + players.get(0).getName().toUpperCase() + " WINS RACE TO A BILLION!**")
channel.sendMessage("**" + players.getFirst().getName().toUpperCase() + " WINS RACE TO A BILLION!**")
.queueAfter(5+(5*i),TimeUnit.SECONDS);
}
if(runDemo != 0)
demoMode.cancel(false); //Season's over no demo needed
if(rankChannel)
channel.sendMessage("@everyone").queueAfter(20,TimeUnit.SECONDS);
gameStatus = GameStatus.SEASON_OVER;
if(!players.get(0).isBot && rankChannel)
if(!players.getFirst().isBot && rankChannel)
{
timer.schedule(() ->
{
channel.sendMessage(players.get(0).getSafeMention() + "...").complete();
channel.sendMessage(players.getFirst().getSafeMention() + "...").complete();
channel.sendMessage("It is time to enter the Super Bonus Round.").completeAfter(5,TimeUnit.SECONDS);
channel.sendMessage("...").completeAfter(10,TimeUnit.SECONDS);
TestMinigameCommand.runGame(players.get(0).user,Game.SUPERBONUSROUND,channel, false, false);
TestMinigameCommand.runGame(players.getFirst().user,Game.SUPERBONUSROUND,channel, false, false);
}, 90, TimeUnit.SECONDS);
}
}
Expand Down Expand Up @@ -2273,7 +2273,7 @@ private void saveData()
Game chosenGame;
do
{
chosenGame = Board.generateSpaces(1,players.size(),Game.values()).get(0);
chosenGame = Board.generateSpaces(1,players.size(),Game.values()).getFirst();
}
while(players.get(i).enhancedGames.contains(chosenGame)); //Reroll until we find one they haven't already done
players.get(i).enhancedGames.add(chosenGame);
Expand Down Expand Up @@ -2506,8 +2506,8 @@ public void displayBoardAndStatus(boolean printBoard, boolean totals, boolean co
//Next the status line
//Start by getting the lengths so we can pad the status bars appropriately
//Add one extra to name length because we want one extra space between name and cash
int nameLength = players.get(0).getName()
.codePointCount(0,players.get(0).getName().length());
int nameLength = players.getFirst().getName()
.codePointCount(0,players.getFirst().getName().length());
for(int i=1; i<players.size(); i++)
nameLength = Math.max(nameLength,players.get(i).getName()
.codePointCount(0,players.get(i).getName().length()));
Expand All @@ -2516,13 +2516,13 @@ public void displayBoardAndStatus(boolean printBoard, boolean totals, boolean co
int moneyLength;
if(totals)
{
moneyLength = String.valueOf(Math.abs(players.get(0).money)).length();
moneyLength = String.valueOf(Math.abs(players.getFirst().money)).length();
for(int i=1; i<players.size(); i++)
moneyLength = Math.max(moneyLength, String.valueOf(Math.abs(players.get(i).money)).length());
}
else
{
moneyLength = String.valueOf(Math.abs(players.get(0).getRoundDelta())).length();
moneyLength = String.valueOf(Math.abs(players.getFirst().getRoundDelta())).length();
for(int i=1; i<players.size(); i++)
{
//If someone's on $1b then they get that displayed directly, otherwise get the largest round delta
Expand Down Expand Up @@ -2731,10 +2731,10 @@ public void useBonusBag(int player, SpaceType desire)
channel.sendMessage("It's a **BOMB**.").queue();
awardBomb(player, BombType.NORMAL); //Never roll the bomb, so potential use in avoiding bankrupt
}
case CASH -> awardCash(player, Board.generateSpaces(1, players.size(), Cash.values()).get(0));
case BOOSTER -> awardBoost(player, Board.generateSpaces(1, players.size(), Boost.values()).get(0));
case CASH -> awardCash(player, Board.generateSpaces(1, players.size(), Cash.values()).getFirst());
case BOOSTER -> awardBoost(player, Board.generateSpaces(1, players.size(), Boost.values()).getFirst());
case GAME -> awardGame(player, players.get(player).generateEventMinigame());
case EVENT -> awardEvent(player, Board.generateSpaces(1, players.size(), EventType.values()).get(0));
case EVENT -> awardEvent(player, Board.generateSpaces(1, players.size(), EventType.values()).getFirst());
default -> channel.sendMessage("Nothing. Did you do something weird?").queue();
}
if(bagger.hiddenCommand == HiddenCommand.BONUS)
Expand Down
2 changes: 1 addition & 1 deletion src/tel/discord/rtab/SuperBotChallenge.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void loadGames()
playerList.clear();
gameList.clear();
//Parse the player list
String[] lineOne = list.get(0).split(" ");
String[] lineOne = list.getFirst().split(" ");
for(String next : lineOne)
playerList.add(Integer.parseInt(next));
gameHandler.baseNumerator = getMultiplier(playerList.size())*baseNumerator;
Expand Down
16 changes: 8 additions & 8 deletions src/tel/discord/rtab/board/Board.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,22 +61,22 @@ public void generateBoard(int size, int players)

public void rerollSpace(int space, int players)
{
typeBoard.set(space, generateSpaces(1, players, SpaceType.values()).get(0));
cashBoard.set(space, generateSpaces(1, players, Cash.values()).get(0));
boostBoard.set(space, generateSpaces(1, players, Boost.values()).get(0));
bombBoard.set(space, generateSpaces(1, players, BombType.values()).get(0));
gameBoard.set(space, generateSpaces(1, players, Game.values()).get(0));
eventBoard.set(space, generateSpaces(1, players, EventType.values()).get(0));
typeBoard.set(space, generateSpaces(1, players, SpaceType.values()).getFirst());
cashBoard.set(space, generateSpaces(1, players, Cash.values()).getFirst());
boostBoard.set(space, generateSpaces(1, players, Boost.values()).getFirst());
bombBoard.set(space, generateSpaces(1, players, BombType.values()).getFirst());
gameBoard.set(space, generateSpaces(1, players, Game.values()).getFirst());
eventBoard.set(space, generateSpaces(1, players, EventType.values()).getFirst());
}

public static <T extends WeightedSpace> T generateSpace(T[] values)
{
return generateSpaces(1, 4, values).get(0);
return generateSpaces(1, 4, values).getFirst();
}

public static <T extends WeightedSpace> T generateSpace(int players, T[] values)
{
return generateSpaces(1, players, values).get(0);
return generateSpaces(1, players, values).getFirst();
}

public static <T extends WeightedSpace> List<T> generateSpaces(int spaces, int players, T[] values)
Expand Down
2 changes: 1 addition & 1 deletion src/tel/discord/rtab/commands/ChampionsCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ protected void execute(CommandEvent event)
{
List<String> list = Files.readAllLines(
Paths.get("scores","history"+channelID+"s"+season+".csv"));
String[] record = list.get(0).split("#");
String[] record = list.getFirst().split("#");
output.append(String.format("Season %2d - %s%n", season, record[1]));
season++;
}
Expand Down
2 changes: 1 addition & 1 deletion src/tel/discord/rtab/commands/TestMinigameCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public static void runGame(User player, Game game, MessageChannel channel, boole
ArrayList<Player> players = new ArrayList<>();
players.add(new Player(player));
if(aiPlayer)
players.get(0).isBot = true;
players.getFirst().isBot = true;
Thread dummyThread = new Thread(() ->
{
RaceToABillionBot.testMinigames --;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ protected void execute(CommandEvent event)
try
{
List<String> list = Files.readAllLines(scoreCurrentFile);
String[] winner = list.get(0).split("#");
String[] winner = list.getFirst().split("#");
int winnerScore = Integer.parseInt(winner[2]);
if(winnerScore < 1_000_000_000)
{
Expand Down
2 changes: 1 addition & 1 deletion src/tel/discord/rtab/events/BoostMagnet.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void execute(GameController game, int player)
try { Thread.sleep(2000); } catch (InterruptedException e) { Thread.currentThread().interrupt(); }
game.channel.sendMessage("So you can have this instead.").queue();
try { Thread.sleep(2000); } catch (InterruptedException e) { Thread.currentThread().interrupt(); }
game.awardBoost(player, Board.generateSpaces(1, game.players.size(), Boost.values()).get(0));
game.awardBoost(player, Board.generateSpaces(1, game.players.size(), Boost.values()).getFirst());
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/tel/discord/rtab/events/Market.java
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ void robberySuccess()
game.channel.sendMessage("The shopkeeper dealt with, you make off with the following...").queue();
try { Thread.sleep(1000); } catch (InterruptedException e) { Thread.currentThread().interrupt(); }
if(minigameOffered == null)
game.awardGame(player, Board.generateSpaces(1, game.players.size(), Game.values()).get(0));
game.awardGame(player, Board.generateSpaces(1, game.players.size(), Game.values()).getFirst());
else
game.awardGame(player, minigameOffered);
try { Thread.sleep(1000); } catch (InterruptedException e) { Thread.currentThread().interrupt(); }
Expand Down
6 changes: 3 additions & 3 deletions src/tel/discord/rtab/games/BowserTicTacBomb.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void startGame()
,applyBaseMultiplier(PRIZE_FOR_MAJOR_WIN-PRIZE_FOR_MINOR_WIN)));
sendSkippableMessages(output);
//Place Bowser's bomb and ask for the player's
opponentBomb = Board.generateSpaces(1,2,TicTacBombSpace.values()).get(0).getSpace();
opponentBomb = Board.generateSpaces(1,2,TicTacBombSpace.values()).getFirst().getSpace();
sendMessage(String.format("Good luck, %s! I've placed my bomb, so go ahead and place yours on this board...",getPlayer().getName()));
sendMessage(generateBoard());
getInput();
Expand Down Expand Up @@ -208,7 +208,7 @@ else if(spaces[i] == -1)
String getBotPick()
{
if(playerBomb == -1) //Place bomb if needed
return String.valueOf(Board.generateSpaces(1,2,TicTacBombSpace.values()).get(0).getSpace() + 1);
return String.valueOf(Board.generateSpaces(1,2,TicTacBombSpace.values()).getFirst().getSpace() + 1);
//Decide which space to pick based on if there are any urgent lines
ArrayList<int[]> urgentLines = new ArrayList<>();
for(int[] nextLine : LINES)
Expand All @@ -232,7 +232,7 @@ String getBotPick()
else if(!urgentLines.isEmpty())
//If there's one line, we'll probably fill it but maybe not in case it's their bomb (or to bluff that it's ours)
if(RtaBMath.random() < 0.75)
return String.valueOf(findEmptySpaceInLine(urgentLines.get(0))+1);
return String.valueOf(findEmptySpaceInLine(urgentLines.getFirst())+1);
//If there are no urgent lines or we decided to leave them alone, pick a space at random
ArrayList<Integer> openSpaces = new ArrayList<>();
for(int i=0; i<spaces.length; i++)
Expand Down
2 changes: 1 addition & 1 deletion src/tel/discord/rtab/games/CallYourShot.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ void playNextTurn(String pick)
}
case "GOLD" -> {
output.add("Ooh, risky~ You picked gold. "
+ String.format("You only get one chance, but if you strike gold, you win **$%,d**. ", values.get(0))
+ String.format("You only get one chance, but if you strike gold, you win **$%,d**. ", values.getFirst())
+ "Good luck!");
colorPicked = 0;
}
Expand Down
4 changes: 2 additions & 2 deletions src/tel/discord/rtab/games/ColourOfMoney.java
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,8 @@ String getBotPick()
while(!remainingValues.contains(withdrawal))
{
//Don't go for something totally impossible lolololol
if(withdrawal > remainingValues.get(remainingValues.size()-1))
withdrawal = remainingValues.get(remainingValues.size()-1);
if(withdrawal > remainingValues.getLast())
withdrawal = remainingValues.getLast();
else
withdrawal += adjustedBase;
}
Expand Down
6 changes: 3 additions & 3 deletions src/tel/discord/rtab/games/DealOrNoDeal.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void startGame()
VALUE_LIST.set(i, applyBaseMultiplier(VALUE_LIST.get(i)));
}
//Get the length of the biggest cash value for board display purposes
moneyLength = String.format("%,d", VALUE_LIST.get(VALUE_LIST.size()-1)).length();
moneyLength = String.format("%,d", VALUE_LIST.getLast()).length();
//Load up the boxes and shuffle them
values.clear();
values.addAll(VALUE_LIST);
Expand Down Expand Up @@ -148,7 +148,7 @@ private boolean parseCounter(LinkedList<String> output, String[] tokens)
private void playNextRound()
{
LinkedList<String> output = new LinkedList<>();
if(casesLeft <= OFFER_POINTS.get(0))
if(casesLeft <= OFFER_POINTS.getFirst())
{
output.add("Your box contains...");
prizeWon = values.pollLast();
Expand Down Expand Up @@ -178,7 +178,7 @@ private void runProveout()
{
LinkedList<String> output = new LinkedList<>();
output.add("Now for the proveout... (you can !skip this)");
while(casesLeft > OFFER_POINTS.get(0))
while(casesLeft > OFFER_POINTS.getFirst())
{
StringBuilder boxesOpened = new StringBuilder();
int casesToOpen = getCasesToOpen(casesLeft);
Expand Down
4 changes: 2 additions & 2 deletions src/tel/discord/rtab/games/DigitalFortress.java
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ String getBotPick()
if(lockedIn[i])
digits.remove(solution.get(i));
//Cycle the list once to get a new guess
digits.add(digits.get(0));
digits.remove(0);
digits.add(digits.getFirst());
digits.removeFirst();
//Now start building up the result
StringBuilder result = new StringBuilder();
ListIterator<Character> nextDigit = digits.listIterator();
Expand Down
2 changes: 1 addition & 1 deletion src/tel/discord/rtab/games/OpenPass.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void startGame()
equPart = 0;
equPartReal = 0;
passed = 0;
while (numbers.get(0) < 1 || numbers.get(19) < 1)
while (numbers.getFirst() < 1 || numbers.get(19) < 1)
{
Collections.shuffle(numbers);
}
Expand Down
4 changes: 2 additions & 2 deletions src/tel/discord/rtab/games/SafeCracker.java
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ String getBotPick()
if(lockedIn[i])
digits.remove(solution.get(i));
//Cycle the list once to get a new guess
digits.add(digits.get(0));
digits.remove(0);
digits.add(digits.getFirst());
digits.removeFirst();
//Now start building up the result
StringBuilder result = new StringBuilder();
ListIterator<Character> nextDigit = digits.listIterator();
Expand Down
2 changes: 1 addition & 1 deletion src/tel/discord/rtab/games/SplitWinnings.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void startGame() {
"banks as high as possible by picking cash values and multipliers "
+ "from two %d-space boards.", MAX_STAGES, BOARD_SIZE));
output.add(String.format("The first board has cash values ranging from $%,d to $%,d, and three bombs.",
applyBaseMultiplier(BASE_CASH.get(0)), applyBaseMultiplier(BASE_CASH.get(BOARD_SIZE-(numBombsLeft[0]+1)))));
applyBaseMultiplier(BASE_CASH.getFirst()), applyBaseMultiplier(BASE_CASH.get(BOARD_SIZE-(numBombsLeft[0]+1)))));
output.add("The second board has cash multipliers ranging from 1.5x to 5x, and four bombs.");
output.add("You can mix and match freely between both boards, and type STOP once you are satisfied with your total. "
+ "Stopping will secure your bank, then your next bank will start over at $0.");
Expand Down
4 changes: 2 additions & 2 deletions src/tel/discord/rtab/games/TicTacBomb.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ private void askForBomb(int playerID, boolean playerTurn)
{
if(players.get(playerID).isBot)
{
int spaceNumber = Board.generateSpaces(1,2,TicTacBombSpace.values()).get(0).getSpace();
int spaceNumber = Board.generateSpaces(1,2,TicTacBombSpace.values()).getFirst().getSpace();
if(playerTurn)
playerBomb = spaceNumber;
else
Expand Down Expand Up @@ -262,7 +262,7 @@ String getBotPick()
else if(!urgentLines.isEmpty())
//If there's one line, we'll probably fill it but maybe not in case it's their bomb (or to bluff that it's ours)
if(RtaBMath.random() < 0.75)
return String.valueOf(findEmptySpaceInLine(urgentLines.get(0))+1);
return String.valueOf(findEmptySpaceInLine(urgentLines.getFirst())+1);
//If there are no urgent lines or we decided to leave them alone, pick a space at random
ArrayList<Integer> openSpaces = new ArrayList<>();
for(int i=0; i<spaces.length; i++)
Expand Down