DefenseRule
DefenseRule.new(defense_priority, defense_order)
priority
DefensePriority.Barrier
DefensePriority.Action
DefensePriority.Body
DefensePriority.Trap
- Additionally causes all players to see
????
in the UI
- Additionally causes all players to see
DefensePriority.Last
defense_order
DefenseOrder.Always
DefenseOrder.CollisionOnly
Adding a DefenseRule to an entity when a DefenseRule already exists with the same priorty will replace the existing rule.
Returns a new DefenseRule.
defense_rule:replaced()
Returns true if a DefenseRule with the same priority replaced this rule.
defense_rule.on_replace_func = function()
Called when a DefenseRule with the same priority replaced this rule.
defense_rule.defense_func = function(defense, attacker, defender, hit_props)
If the defense order is DefenseOrder.Always
, this function will be called on every hit.
If the defense order is DefenseOrder.CollisionOnly
, this function will be called after intangibility is determined to not block the attack.
defense_rule.filter_func = function(hit_props): HitProps
Called before applying damage and statuses to the entity.
Should return HitProps
The return value replaces the HitProps applied to the entity.
Defense
Created for each attack resolution and passed through DefenseRule callbacks.
defense:block_damage()
Prevents damage and statuses from applying to the defending entity.
defense:damage_blocked()
Returns true if defense:block_damage()
was called.
defense:set_responded()
Used to track if the defense retaliated against a hit, such spawning an attack in Reflect / Shields.
defense:responded()
Returns true if defense:set_responded()
was called for this hit.
Used to track if the defense retaliated against a hit, such spawning an attack in Reflect / Shields.