Boss Phases
Boss phases change how a boss fights as its health falls. At two set marks it moves on to the next phase, and each phase attacks a little faster. A change takes a moment in which the boss cannot be hurt. One hit never skips a phase, and healing never takes the boss back one.

Paste this to your AI
Copy it into Claude, Cursor or ChatGPT. It already has good values and the usual mistakes in it.
Add "Boss Phases" to my game.
What it should do: Phases turn one long fight into three shorter ones, each with something new to learn. They also give the player a clear sign of progress, so a long fight keeps its drive.
Build it exactly as this state machine. First check that it fits my game, then build it like this:
```mermaid
stateDiagram-v2
[*] --> one
one: Phase one
two: Phase two
three: Phase three
changing: Changing
defeated: Defeated
one --> changing: first mark reached
two --> changing: second mark reached
changing --> two: change ends
changing --> three: change ends
three --> defeated: health is gone
defeated --> [*]
```
Use these starting values:
- maxHealth: 300 units
- phase2At: 0.66
- phase3At: 0.33
- changeTime: 2 s
- speedBonus: 0.25
Watch out for these common mistakes:
- One big hit skips a phase: Tell your AI: a hit cannot take the boss's health below the next mark while it is in this phase. Stop it at the mark and start the change.
- The change plays again on every hit: Tell your AI: decide from the phase the boss is in, not from the health alone. A mark starts a change only once, when the boss is in the phase before it.
- Damage during the change: Tell your AI: while the boss changes, ignore all damage and all healing, and say so with a clear sign on the screen.
- Healing takes the boss back a phase: Tell your AI: phases only go forward. Healing can raise the health, but never changes the phase.
- The rest of a big hit is carried over: Tell your AI: when a hit reaches a mark, hold the health at the mark and throw the rest away. Every phase then starts at the same health.
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
Phases turn one long fight into three shorter ones, each with something new to learn. They also give the player a clear sign of progress, so a long fight keeps its drive.
How it runs, as a diagram
Everything it can be in, and what moves it on. Your AI builds from exactly this.
How it runs, as a diagram
- Phase one → Changing: first mark reached
- Phase two → Changing: second mark reached
- Changing → Phase two: change ends
- Changing → Phase three: change ends
- Phase three → Defeated: health is gone
Good starting values
| Value | Start with | What it changes |
|---|---|---|
| maxHealth | 300 units | The boss's full health. Three hundred is about fifteen ordinary hits of twenty, or five for each phase, long enough for the player to learn what each phase does before it ends. |
| phase2At | 0.66 | Where phase two begins, as a share of the full health. Two thirds is the first of three even parts. It is kept above the second mark so that the phases come in order. |
| phase3At | 0.33 | Where phase three begins, as a share of the full health. One third is the second of three even parts. It is kept below the first mark so that the phases come in order. |
| changeTime | 2 s | How long a change takes. Two seconds is long enough for the player to see that something new is starting and to catch a breath, and short enough not to break the fight. |
| speedBonus | 0.25 | How much faster each phase attacks than the one before, as a share. A quarter is clear to feel but not unfair. Phase three ends up at one and a half times the speed of phase one. |
What usually goes wrong
One big hit skips a phase
A strong hit takes the boss from full health to well below the second mark in one go. The game jumps straight to phase three, and the player never sees phase two.
Fix: Tell your AI: a hit cannot take the boss's health below the next mark while it is in this phase. Stop it at the mark and start the change.
The change plays again on every hit
The game decides the phase by asking whether the health is below the mark. The boss is below it for the rest of the phase, so every hit starts the change again.
Fix: Tell your AI: decide from the phase the boss is in, not from the health alone. A mark starts a change only once, when the boss is in the phase before it.
Damage during the change
The boss can be hit while it changes. Players save their strongest attack for that moment, or the hits push the boss across the next mark before the new phase has begun.
Fix: Tell your AI: while the boss changes, ignore all damage and all healing, and say so with a clear sign on the screen.
Healing takes the boss back a phase
A boss that heals itself rises above a mark again. The game moves it back to the earlier phase, or starts the same change a second time when it falls.
Fix: Tell your AI: phases only go forward. Healing can raise the health, but never changes the phase.
The rest of a big hit is carried over
A hit of 100 reaches the mark with 20 to spare, and the game takes the other 80 off the health of the next phase. The player is punished for hitting hard, and the new phase starts weaker than planned.
Fix: Tell your AI: when a hit reaches a mark, hold the health at the mark and throw the rest away. Every phase then starts at the same health.
How to check it works
- The boss is at full health in phase one. A hit of 30 arrives: Its health is 270, the hit is counted as 30 and it stays in phase one.
- The boss is at full health. A hit of 110 arrives, which reaches past the first mark: The health stops exactly at the mark, the part left over is thrown away and the boss starts to change to phase two.
- The boss is at full health. A hit arrives that takes it exactly to the first mark: The change starts and nothing is thrown away.
- The boss is at full health. Two enormous hits arrive, one in phase one and one in phase two: It goes through both changes in order and is still alive in phase three.
- The boss is changing. A hit of 50 arrives: Its health does not change and the 50 is counted as refused.
- The boss is changing. The change time has passed: It is in the next phase, at exactly the health of the mark.
- The boss is in phase two with 150 health. A hit of 60 arrives: The health stops at the second mark and the boss changes to phase three.
- The boss is in phase three with 20 health. A hit of 500 arrives: The boss is defeated with zero health, 20 counted as taken and the other 480 as refused.
- The boss is in phase two. It heals all the way back to full health: It stays in phase two and no change starts.
- The boss is in phase two with its health below the first mark. Small hits keep arriving: It stays in phase two and no new change starts.
- The boss is changing. Healing arrives: Its health does not change.
- The boss is in phase three with 5 health. A hit of 5 and healing of 50 arrive in the same moment: The boss is defeated.
- The boss is defeated. More hits and healing arrive: Nothing changes and the boss stays defeated with zero health.
- Damage or healing that is below zero or not a number. It arrives: Nothing is taken and nothing is given.
- The boss in each of its phases. You ask how fast it attacks: It is 1, 1.25 and 1.5, and zero while it changes or after it is defeated.
Works well with
- Health and Damage: The boss uses the same health as everyone else. Phases only add the marks and the change on top of it. Let armor and the short protection work first, then pass the damage that remains to the boss.
- Ability Cooldowns: A new phase should open with its first new attack, not with an old one that was already about to fire. Reset the boss's attack timers when a change ends.
- Threat and Aggro: A boss that forgets whom it was fighting at every phase makes the first player to act the new target, which feels random. Keep the threat scores through a change.
Clashes with Health Regeneration: A boss that heals itself can rise above a mark it has already passed, which can start the same change over again. Let it heal, but decide the phase from the phase it is in, so healing never moves the boss back or starts the same change twice.
Common questions
what do i tell my ai to add boss phases
Paste this: Give the boss three phases. At two thirds and one third of its health it changes phase. A hit can never take its health below the next mark, so one big hit starts the change and cannot skip a phase, and what is left over is thrown away. The change takes two seconds, and the boss takes no damage and no healing in that time. Decide the phase from the phase the boss is in, never from the health alone, and never move it back. Each phase attacks a quarter faster.
why does my boss change phase more than once
The game decides the phase by asking whether the health is below the mark, and the boss stays below it for the rest of the phase. Decide from the phase the boss is in instead, so each mark starts one change.
should a boss be hurt during its change
No. Ignore damage and healing for the whole change and show it clearly, for example with a glow. Otherwise players save their strongest attack for that moment, or the change is skipped.
what happens to the damage left over past a threshold
Throw it away. Hold the health at the mark so every phase starts at the same health. Carrying it over punishes the player for a strong hit and makes the phases uneven.
Where it comes from
We could not find a reliable origin for this one yet.
What was checked
- 23 tests pass on the reference code.
- The state diagram was checked against the code, at the default values and at every listed low and high value.
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