Active Effects - League-of-Fabulous-Developers/FoundryVTT-Fabula-Ultima GitHub Wiki

Active effects are used in Foundry to customize both actors and items, allowing for automating things such as adding bonuses, changing properties and much more. Our system extends Foundry's base Active Effect class, mainly through the usage of our custom ActiveEffectDataModel which contains various properties used by our automation.

Let's go over the tabs in the active effect window in terms of importance.

Changes

Many of our simpler automation can be used directly through the application of active effect changes, which can be used to modify specific properties on actors or items. For the full list of these attribute keys, see them for actors and items.

Rules

This tab includes advanced features such as:

  • Trackers (used for clocks, resources, etc),
  • Stacking
  • Rule Elements

Trackers

Each AE in our system is capable of having a single tracker, which can be used for things such as clocks, resource points, etc.

  • Toggle: Enables or disables the use of a clock for this active effect.
  • Identifier: A unique ID for the clock, used for automation. It’s highly recommended to use lowercase letters, replace spaces with hyphens (-), and avoid using special characters.
  • Name: The display name of the clock, shown in the UI.
  • Current: The current value or progress of the clock.
  • Max: The maximum value the clock can reach before it completes
  • Style: How to render the tracker (such as a clock, progress bar)

Stacking

These options toggle optional stacking mechanisms for when the same effect (by fuid) is applied on the actor.

  • Progress: Whether to increment the progress track when the same effect is re-applied.
  • Duration: Whether to extend the duration of the effect when the same effect is re-applied.

Rule Elements

The system introduced a comprehensive automation solution in order to enable the automation of many of the core rulebook classes and skills, which could not be easily expressed (or at all) via active effect changes. We call this overall system Rule Elements, or REs for short.

Each active effect in our system can have a variable number of rule elements. Nowadays many of our compendium entries for classes and skills contain them.

Architecture

Design

Each rule element contains the following:

  • Rule Trigger: A trigger which is mapped to at least one (sometimes a couple) events dispatched by the system. For example, the damage rule trigger is is valid for a damage event.
  • Rule Predicates: An optional amount of predicates which are used for further predication based on the context. Each rule predicate evaluates the given context at the time of evaluation. This includes not just the properties of the event but also properties on the actors referenced in the event, etc. While many rule predicates are designed to work across any event, some of them are obviously meant to further filter specific events (such as events involving checks).
  • Rule Actions: A variable amount of actions which execute logic and change the world state, whether that be updating an actor to apply damage, post a chat message, perform a check, etc.

When a rule element is evaluated, the following happens:

  1. It evaluates the rule trigger. If the validation is successful, continue onto the next step.
  2. If any rule predicates are present, evaluate each of them. If all validations are successful, proceed to the next step.
  3. For each rule action, now execute it. Whether these actions are executed on the source actor of the event, or the one with the current rule element, or any other possible actors depends on its selector.

Duration

image

This tab is used for managing how long an active effect lasts and under what conditions it expires.

  • Event: Determines when the effect expires.
    • Supported value:
      • endOfTurn: End of turn
      • startOfTurn: Start of turn
      • endOfRound: End of round
      • endOfScene: End of scene
      • rest: On rest
  • Interval: Indicates how many occurrences of the event must pass before the effect expires.
    • Example: Interval of 2 with Event of End of Turn means the effect expires at the end of your next turn after it's applied.
  • Tracking: Defines whose turn is used to track the duration.
    • Supported value:
      • self: The affected actor's turn
      • source: The source actor's turn

Predicate

image

This tab is used to control when an effect becomes active, based on specific conditions or states.

  • Crisis Interaction: Determines how the effect behaves in relation to a Crisis state.
    • active: The effect is active only while in Crisis.
    • inactive: The effect is active only while not in Crisis.
    • none: The effect is always active, regardless of Crisis state.