You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
1.6 KiB
32 lines
1.6 KiB
import { ChapterNewPlayTypeEnum, type ChapterPlayData } from '../../game/ChapterPlayTypes';
|
|
import type { IBattleMechanism } from './IBattleMechanism';
|
|
import { WitchMechanism } from './implementations/WitchMechanism';
|
|
import { ParatroopsMechanism } from './implementations/ParatroopsMechanism';
|
|
import { BloodMoonMechanism } from './implementations/BloodMoonMechanism';
|
|
import { SpiderSpiritMechanism } from './implementations/SpiderSpiritMechanism';
|
|
import { CharmMechanism } from './implementations/CharmMechanism';
|
|
type MechanismFactory = () => IBattleMechanism;
|
|
|
|
const FACTORIES = new Map<ChapterNewPlayTypeEnum, MechanismFactory>([
|
|
[ChapterNewPlayTypeEnum.Witch, () => new WitchMechanism()],
|
|
[ChapterNewPlayTypeEnum.Paratroops, () => new ParatroopsMechanism()],
|
|
[ChapterNewPlayTypeEnum.BossAirdrop, () => new ParatroopsMechanism(ChapterNewPlayTypeEnum.BossAirdrop)],
|
|
[ChapterNewPlayTypeEnum.BloodMoon, () => new BloodMoonMechanism()],
|
|
[ChapterNewPlayTypeEnum.VinesGrass, () => new SpiderSpiritMechanism()],
|
|
[ChapterNewPlayTypeEnum.Charm, () => new CharmMechanism()],
|
|
]);
|
|
|
|
export function createMechanismsForPlayIds(playIds: number[]): IBattleMechanism[] {
|
|
const list: IBattleMechanism[] = [];
|
|
for (const rawId of playIds) {
|
|
const id = rawId as ChapterNewPlayTypeEnum;
|
|
const factory = FACTORIES.get(id);
|
|
if (!factory) continue;
|
|
list.push(factory());
|
|
}
|
|
return list;
|
|
}
|
|
|
|
export function resolveMechanismConfig(typeId: ChapterNewPlayTypeEnum): ChapterPlayData | undefined {
|
|
return gg.data.project.getChapterNewPlayInfo(typeId);
|
|
}
|
|
|