Compare commits
20 Commits
9902f22258
...
abd944b05d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
abd944b05d | ||
|
|
f2d43c159c | ||
|
|
b788473533 | ||
|
|
a21287d6c8 | ||
|
|
e28b51709d | ||
|
|
36693f695b | ||
|
|
663b2b3b16 | ||
|
|
98783c3585 | ||
|
|
cb745b6acc | ||
|
|
5359d045a3 | ||
|
|
388937f535 | ||
|
|
6e9f907d04 | ||
|
|
2294d5042d | ||
|
|
0e1b1ac8b2 | ||
|
|
ad23687274 | ||
|
|
9aa040ecf5 | ||
|
|
bf68fb013f | ||
|
|
3a5ae62fe7 | ||
|
|
f829d551c7 | ||
|
|
d47fe08609 |
@ -110,6 +110,12 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
|||||||
"_lint": true,
|
"_lint": true,
|
||||||
"_docs": "能否使用或装备",
|
"_docs": "能否使用或装备",
|
||||||
"_data": "当前能否使用或装备该道具,仅对cls不为items有效。null表示始终不可使用但可装备"
|
"_data": "当前能否使用或装备该道具,仅对cls不为items有效。null表示始终不可使用但可装备"
|
||||||
|
},
|
||||||
|
"noAutoSaveBeforeUse": {
|
||||||
|
"_leaf": true,
|
||||||
|
"_type": "checkbox",
|
||||||
|
"_docs": "使用前不自动存档",
|
||||||
|
"_data": "勾选时,即使设置中开启了使用(tools类)道具前自动存档,对此道具也无效",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -117,6 +117,18 @@ var plugins_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
|||||||
"_range": "typeof(thiseval)=='string' || thiseval==null",
|
"_range": "typeof(thiseval)=='string' || thiseval==null",
|
||||||
"_data": "自绘设置界面"
|
"_data": "自绘设置界面"
|
||||||
},
|
},
|
||||||
|
"opusAdaptation": {
|
||||||
|
"_leaf": true,
|
||||||
|
"_type": "textarea",
|
||||||
|
"_range": "typeof(thiseval)=='string' || thiseval==null",
|
||||||
|
"_data": "opus格式适配"
|
||||||
|
},
|
||||||
|
"platFly": {
|
||||||
|
"_leaf": true,
|
||||||
|
"_type": "textarea",
|
||||||
|
"_range": "typeof(thiseval)=='string' || thiseval==null",
|
||||||
|
"_data": "平面楼传地图"
|
||||||
|
},
|
||||||
}
|
}
|
||||||
if (obj[key]) return obj[key];
|
if (obj[key]) return obj[key];
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -19,6 +19,8 @@ control.prototype._init = function () {
|
|||||||
this.weathers = {};
|
this.weathers = {};
|
||||||
this.resizes = [];
|
this.resizes = [];
|
||||||
this.noAutoEvents = true;
|
this.noAutoEvents = true;
|
||||||
|
/** @type {{[canvasName:string]:Function}} */
|
||||||
|
this.dymCanvasResizeEvents = {};
|
||||||
// --- 注册系统的animationFrame
|
// --- 注册系统的animationFrame
|
||||||
this.registerAnimationFrame("totalTime", false, this._animationFrame_totalTime);
|
this.registerAnimationFrame("totalTime", false, this._animationFrame_totalTime);
|
||||||
this.registerAnimationFrame("autoSave", true, this._animationFrame_autoSave);
|
this.registerAnimationFrame("autoSave", true, this._animationFrame_autoSave);
|
||||||
@ -656,16 +658,29 @@ control.prototype.moveOneStep = function (callback) {
|
|||||||
////// 实际每一步的行走过程 //////
|
////// 实际每一步的行走过程 //////
|
||||||
control.prototype.moveAction = function (callback) {
|
control.prototype.moveAction = function (callback) {
|
||||||
if (core.status.heroMoving > 0) return;
|
if (core.status.heroMoving > 0) return;
|
||||||
var noPass = core.noPass(core.nextX(), core.nextY()), canMove = core.canMoveHero();
|
const nextX = core.nextX(), nextY = core.nextY();
|
||||||
// 下一个点如果不能走
|
const noPass = core.noPass(nextX, nextY);
|
||||||
|
const canMove = core.canMoveHero();
|
||||||
|
// 下一个点如果不可通行
|
||||||
if (noPass || !canMove) return this._moveAction_noPass(canMove, callback);
|
if (noPass || !canMove) return this._moveAction_noPass(canMove, callback);
|
||||||
if (core.getLocalStorage("autoSaveAfterItem")) { // 即将进入滑冰前触发自动存档
|
// 下一个点如果可通行
|
||||||
const nextbgNumber = core.maps.getBgNumber(core.nextX(), core.nextY(), core.status.floorId);
|
// 满足条件时触发一次自动存档
|
||||||
if (core.onSki(nextbgNumber)) {
|
if (!core.isReplaying()) {
|
||||||
|
const dir = core.getHeroLoc('direction');
|
||||||
|
let needAutoSave = false;
|
||||||
|
if (core.getLocalStorage("autoSaveBeforeUseItem") &&
|
||||||
|
core.onSki(core.maps.getBgNumber(nextX, nextY))) {
|
||||||
|
needAutoSave = true;
|
||||||
|
}
|
||||||
|
else if (core.getLocalStorage('autoSaveBeforePickItem') &&
|
||||||
|
core.getBlockCls(nextX, nextY) === 'items') {
|
||||||
|
needAutoSave = true;
|
||||||
|
}
|
||||||
|
if (needAutoSave) {
|
||||||
|
core.status.route.push(`turn:${dir}`); // 保存触发转向后的方向
|
||||||
core.control.autosave();
|
core.control.autosave();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this._moveAction_moving(callback);
|
this._moveAction_moving(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -723,8 +738,12 @@ control.prototype._moveAction_popAutomaticRoute = function () {
|
|||||||
control.prototype.moveHero = function (direction, callback) {
|
control.prototype.moveHero = function (direction, callback) {
|
||||||
// 如果正在移动,直接return
|
// 如果正在移动,直接return
|
||||||
if (core.status.heroMoving != 0) return;
|
if (core.status.heroMoving != 0) return;
|
||||||
if (core.isset(direction))
|
if (core.isset(direction)) {
|
||||||
|
if (core.status.hero.loc.direction != direction) {
|
||||||
|
core.status.dirBeforeMove = core.status.hero.loc.direction; // 记录转向前的方向,如果下一步自动保存要还原到这个方向
|
||||||
|
}
|
||||||
core.setHeroLoc('direction', direction);
|
core.setHeroLoc('direction', direction);
|
||||||
|
}
|
||||||
|
|
||||||
if (callback) return this.moveAction(callback);
|
if (callback) return this.moveAction(callback);
|
||||||
this._moveHero_moving();
|
this._moveHero_moving();
|
||||||
@ -1179,20 +1198,26 @@ control.prototype.checkBlock = function () {
|
|||||||
const adjacentChase = core.checkBlock_adjacentChase();
|
const adjacentChase = core.checkBlock_adjacentChase();
|
||||||
if (adjacentChase && adjacentChase.length > 0) core.push(actions, adjacentChase);
|
if (adjacentChase && adjacentChase.length > 0) core.push(actions, adjacentChase);
|
||||||
}
|
}
|
||||||
else core.push(actions, { "type": "function", "async": true, "function": "function(){\ncore.checkBlock_adjacentChase(true);\n}" });
|
else core.push(actions, { "type": "function", "async": true, "function": "function(){core.checkBlock_adjacentChase(true);}" });
|
||||||
}
|
}
|
||||||
const chaseAction = this._checkBlock_chase(currChase);
|
const chaseAction = this._checkBlock_chase(currChase);
|
||||||
if (chaseAction.length > 0) core.push(actions, chaseAction);
|
if (chaseAction.length > 0) core.push(actions, chaseAction);
|
||||||
if (currChase && currChase.length > 0) {
|
if (currChase && currChase.length > 0) {
|
||||||
core.push(actions, { "type": "function", "async": true, "function": "function(){\ncore.checkBlock_adjacentChase(true);\n}" });
|
core.push(actions, { "type": "function", "async": true, "function": "function(){core.checkBlock_adjacentChase(true);}" });
|
||||||
}
|
}
|
||||||
if (ambushAction.length > 0 && core.getLocalStorage("autoSaveAfterItem")) {
|
if (ambushAction.length > 0 && core.getLocalStorage("autoSaveBeforeUseItem")) {
|
||||||
core.push(actions, { "type": "autoSave" }); // 捕捉触发后自动存档
|
core.push(actions, { "type": "autoSave" }); // 捕捉触发后自动存档
|
||||||
}
|
}
|
||||||
|
|
||||||
const autoClear = core.plugin.autoClear;
|
const autoClear = core.plugin.autoClear;
|
||||||
if (autoClear) { // 检查autoClear的存在性,防止接档出现bug
|
if (autoClear) { // 检查autoClear的存在性,防止接档出现bug
|
||||||
if (actions.length > 0) core.insertAction(actions, x, y, autoClear);
|
if (actions.length > 0) {
|
||||||
|
actions.push({
|
||||||
|
"type": "function", "async": true,
|
||||||
|
"function": "function(){core.plugin.autoClear();core.doAction();}"
|
||||||
|
}); // 注意要放在事件队列最后。经测试放在insertAction回调当中仍有小概率先于阻击结算触发,原因不明
|
||||||
|
core.insertAction(actions, x, y);
|
||||||
|
}
|
||||||
else autoClear(); // 阻击结算后执行自动清怪
|
else autoClear(); // 阻击结算后执行自动清怪
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1236,7 +1261,7 @@ control.prototype._checkBlock_repulse = function (repulse) {
|
|||||||
if (!repulse || repulse.length == 0) return [];
|
if (!repulse || repulse.length == 0) return [];
|
||||||
var actions = [];
|
var actions = [];
|
||||||
repulse.forEach(function (t) {
|
repulse.forEach(function (t) {
|
||||||
actions.push({ "type": "move", "loc": [t[0], t[1]], "steps": [t[3]], "time": 100, "keep": true, "async": true });
|
actions.push({ "type": "move", "loc": [t[0], t[1]], "steps": [t[3]], "time": 80, "keep": true, "async": true });
|
||||||
});
|
});
|
||||||
if (actions.length > 0) actions.push({ "type": "waitAsync" });
|
if (actions.length > 0) actions.push({ "type": "waitAsync" });
|
||||||
return actions;
|
return actions;
|
||||||
@ -1287,7 +1312,7 @@ control.prototype._checkBlock_chase = function (chase) {
|
|||||||
actions.push({
|
actions.push({
|
||||||
"type": "if", "condition": "!core.getBlock(" + aimx + "," + aimy + ")",
|
"type": "if", "condition": "!core.getBlock(" + aimx + "," + aimy + ")",
|
||||||
"true": [
|
"true": [
|
||||||
{ "type": "move", "loc": [x, y], "time": 100, "keep": true, "async": true, "steps": [dir + ":1"] },
|
{ "type": "move", "loc": [x, y], "time": 80, "keep": true, "async": true, "steps": [dir + ":1"] },
|
||||||
],
|
],
|
||||||
"false": [
|
"false": [
|
||||||
{ "type": "setValue", "name": "flag:chaseAimCls", "value": `core.getBlockCls(${aimx},${aimy})` },
|
{ "type": "setValue", "name": "flag:chaseAimCls", "value": `core.getBlockCls(${aimx},${aimy})` },
|
||||||
@ -1303,8 +1328,8 @@ control.prototype._checkBlock_chase = function (chase) {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
"false": [
|
"false": [
|
||||||
{ "type": "move", "loc": [x, y], "time": 100, "keep": true, "async": true, "steps": [dir + ":1"] },
|
{ "type": "move", "loc": [x, y], "time": 80, "keep": true, "async": true, "steps": [dir + ":1"] },
|
||||||
{ "type": "move", "loc": [aimx, aimy], "time": 100, "keep": true, "async": true, "steps": [reverseDir[dir] + ":1"] },
|
{ "type": "move", "loc": [aimx, aimy], "time": 80, "keep": true, "async": true, "steps": [reverseDir[dir] + ":1"] },
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{ "type": "waitAsync", "excludeAnimates": true },
|
{ "type": "waitAsync", "excludeAnimates": true },
|
||||||
@ -1369,6 +1394,10 @@ control.prototype.getEnemyValueString = function(name, blockId, x, y, floorId) {
|
|||||||
const value = core.enemys.getEnemyValue(blockId, name, x, y, floorId);
|
const value = core.enemys.getEnemyValue(blockId, name, x, y, floorId);
|
||||||
const valueString = core.utils.formatBigNumber(value, 5);
|
const valueString = core.utils.formatBigNumber(value, 5);
|
||||||
return { text: valueString, color: colorMap[name] };
|
return { text: valueString, color: colorMap[name] };
|
||||||
|
case "notBomb":
|
||||||
|
const notBomb = core.enemys.getEnemyValue(blockId, name, x, y, floorId);
|
||||||
|
const notBombStr = notBomb ? "b" : "";
|
||||||
|
return { text: notBombStr, color: colorMap[name] || "white" };
|
||||||
case "criticalDamage":
|
case "criticalDamage":
|
||||||
let criticalDamage = 0;
|
let criticalDamage = 0;
|
||||||
const criticals = core.enemys.nextCriticals(blockId, 1, x, y, floorId);
|
const criticals = core.enemys.nextCriticals(blockId, 1, x, y, floorId);
|
||||||
@ -1426,9 +1455,9 @@ control.prototype._updateDamage_damage = function (floorId, onMap) {
|
|||||||
core.control.pushDamageData(data.leftdown[1], 32 * x + 1, 32 * (y + 1) - 1, blockId, x, y, floorId);
|
core.control.pushDamageData(data.leftdown[1], 32 * x + 1, 32 * (y + 1) - 1, blockId, x, y, floorId);
|
||||||
core.control.pushDamageData(data.leftdown[2], 32 * x + 1, 32 * (y + 1) - 11, blockId, x, y, floorId);
|
core.control.pushDamageData(data.leftdown[2], 32 * x + 1, 32 * (y + 1) - 11, blockId, x, y, floorId);
|
||||||
core.control.pushDamageData(data.leftdown[3], 32 * x + 1, 32 * (y + 1) - 21, blockId, x, y, floorId);
|
core.control.pushDamageData(data.leftdown[3], 32 * x + 1, 32 * (y + 1) - 21, blockId, x, y, floorId);
|
||||||
core.control.pushDamageData(data.rightup[1], 32 * x + 16, 32 * (y + 1) - 21, blockId, x, y, floorId);
|
core.control.pushDamageData(data.rightup[1], 32 * x + 22, 32 * (y + 1) - 21, blockId, x, y, floorId);
|
||||||
core.control.pushDamageData(data.rightup[2], 32 * x + 16, 32 * (y + 1) - 11, blockId, x, y, floorId);
|
core.control.pushDamageData(data.rightup[2], 32 * x + 22, 32 * (y + 1) - 11, blockId, x, y, floorId);
|
||||||
core.control.pushDamageData(data.rightup[3], 32 * x + 16, 32 * (y + 1) - 1, blockId, x, y, floorId);
|
core.control.pushDamageData(data.rightup[3], 32 * x + 22, 32 * (y + 1) - 1, blockId, x, y, floorId);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -3615,6 +3644,14 @@ control.prototype._resize_gameGroup = function (obj) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
control.prototype.registerDymCanvasResizeEvent = function (name, event){
|
||||||
|
this.dymCanvasResizeEvents[name] = event;
|
||||||
|
}
|
||||||
|
|
||||||
|
control.prototype.unregisterDymCanvasResizeEvent = function (name){
|
||||||
|
delete this.dymCanvasResizeEvents[name];
|
||||||
|
}
|
||||||
|
|
||||||
control.prototype._resize_canvas = function (obj) {
|
control.prototype._resize_canvas = function (obj) {
|
||||||
var innerSize = (obj.CANVAS_WIDTH * core.domStyle.scale) + "px";
|
var innerSize = (obj.CANVAS_WIDTH * core.domStyle.scale) + "px";
|
||||||
if (!core.isPlaying()) {
|
if (!core.isPlaying()) {
|
||||||
@ -3658,6 +3695,10 @@ control.prototype._resize_canvas = function (obj) {
|
|||||||
canvas.style.left = parseFloat(canvas.getAttribute("_left")) * core.domStyle.scale + "px";
|
canvas.style.left = parseFloat(canvas.getAttribute("_left")) * core.domStyle.scale + "px";
|
||||||
canvas.style.top = parseFloat(canvas.getAttribute("_top")) * core.domStyle.scale + "px";
|
canvas.style.top = parseFloat(canvas.getAttribute("_top")) * core.domStyle.scale + "px";
|
||||||
}
|
}
|
||||||
|
if (this.dymCanvasResizeEvents[name]) {
|
||||||
|
const event = this.dymCanvasResizeEvents[name];
|
||||||
|
event();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// resize next
|
// resize next
|
||||||
main.dom.next.style.width = main.dom.next.style.height = 5 * core.domStyle.scale + "px";
|
main.dom.next.style.width = main.dom.next.style.height = 5 * core.domStyle.scale + "px";
|
||||||
|
|||||||
@ -2810,7 +2810,10 @@ events.prototype.useFly = function (fromUserAction) {
|
|||||||
if (!this._checkStatus('fly', fromUserAction, true)) return;
|
if (!this._checkStatus('fly', fromUserAction, true)) return;
|
||||||
if (!core.maps.canUseFlyHere()) {
|
if (!core.maps.canUseFlyHere()) {
|
||||||
core.playSound('操作失败');
|
core.playSound('操作失败');
|
||||||
core.drawTip("只有在楼梯边才能使用" + core.material.items['fly'].name, 'fly');
|
const failTip = core.flags.flyNearStair ? "只能在楼梯边使用" : (
|
||||||
|
core.flags.flyAccessStair ? "只能在能直接走到楼梯边的地方使用" : "当前无法使用"
|
||||||
|
);
|
||||||
|
core.drawTip(failTip + core.material.items['fly'].name, 'fly');
|
||||||
core.unlockControl();
|
core.unlockControl();
|
||||||
core.status.event.data = null;
|
core.status.event.data = null;
|
||||||
core.status.event.id = null;
|
core.status.event.id = null;
|
||||||
|
|||||||
@ -128,6 +128,14 @@ items.prototype.useItem = function (itemId, noRoute, callback) {
|
|||||||
if (callback) callback();
|
if (callback) callback();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const itemData = core.material.items[itemId];
|
||||||
|
// 使用道具前自动存档
|
||||||
|
if (core.getLocalStorage("autoSaveBeforeUseItem") &&
|
||||||
|
itemData.cls === 'tools' && !itemData.noAutoSaveBeforeUse) {
|
||||||
|
if (noRoute) core.autosave(true);
|
||||||
|
else core.autosave(false);
|
||||||
|
}
|
||||||
// 执行道具效果
|
// 执行道具效果
|
||||||
this._useItemEffect(itemId);
|
this._useItemEffect(itemId);
|
||||||
// 执行完毕
|
// 执行完毕
|
||||||
|
|||||||
63
libs/maps.js
63
libs/maps.js
@ -900,7 +900,8 @@ maps.prototype._canMoveDirectly_checkNextPoint = function (blocksObj, x, y, floo
|
|||||||
if (!ignore) return false;
|
if (!ignore) return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const checkBlockInfo = core.control.getCheckBlock(floorId);
|
const checkBlockInfo = core.control.getCheckBlock ? core.control.getCheckBlock(floorId) :
|
||||||
|
core.status.checkBlock;
|
||||||
// 是否存在阻激夹域伤害
|
// 是否存在阻激夹域伤害
|
||||||
if (checkBlockInfo) {
|
if (checkBlockInfo) {
|
||||||
if (checkBlockInfo.damage[index]) return false;
|
if (checkBlockInfo.damage[index]) return false;
|
||||||
@ -2706,25 +2707,30 @@ maps.prototype._getAndRemoveBlock = function (x, y) {
|
|||||||
maps.prototype.moveBlock = function (x, y, steps, time, keep, callback, noMoveEInfo) {
|
maps.prototype.moveBlock = function (x, y, steps, time, keep, callback, noMoveEInfo) {
|
||||||
if (core.status.replay.speed == 24) time = 1;
|
if (core.status.replay.speed == 24) time = 1;
|
||||||
time = time || 500;
|
time = time || 500;
|
||||||
var blockArr = this._getAndRemoveBlock(x, y);
|
const blockArr = this._getAndRemoveBlock(x, y);
|
||||||
if (blockArr == null) {
|
if (blockArr == null) {
|
||||||
if (callback) callback();
|
if (callback) callback();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var block = blockArr[0], blockInfo = blockArr[1];
|
const block = blockArr[0], blockInfo = blockArr[1];
|
||||||
var moveSteps = (steps || []).map(function (t) {
|
const moveSteps = (steps || []).map(function (t) {
|
||||||
return [t.split(':')[0], parseInt(t.split(':')[1] || "1")];
|
return [t.split(':')[0], parseInt(t.split(':')[1] || "1")];
|
||||||
}).filter(function (t) {
|
}).filter(function (t) {
|
||||||
return ['up', 'down', 'left', 'right', 'forward', 'backward', 'leftup', 'leftdown', 'rightup', 'rightdown', 'speed'].indexOf(t[0]) >= 0
|
return ['up', 'down', 'left', 'right', 'forward', 'backward', 'leftup', 'leftdown', 'rightup', 'rightdown', 'speed'].indexOf(t[0]) >= 0
|
||||||
&& !(t[0] == 'speed' && t[1] < 16)
|
&& !(t[0] == 'speed' && t[1] < 16)
|
||||||
});
|
});
|
||||||
var canvases = this._initDetachedBlock(blockInfo, x, y, block.event.animate !== false);
|
const canvases = this._initDetachedBlock(blockInfo, x, y, block.event.animate !== false);
|
||||||
this._moveDetachedBlock(blockInfo, 32 * x, 32 * y, 1, canvases);
|
this._moveDetachedBlock(blockInfo, 32 * x, 32 * y, 1, canvases);
|
||||||
|
|
||||||
var moveInfo = {
|
const per_time = time / 16 / core.status.replay.speed;
|
||||||
|
let oneStepLength = 2;
|
||||||
|
if (time / core.status.replay.speed < 50) oneStepLength = 8; // 当time较小时增大步长
|
||||||
|
else if (time / core.status.replay.speed < 100) oneStepLength = 4;
|
||||||
|
|
||||||
|
const moveInfo = {
|
||||||
sx: x, sy: y, x: x, y: y, px: 32 * x, py: 32 * y, opacity: 1, keep: keep, lastDirection: null, offset: 1,
|
sx: x, sy: y, x: x, y: y, px: 32 * x, py: 32 * y, opacity: 1, keep: keep, lastDirection: null, offset: 1,
|
||||||
moveSteps: moveSteps, step: 0, per_time: time / 16 / core.status.replay.speed
|
moveSteps: moveSteps, step: 0, per_time, oneStepLength,
|
||||||
}
|
};
|
||||||
this._moveBlock_doMove(blockInfo, canvases, moveInfo, callback, noMoveEInfo);
|
this._moveBlock_doMove(blockInfo, canvases, moveInfo, callback, noMoveEInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2770,23 +2776,6 @@ maps.prototype._moveBlock_doMove = function (blockInfo, canvases, moveInfo, call
|
|||||||
_run();
|
_run();
|
||||||
}
|
}
|
||||||
|
|
||||||
maps.prototype.exchangeBlock = function (x1, y1, x2, y2, dir, time, callback) {
|
|
||||||
const floorId = core.status.floorId;
|
|
||||||
|
|
||||||
let callbackCount = 0;
|
|
||||||
function myCallback() {
|
|
||||||
callbackCount++;
|
|
||||||
if (callbackCount === 2) {
|
|
||||||
core.exchangeEnemyOnPoint(x1, y1, x2, y2, floorId);
|
|
||||||
if (callback) callback();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const reverseDir = { 'up': 'down', 'down': 'up', 'left': 'right', 'right': 'left' };
|
|
||||||
this.moveBlock(x1, y1, [dir], time, true, myCallback, true);
|
|
||||||
this.moveBlock(x2, y2, [reverseDir[dir]], time, true, myCallback, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
maps.prototype._moveBlock_updateSpeed = function (moveInfo) {
|
maps.prototype._moveBlock_updateSpeed = function (moveInfo) {
|
||||||
if (moveInfo.step == 0 && moveInfo.moveSteps[0][0] == 'speed' && moveInfo.moveSteps[0][1] >= 16) {
|
if (moveInfo.step == 0 && moveInfo.moveSteps[0][0] == 'speed' && moveInfo.moveSteps[0][1] >= 16) {
|
||||||
moveInfo.per_time = moveInfo.moveSteps[0][1] / 16 / core.status.replay.speed;
|
moveInfo.per_time = moveInfo.moveSteps[0][1] / 16 / core.status.replay.speed;
|
||||||
@ -2856,10 +2845,10 @@ maps.prototype._moveBlock_moving = function (blockInfo, canvases, moveInfo) {
|
|||||||
}
|
}
|
||||||
var curr = moveInfo.moveSteps[0];
|
var curr = moveInfo.moveSteps[0];
|
||||||
moveInfo.step++;
|
moveInfo.step++;
|
||||||
moveInfo.px += core.utils.scan2[curr[0]].x * 2 * moveInfo.offset;
|
moveInfo.px += core.utils.scan2[curr[0]].x * moveInfo.offset * moveInfo.oneStepLength;
|
||||||
moveInfo.py += core.utils.scan2[curr[0]].y * 2 * moveInfo.offset;
|
moveInfo.py += core.utils.scan2[curr[0]].y * moveInfo.offset * moveInfo.oneStepLength;
|
||||||
this._moveDetachedBlock(blockInfo, moveInfo.px, moveInfo.py, moveInfo.opacity, canvases);
|
this._moveDetachedBlock(blockInfo, moveInfo.px, moveInfo.py, moveInfo.opacity, canvases);
|
||||||
if (moveInfo.step == Math.round(32 / (moveInfo.offset * 2))) {
|
if (moveInfo.step == Math.abs(Math.round(32 / (moveInfo.offset * moveInfo.oneStepLength)))) {
|
||||||
moveInfo.step = 0;
|
moveInfo.step = 0;
|
||||||
moveInfo.moveSteps[0][1]--;
|
moveInfo.moveSteps[0][1]--;
|
||||||
if (moveInfo.moveSteps[0][1] <= 0) {
|
if (moveInfo.moveSteps[0][1] <= 0) {
|
||||||
@ -2868,6 +2857,24 @@ maps.prototype._moveBlock_moving = function (blockInfo, canvases, moveInfo) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
maps.prototype.exchangeBlock = function (x1, y1, x2, y2, dir, time, callback) {
|
||||||
|
const floorId = core.status.floorId;
|
||||||
|
|
||||||
|
let callbackCount = 0;
|
||||||
|
function myCallback() {
|
||||||
|
callbackCount++;
|
||||||
|
if (callbackCount === 2) {
|
||||||
|
core.exchangeEnemyOnPoint(x1, y1, x2, y2, floorId);
|
||||||
|
if (callback) callback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const reverseDir = { 'up': 'down', 'down': 'up', 'left': 'right', 'right': 'left' };
|
||||||
|
this.moveBlock(x1, y1, [dir], time, true, myCallback, true);
|
||||||
|
this.moveBlock(x2, y2, [reverseDir[dir]], time, true, myCallback, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
////// 显示跳跃某块的动画,达到{"type":"jump"}的效果 //////
|
////// 显示跳跃某块的动画,达到{"type":"jump"}的效果 //////
|
||||||
maps.prototype.jumpBlock = function (sx, sy, ex, ey, time, keep, callback) {
|
maps.prototype.jumpBlock = function (sx, sy, ex, ey, time, keep, callback) {
|
||||||
time = time || 500;
|
time = time || 500;
|
||||||
|
|||||||
@ -10,6 +10,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
|||||||
"bg.jpg",
|
"bg.jpg",
|
||||||
"dragon.png",
|
"dragon.png",
|
||||||
"hero.png",
|
"hero.png",
|
||||||
|
"mousewheel.png",
|
||||||
"winskin.png"
|
"winskin.png"
|
||||||
],
|
],
|
||||||
"tilesets": [
|
"tilesets": [
|
||||||
|
|||||||
BIN
project/images/mousewheel.png
Normal file
BIN
project/images/mousewheel.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 391 B |
@ -345,11 +345,17 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
|||||||
"superPotion": {
|
"superPotion": {
|
||||||
"cls": "items",
|
"cls": "items",
|
||||||
"name": "圣水",
|
"name": "圣水",
|
||||||
"itemEffect": "core.status.hero.hp *= 2",
|
"itemEffect": null,
|
||||||
"itemEffectTip": ",生命值翻倍",
|
"itemEffectTip": ",生命值翻倍",
|
||||||
"useItemEffect": "core.status.hero.hp *= 2;core.playSound('回血');",
|
"useItemEffect": "core.status.hero.hp *= 2;core.playSound('回血');",
|
||||||
"canUseItemEffect": "true",
|
"canUseItemEffect": "true",
|
||||||
"text": "生命值翻倍"
|
"text": "生命值翻倍",
|
||||||
|
"itemEffectEvent": {
|
||||||
|
"sound": "recovery.mp3",
|
||||||
|
"value": {
|
||||||
|
"hp": "core.status.hero.hp"
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"book": {
|
"book": {
|
||||||
"cls": "constants",
|
"cls": "constants",
|
||||||
@ -418,8 +424,9 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
|||||||
"cls": "tools",
|
"cls": "tools",
|
||||||
"name": "破墙镐",
|
"name": "破墙镐",
|
||||||
"text": "可以破坏勇士面前的墙",
|
"text": "可以破坏勇士面前的墙",
|
||||||
"useItemEffect": "(function () {\n\tvar canBreak = function (x, y) {\n\t\tvar block = core.getBlock(x, y);\n\t\tif (block == null || block.disable) return false;\n\t\treturn block.event.canBreak;\n\t};\n\n\tvar success = false;\n\tvar pickaxeFourDirections = false; // 是否多方向破;如果是将其改成true\n\tif (pickaxeFourDirections) {\n\t\tlet hasAutoSaved = false;\n\t\t// 多方向破\n\t\tfor (var direction in core.utils.scan) { // 多方向破默认四方向,如需改成八方向请将这两个scan改为scan2\n\t\t\tvar delta = core.utils.scan[direction];\n\t\t\tvar nx = core.getHeroLoc('x') + delta.x,\n\t\t\t\tny = core.getHeroLoc('y') + delta.y;\n\t\t\tif (canBreak(nx, ny)) {\n\t\t\t\tif (core.getLocalStorage(\"autoSaveAfterItem\")) {\n\t\t\t\t\tif (!hasAutoSaved) core.control.autosave();\n\t\t\t\t\thasAutoSaved = true;\n\t\t\t\t}\n\t\t\t\tcore.removeBlock(nx, ny);\n\t\t\t\tsuccess = true;\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// 仅破当前\n\t\tif (canBreak(core.nextX(), core.nextY())) {\n\t\t\tif (core.getLocalStorage(\"autoSaveAfterItem\")) {\n\t\t\t\tcore.control.autosave();\n\t\t\t}\n\t\t\tcore.removeBlock(core.nextX(), core.nextY());\n\t\t\tsuccess = true;\n\t\t}\n\t}\n\n\tif (success) {\n\t\tcore.playSound('破墙镐');\n\t\tcore.drawTip(core.material.items[itemId].name + '使用成功', itemId);\n\t} else {\n\t\t// 无法使用\n\t\tcore.playSound('操作失败');\n\t\tcore.drawTip(\"当前无法使用\" + core.material.items[itemId].name, itemId);\n\t\tcore.addItem(itemId, 1);\n\t\treturn;\n\t}\n})();",
|
"useItemEffect": "(function () {\n\tvar canBreak = function (x, y) {\n\t\tvar block = core.getBlock(x, y);\n\t\tif (block == null || block.disable) return false;\n\t\treturn block.event.canBreak;\n\t};\n\n\tvar success = false;\n\tvar pickaxeFourDirections = false; // 是否多方向破;如果是将其改成true\n\tif (pickaxeFourDirections) {\n\t\tlet hasAutoSaved = false;\n\t\t// 多方向破\n\t\tfor (var direction in core.utils.scan) { // 多方向破默认四方向,如需改成八方向请将这两个scan改为scan2\n\t\t\tvar delta = core.utils.scan[direction];\n\t\t\tvar nx = core.getHeroLoc('x') + delta.x,\n\t\t\t\tny = core.getHeroLoc('y') + delta.y;\n\t\t\tif (canBreak(nx, ny)) {\n\t\t\t\tif (core.getLocalStorage(\"autoSaveBeforeUseItem\")) {\n\t\t\t\t\tif (!hasAutoSaved) core.control.autosave();\n\t\t\t\t\thasAutoSaved = true;\n\t\t\t\t}\n\t\t\t\tcore.removeBlock(nx, ny);\n\t\t\t\tsuccess = true;\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// 仅破当前\n\t\tif (canBreak(core.nextX(), core.nextY())) {\n\t\t\tif (core.getLocalStorage(\"autoSaveBeforeUseItem\")) {\n\t\t\t\tcore.control.autosave();\n\t\t\t}\n\t\t\tcore.removeBlock(core.nextX(), core.nextY());\n\t\t\tsuccess = true;\n\t\t}\n\t}\n\n\tif (success) {\n\t\tcore.playSound('破墙镐');\n\t\tcore.drawTip(core.material.items[itemId].name + '使用成功', itemId);\n\t} else {\n\t\t// 无法使用\n\t\tcore.playSound('操作失败');\n\t\tcore.drawTip(\"当前无法使用\" + core.material.items[itemId].name, itemId);\n\t\tcore.addItem(itemId, 1);\n\t\treturn;\n\t}\n})();",
|
||||||
"canUseItemEffect": "true"
|
"canUseItemEffect": "true",
|
||||||
|
"noAutoSaveBeforeUse": true
|
||||||
},
|
},
|
||||||
"icePickaxe": {
|
"icePickaxe": {
|
||||||
"cls": "tools",
|
"cls": "tools",
|
||||||
@ -432,14 +439,15 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
|||||||
"cls": "tools",
|
"cls": "tools",
|
||||||
"name": "炸弹",
|
"name": "炸弹",
|
||||||
"text": "可以炸掉勇士面前的怪物",
|
"text": "可以炸掉勇士面前的怪物",
|
||||||
"useItemEffect": "(function () {\n\tconst bombList = []; // 炸掉的怪物坐标列表\n\tconst todo = []; // 炸弹后事件\n\tlet money = 0,\n\t\texp = 0; // 炸弹获得的金币和经验\n\n\tconst canBomb = function (x, y) {\n\t\tvar block = core.getBlock(x, y);\n\t\tif (block == null || block.disable || block.event.cls.indexOf('enemy') != 0) return false;\n\t\tvar enemy = core.getEnemyValue(block.event.id, null, x, y);\n\t\treturn { enemy, notBomb: enemy.notBomb };\n\t};\n\n\tlet hasAutoSaved = false;\n\n\tconst bomb = function (x, y) {\n\t\tconst { enemy, notBomb } = canBomb(x, y);\n\t\tif (!enemy) {\n\t\t\tcore.drawFailTip('该点不是敌人!');\n\t\t\treturn;\n\t\t}\n\t\tif (notBomb) {\n\t\t\tcore.drawFailTip('该点敌人不可炸!');\n\t\t\treturn;\n\t\t}\n\t\tif (core.getLocalStorage(\"autoSaveAfterItem\")) {\n\t\t\tif (!hasAutoSaved) core.control.autosave();\n\t\t\thasAutoSaved = true;\n\t\t}\n\t\tbombList.push([x, y]);\n\t\tmoney += enemy.money || 0;\n\t\texp += enemy.exp || 0;\n\t\tcore.push(todo, core.floors[core.status.floorId].afterBattle[x + \",\" + y]);\n\t\tcore.push(todo, enemy.afterBattle);\n\t\tcore.removeBlock(x, y);\n\t}\n\n\t// 如果要多方向可炸,把这里的false改成true\n\tif (false) {\n\t\tvar scan = core.utils.scan; // 多方向炸时默认四方向,如果要改成八方向炸可以改成 core.utils.scan2\n\t\tfor (var direction in scan) {\n\t\t\tvar delta = scan[direction];\n\t\t\tbomb(core.getHeroLoc('x') + delta.x, core.getHeroLoc('y') + delta.y);\n\t\t}\n\t} else {\n\t\t// 仅炸当前\n\t\tbomb(core.nextX(), core.nextY());\n\t}\n\n\tif (bombList.length == 0) {\n\t\tcore.playSound('操作失败');\n\t\tcore.drawTip('当前无法使用' + core.material.items[itemId].name, itemId);\n\t\tcore.addItem(itemId, 1);\n\t\treturn;\n\t}\n\n\tcore.playSound('炸弹');\n\tcore.drawTip(core.material.items[itemId].name + '使用成功', itemId);\n\n\t// 取消这里的注释可以炸弹后获得金币和经验\n\t// core.status.hero.money += money;\n\t// core.status.hero.exp += exp;\n\n\t// 取消这里的注释可以炸弹引发战后事件\n\t// if (todo.length > 0) core.insertAction(todo);\n\n})();",
|
"useItemEffect": "(function () {\n\tconst bombList = []; // 炸掉的怪物坐标列表\n\tconst todo = []; // 炸弹后事件\n\tlet money = 0,\n\t\texp = 0; // 炸弹获得的金币和经验\n\n\tconst canBomb = function (x, y) {\n\t\tvar block = core.getBlock(x, y);\n\t\tif (block == null || block.disable || block.event.cls.indexOf('enemy') != 0) return false;\n\t\tvar enemy = core.getEnemyValue(block.event.id, null, x, y);\n\t\treturn { enemy, notBomb: enemy.notBomb };\n\t};\n\n\tlet hasAutoSaved = false;\n\n\tconst bomb = function (x, y) {\n\t\tconst { enemy, notBomb } = canBomb(x, y);\n\t\tif (!enemy) {\n\t\t\tcore.drawFailTip('该点不是敌人!');\n\t\t\treturn;\n\t\t}\n\t\tif (notBomb) {\n\t\t\tcore.drawFailTip('该点敌人不可炸!');\n\t\t\treturn;\n\t\t}\n\t\tif (core.getLocalStorage(\"autoSaveBeforeUseItem\")) {\n\t\t\tif (!hasAutoSaved) core.control.autosave();\n\t\t\thasAutoSaved = true;\n\t\t}\n\t\tbombList.push([x, y]);\n\t\tmoney += enemy.money || 0;\n\t\texp += enemy.exp || 0;\n\t\tcore.push(todo, core.floors[core.status.floorId].afterBattle[x + \",\" + y]);\n\t\tcore.push(todo, enemy.afterBattle);\n\t\tcore.removeBlock(x, y);\n\t}\n\n\t// 如果要多方向可炸,把这里的false改成true\n\tif (false) {\n\t\tvar scan = core.utils.scan; // 多方向炸时默认四方向,如果要改成八方向炸可以改成 core.utils.scan2\n\t\tfor (var direction in scan) {\n\t\t\tvar delta = scan[direction];\n\t\t\tbomb(core.getHeroLoc('x') + delta.x, core.getHeroLoc('y') + delta.y);\n\t\t}\n\t} else {\n\t\t// 仅炸当前\n\t\tbomb(core.nextX(), core.nextY());\n\t}\n\n\tif (bombList.length == 0) {\n\t\tcore.playSound('操作失败');\n\t\tcore.drawTip('当前无法使用' + core.material.items[itemId].name, itemId);\n\t\tcore.addItem(itemId, 1);\n\t\treturn;\n\t}\n\n\tcore.playSound('炸弹');\n\tcore.drawTip(core.material.items[itemId].name + '使用成功', itemId);\n\n\t// 取消这里的注释可以炸弹后获得金币和经验\n\t// core.status.hero.money += money;\n\t// core.status.hero.exp += exp;\n\n\t// 取消这里的注释可以炸弹引发战后事件\n\t// if (todo.length > 0) core.insertAction(todo);\n\n})();",
|
||||||
"canUseItemEffect": "true"
|
"canUseItemEffect": "true",
|
||||||
|
"noAutoSaveBeforeUse": true
|
||||||
},
|
},
|
||||||
"centerFly": {
|
"centerFly": {
|
||||||
"cls": "tools",
|
"cls": "tools",
|
||||||
"name": "中心对称飞行器",
|
"name": "中心对称飞行器",
|
||||||
"text": "可以飞向当前楼层中心对称的位置",
|
"text": "可以飞向当前楼层中心对称的位置",
|
||||||
"useItemEffect": "if (core.getLocalStorage(\"autoSaveAfterItem\")) {\n\tcore.control.autosave();\n}\ncore.playSound('centerFly.mp3');\ncore.clearMap('hero');\ncore.setHeroLoc('x', core.bigmap.width - 1 - core.getHeroLoc('x'));\ncore.setHeroLoc('y', core.bigmap.height - 1 - core.getHeroLoc('y'));\ncore.drawHero();\ncore.drawTip(core.material.items[itemId].name + '使用成功');",
|
"useItemEffect": "core.playSound('centerFly.mp3');\ncore.clearMap('hero');\ncore.setHeroLoc('x', core.bigmap.width - 1 - core.getHeroLoc('x'));\ncore.setHeroLoc('y', core.bigmap.height - 1 - core.getHeroLoc('y'));\ncore.drawHero();\ncore.drawTip(core.material.items[itemId].name + '使用成功');",
|
||||||
"canUseItemEffect": "(function () {\n\tvar toX = core.bigmap.width - 1 - core.getHeroLoc('x'),\n\t\ttoY = core.bigmap.height - 1 - core.getHeroLoc('y');\n\tvar id = core.getBlockId(toX, toY);\n\treturn id == null;\n})();"
|
"canUseItemEffect": "(function () {\n\tvar toX = core.bigmap.width - 1 - core.getHeroLoc('x'),\n\t\ttoY = core.bigmap.height - 1 - core.getHeroLoc('y');\n\tvar id = core.getBlockId(toX, toY);\n\treturn id == null;\n})();"
|
||||||
},
|
},
|
||||||
"upFly": {
|
"upFly": {
|
||||||
@ -500,7 +508,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
|||||||
"cls": "tools",
|
"cls": "tools",
|
||||||
"name": "跳跃靴",
|
"name": "跳跃靴",
|
||||||
"text": "能跳跃到前方两格处",
|
"text": "能跳跃到前方两格处",
|
||||||
"useItemEffect": "if (core.getLocalStorage(\"autoSaveAfterItem\")) {\n\tcore.control.autosave();\n}\ncore.playSound(\"跳跃\");\ncore.insertAction({ \"type\": \"jumpHero\", \"loc\": [core.nextX(2), core.nextY(2)] });",
|
"useItemEffect": "core.playSound(\"跳跃\");\ncore.insertAction({ \"type\": \"jumpHero\", \"loc\": [core.nextX(2), core.nextY(2)] });",
|
||||||
"canUseItemEffect": "(function () {\n\tvar nx = core.nextX(2),\n\t\tny = core.nextY(2);\n\treturn nx >= 0 && nx < core.bigmap.width && ny >= 0 && ny < core.bigmap.height && core.getBlockId(nx, ny) == null;\n})();"
|
"canUseItemEffect": "(function () {\n\tvar nx = core.nextX(2),\n\t\tny = core.nextY(2);\n\treturn nx >= 0 && nx < core.bigmap.width && ny >= 0 && ny < core.bigmap.height && core.getBlockId(nx, ny) == null;\n})();"
|
||||||
},
|
},
|
||||||
"wand": {
|
"wand": {
|
||||||
@ -508,8 +516,66 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
|||||||
"name": "生命魔杖",
|
"name": "生命魔杖",
|
||||||
"text": "使用后回复100体力。",
|
"text": "使用后回复100体力。",
|
||||||
"canUseItemEffect": "true",
|
"canUseItemEffect": "true",
|
||||||
"useItemEffect": "core.addStatus('hp', 100);",
|
"useItemEffect": null,
|
||||||
"hideInReplay": true
|
"hideInReplay": true,
|
||||||
|
"useItemEvent": [
|
||||||
|
{
|
||||||
|
"type": "comment",
|
||||||
|
"text": "先静默增加一个魔杖(因为使用道具必须消耗一个)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "function",
|
||||||
|
"function": "function(){\ncore.addItem('wand', 1);\n}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "input",
|
||||||
|
"text": "请输入使用生命杖的次数"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "if",
|
||||||
|
"condition": "Number.isNaN(flag:input)",
|
||||||
|
"true": [
|
||||||
|
{
|
||||||
|
"type": "exit"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "if",
|
||||||
|
"condition": "(flag:input>item:wand)",
|
||||||
|
"true": [
|
||||||
|
{
|
||||||
|
"type": "setValue",
|
||||||
|
"name": "flag:input",
|
||||||
|
"value": "item:wand"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "if",
|
||||||
|
"condition": "(flag:input<0)",
|
||||||
|
"true": [
|
||||||
|
{
|
||||||
|
"type": "setValue",
|
||||||
|
"name": "flag:input",
|
||||||
|
"value": "0"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "setValue",
|
||||||
|
"name": "item:wand",
|
||||||
|
"operator": "-=",
|
||||||
|
"value": "flag:input"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "setValue",
|
||||||
|
"name": "status:hp",
|
||||||
|
"operator": "+=",
|
||||||
|
"value": "100*flag:input"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"noAutoSaveBeforeUse": true
|
||||||
},
|
},
|
||||||
"pack": {
|
"pack": {
|
||||||
"cls": "items",
|
"cls": "items",
|
||||||
|
|||||||
1740
project/plugins.js
1740
project/plugins.js
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user