Spielerando

Status Effects

Status effects are conditions that stay on a character for a while. Poison hurts in steps and builds up, slow holds the speed down, and stun takes away all action. Each one needs its own rule for being applied again, and a stun needs a short protection afterwards so nobody is locked in place for good.

Also called: Buffs and debuffs, Conditions, Damage over time.

A skinny ibis knight in dented armour stands dazed in a courtyard, lime-green poison dripping from its shoulder, its feet stuck in thick amber syrup and a ring of gold stars circling its head, while a toad witch watches from across the way.
Glassmere Vigil, an invented stained-glass tactics game. Invented game, image generated with AI.

Paste this to your AI

Copy it into Claude, Cursor or ChatGPT. It already has good values and the usual mistakes in it.

Add "Status Effects" to my game.

What it should do: Status effects give attacks a lasting result beyond the damage: a hit can leave the target hurt, slowed or helpless for a while, which lets fights be won by setting things up.

Build it exactly as this state machine. First check that it fits my game, then build it like this:

```mermaid
stateDiagram-v2
  [*] --> clear
  clear: No effects
  afflicted: Under effects
  stunned: Stunned
  resisting: Stun protected
  clear --> afflicted: poison or slow lands
  afflicted --> clear: effects run out
  clear --> stunned: stun lands
  afflicted --> stunned: stun lands
  stunned --> resisting: stun runs out
  resisting --> clear: protection ends
  resisting --> afflicted: protection ends
```

Use these starting values:
- maxHealth: 100
- poisonDamage: 3
- tickInterval: 1 s
- poisonTime: 5 s
- maxStacks: 3
- poisonFloor: 1
- slowFactor: 0.5
- slowTime: 3 s
- stunTime: 1 s
- stunImmunity: 1.5 s

Watch out for these common mistakes:
- Applying poison again: Tell your AI: a new application refreshes the time and adds a stack, but the step clock keeps running.
- Stun that never ends: Tell your AI: a stun in progress is not extended, and for a short time after it ends a new stun does nothing.
- A long tick between two poison steps: Tell your AI: count every step that falls inside the time that passed, and not just one per tick.
- Poison that outright kills: Tell your AI: give poison a floor it cannot take health below, or decide on purpose that it can kill and say so in the game.
- An effect that ends in the same moment as a new one: Tell your AI: add new effects to how the character stood when the tick began. An effect that would run out this tick still counts as active.
- A cleanse that also removes stun: Tell your AI: say which effects a cleanse can remove. Here it takes off poison and slow, and a stun runs its course.

Do not change anything else in the game. Do not claim anything without proof: model what it takes, and show me what your solution rests on and how I can see that it works. If you cannot show something, say you do not know. When you are done, tell me in plain words how to try it.

Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP

What it does

Status effects give attacks a lasting result beyond the damage: a hit can leave the target hurt, slowed or helpless for a while, which lets fights be won by setting things up.

How it runs, as a diagram

Everything it can be in, and what moves it on. Your AI builds from exactly this.

poison or slow landseffects run outstun landsstun landsstun runs outprotection endsprotection endsNo effectsUnder effectsStunnedStun protected
How it runs, as a diagram
  • No effects → Under effects: poison or slow lands
  • Under effects → No effects: effects run out
  • No effects → Stunned: stun lands
  • Under effects → Stunned: stun lands
  • Stunned → Stun protected: stun runs out
  • Stun protected → No effects: protection ends
  • Stun protected → Under effects: protection ends

Good starting values

ValueStart withWhat it changes
maxHealth100The character's full health. It sets how much a full poison is worth.
poisonDamage3Damage of one poison step, for each stack. Small, because many steps add up and the stacks multiply it.
tickInterval1 sTime between poison steps. A whole second is slow enough to read each step as one event.
poisonTime5 sHow long poison lasts, and what applying it again resets it to.
maxStacks3The most poison stacks at once. Without a limit, a swarm of small hits becomes a certain kill.
poisonFloor1Poison never takes health below this. At 1 it hurts but cannot end the character by itself, which keeps it from feeling unfair.
slowFactor0.5The share of normal speed while slowed. Half is easy to see and still allows the character to move.
slowTime3 sHow long slow lasts. Applying it again starts the time over and does not stack.
stunTime1 sHow long a stun lasts. Long enough to be worth the hit, short enough that the player does not give up the controller.
stunImmunity1.5 sAfter a stun ends, a new stun does nothing for this long. It gives the player a moment to act and prevents a lock that never ends.

What usually goes wrong

Applying poison again

If every new application restarts the step clock, a character hit often enough is never hurt by any poison step, and the effect does nothing against fast attackers.

Fix: Tell your AI: a new application refreshes the time and adds a stack, but the step clock keeps running.

Stun that never ends

If a new stun lands every time the last one ends, or each one adds to the time, the player is stuck watching and cannot do anything for the rest of the fight.

Fix: Tell your AI: a stun in progress is not extended, and for a short time after it ends a new stun does nothing.

A long tick between two poison steps

If poison only checks once per tick, a slow frame, or a game running at a low rate, swallows steps and does less damage than the same poison on a fast computer.

Fix: Tell your AI: count every step that falls inside the time that passed, and not just one per tick.

Poison that outright kills

A character can be killed by something it already survived: the hit that did not kill it was followed by a poison step that did, with nobody there to blame.

Fix: Tell your AI: give poison a floor it cannot take health below, or decide on purpose that it can kill and say so in the game.

An effect that ends in the same moment as a new one

If time runs out first, a new application at the same moment starts from nothing and loses its stack. If the new one comes first, the effect lives on. Games that do both in different places feel random.

Fix: Tell your AI: add new effects to how the character stood when the tick began. An effect that would run out this tick still counts as active.

A cleanse that also removes stun

If a cleanse removes every effect, it also frees a stunned character at once, which makes stun worthless against anyone with a cleanse ready.

Fix: Tell your AI: say which effects a cleanse can remove. Here it takes off poison and slow, and a stun runs its course.

How to check it works

Works well with

Clashes with Dodge Roll: A roll that cannot be hurt can still be stunned or poisoned if effects are checked on their own and not as part of a hit. Make effects land only with a hit that got through, so a roll's protection also stops the effect.

Common questions

what do i tell my ai to add status effects

Paste this: Add poison, slow and stun. Poison hurts 3 per stack once a second for 5 seconds, stacks up to 3, refreshes its time when applied again without resetting its rhythm, and never takes health below 1. Slow halves the speed for 3 seconds and does not stack. Stun stops all action for 1 second, cannot be extended, and leaves 1.5 seconds of protection afterwards. A cleanse removes poison and slow.

how do i stop stun lock in my game

Do not let a running stun be extended, and give a short protection after it ends. A second and a half of protection after a one second stun lets the player act in between.

should status effects stack or refresh

That depends on the effect. A damage effect like poison can stack up to a limit, a speed effect like slow should just start its time over, and a stun should never be extended.

why does my damage over time do different damage on different computers

The game probably checks once per frame. Count every step that falls inside the time that passed, so the same poison does the same total damage at any frame rate.

Where it comes from

We could not find a reliable origin for this one yet.

Where this mechanic comes from has not been researched yet.

Games are named only as references. Names and marks belong to their owners, and nothing here is endorsed by them.

What was checked

This is what separates the blueprint from a catalogue entry: the values on this page come from code that runs.

Your AI gets the code

Tested example code comes through the Spielerando connection, so your AI can use it right away. How to connect it