Skip to main content

Boss Half-HP Phase Transition & Hard HP-Lock Lab

Extracted from Zhaoshi Wulin boss fights: test 4 half-HP bosses (Raging Bull 42/84, Bandit 45/90, Palm 58/116, Iron 56/112) and 3-phase final boss Grandmaster Cangfeng (148 HP -> 96 -> 45 hard lock). Experience all 3 rules live: one-shot threshold gates + burst HP clamping (100 - 70 stops at 45!), temporary shield + damage buff with zero boss HP healing, and moveset escalation (more hits, heavier blows, faster tempo).

Challenges (0/3)
Phase 1HP 58/840 ShieldStepping Heavy Fist14
Hero 50/50Qi 3/3
Click Raging Bull Brawler directly on the Canvas or play/drag cards below! Push past 42 HP, then cast Iron Guard before ending your turn!
01

Rule 01 — One-shot threshold gate (if hp <= gate && !transformed) + hard phase clamp (Cangfeng 100 - 70 -> 45 HP)

02

Rule 02 — Reward with temporary Shield (+6/+8/+10/+12) + permanent damage buff — NEVER heal boss HP

03

Rule 03 — Moveset upgrade forces tactical adaptation: Bandit 4×2->4×3, Bull 14->17, Palm 15->17 & 4×3

04

Interactive tension-curve & anti-pattern toggle: feel why boss healing ruins fights compared to shield bursts

Installable Agent Skill · Free

Drop straight into Claude Code, Cursor, or Codex

Paste into your AI agent chat
Read https://gameskill.dev/labs/boss-phase-transition/skill.md and apply this skill to my game
Go Deeper · Companion GameSkill Pro Kit

Companion pack "Roguelike Combat & Boss Kit" ships runnable JS/TS + Godot 4 (.gd) + Unity (.cs) source code — unlock all 12 multi-engine Pro packs + 84 commercial WAV SFX + 8 2D VFX shaders from $8.25/mo ($99/yr, save 36%) or $12.9/mo.

Full SKILL.md Specification & Verification Checklist

Boss Half-HP Phase Transition & Hard Phase-Lock Contract

Half-HP boss transformations are not designed to torture players — they exist to kill second-half combat fatigue once the player's build comes online. Great boss design slices one long predictable fight into two (or three) shorter fights, each with its own climax.

1. The 3 Mandatory Rules (Extracted from Zhaoshi Wulin)

  1. Rule 01 — One-Shot Threshold Gate + Hard Phase-Boundary HP Clamp:

    • Trigger strictly once per phase using an explicit guard:
      if (hp <= threshold && !triggeredPhases.has(nextPhase)) {
        triggeredPhases.add(nextPhase);
        enterPhase(nextPhase);
      }
      
    • Regular bosses trigger at exact 50% HP (42/84, 45/90, 58/116, 56/112).
    • Multi-phase final bosses (e.g. 3-phase Grandmaster Cangfeng 148 HP with gates at 96 and 45) apply a hard HP floor clamp on single-hit overflow (if (prevHp > 45 && rawNextHp < 45) nextHp = 45) so a massive -70 burst from 100 HP stops cleanly at 45 HP instead of skipping Phase 2.
  2. Rule 02 — Grant Temporary Shield + Permanent Damage Buff, NEVER Heal the Boss:

    • On transition, grant an immediate temporary Shield (+6, +8, +10 P2, +12 P3) and escalate offensive pressure.
    • Hard Anti-Pattern: Never restore boss HP on phase shift. Healing erases the player's hard-won damage progress and triggers instant frustration; temporary Shield restores tactical urgency while respecting every HP point already shaved off.
  3. Rule 03 — Upgrade the Moveset to Force Tactical Adaptation:

    • A solution that solved Phase 1 must no longer autopilot Phase 2. Pick one clear escalation axis per boss:
      • Heavier Blows: Raging Bull Brawler upgrades Heavy Fist 14 -> 17 (+3 permanent).
      • More Hits: Bandit Chieftain upgrades Flurry 4×2 -> 4×3 (punishes flat per-hit weak points / single-hit blocks).
      • Faster Tempo: Palm Grandmaster upgrades Heavy Palm 15 -> 17 and accelerates Rapid Palm to 4×3.

2. Verification Checklist

  • Phase transition fires strictly once per threshold (!triggeredPhases.has(phase)) — never re-fires if HP fluctuates.
  • Multi-phase final boss clamps massive single-hit overflow cleanly at the phase floor (e.g. 100 - 70 -> 45 HP).
  • Boss HP never increases on phase transition (bossHeal === 0); tension comes strictly from temporary Shield + upgraded intent.
  • Phase 2+ visibly changes the enemy's telegraph/intent (more hits, heavier single blow, or faster cadence).

ENGINEERING BREAKDOWN & BENCHMARK

Why Naive AI Implementations Fail (Measured Benchmark)

Checking `if hp <= max_hp * 0.5: enter_phase_2()` AFTER applying damage lets a 70-damage crit delete a 100-HP boss straight to 0, skipping the entire phase-2 choreography, music swap, and counter mechanics. Clamping excess damage at the exact phase threshold guarantees every player experiences the climax cleanly.

Deterministic clamp proof: 100 HP Boss taking 70 DMG locks cleanly at 45 HP threshold -> triggers Phase 2 transition + telegraphed counter -> never skips mechanics.

PRODUCTION CODE · GODOT 4 · UNITY C# · TYPESCRIPT

Reference Implementation in Godot 4, Unity C#, and TypeScript

Godot 4 (GDScript)

boss_phase_controller.gd
class_name BossPhaseController
extends Node

signal phase_triggered(new_phase: int)

@export var max_hp: int = 100
@export var phase_thresholds: Array[int] = [45] # Hard lock HP values
var hp: int = 100
var current_phase: int = 1

func apply_damage(raw_damage: int) -> Dictionary:
	var next_hp := maxi(0, hp - raw_damage)
	var clamped := false
	if current_phase <= phase_thresholds.size():
		var gate := phase_thresholds[current_phase - 1]
		if hp > gate and next_hp <= gate:
			next_hp = gate
			clamped = true
			current_phase += 1
			phase_triggered.emit(current_phase)
	hp = next_hp
	return { "hp": hp, "clamped": clamped, "phase": current_phase }

Unity (C#)

BossPhaseHealth.cs
using System;
using UnityEngine;

public class BossPhaseHealth : MonoBehaviour
{
    public event Action<int> OnPhaseTransition;
    [SerializeField] private int[] phaseGates = { 45 };
    public int CurrentHp { get; private set; } = 100;
    public int Phase { get; private set; } = 1;

    public bool ApplyDamage(int damage)
    {
        int nextHp = Mathf.Max(0, CurrentHp - damage);
        bool clamped = false;
        if (Phase <= phaseGates.Length)
        {
            int gate = phaseGates[Phase - 1];
            if (CurrentHp > gate && nextHp <= gate)
            {
                nextHp = gate;
                clamped = true;
                Phase++;
                OnPhaseTransition?.Invoke(Phase);
            }
        }
        CurrentHp = nextHp;
        return clamped;
    }
}

TypeScript (Web / Phaser)

boss-phase-lock.ts
export function applyBossDamage(
  state: { hp: number; phase: number; gates: number[] },
  damage: number
): { hp: number; phaseTriggered: boolean } {
  const gate = state.gates[state.phase - 1];
  let nextHp = Math.max(0, state.hp - damage);
  let phaseTriggered = false;
  if (gate !== undefined && state.hp > gate && nextHp <= gate) {
    nextHp = gate;
    state.phase += 1;
    phaseTriggered = true;
  }
  state.hp = nextHp;
  return { hp: nextHp, phaseTriggered };
}

DEVELOPER FAQ

Tuning, Edge Cases & Engine Integration FAQ

Does hard HP-locking frustrate players with high-damage burst builds?

Not if you signal the lock visually on the HP bar (a visible notch/seal marker before they attack) and convert overflow damage into stagger/shield break or crisp phase-break VFX.

Should a Boss cleanse debuffs cleanly on phase transition?

Cleanse stuns/freezes so the boss cannot be stun-locked through its own phase intro, but keep scaling build stacks (like Poison or Mark) partially intact (e.g., halve stacks) so DoT builds aren’t punished unfairly.

How many phases should a standard Act Boss have?

Two distinct phases (one threshold at 45–55% HP) hits the sweet spot for Act 1–2 bosses; save 3-phase multi-gate fights for the final Act climax.

Can I preview this state machine inside a full playable deckbuilder?

Yes—both our Roguelike Combat & Boss Kit (`/pro/roguelike-combat-boss-kit`) and the Roguelike Deckbuilder Starter ship production-tested phase-lock controllers.

Related Engine Hubs, Guides & Production Kits

More interactive labs in this track

Extracted from a real game · Zhaoshi Wulin

Every formula in these labs ships inside our upcoming Steam wuxia deckbuilder

3 martial-arts characters, 39 enemies, 70 relics, 19 kungfu finishers built in Godot with AI agents. Every time we solve a hard design or feel problem, we turn it into an interactive lab and skill here.