Show / Hide Table of Contents

    Class Creature

    Class that represents all creatures in the game.

    Inheritance
    System.Object
    Thing
    Creature
    CombatantCreature
    Implements
    ICreatureThatSensesOthers
    ICreature
    IThing
    IContainedThing
    System.IEquatable<IThing>
    IThingContainer
    ILocatable
    System.IEquatable<ICreature>
    Inherited Members
    Thing.LocationChanged
    Thing.UniqueId
    Thing.CanBeMoved
    Thing.ParentContainer
    Thing.Location
    Thing.TrackedEvents
    Thing.Conditions
    Thing.RaiseLocationChanged(Location)
    Thing.ToString()
    Thing.Equals(IThing)
    Thing.StartTrackingEvent(IEvent, String)
    Thing.StopTrackingEvent(IEvent, String)
    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: Fibula.Creatures
    Assembly: Fibula.Creatures.dll
    Syntax
    public abstract class Creature : Thing, ICreatureThatSensesOthers, ICreature, IThing, IContainedThing, IEquatable<IThing>, IThingContainer, ILocatable, IEquatable<ICreature>

    Constructors

    | Improve this Doc View Source

    Creature(String, String, UInt16, UInt16, UInt16)

    Initializes a new instance of the Creature class.

    Declaration
    protected Creature(string name, string article, ushort maxHitpoints, ushort corpseTypeId = 0, ushort hitpoints = 0)
    Parameters
    Type Name Description
    System.String name

    The name of this creature.

    System.String article

    An article for the name of this creature.

    System.UInt16 maxHitpoints

    The maximum hitpoints of the creature.

    System.UInt16 corpseTypeId

    The corpse of the creature.

    System.UInt16 hitpoints

    The current hitpoints of the creature.

    Properties

    | Improve this Doc View Source

    Article

    Gets the article in the name of the creature.

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

    BloodType

    Gets or sets this creature's blood type.

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

    CanWalk

    Gets a value indicating whether this creature can walk.

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

    CarryLocation

    Gets the location where this thing is being carried at, which is null for creatures.

    Declaration
    public override Location? CarryLocation { get; }
    Property Value
    Type Description
    System.Nullable<Location>
    Overrides
    Thing.CarryLocation
    | Improve this Doc View Source

    CorpseTypeId

    Gets the corpse of the creature.

    Declaration
    public ushort CorpseTypeId { get; }
    Property Value
    Type Description
    System.UInt16
    | Improve this Doc View Source

    Direction

    Gets or sets the direction that this creature is facing.

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

    EmittedLightColor

    Gets or sets this creature's light color.

    Declaration
    public byte EmittedLightColor { get; protected set; }
    Property Value
    Type Description
    System.Byte
    | Improve this Doc View Source

    EmittedLightLevel

    Gets or sets this creature's light level.

    Declaration
    public byte EmittedLightLevel { get; protected set; }
    Property Value
    Type Description
    System.Byte
    | Improve this Doc View Source

    Flags

    Gets this creature's flags.

    Declaration
    public uint Flags { get; }
    Property Value
    Type Description
    System.UInt32
    | Improve this Doc View Source

    Id

    Gets the creature's in-game id.

    Declaration
    public uint Id { get; }
    Property Value
    Type Description
    System.UInt32
    | Improve this Doc View Source

    Inventory

    Gets or sets the inventory for the creature.

    Declaration
    public abstract IInventory Inventory { get; protected set; }
    Property Value
    Type Description
    IInventory
    | Improve this Doc View Source

    IsDead

    Gets a value indicating whether the creature is considered dead.

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

    LastMovementCostModifier

    Gets or sets the creature's last move modifier.

    Declaration
    public decimal LastMovementCostModifier { get; set; }
    Property Value
    Type Description
    System.Decimal
    | Improve this Doc View Source

    Name

    Gets the name of the creature.

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

    Outfit

    Gets or sets the outfit of this creature.

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

    Speed

    Gets or sets this creature's speed.

    Declaration
    public abstract ushort Speed { get; protected set; }
    Property Value
    Type Description
    System.UInt16
    | Improve this Doc View Source

    Stats

    Gets the current stats information for the creature.

    Declaration
    public IDictionary<CreatureStat, IStat> Stats { get; }
    Property Value
    Type Description
    System.Collections.Generic.IDictionary<CreatureStat, IStat>
    Remarks

    The key is a CreatureStat, and the value is an IStat.

    | Improve this Doc View Source

    TrackedCreatures

    Gets the creatures who are sensed by this creature.

    Declaration
    public IEnumerable<ICreature> TrackedCreatures { get; }
    Property Value
    Type Description
    System.Collections.Generic.IEnumerable<ICreature>
    | Improve this Doc View Source

    TypeId

    Gets the type id of this creature.

    Declaration
    public override ushort TypeId { get; }
    Property Value
    Type Description
    System.UInt16
    Overrides
    Thing.TypeId
    | Improve this Doc View Source

    VariableSpeed

    Gets or sets this creature's variable speed.

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

    WalkPlan

    Gets or sets this creature's walk plan.

    Declaration
    public WalkPlan WalkPlan { get; set; }
    Property Value
    Type Description
    WalkPlan

    Methods

    | Improve this Doc View Source

    AddContent(IThingFactory, IThing, Byte)

    Attempts to add a IThing to this container.

    Declaration
    public (bool result, IThing remainder) AddContent(IThingFactory thingFactory, IThing thing, byte index = 255)
    Parameters
    Type Name Description
    IThingFactory thingFactory

    A reference to the factory of things to use.

    IThing thing

    The IThing to add to the container.

    System.Byte index

    Optional. The index at which to add the IThing. Defaults to byte.MaxValue, which instructs to add the IThing at any free index.

    Returns
    Type Description
    System.ValueTuple<System.Boolean, IThing>

    A tuple with a value indicating whether the attempt was at least partially successful, and false otherwise. If the result was only partially successful, a remainder of the thing may be returned.

    | Improve this Doc View Source

    CalculateMovementSpeed()

    Calculates the movement speed of the creature.

    Declaration
    protected virtual ushort CalculateMovementSpeed()
    Returns
    Type Description
    System.UInt16

    The movement speed of the creature.

    | Improve this Doc View Source

    CanSee(Location)

    Checks if this creature can see a given location.

    Declaration
    public bool CanSee(Location location)
    Parameters
    Type Name Description
    Location location

    The location to check against.

    Returns
    Type Description
    System.Boolean

    True if this creature can see the given location, false otherwise.

    | Improve this Doc View Source

    CanSee(ICreature)

    Checks if this creature can see a given creature.

    Declaration
    public bool CanSee(ICreature otherCreature)
    Parameters
    Type Name Description
    ICreature otherCreature

    The creature to check against.

    Returns
    Type Description
    System.Boolean

    True if this creature can see the given creature, false otherwise.

    | Improve this Doc View Source

    DescribeForLogger()

    Provides a string describing the current creature for logging purposes.

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

    The string to log.

    Overrides
    Thing.DescribeForLogger()
    | Improve this Doc View Source

    Equals(ICreature)

    Indicates whether the current object is equal to another object of the same type.

    Declaration
    public bool Equals(ICreature other)
    Parameters
    Type Name Description
    ICreature other

    The other object to compare against.

    Returns
    Type Description
    System.Boolean

    True if the current object is equal to the other parameter, false otherwise.

    | Improve this Doc View Source

    FindThingAtIndex(Byte)

    Attempts to find an IThing whitin this container.

    Declaration
    public IThing FindThingAtIndex(byte index)
    Parameters
    Type Name Description
    System.Byte index

    The index at which to look for the IThing.

    Returns
    Type Description
    IThing

    The IThing found at the index, if any was found.

    | Improve this Doc View Source

    RaiseStatChange(CreatureStat, UInt32, Byte)

    Raises the StatChanged event for this creature on the given stat.

    Declaration
    protected void RaiseStatChange(CreatureStat forStat, uint previousLevel, byte previousPercent)
    Parameters
    Type Name Description
    CreatureStat forStat

    The stat that changed.

    System.UInt32 previousLevel

    The previous stat value.

    System.Byte previousPercent

    The previous percent value of the stat.

    | Improve this Doc View Source

    RemoveContent(IThingFactory, ref IThing, Byte, Byte)

    Attempts to remove a thing from this container.

    Declaration
    public (bool result, IThing remainder) RemoveContent(IThingFactory thingFactory, ref IThing thing, byte index = 255, byte amount = 1)
    Parameters
    Type Name Description
    IThingFactory thingFactory

    A reference to the factory of things to use.

    IThing thing

    The IThing to remove from the container.

    System.Byte index

    Optional. The index from which to remove the IThing. Defaults to byte.MaxValue, which instructs to remove the IThing if found at any index.

    System.Byte amount

    Optional. The amount of the thing to remove.

    Returns
    Type Description
    System.ValueTuple<System.Boolean, IThing>

    A tuple with a value indicating whether the attempt was at least partially successful, and false otherwise. If the result was only partially successful, a remainder of the thing may be returned.

    | Improve this Doc View Source

    ReplaceContent(IThingFactory, IThing, IThing, Byte, Byte)

    Attempts to replace a IThing from this container with another.

    Declaration
    public (bool result, IThing remainderToChange) ReplaceContent(IThingFactory thingFactory, IThing fromThing, IThing toThing, byte index = 255, byte amount = 1)
    Parameters
    Type Name Description
    IThingFactory thingFactory

    A reference to the factory of things to use.

    IThing fromThing

    The IThing to remove from the container.

    IThing toThing

    The IThing to add to the container.

    System.Byte index

    Optional. The index from which to replace the IThing. Defaults to byte.MaxValue, which instructs to replace the IThing if found at any index.

    System.Byte amount

    Optional. The amount of the fromThing to replace.

    Returns
    Type Description
    System.ValueTuple<System.Boolean, IThing>

    A tuple with a value indicating whether the attempt was at least partially successful, and false otherwise. If the result was only partially successful, a remainder of the thing may be returned.

    | Improve this Doc View Source

    StartSensingCreature(ICreature)

    Flags a creature as being sensed.

    Declaration
    public void StartSensingCreature(ICreature creature)
    Parameters
    Type Name Description
    ICreature creature

    The creature which is sensed.

    | Improve this Doc View Source

    StopSensingCreature(ICreature)

    Flags a creature as no longed being sensed.

    Declaration
    public void StopSensingCreature(ICreature creature)
    Parameters
    Type Name Description
    ICreature creature

    The creature that is lost.

    Events

    | Improve this Doc View Source

    CreatureLost

    Event called when this creature loses track of a sensed creature.

    Declaration
    public event OnCreatureLost CreatureLost
    Event Type
    Type Description
    OnCreatureLost
    | Improve this Doc View Source

    CreatureSeen

    Event called when this creature sees another.

    Declaration
    public event OnCreatureSeen CreatureSeen
    Event Type
    Type Description
    OnCreatureSeen
    | Improve this Doc View Source

    CreatureSensed

    Event called when this creature senses another.

    Declaration
    public event OnCreatureSensed CreatureSensed
    Event Type
    Type Description
    OnCreatureSensed
    | Improve this Doc View Source

    StatChanged

    Event triggered when this creature's stat has changed.

    Declaration
    public event OnCreatureStatChanged StatChanged
    Event Type
    Type Description
    OnCreatureStatChanged

    Implements

    ICreatureThatSensesOthers
    ICreature
    IThing
    IContainedThing
    System.IEquatable<T>
    IThingContainer
    ILocatable
    System.IEquatable<T>

    Extension Methods

    ObjectExtensions.YieldSingleItem<T>(T)
    ObjectExtensions.GetPropertyValue(Object, String)
    Validate.ThrowIfNull(Object, String)
    • Improve this Doc
    • View Source
    Back to top Copyright © 2018-2020 | The Fibula Project
    Generated using DocFX | Jose L. Nuñez de Caceres et al.