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
FieldsModifier and TypeFieldDescriptionprotected booleanprotected BoardToken[][]protected intprotected SpeakerNPCFields inherited from class games.stendhal.server.entity.mapstuff.area.AreaEntity
ATTR_NAMEFields inherited from class marauroa.common.game.RPObject
INVALID_ID -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanchecks whether there are empty spots leftprotected voidendGame()static voidgenerates 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 indexbooleanis the game active?protected voidnextTurn()moves to the next turn (next player)voidonTokenMoved(Player player, BoardToken token) handling of moved tokenvoidsetNPC(SpeakerNPC npc) sets the NPC who manages this gameprotected voidvoidtimeOut()Methods inherited from class games.stendhal.server.entity.mapstuff.area.AreaEntity
addBehaviour, getDescriptionName, getName, getTitle, onAdded, onRemoved, setNameMethods 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, updateMethods 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, writeToJsonMethods inherited from class marauroa.common.game.SlotOwner
deserializeRPSlots, fill, serializeRPSlotsMethods 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, toAttributeStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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:
trueiff 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
-