diff --git a/packages-user/client-modules/src/render/elements/layer.ts b/packages-user/client-modules/src/render/elements/layer.ts index d92d347..8f43ff6 100644 --- a/packages-user/client-modules/src/render/elements/layer.ts +++ b/packages-user/client-modules/src/render/elements/layer.ts @@ -1545,7 +1545,7 @@ export function createLayer() { hook.on('setBlock', (x, y, floor, block) => { const isNow = floor === core.status.floorId; - LayerGroupFloorBinder.activedBinder.forEach(v => { + LayerGroupFloorBinder.activeBinder.forEach(v => { if (floor === v.floor || (isNow && v.bindThisFloor)) { v.setBlock('event', block, x, y); } @@ -1561,7 +1561,7 @@ export function createLayer() { hook.on('changingFloor', floor => { // 潜在隐患:如果putRenderData改成异步,那么会变成两帧后才能真正刷新并渲染 // 考虑到楼层转换一般不会同时执行很多次,因此这里改为立刻更新 - LayerGroupFloorBinder.activedBinder.forEach(v => { + LayerGroupFloorBinder.activeBinder.forEach(v => { if (v.bindThisFloor) v.updateBindData(); v.emit('floorChange', floor); }); @@ -1571,7 +1571,7 @@ export function createLayer() { }); hook.on('setBgFgBlock', (name, number, x, y, floor) => { const isNow = floor === core.status.floorId; - LayerGroupFloorBinder.activedBinder.forEach(v => { + LayerGroupFloorBinder.activeBinder.forEach(v => { if (floor === v.floor || (isNow && v.bindThisFloor)) { v.setBlock(name, number, x, y); } @@ -1612,7 +1612,7 @@ export class LayerGroupFloorBinder private needUpdate: boolean = false; - static activedBinder: Set = new Set(); + static activeBinder: Set = new Set(); /** * 绑定楼层为当前楼层,并跟随变化 @@ -1698,7 +1698,7 @@ export class LayerGroupFloorBinder for (const layer of group.layers.values()) { this.checkLayerExtends(layer); } - LayerGroupFloorBinder.activedBinder.add(this); + LayerGroupFloorBinder.activeBinder.add(this); } onLayerAdd(_group: LayerGroup, layer: Layer): void { @@ -1706,7 +1706,7 @@ export class LayerGroupFloorBinder } onDestroy(group: LayerGroup) { - LayerGroupFloorBinder.activedBinder.delete(this); + LayerGroupFloorBinder.activeBinder.delete(this); group.layers.forEach(v => { v.removeExtends('floor-binder'); }); diff --git a/packages-user/client-modules/src/render/index.tsx b/packages-user/client-modules/src/render/index.tsx index 6e0dafb..cc65342 100644 --- a/packages-user/client-modules/src/render/index.tsx +++ b/packages-user/client-modules/src/render/index.tsx @@ -48,6 +48,8 @@ export function createRender() { export * from './components'; export * from './elements'; +export * from './fx'; +export * from './legacy'; export * from './ui'; export * from './utils'; export * from './renderer'; diff --git a/packages-user/client-modules/src/render/legacy/index.ts b/packages-user/client-modules/src/render/legacy/index.ts index 1fec97a..768c449 100644 --- a/packages-user/client-modules/src/render/legacy/index.ts +++ b/packages-user/client-modules/src/render/legacy/index.ts @@ -5,3 +5,5 @@ export function createLegacy() { createGameCanvas(); createShadow(); } + +export * from './shadow'; diff --git a/packages-user/data-state/src/mechanism/skillTree.ts b/packages-user/data-state/src/mechanism/skillTree.ts index 39d7970..4125ea2 100644 --- a/packages-user/data-state/src/mechanism/skillTree.ts +++ b/packages-user/data-state/src/mechanism/skillTree.ts @@ -242,8 +242,9 @@ export function canUpgrade(skill: number) { if (consume > core.status.hero.mdef) return false; const level = getSkillLevel(skill); const s = getSkillFromIndex(skill); - if (level === s?.max) return false; - const front = s?.front ?? []; + if (!s) return false; + if (level >= s.max) return false; + const front = s.front; for (const [skill, level] of front) { if (getSkillLevel(skill) < level) return false; } diff --git a/packages-user/legacy-plugin-client/src/dev/hotReload.ts b/packages-user/legacy-plugin-client/src/dev/hotReload.ts index e4016ea..a0b980f 100644 --- a/packages-user/legacy-plugin-client/src/dev/hotReload.ts +++ b/packages-user/legacy-plugin-client/src/dev/hotReload.ts @@ -56,9 +56,11 @@ export {}; core.status.maps[data].enemy?.calRealAttribute(); core.updateStatusBar(true, true); } - Mota.require('@motajs/legacy-ui').Shadow.update(true); - const Binder = Mota.require('@motajs/render').LayerGroupFloorBinder; - Binder.activedBinder.forEach(v => { + Mota.require('@user/client-modules').Shadow.update(true); + const Binder = Mota.require( + '@user/client-modules' + ).LayerGroupFloorBinder; + Binder.activeBinder.forEach(v => { if (v.getFloor() === core.status.floorId) { v.updateBindData(); } diff --git a/packages-user/legacy-plugin-data/src/replay.ts b/packages-user/legacy-plugin-data/src/replay.ts index cbe946f..9a61d85 100644 --- a/packages-user/legacy-plugin-data/src/replay.ts +++ b/packages-user/legacy-plugin-data/src/replay.ts @@ -62,10 +62,15 @@ export function initReplay() { core.registerReplayAction('upgradeSkill', name => { if (!name.startsWith('skill:')) return false; const skill = parseInt(name.slice(6)); - upgradeSkill(skill); + const success = upgradeSkill(skill); const s = getSkillFromIndex(skill); const skillName = s?.title; core.status.route.push(name); + if (!success) { + const { tip } = Mota.require('@motajs/legacy-ui'); + tip('error', `升级技能:${skillName}失败`); + return false; + } tipAndWait(`升级技能:${skillName}`, 1000).then(() => { core.replay(); }); diff --git a/packages/legacy-ui/src/data/achievement.json b/packages/legacy-ui/src/data/achievement.json index a782b33..9e27d59 100644 --- a/packages/legacy-ui/src/data/achievement.json +++ b/packages/legacy-ui/src/data/achievement.json @@ -2,9 +2,7 @@ "normal": [ { "name": "虚惊一场", - "text": [ - "打完山洞门口的兽人后只剩一滴血" - ], + "text": ["打完山洞门口的兽人后只剩一滴血"], "point": 30 }, { @@ -18,44 +16,34 @@ "challenge": [ { "name": "逃出生天", - "text": [ - "通过山路追逐战的困难难度" - ], + "text": ["通过山路追逐战的困难难度"], "point": 20 }, { "name": "冰与火之舞", - "text": [ - "完成第二章音游特殊战的困难难度" - ], + "text": ["完成第二章音游特殊战的困难难度"], "point": 50 } ], "explore": [ { "name": "勇气巅峰", - "text": [ - "第一章完成度达到100%" - ], - "progress": "${Mota.Plugin.require('completion_r').getChapterCompletion(1)} / 100", + "text": ["第一章完成度达到100%"], + "progress": "${Mota.require('completion_r').getChapterCompletion(1)} / 100", "percent": true, "point": 50 }, { "name": "你是怎么办到的?!", - "text": [ - "与山路上的若干个神秘木牌对话" - ], + "text": ["与山路上的若干个神秘木牌对话"], "progress": "${core.getLocalStorage('mountSign', 0)} / 5", "hide": "该探索成就需要你自己探索如何达成", "point": 25 }, { "name": "智慧之心", - "text": [ - "第二章完成度达到100%" - ], - "progress": "${Mota.Plugin.require('completion_r').getChapterCompletion(2)} / 100", + "text": ["第二章完成度达到100%"], + "progress": "${Mota.require('completion_r').getChapterCompletion(2)} / 100", "percent": true, "point": 50 }, @@ -69,20 +57,16 @@ }, { "name": "学坏了", - "text": [ - "学习电摇嘲讽技能" - ], + "text": ["学习电摇嘲讽技能"], "hide": "该探索成就需要你自己探索如何达成", "point": 20 }, { "name": "满腹经纶", - "text": [ - "把第二章中所有能学习的技能都学一遍" - ], + "text": ["把第二章中所有能学习的技能都学一遍"], "hide": "该探索成就需要你自己探索如何达成", "progress": "", "point": 50 } ] -} \ No newline at end of file +} diff --git a/public/project/floors/MT12.js b/public/project/floors/MT12.js index f3468d5..231e8ec 100644 --- a/public/project/floors/MT12.js +++ b/public/project/floors/MT12.js @@ -39,7 +39,7 @@ main.floors.MT12= "手机端可以点击右下角的难度来切换下方工具栏至数字键", { "type": "function", - "function": "function(){\nconst HeroSkill = Mota.require('@user/data-state').Mechanism.HeroSkill;\nHeroSkill.learnSkill(HeroSkill.Jump);\n}" + "function": "function(){\nconst HeroSkill = Mota.require('@user/data-state').HeroSkill;\nHeroSkill.learnSkill(HeroSkill.Jump);\n}" }, { "type": "hide", diff --git a/public/project/floors/MT16.js b/public/project/floors/MT16.js index c571fc2..9c86d03 100644 --- a/public/project/floors/MT16.js +++ b/public/project/floors/MT16.js @@ -70,7 +70,7 @@ main.floors.MT16= }, { "type": "function", - "function": "function(){\ncore.status.maps.MT14.canFlyFrom = false;\nMota.Plugin.require('chase_g').chaseInit1();\n}" + "function": "function(){\ncore.status.maps.MT14.canFlyFrom = false;\nMota.require('chase_g').chaseInit1();\n}" }, { "type": "show", @@ -89,7 +89,7 @@ main.floors.MT16= "no": [ { "type": "function", - "function": "function(){\nMota.Plugin.require('replay_g').readyClip();\n}" + "function": "function(){\nMota.require('replay_g').readyClip();\n}" }, { "type": "choices", @@ -400,7 +400,7 @@ main.floors.MT16= }, { "type": "function", - "function": "function(){\nMota.Plugin.require('chase_r').start(false);\n}" + "function": "function(){\nMota.require('chase_r').start(false);\n}" }, { "type": "autoSave" diff --git a/public/project/floors/MT17.js b/public/project/floors/MT17.js index 5e805a3..921bbda 100644 --- a/public/project/floors/MT17.js +++ b/public/project/floors/MT17.js @@ -56,7 +56,7 @@ main.floors.MT17= "12,6": [ { "type": "function", - "function": "function(){\nif (core.status.hero.hp - flags.hphphp >= 150000) {\n\tMota.Plugin.require('achievement_r').completeAchievement('normal', 1);\n}\ndelete flags.hphphp;\n}" + "function": "function(){\nif (core.status.hero.hp - flags.hphphp >= 150000) {\n\tMota.require('achievement_r').completeAchievement('normal', 1);\n}\ndelete flags.hphphp;\n}" } ] }, diff --git a/public/project/floors/MT21.js b/public/project/floors/MT21.js index 887b314..6d913ad 100644 --- a/public/project/floors/MT21.js +++ b/public/project/floors/MT21.js @@ -157,7 +157,7 @@ main.floors.MT21= "\t[低级智人]\b[up,hero]或许智慧结晶会告诉我答案吧。", { "type": "function", - "function": "function(){\nif (!core.isReplaying()) Mota.require('@motajs/legacy-ui').fixedUi.open('chapter', { chapter: '第二章 智慧' });\nMota.Plugin.require('removeMap_g').removeMaps('tower1', 'tower7', true);\ndelete flags.tower1;\ndelete flags.wordsTimeOut;\ndelete flags.boom;\ndelete flags.booming;\n}" + "function": "function(){\nif (!core.isReplaying()) Mota.require('@motajs/legacy-ui').fixedUi.open('chapter', { chapter: '第二章 智慧' });\nMota.require('removeMap_g').removeMaps('tower1', 'tower7', true);\ndelete flags.tower1;\ndelete flags.wordsTimeOut;\ndelete flags.boom;\ndelete flags.booming;\n}" }, { "type": "setValue", diff --git a/public/project/floors/MT32.js b/public/project/floors/MT32.js index 8abb9ec..7c70297 100644 --- a/public/project/floors/MT32.js +++ b/public/project/floors/MT32.js @@ -16,7 +16,7 @@ main.floors.MT32= "firstArrive": [ { "type": "function", - "function": "function(){\nMota.Plugin.require('removeMap_g').removeMaps('MT17', 'MT21', true)\n}" + "function": "function(){\nMota.require('removeMap_g').removeMaps('MT17', 'MT21', true)\n}" } ], "eachArrive": [], diff --git a/public/project/floors/MT35.js b/public/project/floors/MT35.js index 7a23094..56d835e 100644 --- a/public/project/floors/MT35.js +++ b/public/project/floors/MT35.js @@ -101,7 +101,7 @@ main.floors.MT35= }, { "type": "function", - "function": "function(){\nMota.Plugin.require('removeMap_g').removeMaps('MT22', 'MT31', true);\n}" + "function": "function(){\nMota.require('removeMap_g').removeMaps('MT22', 'MT31', true);\n}" }, { "type": "changeFloor", diff --git a/public/project/floors/MT41.js b/public/project/floors/MT41.js index 31f33ab..38a7ae4 100644 --- a/public/project/floors/MT41.js +++ b/public/project/floors/MT41.js @@ -70,7 +70,7 @@ main.floors.MT41= "那我就送你回到标题界面吧!", { "type": "function", - "function": "function(){\nMota.Plugin.require('achievement_r').completeAchievement('explore', 0);\n}" + "function": "function(){\nMota.require('achievement_r').completeAchievement('explore', 0);\n}" }, { "type": "restart" diff --git a/public/project/floors/MT6.js b/public/project/floors/MT6.js index 0070106..0be7a84 100644 --- a/public/project/floors/MT6.js +++ b/public/project/floors/MT6.js @@ -124,7 +124,7 @@ main.floors.MT6= "4,12": [ { "type": "function", - "function": "function(){\nif (core.status.hero.hp === 1) {\n\tMota.Plugin.require('achievement_r').completeAchievement('normal', 0);\n}\n}" + "function": "function(){\nif (core.status.hero.hp === 1) {\n\tMota.require('achievement_r').completeAchievement('normal', 0);\n}\n}" } ] }, diff --git a/public/project/floors/tower7.js b/public/project/floors/tower7.js index 223d2c4..6fae1ef 100644 --- a/public/project/floors/tower7.js +++ b/public/project/floors/tower7.js @@ -123,7 +123,7 @@ main.floors.tower7= "下面,就让我们开始吧!", { "type": "function", - "function": "function(){\nMota.Plugin.require('replay_g').readyClip();\n}" + "function": "function(){\nMota.require('replay_g').readyClip();\n}" } ] }, @@ -168,7 +168,7 @@ main.floors.tower7= }, { "type": "function", - "function": "function(){\nMota.Plugin.require('boss_r').startTowerBoss();\n}" + "function": "function(){\nMota.require('boss_r').startTowerBoss();\n}" } ], "eachArrive": [], diff --git a/public/project/functions.js b/public/project/functions.js index ad35d99..a416c7f 100644 --- a/public/project/functions.js +++ b/public/project/functions.js @@ -218,7 +218,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = { } } // if (!flags.debug && !main.replayChecking) - // Mota.Plugin.require('completion_r').checkVisitedFloor(); + // Mota.require('completion_r').checkVisitedFloor(); Mota.require('@user/data-base').hook.emit( 'afterChangeFloor', floorId diff --git a/public/project/items.js b/public/project/items.js index 4073701..c3fb032 100644 --- a/public/project/items.js +++ b/public/project/items.js @@ -40,8 +40,8 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = "cls": "items", "name": "小绿宝石", "text": ",护盾+${core.values.greenGem}", - "itemEffect": "core.status.hero.mdef += Math.round(20 * core.status.thisMap.ratio / (core.getFlag(\"hard\") + 1) * (Mota.require('@user/data-state').getSkillLevel(12) / 20 + 1))", - "itemEffectTip": ",智慧+${Math.round(20 * core.status.thisMap.ratio / (core.getFlag(\"hard\") + 1) * (Mota.require('@user/data-state').getSkillLevel(12) / 20 + 1))}", + "itemEffect": "core.status.hero.mdef += Math.round(20 * core.status.thisMap.ratio / (core.getFlag('hard')) * (Mota.require('@user/data-state').getSkillLevel(12) / 20 + 1))", + "itemEffectTip": ",智慧+${Math.round(20 * core.status.thisMap.ratio / (core.getFlag('hard')) * (Mota.require('@user/data-state').getSkillLevel(12) / 20 + 1))}", "useItemEffect": "core.status.hero.mdef += core.values.greenGem", "canUseItemEffect": "true" }, @@ -626,8 +626,8 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = "cls": "items", "name": "中绿宝石", "text": ",护盾+${core.values.greenGem}", - "itemEffect": "core.status.hero.mdef += Math.round(40 * core.status.thisMap.ratio / (core.getFlag(\"hard\") + 1) * (Mota.require('@user/data-state').getSkillLevel(12) / 20 + 1))", - "itemEffectTip": ",智慧+${Math.round(40 * core.status.thisMap.ratio / (core.getFlag(\"hard\") + 1) * (Mota.require('@user/data-state').getSkillLevel(12) / 20 + 1))}", + "itemEffect": "core.status.hero.mdef += Math.round(40 * core.status.thisMap.ratio / (core.getFlag('hard')) * (Mota.require('@user/data-state').getSkillLevel(12) / 20 + 1))", + "itemEffectTip": ",智慧+${Math.round(40 * core.status.thisMap.ratio / (core.getFlag('hard')) * (Mota.require('@user/data-state').getSkillLevel(12) / 20 + 1))}", "useItemEffect": "core.status.hero.mdef += core.values.greenGem", "canUseItemEffect": "true" }, @@ -729,8 +729,8 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = "cls": "items", "name": "大绿宝石", "text": ",护盾+${core.values.greenGem}", - "itemEffect": "core.status.hero.mdef += Math.round(80 * core.status.thisMap.ratio / (core.getFlag(\"hard\") + 1) * (Mota.require('@user/data-state').getSkillLevel(12) / 20 + 1))", - "itemEffectTip": ",智慧+${Math.round(80 * core.status.thisMap.ratio / (core.getFlag(\"hard\") + 1) * (Mota.require('@user/data-state').getSkillLevel(12) / 20 + 1))}", + "itemEffect": "core.status.hero.mdef += Math.round(80 * core.status.thisMap.ratio / (core.getFlag('hard')) * (Mota.require('@user/data-state').getSkillLevel(12) / 20 + 1))", + "itemEffectTip": ",智慧+${Math.round(80 * core.status.thisMap.ratio / (core.getFlag('hard')) * (Mota.require('@user/data-state').getSkillLevel(12) / 20 + 1))}", "useItemEffect": "core.status.hero.mdef += core.values.greenGem", "canUseItemEffect": "true" }, @@ -896,8 +896,8 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = "cls": "items", "name": "超大绿宝石", "text": ",护盾+${core.values.greenGem}", - "itemEffect": "core.status.hero.mdef += Math.round(160 * core.status.thisMap.ratio / (core.getFlag(\"hard\") + 1) * (Mota.require('@user/data-state').getSkillLevel(12) / 20 + 1))", - "itemEffectTip": ",智慧+${Math.round(160 * core.status.thisMap.ratio / (core.getFlag(\"hard\") + 1) * (Mota.require('@user/data-state').getSkillLevel(12) / 20 + 1))}", + "itemEffect": "core.status.hero.mdef += Math.round(160 * core.status.thisMap.ratio / (core.getFlag('hard')) * (Mota.require('@user/data-state').getSkillLevel(12) / 20 + 1))", + "itemEffectTip": ",智慧+${Math.round(160 * core.status.thisMap.ratio / (core.getFlag('hard')) * (Mota.require('@user/data-state').getSkillLevel(12) / 20 + 1))}", "useItemEffect": "core.status.hero.mdef += core.values.greenGem", "canUseItemEffect": "true" }, @@ -1019,8 +1019,8 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = "cls": "items", "name": "璀璨绿宝石", "text": ",护盾+${core.values.greenGem}", - "itemEffect": "core.status.hero.mdef += Math.round(320 * core.status.thisMap.ratio / (core.getFlag(\"hard\") + 1) * (Mota.require('@user/data-state').getSkillLevel(12) / 20 + 1))", - "itemEffectTip": ",智慧+${Math.round(320 * core.status.thisMap.ratio / (core.getFlag(\"hard\") + 1) * (Mota.require('@user/data-state').getSkillLevel(12) / 20 + 1))}", + "itemEffect": "core.status.hero.mdef += Math.round(320 * core.status.thisMap.ratio / (core.getFlag('hard')) * (Mota.require('@user/data-state').getSkillLevel(12) / 20 + 1))", + "itemEffectTip": ",智慧+${Math.round(320 * core.status.thisMap.ratio / (core.getFlag('hard')) * (Mota.require('@user/data-state').getSkillLevel(12) / 20 + 1))}", "useItemEffect": "core.status.hero.mdef += core.values.greenGem", "canUseItemEffect": "true" }, @@ -1050,8 +1050,8 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = "cls": "items", "name": "传奇绿宝石", "text": ",防御+${core.values.blueGem}", - "itemEffect": "core.status.hero.mdef += Math.round(640 * core.status.thisMap.ratio / (core.getFlag(\"hard\") + 1) * (Mota.require('@user/data-state').getSkillLevel(12) / 20 + 1))", - "itemEffectTip": ",智慧+${Math.round(640 * core.status.thisMap.ratio / (core.getFlag(\"hard\") + 1) * (Mota.require('@user/data-state').getSkillLevel(12) / 20 + 1))}", + "itemEffect": "core.status.hero.mdef += Math.round(640 * core.status.thisMap.ratio / (core.getFlag('hard')) * (Mota.require('@user/data-state').getSkillLevel(12) / 20 + 1))", + "itemEffectTip": ",智慧+${Math.round(640 * core.status.thisMap.ratio / (core.getFlag('hard')) * (Mota.require('@user/data-state').getSkillLevel(12) / 20 + 1))}", "useItemEffect": "core.status.hero.def += core.values.blueGem", "canUseItemEffect": "true" }, @@ -1071,8 +1071,8 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = "cls": "items", "name": "史诗绿宝石", "text": ",护盾+${core.values.greenGem}", - "itemEffect": "core.status.hero.mdef += Math.round(1280 * core.status.thisMap.ratio / (core.getFlag(\"hard\") + 1) * (Mota.require('@user/data-state').getSkillLevel(12) / 20 + 1))", - "itemEffectTip": ",智慧+${Math.round(1280 * core.status.thisMap.ratio / (core.getFlag(\"hard\") + 1) * (Mota.require('@user/data-state').getSkillLevel(12) / 20 + 1))}", + "itemEffect": "core.status.hero.mdef += Math.round(1280 * core.status.thisMap.ratio / (core.getFlag('hard')) * (Mota.require('@user/data-state').getSkillLevel(12) / 20 + 1))", + "itemEffectTip": ",智慧+${Math.round(1280 * core.status.thisMap.ratio / (core.getFlag('hard')) * (Mota.require('@user/data-state').getSkillLevel(12) / 20 + 1))}", "useItemEffect": "core.status.hero.mdef += core.values.greenGem", "canUseItemEffect": "true" },