Status effect system

From nlelouche/Unity-SkillForge · View interactive version

Status effect system is an AI agent skill from the GitHub repository nlelouche/Unity-SkillForge. Complete buff/debuff system with stacking, timed effects, tick damage/heal, and stat modifiers.

How to use this skill

Skill file

Status Effect System

Overview

Complete buff/debuff system supporting stacking, duration, tick damage/heal, stat modifiers, and VFX integration.

When to Use

Architecture

┌─────────────────────────────────────────────────────────────┐
│                   StatusEffectSO                            │
│              (ScriptableObject Asset)                       │
├─────────────────────────────────────────────────────────────┤
│  Identity: ID, Name, Icon, Type (Buff/Debuff)               │
│  Duration: Time, IsPermanent, Stacking                      │
│  Tick: Interval, Damage, Heal                               │
│  Stats: [{Stat, Type, Value}, ...]                          │
└─────────────────────────────────────────────────────────────┘
                              ↓
┌─────────────────────────────────────────────────────────────┐
│                StatusEffectHandler                          │
│              (On Entity)                                    │
├─────────────────────────────────────────────────────────────┤
│  ApplyEffect(effect, stacks)                                │
│  RemoveEffect(effect)                                       │
│  Update: Process ticks, decrement duration                  │
│  Events: OnEffectApplied, OnEffectRemoved, OnEffectTick     │
└─────────────────────────────────────────────────────────────┘

Effect Types

| Type | Examples |

|------|----------|

| Buff | Speed Up, Damage Up, Shield |

| Debuff | Slow, Poison, Burn, Stun |

| DoT | Poison, Burn, Bleed (tick damage) |

| HoT | Regeneration (tick heal) |

Stack Behaviors

Best Practices

Few-Shot Examples

Example 1: Apply Poison

User: "Enemy attack applies poison."

Agent:

// In EnemyAttack.cs
if (hit.TryGetComponent<StatusEffectHandler>(out var handler))
{
    handler.ApplyEffect(poisonEffectSO, 1);
}

Example 2: Speed Buff

User: "Potion gives 20% speed for 10 seconds."

Agent:

// StatusEffectSO asset:
// Duration: 10, Type: Buff
// StatModifiers: [{MovementSpeed, Percent, 0.2}]

Example 3: Stacking Bleed

User: "Each hit adds a bleed stack, max 5."

Agent:

// StatusEffectSO asset:
// IsStackable: true, MaxStacks: 5
// StackBehavior: AddStack
// HasTick: true, TickDamage: 5 per stack

TDD Contract

⚠️ Legacy Skill — Refactor Pending

Este skill NO tiene tests automatizados aún. El siguiente boilerplate es un punto de partida.

// Escribe estos tests ANTES de implementar:

// Test 1: should [expected behavior] when [condition]
[Test]
public void StatusEffectSystem_Should{ExpectedBehavior}_When{Condition}()
{{
    // Arrange
    // TODO: Setup test fixtures
    
    // Act
    // TODO: Execute system under test
    
    // Assert
    Assert.Fail("Not implemented — write test first");
}}

// Test 2: should handle [edge case]
[Test]
public void StatusEffectSystem_ShouldHandle{EdgeCase}()
{{
    // Arrange
    // TODO: Setup edge case scenario
    
    // Act
    // TODO: Execute
    
    // Assert
    Assert.Fail("Not implemented");
}}

// Test 3: should throw when [invalid input]
[Test]
public void StatusEffectSystem_ShouldThrow_When{InvalidInput}()
{{
    // Arrange
    var invalidInput = default;
    
    // Act & Assert
    Assert.Throws<Exception>(() => {{ /* execute */ }});
}}

Pasos para completar el TDD:

  1. Descomenta los tests above
  2. Implementa la funcionalidad mínima para que compile
  3. Ejecuta los tests — deben fallar (RED)
  4. Implementa la funcionalidad real
  5. Verifica que los tests pasen (GREEN)
  6. Refactorea manteniendo los tests verdes

Nota: Este skill fue marcado como tdd_first: false durante la auditoría v2.0.1. La sección TDD fue agregada automáticamente pero requiere customización manual para reflejar el comportamiento real del skill.

Related Skills

Template Files

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.