Randomizer.java 8.06 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
package com.owlmaddie.utils;

import java.util.Arrays;
import java.util.List;
import java.util.Random;

/**
 * The {@code Randomizer} class provides easy functions for generating a variety of different random numbers
 * and phrases used by this mod.
 */
public class Randomizer {
12
    public enum RandomType { NO_RESPONSE, ERROR, ADJECTIVE, SPEAKING_STYLE, CLASS, ALIGNMENT }
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
    private static List<String> noResponseMessages = Arrays.asList(
            "<no response>",
            "<silence>",
            "<stares>",
            "<blinks>",
            "<looks away>",
            "<sighs>",
            "<shrugs>",
            "<taps foot>",
            "<yawns>",
            "<examines nails>",
            "<whistles softly>",
            "<shifts uncomfortably>",
            "<glances around>",
            "<pretends not to hear>",
            "<hums quietly>",
            "<fiddles with something>",
            "<gazes into the distance>",
            "<smirks>",
            "<raises an eyebrow>",
            "<clears throat>",
            "<peers over your shoulder>",
            "<fakes a smile>",
            "<mutters under breath>",
37
            "<counts imaginary stars>"
38 39
    );
    private static List<String> errorResponseMessages = Arrays.asList(
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
            "Seems like my words got lost in the End. Check out http://discord.creaturechat.com for clues!",
            "Oops! My speech bubble popped. Need help? Visit http://discord.creaturechat.com",
            "I might've eaten a bad Command Block. Help me out at http://discord.creaturechat.com!",
            "My words are on strike. More info? http://discord.creaturechat.com",
            "I think a Creeper blew up my script. Instructions? http://discord.creaturechat.com",
            "BRB, asking a villager for directions to http://discord.creaturechat.com",
            "It’s not you, it’s my API key. Let's regroup at http://discord.creaturechat.com",
            "I tried to speak, but it was a critical miss. Help at http://discord.creaturechat.com",
            "Words are hard. Come chat at http://discord.creaturechat.com",
            "I must've left my responses in my other pants. See http://discord.creaturechat.com",
            "Shh... I’m hiding from an invalid API key. Join the hunt at http://discord.creaturechat.com",
            "I’d tell you, but then I’d have to respawn. Meet me at http://discord.creaturechat.com",
            "Error 404: Response not found. Maybe it’s at http://discord.creaturechat.com?",
            "I'm speechless, literally. Let's troubleshoot at http://discord.creaturechat.com",
            "Looks like my connection got lost in the Nether. Can you help? http://discord.creaturechat.com",
            "I forgot what I was saying, but http://discord.creaturechat.com remembers.",
            "Are my words mining without a pickaxe? Dig up some help at http://discord.creaturechat.com",
            "Sorry, my parrot ate the response. Teach it better at http://discord.creaturechat.com",
            "My magic mirror says: 'Better answers found at http://discord.creaturechat.com'",
            "This message is temporarily out of order. Order yours at http://discord.creaturechat.com"
60 61
    );
    private static List<String> characterAdjectives = Arrays.asList(
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
            "mystical", "fiery", "ancient", "cursed", "ethereal", "clumsy", "stealthy",
            "legendary", "toxic", "enigmatic", "celestial", "rambunctious", "shadowy",
            "brave", "screaming", "radiant", "savage", "whimsical", "positive", "turbulent",
            "ominous", "jubilant", "arcane", "hopeful", "rugged", "venomous", "timeworn",
            "heinous", "friendly", "humorous", "silly", "goofy", "irate", "furious",
            "wrathful", "nefarious", "sinister", "malevolent", "sly", "roguish", "deceitful",
            "untruthful", "loving", "noble", "dignified", "righteous", "defensive",
            "protective", "heroic", "amiable", "congenial", "happy", "sarcastic", "funny",
            "short", "zany", "cooky", "wild", "fearless insane", "cool", "chill",
            "cozy", "comforting", "stern", "stubborn", "scatterbrain", "scaredy", "aloof",
            "gullible", "mischievous", "prankster", "trolling", "clingy", " manipulative",
            "weird", "famous", "persuasive", "sweet", "wholesome", "innocent", "annoying",
            "trusting", "hyper", "egotistical", "slow", "obsessive", "compulsive", "impulsive",
            "unpredictable", "wildcard", "stuttering", "hypochondriac", "hypocritical",
            "optimistic", "overconfident", "jumpy", "brief", "flighty", "visionary", "adorable",
            "sparkly", "bubbly", "unstable", "sad", "angry", "bossy", "altruistic", "quirky",
78
            "nostalgic", "emotional", "enthusiastic", "unusual", "conspirator"
79
    );
80 81 82 83 84 85 86
    private static List<String> speakingStyles = Arrays.asList(
            "formal", "casual", "eloquent", "blunt", "humorous", "sarcastic", "mysterious",
            "cheerful", "melancholic", "authoritative", "nervous", "whimsical", "grumpy",
            "wise", "aggressive", "soft-spoken", "patriotic", "romantic", "pedantic", "dramatic",
            "inquisitive", "cynical", "empathetic", "boisterous", "monotone", "laconic", "poetic",
            "archaic", "childlike", "erudite", "streetwise", "flirtatious", "stoic", "rhetorical",
            "inspirational", "goofy", "overly dramatic", "deadpan", "sing-song", "pompous",
87
            "hyperactive", "valley girl", "robot", "baby talk", "lolcat"
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
    );
    private static List<String> classes = Arrays.asList(
            "warrior", "mage", "archer", "rogue", "paladin", "necromancer", "bard", "lorekeeper",
            "sorcerer", "ranger", "cleric", "berserker", "alchemist", "summoner", "shaman",
            "illusionist", "assassin", "knight", "valkyrie", "hoarder", "organizer", "lurker",
            "elementalist", "gladiator", "templar", "reaver", "spellblade", "enchanter", "samurai",
            "runemaster", "witch", "miner", "redstone engineer", "ender knight", "decorator",
            "wither hunter", "nethermancer", "slime alchemist", "trader", "noob", "griefer",
            "potion master", "builder", "explorer", "herbalist", "fletcher", "enchantress",
            "smith", "geomancer", "hunter", "lumberjack", "farmer", "fisherman", "cartographer",
            "librarian", "blacksmith", "architect", "trapper", "baker", "mineralogist",
            "beekeeper", "hermit", "farlander", "void searcher", "end explorer", "archeologist",
            "hero", "villain", "mercenary", "guardian", "rebel", "paragon",
            "antagonist", "avenger", "seeker", "mystic", "outlaw"
    );
    private static List<String> alignments = Arrays.asList(
            "lawful good", "neutral good", "chaotic good",
            "lawful neutral", "true neutral", "chaotic neutral",
            "lawful evil", "neutral evil", "chaotic evil"
107 108 109 110 111 112 113 114 115 116 117 118
    );

    // Get random no response message
    public static String getRandomMessage(RandomType messageType) {
        Random random = new Random();
        List<String> messages = null;
        if (messageType.equals(RandomType.ERROR)) {
            messages = errorResponseMessages;
        } else if (messageType.equals(RandomType.NO_RESPONSE)) {
            messages = noResponseMessages;
        } else if (messageType.equals(RandomType.ADJECTIVE)) {
            messages = characterAdjectives;
119 120 121 122 123 124
        } else if (messageType.equals(RandomType.CLASS)) {
            messages = classes;
        } else if (messageType.equals(RandomType.ALIGNMENT)) {
            messages = alignments;
        } else if (messageType.equals(RandomType.SPEAKING_STYLE)) {
            messages = speakingStyles;
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
        }

        int index = random.nextInt(messages.size());
        return messages.get(index).trim();
    }

    public static String RandomLetter() {
        // Return random letter between 'A' and 'Z'
        int randomNumber = RandomNumber(26);
        return String.valueOf((char) ('A' + randomNumber));
    }

    public static int RandomNumber(int max) {
        // Generate a random integer between 0 and max (inclusive)
        Random random = new Random();
        return random.nextInt(max);
    }
}