Adventure at Umalu  22nd March, 2013
Rogue-like Dungeon Crawler, written in Java
 All Classes Functions Variables Pages
Classes | Public Member Functions | Public Attributes | List of all members
jade.core.World Class Reference
Inheritance diagram for jade.core.World:
jade.core.Messenger rogue.level.Level

Public Member Functions

 World (int width, int height)
 
void playertick ()
 
void tick ()
 
int width ()
 
int height ()
 
List< Class<?extends Actor > > getDrawOrder ()
 
List< Class<?extends Actor > > getActOrder ()
 
void addActor (Actor actor, int x, int y)
 
final void addActor (Actor actor, Coordinate coord)
 
final void addActor (Actor actor, Dice dice)
 
final void addActor (Actor actor)
 
void removeActor (Actor actor)
 
void removeExpired ()
 
final< T extends Actor > T getActorAt (Class< T > cls, Coordinate pos)
 
final< T extends Actor >
Collection< T > 
getActorsAt (Class< T > cls, Coordinate pos)
 
List< ColoredCharlookAll (int x, int y)
 
final List< ColoredCharlookAll (Coordinate pos)
 
final ColoredChar look (int x, int y)
 
final ColoredChar look (Coordinate pos)
 
ColoredChar tileAt (int x, int y)
 
void viewable (int x, int y)
 
Boolean isviewable (int x, int y)
 
final ColoredChar tileAt (Coordinate coord)
 
boolean passableAt (int x, int y)
 
final boolean passableAt (Coordinate coord)
 
void setTile (ColoredChar face, boolean passable, int x, int y)
 
final void setTile (ColoredChar face, boolean passable, Coordinate coord)
 
Coordinate getOpenTile (Dice dice, int x1, int y1, int x2, int y2)
 
final Coordinate getOpenTile (Dice dice, Coordinate topLeft, Coordinate bottomRight)
 
final Coordinate getOpenTile (Dice dice)
 
final Coordinate getOpenTile (int x1, int y1, int x2, int y2)
 
final Coordinate getOpenTile (Coordinate topLeft, Coordinate bottomRight)
 
final Coordinate getOpenTile ()
 
boolean insideBounds (int x, int y)
 
final boolean insideBounds (Coordinate pos)
 
- Public Member Functions inherited from jade.core.Messenger
 Messenger ()
 
void appendMessage (String message)
 
Iterable< String > retrieveMessages ()
 
void aggregateMessages (Messenger messenger)
 
void filterMessages (Collection< Messenger > filter)
 
void clearMessages ()
 

Public Attributes

Coordinate playerstart
 

Detailed Description

Represents a game world on which

Actor

can interact.

Constructor & Destructor Documentation

jade.core.World.World ( int  width,
int  height 
)

Constructs a new

with the given dimensions. Both width and height must be positive integers.

Parameters
widththe width of the new
heightthe height of the new

Member Function Documentation

void jade.core.World.addActor ( Actor  actor,
int  x,
int  y 
)

Adds an

Actor

to the

at the specified location.

Parameters
actorthe being added
xthe x location of the
Actor
ythe y location of the
Actor
final void jade.core.World.addActor ( Actor  actor,
Coordinate  coord 
)

Adds an

Actor

to the

at the specified location.

Parameters
actorthe being added
coordthe location of the
Actor
final void jade.core.World.addActor ( Actor  actor,
Dice  dice 
)

Adds an

Actor

to the

at a random open tile, as generated by the specified

Dice

with a call to

/

Parameters
actorthe
Actor
to be added
dicethe random number generator used to find the open tile
final void jade.core.World.addActor ( Actor  actor)

Adds an

Actor

to the

at a random open tile, as generated by the global instance of

Dice

with a call to

/

Parameters
actorthe
Actor
to be added
final<T extends Actor> T jade.core.World.getActorAt ( Class< T >  cls,
Coordinate  pos 
)

Returns an

Actor

of the given class at the given location, or null if there is none. If there are multiple possible

Actor

that could be returned, an arbitrary

Actor

is returned.

Parameters
<T>the generic type of the class to be returned
clsthe
Class<T extends Actor>
of the
Actor
to be returned
posthe location being queried
Returns
an
Actor
of the given class located at (x, y)
List<Class<? extends Actor> > jade.core.World.getActOrder ( )

Returns the act order for the

. This list will affect the

tick()

method by changing the priority with which

Actor

s will act. Note that if one class in the draw order is a superclass of another in the list, any

Actor

of the type of the subclass will act twice in the

tick()

method.

Returns
the act order for the
final<T extends Actor> Collection<T> jade.core.World.getActorsAt ( Class< T >  cls,
Coordinate  pos 
)

Returns a

Collection<T extends Actor>

of all

Actor

of the given class at the given location.

Parameters
<T>the generic type of the class type to be returned
clsthe
Class<T extends Actor>
of the
Actor
to be returned
posthe location being queried
Returns
a
Collection<T extends Actor>
of all
Actor
of the given class located at (x, y)
List<Class<? extends Actor> > jade.core.World.getDrawOrder ( )

Returns the draw order for the

. This list will affect the

method by changing the priority with which

Actor

s will be drawn. Note that if one class in the draw order is a superclass of another in the list, any

Actor

of the type of the subclass will be seen twice in the

method.

Returns
the draw order for the
Coordinate jade.core.World.getOpenTile ( Dice  dice,
int  x1,
int  y1,
int  x2,
int  y2 
)

Gets a randomly chosen open tile on the

within the given bounds. If after 100 randomly selected tiles are closed, then each tile will be checked and the first open tile found is returned. If the entire

is closed, null is returned.

Parameters
dicethe random number generator used to randomly select tiles
x1the bounds left most value
y1the bounds upper most value
x2the bounds right most value
y2the bounds bottom most value
Returns
a randomly chosen open tile
final Coordinate jade.core.World.getOpenTile ( Dice  dice,
Coordinate  topLeft,
Coordinate  bottomRight 
)

Gets a randomly chosen open tile on the

within the given bounds. If after 100 randomly selected tiles are closed, then each tile will be checked and the first open tile found is returned. If the entire

is closed, null is returned.

Parameters
dicethe random number generator used to randomly select tiles
topLeftthe bounds upper-left most value
bottomRightthe bounds bottom-right most value
Returns
a randomly chosen open tile
final Coordinate jade.core.World.getOpenTile ( Dice  dice)

Gets a randomly chosen open tile from anywhere on the

. If after 100 randomly selected tiles are closed, then each tile will be checked and the first open tile found is returned. If the entire

is closed, null is returned.

Parameters
dicethe random number generator used to randomly select tiles
Returns
a randomly chosen open tile
final Coordinate jade.core.World.getOpenTile ( int  x1,
int  y1,
int  x2,
int  y2 
)

Gets a randomly chosen open tile on the

within the given bounds. The global instance of

Dice

is used as the default parameter for randomly choosing the tiles. If after 100 randomly selected tiles are closed, then each tile will be checked and the first open tile found is returned. If the entire

is closed, null is returned.

Parameters
x1the bounds left most value
y1the bounds upper most value
x2the bounds right most value
y2the bounds bottom most value
Returns
a randomly chosen open tile
final Coordinate jade.core.World.getOpenTile ( Coordinate  topLeft,
Coordinate  bottomRight 
)

Gets a randomly chosen open tile on the

within the given bounds. The global instance of

Dice

is used as the default parameter for randomly choosing the tiles. If after 100 randomly selected tiles are closed, then each tile will be checked and the first open tile found is returned. If the entire

is closed, null is returned.

Parameters
topLeftthe bounds upper-left most value
bottomRightthe bounds bottom-right most value
Returns
a randomly chosen open tile
final Coordinate jade.core.World.getOpenTile ( )

Gets a randomly chosen open tile from anywhere on the

. The global instance of

Dice

is used as the default parameter for randomly choosing the tiles. If after 100 randomly selected tiles are closed, then each tile will be checked and the first open tile found is returned. If the entire

is closed, null is returned.

Returns
a randomly chosen open tile
int jade.core.World.height ( )

Returns the height of the

.

Returns
the height of the
boolean jade.core.World.insideBounds ( int  x,
int  y 
)

Returns true if the given (x, y) location is inside the bounds of the

.

Parameters
xthe x value of the location being queried
ythe y value of the location being queried
Returns
true if the given (x, y) location is inside the bounds of the
final boolean jade.core.World.insideBounds ( Coordinate  pos)

Returns true if the given

Coordinate

location is inside the bounds of the

.

Parameters
posthe location on the being queried
Returns
true if pos is inside the bounds of the
final ColoredChar jade.core.World.look ( int  x,
int  y 
)

Returns the face that should be drawn for the given location. This should be the same as the first face returned by lookAll.

Parameters
xthe x value of the location being queried
ythe y value of the location being queried
Returns
the face that should be drawn for the given location.
final ColoredChar jade.core.World.look ( Coordinate  pos)

Returns the face that should be drawn for the given location.

Parameters
posthe location being queried
Returns
the face that should be drawn for the given location.
List<ColoredChar> jade.core.World.lookAll ( int  x,
int  y 
)

Returns every tile that is visible at a given location, ordered such that the tile with highest priority (the tile returned by look) is first, and the lowest priority is last. This last tile will be the face of the actual tile itself. Note that any actor which has a null face will not be included.

Parameters
xthe x value of the location being queried
ythe y value of the location being queried
Returns
every tile that is visible at a given location
final List<ColoredChar> jade.core.World.lookAll ( Coordinate  pos)

Returns every tile that is visible at a given location, ordered such that the tile with highest priority (the tile returned by look) is first, and the lowest priority is last. This last tile will be the face of the actual tile itself. Note that any actor which has a null face will not be included.

Parameters
posthe location being queried
Returns
every tile that is visible at a given location
boolean jade.core.World.passableAt ( int  x,
int  y 
)

Returns true if the tile at the provided (x, y) coordinates is passable.

Parameters
xthe x value of the position being queried
ythe y value of the position being queried
Returns
true if the tile at (x, y)
final boolean jade.core.World.passableAt ( Coordinate  coord)

Returns true if the tile at the provided

Coordinate

is passable.

Parameters
coordthe value of the position being queried
Returns
true if the tile at the given
Coordinate
void jade.core.World.removeActor ( Actor  actor)

Removes an

Actor

from the

. The

Actor

must be both bound to this

and not held by another

Actor

. However, if the

Actor

is expired, it may always be removed.

Parameters
actorthe
Actor
to be removed
void jade.core.World.removeExpired ( )

Removes all expired

Actor

from the

.

void jade.core.World.setTile ( ColoredChar  face,
boolean  passable,
int  x,
int  y 
)

Sets the face and passable value of the tile at the specified (x, y) location.

Parameters
facethe new face of the tile
passablethe new passable value of the tile
xthe x value of the position being updated
ythe y value of the position being updated
final void jade.core.World.setTile ( ColoredChar  face,
boolean  passable,
Coordinate  coord 
)

Sets the face and passable value of the tile at the specified

Coordinate

.

Parameters
facethe new face of the tile
passablethe new passable value of the tile
coordthe value of the position being updated
void jade.core.World.tick ( )

Performs one tick. This will call

act()

on all

Actor

in the order specified by the act order of the

. Any

Actor

whose type does not appear in the act order does not act. Any expired

Actor

are removed from the

.

ColoredChar jade.core.World.tileAt ( int  x,
int  y 
)

Returns the face of the tile at the provided (x, y) coordinates.

Parameters
xthe x value of the position being queried
ythe y value of the position being queried
Returns
the face of the tile at (x, y)
final ColoredChar jade.core.World.tileAt ( Coordinate  coord)

Returns the face of the tile at the provided coordinates.

Parameters
coordthe value of the position being queried
Returns
the face of the tile at then given
Coordinate
int jade.core.World.width ( )

Returns the width of the

.

Returns
the width of the

The documentation for this class was generated from the following file: