Invisibility potion HUD - UQcsse3200/2026-studio-4 GitHub Wiki

Invisibility potion HUD

Task: #133
PR: #140
Feature: HUD #98

Shows remaining stealth (15s) and cooldown (45s) on the player stats HUD.

Participants

  • Inventory / tryUse
  • InvisibilityPotionComponent
  • CombatStatsComponent
  • PlayerStatsDisplay
  • Enemy AI (invisiblePlayer)

Behaviour

  • Drink → 15s stealth, HUD counts down.
  • Stealth ends → 45s Invis CD.
  • Already stealthed → refresh.
  • On cooldown → drink rejected.
  • Hostile damage blocked while stealthed.

Flowchart

flowchart TD
    A[Player uses potion] --> B{On cooldown?}
    B -->|yes| C[Reject drink]
    B -->|no| D{Already stealthed?}
    D -->|yes| E[Refresh 15s]
    D -->|no| F[Start 15s stealth]
    E --> G[HUD: Invisibility remaining]
    F --> G
    G --> H[AI: invisiblePlayer]
    G --> I[Hostile damage blocked]
    I --> J[15s ends]
    J --> K[Start 45s cooldown]
    K --> L[HUD: Invis CD]

Sequence diagram

sequenceDiagram
    participant Inv as Inventory
    participant Potion as InvisibilityPotionComponent
    participant Stats as CombatStatsComponent
    participant HUD as PlayerStatsDisplay
    participant AI as Enemy AI

    Inv->>Potion: tryUse
    Potion->>Potion: start or refresh 15s
    Potion->>HUD: duration text
    Potion->>AI: invisiblePlayer
    Stats->>Potion: hostile damage
    Potion-->>Stats: blocked while stealthed
    Note over Potion: 15s ends
    Potion->>Potion: 45s cooldown
    Potion->>HUD: Invis CD

Tests

  • InvisibilityPotionComponentTest