|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectKungFuMan
public class KungFuMan
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 |
---|
private java.lang.Object opponent
private int life
private int strength
private int defence
private int recoverTimeFromOwnMove
Constructor Detail |
---|
public KungFuMan(java.lang.Object opponent)
Method Detail |
---|
public java.lang.Object getOpponent()
public void setOpponent(java.lang.Object opponent)
opponent
- public int getLife()
public void setLife(int life)
public int getStrength()
public void setStrength(int strength)
public int getDefence()
public void setDefence(int defence)
public int getRecoverTimeFromOwnMove()
public void setRecoverTimeFromOwnMove(int recoverTimeFromOwnMove)
public void move()
public void attacked(int attackLevel)
attackLevel
- indicates the level of attack: 1 -> light 2-> medium 3 ->
heavypublic void attack(int attackType)
attackType
- the moves that this possesses.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |