Search in sources :

Example 1 with Player

use of tel.discord.rtab.Player in project RtaB6 by Telnaior.

the class TestMinigameCommand method runGame.

public static void runGame(User player, Game game, MessageChannel channel, boolean enhance) {
    ArrayList<Player> players = new ArrayList<Player>();
    players.add(new Player(player));
    Thread dummyThread = new Thread() {

        public void run() {
            RaceToABillionBot.testMinigames--;
        }
    };
    dummyThread.setName(String.format("Minigame Test - %s - %s", player.getName(), game.getName()));
    game.getGame().initialiseGame(channel, true, 1, 1, 1, players, 0, dummyThread, enhance);
    RaceToABillionBot.testMinigames++;
}
Also used : Player(tel.discord.rtab.Player) ArrayList(java.util.ArrayList)

Example 2 with Player

use of tel.discord.rtab.Player in project RtaB6 by Telnaior.

the class MinigamesForAll method execute.

@Override
public void execute(GameController game, int player) {
    // Small chance in large games of the space mutating, capping at 10% in 16p
    if (Math.random() * 100 < game.playersAlive - 6) {
        game.channel.sendMessage("It's **Minigame For... One?!**").queue();
        Game chosenGame = game.generateEventMinigame(player);
        for (int i = 0; i < game.playersAlive; i++) {
            game.players.get(player).games.add(chosenGame);
            game.channel.sendMessage(game.players.get(player).getSafeMention() + " receives a copy of **" + chosenGame.getName() + "**!").queue();
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        game.players.get(player).games.sort(null);
        game.players.get(player).minigameLock = true;
        game.channel.sendMessage("Minigame Lock applied to " + game.players.get(player).getSafeMention() + ".").queue();
    } else {
        game.channel.sendMessage("It's **Minigames For All**! All players remaining receive a minigame!").queue();
        for (int i = 0; i < game.players.size(); i++) {
            Player nextPlayer = game.players.get(i);
            if (nextPlayer.status == PlayerStatus.ALIVE) {
                Game chosenGame = game.generateEventMinigame(i);
                game.players.get(i).games.add(chosenGame);
                game.players.get(i).games.sort(null);
                game.channel.sendMessage(nextPlayer.getSafeMention() + " receives a copy of **" + chosenGame.getName() + "**!").queue();
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
Also used : Player(tel.discord.rtab.Player) Game(tel.discord.rtab.board.Game)

Example 3 with Player

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;
    }
}
Also used : Player(tel.discord.rtab.Player)

Example 4 with Player

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;
    }
}
Also used : Player(tel.discord.rtab.Player)

Example 5 with Player

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();
}
Also used : Player(tel.discord.rtab.Player) LinkedList(java.util.LinkedList) Pair(net.dv8tion.jda.internal.utils.tuple.Pair)

Aggregations

Player (tel.discord.rtab.Player)16 GameController (tel.discord.rtab.GameController)4 Game (tel.discord.rtab.board.Game)3 ArrayList (java.util.ArrayList)2 LinkedList (java.util.LinkedList)2 IOException (java.io.IOException)1 Path (java.nio.file.Path)1 Pair (net.dv8tion.jda.internal.utils.tuple.Pair)1