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

  • Constructor Details

    • MonsterGen

      public MonsterGen()
      Constructs a MonsterGen with a random seed for the default RNG.
    • MonsterGen

      public MonsterGen​(long seed)
      Constructs a MonsterGen with the given seed for the default RNG.
    • MonsterGen

      public MonsterGen​(String seed)
      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 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​(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 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​(RNG 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 RNG 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

      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​(RNG rng)
      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

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