Class Champion

java.lang.Object
me.simulation.players.Champion
All Implemented Interfaces:
DefaultRequired
Direct Known Subclasses:
Elf, Human, Kit, Ork

public abstract class Champion extends Object implements DefaultRequired
Represents an abstract Champion in the simulation. Implements the DefaultRequired interface.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Champion(String type, int x_index, int y_index)
    Constructs a Champion object with the specified type, x index, and y index.
    Champion(String type, int level, int maxhp, int hp, int strength, int range, int luck, boolean move, boolean has_shield, boolean has_sword, int x_index, int y_index, boolean regeneration)
    Constructs a Champion object with the specified attributes.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Retrieves the current hit points of the Champion.
    int
    Retrieves the level of the Champion.
    int
    Retrieves the luck factor of the Champion.
    int
    Retrieves the maximum hit points of the Champion.
    boolean
    Retrieves the move status of the Champion.
    int
    Retrieves the attack range of the Champion.
    boolean
    Returns the status of the champion's regeneration.
    boolean
    Returns the status of the champion's shield.
    int
    Retrieves the strength of the Champion.
    boolean
    Retrieves the availability of a sword for the Champion.
    Retrieves the type of the Champion.
    int
    Retrieves the x index position of the Champion.
    int
    Retrieves the y index position of the Champion.
    void
    Increases the level of the Champion.
    void
    newIndex(int newY, int newX)
    Updates the champion's position with new indices.
    void
    setHp(int change)
    Sets the current hit points of the Champion.
    void
    setLuck(int luck)
    Sets the luck factor of the Champion.
    void
    setMaxHp(int maxhp)
    Sets the maximum hit points of the Champion.
    void
    setMove(boolean value)
    Sets the move status of the Champion.
    void
    setRegeneration(boolean regen)
    Sets the status of the champion's regeneration.
    void
    setShield(boolean has_shield)
    Sets the status of the champion's shield.
    void
    setStrength(int power)
    Sets the strength of the Champion.
    void
    setSword(boolean has_sword)
    Sets the status of the champion's sword.
    void
    takeDMG(int strength, int level, int range, int luck)
    Simulates the Champion taking damage based on various factors.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface me.simulation.game.DefaultRequired

    getLvl
  • Constructor Details

    • Champion

      public Champion(String type, int x_index, int y_index)
      Constructs a Champion object with the specified type, x index, and y index.
      Parameters:
      type - the type of the Champion
      x_index - the x index position of the Champion
      y_index - the y index position of the Champion
    • Champion

      public Champion(String type, int level, int maxhp, int hp, int strength, int range, int luck, boolean move, boolean has_shield, boolean has_sword, int x_index, int y_index, boolean regeneration)
      Constructs a Champion object with the specified attributes.
      Parameters:
      type - the type of the Champion
      level - the level of the Champion
      maxhp - the maximum hit points of the Champion
      hp - the current hit points of the Champion
      strength - the strength of the Champion
      range - the attack range of the Champion
      luck - the luck factor of the Champion
      move - indicates if the Champion can move
      has_shield - indicates if the Champion has a shield
      has_sword - indicates if the Champion has a sword
      x_index - the x index position of the Champion
      y_index - the y index position of the Champion
      regeneration - indicates if the Champion has regeneration ability
  • Method Details

    • newIndex

      public void newIndex(int newY, int newX)
      Updates the champion's position with new indices.
      Specified by:
      newIndex in interface DefaultRequired
      Parameters:
      newY - the new y-coordinate index
      newX - the new x-coordinate index
    • getMove

      public boolean getMove()
      Retrieves the move status of the Champion.
      Specified by:
      getMove in interface DefaultRequired
      Returns:
      true if the Champion can move, false otherwise
    • setMove

      public void setMove(boolean value)
      Sets the move status of the Champion.
      Specified by:
      setMove in interface DefaultRequired
      Parameters:
      value - the move status of the Champion
    • getType

      public String getType()
      Retrieves the type of the Champion.
      Specified by:
      getType in interface DefaultRequired
      Returns:
      the type of the Champion
    • getX_index

      public int getX_index()
      Retrieves the x index position of the Champion.
      Specified by:
      getX_index in interface DefaultRequired
      Returns:
      the x index position of the Champion
    • getY_index

      public int getY_index()
      Retrieves the y index position of the Champion.
      Specified by:
      getY_index in interface DefaultRequired
      Returns:
      the y index position of the Champion
    • getStrength

      public int getStrength()
      Retrieves the strength of the Champion.
      Specified by:
      getStrength in interface DefaultRequired
      Returns:
      the strength of the Champion
    • setStrength

      public void setStrength(int power)
      Sets the strength of the Champion.
      Parameters:
      power - the strength of the Champion
    • getRange

      public int getRange()
      Retrieves the attack range of the Champion.
      Specified by:
      getRange in interface DefaultRequired
      Returns:
      the attack range of the Champion
    • getLuck

      public int getLuck()
      Retrieves the luck factor of the Champion.
      Specified by:
      getLuck in interface DefaultRequired
      Returns:
      the luck factor of the Champion
    • setLuck

      public void setLuck(int luck)
      Sets the luck factor of the Champion.
      Parameters:
      luck - the luck factor of the Champion
    • getHp

      public int getHp()
      Retrieves the current hit points of the Champion.
      Specified by:
      getHp in interface DefaultRequired
      Returns:
      the current hit points of the Champion
    • setHp

      public void setHp(int change)
      Sets the current hit points of the Champion.
      Parameters:
      change - the new current hit points of the Champion
    • takeDMG

      public void takeDMG(int strength, int level, int range, int luck)
      Simulates the Champion taking damage based on various factors.
      Parameters:
      strength - the strength factor for calculating damage
      level - the level of the Champion
      range - the attack range of the Champion
      luck - the luck factor for calculating damage
    • getMaxHp

      public int getMaxHp()
      Retrieves the maximum hit points of the Champion.
      Specified by:
      getMaxHp in interface DefaultRequired
      Returns:
      the maximum hit points of the Champion
    • setMaxHp

      public void setMaxHp(int maxhp)
      Sets the maximum hit points of the Champion.
      Parameters:
      maxhp - the maximum hit points of the Champion
    • getLevel

      public int getLevel()
      Retrieves the level of the Champion.
      Specified by:
      getLevel in interface DefaultRequired
      Returns:
      the level of the Champion
    • increaseLevel

      public void increaseLevel()
      Increases the level of the Champion.
    • getSword

      public boolean getSword()
      Retrieves the availability of a sword for the Champion.
      Specified by:
      getSword in interface DefaultRequired
      Returns:
      true if the Champion has a sword, false otherwise
    • setSword

      public void setSword(boolean has_sword)
      Sets the status of the champion's sword.
      Parameters:
      has_sword - the status of the sword to set
    • getShield

      public boolean getShield()
      Returns the status of the champion's shield.
      Specified by:
      getShield in interface DefaultRequired
      Returns:
      true if the champion has a shield, false otherwise
    • setShield

      public void setShield(boolean has_shield)
      Sets the status of the champion's shield.
      Parameters:
      has_shield - the status of the shield to set
    • getRegeneration

      public boolean getRegeneration()
      Returns the status of the champion's regeneration.
      Specified by:
      getRegeneration in interface DefaultRequired
      Returns:
      true if the champion has regeneration, false otherwise
    • setRegeneration

      public void setRegeneration(boolean regen)
      Sets the status of the champion's regeneration.
      Parameters:
      regen - the status of the regeneration to set