Difference between revisions of "Entity Functions"

From theFarWilds
Jump to: navigation, search
Line 1: Line 1:
[[Scripting]]
+
[[Category:Scripts]]
Entity Functions are called on the Entity object. For example
+
Each '''entity object''' represents a creature, building, enchantment, corpse, or ruin.  Collectively, these objects define the current game state.
  
  Entity ent=getFigure(createLocation(3,3));
+
== Constructors ==
  ent.remove();
+
  Entity createEntity( string cardName, int x_coord, int y_coord, Player controller );
 +
 +
Entity createEntity( string cardName, Location loc, Player controller );
 +
   
 +
Entity createEntity( string cardName, Location loc );
 +
 
 +
See also getFigure( Location loc ).
  
List of functions:
+
== Methods ==
 
  bool '''isValid'''();
 
  bool '''isValid'''();
 +
// check to see if entity was created successfully
 +
 
  bool '''doesExist'''();
 
  bool '''doesExist'''();
  // isValid will tell you if the Entity returned by some other function is valid
+
  // check to see if entity has been removed
// doesExist can be used where you are holding on to an Entity for awhile
+
// it checks to see if it has been removed from the game
+
// getName() and other functions will work on an Entity that is valid but doesn't exist
+
  
 
  string '''getName'''();
 
  string '''getName'''();
 
   
 
   
 
  Player '''getController'''();
 
  Player '''getController'''();
  void '''setController'''(Player);
+
  void '''setController'''( Player controller );
 
   
 
   
  bool '''isType'''(int type);
+
  bool '''isType'''( int type );
  // Types: Creature=1, Building=2,Enchantment=3,Item=4,(Corpse,Flux Well,Ruin)=5,World Enchantment=6
+
  // Types: Creature=1, Building=2, Enchantment=3, Item=4, (Corpse,Flux Well,Ruin)=5, World Enchantment=6
 
   
 
   
 
  Location '''getLoc'''();
 
  Location '''getLoc'''();
  bool '''moveEntity'''(Location);
+
  // returns false if it can't move there
+
  bool '''moveEntity'''( Location );
 +
  // returns false if unsuccessful (e.g., trying to move figure into occupied location)
 
   
 
   
 
  void '''remove'''();
 
  void '''remove'''();
 +
 
  void '''destroy'''();
 
  void '''destroy'''();
 +
 
  void '''sacrifice'''();
 
  void '''sacrifice'''();
 
   
 
   
  void '''setDim'''(bool dimOrNot);
+
  void '''setDim'''( bool dimOrNot );
 +
 
  bool '''isDim'''();
 
  bool '''isDim'''();

Revision as of 21:30, 3 April 2010

Each entity object represents a creature, building, enchantment, corpse, or ruin. Collectively, these objects define the current game state.

Constructors

Entity createEntity( string cardName, int x_coord, int y_coord, Player controller );

Entity createEntity( string cardName, Location loc, Player controller );

Entity createEntity( string cardName, Location loc );

See also getFigure( Location loc ).

Methods

bool isValid();
// check to see if entity was created successfully

bool doesExist();
// check to see if entity has been removed
string getName();

Player getController();
void setController( Player controller );

bool isType( int type );
// Types: Creature=1, Building=2, Enchantment=3, Item=4, (Corpse,Flux Well,Ruin)=5, World Enchantment=6

Location getLoc();

bool moveEntity( Location );
// returns false if unsuccessful (e.g., trying to move figure into occupied location)

void remove();

void destroy();

void sacrifice();

void setDim( bool dimOrNot );

bool isDim();