Files
heros_web/src/game/data/storyCutscenes.ts

101 lines
2.3 KiB
TypeScript

import type { UnitDirection } from './unitAssets';
export type StoryCutsceneKind = 'muster' | 'operation' | 'victory';
export type StoryCutsceneTone = 'reward' | 'next' | 'bond';
export type StoryCutsceneMarkerSide = 'ally' | 'enemy' | 'objective';
export type StoryCutsceneActorProfile = {
unitId: string;
name: string;
roleLabel: string;
unitTextureKey: string;
portraitKey: string;
color: number;
};
export type StoryCutsceneActor = {
unitId: string;
x: number;
y: number;
size?: number;
direction?: UnitDirection;
label?: string;
line?: string;
};
export type StoryCutsceneMarker = {
x: number;
y: number;
label: string;
side: StoryCutsceneMarkerSide;
};
export type StoryCutsceneBriefing = {
title: string;
lines: string[];
};
export type StoryCutsceneReward = {
label: string;
tone?: StoryCutsceneTone;
};
export type StoryCutscene = {
kind: StoryCutsceneKind;
title: string;
subtitle?: string;
actors?: StoryCutsceneActor[];
briefing?: StoryCutsceneBriefing;
markers?: StoryCutsceneMarker[];
rewards?: StoryCutsceneReward[];
};
const storyCutsceneActorProfiles: Record<string, StoryCutsceneActorProfile> = {
'liu-bei': {
unitId: 'liu-bei',
name: '유비',
roleLabel: '검을 든 군주',
unitTextureKey: 'unit-liu-bei',
portraitKey: 'liuBei',
color: 0xd8b15f
},
'guan-yu': {
unitId: 'guan-yu',
name: '관우',
roleLabel: '장병기 선봉',
unitTextureKey: 'unit-guan-yu',
portraitKey: 'guanYu',
color: 0x74c476
},
'zhang-fei': {
unitId: 'zhang-fei',
name: '장비',
roleLabel: '돌파형 창병',
unitTextureKey: 'unit-zhang-fei',
portraitKey: 'zhangFei',
color: 0xd46a4c
},
'rebel-leader': {
unitId: 'rebel-leader',
name: '황건 두령',
roleLabel: '격파 목표',
unitTextureKey: 'unit-rebel-leader',
portraitKey: 'rebelLeader',
color: 0xd6b852
}
};
export function storyCutsceneActorProfileFor(unitId: string) {
return storyCutsceneActorProfiles[unitId];
}
export function storyCutsceneActorTextureKeys(cutscene?: StoryCutscene) {
return Array.from(
new Set(
(cutscene?.actors ?? [])
.map((actor) => storyCutsceneActorProfileFor(actor.unitId)?.unitTextureKey)
.filter((textureKey): textureKey is string => Boolean(textureKey))
)
);
}