server.brickblock.fwimpl
Class BBPlayer

java.lang.Object
  extended by server.framework.models.AbstractPlayer
      extended by server.brickblock.fwimpl.BBPlayer
All Implemented Interfaces:
java.lang.Comparable<AbstractPlayer>

public class BBPlayer
extends AbstractPlayer

BrickBlock's AbstractPlayer implemention. In addition to the attributes and functionality found in AbstractPlayer, this class contains information about the player's strength. In addition, this class offers functionality for handling a player's bonuses in terms of active Powerup objects.

Author:
Martin Jarrett, Eivind Sorteberg

Constructor Summary
BBPlayer(SocketWrapper socket, AbstractServer server, TestModule.TestType testtype)
          Creates a BBPlayer object with the specified attributes.
 
Method Summary
 java.util.List<Powerup> getInactivePowerups()
          Loops through the player's power up objects, and checks if any of the power ups have timed out.
 int getStrength()
          Returns the player's strength.
 void pickUpPowerup(Powerup powerup)
          Lets the player pick up a power up object, and sets the time for when this power up will be deactivated.
 void setStrength(int strength)
          Sets the player's strength.
 
Methods inherited from class server.framework.models.AbstractPlayer
compareTo, getAddress, getAttributeValues, getColor, getId, getName, getPosition, getPositionArray, getScore, getScreenResolution, getSessionId, getSize, getSocket, getSpeed, getTeam, increaseScore, lastAliveConfirmation, notifyAboutAlive, notifyAboutPlayerDisconnected, runTest, sendMessage, setAttributeValues, setName, setPosition, setPosition, setReady, setReady, setScore, setSessionId, setSize, setSpeed, setTeam, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BBPlayer

public BBPlayer(SocketWrapper socket,
                AbstractServer server,
                TestModule.TestType testtype)
Creates a BBPlayer object with the specified attributes. Calls the parent constructor and initialises the power up list.

Parameters:
socket - The player's SocketWrapper object.
server - The server model.
testtype - The test type, if any.
Method Detail

getStrength

public int getStrength()
Returns the player's strength.

Returns:
The player's strength.

setStrength

public void setStrength(int strength)
Sets the player's strength.

Parameters:
strength - The player's strength.

pickUpPowerup

public void pickUpPowerup(Powerup powerup)
Lets the player pick up a power up object, and sets the time for when this power up will be deactivated.

Parameters:
powerup - The picked up power up.

getInactivePowerups

public java.util.List<Powerup> getInactivePowerups()
Loops through the player's power up objects, and checks if any of the power ups have timed out. If so, those power ups are deactivated.

Returns:
The power ups that are deactivated.