Class HarmRule
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
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
attackerICharacterdefenderICharacter
Returns
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
aICharacterbICharacter
Returns
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
castKeylongIdentifies the cast (its projectiles and pulses share it).
targetICharacterThe character the cast struck.
splashboolTrue for an area blast's victims, which are never counted: a neutral beside the enemy is not a target.
Returns
EndAttack(AttackScope)
Ends the scope BeginAttack(long, ICharacter, bool) opened, restoring the one it returned.
public static void EndAttack(HarmRule.AttackScope previous)
Parameters
previousHarmRule.AttackScope
Install(IHarmRelation)
Adds a relation by hand (tests); a type already installed is replaced.
public static void Install(IHarmRelation relation)
Parameters
relationIHarmRelation
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
attackerICharacterdefenderICharacteraggressorICharacter
Returns
Principal(ICharacter)
The character whose relations character acts under: a pet's owner, else itself.
public static ICharacter Principal(ICharacter character)
Parameters
characterICharacter
Returns
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
attackerICharacterdefenderICharacter
Returns
Uninstall(Type)
Removes the relation of a type; true when there was one.
public static bool Uninstall(Type relationType)
Parameters
relationTypeType