Combat Step
Introduction
Initiates turn-based combat encounters with specified enemies and branching outcomes.
Interface
interface CombatStep {
kind: 'combat';
condition?: string;
enemies: EnemyEntity[];
playerBuffs?: Buff[];
numEnemies?: number;
isSpar?: boolean;
bgm?: string[];
victory: EventStep[];
defeat: EventStep[];
}
Properties
kind
- Always'combat'
enemies
- Array of enemy entities to fight. Either the full list to fight, or the pool to draw from ifnumEnemies
is set.playerBuffs
(optional) - Buffs to apply to the playernumEnemies
(optional) - Number of enemies to spawn. If set, will select this number randomly from the enemies poolisSpar
(optional) - Whether this is a sparring matchbgm
(optional) - Background music for combatvictory
- Steps to execute on victorydefeat
- Steps to execute on defeatcondition
(optional) - Conditional execution
Examples
Basic Combat
{
kind: 'combat',
enemies: [
mountainBear
],
victory: [
{ kind: 'text', text: 'You defeated the mountain bear!' },
{ kind: 'addItem', item: { name: 'BearHide' }, amount: '1' }
],
defeat: [
{ kind: 'text', text: 'The bear overpowers you.' },
]
}
Horde battle
{
kind: 'combat',
enemies: [
ratascar, ratascar, ratascar
],
victory: [
{ kind: 'text', text: 'You defeat the swarm of ratascar' },
],
defeat: [
{ kind: 'text', text: 'The swarm overwhelms you and you flee' },
]
}
Randomised group
{
kind: 'combat',
enemies: [
ratascar, gorashi, xingKulei, stellarShard, gravityAnomaly
],
numEnemies: 2,
victory: [
{ kind: 'text', text: 'You defeat the pair of beasts' },
],
defeat: [
{ kind: 'text', text: 'You lose and run' },
]
}