AuxProp
AuxProps are structures for generating conditional behavior that composes well with other AuxProps, without requiring writers to be aware of all content to avoid ordering conflicts. AuxProps achieves this using a priority system that uses the effect and requirements to generate a clear order for behavior.
AuxProps can only be tied to a single entity and can not be updated once bound. To update an AuxProp it must be removed and added again.
AuxProp.new()
Returns a new AuxProp. Attach to an entity with living:add_aux_prop() and remove with living:remove_aux_prop()
All AuxProp methods return the AuxProp for chaining.
aux_prop:once()
Allows the AuxProp to auto remove after it's effects are first applied.
aux_prop:immediate()
Allows the AuxProp to auto remove after a single test run, approximately a single battle frame.
aux_prop:limit(limit)
Allows the AuxProp to auto remove after it's effects are have been applied limit times.
aux_prop:limit_frames(limit)
Allows the AuxProp to auto remove after limit test runs, approximately limit battle frames.
aux_prop:with_callback(callback)
The callback will be called shortly after the AuxProp's effect is applied. Multiple callbacks can be added to a single AuxProp.
AuxProp Requirements
An AuxProp can have zero or more requirements. Every requirement must pass on the same test run (approximately a single battle frame) to execute effects and callbacks.
The requirements affect the final priority of the AuxProp. The lowest requirement priority is used as a secondary priority when multiple effects have the same priority. The lower the priority is in the list, the later it will execute.
- Unconditional
- Interval
- Hit
- Body
- HP Expression
- HP GE
- HP LE
All hit related requirements will use hit properties after DefenseRule modification and before AuxProp modification.
aux_prop:require_chance(chance)
- Interval priority
chance: number, 1 is 100%, 0 is 0%.
The AuxProp will be given a random chance to pass.
-- one in five chance on hit to paralyze:
player:add_aux_prop(
AuxProp.new()
:require_chance(1 / 5) -- 1 in 5 chance
:require_hit_damage(Compare.GT, 0) -- on hit
:apply_status(Hit.Paralyze, 20)
)
-- 20% chance on hit to freeze:
player:add_aux_prop(
AuxProp.new()
:require_chance(0.2)
:require_hit_damage(Compare.GT, 0)
:apply_status(Hit.Freeze, 20)
)
aux_prop:require_interval(frames)
- Interval priority
frames: number
The AuxProp can pass if battle_frame_time % frames == 0
In the future the AuxProp will store an internal timer that starts as soon as it is attached, increments every battle frame, passing the test on the first frame and at each interval.
aux_prop:require_hit_element(element)
- Hit priority
element: Element
The AuxProp will check the incoming hit's element and secondary element of incoming hits for a match.
aux_prop:require_hit_element_is_weakness()
- Hit priority
The AuxProp will check the incoming hit's element and secondary element to see if the attached entity's element is weak to either element.
aux_prop:require_hit_flags(hit_flags)
- Hit priority
hit_flags: Hit
The AuxProp will check the incoming hit's flags to see if all matching flags apply.
aux_prop:require_hit_flags_absent(hit_flags)
- Hit priority
hit_flags: Hit
The AuxProp will check the incoming hit's flags to verify no flags match.
aux_prop:require_hit_damage(compare, damage)
- Hit priority
compare: Comparedamage: number
The AuxProp will check the incoming hit's damage.
aux_prop:require_projected_hit_damage(expr, compare, damage)
- Hit priority
expr: Math Expression String,"DAMAGE"will represent the damage value for the current hit.compare: Comparedamage: number
The AuxProp will check the incoming hit's damage.
aux_prop:require_total_damage(compare, damage)
- Hit priority
compare: Comparedamage: number
The AuxProp will check the total incoming damage from all hits in the current frame.
aux_prop:require_element(element)
- Body priority
element: Element
The AuxProp will check the attached entity for matching element.
aux_prop:require_negative_tile_interaction()
- Body priority
The AuxProp will check entity:ignoring_negative_tile_effects() == false.
aux_prop:require_tile_state(tile_state)
- Body priority
The AuxProp will check the tile state of the tile under the entity.
aux_prop:require_tile_state_absent(tile_state)
- Body priority
The AuxProp will check the tile state of the tile under the entity.
aux_prop:require_context_start()
- Body Priority
Applies when a new entity:context() has started.
aux_prop:require_action(action_types?)
- Body Priority
action_typesActionType.All: All attack types.ActionType.Normal: A player's normal attack.ActionType.Charged: A player's charged attack.ActionType.Special: A player's special attack.ActionType.Card: An attack generated by a card.ActionType.Scripted: A scripted attack.
If the effect is Modify Context, the action_types filter will be tested against the generated action.
Otherwise the filter will be tested against any active action on the associated entity.
aux_prop:require_emotion(emotion)
- Body priority
emotion: string
The AuxProp will check the attached entity for matching emotion.
aux_prop:require_defense(defense_priority)
- Body priority
The AuxProp will check the attached entity for a defense rule with a matching priority.
aux_prop:require_defense_absent(defense_priority)
- Body priority
The AuxProp will check the attached entity for a defense rule with a matching priority.
aux_prop:require_charge_time(compare, time)
- Body priority
The AuxProp will check a Player's held attack charge time against the provided time, the player's charge time will be capped at their max charge time.
aux_prop:require_card_charge_time(compare, time)
- Body priority
The AuxProp will check a Player's held card charge time against the provided time, the player's charge time will be capped at their max charge time.
aux_prop:require_charged_card()
- Body priority
The AuxProp will require a Player to be holding a fully charged card.
aux_prop:require_card_primary_element(element)
- Body priority
element: Element
The AuxProp will check the primary element on the next card for the attached entity.
aux_prop:require_card_not_primary_element(element)
- Body priority
element: Element
The AuxProp will check the next card on the attached entity for a failed match with the primary element.
aux_prop:require_card_element(element)
- Body priority
element: Element
The AuxProp will check the next card on the attached entity for either matching element or secondary element.