From 7f7f48e8a6136741ceb9bec3bfd18a26ffba4984 Mon Sep 17 00:00:00 2001 From: unanmed <1319491857@qq.com> Date: Mon, 24 Apr 2023 20:27:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86=E5=BD=95?= =?UTF-8?q?=E5=83=8Fbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 4 +++- public/libs/control.js | 1 + public/libs/events.js | 1 + public/libs/items.js | 5 ++++- public/project/floors/MT16.js | 10 +++++----- public/project/floors/MT22.js | 4 ++-- public/project/floors/tower1.js | 6 ------ public/project/floors/tower7.js | 11 ++++++++--- public/project/functions.js | 2 +- public/project/plugin/replay.js | 30 ++++++++++++++++++++++++++++++ public/project/plugin/skillTree.js | 7 ++++++- public/project/plugin/towerBoss.js | 23 ++++++----------------- src/plugin/chase/chase1.ts | 2 +- src/types/plugin.d.ts | 16 +++++++--------- 14 files changed, 75 insertions(+), 47 deletions(-) diff --git a/.gitignore b/.gitignore index f8f07cb..bf5165c 100644 --- a/.gitignore +++ b/.gitignore @@ -28,4 +28,6 @@ dist-ssr dist.zip story.md -dist.rar \ No newline at end of file +dist.rar +*.h5save +*.h5route \ No newline at end of file diff --git a/public/libs/control.js b/public/libs/control.js index 728e547..acc63b3 100644 --- a/public/libs/control.js +++ b/public/libs/control.js @@ -1784,6 +1784,7 @@ control.prototype.startReplay = function (list) { core.status.replay.totalList = core.status.route.concat(list); core.status.replay.steps = 0; core.status.replay.save = []; + core.plugin.replay.ready(); core.createCanvas('replay', 0, core._PY_ - 40, core._PX_, 40, 199); core.setOpacity('replay', 0.6); this._replay_drawProgress(); diff --git a/public/libs/events.js b/public/libs/events.js index 7ee8920..a89c15c 100644 --- a/public/libs/events.js +++ b/public/libs/events.js @@ -29,6 +29,7 @@ events.prototype.startGame = function (hard, seed, route, callback) { core.plugin.loaded.value = false; if (main.mode != 'play') return; + core.plugin.skillTree.resetSkillLevel(); // 无动画的开始游戏 if (core.flags.startUsingCanvas || route != null) { diff --git a/public/libs/items.js b/public/libs/items.js index 61e8c87..acd4994 100644 --- a/public/libs/items.js +++ b/public/libs/items.js @@ -76,7 +76,8 @@ items.prototype.getItemEffectTip = function (itemId) { ////// 使用道具 ////// items.prototype.useItem = function (itemId, noRoute, callback) { - const ignore = ['I560', 'I559']; + /** @type {AllIdsOf<'items'>[]} */ + const ignore = ['I560', 'I559', 'skill1']; if ( !this.canUseItem(itemId) || (core.isReplaying() && ignore.includes(itemId)) @@ -286,6 +287,7 @@ items.prototype.loadEquip = function (equipId, callback) { if (callback) callback(); return; } + core.status.route.push(`equip:${equipId}`); this._realLoadEquip( type, @@ -302,6 +304,7 @@ items.prototype.unloadEquip = function (equipType, callback) { if (callback) callback(); return; } + core.status.route.push(`unequip:${equipId}`); this._realLoadEquip(equipType, null, unloadEquipId, callback); }; diff --git a/public/project/floors/MT16.js b/public/project/floors/MT16.js index 312da97..81605a0 100644 --- a/public/project/floors/MT16.js +++ b/public/project/floors/MT16.js @@ -46,7 +46,7 @@ main.floors.MT16= "yes": [ { "type": "setValue", - "name": "flag:finishChase", + "name": "flag:finishChase1", "value": "true" }, { @@ -87,6 +87,10 @@ main.floors.MT16= } ], "no": [ + { + "type": "function", + "function": "function(){\ncore.plugin.replay.readyClip();\n}" + }, { "type": "choices", "text": "请选择难度", @@ -133,10 +137,6 @@ main.floors.MT16= { "type": "function", "function": "function(){\ncore.status.maps.MT15.canFlyFrom = false\n}" - }, - { - "type": "function", - "function": "function(){\ncore.plugin.towerBoss.autoFixRouteBoss(true);\n}" } ] }, diff --git a/public/project/floors/MT22.js b/public/project/floors/MT22.js index c49805a..44c5739 100644 --- a/public/project/floors/MT22.js +++ b/public/project/floors/MT22.js @@ -38,9 +38,9 @@ main.floors.MT22= ], "3,9": [ "第二章的加点已开启,可以在技能树的前置技能下方选择", - "注意学习是一个非常重要的技能,需要尽快点开", "如果你玩过上个版本,直接跳到了本章,记得查看背包里面的各种道具,尤其是百科全书,同时注意左边是你来的方向,那里还有些怪物", - "从现在开始,跳跃技能不再消耗生命值,别忘了你还有跳跃技能" + "从现在开始,跳跃技能不再消耗生命值,别忘了你还有跳跃技能", + "为了确保平衡与可玩性,从现在开始,无上之盾(第一章终极技能)效果变为1/10" ], "7,9": [ "百科全书中已解锁第二章需要特别说明的怪物属性,你可以在百科全书中查看", diff --git a/public/project/floors/tower1.js b/public/project/floors/tower1.js index 801b57e..fd80ee3 100644 --- a/public/project/floors/tower1.js +++ b/public/project/floors/tower1.js @@ -141,12 +141,6 @@ main.floors.tower1= "time": 500 } ], - "13,1": [ - { - "type": "function", - "function": "function(){\nconsole.trace()\n}" - } - ], "7,14": [ { "type": "changeFloor", diff --git a/public/project/floors/tower7.js b/public/project/floors/tower7.js index 8cfd80b..40b668e 100644 --- a/public/project/floors/tower7.js +++ b/public/project/floors/tower7.js @@ -104,16 +104,21 @@ main.floors.tower7= "floorId": "MT19" }, "现在前往东边", + { + "type": "showStatusBar" + }, { "type": "exit" } ], "no": [ - "该特殊战与青岚之光音乐天国特殊战类似,但相比于青岚的特殊战,该特殊战有了不少提升:\n1.动画效果更好,运行更加流畅\n2.boss技能多样,更加好玩\n3.气氛渲染地更好,更有沉浸感\n4.流程缩短,不再枯燥", "屏幕上方有boss血条和提示等,请注意阅读", - "总之,该特殊战你一定会觉得好玩的", "注意:重新开始特殊战需要刷新页面!!!!!!!!!!!!", - "下面,就让我们开始吧!" + "下面,就让我们开始吧!", + { + "type": "function", + "function": "function(){\ncore.plugin.replay.readyClip();\n}" + } ] }, { diff --git a/public/project/functions.js b/public/project/functions.js index e228302..d1f99bf 100644 --- a/public/project/functions.js +++ b/public/project/functions.js @@ -1126,7 +1126,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = { // 根据keyCode值来执行对应操作 switch (keyCode) { case 74: // J:打开技能树 - core.useItem('skill1'); + core.useItem('skill1', true); break; case 27: // ESC:打开菜单栏 core.openSettings(true); diff --git a/public/project/plugin/replay.js b/public/project/plugin/replay.js index 67a58f4..f8d230b 100644 --- a/public/project/plugin/replay.js +++ b/public/project/plugin/replay.js @@ -4,6 +4,24 @@ import { studySkill, canStudySkill } from './study.js'; const replayableSettings = ['autoSkill']; +let cliping = false; +let startIndex = 0; + +export function ready() {} + +export function readyClip() { + cliping = true; + return (startIndex = core.status.route.length - 1); +} + +export function clip(...replace) { + if (!cliping) return; + cliping = false; + + core.status.route.splice(startIndex); + core.status.route.push(...replace); +} + // 注册修改设置的录像操作 core.registerReplayAction('settings', name => { if (!name.startsWith('set:')) return false; @@ -12,6 +30,7 @@ core.registerReplayAction('settings', name => { if (typeof v !== 'boolean') return false; if (!replayableSettings.includes(setting)) return false; flags[setting] = v; + core.status.route.push(name); core.replay(); return true; }); @@ -20,6 +39,7 @@ core.registerReplayAction('upgradeSkill', name => { if (!name.startsWith('skill:')) return false; const skill = parseInt(name.slice(6)); core.plugin.skillTree.upgradeSkill(skill); + core.status.route.push(name); core.replay(); return true; }); @@ -35,6 +55,7 @@ core.registerReplayAction('study', name => { const enemy = core.getEnemyInfo(id, void 0, x, y); if (!enemy.special.includes(num)) return false; studySkill(enemy, num); + core.status.route.push(name); core.replay(); return true; }); @@ -47,6 +68,7 @@ core.registerReplayAction('openShop', name => { if (shopOpened) return false; openedShopId = name.slice(9); shopOpened = true; + core.status.route.push(name); core.replay(); return true; }); @@ -76,6 +98,7 @@ core.registerReplayAction('buy', name => { if (cost > core.status.hero.money) return false; core.status.hero.money -= cost; flags.itemShop[openedShopId][id] += type === 'buy' ? num : -num; + core.status.route.push(name); core.replay(); return true; }); @@ -85,6 +108,13 @@ core.registerReplayAction('closeShop', name => { if (!shopOpened) return false; shopOpened = false; openedShopId = ''; + core.status.route.push(name); core.replay(); return true; }); + +core.plugin.replay = { + ready, + readyClip, + clip +}; diff --git a/public/project/plugin/skillTree.js b/public/project/plugin/skillTree.js index 6893bcf..987d705 100644 --- a/public/project/plugin/skillTree.js +++ b/public/project/plugin/skillTree.js @@ -199,6 +199,10 @@ const skills = { core.plugin.skills = skills; +export function resetSkillLevel() { + levels = []; +} + export function getSkillFromIndex(index) { for (const [, skill] of Object.entries(skills)) { const s = skill.find(v => v.index === index); @@ -311,5 +315,6 @@ core.plugin.skillTree = { saveSkillTree, loadSkillTree, upgradeSkill, - openTree + openTree, + resetSkillLevel }; diff --git a/public/project/plugin/towerBoss.js b/public/project/plugin/towerBoss.js index 353dbeb..c91f4d0 100644 --- a/public/project/plugin/towerBoss.js +++ b/public/project/plugin/towerBoss.js @@ -1,4 +1,5 @@ /// +import { clip } from './replay.js'; // 1000多行,改不动了,原来什么样就什么样吧 @@ -16,23 +17,10 @@ function initTowerBoss() { seconds = 0; heroHp = core.status.hero.hp; dynamicChangeHp(0, 10000, 10000); - autoFixRouteBoss(true); core.insertAction([{ type: 'sleep', time: 1000, noSkip: true }]); setTimeout(bossCore, 1000); } -// 录像自动修正 -export function autoFixRouteBoss(isStart) { - var route = core.status.route; - if (isStart) { - // 开始修正 记录当前录像长度 - flags.startFix = route.length - 1; - return; - } - // 结束修正 删除录像 并追加跳过步骤 - route.splice(flags.startFix); - route.push('choices:0'); - delete flags.startFix; -} + // 血条 function healthBar(now, total) { var nowLength = (now / total) * 476; // 当前血量下绘制长度 @@ -383,7 +371,7 @@ function bossCore() { clearInterval(interval); clearInterval(flags.boom); core.status.hero.hp = heroHp; - core.plugin.towerBoss.autoFixRouteBoss(false); + clip('choices:0'); delete flags.__bgm__; core.pauseBgm(); core.insertAction([ @@ -1569,6 +1557,7 @@ function lineDamage(x1, y1, x2, y2, damage) { } core.plugin.towerBoss = { - initTowerBoss, - autoFixRouteBoss + initTowerBoss }; + +export {}; diff --git a/src/plugin/chase/chase1.ts b/src/plugin/chase/chase1.ts index 8d8b1a5..d3cfddd 100644 --- a/src/plugin/chase/chase1.ts +++ b/src/plugin/chase/chase1.ts @@ -576,7 +576,7 @@ export function para3(chase: Chase) { 'MT14', async () => { flags.finishChase1 = true; - core.plugin.towerBoss.autoFixRouteBoss(); + core.plugin.replay.clip('choices:0'); core.showStatusBar(); ani.time(750).apply('rect', 0); chase.end(); diff --git a/src/types/plugin.d.ts b/src/types/plugin.d.ts index f5e5d60..7422e05 100644 --- a/src/types/plugin.d.ts +++ b/src/types/plugin.d.ts @@ -25,10 +25,10 @@ interface PluginDeclaration */ utils: GamePluginUtils; loopMap: GamePluginLoopMap; - towerBoss: GamePluginBoss; skillTree: GamePluginSkillTree; study: GamePluginStudy; hero: GamePluginHeroRealStatus; + replay: PluginReplay; skills: Record; skillEffects: SkillEffects; @@ -125,14 +125,6 @@ interface GamePluginLoopMap { checkLoopMap(): void; } -interface GamePluginBoss { - /** - * 自动修复特殊boss战的录像 - * @param isStart 是否要开始修剪录像 - */ - autoFixRouteBoss(isStart?: boolean); -} - interface PluginUtils { /** * 判定一个值是否不是undefined或null @@ -436,6 +428,12 @@ interface PluginAchievement { checkVisitedFloor(): void; } +interface PluginReplay { + ready(): void; + readyClip(): number; + clip(...replace: string[]): void; +} + interface SkillEffects { jumpIgnoreFloor: FloorIds[]; }