Table of Contents

Class HarmRule

Namespace
FishMMO.Shared
Assembly
FishMMO.Shared.dll

Who may harm whom: the one rule every hostile effect answers to, so an ability needs no authored condition to leave friends alone. Asked by damage (Damage(ICharacter, int, DamageAttributeTemplate, bool, bool)) and, through CharacterEvade, by debuffs, knockback, interrupts, taunts, buff-stripping dispels and resource drains.

public static class HarmRule
Inheritance
HarmRule
Inherited Members

Remarks

The rule itself is Core; what decides it is supplied by features as IHarmRelations, asked in order until one decides. Shipped: the arena's match sides (only an opponent, whatever anyone's toggle says), wildlife (outside every other relation), companions (party, guild, one's own pet: never), and faction standing with the aggression toggles. With no relation deciding, or none installed, a hit is allowed: combat works without any of them.

No attacker (the world: a fall, lava), or the character harming itself, is never restricted. A pet answers as its owner on either side (Principal(ICharacter)).

Properties

Relations

The installed relations, in the order they are asked.

public static IReadOnlyList<IHarmRelation> Relations { get; }

Property Value

IReadOnlyList<IHarmRelation>

Methods

Allows(ICharacter, ICharacter)

MayHarm(ICharacter, ICharacter, out ICharacter), with its consequences told to every relation: the call every hostile route makes once it is about to apply the effect. Allowed between two sides: OnAllowed(ICharacter, ICharacter) (the aggression lock restarts). Refused at the character an attack cast struck: OnRefusedAttack(ICharacter, ICharacter, long, IHarmRelation) (refused casts count toward turning aggression on).

public static bool Allows(ICharacter attacker, ICharacter defender)

Parameters

attacker ICharacter
defender ICharacter

Returns

bool

AreCompanions(ICharacter, ICharacter)

Whether a and b are on one side outside an arena: any ICompanionRelation says so (the same party, the same guild, a pet and its owner, two pets of one owner). Companions are never harmed, and never drawn hostile, whatever their aggression toggles say.

public static bool AreCompanions(ICharacter a, ICharacter b)

Parameters

a ICharacter
b ICharacter

Returns

bool

BeginAttack(long, ICharacter, bool)

Marks the effects applied until EndAttack(AttackScope) as one hit of the cast castKey on target, so a refusal among them can be counted per cast. Returns the scope it replaced, for EndAttack(AttackScope) (hits can nest).

public static HarmRule.AttackScope BeginAttack(long castKey, ICharacter target, bool splash)

Parameters

castKey long

Identifies the cast (its projectiles and pulses share it).

target ICharacter

The character the cast struck.

splash bool

True for an area blast's victims, which are never counted: a neutral beside the enemy is not a target.

Returns

HarmRule.AttackScope

EndAttack(AttackScope)

Ends the scope BeginAttack(long, ICharacter, bool) opened, restoring the one it returned.

public static void EndAttack(HarmRule.AttackScope previous)

Parameters

previous HarmRule.AttackScope

Install(IHarmRelation)

Adds a relation by hand (tests); a type already installed is replaced.

public static void Install(IHarmRelation relation)

Parameters

relation IHarmRelation

MayHarm(ICharacter, ICharacter, out ICharacter)

Whether attacker may harm defender. aggressor is the character (a pet's owner, for a pet) whose own choice alone allowed it (an aggression toggle), else null.

public static bool MayHarm(ICharacter attacker, ICharacter defender, out ICharacter aggressor)

Parameters

attacker ICharacter
defender ICharacter
aggressor ICharacter

Returns

bool

Principal(ICharacter)

The character whose relations character acts under: a pet's owner, else itself.

public static ICharacter Principal(ICharacter character)

Parameters

character ICharacter

Returns

ICharacter

Rediscover()

Forgets the installed relations; the next question discovers them again from the loaded assemblies.

public static void Rediscover()

RefusedForWantOfAggression(ICharacter, ICharacter)

True when attacker may not harm defender now, and the only thing in the way is the attacking side's aggression toggle being off (see AggressionLiftsRefusal). An order that names such a target (a pet sent at a neutral) can turn the toggle on and go ahead; companions, an arena's teams and a pack are never this.

public static bool RefusedForWantOfAggression(ICharacter attacker, ICharacter defender)

Parameters

attacker ICharacter
defender ICharacter

Returns

bool

Uninstall(Type)

Removes the relation of a type; true when there was one.

public static bool Uninstall(Type relationType)

Parameters

relationType Type

Returns

bool