C# Class Gruppe22.Backend.Actor

A living entity (backend) for example the player
Show file Open project: propra13-orga/gruppe22 Class Usage Examples

Public Properties

Property Type Description
_quicklist List

Protected Properties

Property Type Description
_GUID string
_abilities List
_abilityPoints int
_actorType ActorType
_aggro bool
_animationFile string
_armor int
_block int
_charmed int
_checkPointCoords Coords
_crazy bool
_damage int
_destroyArmor int
_destroyWeapon int
_direction Direction
_evade int
_exp int
_expNeeded int
_fireDamage int
_fireDefense int
_friendly bool
_gold int
_health int
_healthReg int
_iceDamage int
_iceDefense int
_id int
_inventory List
_lastCheckpoint int
_level int
_lives int
_locked bool
_mana int
_manaReg int
_maxMana int
_maxhealth int
_name string
_newItems int
_online bool
_penetrate int
_random System.Random
_ranged bool
_regCounter int
_resist int
_scared int
_skills int
_stealHealth int
_stealMana int
_stunned int
_tile ActorTile
_viewRange int

Public Methods

Method Description
Actor ( ActorType actorType, int health, int armor, int damage, int maxHealth = -1, string name = "", Random rnd = null, string animationFile = "", int level = -1 ) : System

The constructor used for actors. Sets default values for the most important properties.

AddHealth ( int amount ) : void

Method to let the player get some health back

AddItem ( Item item ) : void

Add new item to inventory

AddProtection ( int amount ) : void

Method to increase the amount of armor an actor has. Does not change anything if armor>amount

AddStrength ( int amount ) : void

Method to directly increase the damage an actor deals. Does nothing if damage>amount.

FromXML ( string input ) : Actor

Get character data from an XML-string

GenerateName ( string filename ) : string

Method to choose an random actor name from a file.

GenerateName ( ) : void

Method to generate a random actor name. Uses GenerateName() for files if a file exists. Otherwise chooses one of six random names.

HasKey ( int level ) : bool

Methode to determine if the player has the key to the next level.

Items ( int i ) : Item

Method to get the items an actor has.

LevelUp ( ) : void

Method called when the exp reach the needed exp. Lets the player level up. The actor gains abilitypoints, skills and his health is set to maxhealth. Also the needed exp increase for the next level.

Load ( XmlReader reader ) : void

Method to read actor properties from a XML-file.

Regen ( ) : void

Method to let the player regenerate mana and health.

Save ( XmlWriter writer ) : void

Method to save an actor in an XML-file. Just writes every property to the file.

ToString ( ) : string

Changed ToString Method for the actor's name.

ToXML ( ) : string

Write all data as an XML-string

copyFrom ( Actor a ) : void

Duplicates the properties of actor a to the current actor.

Method Details

Actor() public method

The constructor used for actors. Sets default values for the most important properties.
public Actor ( ActorType actorType, int health, int armor, int damage, int maxHealth = -1, string name = "", Random rnd = null, string animationFile = "", int level = -1 ) : System
actorType ActorType Player, NPC oder Enemy
health int Standardwert 15+random(30) or 5+random(maxhealth-5) if maxhealth is passed
armor int default random(10)
damage int default 12+random(10)
maxHealth int default = health
name string uses GenerateName() by default
rnd System.Random a random used to generate the actors starting values
animationFile string the file used to display the actor
level int the default starting level is 1
return System

AddHealth() public method

Method to let the player get some health back
public AddHealth ( int amount ) : void
amount int The amount of healthpoints that should be added
return void

AddItem() public method

Add new item to inventory
public AddItem ( Item item ) : void
item Item The item to add to inventory
return void

AddProtection() public method

Method to increase the amount of armor an actor has. Does not change anything if armor>amount
public AddProtection ( int amount ) : void
amount int the new amount the armor the actor should have
return void

AddStrength() public method

Method to directly increase the damage an actor deals. Does nothing if damage>amount.
public AddStrength ( int amount ) : void
amount int The new amount of damage the actor should deal
return void

FromXML() public method

Get character data from an XML-string
public FromXML ( string input ) : Actor
input string
return Actor

GenerateName() public method

Method to choose an random actor name from a file.
public GenerateName ( string filename ) : string
filename string The file with one name per line
return string

GenerateName() public method

Method to generate a random actor name. Uses GenerateName() for files if a file exists. Otherwise chooses one of six random names.
public GenerateName ( ) : void
return void

HasKey() public method

Methode to determine if the player has the key to the next level.
public HasKey ( int level ) : bool
level int The level for which the key is checked.
return bool

Items() public method

Method to get the items an actor has.
public Items ( int i ) : Item
i int The id of the item
return Item

LevelUp() public method

Method called when the exp reach the needed exp. Lets the player level up. The actor gains abilitypoints, skills and his health is set to maxhealth. Also the needed exp increase for the next level.
public LevelUp ( ) : void
return void

Load() public method

Method to read actor properties from a XML-file.
public Load ( XmlReader reader ) : void
reader XmlReader The used XMLReader for reading the actor.
return void

Regen() public method

Method to let the player regenerate mana and health.
public Regen ( ) : void
return void

Save() public method

Method to save an actor in an XML-file. Just writes every property to the file.
public Save ( XmlWriter writer ) : void
writer System.Xml.XmlWriter The writer which should be used to save the data
return void

ToString() public method

Changed ToString Method for the actor's name.
public ToString ( ) : string
return string

ToXML() public method

Write all data as an XML-string
public ToXML ( ) : string
return string

copyFrom() public method

Duplicates the properties of actor a to the current actor.
public copyFrom ( Actor a ) : void
a Actor The actor from which the properties should be cloned
return void

Property Details

_GUID protected property

A unique identity used in online games
protected string _GUID
return string

_abilities protected property

protected List _abilities
return List

_abilityPoints protected property

protected int _abilityPoints
return int

_actorType protected property

protected ActorType _actorType
return ActorType

_aggro protected property

protected bool _aggro
return bool

_animationFile protected property

protected string _animationFile
return string

_armor protected property

protected int _armor
return int

_block protected property

protected int _block
return int

_charmed protected property

protected int _charmed
return int

_checkPointCoords protected property

Coordinates of last checkpoint
protected Coords _checkPointCoords
return Coords

_crazy protected property

protected bool _crazy
return bool

_damage protected property

protected int _damage
return int

_destroyArmor protected property

protected int _destroyArmor
return int

_destroyWeapon protected property

protected int _destroyWeapon
return int

_direction protected property

protected Direction _direction
return Direction

_evade protected property

protected int _evade
return int

_exp protected property

protected int _exp
return int

_expNeeded protected property

protected int _expNeeded
return int

_fireDamage protected property

protected int _fireDamage
return int

_fireDefense protected property

protected int _fireDefense
return int

_friendly protected property

protected bool _friendly
return bool

_gold protected property

protected int _gold
return int

_health protected property

protected int _health
return int

_healthReg protected property

protected int _healthReg
return int

_iceDamage protected property

protected int _iceDamage
return int

_iceDefense protected property

protected int _iceDefense
return int

_id protected property

protected int _id
return int

_inventory protected property

protected List _inventory
return List

_lastCheckpoint protected property

protected int _lastCheckpoint
return int

_level protected property

protected int _level
return int

_lives protected property

Number of lives (ressurection)
protected int _lives
return int

_locked protected property

protected bool _locked
return bool

_mana protected property

protected int _mana
return int

_manaReg protected property

protected int _manaReg
return int

_maxMana protected property

protected int _maxMana
return int

_maxhealth protected property

protected int _maxhealth
return int

_name protected property

protected string _name
return string

_newItems protected property

protected int _newItems
return int

_online protected property

Determines whether player is available
protected bool _online
return bool

_penetrate protected property

protected int _penetrate
return int

_quicklist public property

public List _quicklist
return List

_random protected property

A random number generator
protected Random,System _random
return System.Random

_ranged protected property

protected bool _ranged
return bool

_regCounter protected property

Internal counter for regeneration of health or mana
protected int _regCounter
return int

_resist protected property

protected int _resist
return int

_scared protected property

protected int _scared
return int

_skills protected property

protected int _skills
return int

_stealHealth protected property

protected int _stealHealth
return int

_stealMana protected property

protected int _stealMana
return int

_stunned protected property

protected int _stunned
return int

_tile protected property

protected ActorTile _tile
return ActorTile

_viewRange protected property

protected int _viewRange
return int