|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.ObjectPlayer
public class Player
| Field Summary | |
|---|---|
private Ship |
Battleship1
|
private Ship |
Battleship2
|
private Ship |
Carrier1
|
private Ship |
Carrier2
|
private Ship |
Destroyer1
|
private Ship |
Destroyer2
|
private Turn |
hit
|
private int |
mode
|
private Ship |
PTBoat1
|
private Ship |
PTBoat2
|
private Ship |
Submarine1
|
private Ship |
Submarine2
|
| Constructor Summary | |
|---|---|
Player(int who,
Grid gridO)
The Player class is sued to setup the ships for each player,also is sued to shoot and attack other players ships and as well is used to detract the ships health |
|
| Method Summary | |
|---|---|
int |
aiAttack(Grid gridO)
Used to incorporate the Artifical Intelligence attack, basically the brain behind the operation |
int |
GameOver(int player)
Used to determine when the game is over or not |
int |
getMode()
Used to get the attack mode of the AI |
int |
getShipHp(int type)
used to return the HP of the ship determined by the type of ship passed in |
int |
guiSetupShips(Grid gridO,
int play,
int type,
int x,
int y,
int o)
Used to setup the ships for the gui front end |
void |
setMode(int m)
Used to set the attack mode of the AI |
int |
shipID(java.lang.String BoatHit)
Used to ID the ship that was hit and to deduct its headpoints |
int |
shipID2(java.lang.String BoatHit)
Used to ID the ship that was hit and to deduct its headpoints |
int |
shootShips(int player,
Grid gridO,
int height,
int length,
int row,
int col)
Used to fire at ships from variables being passed from the main game class |
int |
showShip(int shipT)
Used to show the ship status of the computers ships |
int |
showShip2(int shipT)
Used to show the ship status of the computers ships |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private Ship Carrier1
private Ship Carrier2
private Ship Battleship1
private Ship Battleship2
private Ship Submarine1
private Ship Submarine2
private Ship Destroyer1
private Ship Destroyer2
private Ship PTBoat1
private Ship PTBoat2
private Turn hit
private int mode
| Constructor Detail |
|---|
public Player(int who,
Grid gridO)
who - - determines the player coming into the constructorgridO - - Determines which player grid to use to setup ships| Method Detail |
|---|
public int shootShips(int player,
Grid gridO,
int height,
int length,
int row,
int col)
player - - This is used to determine which player is shootinggridO - - This is used to determine which grid to shot onheight - - this is the height of the gridlength - - this is the length of the gridrow - - this is the row coordinate to shoot atcol - - this is the column coordinate to shoot at
public int GameOver(int player)
player - - Which player to check for
public int aiAttack(Grid gridO)
gridO - - The grid used to attack
public int shipID(java.lang.String BoatHit)
BoatHit - - Used to identify the boat that was hit
public int shipID2(java.lang.String BoatHit)
BoatHit - - Used to identify the boat that was hit
public void setMode(int m)
m - - Used to set the attack mode, 0 for off and 1 for onpublic int getMode()
public int showShip(int shipT)
shipT - - The ship type being checked on
public int showShip2(int shipT)
shipT - - The ship type being checked on
public int guiSetupShips(Grid gridO,
int play,
int type,
int x,
int y,
int o)
gridO - - The grid to set the ships ontype - - the type of ship that needs to be setupx - - the row coordinate for the starting spoty - - the column coordinate for the starting spoto - - the orientation for the ship, vertical or horizontal
public int getShipHp(int type)
type - - the tye of ship that needs to be checked
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||