|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object
|
+--au.com.solidsoftware.multimahjong.mmc.game.Player
|
+--au.com.solidsoftware.multimahjong.mmc.game.Human
The Human class represents the user on the MMC of the current
game thread. All moves that require input from the user are made through this
inherited class of the Player, and the requests are run in the
UserGUI.
The class will perform two important input functions from the user. The first
is to retrieve a discard tile. Once a move has been selected the Tile is
inserted into the Moves class and is passed to the
Game to handle the action. The player is prompted for moves
until a discard tile has been selected.
The second important function is the search for possible moves with the last
discarded tile. The player's Hand is searched for possible moves
and if it is possible, Human will need to enable the
corresponding button in the ActionPane. The checks that need to
be made are draw tile, Chow(2 sides, 2 up, 2 down), Pung, Kong and if the
Player is fishing, Mahjong. The user will then need to make
their selection. This is retrieved and sent back to the Game.
| Field Summary | |
static int |
ALL_CHOW
|
private int[] |
chow
List of different Chows that the player can make |
static int |
FIRST2CHOW
|
private HumanDiscard |
humanDiscard
Class used for interaction with the UserGUI to retrieve discard selections |
private HumanSelection |
humanSelection
Class used for interaction with the UserGUI to retrieve the users selection on the next move with the last player's discard |
static int |
LAST2CHOW
|
static int |
LEFT_CHOW
|
static int |
MID_CHOW
|
static int |
RIGHT_CHOW
|
static int |
SPLIT_CHOW
|
| Fields inherited from class au.com.solidsoftware.multimahjong.mmc.game.Player |
CHOW2DOWN,
CHOW2SIDES,
CHOW2UP,
DECLARED_KONG,
DISCARD,
EAST,
EITHER_MOVE,
EXTEND_PUNG,
icon,
isFishing,
KONG,
MAHJONG,
name,
NO_MOVE,
NORTH,
NOT_ROBBED,
payout,
PICKUP,
playArea,
playerHand,
playerId,
PUNG,
ROBBED_KONG,
score,
selectedTile,
SOUTH,
standingHand,
userGUI,
WEST,
wind,
WONT_ROB |
| Constructor Summary | |
Human(java.lang.String name,
javax.swing.ImageIcon icon,
int score,
int playerId)
Initialises the Player's name, icon
and inserts the initial score. |
|
| Method Summary | |
int |
determineCanRob(Tile selectedTile)
Determines whether the Player can rob the Kong with the
given tile. |
int |
getDiscard(boolean playerFishing,
Moves currentMove)
Retrieves the discard or special Kong move from the current player. |
int |
getPlayerSelection(Tile lastDiscard,
int next)
Displays all the selections that the player can make for their next move. |
int |
multipleChow()
Returns a value that represents to the UserGUI the location
of and the number of different Chow selections that are possible. |
void |
setMove(Tile tile,
int move)
Inserts a selected move made by the player from the UserGUI. |
void |
setSelection(int move)
Inserts the selected move that a player has chosen with the last discarded tile if it is possible. |
| Methods inherited from class au.com.solidsoftware.multimahjong.mmc.game.Player |
checkFishing,
checkKong,
checkMahjong,
checkPung2Kong,
declareKong,
discard,
findKong,
findPung2Kong,
getIcon,
getId,
getName,
getScore,
getWind,
initPlayer,
insertTile,
insertTile,
isStandingHand,
mahjong,
notStandingHand,
robbedKong,
runChow,
runKong,
runMahjong,
runPung,
runPung2Kong,
setIcon,
setName,
setPlayArea,
setPlayArea,
setScore,
setWind |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
public static final int LEFT_CHOW
public static final int MID_CHOW
public static final int RIGHT_CHOW
public static final int FIRST2CHOW
public static final int SPLIT_CHOW
public static final int LAST2CHOW
public static final int ALL_CHOW
private HumanDiscard humanDiscard
private HumanSelection humanSelection
private int[] chow
| Constructor Detail |
public Human(java.lang.String name,
javax.swing.ImageIcon icon,
int score,
int playerId)
Player's name, icon
and inserts the initial score.
name - Name of the player.icon - Player's selected icon.score - Initial score of the player.playerId - Player's ID.| Method Detail |
public int getDiscard(boolean playerFishing,
Moves currentMove)
HumanDiscard class to retrieve the player's selection. If
the selection can be run (i.e. not Pung2Kong and fishing) then it will be
directly run from this function before leaving.playerFishing - True if any player is fishing in the game.currentMove - Storage for player's selected move.public int determineCanRob(Tile selectedTile)
Player can rob the Kong with the
given tile. If this is the case then the user will be prompted to select
whether they wish to rob the Kong.selectedTile - Tile that has the potential to be robbed.
public int getPlayerSelection(Tile lastDiscard,
int next)
Hand are: Chow2Down, Chow2Sides, Chow2Up, Pung,
Kong and Mahjong. A flag is sent from the Game if the player
can pickup from the Wall. If a choice is possible then the
function will move to the HumanSelection class to retrieve
the selection. Before exiting the function disables the
ActionPane.lastDiscard - Last discarded tile.next - Flag that indicates whether this player can draw a tile.
public void setMove(Tile tile,
int move)
UserGUI.tile - Tile selected by the player.move - Move selected by the player.public void setSelection(int move)
move - Selection made by the player.public int multipleChow()
UserGUI the location
of and the number of different Chow selections that are possible. If
a multiple number of different selections are possible then the
player will need to be prompted to choose one of the selections that
can be made.
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||