C# Class Gruppe22.Backend.Actor

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

Méthodes publiques

Свойство Type Description
_quicklist List

Protected Properties

Свойство 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

Méthodes publiques

Méthode 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 méthode

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
Résultat System

AddHealth() public méthode

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

AddItem() public méthode

Add new item to inventory
public AddItem ( Item item ) : void
item Item The item to add to inventory
Résultat void

AddProtection() public méthode

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
Résultat void

AddStrength() public méthode

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
Résultat void

FromXML() public méthode

Get character data from an XML-string
public FromXML ( string input ) : Actor
input string
Résultat Actor

GenerateName() public méthode

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

GenerateName() public méthode

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
Résultat void

HasKey() public méthode

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.
Résultat bool

Items() public méthode

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

LevelUp() public méthode

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
Résultat void

Load() public méthode

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

Regen() public méthode

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

Save() public méthode

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
Résultat void

ToString() public méthode

Changed ToString Method for the actor's name.
public ToString ( ) : string
Résultat string

ToXML() public méthode

Write all data as an XML-string
public ToXML ( ) : string
Résultat string

copyFrom() public méthode

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
Résultat void

Property Details

_GUID protected_oe property

A unique identity used in online games
protected string _GUID
Résultat string

_abilities protected_oe property

protected List _abilities
Résultat List

_abilityPoints protected_oe property

protected int _abilityPoints
Résultat int

_actorType protected_oe property

protected ActorType _actorType
Résultat ActorType

_aggro protected_oe property

protected bool _aggro
Résultat bool

_animationFile protected_oe property

protected string _animationFile
Résultat string

_armor protected_oe property

protected int _armor
Résultat int

_block protected_oe property

protected int _block
Résultat int

_charmed protected_oe property

protected int _charmed
Résultat int

_checkPointCoords protected_oe property

Coordinates of last checkpoint
protected Coords _checkPointCoords
Résultat Coords

_crazy protected_oe property

protected bool _crazy
Résultat bool

_damage protected_oe property

protected int _damage
Résultat int

_destroyArmor protected_oe property

protected int _destroyArmor
Résultat int

_destroyWeapon protected_oe property

protected int _destroyWeapon
Résultat int

_direction protected_oe property

protected Direction _direction
Résultat Direction

_evade protected_oe property

protected int _evade
Résultat int

_exp protected_oe property

protected int _exp
Résultat int

_expNeeded protected_oe property

protected int _expNeeded
Résultat int

_fireDamage protected_oe property

protected int _fireDamage
Résultat int

_fireDefense protected_oe property

protected int _fireDefense
Résultat int

_friendly protected_oe property

protected bool _friendly
Résultat bool

_gold protected_oe property

protected int _gold
Résultat int

_health protected_oe property

protected int _health
Résultat int

_healthReg protected_oe property

protected int _healthReg
Résultat int

_iceDamage protected_oe property

protected int _iceDamage
Résultat int

_iceDefense protected_oe property

protected int _iceDefense
Résultat int

_id protected_oe property

protected int _id
Résultat int

_inventory protected_oe property

protected List _inventory
Résultat List

_lastCheckpoint protected_oe property

protected int _lastCheckpoint
Résultat int

_level protected_oe property

protected int _level
Résultat int

_lives protected_oe property

Number of lives (ressurection)
protected int _lives
Résultat int

_locked protected_oe property

protected bool _locked
Résultat bool

_mana protected_oe property

protected int _mana
Résultat int

_manaReg protected_oe property

protected int _manaReg
Résultat int

_maxMana protected_oe property

protected int _maxMana
Résultat int

_maxhealth protected_oe property

protected int _maxhealth
Résultat int

_name protected_oe property

protected string _name
Résultat string

_newItems protected_oe property

protected int _newItems
Résultat int

_online protected_oe property

Determines whether player is available
protected bool _online
Résultat bool

_penetrate protected_oe property

protected int _penetrate
Résultat int

_quicklist public_oe property

public List _quicklist
Résultat List

_random protected_oe property

A random number generator
protected Random,System _random
Résultat System.Random

_ranged protected_oe property

protected bool _ranged
Résultat bool

_regCounter protected_oe property

Internal counter for regeneration of health or mana
protected int _regCounter
Résultat int

_resist protected_oe property

protected int _resist
Résultat int

_scared protected_oe property

protected int _scared
Résultat int

_skills protected_oe property

protected int _skills
Résultat int

_stealHealth protected_oe property

protected int _stealHealth
Résultat int

_stealMana protected_oe property

protected int _stealMana
Résultat int

_stunned protected_oe property

protected int _stunned
Résultat int

_tile protected_oe property

protected ActorTile _tile
Résultat ActorTile

_viewRange protected_oe property

protected int _viewRange
Résultat int