Skip to content

Action System #30

Description

@snayff

Suggested Feature

Actors need to be able to influence combat. We will call these Actions. There are 2 kinds, active and passive; 1 that happens on demand and 1 that happens in response to something else.

Requirements

  • Active Actions can be triggered on demand, when ready. ready is determined by:
    • not being on cooldown e.g. cooldown timer is at 0
    • having an appropriate target
  • Passive actions are triggered in response to events. These are:
    • on death
    • on receive damage
    • on healed
  • Passive Actions cant be triggered by the same thing more than once in the same chain. i.e. prevent infinite loops. e.g. 2 instances of on_receive_damage both deal damage and then continually trigger one another endlessly.
  • All Actions require an appropriate target. Target types are:
    • SELF, ## actor using the skill
    • ALLY, ## actor on same team
    • ENEMY, ## actor on other team
    • ATTACKER, ## actor attacking person asking
    • DEFENDER, ## actor being attacked by person asking
    • ANY, ## anyone, we dont care
  • Actions may use "sub-rules", aka target preferences, to specify conditions for a valid target. This is used as a refinement beyond just target type. The target preferences are:
    • ANY, ## anyone
    • LOWEST_HEALTH, ## actor with lowest health
    • HIGHEST_HEALTH, ## actor with highest health
    • DAMAGED, ## actor that isnt full health
    • NEAREST, ## actor nearest caller
    • FURTHEST, ## actor furthest from caller, but still in range
  • The Actions known to an Actor are defined at Unit level
  • Actions can trigger the following effects:
    • heal
    • damage
    • apply status effect
    • apply knockback
  • Actions use one of the following targeting methods:
    • GLOBAL, ## affects all valid units
    • UNIT, ## specific Unit is chosen
    • ACTOR, ## specific actor is chosen. the Action will always hit the target Actor.
    • GROUND, ## position on the ground is chosen.
    • SELF, ## targets self

Additional Context

I quite like being able to build actions logic by chaining together a series of effects, querying conditions as we go. This creates a versatile, but structured, approach. See here for an example.

Note, while all active actions have a targeting method it is only used by the player commander to determine the targeting method used when casting that action.

Current approach works as follows:

  • Actor has a component ActorActions that holds references to all of the Actions and acts as the interface for using those Actions.
  • There are 3 kinds of Action, Attack (should we rename active? 🤔 ), Reaction, and StatusEffect.
  • Actions are defined in code, with their behaviour outside of use() sharing a uniform set of expectations, defined by action_type, action_trigger, target_type. That is to say that on use() the Action can be entirely unique and bespoke, but in all other interactions will follow a set of prescribed behaviours.
  • Actions have access to a variety of _effect_* methods to use as building blocks in their use() method, though they are not confined to these. N.B. some of these effect methods exist but are not implemented, use of these will generate a warning.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    combatCombat functionality

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions