MMOrpg Combat Lab
Technical Specification · Time

Time

To simulate a real-time fight, we'll rely on three independent timers that track the player and boss action sequences.

§ 06.01

Three Timers

Auto-attack Timer

This is the unstoppable, looping countdown timer for every physical entity (Boss, Tank, Melee, and Ranged DPS).

  • Always be swinging: The moment the encounter starts this timer begins for each physical entity. When it hits zero, a White Damage swing fires, and the timer instantly resets to the weapon's speed interval, modified by the player's Tempo stat.
  • Friction: Nothing stops this clock except a hard stun or death. Yellow abilities and spells do not interrupt or delay it.

Ability Action Timer

This is the "player-driven" (AI logic-driven) sequence of active button presses to trigger abilities and spells, governed by cast times and cooldown:

  • Cast Time: A spell locks the caster in place for the duration of the cast time. If the timer reaches zero, it fires. If the caster takes physical damage during this window, the clock is pushed back by 0.5s (Spell Pushback). After 2 pushbacks (max 1.0s of delay) the spell will finish regardless of any additional damage taken.
  • Last Cast End: Casters maintain a timestamp of their last cast end time. When the Heartbeat timer ticks, if the time is less than 5.0s from the last cast, the caster receives active mana regeneration, otherwise they receive passive regeneration.
  • Global Cooldown (GCD): The moment any instant ability, i.e. Yellow Damage, or instant spell is fired, a mandatory 1.5s lock is placed on the Action Queue. No other active abilities can be triggered until this lock expires.

Heartbeat Timer

This is the invisible background metronome that governs passive recovery and Over-Time effects. Instead of tracking timers for every individual buff, this environmental heartbeat pulses at fixed intervals.

  • Mana Pulse: Evaluates passive vs. active mana regeneration every 2.0s
  • Over-Time Pulse: Evaluates DoT damage and HoT healing every 3.0s
§ 06.02

Action Resolution Sequence

Every 0.1 seconds the engine fires a tick and resolves actions in strict phase order. The diagram below shows the complete sequence for a single tick.

Phase 1 — Time & Environment

Before anyone throws a punch, the universe must update its physical laws.

Advance the Global Clock

currentTime += 0.1s

Update Entity Timers (Tick Down)
  • Decrement all active Auto-Attack Timers by 0.1s.
  • Decrement all active Global Cooldowns (GCD) by 0.1s.
  • Decrement all active Cast Timers by 0.1s.
  • (If Threat Crisis Active) Decrement Tank tauntLock timer.
  • (If Threat Crisis Active) Decrement Offending Player Taunt Suppression Timer by 0.1s.
Resolve Engine Heartbeats
  • If currentTime % 2.0 == 0: Evaluate 5-Second Rule timestamps and apply passive/active Mana Regen.
  • If currentTime % 3.0 == 0: Resolve Over-Time Damage (DoTs) and Healing (HoTs) ticks. Apply damage/healing and add Threat.

Phase 2 — The Enemy

The enemy always acts before the players to ensure defensive checks (like Cast Pushback) resolve correctly.

Resolve Boss Actions
  • White Damage: Did the Boss Auto-Attack timer hit ≤ 0? Roll Boss single-roll attack table against the Tank. Apply damage to Tank.
  • White Cleave Damage: Check Grid Coordinates; If any player is inside the active Cleave Zone: Roll Boss single-roll attack table against player. Apply (Raw Damage × Cleave%) to the player.
  • Spell Pushback: If the Boss hits a player who is currently casting, immediately add +0.5s to that player's Cast Timer (subject to the 2-hit cap).
  • Cast Completion: Did Cast Timer hit ≤ 0? The spell fires. Roll spell table. Apply damage.
  • Boss Gambits: If the Boss GCD is ≤ 0, evaluate the Boss Gambit List (e.g., IF Target HP > 0 THEN Cast Heavy Strike).
  • Yellow Damage: Trigger Yellow damage or begin Cast Time and Lock Boss GCD.
  • Yellow Cleave Damage: Check Grid Coordinates; If any player is inside the active Cleave Zone: Roll Boss single-roll attack table against player. Apply (Raw Damage × Cleave%) to the player.

Phase 3 — The Players

Players are evaluated in strict order of proximity/role: Tank → Melee → Ranged → Healer. For each player, the engine checks three things: Auto-Attacks, Finishing Spells, and New Gambits.

Resolve Tank Actions
  • White Damage: Did Auto-Attack timer hit ≤ 0? Roll physical table. Apply damage & Threat. Reset timer.
  • Gambit Evaluation: Is the Tank GCD ≤ 0? Evaluate Tank Gambit list (Utility/Cooldowns/Taunt Management). If a condition is met, execute the utility action and lock Tank GCD to 1.5s. (Note: Flat rotational damage is already accounted for via the passive 1.4× modifier).
Resolve DPS Actions (Melee & Ranged)
  • White Damage: Did Auto-Attack timer hit ≤ 0? Roll physical table (apply Dual-Wield penalties if applicable). Apply damage & Threat. Reset timer.
  • Cast Completion: Did Cast Timer hit ≤ 0? The spell fires. Roll spell table. Apply damage & Threat. Set timestamp for 5-Second rule.
  • Gambit Evaluation: Is the DPS GCD ≤ 0 AND are they NOT currently casting? If yes, evaluate DPS Gambits.
  • Yellow Damage: Execute Yellow damage OR trigger Cast Timer. Lock DPS GCD to 1.5s. Add Threat.
Resolve Healer Actions
  • Cast Completion: Did Cast Timer hit ≤ 0? The spell fires. Roll spell table. Apply healing to target & Threat to Boss. Set timestamp for 5-Second rule.
  • Gambit Evaluation: Is Healer GCD ≤ 0 AND are they NOT currently casting? Evaluate Healer Gambits.
    • Example 1: IF Tank.HP < 30% THEN [Flash Mend]
    • Example 2: IF Tank.HP < 80% THEN [Greater Heal]
  • Begin Cast: Begin Cast Timer. Lock Healer GCD to 1.5s. Deduct Mana cost immediately.

Phase 4 — State Checks & Resolution

The dust settles. The engine looks at the new math and decides if the state of the battle needs to change.

The Threat Check (The Crisis Protocol)

The engine sweeps the Threat Table to see if any DPS/Healer has breached the Tank's maximum threshold.

Step A — Threshold Evaluation:

  • For Melee DPS: Is Current Threat > (Tank Threat × 1.10)?
  • For Ranged/Healer: Is Current Threat > (Tank Threat × 1.30)?

Step B — The Breach Trigger: If YES, trigger the Crisis Protocol:

  • Aggro Shift: Boss currentTarget instantly switches to the offending player.
  • The Penalty Strike: Boss immediately executes an out-of-turn instant physical strike on the new target (amplified damage).
  • Tank Friction: Tank is forced to use the [Taunt] ability. Tank Threat is mathematically equalized to match the offending player. Tank is locked into a 1.5s GCD (losing a turn).
  • Aggro Return: Boss currentTarget switches back to the Tank. The offending player receives a 3.0s [Suppression] debuff preventing all action.
KO Check (Life and Death)
  • Player Death: Sweep player HP. If any Player HP ≤ 0, set state to KO. Clear their Threat to 0. Stop processing them in Phase 3.
  • Wipe Check: Are all players KO? If YES, Simulation Ends (Loss).
  • Victory Check: Is Boss HP ≤ 0? If YES, Simulation Ends (Win). Return Combat Log array.
Reference Table