Class CharacterEvade
Single definition of "this character accepts nothing hostile": it is evading, or (with a source) the harm rule (HarmRule) does not let that source harm it.
public static class CharacterEvade
- Inheritance
-
CharacterEvade
- Inherited Members
Remarks
An NPC whose leash ended a fight walks home evading (IsEvading). The
evade exists to stop a leash being farmed: without it a player could drag a mob to the edge
of its range and hit it all the way home, or land one blow on the way to reset the fight on
their own terms. That is only closed if EVERY hostile route is closed, and they are applied
in three different places — damage in CharacterDamageController.Damage, debuffs in
ApplyBuffAction, displacement in KnockbackHitAction — so the question lives
here rather than being written out three times and drifting. Threat and taunt are refused by
the brain itself, which owns the threat table.
Server-side truth only. The brain exists only on the scene server, so on every client
this answers false. A client that predicts a hostile effect on an evading NPC is corrected
the way any refused prediction is: the damage report says Evade, the provisional
debuff is dropped by the next full buff set, and knockback never predicted a displacement.
Separate from Immortal on purpose, and it does not change what Immortal means: an immortal character still takes buffs and debuffs as it always has. See IsEvading for why the evade is not built on Immortal.
Methods
IsHostileBuff(bool, bool)
Whether a buff is a hostile effect: a debuff put on its target by some other character.
public static bool IsHostileBuff(bool isDebuff, bool fromAnotherCharacter)
Parameters
isDebuffboolTrue when the template is a debuff (IsDebuff).
fromAnotherCharacterboolTrue when a character other than the target is applying it.
Returns
- bool
True for a hostile buff.
Remarks
Every debuff, not a list of crowd-control shapes. A stun, a freeze (root) and a mesmerize are state flags, but a slow is nothing more than a debuff lowering the Move Speed attribute, which in the buff model is indistinguishable from one lowering armour; there is no silence mechanic, and "similar" has no field to test. A narrower rule would either miss slows or name one attribute asset. It would also leave the part of the exploit a debuff opens on its own: a damage-over-time debuff put on during the walk home has every tick refused while the evade lasts and then ticks on, from full health, the moment the NPC arrives — pulling it straight back to the player who applied it.
Only from another character. A buff an NPC puts on itself is its own business, and environmental debuffs (weather exposure, buff volumes) never reach this rule: they are not attacks, and they are applied by their own systems with no caster.
Pure, so the rule is a truth table.
RefusesBuff(ICharacter, BaseBuffTemplate, ICharacter)
True when target must refuse template from
caster: a hostile buff (IsHostileBuff(bool, bool)) landing on a
character that refuses hostile effects (RefusesHostileEffects(ICharacter)).
public static bool RefusesBuff(ICharacter target, BaseBuffTemplate template, ICharacter caster)
Parameters
targetICharacterThe character the buff would land on.
templateBaseBuffTemplateThe buff being applied.
casterICharacterThe character applying it; null for a source with none.
Returns
- bool
True when the application must be refused.
RefusesHostileEffects(ICharacter)
True while character refuses every hostile effect: an NPC its server
brain has evading.
public static bool RefusesHostileEffects(ICharacter character)
Parameters
characterICharacterThe character something hostile is about to land on.
Returns
- bool
True when the effect must be refused.
Remarks
The NPC type test comes first so a hit on a player never pays the behaviour lookup; this is asked on every hit, every debuff and every knockback.
RefusesHostileEffects(ICharacter, ICharacter)
True when target must refuse a hostile effect from source: it is evading
(RefusesHostileEffects(ICharacter)), or the harm rule does not let source harm it
(HarmRule: enemies only, unless an aggression toggle is on; a pet as its owner). The one question
every hostile route asks — damage, debuffs, knockback, interrupts, taunts, buff-stripping dispels, drains — so none
can be the one that still lands on a friend.
public static bool RefusesHostileEffects(ICharacter target, ICharacter source)
Parameters
targetICharacterThe character the effect would land on.
sourceICharacterThe character applying it; null for the world (never refused by the harm rule).
Returns
- bool
True when the effect must be refused.