Commit 88a88168 by Jonathan Thomas

Improved character creation with more random classes, speaking styles, and alignments.

parent fa711c9b
Pipeline #12726 passed with stages
in 2 minutes 26 seconds
...@@ -13,6 +13,7 @@ All notable changes to **CreatureChat** are documented in this file. The format ...@@ -13,6 +13,7 @@ All notable changes to **CreatureChat** are documented in this file. The format
- Automatically tame best friends (who are tameable) and un-tame worst enemies! - Automatically tame best friends (who are tameable) and un-tame worst enemies!
### Changed ### Changed
- Improved character creation with more random classes, speaking styles, and alignments.
- Large refactor of how MobEntity avoids targeting players when friendship > 0 - Large refactor of how MobEntity avoids targeting players when friendship > 0
- Updated LookControls to support PhantomEntity and made it more generalized (look in any direction) - Updated LookControls to support PhantomEntity and made it more generalized (look in any direction)
- Updated FLEE behavior Y movement speed - Updated FLEE behavior Y movement speed
......
...@@ -264,20 +264,27 @@ public class ServerPackets { ...@@ -264,20 +264,27 @@ public class ServerPackets {
// Grab random adjective // Grab random adjective
String randomAdjective = Randomizer.getRandomMessage(Randomizer.RandomType.ADJECTIVE); String randomAdjective = Randomizer.getRandomMessage(Randomizer.RandomType.ADJECTIVE);
String randomFrequency = Randomizer.getRandomMessage(Randomizer.RandomType.FREQUENCY); String randomClass = Randomizer.getRandomMessage(Randomizer.RandomType.CLASS);
String randomAlignment = Randomizer.getRandomMessage(Randomizer.RandomType.ALIGNMENT);
String randomSpeakingStyle = Randomizer.getRandomMessage(Randomizer.RandomType.SPEAKING_STYLE);
// Generate random name parameters
String randomLetter = Randomizer.RandomLetter();
int randomSyllables = Randomizer.RandomNumber(5) + 1;
// Build the message
StringBuilder userMessageBuilder = new StringBuilder(); StringBuilder userMessageBuilder = new StringBuilder();
userMessageBuilder.append("Please generate a " + randomFrequency + " " + randomAdjective); userMessageBuilder.append("Please generate a ").append(randomAdjective).append(" character. ");
userMessageBuilder.append(" character "); userMessageBuilder.append("This character is a ").append(randomClass).append(" class, who is ").append(randomAlignment).append(". ");
if (entity.getCustomName() != null && !entity.getCustomName().getString().equals("N/A")) { if (entity.getCustomName() != null && !entity.getCustomName().getString().equals("N/A")) {
userMessageBuilder.append("named '").append(entity.getCustomName().getString()).append("' "); userMessageBuilder.append("Their name is '").append(entity.getCustomName().getString()).append("'. ");
} else { } else {
userMessageBuilder.append("whose name starts with the letter '").append(Randomizer.RandomLetter()).append("' "); userMessageBuilder.append("Their name starts with the letter '").append(randomLetter)
userMessageBuilder.append("and uses ").append(Randomizer.RandomNumber(4) + 1).append(" syllables "); .append("' and is ").append(randomSyllables).append(" syllables long. ");
} }
userMessageBuilder.append("and speaks in '" + userLanguage + "'" ); userMessageBuilder.append("They speak in '").append(userLanguage).append("' with a ").append(randomSpeakingStyle).append(" style.");
LOGGER.info(userMessageBuilder.toString());
LOGGER.info(userMessageBuilder.toString());
chatData.generateMessage(userLanguage, player, "system-character", userMessageBuilder.toString(), false); chatData.generateMessage(userLanguage, player, "system-character", userMessageBuilder.toString(), false);
} }
......
...@@ -9,7 +9,7 @@ import java.util.Random; ...@@ -9,7 +9,7 @@ import java.util.Random;
* and phrases used by this mod. * and phrases used by this mod.
*/ */
public class Randomizer { public class Randomizer {
public enum RandomType { NO_RESPONSE, ERROR, ADJECTIVE, FREQUENCY } public enum RandomType { NO_RESPONSE, ERROR, ADJECTIVE, SPEAKING_STYLE, CLASS, ALIGNMENT }
private static List<String> noResponseMessages = Arrays.asList( private static List<String> noResponseMessages = Arrays.asList(
"<no response>", "<no response>",
"<silence>", "<silence>",
...@@ -79,11 +79,35 @@ public class Randomizer { ...@@ -79,11 +79,35 @@ public class Randomizer {
"unpredictable", "wildcard", "stuttering", "hypochondriac", "hypocritical", "unpredictable", "wildcard", "stuttering", "hypochondriac", "hypocritical",
"optimistic", "overconfident", "jumpy", "brief", "flighty", "visionary", "adorable", "optimistic", "overconfident", "jumpy", "brief", "flighty", "visionary", "adorable",
"sparkly", "bubbly", "unstable", "sad", "angry", "bossy", "altruistic", "quirky", "sparkly", "bubbly", "unstable", "sad", "angry", "bossy", "altruistic", "quirky",
"nostalgic", "essentially", "emotional", "enthusiastic", "unusual", "conspirator" "nostalgic", "emotional", "enthusiastic", "unusual", "conspirator"
); );
private static List<String> frequencyTerms = Arrays.asList( private static List<String> speakingStyles = Arrays.asList(
"always", "frequently", "usually", "often", "sometimes", "formal", "casual", "eloquent", "blunt", "humorous", "sarcastic", "mysterious",
"occasionally", "rarely", "seldom", "almost never", "never" "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",
"hyperactive", "valley girl", "robot", "pirate", "baby talk", "lolcat"
);
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"
); );
// Get random no response message // Get random no response message
...@@ -96,8 +120,12 @@ public class Randomizer { ...@@ -96,8 +120,12 @@ public class Randomizer {
messages = noResponseMessages; messages = noResponseMessages;
} else if (messageType.equals(RandomType.ADJECTIVE)) { } else if (messageType.equals(RandomType.ADJECTIVE)) {
messages = characterAdjectives; messages = characterAdjectives;
} else if (messageType.equals(RandomType.FREQUENCY)) { } else if (messageType.equals(RandomType.CLASS)) {
messages = frequencyTerms; messages = classes;
} else if (messageType.equals(RandomType.ALIGNMENT)) {
messages = alignments;
} else if (messageType.equals(RandomType.SPEAKING_STYLE)) {
messages = speakingStyles;
} }
int index = random.nextInt(messages.size()); int index = random.nextInt(messages.size());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment