From 26dfcb9819c70075334772a91e6ba5ae1bf65cfb Mon Sep 17 00:00:00 2001 From: oc Date: Tue, 5 Dec 2017 12:33:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A5=BC=E6=A2=AF=E3=80=81=E4=BC=A0=E9=80=81?= =?UTF-8?q?=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libs/data.js | 19 +++++++++++++ libs/items.js | 76 +++++++++++++++++++++++++-------------------------- 2 files changed, 57 insertions(+), 38 deletions(-) diff --git a/libs/data.js b/libs/data.js index 953cf6ec..cf123f88 100644 --- a/libs/data.js +++ b/libs/data.js @@ -100,6 +100,25 @@ data.prototype.init = function() { /****** 道具相关 ******/ + "redJewel": 3, // 红宝石加攻击的数值 + "blueJewel": 3, // 蓝宝石加防御的数值 + "greenJewel": 5, // 绿宝石加魔防的数值 + "redPotion": 100, // 红血瓶加血数值 + "bluePotion": 250, // 蓝血瓶加血数值 + "yellowPotion": 500, // 黄血瓶加血数值 + "greenPotion": 800, // 绿血瓶加血数值 + "sword1": 10, // 铁剑加攻数值 + "shield1": 10, // 铁盾加防数值 + "sword2": 20, // 银剑加攻数值 + "shield2": 20, // 银盾加防数值 + "sword3": 40, // 骑士剑加攻数值 + "shield3": 40, // 骑士盾加防数值 + "sword4": 80, // 圣剑加攻数值 + "shield4": 80, // 圣盾加防数值 + "sword5": 160, // 神圣剑加攻数值 + "shield5": 160, // 神圣盾加防数值 + "moneyPocket": 500, // 金钱袋加金币的数值 + "flyNearStair": false, // 是否需要在楼梯边使用传送器 "bombTrigger": true, // 使用炸弹后是否触发怪物事件(如开门) "pickaxeFourDirections": true, // 使用破墙镐是否四个方向都破坏;如果false则只破坏面前的墙壁 diff --git a/libs/items.js b/libs/items.js index fd426d1e..a66a1453 100644 --- a/libs/items.js +++ b/libs/items.js @@ -77,36 +77,36 @@ items.prototype.getItemEffect = function(itemId, itemNum) { var itemCls = core.material.items[itemId].cls; // 消耗品 if (itemCls === 'items') { - if (itemId === 'redJewel') core.status.hero.atk += 3; - if (itemId === 'blueJewel') core.status.hero.def += 3; - if (itemId === 'greenJewel') core.status.hero.mdef += 5; - if (itemId == 'yellowJewel') { + if (itemId === 'redJewel') core.status.hero.atk += core.flags.redJewel; + if (itemId === 'blueJewel') core.status.hero.def += core.flags.blueJewel; + if (itemId === 'greenJewel') core.status.hero.mdef += core.flags.greenJewel; + if (itemId == 'yellowJewel') { // 黄宝石属性:需自己定义 core.status.hero.hp+=1000; core.status.hero.atk+=6; core.status.hero.def+=6; core.status.hero.mdef+=10; } - if (itemId === 'redPotion') core.status.hero.hp += 200; - if (itemId === 'bluePotion') core.status.hero.hp += 500; - if (itemId === 'yellowPotion') core.status.hero.hp += 500; - if (itemId === 'greenPotion') core.status.hero.hp += 800; - if (itemId === 'sword1') core.status.hero.atk += 10; - if (itemId === 'sword2') core.status.hero.atk += 20; - if (itemId == 'sword3') core.status.hero.atk += 40; - if (itemId == 'sword4') core.status.hero.atk += 80; - if (itemId === 'sword5') core.status.hero.atk += 160; - if (itemId === 'shield1') core.status.hero.def += 10; - if (itemId === 'shield2') core.status.hero.def += 20; - if (itemId === 'shield3') core.status.hero.def += 40; - if (itemId === 'shield4') core.status.hero.def += 80; - if (itemId === 'shield5') core.status.hero.def += 160; - if (itemId === 'bigKey') { + if (itemId === 'redPotion') core.status.hero.hp += core.flags.redPotion; + if (itemId === 'bluePotion') core.status.hero.hp += core.flags.bluePotion; + if (itemId === 'yellowPotion') core.status.hero.hp += core.flags.yellowPotion; + if (itemId === 'greenPotion') core.status.hero.hp += core.flags.greenPotion; + if (itemId === 'sword1') core.status.hero.atk += core.flags.sword1; + if (itemId === 'sword2') core.status.hero.atk += core.flags.sword2; + if (itemId == 'sword3') core.status.hero.atk += core.flags.sword3; + if (itemId == 'sword4') core.status.hero.atk += core.flags.sword4; + if (itemId === 'sword5') core.status.hero.atk += core.flags.sword5; + if (itemId === 'shield1') core.status.hero.def += core.flags.shield1; + if (itemId === 'shield2') core.status.hero.def += core.flags.shield2; + if (itemId === 'shield3') core.status.hero.def += core.flags.shield3; + if (itemId === 'shield4') core.status.hero.def += core.flags.shield4; + if (itemId === 'shield5') core.status.hero.def += core.flags.shield5; + if (itemId === 'bigKey') { // 只有是钥匙盒才会执行这一步 core.status.hero.items.keys.yellowKey++; core.status.hero.items.keys.blueKey++; core.status.hero.items.keys.redKey++; } if (itemId == 'superPotion') core.status.hero.hp *= 2; - if (itemId == 'moneyPocket') core.status.hero.money += 500; + if (itemId == 'moneyPocket') core.status.hero.money += core.flags.moneyPocket; } else { core.addItem(itemId, itemNum); @@ -114,27 +114,27 @@ items.prototype.getItemEffect = function(itemId, itemNum) { } items.prototype.getItemEffectTip = function(itemId) { - if (itemId === 'redJewel') return ",攻击+3"; - if (itemId === 'blueJewel') return ",防御+3"; - if (itemId === 'greenJewel') return ",魔防+3"; + if (itemId === 'redJewel') return ",攻击+"+core.flags.redJewel; + if (itemId === 'blueJewel') return ",防御+"+core.flags.blueJewel; + if (itemId === 'greenJewel') return ",魔防+"+core.flags.greenJewel; if (itemId == 'yellowJewel') return ",全属性提升"; - if (itemId === 'redPotion') return ",生命+200"; - if (itemId === 'bluePotion') return ",生命+500"; - if (itemId === 'yellowPotion') return ",生命+500"; - if (itemId === 'greenPotion') return ",生命+800"; - if (itemId === 'sword1') return ",攻击+10"; - if (itemId === 'sword2') return ",攻击+20"; - if (itemId === 'sword3') return ",攻击+40"; - if (itemId === 'sword4') return ",攻击+80"; - if (itemId === 'sword5') return ",攻击+160"; - if (itemId === 'shield1') return ",防御+10"; - if (itemId === 'shield2') return ",防御+20"; - if (itemId === 'shield3') return ",防御+40"; - if (itemId === 'shield4') return ",防御+80"; - if (itemId === 'shield5') return ",防御+160"; + if (itemId === 'redPotion') return ",生命+"+core.flags.redPotion; + if (itemId === 'bluePotion') return ",生命+"+core.flags.bluePotion; + if (itemId === 'yellowPotion') return ",生命+"+core.flags.yellowPotion; + if (itemId === 'greenPotion') return ",生命+"+core.flags.greenPotion; + if (itemId === 'sword1') return ",攻击+"+core.flags.sword1; + if (itemId === 'sword2') return ",攻击+"+core.flags.sword2; + if (itemId === 'sword3') return ",攻击+"+core.flags.sword3; + if (itemId === 'sword4') return ",攻击+"+core.flags.sword4; + if (itemId === 'sword5') return ",攻击+"+core.flags.sword5; + if (itemId === 'shield1') return ",防御+"+core.flags.shield1; + if (itemId === 'shield2') return ",防御+"+core.flags.shield2; + if (itemId === 'shield3') return ",防御+"+core.flags.shield3; + if (itemId === 'shield4') return ",防御+"+core.flags.shield4; + if (itemId === 'shield5') return ",防御+"+core.flags.shield5; if (itemId === 'bigKey') return ",全钥匙+1"; if (itemId === 'superPotion') return ",生命值翻倍"; - if (itemId == 'moneyPocket') return ",金币+500"; + if (itemId == 'moneyPocket') return ",金币+"+core.flags.moneyPocket; return ""; }