Difference between revisions of "Entity Functions"

From theFarWilds
Jump to: navigation, search
m (moveEntity doesn't exist. fixed to reflect actual method name.)
 
(10 intermediate revisions by 2 users not shown)
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 Functions|Player]] controller );
 +
 +
Entity createEntity( string cardName, Location loc, [[Player Functions|Player]] controller );
 +
   
 +
Entity createEntity( string cardName, Location loc );
  
List of functions:
+
See also getFigure( Location loc ).
bool isValid();
+
string getName();
+
  
  Player getController();
+
== Methods ==
  void setController(Player);
+
bool '''isValid'''();
 +
// check to see if entity was created successfully
 +
 +
bool '''doesExist'''();
 +
// check to see if entity has been removed
 +
 +
string '''getName'''();
 +
 +
  [[Player Functions|Player]] '''getController'''();
 +
 +
  void '''setController'''( [[Player Functions|Player]] controller );
 +
 +
bool '''isType'''( int type );
 +
// Types: CREATURE=1, BUILDING=2, ENCHANTMENT=3, ITEM=4, MARKER(Corpse,Flux Well,Ruin)=5, WORLD_ENCHANT=6
 +
 +
Location '''getLoc'''();
 +
 +
bool '''move'''( 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'''();
 +
 +
int '''addTokens'''(string tokenName,int delta);
 +
// returns the number of that token after the add.
 +
// delta can be negative
 +
// some common tokens: attack,maxhp,vision,speed,range
 +
// also: age,work,entrench,sleep,vigor,spawn,soul,termite
 +
// you can look in helpers/counters.xml for a complete list
 +
// Example: ent.addToken("attack",1);
 +
// it is case sensitive
 +
 +
int '''numTokens'''(string tokenName);
 
   
 
   
  bool isType(int type);
+
  int '''getCurHealth'''();
// Types: Creature=1, Building=2,Enchantment=3,Item=4,(Corpse,Flux Well,Ruin)=5,World Enchantment=6
+
 
   
 
   
  Location getLoc();
+
  int '''getMaxHealth'''();
bool moveEntity(Location);
+
// returns false if it can't move there
+
 
   
 
   
  void remove();
+
  string '''otherName'''();
  void destroy();
+
  // returns the name of the corpse, ruin,
  void sacrifice();
+
  // or construction site building that this was or will be

Latest revision as of 02:36, 10 May 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, MARKER(Corpse,Flux Well,Ruin)=5, WORLD_ENCHANT=6

Location getLoc();

bool move( 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();

int addTokens(string tokenName,int delta);
// returns the number of that token after the add.
// delta can be negative
// some common tokens: attack,maxhp,vision,speed,range
// also: age,work,entrench,sleep,vigor,spawn,soul,termite
// you can look in helpers/counters.xml for a complete list
// Example: ent.addToken("attack",1); 
// it is case sensitive

int numTokens(string tokenName);

int getCurHealth();

int getMaxHealth();

string otherName();
// returns the name of the corpse, ruin, 
// or construction site building that this was or will be