• Home
  • API reference
  • Source code
Show / Hide Table of Contents
  • osrlib.Controllers
    • GameManager
  • osrlib.Core
    • Ability
    • AbilityType
    • Adventure
    • Alignment
    • Being
    • BeingTargetingEventArgs
    • BeingTargetingEventHandler
    • CharacterClass
    • Dungeon
    • Encounter
    • GameAction
    • GameActionEventArgs
    • GameActionEventHandler
    • GamePosition
    • Modifier
    • Party
    • Quest
    • User
    • Weapon
    • WeaponType
  • osrlib.Dice
    • DiceHand
    • DiceRoll
    • DiceRolledEventArgs
    • DiceRolledEventHandler
    • Die
  • osrlib.SaveLoad
    • SaveLoadLocal
    • SaveType
  • osrlib.Tests
    • CoreRulesTests
    • DiceTests
    • PartyGenerator
    • ReadMeTests
    • SaveLoadTests
    • SteppedBattleTests
  • osrlib.Utility
    • Randomizer

Class Being

The Being represents a living entity in within an Adventure, and is used for both player characters and monsters.

Inheritance
System.Object
Being
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: osrlib.Core
Assembly: osrlib.Core.dll
Syntax
public class Being
Examples

Create a player character

Being fighter = new Being
{
    Name = "Blarg the Destructor",
    Defense = 10,
    MaxHitPoints = DiceRoll.RollDice(new DiceHand(2, DieType.d6)),
    ActiveWeapon = new Weapon { Name = "Battle Axe", Type = WeaponType.Melee, DamageDie = new DiceHand(1, DieType.d12) }
};
fighter.HitPoints = fighter.MaxHitPoints;
fighter.RollAbilities();

Create a monster

Being goblin = new Being
{
    Name = "Goblin Chieftain",
    Defense = 12,
    MaxHitPoints = DiceRoll.RollDice(new DiceHand(4, DieType.d6)),
    ActiveWeapon = new Weapon { Name = "Javelin", Type = WeaponType.Ranged, DamageDie = new DiceHand(2, DieType.d4) }
};
goblin.HitPoints = goblin1.MaxHitPoints;
goblin.RollAbilities();

Properties

| Improve this Doc View Source

Abilities

Gets or sets the Being's Ability collection.

Declaration
public List<Ability> Abilities { get; set; }
Property Value
Type Description
System.Collections.Generic.List<Ability>
| Improve this Doc View Source

ActiveWeapon

Gets or sets the Being's active weapon or spell. The active weapon is a weapon or offensive spell, and is used when when the Being attacks another being.

Declaration
public Weapon ActiveWeapon { get; set; }
Property Value
Type Description
Weapon
| Improve this Doc View Source

Alignment

Gets or sets the Alignment of the Being.

Declaration
public Alignment Alignment { get; set; }
Property Value
Type Description
Alignment
| Improve this Doc View Source

Class

Gets or sets the Being's CharacterClass.

Declaration
public CharacterClass Class { get; set; }
Property Value
Type Description
CharacterClass
Remarks

This can be a player character class or a monster type.

| Improve this Doc View Source

Defense

Gets or sets the minimum attack roll needed to hit the GamePiece.

Declaration
public int Defense { get; set; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

ExperiencePoints

Gets or sets the number of experience points for the Being.

Declaration
public int ExperiencePoints { get; set; }
Property Value
Type Description
System.Int32
Remarks

This is the amount of experience possessed by a player character or the XP value of a monster.

| Improve this Doc View Source

HitPoints

Gets or sets the number of hit points for the Being.

Declaration
public int HitPoints { get; set; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

IsAlive

Gets whether the Being is alive (has greater than zero hit points).

Declaration
public bool IsAlive { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

IsTargetable

Gets or sets whether the Being can be attacked. Default: true.

Declaration
public bool IsTargetable { get; set; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

MaxHitPoints

Gets or sets the maximum hit points for the Being.

Declaration
public int MaxHitPoints { get; set; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

Name

Gets or sets the name of the Being.

Declaration
public string Name { get; set; }
Property Value
Type Description
System.String
| Improve this Doc View Source

PotentialTargets

Gets the list of targets from which this Being can select one or more targets before calling PerformActionOnSelectedTargets().

Declaration
public ReadOnlyCollection<Being> PotentialTargets { get; }
Property Value
Type Description
System.Collections.ObjectModel.ReadOnlyCollection<Being>
Remarks

You can't populate this list directly. Use osrlib.Core.Being.AddPotentialTargets(System.Collections.Generic.List{osrlib.Core.Being}) instead.

| Improve this Doc View Source

SelectedTargets

Gets the list of targets that the Being has selected for its next GameAction.

Declaration
public ReadOnlyCollection<Being> SelectedTargets { get; }
Property Value
Type Description
System.Collections.ObjectModel.ReadOnlyCollection<Being>
Remarks

You can't populate this list directly. Use SelectTarget(Being), then call PerformActionOnSelectedTargets() to perform GameActions on the targets in the collection with this Being's ActiveWeapon.

Methods

| Improve this Doc View Source

AddAbilityModifier(Modifier, AbilityType)

Adds a modifier to the specified ability's ScoreModifiers collection. This acts as a bonus or penalty, for example due to an enchantment or curse affecting the Being.

Declaration
public void AddAbilityModifier(Modifier modifier, AbilityType abilityType)
Parameters
Type Name Description
Modifier modifier

The modifier to adjust the specified ability score.

AbilityType abilityType

The ability to which to apply the modifier.

| Improve this Doc View Source

ApplyDamage(Int32)

Deducts the specified amount of HitPoints from the Being.

Declaration
public bool ApplyDamage(int damage)
Parameters
Type Name Description
System.Int32 damage

The amount of HitPoints to deduct.

Returns
Type Description
System.Boolean

Whether the applied damage killed the being.

Remarks

If the Being is killed by this damage, the osrlib.Core.Being.OnKilled event is raised. The event is raised only if the Being was previously alive, and returns true only if the Being was alive prior to taking this damage.

| Improve this Doc View Source

GetAttackRoll()

Returns the attack roll rolled by the Being. The Being's active weapon (or spell) is used in calculating the roll, as are any ability modifiers appropriate for the weapon type.

Declaration
public DiceRoll GetAttackRoll()
Returns
Type Description
DiceRoll

The DiceRoll to be compared to a Being's defense value.

| Improve this Doc View Source

GetDamageRoll()

Returns the damage roll rolled by the Being. The Being's active weapon (or spell) is used in calculating the roll, as are any ability modifiers appropriate for the weapon type.

Declaration
public DiceRoll GetDamageRoll()
Returns
Type Description
DiceRoll

The DiceRoll to be deducted from an opponent Being's hit points.

| Improve this Doc View Source

PerformActionOnSelectedTargets()

For each Being in its SelectedTargets collection, creates and performs a GameAction.

Declaration
public void PerformActionOnSelectedTargets()
Remarks

Call this after the SelectedTargets collection has been populated with SelectTarget(Being) or SelectTargets(List<Being>).

| Improve this Doc View Source

RollAbilities()

Rolls the full set of ability scores for the Being. Calling this method removes any abilities currently in the Being's Abilities collection.

Declaration
public List<Ability> RollAbilities()
Returns
Type Description
System.Collections.Generic.List<Ability>

The Being's newly populated Abilities collection.

| Improve this Doc View Source

RollAbilityScore(AbilityType)

Rolls the specified ability score and adds the ability to the Being's ability collection. If an ability of the same type is already in the Abilities collection, the existing ability is removed before adding the new one generated by this method.

Declaration
public Ability RollAbilityScore(AbilityType abilityType)
Parameters
Type Name Description
AbilityType abilityType

The type of ability to roll and add to the Abilities collection.

Returns
Type Description
Ability

The newly rolled Ability.

| Improve this Doc View Source

SelectTarget(Being)

Adds the specified Being to the list of targets that will be the destination of the GameAction executed when PerformActionOnSelectedTargets() is called.

Declaration
public void SelectTarget(Being target)
Parameters
Type Name Description
Being target

The Being that will be a destination of the GameAction performed when PerformActionOnSelectedTargets() is called.

| Improve this Doc View Source

SelectTargets(List<Being>)

Adds the specified Beings to the list of targets that will be the destination of the GameAction executed when PerformActionOnSelectedTargets() is called.

Declaration
public void SelectTargets(List<Being> targets)
Parameters
Type Name Description
System.Collections.Generic.List<Being> targets

The collection of Beings that will be a destination of the GameAction performed when PerformActionOnSelectedTargets() is called.

| Improve this Doc View Source

ToString()

Gets the string representation of the Being.

Declaration
public override string ToString()
Returns
Type Description
System.String

Single-line text representation of the Being.

Overrides
System.Object.ToString()

Events

| Improve this Doc View Source

ActionPerformed

Event raised when this Being has performed a GameAction, such as when the Being attacks an enemy.

Declaration
public event GameActionEventHandler ActionPerformed
Event Type
Type Description
GameActionEventHandler
Remarks

Subscribe to this event to obtain information about the Being on which this Being is performing an action and determine the victor of the action. For example, you might use this to display the name of this Being, the stats about the the weapon or spell they wielded (via the ActiveWeapon property), and whether the action was successful (whether they hit and the damage dealt).

| Improve this Doc View Source

Killed

Event raised when the Being's HitPoints reach zero or below.

Declaration
public event EventHandler Killed
Event Type
Type Description
System.EventHandler
| Improve this Doc View Source

PerformingAction

Event raised when this Being is about to perform a GameAction, such as when the Being is about to attack an enemy.

Declaration
public event GameActionEventHandler PerformingAction
Event Type
Type Description
GameActionEventHandler
Remarks

Subscribe to this event to obtain information about the Being on which this Being is performing an action. For example, you might use this to display the name of this Being and stats about the the weapon or spell they're wielding (via the ActiveWeapon property).

| Improve this Doc View Source

PotentialTargetsAdded

Event raised when the Being's PotentialTargets collection is populated.

Declaration
public event EventHandler PotentialTargetsAdded
Event Type
Type Description
System.EventHandler
| Improve this Doc View Source

SelectedAsTarget

Event raised when this Being has been selected as a target; that is, the targeting Being's SelectTarget(Being) was called with this Being as the target.

Declaration
public event BeingTargetingEventHandler SelectedAsTarget
Event Type
Type Description
BeingTargetingEventHandler
| Improve this Doc View Source

TargetSelected

Event raised when this Being selects a target with SelectTarget(Being).

Declaration
public event BeingTargetingEventHandler TargetSelected
Event Type
Type Description
BeingTargetingEventHandler
  • Improve this Doc
  • View Source
Back to top Generated by DocFX