修复部分录像bug

This commit is contained in:
unanmed 2023-04-24 20:27:21 +08:00
parent 5e3f143db9
commit 7f7f48e8a6
14 changed files with 75 additions and 47 deletions

4
.gitignore vendored
View File

@ -28,4 +28,6 @@ dist-ssr
dist.zip
story.md
dist.rar
dist.rar
*.h5save
*.h5route

View File

@ -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();

View File

@ -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) {

View File

@ -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);
};

View File

@ -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}"
}
]
},

View File

@ -38,9 +38,9 @@ main.floors.MT22=
],
"3,9": [
"第二章的加点已开启,可以在技能树的前置技能下方选择",
"注意学习是一个非常重要的技能,需要尽快点开",
"如果你玩过上个版本,直接跳到了本章,记得查看背包里面的各种道具,尤其是百科全书,同时注意左边是你来的方向,那里还有些怪物",
"从现在开始,跳跃技能不再消耗生命值,别忘了你还有跳跃技能"
"从现在开始,跳跃技能不再消耗生命值,别忘了你还有跳跃技能",
"为了确保平衡与可玩性从现在开始无上之盾第一章终极技能效果变为1/10"
],
"7,9": [
"百科全书中已解锁第二章需要特别说明的怪物属性,你可以在百科全书中查看",

View File

@ -141,12 +141,6 @@ main.floors.tower1=
"time": 500
}
],
"13,1": [
{
"type": "function",
"function": "function(){\nconsole.trace()\n}"
}
],
"7,14": [
{
"type": "changeFloor",

View File

@ -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}"
}
]
},
{

View File

@ -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);

View File

@ -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
};

View File

@ -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
};

View File

@ -1,4 +1,5 @@
///<reference path="../../../src/types/core.d.ts" />
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 {};

View File

@ -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();

16
src/types/plugin.d.ts vendored
View File

@ -25,10 +25,10 @@ interface PluginDeclaration
*/
utils: GamePluginUtils;
loopMap: GamePluginLoopMap;
towerBoss: GamePluginBoss;
skillTree: GamePluginSkillTree;
study: GamePluginStudy;
hero: GamePluginHeroRealStatus;
replay: PluginReplay;
skills: Record<Chapter, Skill[]>;
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[];
}