Skip to content

Death Saves & Unconscious State #101

Description

@FirebrickRed

Summary

Handle player death saving throws when reduced to 0 HP. Track successes/failures, handle natural 20s (regain consciousness) and natural 1s (two failures), and manage the unconscious state including damage while down.

Phase: MVP Combat System
Systems: Combat System, Character State, Scoreboard

Prerequisites

Goals

  • Automatic unconscious state when player reaches 0 HP
  • Death saving throw tracking (3 successes = stable, 3 failures = death)
  • Auto-prompt for death saves on unconscious player's turn
  • Natural 20/1 special handling
  • Damage while unconscious causes failures
  • Healing while unconscious restores consciousness
  • Scoreboard display of death save progress
  • Prone status when unconscious

Unconscious Trigger

// When player reaches 0 HP (from #100)
if (player.getCurrentHealth() <= 0) {
    player.setCurrentHealth(0);
    
    // Set unconscious state
    combatant.setUnconscious(true);
    combatant.setDeathSaveSuccesses(0);
    combatant.setDeathSaveFailures(0);
    
    // Make player prone (Minecraft effects)
    applyProneEffect(player);
    
    broadcast(player.getName() + " falls unconscious!");
    broadcast("Death saving throws begin on their turn.");
}

Death Saving Throws

Auto-Prompt on Turn

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
It's Alice's turn!
Alice is UNCONSCIOUS and must make a death saving throw.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Type /combat deathsave or click [Roll Death Save]

Commands

# Roll death save (auto-roll)
/combat deathsave
> Alice makes a death saving throw...
> Roll: 14 → SUCCESS (DC 10)
> Death Saves: ●●○ successes | ○○○ failures

# Player provides their roll
/combat deathsave --roll 8
> Alice makes a death saving throw...
> Roll: 8 → FAILURE (DC 10)
> Death Saves: ●○○ successes | ●○○ failures

Natural 20 - Regain Consciousness

/combat deathsave
> Alice makes a death saving throw...
> Roll: ★ NATURAL 20 ★
> Alice regains 1 HP and consciousness!
> Alice is no longer prone but remains on the ground.
> HP: 0 → 1

Natural 1 - Two Failures

/combat deathsave
> Alice makes a death saving throw...
> Roll: ✗ NATURAL 1 ✗
> CRITICAL FAILURE - counts as TWO failures!
> Death Saves: ●○○ successes | ●●● failures
> Alice has died!

Death Save Results

Three Successes - Stabilized

> Alice makes a death saving throw...
> Roll: 15 → SUCCESS
> Death Saves: ●●● successes | ●○○ failures
> Alice is STABILIZED!
> (Unconscious but no longer dying - no more death saves needed)

Three Failures - Death

> Alice makes a death saving throw...
> Roll: 7 → FAILURE
> Death Saves: ●●○ successes | ●●● failures
> Alice has DIED!
> [Remove from combat or mark as dead based on campaign rules]

Damage While Unconscious

// Taking damage while at 0 HP
if (combatant.isUnconscious() && damage > 0) {
    combatant.addDeathSaveFailure(1);
    broadcast(player.getName() + " takes damage while unconscious!");
    broadcast("Automatic death save FAILURE!");
    
    // Critical hit = 2 failures
    if (wasCriticalHit) {
        combatant.addDeathSaveFailure(1);  // +1 more
        broadcast("Critical hit - TWO automatic failures!");
    }
    
    checkForDeath(combatant);
}

Healing While Unconscious

/combat heal Alice 5
> Alice is healed for 5 HP while unconscious!
> Alice regains consciousness!
> HP: 0 → 5
> Death saves reset.
> Alice is no longer prone.
if (combatant.isUnconscious() && healing > 0) {
    player.heal(healing);
    combatant.setUnconscious(false);
    combatant.resetDeathSaves();
    removeProneEffect(player);
    broadcast(player.getName() + " regains consciousness!");
}

Prone Effect (Minecraft)

private void applyProneEffect(Player player) {
    // Option 1: Slowness effect to simulate prone
    player.addPotionEffect(new PotionEffect(
        PotionEffectType.SLOWNESS, 
        Integer.MAX_VALUE,  // Until removed
        255,  // Can't move
        false, false
    ));
    
    // Option 2: Just track state (DM enforces)
    // Prone rules: disadvantage on attacks, advantage for melee attackers
}

private void removeProneEffect(Player player) {
    player.removePotionEffect(PotionEffectType.SLOWNESS);
}

Scoreboard Display

━━━ INITIATIVE ━━━
  19 Alice 💀 ●●○/●○○   ← Unconscious, 2 success / 1 fail
  15 Bob
→ 12 Goblin Chief
  8  Kobold Scout
━━━━━━━━━━━━━━━━━━

Legend:
💀 = Unconscious
●●● = 3 successes (stabilized)
●●●/●●● = Successes/Failures

Alternative compact format:

  19 Alice [DOWN 2/1]    ← 2 successes, 1 failure

State Machine

         ┌──────────────┐
         │   CONSCIOUS  │
         │   (HP > 0)   │
         └──────┬───────┘
                │ Damage reduces HP to 0
                ▼
         ┌──────────────┐
    ┌────│  UNCONSCIOUS │────┐
    │    │  (Death Saves)│    │
    │    └──────┬───────┘    │
    │           │            │
 Healed    3 Successes    3 Failures
    │           │            │
    │           ▼            │
    │    ┌──────────────┐    │
    │    │  STABILIZED  │    │
    │    │ (No saves)   │    │
    │    └──────────────┘    │
    │                        │
    ▼                        ▼
┌──────────────┐      ┌──────────────┐
│  CONSCIOUS   │      │    DEAD      │
│  (HP > 0)    │      │              │
└──────────────┘      └──────────────┘

Data Structure

public class DeathSaveState {
    private int successes = 0;  // 0-3
    private int failures = 0;   // 0-3
    private boolean isStabilized = false;
    private boolean isDead = false;
    
    public void addSuccess() {
        successes++;
        if (successes >= 3) {
            isStabilized = true;
        }
    }
    
    public void addFailure(int count) {
        failures += count;
        if (failures >= 3) {
            isDead = true;
        }
    }
    
    public void reset() {
        successes = 0;
        failures = 0;
        isStabilized = false;
        isDead = false;
    }
}

Skip Turn When Unconscious

// Unconscious players can only make death saves on their turn
if (combatant.isUnconscious() && !combatant.isStabilized()) {
    promptDeathSave(combatant);
    // No other actions available
} else if (combatant.isStabilized()) {
    broadcast(player.getName() + " is stabilized and skips their turn.");
    advanceToNextTurn();
}

Future Enhancements (Not MVP)

  • Spare the Dying cantrip auto-stabilization
  • Medicine check to stabilize (DC 10)
  • Instant death at negative max HP (config option)
  • Revivify and resurrection spell integration
  • Death notification to party

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    characterpertaining to the players charactercombatCombat, HP, initiative, damageenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions