Class ServerRobot

java.lang.Object
za.co.wethinkcode.robots.server.serverRobot.ServerRobot
All Implemented Interfaces:
WorldObject, Robot
Direct Known Subclasses:
BoringServerBot

public abstract class ServerRobot extends Object implements WorldObject, Robot
Server ClientRobot class. Will evaluate as logically equal to a client robot if they have the same name
  • Field Details

  • Constructor Details

    • ServerRobot

      public ServerRobot()
      Empty Constructor for the server robots
    • ServerRobot

      public ServerRobot(String name, RobotKind kind, Integer maxShieldStrength, Integer maximumShots, WorldState worldState) throws WorldFullException
      Best constructor for server side bots that allows for spawn finding
      Parameters:
      name - name of the bot
      kind - kind of bot
      maxShieldStrength - maximum shield Strength of the robot
      maximumShots - maximum shield Strength of the robot
      worldState - worldState to find a spawn point
      Throws:
      WorldFullException
    • ServerRobot

      public ServerRobot(String name, RobotKind kind, Integer maxShieldStrength, Integer maximumShots)
      Constructor overload for building a Server robot from its kind, shieldStrength and Maximum shots
      Parameters:
      kind - what kind of robot it is
      maxShieldStrength - maximum shieldStrength of this bot
      maximumShots - maximum number of shots this server bot has
  • Method Details

    • setState

      public void setState(RobotState robotState)
      Easy setter for updating a robot's state
      Parameters:
      robotState - the state that is being changed to
    • getRobotStatus

      public RobotStatus getRobotStatus()
      Standard getter for a server robot's status
      Specified by:
      getRobotStatus in interface Robot
      Returns:
      this serverRobot's RobotStatus
    • setRobotStatus

      public void setRobotStatus(RobotStatus robotStatus)
      Setter for a server robot's status
      Parameters:
      robotStatus - a RobotStatus
    • getRobotState

      public RobotState getRobotState()
      Getter for the robot's state
      Returns:
      the robot's state
    • equals

      public boolean equals(Object o)
      allows Direct Comparison between Server Robot and Client Robot
      Overrides:
      equals in class Object
      Parameters:
      o - objects being compared
      Returns:
      if they are truly equal
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getType

      public WorldObject.WorldObjectType getType()
      Get the type of this server bot
      Specified by:
      getType in interface WorldObject
      Returns:
      always returns robot
    • getRobotKind

      public RobotKind getRobotKind()
      Description copied from interface: Robot
      Gets the kind of robot that this robot is
      Specified by:
      getRobotKind in interface Robot
      Returns:
      which kind of robot this is