Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
134 changes: 134 additions & 0 deletions src/java/soc/common/actions/gameAction/GameAction.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
package soc.common.actions.gameAction;

import java.util.Date;

import soc.common.game.Game;
import soc.common.game.IGame;
import soc.common.game.Player;
import soc.common.game.User;
import soc.common.game.gamePhase.GamePhase;
import soc.common.game.gamePhase.turnPhase.TurnPhase;
import sun.reflect.generics.reflectiveObjects.NotImplementedException;

/*
* A GameAction performed in a game
*/
public class GameAction
{
private Player player;
private int sender;
protected String invalidMessage;
protected String toDoMessage;
protected String message;

/*
* Should be omitted at hashCode calculation, since values differ at server
* and at client
*/
protected Date dateTimeExecuted;

/**
* @return the toDoMessage
*/
public String getToDoMessage()
{
return toDoMessage;
}

/**
* @return the dateTimeExecuted
*/
public Date getDateTimeExecuted()
{
return dateTimeExecuted;
}

/**
* @return the sender
*/
public int getSender()
{
return sender;
}

/**
* @param sender the sender to set
*/
public GameAction setSender(int sender)
{
this.sender = sender;

// Enables fluent interface usage
// http://en.wikipedia.org/wiki/Fluent_interface
return this;
}

/**
* @return the invalidMessage
*/
public String getInvalidMessage()
{
return invalidMessage;
}


/**
* @return the message
*/
public String getMessage()
{
return message;
}

/**
* @return the player
*/
public Player getPlayer()
{
if (sender == 0 && player == null)
{
User p = new Player()
.setId(0)
.setName("Server");

player = (Player)p;
}
return player;
}


/**
* @param player the player to set
*/
public GameAction setPlayer(Player player)
{
this.player = player;
this.sender = player.getId();

// Enables fluent interface usage
// http://en.wikipedia.org/wiki/Fluent_interface
return this;
}

public void perform(Game game)
{
dateTimeExecuted = new Date();
}

/*
* Returns true if player is allowed to play this action in given TurnPhase
*/
public boolean isAllowed(TurnPhase turnPhase)
{
throw new NotImplementedException();
}

/*
* Returns true if player is allowed to play this action in given GamePhase
*/
public boolean isAllowed(GamePhase gamePhase)
{
throw new NotImplementedException();
}

}
31 changes: 31 additions & 0 deletions src/java/soc/common/actions/gameAction/GamePhaseHasEnded.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package soc.common.actions.gameAction;

import soc.common.game.gamePhase.GamePhase;

/*
* Announces a gamephase which has been ended
*/
public class GamePhaseHasEnded extends GameAction
{
private GamePhase endedGamePhase;

/**
* @return the endedGamePhase
*/
public GamePhase getEndedGamePhase()
{
return endedGamePhase;
}

/**
* @param endedGamePhase the endedGamePhase to set
*/
public GamePhaseHasEnded setEndedGamePhase(GamePhase endedGamePhase)
{
this.endedGamePhase = endedGamePhase;

// Enables fluent interface usage
// http://en.wikipedia.org/wiki/Fluent_interface
return this;
}
}
6 changes: 6 additions & 0 deletions src/java/soc/common/actions/gameAction/InGameChatAction.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package soc.common.actions.gameAction;

public class InGameChatAction extends GameAction
{

}
26 changes: 26 additions & 0 deletions src/java/soc/common/actions/gameAction/PlacePort.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package soc.common.actions.gameAction;

public class PlacePort extends GameAction
{
private int territoryID;

/**
* @return the territoryID
*/
public int getTerritoryID()
{
return territoryID;
}

/**
* @param territoryID the territoryID to set
*/
public PlacePort setTerritoryID(int territoryID)
{
this.territoryID = territoryID;

// Enables fluent interface usage
// http://en.wikipedia.org/wiki/Fluent_interface
return this;
}
}
27 changes: 27 additions & 0 deletions src/java/soc/common/actions/gameAction/RolledSame.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package soc.common.actions.gameAction;


public class RolledSame extends GameAction
{
private int highRoll;

/**
* @return the highRoll
*/
public int getHighRoll()
{
return highRoll;
}

/**
* @param highRoll the highRoll to set
*/
public RolledSame setHighRoll(int highRoll)
{
this.highRoll = highRoll;

// Enables fluent interface usage
// http://en.wikipedia.org/wiki/Fluent_interface
return this;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package soc.common.actions.gameAction;

public class StartingPlayerDetermined extends GameAction
{
private int diceRoll;

/**
* @return the diceRoll
*/
public int getDiceRoll()
{
return diceRoll;
}

/**
* @param diceRoll the diceRoll to set
*/
public StartingPlayerDetermined setDiceRoll(int diceRoll)
{
this.diceRoll = diceRoll;

// Enables fluent interface usage
// http://en.wikipedia.org/wiki/Fluent_interface
return this;
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package soc.common.actions.gameAction.turnActions;

public class BuildCity extends TurnAction
{

}
10 changes: 10 additions & 0 deletions src/java/soc/common/actions/gameAction/turnActions/BuildRoad.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package soc.common.actions.gameAction.turnActions;

import soc.common.game.Player;

public class BuildRoad extends TurnAction
{



}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package soc.common.actions.gameAction.turnActions;

public class BuildShip extends TurnAction
{

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package soc.common.actions.gameAction.turnActions;

public class BuildTown extends TurnAction
{

}
54 changes: 54 additions & 0 deletions src/java/soc/common/actions/gameAction/turnActions/RollDice.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package soc.common.actions.gameAction.turnActions;



public class RollDice extends TurnAction
{
private int dice1;
private int dice2;
private int dice;
/**
* @return the dice1
*/
public int getDice1()
{
return dice1;
}
/**
* @param dice1 the dice1 to set
*/
public RollDice setDice1(int dice1)
{
this.dice1 = dice1;

// Enables fluent interface usage
// http://en.wikipedia.org/wiki/Fluent_interface
return this;
}
/**
* @return the dice2
*/
public int getDice2()
{
return dice2;
}
/**
* @param dice2 the dice2 to set
*/
public RollDice setDice2(int dice2)
{
this.dice2 = dice2;

// Enables fluent interface usage
// http://en.wikipedia.org/wiki/Fluent_interface
return this;
}
/**
* @return the dice
*/
public int getDice()
{
return dice;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package soc.common.actions.gameAction.turnActions;

import soc.common.actions.gameAction.GameAction;
import soc.common.game.Player;

public class TurnAction extends GameAction
{

}
7 changes: 7 additions & 0 deletions src/java/soc/common/actions/lobby/LobbyAction.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package soc.common.actions.lobby;


public class LobbyAction
{

}
6 changes: 6 additions & 0 deletions src/java/soc/common/actions/lobby/LobbyChatAction.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package soc.common.actions.lobby;

public class LobbyChatAction extends LobbyAction
{

}
Loading