Update Item Effect
This commit is contained in:
parent
b222ed4252
commit
150d65275b
252
libs/items.js
252
libs/items.js
@ -7,6 +7,8 @@ items.prototype.init = function () {
|
||||
this.items = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.items;
|
||||
this.itemEffect = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.itemEffect;
|
||||
this.itemEffectTip = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.itemEffectTip;
|
||||
this.useItemEffect = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.useItem;
|
||||
this.canUseItemEffect = items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.canUseItem;
|
||||
//delete(items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a);
|
||||
}
|
||||
|
||||
@ -21,16 +23,16 @@ items.prototype.getItems = function () {
|
||||
if (core.flags.bombFourDirections)
|
||||
this.items.bomb.text = "可以炸掉勇士四周的怪物";
|
||||
if (core.flags.equipment) {
|
||||
this.items.sword1 = {'cls': 'constants', 'name': '铁剑', 'text': '一把很普通的铁剑,攻击+'+core.values.sword1};
|
||||
this.items.sword2 = {'cls': 'constants', 'name': '银剑', 'text': '一把很普通的银剑,攻击+'+core.values.sword2};
|
||||
this.items.sword3 = {'cls': 'constants', 'name': '骑士剑', 'text': '一把很普通的骑士剑,攻击+'+core.values.sword3};
|
||||
this.items.sword4 = {'cls': 'constants', 'name': '圣剑', 'text': '一把很普通的圣剑,攻击+'+core.values.sword4};
|
||||
this.items.sword5 = {'cls': 'constants', 'name': '神圣剑', 'text': '一把很普通的神圣剑,攻击+'+core.values.sword5};
|
||||
this.items.shield1 = {'cls': 'constants', 'name': '铁盾', 'text': '一个很普通的铁盾,防御+'+core.values.shield1};
|
||||
this.items.shield2 = {'cls': 'constants', 'name': '银盾', 'text': '一个很普通的银盾,防御+'+core.values.shield2};
|
||||
this.items.shield3 = {'cls': 'constants', 'name': '骑士盾', 'text': '一个很普通的骑士盾,防御+'+core.values.shield3};
|
||||
this.items.shield4 = {'cls': 'constants', 'name': '圣盾', 'text': '一个很普通的圣盾,防御+'+core.values.shield4};
|
||||
this.items.shield5 = {'cls': 'constants', 'name': '神圣盾', 'text': '一个很普通的神圣盾,防御+'+core.values.shield5};
|
||||
this.items.sword1 = {'cls': 'constants', 'name': '铁剑', 'text': '一把很普通的铁剑'};
|
||||
this.items.sword2 = {'cls': 'constants', 'name': '银剑', 'text': '一把很普通的银剑'};
|
||||
this.items.sword3 = {'cls': 'constants', 'name': '骑士剑', 'text': '一把很普通的骑士剑'};
|
||||
this.items.sword4 = {'cls': 'constants', 'name': '圣剑', 'text': '一把很普通的圣剑'};
|
||||
this.items.sword5 = {'cls': 'constants', 'name': '神圣剑', 'text': '一把很普通的神圣剑'};
|
||||
this.items.shield1 = {'cls': 'constants', 'name': '铁盾', 'text': '一个很普通的铁盾'};
|
||||
this.items.shield2 = {'cls': 'constants', 'name': '银盾', 'text': '一个很普通的银盾'};
|
||||
this.items.shield3 = {'cls': 'constants', 'name': '骑士盾', 'text': '一个很普通的骑士盾'};
|
||||
this.items.shield4 = {'cls': 'constants', 'name': '圣盾', 'text': '一个很普通的圣盾'};
|
||||
this.items.shield5 = {'cls': 'constants', 'name': '神圣盾', 'text': '一个很普通的神圣盾'};
|
||||
}
|
||||
|
||||
return this.items;
|
||||
@ -66,72 +68,8 @@ items.prototype.useItem = function (itemId, callback) {
|
||||
}
|
||||
var itemCls = core.material.items[itemId].cls;
|
||||
|
||||
if (itemId=='book') core.ui.drawBook(0);
|
||||
if (itemId=='fly') core.ui.drawFly(core.status.hero.flyRange.indexOf(core.status.floorId));
|
||||
if (itemId == 'earthquake' || itemId == 'bomb' || itemId == 'pickaxe' || itemId=='icePickaxe'
|
||||
|| itemId == 'snow' || itemId == 'hammer' || itemId=='bigKey') {
|
||||
// 消除当前层的某些块
|
||||
core.removeBlockByIds(core.status.floorId, core.status.event.data);
|
||||
core.drawMap(core.status.floorId, function () {
|
||||
core.drawHero(core.getHeroLoc('direction'), core.getHeroLoc('x'), core.getHeroLoc('y'), 'stop');
|
||||
core.updateFg();
|
||||
core.drawTip(core.material.items[itemId].name + "使用成功");
|
||||
|
||||
if (itemId == 'bomb' || itemId == 'hammer')
|
||||
core.events.afterUseBomb();
|
||||
});
|
||||
}
|
||||
if (itemId == 'centerFly') {
|
||||
// 对称飞
|
||||
core.clearMap('hero', 0, 0, 416, 416);
|
||||
core.setHeroLoc('x', core.status.event.data.x);
|
||||
core.setHeroLoc('y', core.status.event.data.y);
|
||||
core.drawHero(core.getHeroLoc('direction'), core.getHeroLoc('x'), core.getHeroLoc('y'), 'stop');
|
||||
core.drawTip(core.material.items[itemId].name + "使用成功");
|
||||
}
|
||||
if (itemId == 'upFly' || itemId == 'downFly') {
|
||||
// 上楼器/下楼器
|
||||
core.changeFloor(core.status.event.data.id, null, {'direction': core.status.hero.loc.direction, 'x': core.status.event.data.x, 'y': core.status.event.data.y}, null, function (){
|
||||
core.drawTip(core.material.items[itemId].name + "使用成功");
|
||||
core.replay();
|
||||
});
|
||||
}
|
||||
if (itemId == 'poisonWine') core.setFlag('poison', false);
|
||||
if (itemId == 'weakWine') {
|
||||
core.setFlag('weak', false);
|
||||
core.status.hero.atk += core.values.weakValue;
|
||||
core.status.hero.def += core.values.weakValue;
|
||||
}
|
||||
if (itemId == 'curseWine') core.setFlag('curse', false);
|
||||
if (itemId == 'superWine') {
|
||||
core.setFlag('poison', false);
|
||||
if (core.hasFlag('weak')) {
|
||||
core.setFlag('weak', false);
|
||||
core.status.hero.atk += core.values.weakValue;
|
||||
core.status.hero.def += core.values.weakValue;
|
||||
}
|
||||
core.setFlag('curse', false);
|
||||
}
|
||||
|
||||
// 剑
|
||||
if (itemId.indexOf("sword")==0) {
|
||||
var now=core.getFlag('sword', 'sword0'); // 当前装备剑的ID
|
||||
core.status.hero.atk -= core.values[now];
|
||||
core.setItem(now, 1);
|
||||
core.status.hero.atk += core.values[itemId];
|
||||
core.setItem(itemId, 0);
|
||||
core.setFlag('sword', itemId);
|
||||
core.drawTip("已装备"+core.material.items[itemId].name);
|
||||
}
|
||||
// 盾
|
||||
if (itemId.indexOf("shield")==0) {
|
||||
var now=core.getFlag('shield', 'shield0');
|
||||
core.status.hero.def -= core.values[now];
|
||||
core.setItem(now, 1);
|
||||
core.status.hero.def += core.values[itemId];
|
||||
core.setItem(itemId, 0);
|
||||
core.setFlag('shield', itemId);
|
||||
core.drawTip("已装备"+core.material.items[itemId].name);
|
||||
if (itemId in this.useItemEffect) {
|
||||
eval(this.useItemEffect[itemId]);
|
||||
}
|
||||
|
||||
core.updateStatusBar();
|
||||
@ -155,167 +93,9 @@ items.prototype.canUseItem = function (itemId) {
|
||||
// 没有道具
|
||||
if (!core.hasItem(itemId)) return false;
|
||||
|
||||
if (itemId == 'book') return true;
|
||||
if (itemId == 'fly') return core.status.hero.flyRange.indexOf(core.status.floorId)>=0;
|
||||
if (itemId == 'pickaxe') {
|
||||
// 破墙镐
|
||||
var ids = [];
|
||||
for (var i in core.status.thisMap.blocks) {
|
||||
var block = core.status.thisMap.blocks[i];
|
||||
if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) &&
|
||||
(block.event.id == 'yellowWall' || block.event.id=='whiteWall' || block.event.id=='blueWall')) // 能破哪些墙
|
||||
{
|
||||
// 四个方向
|
||||
if (core.flags.pickaxeFourDirections) {
|
||||
if (Math.abs(block.x-core.status.hero.loc.x)+Math.abs(block.y-core.status.hero.loc.y)<=1) {
|
||||
ids.push(i);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (block.x == core.nextX() && block.y == core.nextY()) {
|
||||
ids.push(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ids.length>0) {
|
||||
core.status.event.data = ids;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
if (itemId in this.canUseItemEffect) {
|
||||
return eval(this.canUseItemEffect[itemId]);
|
||||
}
|
||||
if (itemId == 'icePickaxe') {
|
||||
// 破冰镐
|
||||
for (var i in core.status.thisMap.blocks) {
|
||||
var block = core.status.thisMap.blocks[i];
|
||||
if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) && block.x==core.nextX() && block.y==core.nextY() && block.event.id=='ice') {
|
||||
core.status.event.data = [i];
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (itemId == 'bomb') {
|
||||
// 炸弹
|
||||
var ids = [];
|
||||
for (var i in core.status.thisMap.blocks) {
|
||||
var block = core.status.thisMap.blocks[i];
|
||||
if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) && block.event.cls.indexOf('enemy')==0 && Math.abs(block.x-core.status.hero.loc.x)+Math.abs(block.y-core.status.hero.loc.y)<=1) {
|
||||
var enemy = core.material.enemys[block.event.id];
|
||||
if (core.isset(enemy.bomb) && !enemy.bomb) continue;
|
||||
if (core.flags.bombFourDirections || (block.x==core.nextX() && block.y==core.nextY()))
|
||||
ids.push(i);
|
||||
}
|
||||
}
|
||||
if (ids.length>0) {
|
||||
core.status.event.data = ids;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (itemId == 'hammer') {
|
||||
// 圣锤
|
||||
for (var i in core.status.thisMap.blocks) {
|
||||
var block = core.status.thisMap.blocks[i];
|
||||
if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) && block.event.cls.indexOf('enemy')==0 && block.x==core.nextX() && block.y==core.nextY()) {
|
||||
var enemy = core.material.enemys[block.event.id];
|
||||
if (core.isset(enemy.bomb) && !enemy.bomb) continue;
|
||||
core.status.event.data = [i];
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (itemId == 'earthquake') {
|
||||
var ids = []
|
||||
for (var i in core.status.thisMap.blocks) {
|
||||
var block = core.status.thisMap.blocks[i];
|
||||
if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) && (block.event.id == 'yellowWall' || block.event.id == 'blueWall' || block.event.id == 'whiteWall'))
|
||||
ids.push(i);
|
||||
}
|
||||
if (ids.length>0) {
|
||||
core.status.event.data = ids;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (itemId == 'centerFly') {
|
||||
// 中心对称
|
||||
var toX = 12 - core.getHeroLoc('x'), toY = 12-core.getHeroLoc('y');
|
||||
var block = core.getBlock(toX, toY);
|
||||
if (block==null) {
|
||||
core.status.event.data = {'x': toX, 'y': toY};
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (itemId == 'upFly') {
|
||||
// 上楼器
|
||||
var floorId = core.status.floorId;
|
||||
var index = core.floorIds.indexOf(floorId);
|
||||
if (index==core.floorIds.length-1) return false;
|
||||
var toId = core.floorIds[index+1];
|
||||
var toX = core.getHeroLoc('x'), toY = core.getHeroLoc('y');
|
||||
|
||||
var block = core.getBlock(toX, toY, toId);
|
||||
if (block==null) {
|
||||
core.status.event.data = {'id': toId, 'x': toX, 'y': toY};
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (itemId == 'downFly') {
|
||||
// 下楼器
|
||||
var floorId = core.status.floorId;
|
||||
var index = core.floorIds.indexOf(floorId);
|
||||
if (index==0) return false;
|
||||
var toId = core.floorIds[index-1];
|
||||
var toX = core.getHeroLoc('x'), toY = core.getHeroLoc('y');
|
||||
|
||||
var block = core.getBlock(toX, toY, toId);
|
||||
if (block==null) {
|
||||
core.status.event.data = {'id': toId, 'x': toX, 'y': toY};
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (itemId=='snow') {
|
||||
// 冰冻徽章
|
||||
var ids = [];
|
||||
for (var i in core.status.thisMap.blocks) {
|
||||
var block = core.status.thisMap.blocks[i];
|
||||
if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) && block.event.id == 'lava' && Math.abs(block.x-core.status.hero.loc.x)+Math.abs(block.y-core.status.hero.loc.y)<=1) {
|
||||
ids.push(i);
|
||||
}
|
||||
}
|
||||
if (ids.length>0) {
|
||||
core.status.event.data = ids;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (itemId=='bigKey') {
|
||||
// 大黄门钥匙
|
||||
var ids = [];
|
||||
for (var i in core.status.thisMap.blocks) {
|
||||
var block = core.status.thisMap.blocks[i];
|
||||
if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) && block.event.id == 'yellowDoor') {
|
||||
ids.push(i);
|
||||
}
|
||||
}
|
||||
if (ids.length>0) {
|
||||
core.status.event.data = ids;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (itemId=='poisonWine') return core.hasFlag('poison');
|
||||
if (itemId=='weakWine') return core.hasFlag('weak');
|
||||
if (itemId=='curseWine') return core.hasFlag('curse');
|
||||
if (itemId=='superWine') return core.hasFlag('poison') || core.hasFlag('weak') || core.hasFlag('curse');
|
||||
|
||||
// 剑盾
|
||||
if (itemId.indexOf("sword")==0 || itemId.indexOf("shield")==0) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -8,7 +8,9 @@ comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
|
||||
'isEquipment': '物品是否属于装备(仅在core.flags.equipment时有效)\n$select({\"values\":[true,false]})$end'
|
||||
},
|
||||
'itemEffect':'cls为items的即捡即用类物品的效果,执行时会对这里的字符串执行eval()',
|
||||
'itemEffectTip':'cls为items的即捡即用类物品,在获得时左上角额外显示的文字,执行时会对这里的字符串执行eval()得到字符串'
|
||||
'itemEffectTip':'cls为items的即捡即用类物品,在获得时左上角额外显示的文字,执行时会对这里的字符串执行eval()得到字符串',
|
||||
'useItem':'cls为tools或contants时的使用物品效果,执行时会对这里的字符串执行eval()',
|
||||
'canUseItem':'cls为tools或contants时能否使用物品的判断,执行时会return这里的字符串执行eval()后的结果',
|
||||
},
|
||||
"items_template" : {'cls': 'items', 'name': '新物品'},
|
||||
"enemys" : {
|
||||
|
||||
@ -147,7 +147,7 @@ data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
||||
"pickaxeFourDirections": true,
|
||||
"bombFourDirections": true,
|
||||
"bigKeyIsBox": false,
|
||||
"equipment": false,
|
||||
"equipment": true,
|
||||
"enableDeleteItem": true,
|
||||
"enableAddPoint": false,
|
||||
"enableNegativeDamage": true,
|
||||
|
||||
@ -311,6 +311,28 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
this.test = function () {
|
||||
console.log("插件函数执行测试");
|
||||
}
|
||||
|
||||
this.useEquipment = function (itemId) { // 使用装备
|
||||
if (itemId.indexOf("sword")==0) {
|
||||
var now=core.getFlag('sword', 'sword0'); // 当前装备剑的ID
|
||||
core.status.hero.atk -= core.values[now];
|
||||
core.setItem(now, 1);
|
||||
core.status.hero.atk += core.values[itemId];
|
||||
core.setItem(itemId, 0);
|
||||
core.setFlag('sword', itemId);
|
||||
core.drawTip("已装备"+core.material.items[itemId].name);
|
||||
}
|
||||
if (itemId.indexOf("shield")==0) {
|
||||
var now=core.getFlag('shield', 'shield0');
|
||||
core.status.hero.def -= core.values[now];
|
||||
core.setItem(now, 1);
|
||||
core.status.hero.def += core.values[itemId];
|
||||
core.setItem(itemId, 0);
|
||||
core.setFlag('shield', itemId);
|
||||
core.drawTip("已装备"+core.material.items[itemId].name);
|
||||
}
|
||||
}
|
||||
|
||||
// 可以在任何地方(如afterXXX或自定义脚本事件)调用函数,方法为 core.plugin.xxx();
|
||||
|
||||
}
|
||||
|
||||
@ -112,6 +112,69 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
||||
"bigKey":"',全钥匙+1'",
|
||||
"superPotion":"',生命值翻倍'",
|
||||
"moneyPocket":"',金币+'+core.values.moneyPocket",
|
||||
},
|
||||
|
||||
"useItem": {
|
||||
"book": "core.ui.drawBook(0);",
|
||||
"fly": "core.ui.drawFly(core.status.hero.flyRange.indexOf(core.status.floorId));",
|
||||
"earthquake": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n core.drawHero(core.getHeroLoc('direction'), core.getHeroLoc('x'), core.getHeroLoc('y'), 'stop');\n core.updateFg();\n core.drawTip(core.material.items[itemId].name + '使用成功');\n});",
|
||||
"pickaxe": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n core.drawHero(core.getHeroLoc('direction'), core.getHeroLoc('x'), core.getHeroLoc('y'), 'stop');\n core.updateFg();\n core.drawTip(core.material.items[itemId].name + '使用成功');\n});",
|
||||
"icePickaxe": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n core.drawHero(core.getHeroLoc('direction'), core.getHeroLoc('x'), core.getHeroLoc('y'), 'stop');\n core.updateFg();\n core.drawTip(core.material.items[itemId].name + '使用成功');\n});",
|
||||
"snow": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n core.drawHero(core.getHeroLoc('direction'), core.getHeroLoc('x'), core.getHeroLoc('y'), 'stop');\n core.updateFg();\n core.drawTip(core.material.items[itemId].name + '使用成功');\n});",
|
||||
"bigKey": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n core.drawHero(core.getHeroLoc('direction'), core.getHeroLoc('x'), core.getHeroLoc('y'), 'stop');\n core.updateFg();\n core.drawTip(core.material.items[itemId].name + '使用成功');\n});",
|
||||
"bomb": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n core.drawHero(core.getHeroLoc('direction'), core.getHeroLoc('x'), core.getHeroLoc('y'), 'stop');\n core.updateFg();\n core.drawTip(core.material.items[itemId].name + '使用成功');\n core.events.afterUseBomb();\n});",
|
||||
"hammer": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n core.drawHero(core.getHeroLoc('direction'), core.getHeroLoc('x'), core.getHeroLoc('y'), 'stop');\n core.updateFg();\n core.drawTip(core.material.items[itemId].name + '使用成功');\n core.events.afterUseBomb();\n});",
|
||||
"centerFly": "core.clearMap('hero', 0, 0, 416, 416);\ncore.setHeroLoc('x', core.status.event.data.x);\ncore.setHeroLoc('y', core.status.event.data.y);\ncore.drawHero(core.getHeroLoc('direction'), core.getHeroLoc('x'), core.getHeroLoc('y'), 'stop');\ncore.drawTip(core.material.items[itemId].name + '使用成功');",
|
||||
"upFly": "var loc = {'direction': core.status.hero.loc.direction, 'x': core.status.event.data.x, 'y': core.status.event.data.y};\ncore.changeFloor(core.status.event.data.id, null, loc, null, function (){\n core.drawTip(core.material.items[itemId].name + '使用成功');\n core.replay();\n});",
|
||||
"downFly": "var loc = {'direction': core.status.hero.loc.direction, 'x': core.status.event.data.x, 'y': core.status.event.data.y};\ncore.changeFloor(core.status.event.data.id, null, loc, null, function (){\n core.drawTip(core.material.items[itemId].name + '使用成功');\n core.replay();\n});",
|
||||
"poisonWine": "core.setFlag('poison', false);",
|
||||
"weakWine": "core.setFlag('weak', false);\ncore.status.hero.atk += core.values.weakValue;\ncore.status.hero.def += core.values.weakValue;",
|
||||
"curseWine": "core.setFlag('curse', false);",
|
||||
"superWine": "core.setFlag('poison', false);\nif (core.hasFlag('weak')) {\n core.setFlag('weak', false);\n core.status.hero.atk += core.values.weakValue;\n core.status.hero.def += core.values.weakValue;\n}\ncore.setFlag('curse', false);",
|
||||
"sword0": "core.plugin.useEquipment(itemId)",
|
||||
"sword1": "core.plugin.useEquipment(itemId)",
|
||||
"sword2": "core.plugin.useEquipment(itemId)",
|
||||
"sword3": "core.plugin.useEquipment(itemId)",
|
||||
"sword4": "core.plugin.useEquipment(itemId)",
|
||||
"sword5": "core.plugin.useEquipment(itemId)",
|
||||
"shield0": "core.plugin.useEquipment(itemId)",
|
||||
"shield1": "core.plugin.useEquipment(itemId)",
|
||||
"shield2": "core.plugin.useEquipment(itemId)",
|
||||
"shield3": "core.plugin.useEquipment(itemId)",
|
||||
"shield4": "core.plugin.useEquipment(itemId)",
|
||||
"shield5": "core.plugin.useEquipment(itemId)",
|
||||
},
|
||||
|
||||
"canUseItem": {
|
||||
"book": "true",
|
||||
"fly": "core.status.hero.flyRange.indexOf(core.status.floorId)>=0",
|
||||
"pickaxe": "var able=false;\nvar ids = [];\nfor (var i in core.status.thisMap.blocks) {\n var block = core.status.thisMap.blocks[i];\n if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) &&\n (block.event.id == 'yellowWall' || block.event.id=='whiteWall' || block.event.id=='blueWall')) // 能破哪些墙\n {\n // 四个方向\n if (core.flags.pickaxeFourDirections) {\n if (Math.abs(block.x-core.status.hero.loc.x)+Math.abs(block.y-core.status.hero.loc.y)<=1) {\n ids.push(i);\n }\n }\n else {\n if (block.x == core.nextX() && block.y == core.nextY()) {\n ids.push(i);\n }\n }\n }\n}\nif (ids.length>0) {\n core.status.event.data = ids;\n able=true;\n}\nable",
|
||||
"icePickaxe": "var able=false;\nfor (var i in core.status.thisMap.blocks) {\n var block = core.status.thisMap.blocks[i];\n if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) && block.x==core.nextX() && block.y==core.nextY() && block.event.id=='ice') {\n core.status.event.data = [i];\n able=true;\n }\n}\nable",
|
||||
"bomb": "var able=false;\nvar ids = [];\nfor (var i in core.status.thisMap.blocks) {\n var block = core.status.thisMap.blocks[i];\n if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) && block.event.cls.indexOf('enemy')==0 && Math.abs(block.x-core.status.hero.loc.x)+Math.abs(block.y-core.status.hero.loc.y)<=1) {\n var enemy = core.material.enemys[block.event.id];\n if (core.isset(enemy.bomb) && !enemy.bomb) continue;\n if (core.flags.bombFourDirections || (block.x==core.nextX() && block.y==core.nextY()))\n ids.push(i);\n }\n}\nif (ids.length>0) {\n core.status.event.data = ids;\n able=true;\n}\nable",
|
||||
"hammer": "var able=false;\nfor (var i in core.status.thisMap.blocks) {\n var block = core.status.thisMap.blocks[i];\n if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) && block.event.cls.indexOf('enemy')==0 && block.x==core.nextX() && block.y==core.nextY()) {\n var enemy = core.material.enemys[block.event.id];\n if (core.isset(enemy.bomb) && !enemy.bomb) continue;\n core.status.event.data = [i];\n able=true;\n }\n}\nable",
|
||||
"earthquake": "var able=false;\nvar ids = [];\nfor (var i in core.status.thisMap.blocks) {\n var block = core.status.thisMap.blocks[i];\n if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) && (block.event.id == 'yellowWall' || block.event.id == 'blueWall' || block.event.id == 'whiteWall')) // 能炸的墙壁\n ids.push(i);\n}\nif (ids.length>0) {\n core.status.event.data = ids;\n able=true;\n}\nable",
|
||||
"centerFly": "var able=false;\nvar toX = 12 - core.getHeroLoc('x'), toY = 12-core.getHeroLoc('y');\nvar block = core.getBlock(toX, toY);\nif (block==null) {\n core.status.event.data = {'x': toX, 'y': toY};\n able = true;\n}\nable",
|
||||
"upFly": "var able=false;\nvar floorId = core.status.floorId, index = core.floorIds.indexOf(floorId);\nif (index<core.floorIds.length-1) {\n\tvar toId = core.floorIds[index+1], toX = core.getHeroLoc('x'), toY = core.getHeroLoc('y');\n\tif (core.getBlock(toX, toY, toId)==null) {\n\t\tcore.status.event.data = {'id': toId, 'x': toX, 'y': toY};\n\t\table=true;\n\t}\n}\nable",
|
||||
"downFly": "var able=false;\nvar floorId = core.status.floorId, index = core.floorIds.indexOf(floorId);\nif (index>0) {\n\tvar toId = core.floorIds[index-1], toX = core.getHeroLoc('x'), toY = core.getHeroLoc('y');\n\tif (core.getBlock(toX, toY, toId)==null) {\n\t\tcore.status.event.data = {'id': toId, 'x': toX, 'y': toY};\n\t\table=true;\n\t}\n}\nable",
|
||||
"snow": "var able=false;\nvar ids = [];\nfor (var i in core.status.thisMap.blocks) {\n var block = core.status.thisMap.blocks[i];\n if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) && block.event.id == 'lava' && Math.abs(block.x-core.status.hero.loc.x)+Math.abs(block.y-core.status.hero.loc.y)<=1) {\n ids.push(i);\n }\n}\nif (ids.length>0) {\n core.status.event.data = ids;\n able=true;\n}\nable",
|
||||
"bigKey": "var able=false;\nvar ids = [];\nfor (var i in core.status.thisMap.blocks) {\n var block = core.status.thisMap.blocks[i];\n if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) && block.event.id == 'yellowDoor') {\n ids.push(i);\n }\n}\nif (ids.length>0) {\n core.status.event.data = ids;\n able=true;\n}\nable",
|
||||
"poisonWine": "core.hasFlag('poison')",
|
||||
"weakWine": "core.hasFlag('weak')",
|
||||
"curseWine": "core.hasFlag('curse')",
|
||||
"superWine": "core.hasFlag('poison') || core.hasFlag('weak') || core.hasFlag('curse')",
|
||||
"sword0": "true",
|
||||
"sword1": "true",
|
||||
"sword2": "true",
|
||||
"sword3": "true",
|
||||
"sword4": "true",
|
||||
"sword5": "true",
|
||||
"shield0": "true",
|
||||
"shield1": "true",
|
||||
"shield2": "true",
|
||||
"shield3": "true",
|
||||
"shield4": "true",
|
||||
"shiled5": "true",
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user