Package squidpony
Class MonsterGen
java.lang.Object
squidpony.MonsterGen
public class MonsterGen extends Object
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.
Created by Tommy Ettinger on 1/31/2016.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MonsterGen.Chimera
A creature that can be mixed with other Chimeras or given additional descriptors, then printed in a usable format for game text. -
Field Summary
Fields Modifier and Type Field Description String[]
adjectives
String[]
components
static MonsterGen.Chimera
HAWK
static MonsterGen.Chimera
HORSE
static MonsterGen.Chimera
LION
String[]
powerAdjectives
String[]
powerPhrases
static MonsterGen.Chimera
SHOGGOTH
static MonsterGen.Chimera
SNAKE
static StatefulRNG
srng
-
Constructor Summary
Constructors Constructor Description MonsterGen()
Constructs a MonsterGen with a random seed for the default RNG.MonsterGen(long seed)
Constructs a MonsterGen with the given seed for the default RNG.MonsterGen(String seed)
Constructs a MonsterGen with the given seed (hashing seed with CrossHash) for the default RNG. -
Method Summary
Modifier and Type Method Description MonsterGen.Chimera
randomize()
Randomly add appearance and power descriptors to a new Chimera creature with random body part adjectives.MonsterGen.Chimera
randomize(String newName, int detail)
Randomly add appearance and power descriptors to a new Chimera creature with random body part adjectives.MonsterGen.Chimera
randomize(RNG rng, String newName, int detail)
Randomly add appearance and power descriptors to a new Chimera creature with random body part adjectives.MonsterGen.Chimera
randomizeAppearance(MonsterGen.Chimera creature, String newName, int adjectiveCount)
Randomly add appearance descriptors to a copy of the Chimera creature.MonsterGen.Chimera
randomizeAppearance(RNG rng, MonsterGen.Chimera creature, String newName, int adjectiveCount)
Randomly add appearance descriptors to a copy of the Chimera creature.MonsterGen.Chimera
randomizePowers(MonsterGen.Chimera creature, String newName, int powerCount)
Randomly add power descriptors to a copy of the Chimera creature.MonsterGen.Chimera
randomizePowers(RNG rng, MonsterGen.Chimera creature, String newName, int powerCount)
Randomly add power descriptors to a copy of the Chimera creature.String
randomName()
Gets a random name as a String using FakeLanguageGen.String
randomName(RNG rng)
Gets a random name as a String using FakeLanguageGen.
-
Field Details
-
Constructor Details
-
MonsterGen
public MonsterGen()Constructs a MonsterGen with a random seed for the default RNG. -
MonsterGen
Constructs a MonsterGen with the given seed for the default RNG. -
MonsterGen
Constructs a MonsterGen with the given seed (hashing seed with CrossHash) for the default RNG.
-
-
Method Details
-
randomizeAppearance
public MonsterGen.Chimera randomizeAppearance(RNG 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 RNG 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(RNG 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 RNG 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
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 RNG 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 RNG 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
-