Compare commits
No commits in common. "abd944b05dbf27aceb6548273c02cc6ad12362b9" and "9902f222588ed2dea3e4be1882a41dc43b1d8e9f" have entirely different histories.
abd944b05d
...
9902f22258
@ -110,12 +110,6 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
"_lint": true,
|
||||
"_docs": "能否使用或装备",
|
||||
"_data": "当前能否使用或装备该道具,仅对cls不为items有效。null表示始终不可使用但可装备"
|
||||
},
|
||||
"noAutoSaveBeforeUse": {
|
||||
"_leaf": true,
|
||||
"_type": "checkbox",
|
||||
"_docs": "使用前不自动存档",
|
||||
"_data": "勾选时,即使设置中开启了使用(tools类)道具前自动存档,对此道具也无效",
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@ -117,18 +117,6 @@ var plugins_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
"_range": "typeof(thiseval)=='string' || thiseval==null",
|
||||
"_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];
|
||||
return {
|
||||
|
||||
@ -19,8 +19,6 @@ control.prototype._init = function () {
|
||||
this.weathers = {};
|
||||
this.resizes = [];
|
||||
this.noAutoEvents = true;
|
||||
/** @type {{[canvasName:string]:Function}} */
|
||||
this.dymCanvasResizeEvents = {};
|
||||
// --- 注册系统的animationFrame
|
||||
this.registerAnimationFrame("totalTime", false, this._animationFrame_totalTime);
|
||||
this.registerAnimationFrame("autoSave", true, this._animationFrame_autoSave);
|
||||
@ -658,29 +656,16 @@ control.prototype.moveOneStep = function (callback) {
|
||||
////// 实际每一步的行走过程 //////
|
||||
control.prototype.moveAction = function (callback) {
|
||||
if (core.status.heroMoving > 0) return;
|
||||
const nextX = core.nextX(), nextY = core.nextY();
|
||||
const noPass = core.noPass(nextX, nextY);
|
||||
const canMove = core.canMoveHero();
|
||||
// 下一个点如果不可通行
|
||||
var noPass = core.noPass(core.nextX(), core.nextY()), canMove = core.canMoveHero();
|
||||
// 下一个点如果不能走
|
||||
if (noPass || !canMove) return this._moveAction_noPass(canMove, callback);
|
||||
// 下一个点如果可通行
|
||||
// 满足条件时触发一次自动存档
|
||||
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}`); // 保存触发转向后的方向
|
||||
if (core.getLocalStorage("autoSaveAfterItem")) { // 即将进入滑冰前触发自动存档
|
||||
const nextbgNumber = core.maps.getBgNumber(core.nextX(), core.nextY(), core.status.floorId);
|
||||
if (core.onSki(nextbgNumber)) {
|
||||
core.control.autosave();
|
||||
}
|
||||
}
|
||||
|
||||
this._moveAction_moving(callback);
|
||||
}
|
||||
|
||||
@ -738,12 +723,8 @@ control.prototype._moveAction_popAutomaticRoute = function () {
|
||||
control.prototype.moveHero = function (direction, callback) {
|
||||
// 如果正在移动,直接return
|
||||
if (core.status.heroMoving != 0) return;
|
||||
if (core.isset(direction)) {
|
||||
if (core.status.hero.loc.direction != direction) {
|
||||
core.status.dirBeforeMove = core.status.hero.loc.direction; // 记录转向前的方向,如果下一步自动保存要还原到这个方向
|
||||
}
|
||||
if (core.isset(direction))
|
||||
core.setHeroLoc('direction', direction);
|
||||
}
|
||||
|
||||
if (callback) return this.moveAction(callback);
|
||||
this._moveHero_moving();
|
||||
@ -1198,26 +1179,20 @@ control.prototype.checkBlock = function () {
|
||||
const adjacentChase = core.checkBlock_adjacentChase();
|
||||
if (adjacentChase && adjacentChase.length > 0) core.push(actions, adjacentChase);
|
||||
}
|
||||
else core.push(actions, { "type": "function", "async": true, "function": "function(){core.checkBlock_adjacentChase(true);}" });
|
||||
else core.push(actions, { "type": "function", "async": true, "function": "function(){\ncore.checkBlock_adjacentChase(true);\n}" });
|
||||
}
|
||||
const chaseAction = this._checkBlock_chase(currChase);
|
||||
if (chaseAction.length > 0) core.push(actions, chaseAction);
|
||||
if (currChase && currChase.length > 0) {
|
||||
core.push(actions, { "type": "function", "async": true, "function": "function(){core.checkBlock_adjacentChase(true);}" });
|
||||
core.push(actions, { "type": "function", "async": true, "function": "function(){\ncore.checkBlock_adjacentChase(true);\n}" });
|
||||
}
|
||||
if (ambushAction.length > 0 && core.getLocalStorage("autoSaveBeforeUseItem")) {
|
||||
if (ambushAction.length > 0 && core.getLocalStorage("autoSaveAfterItem")) {
|
||||
core.push(actions, { "type": "autoSave" }); // 捕捉触发后自动存档
|
||||
}
|
||||
|
||||
const autoClear = core.plugin.autoClear;
|
||||
if (autoClear) { // 检查autoClear的存在性,防止接档出现bug
|
||||
if (actions.length > 0) {
|
||||
actions.push({
|
||||
"type": "function", "async": true,
|
||||
"function": "function(){core.plugin.autoClear();core.doAction();}"
|
||||
}); // 注意要放在事件队列最后。经测试放在insertAction回调当中仍有小概率先于阻击结算触发,原因不明
|
||||
core.insertAction(actions, x, y);
|
||||
}
|
||||
if (actions.length > 0) core.insertAction(actions, x, y, autoClear);
|
||||
else autoClear(); // 阻击结算后执行自动清怪
|
||||
}
|
||||
else {
|
||||
@ -1261,7 +1236,7 @@ control.prototype._checkBlock_repulse = function (repulse) {
|
||||
if (!repulse || repulse.length == 0) return [];
|
||||
var actions = [];
|
||||
repulse.forEach(function (t) {
|
||||
actions.push({ "type": "move", "loc": [t[0], t[1]], "steps": [t[3]], "time": 80, "keep": true, "async": true });
|
||||
actions.push({ "type": "move", "loc": [t[0], t[1]], "steps": [t[3]], "time": 100, "keep": true, "async": true });
|
||||
});
|
||||
if (actions.length > 0) actions.push({ "type": "waitAsync" });
|
||||
return actions;
|
||||
@ -1312,7 +1287,7 @@ control.prototype._checkBlock_chase = function (chase) {
|
||||
actions.push({
|
||||
"type": "if", "condition": "!core.getBlock(" + aimx + "," + aimy + ")",
|
||||
"true": [
|
||||
{ "type": "move", "loc": [x, y], "time": 80, "keep": true, "async": true, "steps": [dir + ":1"] },
|
||||
{ "type": "move", "loc": [x, y], "time": 100, "keep": true, "async": true, "steps": [dir + ":1"] },
|
||||
],
|
||||
"false": [
|
||||
{ "type": "setValue", "name": "flag:chaseAimCls", "value": `core.getBlockCls(${aimx},${aimy})` },
|
||||
@ -1328,8 +1303,8 @@ control.prototype._checkBlock_chase = function (chase) {
|
||||
},
|
||||
],
|
||||
"false": [
|
||||
{ "type": "move", "loc": [x, y], "time": 80, "keep": true, "async": true, "steps": [dir + ":1"] },
|
||||
{ "type": "move", "loc": [aimx, aimy], "time": 80, "keep": true, "async": true, "steps": [reverseDir[dir] + ":1"] },
|
||||
{ "type": "move", "loc": [x, y], "time": 100, "keep": true, "async": true, "steps": [dir + ":1"] },
|
||||
{ "type": "move", "loc": [aimx, aimy], "time": 100, "keep": true, "async": true, "steps": [reverseDir[dir] + ":1"] },
|
||||
]
|
||||
},
|
||||
{ "type": "waitAsync", "excludeAnimates": true },
|
||||
@ -1394,10 +1369,6 @@ control.prototype.getEnemyValueString = function(name, blockId, x, y, floorId) {
|
||||
const value = core.enemys.getEnemyValue(blockId, name, x, y, floorId);
|
||||
const valueString = core.utils.formatBigNumber(value, 5);
|
||||
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":
|
||||
let criticalDamage = 0;
|
||||
const criticals = core.enemys.nextCriticals(blockId, 1, x, y, floorId);
|
||||
@ -1455,9 +1426,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[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.rightup[1], 32 * x + 22, 32 * (y + 1) - 21, 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 + 22, 32 * (y + 1) - 1, 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[2], 32 * x + 16, 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);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -3644,14 +3615,6 @@ 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) {
|
||||
var innerSize = (obj.CANVAS_WIDTH * core.domStyle.scale) + "px";
|
||||
if (!core.isPlaying()) {
|
||||
@ -3695,10 +3658,6 @@ control.prototype._resize_canvas = function (obj) {
|
||||
canvas.style.left = parseFloat(canvas.getAttribute("_left")) * 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
|
||||
main.dom.next.style.width = main.dom.next.style.height = 5 * core.domStyle.scale + "px";
|
||||
|
||||
@ -2810,10 +2810,7 @@ events.prototype.useFly = function (fromUserAction) {
|
||||
if (!this._checkStatus('fly', fromUserAction, true)) return;
|
||||
if (!core.maps.canUseFlyHere()) {
|
||||
core.playSound('操作失败');
|
||||
const failTip = core.flags.flyNearStair ? "只能在楼梯边使用" : (
|
||||
core.flags.flyAccessStair ? "只能在能直接走到楼梯边的地方使用" : "当前无法使用"
|
||||
);
|
||||
core.drawTip(failTip + core.material.items['fly'].name, 'fly');
|
||||
core.drawTip("只有在楼梯边才能使用" + core.material.items['fly'].name, 'fly');
|
||||
core.unlockControl();
|
||||
core.status.event.data = null;
|
||||
core.status.event.id = null;
|
||||
|
||||
@ -128,14 +128,6 @@ items.prototype.useItem = function (itemId, noRoute, callback) {
|
||||
if (callback) callback();
|
||||
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);
|
||||
// 执行完毕
|
||||
|
||||
63
libs/maps.js
63
libs/maps.js
@ -900,8 +900,7 @@ maps.prototype._canMoveDirectly_checkNextPoint = function (blocksObj, x, y, floo
|
||||
if (!ignore) return false;
|
||||
}
|
||||
|
||||
const checkBlockInfo = core.control.getCheckBlock ? core.control.getCheckBlock(floorId) :
|
||||
core.status.checkBlock;
|
||||
const checkBlockInfo = core.control.getCheckBlock(floorId);
|
||||
// 是否存在阻激夹域伤害
|
||||
if (checkBlockInfo) {
|
||||
if (checkBlockInfo.damage[index]) return false;
|
||||
@ -2707,30 +2706,25 @@ maps.prototype._getAndRemoveBlock = function (x, y) {
|
||||
maps.prototype.moveBlock = function (x, y, steps, time, keep, callback, noMoveEInfo) {
|
||||
if (core.status.replay.speed == 24) time = 1;
|
||||
time = time || 500;
|
||||
const blockArr = this._getAndRemoveBlock(x, y);
|
||||
var blockArr = this._getAndRemoveBlock(x, y);
|
||||
if (blockArr == null) {
|
||||
if (callback) callback();
|
||||
return;
|
||||
}
|
||||
const block = blockArr[0], blockInfo = blockArr[1];
|
||||
const moveSteps = (steps || []).map(function (t) {
|
||||
var block = blockArr[0], blockInfo = blockArr[1];
|
||||
var moveSteps = (steps || []).map(function (t) {
|
||||
return [t.split(':')[0], parseInt(t.split(':')[1] || "1")];
|
||||
}).filter(function (t) {
|
||||
return ['up', 'down', 'left', 'right', 'forward', 'backward', 'leftup', 'leftdown', 'rightup', 'rightdown', 'speed'].indexOf(t[0]) >= 0
|
||||
&& !(t[0] == 'speed' && t[1] < 16)
|
||||
});
|
||||
const canvases = this._initDetachedBlock(blockInfo, x, y, block.event.animate !== false);
|
||||
var canvases = this._initDetachedBlock(blockInfo, x, y, block.event.animate !== false);
|
||||
this._moveDetachedBlock(blockInfo, 32 * x, 32 * y, 1, canvases);
|
||||
|
||||
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 = {
|
||||
var moveInfo = {
|
||||
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, oneStepLength,
|
||||
};
|
||||
moveSteps: moveSteps, step: 0, per_time: time / 16 / core.status.replay.speed
|
||||
}
|
||||
this._moveBlock_doMove(blockInfo, canvases, moveInfo, callback, noMoveEInfo);
|
||||
}
|
||||
|
||||
@ -2776,6 +2770,23 @@ maps.prototype._moveBlock_doMove = function (blockInfo, canvases, moveInfo, call
|
||||
_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) {
|
||||
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;
|
||||
@ -2845,10 +2856,10 @@ maps.prototype._moveBlock_moving = function (blockInfo, canvases, moveInfo) {
|
||||
}
|
||||
var curr = moveInfo.moveSteps[0];
|
||||
moveInfo.step++;
|
||||
moveInfo.px += core.utils.scan2[curr[0]].x * moveInfo.offset * moveInfo.oneStepLength;
|
||||
moveInfo.py += core.utils.scan2[curr[0]].y * moveInfo.offset * moveInfo.oneStepLength;
|
||||
moveInfo.px += core.utils.scan2[curr[0]].x * 2 * moveInfo.offset;
|
||||
moveInfo.py += core.utils.scan2[curr[0]].y * 2 * moveInfo.offset;
|
||||
this._moveDetachedBlock(blockInfo, moveInfo.px, moveInfo.py, moveInfo.opacity, canvases);
|
||||
if (moveInfo.step == Math.abs(Math.round(32 / (moveInfo.offset * moveInfo.oneStepLength)))) {
|
||||
if (moveInfo.step == Math.round(32 / (moveInfo.offset * 2))) {
|
||||
moveInfo.step = 0;
|
||||
moveInfo.moveSteps[0][1]--;
|
||||
if (moveInfo.moveSteps[0][1] <= 0) {
|
||||
@ -2857,24 +2868,6 @@ 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"}的效果 //////
|
||||
maps.prototype.jumpBlock = function (sx, sy, ex, ey, time, keep, callback) {
|
||||
time = time || 500;
|
||||
|
||||
@ -10,7 +10,6 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
||||
"bg.jpg",
|
||||
"dragon.png",
|
||||
"hero.png",
|
||||
"mousewheel.png",
|
||||
"winskin.png"
|
||||
],
|
||||
"tilesets": [
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 391 B |
@ -345,17 +345,11 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
||||
"superPotion": {
|
||||
"cls": "items",
|
||||
"name": "圣水",
|
||||
"itemEffect": null,
|
||||
"itemEffect": "core.status.hero.hp *= 2",
|
||||
"itemEffectTip": ",生命值翻倍",
|
||||
"useItemEffect": "core.status.hero.hp *= 2;core.playSound('回血');",
|
||||
"canUseItemEffect": "true",
|
||||
"text": "生命值翻倍",
|
||||
"itemEffectEvent": {
|
||||
"sound": "recovery.mp3",
|
||||
"value": {
|
||||
"hp": "core.status.hero.hp"
|
||||
}
|
||||
}
|
||||
"text": "生命值翻倍"
|
||||
},
|
||||
"book": {
|
||||
"cls": "constants",
|
||||
@ -424,9 +418,8 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
||||
"cls": "tools",
|
||||
"name": "破墙镐",
|
||||
"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(\"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",
|
||||
"noAutoSaveBeforeUse": true
|
||||
"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})();",
|
||||
"canUseItemEffect": "true"
|
||||
},
|
||||
"icePickaxe": {
|
||||
"cls": "tools",
|
||||
@ -439,15 +432,14 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
||||
"cls": "tools",
|
||||
"name": "炸弹",
|
||||
"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(\"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",
|
||||
"noAutoSaveBeforeUse": true
|
||||
"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})();",
|
||||
"canUseItemEffect": "true"
|
||||
},
|
||||
"centerFly": {
|
||||
"cls": "tools",
|
||||
"name": "中心对称飞行器",
|
||||
"text": "可以飞向当前楼层中心对称的位置",
|
||||
"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 + '使用成功');",
|
||||
"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 + '使用成功');",
|
||||
"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": {
|
||||
@ -508,7 +500,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
||||
"cls": "tools",
|
||||
"name": "跳跃靴",
|
||||
"text": "能跳跃到前方两格处",
|
||||
"useItemEffect": "core.playSound(\"跳跃\");\ncore.insertAction({ \"type\": \"jumpHero\", \"loc\": [core.nextX(2), core.nextY(2)] });",
|
||||
"useItemEffect": "if (core.getLocalStorage(\"autoSaveAfterItem\")) {\n\tcore.control.autosave();\n}\ncore.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})();"
|
||||
},
|
||||
"wand": {
|
||||
@ -516,66 +508,8 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
||||
"name": "生命魔杖",
|
||||
"text": "使用后回复100体力。",
|
||||
"canUseItemEffect": "true",
|
||||
"useItemEffect": null,
|
||||
"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
|
||||
"useItemEffect": "core.addStatus('hp', 100);",
|
||||
"hideInReplay": true
|
||||
},
|
||||
"pack": {
|
||||
"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