# TrickCardGameObject (vilya 1.3 API)
Date: 2011-04-06

## com.threerings.parlor.card.trick.data
Interface TrickCardGameObject

All Superinterfaces:
  TurnGameObject

    public interface TrickCardGameObject

extends TurnGameObject

Game objects for trick-based card games must implement this interface.

Field Summary
`static int` `ACCEPTS_REMATCH` Indicates that the player has accepted the rematch request.
`static int` `BETWEEN_HANDS` The state that indicates the game is currently between hands.
`static int` `NO_REQUEST` Indicates that the player has not requested or accepted a rematch.
`static int` `PLAYING_HAND` The state that indicates the game is currently playing a hand.
`static int` `PLAYING_TRICK` The state that indicates the game is currently playing a trick.
`static int` `REQUESTS_REMATCH` Indicates that the player has requested a rematch.
`static int` `TRICK_STATE_COUNT` The number of states defined for the base trick card game object.

Fields inherited from interface com.threerings.parlor.turn.data.TurnGameObject
`TURN_HOLDER_REPLACED`

Method Summary
`PlayerCard[]` `getCardsPlayed()` Returns an array containing the history of the trick in terms of the cards played by each player.
`String` `getCardsPlayedFieldName()` Returns the name of the field that contains the history of the trick in terms of the cards played by each player.
`PlayerCard[]` `getLastCardsPlayed()` Returns an array containing the history of the last trick in terms of the cards played by each player.
`String` `getLastCardsPlayedFieldName()` Returns the name of the field that contains the history of the last trick in terms of the cards played by each player.
`int[]` `getRematchRequests()` Returns the array of rematch requests.
`String` `getRematchRequestsFieldName()` Returns the name of the field that contains the rematch requests.
`TrickCardGameMarshaller` `getTrickCardGameService()` Returns a reference to the trick card game service used to make requests to the server.
`int` `getTrickState()` Returns the trick state: between hands, playing a hand, or playing a trick.
`String` `getTrickStateFieldName()` Returns the name of the field that contains the trick state: between hands, playing a hand, or playing a trick.
`PlayerCard` `getTrickTaker()` Returns the card of the player who took the current trick.
`long` `getTurnDuration()` Returns the duration of the current turn, which may depend on the state of the game as well as the duration scale of the active player.
`float[]` `getTurnDurationScales()` Returns an array containing the turn duration scales for each player.
`boolean` `isCardPlayable(Hand hand, Card card)` Checks whether a user can play the specified card at this time.
`void` `setCardsPlayed(PlayerCard[] cardsPlayed)` Sets the array of cards played by each player.
`void` `setLastCardsPlayed(PlayerCard[] lastCardsPlayed)` Sets the last array of cards played by each player.
`void` `setRematchRequests(int[] rematchRequests)` Sets the array of rematch requests.
`void` `setRematchRequestsAt(int rematchRequest, int index)` Sets an element of the rematch request array.
`void` `setTrickCardGameService(TrickCardGameMarshaller trickCardGameService)` Sets the reference to the trick card game service.
`void` `setTrickState(int trickState)` Sets the trick state.
`void` `setTurnDurationScales(float[] turnDurationScales)` Sets the array of turn duration scales.
`void` `setTurnDurationScalesAt(float turnDurationScale, int index)` Sets an element of the array of turn duration scales.

Methods inherited from interface com.threerings.parlor.turn.data.TurnGameObject
`getPlayers, getTurnHolder, getTurnHolderFieldName, isInPlay, setTurnHolder`

Field Detail

### BETWEEN_HANDS

    static final int BETWEEN_HANDS

  The state that indicates the game is currently between hands.

  See Also:
    Constant Field Values

### PLAYING_HAND

    static final int PLAYING_HAND

  The state that indicates the game is currently playing a hand.

  See Also:
    Constant Field Values

### PLAYING_TRICK

    static final int PLAYING_TRICK

  The state that indicates the game is currently playing a trick.

  See Also:
    Constant Field Values

### TRICK_STATE_COUNT

    static final int TRICK_STATE_COUNT

  The number of states defined for the base trick card game object.

  See Also:
    Constant Field Values

### NO_REQUEST

    static final int NO_REQUEST

  Indicates that the player has not requested or accepted a rematch.

  See Also:
    Constant Field Values

### REQUESTS_REMATCH

    static final int REQUESTS_REMATCH

  Indicates that the player has requested a rematch.

  See Also:
    Constant Field Values

### ACCEPTS_REMATCH

    static final int ACCEPTS_REMATCH

  Indicates that the player has accepted the rematch request.

  See Also:
    Constant Field Values

Method Detail

### getTrickCardGameService

    TrickCardGameMarshaller getTrickCardGameService()

  Returns a reference to the trick card game service used to make requests to the server.

  Returns:
    a reference to the trick card game service

### setTrickCardGameService

    void setTrickCardGameService(TrickCardGameMarshaller trickCardGameService)

  Sets the reference to the trick card game service.

  Parameters:
    `trickCardGameService` - the trick card game service

### getTrickStateFieldName

    String getTrickStateFieldName()

  Returns the name of the field that contains the trick state: between hands, playing a hand, or playing a trick.

  Returns:
    the name of the trickState field

### getTrickState

    int getTrickState()

  Returns the trick state: between hands, playing a hand, or playing a trick.

  Returns:
    the trick state

### setTrickState

    void setTrickState(int trickState)

  Sets the trick state.

  Parameters:
    `trickState` - the trick state

### getTurnDurationScales

    float[] getTurnDurationScales()

  Returns an array containing the turn duration scales for each player. Turn duration scales decrease each time players time out.

  Returns:
    the array of turn duration scales

### setTurnDurationScales

    void setTurnDurationScales(float[] turnDurationScales)

  Sets the array of turn duration scales.

  Parameters:
    `turnDurationScales` - the array of turn duration scales

### setTurnDurationScalesAt

    void setTurnDurationScalesAt(float turnDurationScale,
                                 int index)

  Sets an element of the array of turn duration scales.

  Parameters:
    `turnDurationScale` - the turn duration scale
    `index` - the index of the turn duration scale

### getTurnDuration

    long getTurnDuration()

  Returns the duration of the current turn, which may depend on the state of the game as well as the duration scale of the active player.

### getCardsPlayedFieldName

    String getCardsPlayedFieldName()

  Returns the name of the field that contains the history of the trick in terms of the cards played by each player.

  Returns:
    the name of the cardsPlayed field

### getCardsPlayed

    PlayerCard[] getCardsPlayed()

  Returns an array containing the history of the trick in terms of the cards played by each player.

  Returns:
    the cards played so far in the trick

### setCardsPlayed

    void setCardsPlayed(PlayerCard[] cardsPlayed)

  Sets the array of cards played by each player.

  Parameters:
    `cardsPlayed` - the array of cards played

### getLastCardsPlayedFieldName

    String getLastCardsPlayedFieldName()

  Returns the name of the field that contains the history of the last trick in terms of the cards played by each player.

  Returns:
    the name of the lastCardsPlayed field

### getLastCardsPlayed

    PlayerCard[] getLastCardsPlayed()

  Returns an array containing the history of the last trick in terms of the cards played by each player.

  Returns:
    the cards played in the last trick

### setLastCardsPlayed

    void setLastCardsPlayed(PlayerCard[] lastCardsPlayed)

  Sets the last array of cards played by each player.

  Parameters:
    `lastCardsPlayed` - the last array of cards played

### getRematchRequestsFieldName

    String getRematchRequestsFieldName()

  Returns the name of the field that contains the rematch requests.

  Returns:
    the name of the rematchRequests field

### getRematchRequests

    int[] getRematchRequests()

  Returns the array of rematch requests.

  Returns:
    the array of rematch requests

### setRematchRequests

    void setRematchRequests(int[] rematchRequests)

  Sets the array of rematch requests.

  Parameters:
    `rematchRequests` - the array of rematch requests

### setRematchRequestsAt

    void setRematchRequestsAt(int rematchRequest,
                              int index)

  Sets an element of the rematch request array.

  Parameters:
    `rematchRequest` - the rematch request value
    `index` - the index at which to set the value

### isCardPlayable

    boolean isCardPlayable(Hand hand,
                           Card card)

  Checks whether a user can play the specified card at this time.

  Parameters:
    `hand` - the player's hand
    `card` - the card that the user would like to play

### getTrickTaker

    PlayerCard getTrickTaker()

  Returns the card of the player who took the current trick.

Copyright © 2011. All Rights Reserved.