Class NPCFactory

java.lang.Object
com.csse3200.game.entities.factories.NPCFactory

public class NPCFactory extends Object
Factory to create non-playable character (NPC) entities with predefined components.

Each NPC entity type should have a creation method that returns a corresponding entity. Predefined entity properties can be loaded from configs stored as json files which are defined in "NPCConfigs".

If needed, this factory can be separated into more specific factories for entities with similar characteristics.

  • Method Details

    • createCow

      public static Entity createCow(Entity target, List<Entity> enemies)
      Creates a Cow NPC, configures its behavior based on the provided target and enemies, and handles any conditional drops specific to the Cow NPC.
      Parameters:
      target - The entity that the Cow NPC will assist or follow.
      enemies - A list of enemy entities that the Cow NPC will be aware of or react to.
      Returns:
      A new Cow NPC entity with the appropriate behavior and configurations, including handling conditional item drops.
    • createFish

      public static Entity createFish(Entity target, List<Entity> enemies)
      Creates a Fish NPC, configures its behavior based on the provided target and enemies, and handles any conditional drops specific to the Fish NPC.
      Parameters:
      target - The entity that the Fish NPC will assist or follow.
      enemies - A list of enemy entities that the Fish NPC will be aware of or react to.
      Returns:
      A new Fish NPC entity with the appropriate behavior and configurations, including handling conditional item drops.
    • createLion

      public static Entity createLion(Entity target, List<Entity> enemies)
      Creates a Lion NPC and configures its behavior based on the provided target and enemies.
      Parameters:
      target - The entity that the Lion NPC will assist or follow.
      enemies - A list of enemy entities that the Lion NPC will be aware of or react to.
      Returns:
      A new Lion NPC entity with the appropriate behavior and configurations.
    • createTurtle

      public static Entity createTurtle(Entity target, List<Entity> enemies)
      Creates a Turtle NPC and configures its behavior based on the provided target and enemies.
      Parameters:
      target - The entity that the Turtle NPC will assist or follow.
      enemies - A list of enemy entities that the Turtle NPC will be aware of or react to.
      Returns:
      A new Turtle NPC entity with the appropriate behavior and configurations.
    • createEagle

      public static Entity createEagle(Entity target, List<Entity> enemies)
      Creates an Eagle NPC and configures its behavior based on the provided target and enemies.
      Parameters:
      target - The entity that the Eagle NPC will assist or follow.
      enemies - A list of enemy entities that the Eagle NPC will be aware of or react to.
      Returns:
      A new Eagle NPC entity with the appropriate behavior and configurations.
    • createSnake

      public static Entity createSnake(Entity target, List<Entity> enemies)
      Creates a Snake NPC and configures its behavior based on the provided target and enemies.
      Parameters:
      target - The entity that the Snake NPC will assist or follow.
      enemies - A list of enemy entities that the Snake NPC will be aware of or react to.
      Returns:
      A new Snake NPC entity with the appropriate behavior and configurations.
    • createMagpie

      public static Entity createMagpie(Entity target, List<Entity> enemies)
      Creates a Magpie NPC and configures its behavior based on the provided target and enemies.
      Parameters:
      target - The entity that the Magpie NPC will assist or follow.
      enemies - A list of enemy entities that the Magpie NPC will be aware of or react to.
      Returns:
      A new Magpie NPC entity with the appropriate behavior and configurations.
    • createChicken

      public static Entity createChicken(Entity target, List<Entity> enemies)
      Creates a Chicken NPC and configures its behavior based on the provided target and enemies.
      Parameters:
      target - The entity that the Chicken NPC will assist or follow.
      enemies - A list of enemy entities that the Chicken NPC will be aware of or react to.
      Returns:
      A new Chicken NPC entity with the appropriate behavior and configurations.
    • createFrog

      public static Entity createFrog(Entity target, List<Entity> enemies)
      Creates a Frog NPC and configures its behavior based on the provided target and enemies.
      Parameters:
      target - The entity that the Frog NPC will assist or follow.
      enemies - A list of enemy entities that the Frog NPC will be aware of or react to.
      Returns:
      A new Frog NPC entity with the appropriate behavior and configurations.
    • createMonkey

      public static Entity createMonkey(Entity target, List<Entity> enemies)
      Creates a Monkey NPC and configures its behavior based on the provided target and enemies.
      Parameters:
      target - The entity that the Monkey NPC will assist or follow.
      enemies - A list of enemy entities that the Monkey NPC will be aware of or react to.
      Returns:
      A new Monkey NPC entity with the appropriate behavior and configurations.
    • createBear

      public static Entity createBear(Entity target, List<Entity> enemies)
      Creates a Bear NPC and configures its behavior based on the provided target and enemies.
      Parameters:
      target - The entity that the Bear NPC will assist or follow.
      enemies - A list of enemy entities that the Bear NPC will be aware of or react to.
      Returns:
      A new Bear NPC entity with the appropriate behavior and configurations.
    • createEel

      public static Entity createEel(Entity target, List<Entity> enemies)
    • createOctopus

      public static Entity createOctopus(Entity target, List<Entity> enemies)
    • createBee

      public static Entity createBee(Entity target, List<Entity> enemies)
    • createPigeon

      public static Entity createPigeon(Entity target, List<Entity> enemies)
    • createBigsawfish

      public static Entity createBigsawfish(Entity target, List<Entity> enemies)
    • createMacaw

      public static Entity createMacaw(Entity target, List<Entity> enemies)
    • initiateDialogue

      public static void initiateDialogue(String[] animalSoundPaths, String[][] hintText)
      Initiates a dialogue by updating the dialogue box with the given text and optionally playing sounds. If the dialogue box service is not available, it creates a new instance.
      Parameters:
      animalSoundPaths - An array of sound asset paths to play. If null or empty, no sounds are played.
      hintText - An array of strings to display in the dialogue box.
    • initiateDialogue

      public static void initiateDialogue(String[] animalSoundPaths, String[][] hintText, Entity entity)
      Initiates a dialogue by updating the dialogue box with the given text and optionally playing sounds. If the dialogue box service is not available, it creates a new instance.
      Parameters:
      animalSoundPaths - An array of sound asset paths to play. If null or empty, no sounds are played.
      hintText - An array of strings to display in the dialogue box.
      entity - The entity to highlight
    • endDialogue

      public static void endDialogue()
      Ends a dialogue and takes it off the screen
    • createFirefly

      public static Entity createFirefly()