Class KungFuMan

java.lang.Object
  extended by KungFuMan
Direct Known Subclasses:
KungFuFighter

public class KungFuMan
extends java.lang.Object


Field Summary
private  int defence
          Defence, combining with strength must not exceed 100.
private  int life
          Life point.
private  java.lang.Object opponent
          An opponent of this KungFuMan.
private  int recoverTimeFromOwnMove
          Heavier move requires longer time to recover.
private  int strength
          Strength, combining with defence must not exceed 100.
 
Constructor Summary
KungFuMan(java.lang.Object opponent)
           
 
Method Summary
 void attack(int attackType)
          Attack opponent with given type of attack (from 1 to 7).
 void attacked(int attackLevel)
          Reduce the life point after being attacked.
 int getDefence()
           
 int getLife()
           
 java.lang.Object getOpponent()
          Get a reference to the current opponent.
 int getRecoverTimeFromOwnMove()
           
 int getStrength()
           
 void move()
          If not recovering, always attack with attack type 3.
 void setDefence(int defence)
           
 void setLife(int life)
           
 void setOpponent(java.lang.Object opponent)
          Assign a given KungFuMan to be the current opponent.
 void setRecoverTimeFromOwnMove(int recoverTimeFromOwnMove)
           
 void setStrength(int strength)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

opponent

private java.lang.Object opponent
An opponent of this KungFuMan.


life

private int life
Life point.


strength

private int strength
Strength, combining with defence must not exceed 100.


defence

private int defence
Defence, combining with strength must not exceed 100.


recoverTimeFromOwnMove

private int recoverTimeFromOwnMove
Heavier move requires longer time to recover. While Recovering, the character cannot attack.

Constructor Detail

KungFuMan

public KungFuMan(java.lang.Object opponent)
Method Detail

getOpponent

public java.lang.Object getOpponent()
Get a reference to the current opponent.

Returns:
opponent.

setOpponent

public void setOpponent(java.lang.Object opponent)
Assign a given KungFuMan to be the current opponent.

Parameters:
opponent -

getLife

public int getLife()

setLife

public void setLife(int life)

getStrength

public int getStrength()

setStrength

public void setStrength(int strength)

getDefence

public int getDefence()

setDefence

public void setDefence(int defence)

getRecoverTimeFromOwnMove

public int getRecoverTimeFromOwnMove()

setRecoverTimeFromOwnMove

public void setRecoverTimeFromOwnMove(int recoverTimeFromOwnMove)

move

public void move()
If not recovering, always attack with attack type 3.


attacked

public void attacked(int attackLevel)
Reduce the life point after being attacked.

Parameters:
attackLevel - indicates the level of attack: 1 -> light 2-> medium 3 -> heavy

attack

public void attack(int attackType)
Attack opponent with given type of attack (from 1 to 7). Resulting in opponent calling method attacked().

Parameters:
attackType - the moves that this possesses.