Search in sources :

Example 11 with Player

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

the class ViewBombsCommand method execute.

@Override
protected void execute(CommandEvent event) {
    for (GameController game : RaceToABillionBot.game) {
        if (game.channel.equals(event.getChannel())) {
            if (game.findPlayerInGame(event.getAuthor().getId()) != -1)
                event.reply("You can't view bombs for a game you're in!");
            else {
                StringBuilder output = new StringBuilder();
                for (Player nextPlayer : game.players) {
                    output.append(nextPlayer.printBombs() + "\n");
                }
                event.replyInDm(output.toString());
            }
            // We found the right channel, so
            return;
        }
    }
}
Also used : Player(tel.discord.rtab.Player) GameController(tel.discord.rtab.GameController)

Example 12 with Player

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

the class Bowser method bowserPotluck.

private void bowserPotluck() {
    game.channel.sendMessage("It's **Bowser's Cash Potluck**!").queue();
    try {
        Thread.sleep(1000);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    game.channel.sendMessage("In this EXTRA FUN event, EVERY PLAYER gives me money!").queue();
    // Potluck: 0.01% - 1.00% of the average total bank of the living players in the round
    int potluckFraction = (int) (Math.random() * 100 + 1);
    int potluck = 0;
    for (Player next : game.players) if (next.status == PlayerStatus.ALIVE)
        potluck += next.money / 100;
    potluck /= game.playersAlive;
    potluck *= potluckFraction;
    potluck /= 100;
    if (potluck < 50000)
        potluck = 50000;
    potluck = game.applyBaseMultiplier(potluck);
    try {
        Thread.sleep(1000);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    game.channel.sendMessage(String.format("Let the event begin! That'll be **$%,d** each! Wah, hah, hah, HAH!", potluck)).queue();
    for (Player next : game.players) if (next.status == PlayerStatus.ALIVE)
        next.addMoney(potluck * -1, MoneyMultipliersToUse.NOTHING);
    bowserJackpot += (potluck * game.playersAlive);
}
Also used : Player(tel.discord.rtab.Player)

Example 13 with Player

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

the class Bowser method blammoFrenzy.

private void blammoFrenzy() {
    game.channel.sendMessage("It's **Bowser's Multiplying Blammos**, we're using your cash to make more BLAMMOs! Good luck!").queue();
    for (int i = 0; i < game.boardSize; i++) {
        // Determine blammo rate based on current cash totals
        int totalMillions = 0;
        for (Player next : game.players) {
            totalMillions += Math.pow(next.money / 1_000_000, 2);
        }
        int average = (int) Math.pow(totalMillions / game.players.size(), 0.5) / 100;
        // So the range is 1-10 rather than 0-9
        average += 1;
        // Switch cash to blammo with average/10 chance
        if (game.gameboard.getType(i) == SpaceType.CASH && Math.random() * 10 < average)
            game.gameboard.changeType(i, SpaceType.BLAMMO);
    }
}
Also used : Player(tel.discord.rtab.Player)

Example 14 with Player

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

the class Bowser method communism.

private void communism() {
    game.channel.sendMessage("I am not always thinking about money. Why can't we all be friends?").queue();
    try {
        Thread.sleep(1000);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    game.channel.sendMessage("So, to make the world a more peaceful place, " + "I've decided to *divide everyone's earnings evenly*!").queue();
    try {
        Thread.sleep(1000);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    game.channel.sendMessage("It's a **Bowser Revolution**!").queue();
    boolean superRevolution = Math.random() < 0.5;
    if (superRevolution) {
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        game.channel.sendMessage("And let's throw in 1% of your total banks as well!").queue();
    }
    // Get the total money added during the round
    int delta = 0;
    for (Player next : game.players) {
        // Add their delta to the pile
        delta += next.resetRoundDelta();
        // Take total banks as well if necessary
        if (superRevolution) {
            delta += (next.money / 100);
            next.money -= next.money / 100;
        }
        // If they're out with split and share, give them an achievement
        if (next.splitAndShare && next.status == PlayerStatus.OUT)
            Achievement.SPLIT_COMMUNISM.check(next);
    }
    // Add the remainder to the jackpot - Bowser keeps it!
    bowserJackpot += (delta % game.players.size());
    // Divide the total by the number of players
    delta /= game.players.size();
    // If the delta is negative, Bowser doesn't 'keep' the change!
    if (delta < 0)
        delta -= 1;
    // And give it to each of them
    for (Player next : game.players) {
        next.addMoney(delta, MoneyMultipliersToUse.NOTHING);
    }
}
Also used : Player(tel.discord.rtab.Player)

Example 15 with Player

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

the class CashForAll method execute.

@Override
public void execute(GameController game, int player) {
    // Give each living player a value based on what fraction of the original playercount is still in
    int cashGiven = game.applyBaseMultiplier(50_000 + (int) (50_001 * Math.random())) * game.players.size() / game.playersAlive;
    for (Player nextPlayer : game.players) {
        if (nextPlayer.status == PlayerStatus.ALIVE) {
            nextPlayer.addMoney(cashGiven, MoneyMultipliersToUse.BOOSTER_ONLY);
        }
    }
    game.channel.sendMessage(String.format("It's **Cash For All**! All players remaining receive **$%,d**!", cashGiven)).queue();
}
Also used : Player(tel.discord.rtab.Player)

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