Class CombatantCreature
Class that represents all creatures in the game.
Inherited Members
Namespace: Fibula.Creatures
Assembly: Fibula.Creatures.dll
Syntax
public abstract class CombatantCreature : Creature, ICombatant, ICreatureWithSkills, ICreatureThatSensesOthers, ICreature, IThing, IContainedThing, IEquatable<IThing>, IThingContainer, ILocatable, IEquatable<ICreature>
Constructors
| Improve this Doc View SourceCombatantCreature(String, String, UInt16, UInt16, UInt16, Decimal, Decimal)
Initializes a new instance of the CombatantCreature class.
Declaration
protected CombatantCreature(string name, string article, ushort maxHitpoints, ushort corpse, ushort hitpoints = 0, decimal baseAttackSpeed = 1.0M, decimal baseDefenseSpeed = 1.0M)
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 | corpse | The corpse of the creature. |
System.UInt16 | hitpoints | The current hitpoints of the creature. |
System.Decimal | baseAttackSpeed | Optional. The base attack speed for this creature. Bounded between [MinimumCombatSpeed, MaximumCombatSpeed] inclusive. Defaults to DefaultAttackSpeed. |
System.Decimal | baseDefenseSpeed | Optional. The base defense speed for this creature. Bounded between [MinimumCombatSpeed, MaximumCombatSpeed] inclusive. Defaults to DefaultDefenseSpeed. |
Properties
| Improve this Doc View SourceAttackedBy
Gets the collection of combatants currently attacking this combatant.
Declaration
public IEnumerable<ICombatant> AttackedBy { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<ICombatant> |
AttackSpeed
Gets a metric of how fast a combatant can earn an attack credit per combat round.
Declaration
public decimal AttackSpeed { get; }
Property Value
Type | Description |
---|---|
System.Decimal |
AutoAttackRange
Gets the range that the auto attack has.
Declaration
public abstract byte AutoAttackRange { get; }
Property Value
Type | Description |
---|---|
System.Byte |
AutoAttackTarget
Gets the current target combatant.
Declaration
public ICombatant AutoAttackTarget { get; }
Property Value
Type | Description |
---|---|
ICombatant |
ChaseMode
Gets or sets the chase mode selected by this combatant.
Declaration
public ChaseMode ChaseMode { get; set; }
Property Value
Type | Description |
---|---|
ChaseMode |
ChaseTarget
Gets or sets the target being chased, if any.
Declaration
public ICreature ChaseTarget { get; protected set; }
Property Value
Type | Description |
---|---|
ICreature |
DamageTakenInSession
Gets the distribution of damage taken by any combatant that has attacked this combatant while the current combat is active.
Declaration
public IEnumerable<(uint, uint)> DamageTakenInSession { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.ValueTuple<System.UInt32, System.UInt32>> |
DefenseSpeed
Gets a metric of how fast a combatant can earn a defense credit per combat round.
Declaration
public decimal DefenseSpeed { get; }
Property Value
Type | Description |
---|---|
System.Decimal |
FightMode
Gets or sets the fight mode selected by this combatant.
Declaration
public FightMode FightMode { get; set; }
Property Value
Type | Description |
---|---|
FightMode |
Skills
Gets the current skills information for the combatant.
Declaration
public IDictionary<SkillType, ISkill> Skills { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IDictionary<SkillType, ISkill> |
Remarks
Methods
| Improve this Doc View SourceAddToCombatList(ICombatant)
Starts tracking another ICombatant.
Declaration
public abstract void AddToCombatList(ICombatant otherCombatant)
Parameters
Type | Name | Description |
---|---|---|
ICombatant | otherCombatant | The other combatant, now in view. |
ApplyDamage(DamageInfo, UInt32)
Applies damage to the combatant, which is expected to apply reductions and protections.
Declaration
public DamageInfo ApplyDamage(DamageInfo damageInfo, uint fromCombatantId = 0U)
Parameters
Type | Name | Description |
---|---|---|
DamageInfo | damageInfo | The information of the damage to make, without reductions. |
System.UInt32 | fromCombatantId | The combatant from which to track the damage, if any. |
Returns
Type | Description |
---|---|
DamageInfo | The information about the damage actually done. |
ApplyDamageModifiers(ref DamageInfo)
Applies damage modifiers to the damage information provided.
Declaration
protected abstract void ApplyDamageModifiers(ref DamageInfo damageInfo)
Parameters
Type | Name | Description |
---|---|---|
DamageInfo | damageInfo | The damage information. |
CalculateSkillPercent(SkillType)
Calculates the current percentual value between current and target counts for the given skill.
Declaration
public byte CalculateSkillPercent(SkillType skillType)
Parameters
Type | Name | Description |
---|---|---|
SkillType | skillType | The type of skill to calculate for. |
Returns
Type | Description |
---|---|
System.Byte | A value between [0, 100] representing the current percentual value. |
DecreaseAttackSpeed(Decimal)
Decreases the attack speed of this combatant.
Declaration
public void DecreaseAttackSpeed(decimal decreaseAmount)
Parameters
Type | Name | Description |
---|---|---|
System.Decimal | decreaseAmount | The amount by which to decrease. |
DecreaseDefenseSpeed(Decimal)
Decreases the defense speed of this combatant.
Declaration
public void DecreaseDefenseSpeed(decimal decreaseAmount)
Parameters
Type | Name | Description |
---|---|---|
System.Decimal | decreaseAmount | The amount by which to decrease. |
IncreaseAttackSpeed(Decimal)
Increases the attack speed of this combatant.
Declaration
public void IncreaseAttackSpeed(decimal increaseAmount)
Parameters
Type | Name | Description |
---|---|---|
System.Decimal | increaseAmount | The amount by which to increase. |
IncreaseDefenseSpeed(Decimal)
Increases the defense speed of this combatant.
Declaration
public void IncreaseDefenseSpeed(decimal increaseAmount)
Parameters
Type | Name | Description |
---|---|---|
System.Decimal | increaseAmount | The amount by which to increase. |
RaiseSkillChange(SkillType, UInt32, Byte)
Raises the SkillChanged event for this creature on the given skill.
Declaration
protected void RaiseSkillChange(SkillType forSkill, uint previousLevel, byte previousPercent)
Parameters
Type | Name | Description |
---|---|---|
SkillType | forSkill | The skill to advance. |
System.UInt32 | previousLevel | The previous skill level. |
System.Byte | previousPercent | The previous percent of completion to next level. |
RemoveFromCombatList(ICombatant)
Stops tracking another ICombatant.
Declaration
public abstract void RemoveFromCombatList(ICombatant otherCombatant)
Parameters
Type | Name | Description |
---|---|---|
ICombatant | otherCombatant | The other combatant, now in view. |
SetAttackedBy(ICombatant)
Sets this combatant as being attacked by another.
Declaration
public void SetAttackedBy(ICombatant combatant)
Parameters
Type | Name | Description |
---|---|---|
ICombatant | combatant | The combatant attacking this one, if any. |
SetAttackTarget(ICombatant)
Sets the attack target of this combatant.
Declaration
public bool SetAttackTarget(ICombatant otherCombatant)
Parameters
Type | Name | Description |
---|---|---|
ICombatant | otherCombatant | The other target combatant, if any. |
Returns
Type | Description |
---|---|
System.Boolean | True if the target was actually changed, false otherwise. |
SetFollowTarget(ICreature)
Sets the chasing target of this combatant.
Declaration
public bool SetFollowTarget(ICreature target)
Parameters
Type | Name | Description |
---|---|---|
ICreature | target | The target to chase, if any. |
Returns
Type | Description |
---|---|
System.Boolean | True if the target was actually changed, false otherwise. |
UnsetAttackedBy(ICombatant)
Unsets this combatant as being attacked by another.
Declaration
public void UnsetAttackedBy(ICombatant combatant)
Parameters
Type | Name | Description |
---|---|---|
ICombatant | combatant | The combatant no longer attacking this one, if any. |
Events
| Improve this Doc View SourceAttackTargetChanged
Event to call when the attack target changes.
Declaration
public event OnAttackTargetChanged AttackTargetChanged
Event Type
Type | Description |
---|---|
OnAttackTargetChanged |
Death
Event to call when the combatant dies.
Declaration
public event OnDeath Death
Event Type
Type | Description |
---|---|
OnDeath |
FollowTargetChanged
Event to call when the follow target changes.
Declaration
public event OnFollowTargetChanged FollowTargetChanged
Event Type
Type | Description |
---|---|
OnFollowTargetChanged |
SkillChanged
Event triggered when this a skill of this creature changes.
Declaration
public event OnCreatureSkillChanged SkillChanged
Event Type
Type | Description |
---|---|
OnCreatureSkillChanged |