Skip to content

Commit

Permalink
fix: 移除core字段依赖(合并到未来对对等依赖的支持中)
Browse files Browse the repository at this point in the history
  • Loading branch information
median-dxz committed Jul 2, 2024
1 parent 6e02646 commit f5d8209
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 33 deletions.
7 changes: 2 additions & 5 deletions packages/launcher/src/builtin/battle.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { CORE_VERSION, MOD_SCOPE_BUILTIN, VERSION } from '@/constants';
import { MOD_SCOPE_BUILTIN, VERSION } from '@/constants';
import { engine } from '@sea/core';
import type { Battle, SEAModContext, SEAModExport, SEAModMetadata } from '@sea/mod-type';

export const metadata = {
id: 'builtin-battle',
scope: MOD_SCOPE_BUILTIN,
version: VERSION,
core: CORE_VERSION,
description: '内置战斗模型'
} satisfies SEAModMetadata;

Expand All @@ -15,9 +14,7 @@ export default function builtinBattle({ ct }: SEAModContext<typeof metadata>) {
{
name: '潘蒂表必先',
pets: ['潘克多斯', '蒂朵', '帝皇之御', '魔钰', '月照星魂', '时空界皇'],
beforeBattle: () => {
return engine.lowerHp(ct('潘克多斯', '蒂朵', '帝皇之御', '魔钰', '月照星魂', '时空界皇'));
},
beforeBattle: () => engine.lowerHp(ct('潘克多斯', '蒂朵', '帝皇之御', '魔钰', '月照星魂', '时空界皇')),
strategy: '潘蒂表必先'
},
{
Expand Down
3 changes: 1 addition & 2 deletions packages/launcher/src/builtin/command.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable */
import { CORE_VERSION, MOD_SCOPE_BUILTIN, VERSION } from '@/constants';
import { MOD_SCOPE_BUILTIN, VERSION } from '@/constants';
import { PetElement, SEAPetStore, delay, socket } from '@sea/core';
import type { Command, SEAModContext, SEAModExport, SEAModMetadata } from '@sea/mod-type';

Expand All @@ -9,7 +9,6 @@ export const metadata = {
id: 'builtin-command',
scope: MOD_SCOPE_BUILTIN,
version: VERSION,
core: CORE_VERSION,
description: '内置命令组'
} satisfies SEAModMetadata;

Expand Down
3 changes: 1 addition & 2 deletions packages/launcher/src/builtin/petFragment/petFragment.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CORE_VERSION, MOD_SCOPE_BUILTIN, VERSION } from '@/constants';
import { MOD_SCOPE_BUILTIN, VERSION } from '@/constants';
import {
PetFragmentLevelDifficulty as Difficulty,
LevelAction,
Expand Down Expand Up @@ -31,7 +31,6 @@ export const metadata = {
id: 'PetFragmentLevel',
scope: MOD_SCOPE_BUILTIN,
version: VERSION,
core: CORE_VERSION,
description: '精灵因子'
} satisfies SEAModMetadata;

Expand Down
3 changes: 1 addition & 2 deletions packages/launcher/src/builtin/preload.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { CORE_VERSION, MOD_SCOPE_BUILTIN, VERSION } from '@/constants';
import { MOD_SCOPE_BUILTIN, VERSION } from '@/constants';
import type { SEAModContext, SEAModExport, SEAModMetadata } from '@sea/mod-type';

export const metadata = {
id: 'builtin-preload',
scope: MOD_SCOPE_BUILTIN,
version: VERSION,
core: CORE_VERSION,
description: '预加载脚本',
preload: true
} satisfies SEAModMetadata;
Expand Down
3 changes: 1 addition & 2 deletions packages/launcher/src/builtin/realm/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CORE_VERSION, MOD_SCOPE_BUILTIN, VERSION } from '@/constants';
import { MOD_SCOPE_BUILTIN, VERSION } from '@/constants';
import { NOOP, delay, type ILevelBattle, type ILevelRunner } from '@sea/core';
import type { LevelData, LevelMeta, SEAModContext, SEAModExport, SEAModMetadata, TaskRunner } from '@sea/mod-type';
import LevelCourageTower from './LevelCourageTower';
Expand All @@ -12,7 +12,6 @@ export const metadata = {
id: 'realm',
scope: MOD_SCOPE_BUILTIN,
version: VERSION,
core: CORE_VERSION,
description: '日常关卡',
configSchema: {
'LevelElfKingsTrial.elfKing': {
Expand Down
31 changes: 13 additions & 18 deletions packages/launcher/src/builtin/strategy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CORE_VERSION, MOD_SCOPE_BUILTIN, VERSION } from '@/constants';
import { MOD_SCOPE_BUILTIN, VERSION } from '@/constants';
import { PotionId, battle, strategy as sg } from '@sea/core';
import type { SEAModContext, SEAModExport, SEAModMetadata, Strategy } from '@sea/mod-type';

Expand All @@ -8,39 +8,35 @@ export const metadata = {
id: 'builtin-strategy',
scope: MOD_SCOPE_BUILTIN,
version: VERSION,
core: CORE_VERSION,
description: '内置战斗策略模型'
} satisfies SEAModMetadata;

export default function builtinStrategy(_context: SEAModContext<typeof metadata>) {
const strategies: Array<Strategy> = [
const strategies: Strategy[] = [
{
name: '圣谱单挑',
resolveMove: (state, skills, pets) => {
return battle.executor.useSkill(match(state, skills, pets)(rotating('光荣之梦', '神灵救世光')));
},
resolveMove: (state, skills, pets) =>
battle.executor.useSkill(match(state, skills, pets)(rotating('光荣之梦', '神灵救世光'))),
resolveNoBlood: auto.noBlood()
},
{
name: '圣谱先手',
resolveMove: (state, skills, pets) => {
return battle.executor.useSkill(match(state, skills, pets)(rotating('光荣之梦', '神灵之触')));
},
resolveMove: (state, skills, pets) =>
battle.executor.useSkill(match(state, skills, pets)(rotating('光荣之梦', '神灵之触'))),
resolveNoBlood: auto.noBlood()
},
{
name: '王哈单挑',
resolveMove: (state, skills, pets) => {
return battle.executor.useSkill(
resolveMove: (state, skills, pets) =>
battle.executor.useSkill(
match(state, skills, pets)(rotating('狂龙击杀', '龙子诞生'), name('王·龙子盛威决'))
);
},
),
resolveNoBlood: auto.noBlood()
},
{
name: '蒂朵单挑',
resolveMove: (state, skills, pets) => {
return battle.executor.useSkill(
resolveMove: (state, skills, pets) =>
battle.executor.useSkill(
match(
state,
skills,
Expand All @@ -49,8 +45,7 @@ export default function builtinStrategy(_context: SEAModContext<typeof metadata>
round((r) => r === 0, name('时空牵绊')),
rotating('朵·盛夏咏叹', '灵籁之愿')
)
);
},
),
resolveNoBlood: auto.noBlood()
},
{
Expand Down Expand Up @@ -117,7 +112,7 @@ export default function builtinStrategy(_context: SEAModContext<typeof metadata>
name: 'LevelCourageTower',
async resolveMove(state, skills, pets) {
const matcher = match(state, skills, pets);
const r = battle.executor.useSkill(
const r = await battle.executor.useSkill(
matcher(
name('竭血残蝶', '时空牵绊'),
rotating('光荣之梦', '神灵救世光'),
Expand Down
1 change: 0 additions & 1 deletion packages/launcher/src/services/mod/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const ConfigItemSchema = z

export const ModMetadataSchema = z.object({
id: z.string(),
core: z.string(),
scope: z.string().optional(),
version: z.string().optional(),
description: z.string().optional(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function Header() {
<Button
onClick={() => {
teardown();
fetchList()
void fetchList()
.then(() =>
Promise.all(
deploymentHandlers.map((handler) => handler.fetch().then(() => handler.deploy()))
Expand Down

0 comments on commit f5d8209

Please sign in to comment.