use of tel.discord.rtab.Player in project RtaB6 by Telnaior.
the class TimesTen method execute.
@Override
public void execute(GameController game, int player) {
// This check shouldn't be needed right now, but in case we change things later
if (game.players.get(player).oneshotBooster == 1) {
game.channel.sendMessage("It's **Times Ten**. The next time you gain or lose boosted cash, it will be multiplied by ten!").queue();
game.players.get(player).oneshotBooster = 10;
} else {
game.channel.sendMessage("It's **Times Ten**, but you already have it... then it'll be for everyone else!").queue();
for (Player next : game.players) next.oneshotBooster = 10;
}
}
use of tel.discord.rtab.Player in project RtaB6 by Telnaior.
the class Bowser method awardJackpot.
private void awardJackpot() {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
game.channel.sendMessage("...").queue();
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
game.channel.sendMessage("Bowser looks about to run away, but then gives you a pitiful look.").queue();
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
game.channel.sendMessage("You're looking quite sad there, aren't you?").queue();
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
game.channel.sendMessage("Let no one say I am unkind. You can have this, but don't tell anyone...").queue();
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
// Final test: They need to be in last overall out of the players in the round
boolean awardJP = true;
int threshold = getCurrentPlayer().money;
for (Player next : game.players) if (next.money < threshold) {
awardJP = false;
game.channel.sendMessage("Bowser left you **ABSOLUTELY NOTHING**! PSYCHE!").queue();
return;
}
if (awardJP) {
game.channel.sendMessage("Bowser left you **all the money he has collected**!!").queue();
game.channel.sendMessage(String.format("**$%,d**!!", bowserJackpot)).queue();
getCurrentPlayer().addMoney(bowserJackpot, MoneyMultipliersToUse.NOTHING);
bowserJackpot = Jackpots.BOWSER.resetValue;
}
}
use of tel.discord.rtab.Player in project RtaB6 by Telnaior.
the class RaceDeal method startGame.
@Override
void startGame() {
casesLeft = 26;
round = 0;
// Start by adding the fixed values
valueList = new ArrayList<Pair<Integer, SpecialType>>(casesLeft);
valueList.add(Pair.of(applyBaseMultiplier(-10_000_000), SpecialType.CASH));
// Just like the regular DoND minigame, this isn't multiplied
valueList.add(Pair.of(1, SpecialType.CASH));
// Lowest Red Value
valueList.add(Pair.of(applyBaseMultiplier(1_000_000), SpecialType.CASH));
// +999% Boost
valueList.add(Pair.of(applyBaseMultiplier(9_990_000), SpecialType.MAX_BOOST));
valueList.add(Pair.of(applyBaseMultiplier(100_000_000), SpecialType.CASH));
// All Bonus Games - this may be undervalued but it'll push them to win it
valueList.add(Pair.of(applyBaseMultiplier(123_456_789), SpecialType.BONUS_GAMES));
// $1,000,000,000 - the value of which is reduced by the player's bank
valueList.add(Pair.of(1_000_000_000 - getCurrentPlayer().money, SpecialType.BILLION));
int negativeToAdd = 6;
int blueToAdd = 5;
int redToAdd = 8;
// Calculate mystery chance value as the average of all players' cash amounts
mysteryChanceBase = 0;
for (Player next : players) mysteryChanceBase += next.money / players.size();
// Finally, average it with the current player's money
mysteryChanceBase = (mysteryChanceBase + getCurrentPlayer().money) / 2;
// Minimum value to make sure Mystery Chance is interesting / playable
mysteryChanceBase = Math.max(mysteryChanceBase, 1_234_567);
mysteryChance = false;
// And this becomes the amount they stand to gain/lose on average
int mysteryChanceValue = mysteryChanceBase - getCurrentPlayer().money;
// Then add it, replacing a random value as relevant
valueList.add(Pair.of(mysteryChanceValue, SpecialType.MYSTERY_CHANCE));
if (mysteryChanceValue > 1_000_000)
redToAdd--;
else
negativeToAdd--;
// Now shuffle the random values and use them to fill the gaps
Collections.shuffle(randomNegativeValues);
Collections.shuffle(randomBlueValues);
Collections.shuffle(randomRedValues);
for (int i = 0; i < negativeToAdd; i++) valueList.add(Pair.of(applyBaseMultiplier(randomNegativeValues.get(i)), SpecialType.CASH));
for (int i = 0; i < blueToAdd; i++) valueList.add(Pair.of(applyBaseMultiplier(randomBlueValues.get(i)), SpecialType.CASH));
for (int i = 0; i < redToAdd; i++) valueList.add(Pair.of(applyBaseMultiplier(randomRedValues.get(i)), SpecialType.CASH));
// Finally, sort the board
valueList.sort(new AscendingValueSorter());
// Now shuffle the values into the cases
caseList = new ArrayList<Integer>(casesLeft);
for (int i = 0; i < casesLeft; i++) caseList.add(i);
Collections.shuffle(caseList);
openedCases = new boolean[casesLeft];
// No case selected yet
chosenCase = -1;
casesToOpen = -1;
acceptedOffer = false;
// Alright, we got ourselves organised, give them the achievement for making it here and tell them what's happening
Achievement.TWENTY.check(getCurrentPlayer());
LinkedList<String> output = new LinkedList<>();
output.add("For reaching a streak bonus of x20, you have earned the right to play the final bonus game!");
output.add("Race Deal is a lot like regular Deal or No Deal, except the stakes are a lot higher.");
output.add("In fact, one of the twenty-six cases in front of you contains one billion dollars!");
output.add("There are also some negative values, however, so be extra careful not to get stuck with one of them.");
output.add("In addition, there are three cases that will award other prizes in lieu of cash.");
output.add("Winning +999% Boost will max out your boost, and award you a small monetary prize based on the excess.");
output.add("Winning 4 Bonus Games will give you the opportunity to play Supercash, Digital Fortress, Spectrum, and Hypercube in turn.");
output.add("Finally, if won, Mystery Chance will remove and replace your *entire cash bank* with a new value decided at random. " + "This could earn you hundreds of millions, or *cost* you the same. Win it at your own risk.");
output.add("You will choose six cases to open before the first offer, and each future round will require one case less " + "until the final six cases are opened one at a time.");
output.add("Before that, however, you must first decide which case you want to be yours.");
output.add("There will not be any opportunity to change your case later, so choose wisely and good luck!");
sendSkippableMessages(output);
sendMessage(generateBoard());
getInput();
}
use of tel.discord.rtab.Player in project RtaB6 by Telnaior.
the class TicTacBomb method startGame.
@Override
void startGame() {
LinkedList<String> output = new LinkedList<String>();
output.add("Welcome to Tic Tac Bomb, the race's first PvP minigame!");
output.addAll(getInstructions());
sendSkippableMessages(output);
// Decide Opponent
if (players.size() == 1) {
// If there's only one player somehow, automatically generate a bot for them
players.add(new Player());
opponent = 1;
// The automatic AI doesn't get initialised properly so let's just set this here
opponentEnhanced = enhanced;
placeBombs();
} else if (!getCurrentPlayer().isBot && players.size() == 2) {
// Bots don't use this so it falls through to the method that enables messages
// If it's 2p, automatically designate the other player as the opponent
opponent = 1 - player;
opponentEnhanced = isOpponentEnhanced();
placeBombs();
} else {
// Otherwise, the player gets to decide!
sendMessage("First of all, name another player in this round to be your opponent for the game.");
getInput();
}
}
use of tel.discord.rtab.Player in project RtaB6 by Telnaior.
the class OneBuckBehind method execute.
@Override
public void execute(GameController game, int player) {
// Makes the player go one dollar behind whoever has the highest score so far this round.
int highScore = 0;
for (Player nextPlayer : game.players) {
if (nextPlayer.getRoundDelta() > highScore) {
highScore = nextPlayer.getRoundDelta();
}
}
if (highScore == 0) {
int backupMoney = game.applyBaseMultiplier(100_000);
game.channel.sendMessage("It's **One Buck Behind the Leader**! " + "But since no one has money this round, " + String.format("we'll just give you **$%,d**!", backupMoney)).queue();
game.players.get(player).addMoney(backupMoney, MoneyMultipliersToUse.NOTHING);
} else if (highScore == game.players.get(player).getRoundDelta()) {
int playerChosen = 0;
// now we need a low scorer, this time in overall standings terms
int lowScore = 1_000_000_001;
for (int i = 0; i < game.players.size(); i++) if (game.players.get(i).money < lowScore && i != player && game.players.get(i).status == PlayerStatus.ALIVE) {
playerChosen = i;
lowScore = game.players.get(i).money;
}
game.channel.sendMessage("It's **One Buck Behind the Leader**! " + "But since *you're* the leader, we'll just place **" + game.players.get(playerChosen).getName() + "** in front of you!").queue();
game.players.get(playerChosen).resetRoundDelta();
game.players.get(playerChosen).addMoney(highScore + 1, MoneyMultipliersToUse.NOTHING);
} else {
game.channel.sendMessage("It's **One Buck Behind the Leader**! " + "Your round score is now one dollar behind the player with the most money!").queue();
game.players.get(player).resetRoundDelta();
game.players.get(player).addMoney(highScore - 1, MoneyMultipliersToUse.NOTHING);
}
}
Aggregations