Overview
The skills system powers Project Stardust’s battle mechanics. It’s a modular, extensible framework that supports:- 70+ unique skills with diverse effects
- 4-phase battle lifecycle (Start → Power Calc → Post-Calc → End)
- Skill interactions (synergies, suppressions, conditional buffs)
- Retry mechanics (skills can rewind battles)
- Priority system (determines execution order)
Architecture
System Components
File Structure
Core Classes
BattleContext
Manages all battle state. Located incore/skills/engine.py:1.
BattleSkill (Base Class)
Abstract base for all skills. Located incore/skills/engine.py:58.
Battle Lifecycle
Phase 1: Battle Start
Executed once per battle (or retry) in priority order. Location:cogs/battle.py:128-129
- Disable enemy skills (Onyx Moon, Zodiac Pig)
- Apply team-wide buffs/debuffs (Guard, Ephemerality)
- Trigger random effects (Queen of the Zodiacs)
- Sacrifice mechanics (Kamikaze, Griffith)
Phase 2: Power Calculation
Executed per character to determine final power. Location:cogs/battle.py:153-176
- Simple buffs (Surge, Berserk)
- Conditional buffs (Amber Sun, Eternity)
- Probabilistic effects (Lucky 7, Joker)
Phase 3: Post-Calculation
Executed after base calculations but before summation. Location:cogs/battle.py:179-180
- Power swapping (Zodiac Monkey)
- Power copying (Zodiac Dog)
- Fixed power overrides (Zodiac Sheep)
- Conditional cleanses (Casca’s Runaway)
Phase 4: Battle End
Executed after winner is determined. Location:cogs/battle.py:195-209
- Outcome reversal (Revive)
- Battle retry (The Almighty)
Skill Registry
SKILL_DATA Dictionary
Central skill configuration incore/skills/registry.py:10.
description- User-facing tooltip textvalue- Numeric config (can be int, float, list, or dict)applies_in- Context:"b"(battle),"e"(expedition),"g"(global)stackable- Whether multiple instances can stackoverlap- Whether same skill on different units stacksclass- Python class implementing the logic
Factory Function
Skill Categories
Simple Buffs
Basic power multipliers. Examples: Surge (+25%), Berserk (25% chance for +50%), Golden Egg (1% chance for 3x) Implementation:core/skills/implementations.py:41
Conditional Synergies
Require specific characters to activate. Examples:- Amber Sun - If Agott is present, both gain +15%
- Eternity - If Himmel is present, gain +18%
- Feline Fealty - If Tohru is present, both gain +10% and enemies lose -2.5%
core/skills/implementations.py:486
Team-Wide Effects
Affect multiple units. Examples:- Guard - Reduce all enemy power by 10%
- Ephemerality - If Frieren present, boost entire team by 6%
- Queen of the Zodiacs (Tiger) - Boost team by 5%
core/skills/implementations.py:425
Skill Suppression
Disable enemy skills. Examples:- Onyx Moon - Disables 1 random enemy skill
- Zodiac (Pig) - Disables 1 random enemy skill
- The Almighty - Suppresses all ally skills (self-sacrifice)
core/skills/implementations.py:547
Sacrifice Mechanics
Self-destruction for strategic advantage. Examples:- Kamikaze - Sacrifice self to eliminate 1 random enemy
- The Absolute (Griffith) - Sacrifice all allies (except Guts) to massively buff him
core/skills/implementations.py:601
Advanced Mechanics
The Almighty (Yhwach)
Most complex skill with retry logic. Location:core/skills/implementations.py:87
Features:
- Auswählen - Suppresses all ally skills (except Jugram), reduces their power by 40%
- Absorption - Gains +10% power (+0.5% per dupe) per suppressed skill
- Rewrite Future - If defeated, retries battle (max 5 times, +1 per 2 dupes)
- Evolution - Gains +25% power per retry
The Balance (Jugram Haschwalth)
Nullifies variance and absorbs deviation. Location:core/skills/implementations.py:180
Priority System
Skills execute in order of priority (highest first). Default:priority = 0
Custom Priorities:
cogs/battle.py:125
Suppression Rules
Suppression Immunity
Some skills cannot be suppressed:Check Pattern
Always check suppression at the start of each phase:Protected Skills
Certain skills are exempt from suppression by specific abilities:Testing Skills
Adding a New Skill
- Define in Registry (
core/skills/registry.py)
- Implement Class (
core/skills/implementations.py)
- Import in Registry
- Add to Character (via admin command or database)
Debug Logging
Add verbose logs during development:Best Practices
1. Always Check Suppression
2. Use Flags for State
Store temporary data inctx.flags:
3. Prevent Stacking When Needed
4. Use Priority for Dependencies
If Skill A must run before Skill B, give A higher priority.5. Handle None/Empty Gracefully
6. Log User-Friendly Messages
Next Steps
- Bot Architecture - System overview
- Database Schema - Data structures
- Battle Commands - User guide