108 lines
2.6 KiB
TypeScript
108 lines
2.6 KiB
TypeScript
import {
|
|
firstBattleBonds,
|
|
firstBattleMap,
|
|
firstBattleUnits,
|
|
firstBattleVictoryPages,
|
|
type BattleBond,
|
|
type BattleMap,
|
|
type StoryPage,
|
|
type UnitData
|
|
} from './scenario';
|
|
|
|
export type BattleScenarioId = 'first-battle-zhuo-commandery';
|
|
|
|
export type BattleObjectiveKind = 'defeat-leader' | 'keep-unit-alive' | 'secure-terrain' | 'quick-victory';
|
|
|
|
export type BattleObjectiveDefinition = {
|
|
id: string;
|
|
kind: BattleObjectiveKind;
|
|
label: string;
|
|
rewardGold: number;
|
|
unitId?: string;
|
|
terrain?: string;
|
|
maxTurn?: number;
|
|
};
|
|
|
|
export type BattleDefeatConditionDefinition = {
|
|
kind: 'unit-defeated';
|
|
unitId: string;
|
|
};
|
|
|
|
export type BattleScenarioDefinition = {
|
|
id: BattleScenarioId;
|
|
title: string;
|
|
map: BattleMap;
|
|
units: UnitData[];
|
|
bonds: BattleBond[];
|
|
mapTextureKey: string;
|
|
leaderUnitId: string;
|
|
quickVictoryTurnLimit: number;
|
|
baseVictoryGold: number;
|
|
objectives: BattleObjectiveDefinition[];
|
|
defeatConditions: BattleDefeatConditionDefinition[];
|
|
itemRewards: string[];
|
|
victoryPages: StoryPage[];
|
|
nextCampScene: string;
|
|
};
|
|
|
|
export const firstBattleScenario: BattleScenarioDefinition = {
|
|
id: 'first-battle-zhuo-commandery',
|
|
title: '탁현의 전투',
|
|
map: firstBattleMap,
|
|
units: firstBattleUnits,
|
|
bonds: firstBattleBonds,
|
|
mapTextureKey: 'battle-map-first',
|
|
leaderUnitId: 'rebel-leader',
|
|
quickVictoryTurnLimit: 8,
|
|
baseVictoryGold: 300,
|
|
objectives: [
|
|
{
|
|
id: 'leader',
|
|
kind: 'defeat-leader',
|
|
label: '황건 두령 격파',
|
|
rewardGold: 200,
|
|
unitId: 'rebel-leader'
|
|
},
|
|
{
|
|
id: 'liu-bei',
|
|
kind: 'keep-unit-alive',
|
|
label: '유비 생존',
|
|
rewardGold: 100,
|
|
unitId: 'liu-bei'
|
|
},
|
|
{
|
|
id: 'village',
|
|
kind: 'secure-terrain',
|
|
label: '마을 확보',
|
|
rewardGold: 150,
|
|
terrain: 'village'
|
|
},
|
|
{
|
|
id: 'quick',
|
|
kind: 'quick-victory',
|
|
label: '8턴 안에 승리',
|
|
rewardGold: 120,
|
|
maxTurn: 8
|
|
}
|
|
],
|
|
defeatConditions: [{ kind: 'unit-defeated', unitId: 'liu-bei' }],
|
|
itemRewards: ['콩 1', '탁주 1', '의용군 명성 +1'],
|
|
victoryPages: firstBattleVictoryPages,
|
|
nextCampScene: 'CampScene'
|
|
};
|
|
|
|
export const defaultBattleScenarioId: BattleScenarioId = firstBattleScenario.id;
|
|
|
|
export const battleScenarios: Record<BattleScenarioId, BattleScenarioDefinition> = {
|
|
[firstBattleScenario.id]: firstBattleScenario
|
|
};
|
|
|
|
export const defaultBattleScenario = battleScenarios[defaultBattleScenarioId];
|
|
|
|
export function getBattleScenario(id: string | undefined) {
|
|
if (id && id in battleScenarios) {
|
|
return battleScenarios[id as BattleScenarioId];
|
|
}
|
|
return defaultBattleScenario;
|
|
}
|