Class GameBoard
java.lang.Object
marauroa.common.game.Attributes
marauroa.common.game.SlotOwner
marauroa.common.game.RPObject
games.stendhal.server.entity.Entity
games.stendhal.server.entity.mapstuff.area.AreaEntity
games.stendhal.server.entity.mapstuff.game.GameBoard
- All Implemented Interfaces:
Killer
,Cloneable
,Iterable<String>
,Serializable
- Direct Known Subclasses:
TicTacToeBoard
-
Nested Class Summary
Nested classes/interfaces inherited from class marauroa.common.game.RPObject
RPObject.ID
-
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
protected BoardToken[][]
protected int
protected SpeakerNPC
Fields inherited from class games.stendhal.server.entity.mapstuff.area.AreaEntity
ATTR_NAME
Fields inherited from class marauroa.common.game.RPObject
INVALID_ID
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
checks whether there are empty spots leftprotected void
endGame()
static void
generates the RP classgets the name of the player who is doing the current turn.gets the name of the token type for the current turngets the name of the NPCgets a list of player names participating in this gamegetTokenAt(int xIndex, int yIndex)
returns the token at the specified indexboolean
is the game active?protected void
nextTurn()
moves to the next turn (next player)void
onTokenMoved(Player player, BoardToken token)
handling of moved tokenvoid
setNPC(SpeakerNPC npc)
sets the NPC who manages this gameprotected void
void
timeOut()
Methods inherited from class games.stendhal.server.entity.mapstuff.area.AreaEntity
addBehaviour, getDescriptionName, getName, getTitle, onAdded, onRemoved, setName
Methods inherited from class games.stendhal.server.entity.Entity
describe, getAdjacentNodes, getArea, getArea, getCursor, getDescription, getEntitySlot, getHeight, getOrigin, getResistance, getResistance, getWidth, getX, getY, getZone, hasDescription, isInSight, isObstacle, nextTo, nextTo, notifyWorldAboutChanges, onMoved, setCursor, setDescription, setEntityClass, setEntitySubclass, setMenu, setPosition, setResistance, setSize, setVisibility, slotIterator, slots, squaredDistance, squaredDistance, stopped, update
Methods inherited from class marauroa.common.game.RPObject
addEvent, addLink, addLink, addMap, addSlot, addSlot, applyDifferences, clearEvents, clearVisible, clone, containsKey, equals, events, eventsIterator, fill, get, getBaseContainer, getBoolean, getContainer, getContainerBaseOwner, getContainerOwner, getContainerSlot, getDifferences, getDouble, getFromSlots, getID, getInt, getLink, getLinkedObject, getMap, getSlot, has, hashCode, hasLink, hasMap, hasSlot, hide, isContained, isEmpty, isHidden, isStorable, maps, put, put, put, put, readObject, remove, removeLink, removeMap, removeSlot, resetAddedAndDeleted, resetAddedAndDeletedMaps, resetAddedAndDeletedRPLink, resetAddedAndDeletedRPSlot, setAddedMaps, setAddedRPSlot, setContainer, setDeletedMaps, setDeletedRPSlot, setID, size, slots, slotsIterator, store, toString, unhide, unstore, writeObject, writeObject, writeToJson
Methods inherited from class marauroa.common.game.SlotOwner
deserializeRPSlots, fill, serializeRPSlots
Methods inherited from class marauroa.common.game.Attributes
add, applyDifferences, get, getBool, getDouble, getInt, getList, getLong, getRPClass, has, instanceOf, iterator, put, put, put, put, put, readFromMap, remove, resetAddedAndDeletedAttributes, setAddedAttributes, setDeletedAttributes, setRPClass, setRPClass, toAttributeString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
board
-
active
protected boolean active -
players
-
tokenTypes
-
currentPlayerIndex
protected int currentPlayerIndex -
npc
-
-
Constructor Details
-
GameBoard
public GameBoard()creates a new GameBoard -
GameBoard
public GameBoard(int width, int height)creates a new GameBoard- Parameters:
width
- width of the boardheight
- height of the board
-
-
Method Details
-
setNPC
sets the NPC who manages this game- Parameters:
npc
- SpeakerNPC
-
isGameActive
public boolean isGameActive()is the game active?- Returns:
- active
-
getPlayers
gets a list of player names participating in this game- Returns:
- list of player names
-
getCurrentPlayer
gets the name of the player who is doing the current turn.- Returns:
- name of player
-
getCurrentTokenType
gets the name of the token type for the current turn- Returns:
- name of token type
-
getNPCName
gets the name of the NPC- Returns:
- name of NPC
-
areEmptyFieldsLeft
public boolean areEmptyFieldsLeft()checks whether there are empty spots left- Returns:
true
iff there are empty spots.
-
nextTurn
protected void nextTurn()moves to the next turn (next player) -
onTokenMoved
handling of moved token- Parameters:
player
- player moving the toketoken
- moved token
-
startGame
protected void startGame() -
endGame
protected void endGame() -
timeOut
public void timeOut() -
getTokenAt
returns the token at the specified index- Parameters:
xIndex
- target x-indexyIndex
- target y-index- Returns:
- token or
null
-
generateRPClass
public static void generateRPClass()generates the RP class
-