Class MonsterGen
java.lang.Object
com.github.yellowstonegames.text.MonsterGen
- All Implemented Interfaces:
com.github.yellowstonegames.core.ISerializersNeeded
public class MonsterGen
extends Object
implements com.github.yellowstonegames.core.ISerializersNeeded
A class for generating random monster descriptions; can be subclassed to generate stats for a specific game. Use the
nested Chimera class for most of the functionality here; MonsterGen is here so you can change the descriptors that
monsters can be given (they are in public array fields). You can call randomizeAppearance or randomizePowers on a
Chimera to draw from the list of descriptors in MonsterGen, or fuse two Chimera objects with the mix method in the
Chimera class. Chimeras can be printed to a usable format with presentVisible or present; the former does not print
special powers and is suitable for monsters being encountered, and the latter is more useful for texts in the game
world that describe some monster.
This doesn't produce very good output; it's mostly here for feature parity with SquidLib 3.x .
This doesn't produce very good output; it's mostly here for feature parity with SquidLib 3.x .
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA creature that can be mixed with other Chimeras or given additional descriptors, then printed in a usable format for game text. -
Field Summary
FieldsModifier and TypeFieldDescriptionString[]String[]static final MonsterGen.Chimerastatic final MonsterGen.Chimerastatic final MonsterGen.ChimeraString[]String[]final com.github.tommyettinger.random.DistinctRandomstatic final MonsterGen.Chimerastatic final MonsterGen.Chimera -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a MonsterGen with a random seed for the default EnhancedRandom.MonsterGen(long seed) Constructs a MonsterGen with the given seed for the default EnhancedRandom.MonsterGen(String seed) Constructs a MonsterGen with the given seed (hashing seed withHasher.hashBulk64(long, String)) for the default EnhancedRandom. -
Method Summary
Modifier and TypeMethodDescriptionGets a List of Class instances that must each be registered with a serialization library before this object can be successfully serialized or deserialized.Randomly add appearance and power descriptors to a new Chimera creature with random body part adjectives.Randomly add appearance and power descriptors to a new Chimera creature with random body part adjectives.Randomly add appearance and power descriptors to a new Chimera creature with random body part adjectives.randomizeAppearance(com.github.tommyettinger.random.EnhancedRandom rng, MonsterGen.Chimera creature, String newName, int adjectiveCount) Randomly add appearance descriptors to a copy of the Chimera creature.randomizeAppearance(MonsterGen.Chimera creature, String newName, int adjectiveCount) Randomly add appearance descriptors to a copy of the Chimera creature.randomizePowers(com.github.tommyettinger.random.EnhancedRandom rng, MonsterGen.Chimera creature, String newName, int powerCount) Randomly add power descriptors to a copy of the Chimera creature.randomizePowers(MonsterGen.Chimera creature, String newName, int powerCount) Randomly add power descriptors to a copy of the Chimera creature.Gets a random name as a String using FakeLanguageGen.randomName(com.github.tommyettinger.random.EnhancedRandom rng) Gets a random name as a String using FakeLanguageGen.
-
Field Details
-
random
public final com.github.tommyettinger.random.DistinctRandom random -
components
-
adjectives
-
powerAdjectives
-
powerPhrases
-
SNAKE
-
LION
-
HORSE
-
HAWK
-
SHOGGOTH
-
-
Constructor Details
-
MonsterGen
public MonsterGen()Constructs a MonsterGen with a random seed for the default EnhancedRandom. -
MonsterGen
public MonsterGen(long seed) Constructs a MonsterGen with the given seed for the default EnhancedRandom. -
MonsterGen
Constructs a MonsterGen with the given seed (hashing seed withHasher.hashBulk64(long, String)) for the default EnhancedRandom.
-
-
Method Details
-
randomizeAppearance
public MonsterGen.Chimera randomizeAppearance(com.github.tommyettinger.random.EnhancedRandom rng, MonsterGen.Chimera creature, String newName, int adjectiveCount) Randomly add appearance descriptors to a copy of the Chimera creature. Produces a new Chimera, potentially with a different name, and adds the specified count of adjectives (if any are added that the creature already has, they are ignored, and this includes unsaid adjectives if the creature is known).- Parameters:
rng- the EnhancedRandom to determine random factorscreature- the Chimera to add descriptors tonewName- the name to call the produced ChimeraadjectiveCount- the number of adjectives to add; may add less if some overlap- Returns:
- a new Chimera with additional appearance descriptors
-
randomizeAppearance
public MonsterGen.Chimera randomizeAppearance(MonsterGen.Chimera creature, String newName, int adjectiveCount) Randomly add appearance descriptors to a copy of the Chimera creature. Produces a new Chimera, potentially with a different name, and adds the specified count of adjectives (if any are added that the creature already has, they are ignored, and this includes unsaid adjectives if the creature is known).- Parameters:
creature- the Chimera to add descriptors tonewName- the name to call the produced ChimeraadjectiveCount- the number of adjectives to add; may add less if some overlap- Returns:
- a new Chimera with additional appearance descriptors
-
randomizePowers
public MonsterGen.Chimera randomizePowers(com.github.tommyettinger.random.EnhancedRandom rng, MonsterGen.Chimera creature, String newName, int powerCount) Randomly add power descriptors to a copy of the Chimera creature. Produces a new Chimera, potentially with a different name, and adds the specified total count of power adjectives and phrases (if any are added that the creature already has, they are ignored).- Parameters:
rng- the EnhancedRandom to determine random factorscreature- the Chimera to add descriptors tonewName- the name to call the produced ChimerapowerCount- the number of adjectives to add; may add less if some overlap- Returns:
- a new Chimera with additional power descriptors
-
randomizePowers
public MonsterGen.Chimera randomizePowers(MonsterGen.Chimera creature, String newName, int powerCount) Randomly add power descriptors to a copy of the Chimera creature. Produces a new Chimera, potentially with a different name, and adds the specified total count of power adjectives and phrases (if any are added that the creature already has, they are ignored).- Parameters:
creature- the Chimera to add descriptors tonewName- the name to call the produced ChimerapowerCount- the number of adjectives to add; may add less if some overlap- Returns:
- a new Chimera with additional power descriptors
-
randomize
public MonsterGen.Chimera randomize(com.github.tommyettinger.random.EnhancedRandom rng, String newName, int detail) Randomly add appearance and power descriptors to a new Chimera creature with random body part adjectives. Produces a new Chimera with the specified name, and adds the specified total count (detail) of appearance adjectives, power adjectives and phrases, and the same count (detail) of body parts.- Parameters:
rng- the EnhancedRandom to determine random factorsnewName- the name to call the produced Chimeradetail- the number of adjectives and phrases to add, also the number of body parts- Returns:
- a new Chimera with random traits
-
randomize
Randomly add appearance and power descriptors to a new Chimera creature with random body part adjectives. Produces a new Chimera with the specified name, and adds the specified total count (detail) of appearance adjectives, power adjectives and phrases, and the same count (detail) of body parts.- Parameters:
newName- the name to call the produced Chimeradetail- the number of adjectives and phrases to add, also the number of body parts- Returns:
- a new Chimera with random traits
-
randomize
Randomly add appearance and power descriptors to a new Chimera creature with random body part adjectives. Produces a new Chimera with a random name using FakeLanguageGen, and adds a total of 5 appearance adjectives, power adjectives and phrases, and 5 body parts.- Returns:
- a new Chimera with random traits
-
randomName
Gets a random name as a String using FakeLanguageGen.- Parameters:
rng- the EnhancedRandom to use for random factors- Returns:
- a String meant to be used as a creature name
-
randomName
Gets a random name as a String using FakeLanguageGen.- Returns:
- a String meant to be used as a creature name
-
getSerializersNeeded
Gets a List of Class instances that must each be registered with a serialization library before this object can be successfully serialized or deserialized. This isGwtIncompatible; none of the serialization libraries this is meant for have any support for GWT.- Specified by:
getSerializersNeededin interfacecom.github.yellowstonegames.core.ISerializersNeeded- Returns:
- a List of Class instances that must each be registered with a serialization library
-