Skip to content

Battle Mechanics

Cowculator runs turn-based battles between two fighters. Each fighter builds turn meter, uses skills, and applies effects until one fighter is knocked out or the battle reaches the turn limit.

How a battle progresses

Every battle follows three main phases:

Preparation → Battle Start → Battle End
                 └─ Build meters → Turn Start → Turn End → Repeat

Preparation

Before the fight begins, Cowculator prepares both fighters:

  1. Both fighters start with their configured health, energy, stats, skills, and an empty turn meter.
  2. Preparation passives run from the faster fighter to the slower fighter. If their speeds are equal, fighter_1 goes first.
  3. Each start_of_battle passive runs its configured actions in order.

Preparation passives can use the same actions as other passives. They can deal damage, restore health or energy, apply a status, or remove a status before the first ordinary turn.

Preparation does not count as a normal turn. See Passive skills for their triggers and allowed effects.

Battle Start

After preparation, Cowculator builds each fighter's turn meter until one is ready to act. A normal turn then follows this order:

  1. Turn Start

    1. Apply damage-over-time (DOT) effects to the acting fighter, if any.
    2. Run eligible turn_start passive actions, acting fighter first.
    3. Select and use the fighter's next skill unless a control effect prevents the action.
  2. Turn End

    1. Regenerate the acting fighter's energy and health.
    2. Reduce the acting fighter's turn meter by the turn threshold.
    3. Decrease the acting fighter's status durations and remove expired statuses.

Cowculator repeats this cycle until the battle ends. See Control debuffs for how skip_action and skip_turn change the normal flow.

Battle end

The battle ends after 60 global turns, or when either fighter reaches 0 health and any required in-progress processing finishes. If an active skill knocks out the opponent, the surviving caster completes that skill's remaining actions before the battle ends.

The winner is determined as follows:

  • If one fighter reaches 0 health, the other fighter wins.
  • At the turn limit, the fighter with more health remaining wins.
  • If both fighters have the same health remaining, fighter_1 wins.

Global turns and fighter turns

Cowculator tracks the battle timeline with one global turn counter and tracks each fighter's progress with a separate fighter turn counter. All three counters start at 0 during preparation.

Counter Belongs to Advances when Does not advance when
Global turn The whole battle Either fighter consumes a turn, including skip_turn Preparation or meter-building ticks occur
Fighter turn One fighter That fighter starts a normal turn, including skip_action The other fighter acts or skip_turn blocks the entire turn

The global counter establishes the chronological order and determines when the battle reaches its 60-turn limit. A fighter counter shows how many normal turns that specific fighter has started. Faster fighters may therefore accumulate more fighter turns than their opponent.

This example shows the counters moving independently:

What happens Global turn Fighter 1 turn Fighter 2 turn
Preparation finishes 0 0 0
Fighter 1 takes a normal turn 1 1 0
skip_turn blocks Fighter 2 2 1 0
Fighter 1 takes another normal turn 3 2 0
Fighter 2 takes a normal turn 4 2 1

In the battle result, battle_turn contains the global counter and actor_turn contains the acting fighter's counter. Because skip_turn does not start a normal fighter turn, its actor_turn can remain 0 or repeat that fighter's previous value. See Understanding BattleResult for guidance on using the counters in a replay or UI.

Turn meter

Turn meter determines when a fighter can act:

  • Each fighter's meter increases every tick based on their effective speed.
  • A fighter is ready to act when their meter reaches TURN_METER_FULL, currently 1000.
  • If both fighters are ready, the fighter with the higher meter acts first. If their meters are equal, fighter_1 acts first.
  • Faster fighters generally become ready sooner and act more often.

Skills and passive skills

Skills are how fighters act during battle. A skill can contain several actions, which run in their configured order. These actions can:

  • Deal damage.
  • Restore health or energy.
  • Apply buffs or debuffs.
  • Remove statuses.

Passive skills run automatically. start_of_battle passives run during preparation. turn_start triggers run on their owner's turns, the opponent's turns, or both, according to actor. Each action has its own chance check.

See the Skills guide for skill selection, actions, and passive triggers.

Damage

An attack action deals either normal or true damage:

Damage type Defence Damage reduction Critical hit Shield
normal Applied Applied Can occur Absorbs damage first
true Ignored Ignored Can occur Absorbs damage first

Normal damage is affected by the target's defence and damage reduction. True damage ignores both, but it can still be a critical hit and does not bypass shields.

For either type, Cowculator calculates damage, checks for a critical hit, then rounds the result to a whole number with a minimum calculated damage of 1. The target's shields and remaining health determine how much of that calculated damage is ultimately applied to health.

See Damage calculation for the formulas, rounding rules, and a worked example.

Shields

A shield is a temporary buff that protects health from direct damage. When a fighter receives direct damage:

  1. Active shields absorb as much of the calculated damage as possible.
  2. If the shields absorb all the damage, health does not change.
  3. Any damage left after the shields are depleted reduces health.

Shield absorption

A fighter has 100 shield.

  • 80 direct damage reduces the shield to 20 and leaves health unchanged.
  • 120 direct damage depletes the shield and reduces health by 20.

DOT bypasses shields and reduces health directly.

Multiple shields

A fighter can have more than one active shield. The battle result reports their combined protection as the fighter's current shield, but each shield keeps its own amount and duration.

  • Direct damage consumes the oldest shield first.
  • If a shield expires or is removed, only its remaining amount is lost.
  • Reapplying a same-name shield whose active group uses replace replaces the existing instance.
  • A same-name shield whose active group uses stack adds a new instance until it reaches max_stacks. Each instance keeps its own amount and duration.
  • At max_stacks, Cowculator rejects the new shield without changing existing shields.

See Utility buffs for shield configuration, stacking, expiry, removal, and rejection events.

Health and energy

Health and energy cannot exceed their configured maximums. Battle events keep the requested or calculated amount separate from the amount actually applied. For example, healing a fighter for 100 when they are missing only 30 health restores 30, while the event retains the original requested amount.

Percentage healing, regeneration, shields, and DOT are rounded half up to whole points. Regeneration combines its configured components before rounding once. DOT applies dot_reduction before rounding.

Energy and the fallback skill

Active skills consume energy:

  • An affordable skill consumes its energy cost before hit checks. The cost is still paid if the skill or one of its actions misses.
  • If the intended skill is unaffordable, the fighter uses its separately configured fallback_skill. The intended skill is not charged.
  • If the active-skill rotation is empty, the fighter uses fallback_skill on every normal turn that reaches skill execution.
  • The fallback skill has no configurable energy cost and always executes at zero energy cost.
  • Energy healing and end-of-turn regeneration cannot raise energy above the fighter's maximum.

Battle result

The battle result records every action, effect, and outcome. Its battle log follows the same lifecycle described above: Preparation, each turn's Turn Start and Turn End, then Battle End.

See Understanding BattleResult for the phase mapping and guidance on replaying battle events.