Skip to content

Status Effects

wizzardLord edited this page Sep 15, 2026 · 1 revision

Overview

The status effects system allows the implementation of temporary buffs or debuffs to an entity. This is achieved by attributing the entities with a component to store the relevant stat changes.

Interacting with Status Effects

To interact with status effects you must first be operating with an entity with the StatusEffectControllerComponent, this should be all entities as some effects may grant another entity a status effect. Most interaction can be achieved directly through a method call on this class.

  • public void addStatusEffect(int, char) This method is the way to give an entity a status effect. It is a method of the StatusEffectControllerComponent.
    • int stacks - This refers to the number of stacks of the status effect you want to add.
    • char statusEffect - This is the character symbol reference for the status effect you want to add. A list of current character symbols can be found at the bottom of the file..

Example implementations

statusEffectControllerComponent.addStatusEffect(1, 'r') This will add 1 new stack of burning to the relevant entity. statusEffectControllerComponent.addStatusEffect(4, 'v') This will add 4 new stacks of vulnerability to the relevant entity.

Removing Status Effects

Generally you will not need to worry about removing status effects as they remove themselves once the duration has expired.

Creating a New Status Effect

The status effect controller follows a class structure based on not interacting directly with any of the concrete implementations of status effects where possible to remove dependencies. Instead it interacts with the StatusEffectFactory class to create the status effect. This class then creates the status effect and returns it to the controller as a StatusEffect object.

  1. When you create the new status effect object make sure it implements the StatusEffect interface.
  2. Add any other relevant interfaces for the status effect triggers. e.g. If your status effect does something when the entity is damaged, add the Damageable interface.
  3. Once you have completed the status effect's methods, add it to the StatusEffectFactory static class.
  4. Add the StatusEffectFactory static method to the addStatusEffect method in the StatusEffectControllerComponent. Make sure to choose a unique character symbol for your status effect as the switch case wont work if you choose the same one.
  5. Make sure your new status effect holds with the below class diagram
image

Status Effect Symbols

- 'b' - burning

- 'r' - regeneration

- 's' - slow

- 'S' - speed up

- 'v' - vulnerable

- 'f' - freeze

Table of Contents

Home

Test Plan

Team 2

Features

Components
Player
Items and Inventory
Enemies
Interactable NPCs
Cutscenes and Dialogue
Music
Bosses
Rooms
Weapons
Abilities & Spells
Game Screens and Areas
Dungeons

Game Engine

Getting Started

Entities and Components

Service Locator

Loading Resources

Logging

Unit Testing

Debug Terminal

Input Handling

UI

Animations

Audio

AI

Physics

Terrain

Concurrency & Threading

Settings

Troubleshooting

MacOS Setup Guide

Clone this wiki locally