edu.lmu.lmusleuth
Interface GameChangeListener

All Known Subinterfaces:
Game
All Known Implementing Classes:
ClientConnection, ServerConnection

public interface GameChangeListener

Interface that receives updates when changes occur to a game. Implementors of this interface generally desire to be notified of changes to the state of some Game or another. When the actions noted below occur, the Game calls each registered listener in turn notifying them of the event.


Method Summary
 void askRefute(Game g, Player p, Evidence.Suspect who, Evidence.Room where, Evidence.Weapon what)
          The player is being asked if they can refute the evidence.
 void assertion(Game g, Player p, Evidence.Suspect who, Evidence.Room where, Evidence.Weapon what)
          The player is attempting to win the game.
 void beginTurn(Game g, Player p)
          A player's turn has begun.
 void chat(Game g, Player p, java.lang.String message)
          The player has sent a public chat message.
 void clearStartVotes(Game g)
          All start votes have been set back to 'false'.
 void endTurn(Game g, Player p)
          A player's turn has ended.
 void hypothesis(Game g, Player p, Evidence.Suspect who, Evidence.Room where, Evidence.Weapon what)
          The player has posed the given hypothesis.
 void lose(Game g, Player p)
          A player has lost the game.
 void move(Game g, Evidence.Suspect s, Location l)
          A suspect has moved to a new location in the game.
 void newPlayer(Game g, Player p)
          A player has joined the game.
 void newPlayerSuspect(Game g, Player p, Evidence.Suspect s)
          A player has selected a new Suspect to play as.
 void playerQuit(Game g, Player p)
          A player has quit the game.
 void refuted(Game g, Player p, Evidence.Suspect who, Evidence.Room where, Evidence.Weapon what)
          The player has refuted the hypothesis/assertion with an unknown piece of evidence.
 void refuted(Game g, Player p, Evidence.Suspect who, Evidence.Room where, Evidence.Weapon what, Evidence by)
          The player has refuted the hypothesis/assertion with the piece of evidence.
 void spin(Game g, Player p)
          A player has spun the spinner in order to get their movement.
 void spin(Game g, Player p, int spin)
          A player has spun the spinner with the given result.
 void unableToRefute(Game g, Player p, Evidence.Suspect who, Evidence.Room where, Evidence.Weapon what)
          The player has failed to refute the hypothesis/assertion.
 void voteStart(Game g, Player p, boolean vote)
          A player has changed their vote that the game should start.
 void win(Game g, Player p)
          A player has won the game.
 

Method Detail

win

public void win(Game g,
                Player p)
A player has won the game. The named player is the victor. All spoils shall inure to his or her benefit. All others must bow down and pay homage to his or her superior deductive skills.

Parameters:
g - the Game that this change applies to
p - the Player that won the game

lose

public void lose(Game g,
                 Player p)
A player has lost the game. This method will not necessarily be called once for every player in the game at the end of the game, rather it is intended to be called when a player makes a failed assertion and they must then sit out the remainder of the game.

Parameters:
g - the Game that this change applies to
p - the Player that lost the game

newPlayer

public void newPlayer(Game g,
                      Player p)
A player has joined the game. The given player has just joined the given game. This method should be closely followed by a call to newPlayerSuspect or playerQuit.

Parameters:
g - the Game that this change applies to
p - the Player that joined the game
See Also:
playerQuit(Game, Player), newPlayerSuspect(Game, Player, Evidence.Suspect)

playerQuit

public void playerQuit(Game g,
                       Player p)
A player has quit the game.

Parameters:
g - the Game that this change applies to
p - the Player that quit the game

newPlayerSuspect

public void newPlayerSuspect(Game g,
                             Player p,
                             Evidence.Suspect s)
A player has selected a new Suspect to play as. This changes or assigns the suspect that a player will be playing as.

Parameters:
g - the Game that this change applies to
p - the Player who is changing or assigning their suspect
s - the Suspect that the Player will now be playing as

voteStart

public void voteStart(Game g,
                      Player p,
                      boolean vote)
A player has changed their vote that the game should start. This method is called when a player makes a vote one way or the other as to whether or not the game should start. When all players have voted that the game should start, the game may commence.

Parameters:
g - the Game that this change applies to
p - the Player who is changing/setting their vote
vote - the vote, true/yes/start or false/no/don't-start.
See Also:
clearStartVotes(Game)

clearStartVotes

public void clearStartVotes(Game g)
All start votes have been set back to 'false'. Due to some change in the global game state, such as a new player joining, or a player changing suspect, all votes for the start of the game have been set back to false. It is up to each player to re-affirm their desire for the game to begin.

Parameters:
g - the Game that this change applies to

beginTurn

public void beginTurn(Game g,
                      Player p)
A player's turn has begun. The given player is the one who is eligible to spin, make hypothesese, assertions and/or move. When called for the very first time, on the first player, this is the indication that the game has begun.

Parameters:
g - the Game that this change applies to
p - the Player whose turn has just begun

endTurn

public void endTurn(Game g,
                    Player p)
A player's turn has ended. The given players turn has come to an end. The next player's turn should begin shortly.

Parameters:
g - the Game that this change applies to
p - the Player whose turn has just ended

spin

public void spin(Game g,
                 Player p)
A player has spun the spinner in order to get their movement. When the spinner stops spinning, the other form of this method will be called. The player parameter may be redundant and might be removed in the future as the player is implicitly and always the 'current player'.

Parameters:
g - the Game that this change applies to
p - the Player who is spinning the spinner
See Also:
spin(Game, Player, int)

spin

public void spin(Game g,
                 Player p,
                 int spin)
A player has spun the spinner with the given result. The given player has just gotten the given result on their spin of the spinner. Generally this is between 1 and 6. The player parameter may be redundant and might be removed in the future as the player is implicitly and always the 'current player'.

Parameters:
g - the Game that this change applies to
p - the Player who will be able to use this spin for movement
spin - the number of 'spaces' the player will be able to move
See Also:
spin(Game, Player)

hypothesis

public void hypothesis(Game g,
                       Player p,
                       Evidence.Suspect who,
                       Evidence.Room where,
                       Evidence.Weapon what)
The player has posed the given hypothesis. The player parameter may be redundant and might be removed in the future as the player is implicitly and always the 'current player'.

Parameters:
g - the Game that this change applies to
p - the Player who posed the hypothesis
who - the Suspect that the Player, uh, suspects did it
where - the Place that the Player suspects it was done at
what - the Weapon that the Player suspects was used

assertion

public void assertion(Game g,
                      Player p,
                      Evidence.Suspect who,
                      Evidence.Room where,
                      Evidence.Weapon what)
The player is attempting to win the game. An assertion is just like a hypothesis, however the consequences are fare more dire if it is wrong.

Parameters:
g - the Game that this change applies to
p - the Player who is trying to win
who - the Suspect that the Player, uh, suspects did it
where - the Place that the Player suspects it was done at
what - the Weapon that the Player suspects was used

askRefute

public void askRefute(Game g,
                      Player p,
                      Evidence.Suspect who,
                      Evidence.Room where,
                      Evidence.Weapon what)
The player is being asked if they can refute the evidence. When a hypothesis or assertion is made, each of the other players is, in turn, given the opportunity to refute the hypothesis. This event will be closely followed by one of the refuted methods.

Parameters:
g - the Game that this change applies to
p - the Player who is being asked to refute
who - the Suspect that the other Player, uh, suspects did it
where - the Place that the other Player suspects it was done at
what - the Weapon that the other Player suspects was used
See Also:
refuted(Game, Player, Evidence.Suspect, Evidence.Room, Evidence.Weapon, Evidence), refuted(Game, Player, Evidence.Suspect, Evidence.Room, Evidence.Weapon)

refuted

public void refuted(Game g,
                    Player p,
                    Evidence.Suspect who,
                    Evidence.Room where,
                    Evidence.Weapon what,
                    Evidence by)
The player has refuted the hypothesis/assertion with the piece of evidence. The given piece of evidence is being used to refute the triplet of who/what/where that was posed by one of the players. The player that is referenced here is the person who is making the refutation, not the person who originally posed the hypothesis or assertion.

Parameters:
g - the Game that this change applies to
p - the Player who is making the refutation
who - the Suspect that the other Player, uh, suspects did it
where - the Place that the other Player suspects it was done at
what - the Weapon that the other Player suspects was used
by - the Evidence that p is refuting with
See Also:
hypothesis(Game, Player, Evidence.Suspect, Evidence.Room, Evidence.Weapon), assertion(Game, Player, Evidence.Suspect, Evidence.Room, Evidence.Weapon)

refuted

public void refuted(Game g,
                    Player p,
                    Evidence.Suspect who,
                    Evidence.Room where,
                    Evidence.Weapon what)
The player has refuted the hypothesis/assertion with an unknown piece of evidence. The actual evidence that is being used to refute the hypothesis or assertion is unknown.

Parameters:
g - the Game that this change applies to
p - the Player who is making the refutation
who - the Suspect that the other Player, uh, suspects did it
where - the Place that the other Player suspects it was done at
what - the Weapon that the other Player suspects was used
See Also:
hypothesis(edu.lmu.lmusleuth.Game, edu.lmu.lmusleuth.Player, edu.lmu.lmusleuth.Evidence.Suspect, edu.lmu.lmusleuth.Evidence.Room, edu.lmu.lmusleuth.Evidence.Weapon), assertion(edu.lmu.lmusleuth.Game, edu.lmu.lmusleuth.Player, edu.lmu.lmusleuth.Evidence.Suspect, edu.lmu.lmusleuth.Evidence.Room, edu.lmu.lmusleuth.Evidence.Weapon), askRefute(edu.lmu.lmusleuth.Game, edu.lmu.lmusleuth.Player, edu.lmu.lmusleuth.Evidence.Suspect, edu.lmu.lmusleuth.Evidence.Room, edu.lmu.lmusleuth.Evidence.Weapon), unableToRefute(edu.lmu.lmusleuth.Game, edu.lmu.lmusleuth.Player, edu.lmu.lmusleuth.Evidence.Suspect, edu.lmu.lmusleuth.Evidence.Room, edu.lmu.lmusleuth.Evidence.Weapon)

unableToRefute

public void unableToRefute(Game g,
                           Player p,
                           Evidence.Suspect who,
                           Evidence.Room where,
                           Evidence.Weapon what)
The player has failed to refute the hypothesis/assertion. The given player was unable to refute the triplet of evidence with evidence they had available to them at this time.

Parameters:
g - the Game that this change applies to
p - the Player who is failing to make the refutation
who - the Suspect that the other Player, uh, suspects did it
where - the Place that the other Player suspects it was done at
what - the Weapon that the other Player suspects was used
See Also:
hypothesis(edu.lmu.lmusleuth.Game, edu.lmu.lmusleuth.Player, edu.lmu.lmusleuth.Evidence.Suspect, edu.lmu.lmusleuth.Evidence.Room, edu.lmu.lmusleuth.Evidence.Weapon), assertion(edu.lmu.lmusleuth.Game, edu.lmu.lmusleuth.Player, edu.lmu.lmusleuth.Evidence.Suspect, edu.lmu.lmusleuth.Evidence.Room, edu.lmu.lmusleuth.Evidence.Weapon)

move

public void move(Game g,
                 Evidence.Suspect s,
                 Location l)
A suspect has moved to a new location in the game. The given Suspect has moved to the given location. This can happen by a player moving themselves (that is, their suspect by proxy) or by a Suspect being pulled into a room for a hypothesis or assertion.

Parameters:
g - the Game that this change applies to
s - the Suspect that has been moved
l - the Location that the Suspect is now at

chat

public void chat(Game g,
                 Player p,
                 java.lang.String message)
The player has sent a public chat message. If the recipient of this event is designed in a way that would facilitate presentation of the message to a user, it ought to do so.

Parameters:
g - the Game that this change applies to
p - the Player that sent the message
message - the text of the message