Difference between revisions of "Entity"

From SkyCorp Global
(void makeCursed())
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
== Static Public Methods ==
 
== Static Public Methods ==
  
=== static generate(entityName:String):Entity ===
+
=== static Entity generate(string entityName) ===
Generate a new entity of the given type based on the entity type string.  Null if unknown entity.
+
Generate a new entity of the given type based on the [[Types of Entities|entity type string]].  Null if unknown entity.
  
 
== Public Methods ==
 
== Public Methods ==
  
string getName()
+
=== string getName() ===
 
 
 
Gets name of entity
 
Gets name of entity
  
string getLookDesc()
+
=== string getLookDesc() ===
 
 
 
Gets look description(the text displayed when looking at item)
 
Gets look description(the text displayed when looking at item)
  
boolean isExaminable()
+
=== boolean isExaminable() ===
 
+
Allow player to examine object?  If so, the item is shown in the room item listOtherwise, the object is invisible
Allow player to examine object?  Will then display relevant options such as pickup, drop, etc.  Otherwise, the object is invisible
 
 
 
        /**
 
 
 
         * Allow player to do an attack on this object -- shown when looking at object
 
 
 
         */
 
 
 
boolean isAttackable()
 
 
 
        /**
 
 
 
         * Allow player to do the use action on this object -- shown when looking at object
 
 
 
         */
 
 
 
boolean isUseable()
 
 
 
        /**
 
 
 
         * Should object display a pick-up option if not yet in inventory?  May or may not *actually* be pickupable
 
 
 
         */
 
 
 
boolean isPickupable()
 
 
 
        /**
 
 
 
         * Should object display a drop item if is in inventory?   May or may not *actually* be dropable
 
 
 
         */
 
 
 
boolean isDropable()    
 
 
 
        /**
 
 
 
         * Shortcut function -- removes entity from either the inventory or room that it exists in.   
 
 
 
         */
 
 
 
void deleteEntity()
 
 
 
        /**
 
 
 
         * If we are in the world, is the player in this same room?
 
 
 
         */
 
 
 
boolean isPlayerHere()
 
  
        /**
+
=== boolean isAttackable() ===
 +
Is player allowed to (attempt) to do an attack on this object -- shown when looking at object
  
         * If we are in the world, is the player in a room adjacent to this one?  If so, which room?
+
=== boolean isUseable() ===
 +
Is player shown a use button on this object -- shown when looking at object
  
         * If not, room ID is 0.  If player is in the same room, then room ID 0 is also returned.
+
=== boolean isPickupable() ===
 +
Should object display a pick-up option if not yet in inventory?  May or may not *actually* be pickupable.  To do / attempt to do a pickup, use the [[Player]] class.
  
         */
+
=== boolean isDropable()    ===
 +
Should object display a drop item button if is in inventory?   May or may not *actually* be dropable.  Use [[Player]] class to make the actual attempt.
  
int isPlayerAdjacent()
+
=== void deleteEntity() ===
 +
Removes entity from either the inventory or room that it exists in.
  
Location getLocation()
+
=== boolean isPlayerHere() ===
 +
If entity is in world, is the player in this same room?
  
Returns null if entity is in inventory, or otherwise not in world.
+
=== int isPlayerAdjacent() ===
 +
If entity is in the world, is the player in a room adjacent to the one entity is in?  If so, which room ID?
  
        /**
+
If not, room ID is 0.  If player is in the same room, then room ID 0 is also returned.
  
         * Moves entity from whereever it is (including inventory) into a particular location.  If picking up the item, should use the functions on the Player class instead.
+
=== [[Location]] getLocation() ===
 +
Gets location of this entityReturns null if entity is in inventory, or otherwise not in world.
  
         */
+
=== void moveEntity(string newMapName:String, int newRoomID) ===
 +
Moves entity from whereever it is (including inventory) into a particular location.  If picking up the item, should use the functions on the Player class instead.
  
void moveEntity(string newMapName:String, int newRoomID)
+
=== void moveEntityToSameRoomAsPlayer() ===
 +
Move entity from wherever it is (including inventory) into the same room as the player is in.
  
        /**
+
=== void makeCursed() ===
 +
Marks this entity as cursed.  In order for this to have any effect, you should write a custom function for playerAttemptDropCheck.
  
         * Move entity from wherever it is (including inventory) into the same room as the player is in.
+
Generally this would be called on start-up.  Curse status can be modified by NPCs that can perform purification.
  
         */
+
See [[Weight Pendant]] for an example of cursed items.
  
void moveEntityToSameRoomAsPlayer()
+
=== boolean getCursed() ===
 +
Is this entity cursed?
 
[[Category:LUA Class Reference]]
 
[[Category:LUA Class Reference]]

Latest revision as of 04:11, 30 December 2017

Static Public Methods

static Entity generate(string entityName)

Generate a new entity of the given type based on the entity type string. Null if unknown entity.

Public Methods

string getName()

Gets name of entity

string getLookDesc()

Gets look description(the text displayed when looking at item)

boolean isExaminable()

Allow player to examine object?  If so, the item is shown in the room item list. Otherwise, the object is invisible

boolean isAttackable()

Is player allowed to (attempt) to do an attack on this object -- shown when looking at object

boolean isUseable()

Is player shown a use button on this object -- shown when looking at object

boolean isPickupable()

Should object display a pick-up option if not yet in inventory?  May or may not *actually* be pickupable. To do / attempt to do a pickup, use the Player class.

boolean isDropable()    

Should object display a drop item button if is in inventory?   May or may not *actually* be dropable. Use Player class to make the actual attempt.

void deleteEntity()

Removes entity from either the inventory or room that it exists in.

boolean isPlayerHere()

If entity is in world, is the player in this same room?

int isPlayerAdjacent()

If entity is in the world, is the player in a room adjacent to the one entity is in?  If so, which room ID?

If not, room ID is 0.  If player is in the same room, then room ID 0 is also returned.

Location getLocation()

Gets location of this entity. Returns null if entity is in inventory, or otherwise not in world.

void moveEntity(string newMapName:String, int newRoomID)

Moves entity from whereever it is (including inventory) into a particular location. If picking up the item, should use the functions on the Player class instead.

void moveEntityToSameRoomAsPlayer()

Move entity from wherever it is (including inventory) into the same room as the player is in.

void makeCursed()

Marks this entity as cursed. In order for this to have any effect, you should write a custom function for playerAttemptDropCheck.

Generally this would be called on start-up. Curse status can be modified by NPCs that can perform purification.

See Weight Pendant for an example of cursed items.

boolean getCursed()

Is this entity cursed?