Movesets - Jackiecrazy/CombatCircle GitHub Wiki

Basic Info

Movesets

Mobs may have an arbitrary number of "movesets". Each one represents an attack sequence that it may perform.

Movesets are defined as a series of "timer actions".

Timer and Instant Actions

A "timer action" is a special type of "action" that takes time to complete, such as "move towards location" or "jump with velocity". Each timer action includes several points where you may insert more actions to trigger.

An "instant action" is any action that is not a timer action, and thus takes no time to complete. These include actions such as "apply potion effect" and "explode".

Conditions, Arguments, and Filters

Actions may have a "condition" before they trigger (outermost actions ignore their own condition field). Some actions also take conditions as arguments, such as whether explosions should spread fire.

Conditions are statements that resolve to either true or false, such as "is X less than Y" or "is entity alive". Multiple conditions can be combined into a single condition using "and" and "or" conditions.

Actions may also take a series of "arguments". Arguments include numbers, vectors, and entities. Arguments are used to dynamically alter moveset behavior.

Some specific actions or arguments take "filters". These sort lists according to conditions, or completely randomly.

Storage

Arguments may be stored and loaded. This is useful for applications such as storing an entity's location to teleport to later.

Mob Definitions

Mob moveset definition jsons, under the namespace combat_circle_movesets, takes several parameters that define overall mob behavior:

  • mob_size is a decimal that determines how "big" the mob is for spacing when pursuing. Defaults to the mob's width.
  • encirclement_distance is a decimal that determines how far the mob will stay from you while not actively attacking. The greater of this value and the target's attack range is taken, so that mobs prefer to stay at their normal distances, but will move out further to be safe. Defaults to 3 for melee and 6 for ranged.
  • pursue_walk_speed and pursue_sprint_speed determine how fast the mob will run into formation after reaching you or after attacking.
  • to_wipe takes a series of fully qualified class names to be removed from the mob entirely. note that some mobs, such as skeletons, modify their own goals on the fly and thus resist this modification.
  • moveset takes an array of moveset factories to initialize.

For an example of a mob definition, see this file.

Moveset Factory

A moveset factory provides some important information on how a mob should use a given moveset.

Each time a mob attempts to perform a moveset, a filtered list of currently usable movesets is randomly chosen from.

  • Movesets are linked by a ResourceLocation to a corresponding file in the combat_circle_moves folder. This file is represented by the move parameter. For instance, filling in "move": "mycooldatapack:spinattack" will cause the mod to search for a moveset defined in data/mycooldatapack/combat_circle_moves/spinattack.json.
  • Movesets are filtered according to a provided condition field. The condition field must exist, but can be empty (defaults to true).
  • In addition, as detailed in Encirclement, the sum of the size values of all attacks against one target may not exceed the target's attack size cap.
  • starting_weight determines how likely a mob is to choose the move initially. For example, a mob that has a choice between a move of weight 3 and a move of weight 1 will choose the former with a 75% chance.
  • weight_change is applied after a move is chosen and executed to introduce more variety in chosen attacks. If the value is positive, the value is added to the weight of the current move (i.e. the mob is more likely to use it again). Negative values, on the converse, increase the weight of every other moveset, making them more likely to be chosen. For example, if the mob in the previous example chose moveset 1, and it has a weight_change of -1, the next time it has to choose a moveset, the weight distribution will become 3 and 2, and it will have a 40% chance to choose moveset 2 instead of 25%.

Moveset and Combat Managers

Every mob that has custom movesets has a moveset manager that determines what movesets it can use at a given moment and executes moves.

The combat manager is responsible for telling each moveset manager the size cap for the current target, to prevent an overly large number of simultaneous attacks. Moveset managers then choose semi-randomly from eligible movesets.