🎯

combat-system-creator

🎯Skill

from cesaraugustusgrob/shinobi-way-the-inifinite-tower

VibeIndex|
What it does

combat-system-creator skill from cesaraugustusgrob/shinobi-way-the-inifinite-tower

combat-system-creator

Installation

Install skill:
npx skills add https://github.com/cesaraugustusgrob/shinobi-way-the-inifinite-tower --skill combat-system-creator
1
AddedJan 29, 2026

Skill Details

SKILL.md

Create and modify combat system components for SHINOBI WAY game following the dual-system architecture (CombatCalculationSystem + CombatWorkflowSystem). Use when user wants to add new combat mechanics, damage formulas, status effects, mitigation logic, turn phases, or refactor existing combat code. Guides through proper separation of pure calculations vs state management.

Overview

# Combat System Creator - SHINOBI WAY

Create combat system components following the dual-system architecture: pure calculations separated from state workflow.

Architecture Principle

```

Player Action β†’ CombatCalculationSystem (pure math) β†’ CombatWorkflowSystem (apply to state)

```

CombatCalculationSystem: Pure functions, no mutations, returns complete results

CombatWorkflowSystem: State management, applies calculated results, controls flow

When to Use

  • Add new damage calculations or formulas
  • Create new status effects or mitigation mechanics
  • Add new combat phases or turn logic
  • Refactor existing combat code
  • Balance or modify combat math

Quick Reference

Damage Pipeline (5 Steps)

```

  1. Hit Check β†’ MELEE: Speed vs Speed | RANGED: Accuracy vs Speed | AUTO: Always hits
  2. Base Damage β†’ ScalingStat Γ— damageMult
  3. Element β†’ Super: 1.5Γ— (+10% crit) | Resist: 0.5Γ— | Neutral: 1.0Γ—
  4. Critical β†’ 8% + (DEX Γ— 0.5) + bonuses, max 75%, multiplier 1.75Γ—
  5. Defense β†’ Flat (max 60% reduction) then % (soft cap 75%)

```

Mitigation Pipeline (Priority Order)

```

  1. INVULNERABILITY β†’ Blocks ALL damage (return 0)
  2. REFLECTION β†’ Calculate reflected damage (before curse)
  3. CURSE β†’ Amplify: damage Γ— (1 + curseValue)
  4. SHIELD β†’ Absorb damage before HP
  5. GUTS β†’ Survive at 1 HP if roll succeeds

```

Defense Formulas

| Type | Flat | Percent (Soft Cap) |

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

| Physical | STR Γ— 0.3 | STR / (STR + 200) |

| Elemental | SPI Γ— 0.3 | SPI / (SPI + 200) |

| Mental | CAL Γ— 0.25 | CAL / (CAL + 150) |

Damage Properties

| Property | Flat Def | % Def |

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

| NORMAL | βœ… (max 60%) | βœ… |

| PIERCING | ❌ | βœ… |

| ARMOR_BREAK | βœ… | ❌ |

| TRUE | ❌ | ❌ |

Workflow: Adding New Mechanics

Step 1: Identify System

Ask: Is this pure math or state management?

| CombatCalculationSystem | CombatWorkflowSystem |

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

| Damage formulas | Applying damage to HP |

| Hit/miss/evasion rolls | Turn order management |

| Crit calculations | Buff duration tracking |

| Defense reduction | Phase transitions |

| Effect chance rolls | Combat log generation |

Step 2: Design the Calculation Interface

For new calculations, define the result interface:

```typescript

interface NewMechanicResult {

// All values needed to apply this mechanic

value: number;

triggered: boolean;

// Metadata for logging

logs: CombatLogEntry[];

}

```

Step 3: Implement Pure Function

```typescript

// In CombatCalculationSystem

function calculateNewMechanic(

attackerStats: DerivedStats,

defenderStats: DerivedStats,

context: CombatContext

): NewMechanicResult {

// Pure calculation - NO state mutation

return { value, triggered, logs };

}

```

Step 4: Implement Workflow Application

```typescript

// In CombatWorkflowSystem

function applyNewMechanic(

state: CombatWorkflowState,

result: NewMechanicResult

): CombatWorkflowState {

// Apply result to state - returns NEW state

return { ...state, / updated values / };

}

```

Creating New Status Effects

Effect Types Available

```typescript

// Damage Over Time

DOT, BLEED, BURN, POISON

// Crowd Control

STUN, CONFUSION, SILENCE

// Defensive

SHIELD, INVULNERABILITY, REFLECTION

// Stat Modifiers

BUFF, DEBUFF, CURSE

// Recovery

HEAL, REGEN, CHAKRA_DRAIN

```

Effect Interface

```typescript

interface SkillEffect {

type: EffectType;

value: number; // Damage/heal amount or multiplier

duration: number; // Turns (-1 = permanent)

chance: number; // 0.0-1.0 application chance

targetStat?: PrimaryStat; // For BUFF/DEBUFF

damageType?: DamageType; // For DoTs

damageProperty?: DamageProperty;

}

```

DoT Damage Formula

```typescript

// DoTs get 50% defense mitigation

dotDamage = max(1, baseDamage - (flatDef Γ— 0.5) - (damage Γ— percentDef Γ— 0.5))

```

Creating New Combat Phases

Existing Turn Phases

Player Turn:

  1. TURN_START β†’ Reset flags
  2. UPKEEP β†’ Toggle costs, passive regen
  3. MAIN_ACTION β†’ Skill execution
  4. DEATH_CHECK β†’ Victory/defeat
  5. TURN_END β†’ Mark turn complete

Enemy Turn:

  1. DOT_ENEMY β†’ Process enemy DoTs
  2. DOT_PLAYER β†’ Process player DoTs (through shield)
  3. DEATH_CHECK_DOT β†’ Check DoT kills
  4. ENEMY_ACTION β†’ AI skill selection + execution
  5. DEATH_CHECK_ATTACK β†’ Check combat kills
  6. RESOURCE_RECOVERY β†’ Cooldowns, chakra regen
  7. TERRAIN_HAZARDS β†’ Environmental damage
  8. FINAL_DEATH_CHECK β†’ Hazard kills

Adding New Phase

```typescript

// 1. Add to CombatPhase enum

enum CombatPhase {

// ... existing

NEW_PHASE,

}

// 2. Create calculation function

function calculateNewPhaseEffects(state: CombatWorkflowState): NewPhaseResult;

// 3. Create workflow handler

function processNewPhase(state: CombatWorkflowState): CombatWorkflowState;

// 4. Insert into turn flow in processEnemyTurn or executePlayerAction

```

Output Templates

New Calculation Function

```typescript

/**

* [Description of what this calculates]

* @param attackerStats - Attacker's derived stats

* @param defenderStats - Defender's derived stats

* @param skill - The skill being used

* @returns [ResultType] with all calculation details

*/

export function calculateX(

attackerStats: DerivedStats,

defenderStats: DerivedStats,

skill: Skill

): XResult {

const result: XResult = {

// Initialize result object

};

// Pure calculations here

// NO state mutation

// Use Math.random() for rolls

return result;

}

```

New Workflow Function

```typescript

/**

* [Description of what state changes this applies]

* @param state - Current combat state

* @param result - Calculation result to apply

* @returns New combat state with changes applied

*/

export function applyX(

state: CombatWorkflowState,

result: XResult

): CombatWorkflowState {

// Create new state object (immutable)

const newState = { ...state };

// Apply result values to state

// Add combat logs

// Check for combat end conditions

return newState;

}

```

New Effect Implementation

```typescript

// In constants/index.ts - Add to SKILLS

NEW_SKILL: {

id: 'new_skill',

name: 'New Skill Name',

// ... other properties

effects: [{

type: EffectType.NEW_EFFECT,

value: 10,

duration: 3,

chance: 0.8,

damageType: DamageType.PHYSICAL,

damageProperty: DamageProperty.NORMAL

}]

}

// In CombatSystem.ts - Handle in applyMitigation or processDoT

if (buff.effect.type === EffectType.NEW_EFFECT) {

// Calculate effect

// Apply to appropriate target

}

```

Reference Files

  • [combat-mechanics.md](references/combat-mechanics.md) - Full combat formulas and constants
  • [architecture.md](references/architecture.md) - Dual-system architecture details

Balance Constants

Resource Pools

  • HP: 50 + (WIL Γ— 12)
  • Chakra: 30 + (CHA Γ— 8)
  • HP Regen: maxHP Γ— 0.02 Γ— (WIL / 20)
  • Chakra Regen: INT Γ— 2

Combat Constants

  • Base Hit: 92%
  • Hit Range: 30-98%
  • Base Crit: 8%
  • Crit Cap: 75%
  • Crit Mult: 1.75Γ—
  • Flat Def Cap: 60% of damage
  • % Def Cap: 75%

Survival

  • Guts: WIL / (WIL + 200)
  • Status Resist: CAL / (CAL + 80)
  • Evasion: SPD / (SPD + 250)