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 .
  • Field Details

  • 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

      public MonsterGen(String seed)
      Constructs a MonsterGen with the given seed (hashing seed with Hasher.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 factors
      creature - the Chimera to add descriptors to
      newName - the name to call the produced Chimera
      adjectiveCount - 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 to
      newName - the name to call the produced Chimera
      adjectiveCount - 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 factors
      creature - the Chimera to add descriptors to
      newName - the name to call the produced Chimera
      powerCount - 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 to
      newName - the name to call the produced Chimera
      powerCount - 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 factors
      newName - the name to call the produced Chimera
      detail - the number of adjectives and phrases to add, also the number of body parts
      Returns:
      a new Chimera with random traits
    • randomize

      public MonsterGen.Chimera randomize(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:
      newName - the name to call the produced Chimera
      detail - the number of adjectives and phrases to add, also the number of body parts
      Returns:
      a new Chimera with random traits
    • randomize

      public MonsterGen.Chimera 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

      public String randomName(com.github.tommyettinger.random.EnhancedRandom rng)
      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

      public String randomName()
      Gets a random name as a String using FakeLanguageGen.
      Returns:
      a String meant to be used as a creature name
    • getSerializersNeeded

      public List<Class<?>> 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 is GwtIncompatible; none of the serialization libraries this is meant for have any support for GWT.
      Specified by:
      getSerializersNeeded in interface com.github.yellowstonegames.core.ISerializersNeeded
      Returns:
      a List of Class instances that must each be registered with a serialization library