重写全部道具效果

This commit is contained in:
ckcz123 2020-05-05 22:46:15 +08:00
parent d270760796
commit b49728ecef
12 changed files with 139 additions and 127 deletions

View File

@ -1142,10 +1142,6 @@ core.tryUseItem(itemId)
对于怪物手册和楼传器将分别调用core.openBook()和core.useFly()函数。
对于中心对称飞行器则会调用core.drawCenterFly()函数。
对于其他的道具,将检查是否拥有,能否使用,并且进行使用。
core.afterUseBomb()
使用炸弹或圣锤后的事件。实际被转发到了脚本编辑中。
```
## icons.js
@ -1532,13 +1528,13 @@ core.removeBlock(x, y, floorId)
如果存在自定义事件,则简单的禁用它,以供以后可能的启用事件。
core.removeBlockById(index, floorId)
core.removeBlockByIndex(index, floorId)
每个楼层的图块存成一个数组index即为该数组中的索引每个索引对应该地图中的一个图块
根据索引从地图的block数组中尽可能删除一个图块。floorId可不填或null表示当前楼层。
core.removeBlockByIds(floorId, ids)
ids为由索引组成的数组如[0,1]等
core.removeBlockByIndexes(indexes, floorId)
indexes为由索引组成的数组如[0,1]等
根据索引数组从地图的block数组中尽可能删除一系列图块。floorId可不填或null表示当前楼层。

View File

@ -481,11 +481,11 @@ core.maps.canMoveDirectly(destX, destY)
该函数如果返回0则不可瞬间移动大于0则可以瞬间移动且返回值是跨度即少走的步数
core.maps.removeBlockById(index, floorId)
core.maps.removeBlockByIndexes(index, floorId)
根据索引删除或禁用某块。
core.maps.removeBlockByIds(floorId, ids)
core.maps.removeBlockByIndexes(indexes, floorId)
根据索引删除或禁用若干块。

View File

@ -1141,10 +1141,6 @@ core.tryUseItem(itemId)
对于怪物手册和楼传器将分别调用core.openBook()和core.useFly()函数。
对于中心对称飞行器则会调用core.drawCenterFly()函数。
对于其他的道具,将检查是否拥有,能否使用,并且进行使用。
core.afterUseBomb()
使用炸弹或圣锤后的事件。实际被转发到了脚本编辑中。
```
## icons.js
@ -1531,13 +1527,13 @@ core.removeBlock(x, y, floorId)
如果存在自定义事件,则简单的禁用它,以供以后可能的启用事件。
core.removeBlockById(index, floorId)
core.removeBlockByIndex(index, floorId)
每个楼层的图块存成一个数组index即为该数组中的索引每个索引对应该地图中的一个图块
根据索引从地图的block数组中尽可能删除一个图块。floorId可不填或null表示当前楼层。
core.removeBlockByIds(floorId, ids)
ids为由索引组成的数组如[0,1]等
core.removeBlockByIndexes(indexes, floorId)
indexes为由索引组成的数组如[0,1]等
根据索引数组从地图的block数组中尽可能删除一系列图块。floorId可不填或null表示当前楼层。

View File

@ -2665,26 +2665,6 @@ if (core.flags.enableAddPoint && point > 0) {
除此以外,每层楼还提供了`firstArrive`和`eachArrive`事件,分别为首次到达该楼层和每次到达该楼层时执行的事件。
## 使用炸弹后的事件
上面的afterBattle事件只对和怪物进行战斗后才有会被处理。
如果我们想在使用炸弹后也能触发一些事件(如开门),则可以在脚本编辑里面的`afterUseBomb`函数进行处理:
``` js
////// 使用炸弹/圣锤后的事件 //////
"afterUseBomb": function () {
// 这是一个使用炸弹也能开门的例子
if (core.status.floorId=='xxx' && core.terrainExists(x0,y0,'specialDoor') // 某个楼层,该机关门存在
&& !core.enemyExists(x1,y1) && !core.enemyExists(x2,y2)) // 且守门的怪物都不存在
{
core.insertAction([ // 插入事件
{"type": "openDoor", "loc": [x0,y0]} // 开门
])
}
}
```
## 滑冰事件
从V2.6开始,滑冰事件被重写。现在的滑冰由公共事件执行。

View File

@ -88,12 +88,6 @@ var functions_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_lint": true,
"_data": "推箱子事件"
},
"afterUseBomb": {
"_leaf": true,
"_type": "textarea",
"_lint": true,
"_data": "炸弹事件"
},
"afterPassNet": {
"_leaf": true,
"_type": "textarea",

View File

@ -2944,11 +2944,6 @@ events.prototype.tryUseItem = function (itemId) {
else core.drawTip("当前无法使用" + core.material.items[itemId].name);
}
////// 使用炸弹/圣锤后的事件 //////
events.prototype.afterUseBomb = function () {
return this.eventdata.afterUseBomb();
}
////// 上传当前数据 //////
events.prototype._uploadCurrent = function (username) {
var formData = new FormData();

View File

@ -147,9 +147,6 @@ items.prototype._afterUseItem = function (itemId) {
core.status.hero.items[itemCls][itemId]--;
if (core.status.hero.items[itemCls][itemId] <= 0)
delete core.status.hero.items[itemCls][itemId];
if (!core.status.event.id)
core.status.event.ui = null;
core.updateStatusBar();
}
@ -158,21 +155,15 @@ items.prototype.canUseItem = function (itemId) {
// 没有道具
if (!core.hasItem(itemId)) return false;
var able = false;
if (itemId in this.canUseItemEffect) {
try {
able = eval(this.canUseItemEffect[itemId]);
return eval(this.canUseItemEffect[itemId]);
}
catch (e) {
main.log(e);
return false;
}
}
if (!able) {
core.status.event.data = null;
core.status.event.ui = null;
}
return able;
}
////// 获得某个物品的个数 //////

View File

@ -685,8 +685,8 @@ maps.prototype._automaticRoute_deepAdd = function (x, y) {
if (id == "light") deepAdd += 100;
// 绕过路障
if (id.endsWith("Net")) deepAdd += 100;
// 绕过血瓶
if (!core.flags.potionWhileRouting && id.endsWith("Potion")) deepAdd += 100;
// 绕过血瓶和绿宝石
if (!core.flags.potionWhileRouting && (id.endsWith("Potion") || id == 'greenJewel')) deepAdd += 100;
// 绕过传送点
// if (block.block.event.trigger == 'changeFloor') deepAdd+=10;
}
@ -1417,7 +1417,7 @@ maps.prototype.searchBlock = function (id, floorId, showDisable) {
}
for (var i = 0; i < core.status.maps[floorId].blocks.length; ++i) {
var block = core.status.maps[floorId].blocks[i];
if ((showDisable || !block.disable) && core.matchWildcard(id, block.event.id)) {
if ((showDisable || !block.disable) && (core.matchWildcard(id, block.event.id) || core.matchRegex(id, block.event.id))) {
result.push({floorId: floorId, index: i, block: block, x: block.x, y: block.y});
}
}
@ -1486,12 +1486,12 @@ maps.prototype.removeBlock = function (x, y, floorId) {
}
// 删除Index
core.removeBlockById(index, floorId);
core.removeBlockByIndex(index, floorId);
core.updateStatusBar();
}
////// 根据block的索引尽可能删除该块 //////
maps.prototype.removeBlockById = function (index, floorId) {
maps.prototype.removeBlockByIndex = function (index, floorId) {
floorId = floorId || core.status.floorId;
if (!floorId) return;
@ -1506,13 +1506,11 @@ maps.prototype.removeBlockById = function (index, floorId) {
}
////// 一次性删除多个block //////
maps.prototype.removeBlockByIds = function (floorId, ids) {
floorId = floorId || core.status.floorId;
if (!floorId) return;
ids.sort(function (a, b) {
return b - a
}).forEach(function (id) {
core.removeBlockById(id, floorId);
maps.prototype.removeBlockByIndexes = function (indexes, floorId) {
indexes.sort(function (a, b) {
return b - a;
}).forEach(function (index) {
core.removeBlockByIndex(index, floorId);
});
}

View File

@ -694,9 +694,23 @@ utils.prototype.reverseDirection = function (direction) {
}
utils.prototype.matchWildcard = function (pattern, string) {
return new RegExp('^' + pattern.split(/\*+/).map(function (s) {
return s.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&');
}).join('.*') + '$').test(string);
try {
return new RegExp('^' + pattern.split(/\*+/).map(function (s) {
return s.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&');
}).join('.*') + '$').test(string);
} catch (e) {
return false;
}
}
utils.prototype.matchRegex = function (pattern, string) {
try {
if (pattern.startsWith("^")) pattern = pattern.substring(1);
if (pattern.endsWith("$")) pattern = pattern.substring(0, pattern.length - 1);
return new RegExp("^" + pattern + "$").test(string);
} catch (e) {
return false;
}
}
////// Base64加密 //////

View File

@ -442,21 +442,6 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
}
*/
}
},
"afterUseBomb": function () {
// 使用炸弹/圣锤后的事件
// 这是一个使用炸弹也能开门的例子
/*
if (core.status.floorId=='xxx' && core.terrainExists(x0,y0,'specialDoor') // 某个楼层,该机关门存在
&& !core.enemyExists(x1,y1) && !core.enemyExists(x2,y2)) // 且守门的怪物都不存在
{
core.insertAction([ // 插入事件
{"type": "openDoor", "loc": [x0,y0]} // 开门
])
}
*/
},
"afterPassNet": function (x, y, id) {
// 经过特殊地形后的事件x和y为当前坐标id为当前的图块id
@ -886,14 +871,6 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
} else {
core.drawTip('当前不能使用炸弹');
}
} else if (core.hasItem('hammer')) {
if (core.canUseItem('hammer')) {
core.status.route.push("key:50"); // 将按键记在录像中
core.useItem('hammer', true); // 第二个参数true代表该次使用道具是被按键触发的使用过程不计入录像
} else {
core.drawTip('当前不能使用圣锤');
}
}
break;
case 51: // 快捷键3: 飞

View File

@ -288,7 +288,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"hammer": {
"cls": "tools",
"name": "圣锤",
"text": "可以炸掉勇士面前的怪物"
"text": "该道具尚未被定义"
},
"lifeWand": {
"cls": "tools",
@ -364,22 +364,21 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"useItemEffect": {
"book": "core.ui.drawBook(0);",
"fly": "core.ui.drawFly(core.floorIds.indexOf(core.status.floorId));",
"earthquake": "core.removeBlockByIds(core.status.floorId, core.status.event.ui);\ncore.drawMap(core.status.floorId, function () {\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n});",
"pickaxe": "core.playSound('pickaxe.mp3');\ncore.removeBlockByIds(core.status.floorId, core.status.event.ui);\ncore.drawMap(core.status.floorId, function () {\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n});",
"icePickaxe": "core.removeBlockByIds(core.status.floorId, core.status.event.ui);\ncore.drawMap(core.status.floorId, function () {\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n});",
"snow": "core.removeBlockByIds(core.status.floorId, core.status.event.ui);\ncore.drawMap(core.status.floorId, function () {\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n});",
"bigKey": "(function () {\n\tvar actions = core.status.event.ui.map(function (id) {\n\t\tvar block = core.status.thisMap.blocks[id];\n\t\treturn { \"type\": \"openDoor\", \"loc\": [block.x, block.y], \"async\": true };\n\t});\n\tactions.push({ \"type\": \"waitAsync\" });\n\tactions.push({ \"type\": \"tip\", \"text\": core.material.items[itemId].name + \"使用成功\" });\n\tcore.insertAction(actions);\n})();",
"bomb": "core.playSound('bomb.mp3');\ncore.removeBlockByIds(core.status.floorId, core.status.event.ui);\ncore.drawMap(core.status.floorId, function () {\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\tcore.events.afterUseBomb();\n});",
"hammer": "core.playSound('bomb.mp3');\ncore.removeBlockByIds(core.status.floorId, core.status.event.ui);\ncore.drawMap(core.status.floorId, function () {\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\tcore.events.afterUseBomb();\n});",
"centerFly": "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 + '使用成功');",
"upFly": "var loc = {'direction': core.status.hero.loc.direction, 'x': core.status.event.ui.x, 'y': core.status.event.ui.y};\nif (core.status.event.id == 'action') {\n\tcore.insertAction([\n\t\t{\"type\": \"changeFloor\", \"loc\": [loc.x, loc.y], \"direction\": loc.direction, \"floorId\": core.status.event.ui.id},\n\t\t{\"type\": \"tip\", \"text\": core.material.items[itemId].name + '使用成功'}\n\t]);\n}\nelse {\n\tcore.changeFloor(core.status.event.ui.id, null, loc, null, function (){\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t\tcore.replay();\n\t});\n}",
"downFly": "var loc = {'direction': core.status.hero.loc.direction, 'x': core.status.event.ui.x, 'y': core.status.event.ui.y};\nif (core.status.event.id == 'action') {\n\tcore.insertAction([\n\t\t{\"type\": \"changeFloor\", \"loc\": [loc.x, loc.y], \"direction\": loc.direction, \"floorId\": core.status.event.ui.id},\n\t\t{\"type\": \"tip\", \"text\": core.material.items[itemId].name + '使用成功'}\n\t]);\n}\nelse {\n\tcore.changeFloor(core.status.event.ui.id, null, loc, null, function (){\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t\tcore.replay();\n\t});\n}\n",
"earthquake": "(function () {\n\tvar indexes = [];\n\tfor (var index in core.status.thisMap.blocks) {\n\t\tvar block = core.status.thisMap.blocks[index];\n\t\tif (!block.disable && block.event.canBreak) {\n\t\t\tindexes.push(index);\n\t\t}\n\t}\n\tcore.removeBlockByIndexes(indexes);\n\tcore.drawMap(core.status.floorId, function () {\n\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t});\n})();",
"pickaxe": "(function () {\n\tvar canBreak = function (x, y) {\n\t\tvar block = core.getBlock(x, y);\n\t\tif (block == null || block.block.disable) return false;\n\t\treturn block.block.event.canBreak;\n\t};\n\n\tcore.playSound('pickaxe.mp3');\n\tif (core.flags.pickaxeFourDirections) {\n\t\t// 四方向破\n\t\tfor (var direction in core.utils.scan) {\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\tcore.removeBlock(nx, ny);\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// 仅破当前\n\t\tcore.removeBlock(core.nextX(), core.nextY());\n\t}\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n})();",
"icePickaxe": "(function () {\n\tcore.removeBlock(core.nextX(), core.nextY());\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n})();",
"snow": "(function () {\n\tif (core.flags.snowFourDirections) {\n\t\t// 四方向雪花\n\t\tfor (var direction in core.utils.scan) {\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 (core.getBlockId(nx, ny) == 'lava') {\n\t\t\t\tcore.removeBlock(nx, ny);\n\t\t\t}\n\t\t}\n\t} else {\n\t\tcore.removeBlock(core.nextX(), core.nextY());\n\t}\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n})();",
"bigKey": "(function () {\n\tvar actions = core.searchBlock(\"yellowDoor\").map(function (block) {\n\t\treturn { \"type\": \"openDoor\", \"loc\": [block.x, block.y], \"async\": true };\n\t});\n\tactions.push({ \"type\": \"waitAsync\" });\n\tactions.push({ \"type\": \"tip\", \"text\": core.material.items[itemId].name + \"使用成功\" });\n\tcore.insertAction(actions);\n})();",
"bomb": "(function () {\n\tvar canBomb = function (x, y) {\n\t\tvar block = core.getBlock(x, y);\n\t\tif (block == null || block.block.disable || block.block.event.cls.indexOf('enemy') != 0) return false;\n\t\tvar enemy = core.material.enemys[block.block.event.id];\n\t\treturn enemy && !enemy.notBomb;\n\t};\n\n\tcore.playSound('bomb.mp3');\n\tvar bombList = []; // 炸掉的怪物坐标列表\n\tif (core.flags.bombFourDirections) {\n\t\t// 四方向炸\n\t\tfor (var direction in core.utils.scan) {\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 (canBomb(nx, ny)) {\n\t\t\t\tbombList.push([nx, ny]);\n\t\t\t\tcore.removeBlock(nx, ny);\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// 仅炸当前\n\t\tcore.removeBlock(core.nextX(), core.nextY());\n\t\tbombList.push([core.nextX(), core.nextY()]);\n\t}\n\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t// 炸弹后事件\n\t// 这是一个使用炸弹也能开门的例子\n\t/*\n\tif (core.status.floorId=='xxx' && core.terrainExists(x0,y0,'specialDoor') // 某个楼层,该机关门存在\n\t\t&& !core.enemyExists(x1,y1) && !core.enemyExists(x2,y2)) // 且守门的怪物都不存在\n\t{\n\t\tcore.insertAction([ // 插入事件\n\t\t\t{\"type\": \"openDoor\", \"loc\": [x0,y0]} // 开门\n\t\t])\n\t}\n\t*/\n})();",
"centerFly": "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 + '使用成功');",
"upFly": "(function () {\n\tvar floorId = core.floorIds[core.floorIds.indexOf(core.status.floorId) + 1];\n\tif (core.status.event.id == 'action') {\n\t\tcore.insertAction([\n\t\t\t{ \"type\": \"changeFloor\", \"loc\": [core.getHeroLoc('x'), core.getHeroLoc('y')], \"floorId\": floorId },\n\t\t\t{ \"type\": \"tip\", \"text\": core.material.items[itemId].name + '使用成功' }\n\t\t]);\n\t} else {\n\t\tcore.changeFloor(floorId, null, core.status.hero.loc, null, function () {\n\t\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t\t\tcore.replay();\n\t\t});\n\t}\n})();",
"downFly": "(function () {\n\tvar floorId = core.floorIds[core.floorIds.indexOf(core.status.floorId) - 1];\n\tif (core.status.event.id == 'action') {\n\t\tcore.insertAction([\n\t\t\t{ \"type\": \"changeFloor\", \"loc\": [core.getHeroLoc('x'), core.getHeroLoc('y')], \"floorId\": floorId },\n\t\t\t{ \"type\": \"tip\", \"text\": core.material.items[itemId].name + '使用成功' }\n\t\t]);\n\t} else {\n\t\tcore.changeFloor(floorId, null, core.status.hero.loc, null, function () {\n\t\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t\t\tcore.replay();\n\t\t});\n\t}\n})();",
"poisonWine": "core.removeFlag('poison');",
"weakWine": "core.removeFlag('weak');\nif (core.values.weakValue>=1) { // >=1直接扣数值\n\tcore.status.hero.atk += core.values.weakValue;\n\tcore.status.hero.def += core.values.weakValue;\n}\nelse { // <1扣比例\n\tcore.addBuff(\"atk\", core.values.weakValue);\n\tcore.addBuff(\"def\", core.values.weakValue);\n}",
"curseWine": "core.removeFlag('curse');",
"superWine": "core.removeFlag('poison');\nif (core.hasFlag('weak')) {\n\tcore.removeFlag('weak');\n\tif (core.values.weakValue>=1) { // >=1直接扣数值\n\t\tcore.status.hero.atk += core.values.weakValue;\n\t\tcore.status.hero.def += core.values.weakValue;\n\t}\n\telse { // <1扣比例\n\t\tcore.addBuff(\"atk\", core.values.weakValue);\n\t\tcore.addBuff(\"def\", core.values.weakValue);\n\t}\n}\ncore.removeFlag('curse');",
"lifeWand": "core.insertAction([\n\t{\"type\": \"input\", \"text\": \"请输入生命魔杖使用次数:(0-${item:lifeWand})\"},\n\t{\"type\": \"if\", \"condition\": \"flag:input<=item:lifeWand\",\n\t\t\"true\": [\n\t\t\t{\"type\": \"setValue\", \"name\": \"item:lifeWand\", \"value\": \"item:lifeWand-flag:input\"},\n\t\t\t{\"type\": \"setValue\", \"name\": \"status:hp\", \"value\": \"status:hp+flag:input*100\"},\n\t\t\t\"成功使用${flag:input}次生命魔杖,恢复${flag:input*100}点生命。\"\n\t\t],\n\t\t\"false\": [\"输入不合法!\"]\n\t},\n]);\ncore.addItem('lifeWand', 1);",
"jumpShoes": "core.insertAction({\"type\":\"jumpHero\",\"loc\":[core.nextX(2),core.nextY(2)]});",
"lifeWand": null,
"jumpShoes": "core.insertAction({ \"type\": \"jumpHero\", \"loc\": [core.nextX(2), core.nextY(2)] });",
"redPotion": "core.status.hero.hp += core.values.redPotion",
"bluePotion": "core.status.hero.hp += core.values.bluePotion",
"greenPotion": "core.status.hero.hp += core.values.greenPotion",
@ -387,28 +386,27 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"redJewel": "core.status.hero.atk += core.values.redJewel",
"blueJewel": "core.status.hero.def += core.values.blueJewel",
"greenJewel": "core.status.hero.mdef += core.values.greenJewel",
"yellowJewel": "core.insertAction([\n\t{\"type\": \"choices\", \"choices\": [\n\t\t{\"text\": \"攻击+1\", \"action\": [\n\t\t\t{\"type\": \"setValue\", \"name\": \"status:atk\", \"value\": \"status:atk+1\"}\n\t\t]},\n\t\t{\"text\": \"防御+2\", \"action\": [\n\t\t\t{\"type\": \"setValue\", \"name\": \"status:def\", \"value\": \"status:def+2\"}\n\t\t]},\n\t\t{\"text\": \"生命+200\", \"action\": [\n\t\t\t{\"type\": \"setValue\", \"name\": \"status:hp\", \"value\": \"status:hp+200\"}\n\t\t]},\n\t]}\n]);",
"yellowJewel": null,
"skill1": "// 二倍斩的flag:skill为1\nif (core.getFlag('skill', 0)==0) { // 判断当前是否已经开了技能\n\tif (core.getStatus('mana')>=5) { // 这里要写当前能否开技能的条件判断,比如魔力值至少要多少\n\t\tcore.setFlag('skill', 1); // 开技能1\n\t\tcore.setFlag('skillName', '二倍斩'); // 设置技能名\n\t}\n\telse {\n\t\tcore.drawTip(\"魔力不足,无法开启技能\");\n\t}\n}\nelse { // 关闭技能\n\tcore.setFlag('skill', 0); // 关闭技能状态\n\tcore.setFlag('skillName', '无');\n}"
},
"canUseItemEffect": {
"book": "true",
"fly": "(function () {\n\treturn core.status.maps[core.status.floorId].canFlyTo;\n})();",
"pickaxe": "(function() {\n\tvar ids = [], id2s = [];\n\tfor (var i in core.status.thisMap.blocks) {\n\t\tvar block = core.status.thisMap.blocks[i];\n\t\tif (!block.disable && core.nearHero(block.x, block.y) && \n\t\t\t(block.event.canBreak || block.event.id == 'yellowWall' || block.event.id=='whiteWall' || block.event.id=='blueWall')) { // 能破哪些墙\n\t\t\t// 四个方向\n\t\t\tif (core.flags.pickaxeFourDirections || (block.x == core.nextX() && block.y == core.nextY()))\n\t\t\t\tids.push(i);\n\t\t\telse id2s.push(i);\n\t\t}\n\t}\n\tif (ids.length>0) {\n\t\tcore.status.event.ui = ids;\n\t\treturn true;\n\t}\n\telse if (id2s.length==1) {\n\t\tcore.status.event.ui = id2s;\n\t\treturn true;\n\t}\n\treturn false;\n})();",
"icePickaxe": "(function() {\n\tfor (var i in core.status.thisMap.blocks) {\n\t\tvar block = core.status.thisMap.blocks[i];\n\t\tif (!block.disable && block.x==core.nextX() && block.y==core.nextY() && block.event.id=='ice') {\n\t\t\tcore.status.event.ui = [i];\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n})();",
"bomb": "(function () {\n\tvar ids = [], id2s = [];\n\tfor (var i in core.status.thisMap.blocks) {\n\t\tvar block = core.status.thisMap.blocks[i];\n\t\tif (!block.disable && block.event.cls.indexOf('enemy')==0 && core.nearHero(block.x, block.y)) {\n\t\t\tvar enemy = core.material.enemys[block.event.id];\n\t\t\tif (core.isset(enemy) && enemy.notBomb) continue;\n\t\t\tif (core.flags.bombFourDirections || (block.x==core.nextX() && block.y==core.nextY()))\n\t\t\t\tids.push(i);\n\t\t\telse\n\t\t\t\tid2s.push(i);\n\t\t}\n\t}\n\tif (ids.length>0) {\n\t\tcore.status.event.ui = ids;\n\t\treturn true;\n\t}\n\tif (id2s.length==1) {\n\t\tcore.status.event.ui = id2s;\n\t\treturn true;\n\t}\n\treturn false;\n})();",
"hammer": "(function() {\n\tvar ids = [], id2s = [];\n\tfor (var i in core.status.thisMap.blocks) {\n\t\tvar block = core.status.thisMap.blocks[i];\n\t\tif (!block.disable && block.event.cls.indexOf('enemy')==0 && core.nearHero(block.x, block.y)) {\n\t\t\tvar enemy = core.material.enemys[block.event.id];\n\t\t\tif (core.isset(enemy) && enemy.notBomb) continue;\n\t\t\tif (block.x==core.nextX() && block.y==core.nextY())\n\t\t\t\tids.push(i);\n\t\t\telse\n\t\t\t\tid2s.push(i);\n\t\t}\n\t}\n\tif (ids.length>0) {\n\t\tcore.status.event.ui = ids;\n\t\treturn true;\n\t}\n\telse if (id2s.length==1) {\n\t\tcore.status.event.ui = id2s;\n\t\treturn true;\n\t}\n\treturn false;\n})();",
"earthquake": "(function () {\n\tvar able=false;\n\tvar ids = [];\n\tfor (var i in core.status.thisMap.blocks) {\n\t\tvar block = core.status.thisMap.blocks[i];\n\t\tif (!block.disable &&\n\t\t\t(block.event.canBreak || block.event.id == 'yellowWall' || block.event.id == 'blueWall' || block.event.id == 'whiteWall')) { // 能炸的墙壁\n\t\t\tids.push(i);\n\t\t}\n\t}\n\tif (ids.length>0) {\n\t\tcore.status.event.ui = ids;\n\t\table=true;\n\t}\n\treturn able;\n})();",
"centerFly": "(function () {\n\tvar toX = core.bigmap.width-1-core.getHeroLoc('x'), toY = core.bigmap.height-1-core.getHeroLoc('y');\n\tvar id = core.getBlockId(toX, toY);\n\treturn id == null;\n})();",
"upFly": "(function() {\n\tvar floorId = core.status.floorId, index = core.floorIds.indexOf(floorId);\n\tif (index<core.floorIds.length-1) {\n\t\tvar toId = core.floorIds[index+1], toX = core.getHeroLoc('x'), toY = core.getHeroLoc('y');\n\t\tvar mw = core.floors[toId].width, mh = core.floors[toId].height;\n\t\tif (toX>=0 && toX<mw && toY>=0 && toY<mh && core.getBlock(toX, toY, toId)==null) {\n\t\t\tcore.status.event.ui = {'id': toId, 'x': toX, 'y': toY};\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n})();",
"downFly": "(function() {\n\tvar floorId = core.status.floorId, index = core.floorIds.indexOf(floorId);\n\tif (index>0) {\n\t\tvar toId = core.floorIds[index-1], toX = core.getHeroLoc('x'), toY = core.getHeroLoc('y');\n\t\tvar mw = core.floors[toId].width, mh = core.floors[toId].height;\n\t\tif (toX>=0 && toX<mw && toY>=0 && toY<mh && core.getBlock(toX, toY, toId)==null) {\n\t\t\tcore.status.event.ui = {'id': toId, 'x': toX, 'y': toY};\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n})();",
"snow": "(function () {\n\tvar ids = [], id2s = [];\n\tfor (var i in core.status.thisMap.blocks) {\n\t\tvar block = core.status.thisMap.blocks[i];\n\t\tif (!block.disable && block.event.id == 'lava' && core.nearHero(block.x, block.y)) {\n\t\t\tif (core.flags.snowFourDirections || (block.x == core.nextX() && block.y == core.nextY()))\n\t\t\t\tids.push(i);\n\t\t\telse id2s.push(i);\n\t\t}\n\t}\n\tif (ids.length>0) {\n\t\tcore.status.event.ui = ids;\n\t\treturn true;\n\t}\n\tif (id2s.length==1) {\n\t\tcore.status.event.ui = id2s;\n\t\treturn true;\n\t}\n\treturn false;\n})();",
"bigKey": "(function () {\n\tvar able = false,\n\t\tids = [];\n\tfor (var i in core.status.thisMap.blocks) {\n\t\tvar block = core.status.thisMap.blocks[i];\n\t\tif (!block.disable && block.event.id == 'yellowDoor') {\n\t\t\tids.push(i);\n\t\t}\n\t}\n\tif (ids.length > 0) {\n\t\tcore.status.event.ui = ids;\n\t\table = true;\n\t}\n\treturn able;\n})();",
"pickaxe": "(function () {\n\tvar canBreak = function (x, y) {\n\t\tvar block = core.getBlock(x, y);\n\t\tif (block == null || block.block.disable) return false;\n\t\treturn block.block.event.canBreak;\n\t};\n\n\tif (core.flags.pickaxeFourDirections) {\n\t\t// 四方向破\n\t\tfor (var direction in core.utils.scan) {\n\t\t\tvar delta = core.utils.scan[direction];\n\t\t\tif (canBreak(core.getHeroLoc('x') + delta.x, core.getHeroLoc('y') + delta.y)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t} else {\n\t\t// 仅破当前\n\t\treturn canBreak(core.nextX(), core.nextY());\n\t}\n})();",
"icePickaxe": "(function () {\n\treturn core.getBlockId(core.nextX(), core.nextY()) == 'ice';\n})();",
"bomb": "(function () {\n\tvar canBomb = function (x, y) {\n\t\tvar block = core.getBlock(x, y);\n\t\tif (block == null || block.block.disable || block.block.event.cls.indexOf('enemy') != 0) return false;\n\t\tvar enemy = core.material.enemys[block.block.event.id];\n\t\treturn enemy && !enemy.notBomb;\n\t};\n\n\tif (core.flags.bombFourDirections) {\n\t\t// 四方向炸\n\t\tfor (var direction in core.utils.scan) {\n\t\t\tvar delta = core.utils.scan[direction];\n\t\t\tif (canBomb(core.getHeroLoc('x') + delta.x, core.getHeroLoc('y') + delta.y)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t} else {\n\t\t// 仅炸当前\n\t\treturn canBomb(core.nextX(), core.nextY());\n\t}\n})();",
"earthquake": "(function () {\n\treturn core.status.thisMap.blocks.filter(function (block) {\n\t\treturn !block.disable && block.event.canBreak;\n\t}).length > 0;\n})();",
"centerFly": "(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": "(function () {\n\tvar floorId = core.status.floorId,\n\t\tindex = core.floorIds.indexOf(floorId);\n\tif (index < core.floorIds.length - 1) {\n\t\tvar toId = core.floorIds[index + 1],\n\t\t\ttoX = core.getHeroLoc('x'),\n\t\t\ttoY = core.getHeroLoc('y');\n\t\tvar mw = core.floors[toId].width,\n\t\t\tmh = core.floors[toId].height;\n\t\tif (toX >= 0 && toX < mw && toY >= 0 && toY < mh && core.getBlock(toX, toY, toId) == null) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n})();",
"downFly": "(function () {\n\tvar floorId = core.status.floorId,\n\t\tindex = core.floorIds.indexOf(floorId);\n\tif (index > 0) {\n\t\tvar toId = core.floorIds[index - 1],\n\t\t\ttoX = core.getHeroLoc('x'),\n\t\t\ttoY = core.getHeroLoc('y');\n\t\tvar mw = core.floors[toId].width,\n\t\t\tmh = core.floors[toId].height;\n\t\tif (toX >= 0 && toX < mw && toY >= 0 && toY < mh && core.getBlock(toX, toY, toId) == null) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n})();",
"snow": "(function () {\n\tif (core.flags.snowFourDirections) {\n\t\t// 四方向雪花\n\t\tfor (var direction in core.utils.scan) {\n\t\t\tvar delta = core.utils.scan[direction];\n\t\t\tif (core.getBlockId(core.getHeroLoc('x') + delta.x, core.getHeroLoc('y') + delta.y) == 'lava') {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t} else {\n\t\treturn core.getBlockId(core.nextX(), core.nextY()) == 'lava';\n\t}\n})();",
"bigKey": "(function () {\n\treturn core.searchBlock('yellowDoor').length > 0;\n})();",
"poisonWine": "core.hasFlag('poison');",
"weakWine": "core.hasFlag('weak');",
"curseWine": "core.hasFlag('curse');",
"superWine": "(function() {\n\treturn core.hasFlag('poison') || core.hasFlag('weak') || core.hasFlag('curse');\n})();",
"lifeWand": "true",
"jumpShoes": "(function() {\n\tvar nx=core.nextX(2), ny=core.nextY(2);\n\treturn nx>=0 && nx<core.bigmap.width && ny>=0 && ny<core.bigmap.height && core.getBlockId(nx,ny)==null;\n})();",
"jumpShoes": "(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})();",
"redPotion": "true",
"bluePotion": "true",
"greenPotion": "true",
@ -419,5 +417,78 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"yellowJewel": "true",
"skill1": "true"
},
"equipCondition": {}
"equipCondition": {},
"useItemEvent": {
"yellowJewel": [
{
"type": "choices",
"choices": [
{
"text": "攻击+1",
"action": [
{
"type": "setValue",
"name": "status:atk",
"value": "status:atk+1"
}
]
},
{
"text": "防御+2",
"action": [
{
"type": "setValue",
"name": "status:def",
"value": "status:def+2"
}
]
},
{
"text": "生命+200",
"action": [
{
"type": "setValue",
"name": "status:hp",
"value": "status:hp+200"
}
]
}
]
}
],
"lifeWand": [
{
"type": "comment",
"text": "先恢复一个魔杖(因为使用道具必须消耗一个)"
},
{
"type": "function",
"function": "function(){\ncore.addItem('lifeWand', 1);\n}"
},
{
"type": "input",
"text": "请输入生命魔杖使用次数:(0-${item:lifeWand})"
},
{
"type": "if",
"condition": "flag:input<=item:lifeWand",
"true": [
{
"type": "setValue",
"name": "item:lifeWand",
"value": "item:lifeWand-flag:input"
},
{
"type": "setValue",
"name": "status:hp",
"value": "status:hp+flag:input*100"
},
"成功使用${flag:input}次生命魔杖,恢复${flag:input*100}点生命。"
],
"false": [
"输入不合法!"
]
}
]
}
}

View File

@ -41,7 +41,7 @@
(已完成!) 11. (来自鹿神)门和像三种基础墙一样的墙应当提供一个“需要消耗多少把哪种钥匙、开关门分别播放什么音效”(如[{"yellowKey": 1}, "door.mp3", "close.mp3"])的属性(还可以提供多种钥匙组合,关系可以为&&和||而不是通过id去机械地对应
(不处理) 12. 来自鹿神和君浪坚固属性建议按照描述来去修改turn或hero_per_damage而不是mon_defrmxp魔塔的坚固属性是通过一个全局量去指定hero_per_damage的默认为1以免和模仿或者说仿防冲突
(不处理) 13. 破甲、反击、净化倍率、仇恨增量和是否减半,建议允许使用怪物的属性去覆盖全塔属性中的值,如不同的破甲怪破甲倍率不同
14. (来自小艾)仇恨伤害和固伤合并进总伤害以免和负伤抵消
(已完成!) 14. (来自小艾)仇恨伤害和固伤合并进总伤害以免和负伤抵消
(不处理) 15. 单点阻激夹域和血网伤害同时存在多种时,气泡提示的伤害类型存在覆盖现象,建议优化
(已完成!) 16. 来自小艾建议修复瞬移判定无视图快属性script项的bug
(已完成!) 17. 建议修复如果还没修复core.drawTip()不能使用系统图标和clear参数的bug并建议增加一个参数来表示多帧图块使用第几帧UI绘制事件中的绘制图标同理增加另一个参数来表示32*48图块绘制上2/3当前实现和手册一致还是下2/3
@ -62,12 +62,12 @@
(已完成!) 32. 关于CC的来回回档优化版据其称清空存档后会出现bug此外他使用了W键导致二倍斩失效了js的switch语句遇到duplicate cases居然不报错吗...
(已完成!) 33. 疑似已被CC修复楼传平面塔模式在记录离开位置时会错误地把读档也算作离开
(已完成!) 34. 接上还有很多像这样在楼层切换中对读档处理不当的问题如天气色调bgm前两者应当像bgm一样提供keep勾选项
35. (来自群友)自动寻路有绕过血瓶的勾选项,但不会绕过绿宝石,这在卡血的净化塔是噩梦
(已完成!) 35. (来自群友)自动寻路有绕过血瓶的勾选项,但不会绕过绿宝石,这在卡血的净化塔是噩梦
(已修复!) 36. (疑似)一年前小雨等人提到“可穿透的楼梯”旁边没有不可通行图块时,桌面端和移动端中只有一种端能停在楼梯上。如果确有此现象,希望修复
(不处理) 37. animates.png的四种箭头的右键绑定目前都只有":next",希望也提供":before"
38. 建议移除afterUseBomb函数合并进炸弹和圣锤的useItemEffect甚至useItemEvent
38.1 现在强制要求面向要破的墙/要炸的怪物了
38.2 移除圣锤道具的定义
(已修复!) 38. 建议移除afterUseBomb函数合并进炸弹和圣锤的useItemEffect甚至useItemEvent
(已修复!) 38.1 现在强制要求面向要破的墙/要炸的怪物了
(已修复!) 38.2 移除圣锤道具的定义
(不处理) 39. 建议把样板自带的大部分tools类道具的useItemEffect用useItemEvent重写以方便作者参照学习我能说266都几个月了好多新作者和老作者压根不知道useItemEvent的存在吗
(已修复!) 40. 希望显示文章的\b提供top和bottom这两种新写法来实现在顶部或底部显示对话框目前只有firstArrive和eachArrive等没有当前点的事件中才能用up和down来临时实现这种效果否则就得设置剧情文本的属性这在频繁来回切换时是致命的就像《无上之光》RMXP版地上40层一样
41. 建议优化core.splitLines()来避免出现标点禁则(如点号和右标号不能用于行首,左标号不能用于行尾),同时也能更好地支持字母文字语言如英语(日语韩语等同样是方块字的倒不要紧)