From 9ecccf35de795ac80f90a305c232431b89880b58 Mon Sep 17 00:00:00 2001 From: oc Date: Sat, 30 Dec 2017 15:58:42 +0800 Subject: [PATCH] =?UTF-8?q?N=E8=BF=9E=E5=87=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libs/enemys.js | 14 +++++++++----- libs/events.js | 4 ++-- libs/items.js | 2 +- libs/ui.js | 14 +++++++------- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/libs/enemys.js b/libs/enemys.js index 2b54da9a..a5c970fe 100644 --- a/libs/enemys.js +++ b/libs/enemys.js @@ -5,10 +5,10 @@ function enemys() { enemys.prototype.init = function () { // 怪物属性初始化定义: this.enemys = { - 'greenSlime': {'name': '绿头怪', 'hp': 100, 'atk': 120, 'def': 0, 'money': 1, 'experience': 1, 'special': 0, 'point': 2}, + 'greenSlime': {'name': '绿头怪', 'hp': 100, 'atk': 120, 'def': 0, 'money': 1, 'experience': 1, 'special': [1,5,7,8]}, 'redSlime': {'name': '红头怪', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, 'blackSlime': {'name': '青头怪', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, - 'slimelord': {'name': '怪王', 'hp': 100, 'atk': 120, 'def': 0, 'money': 10, 'experience': 0, 'special': 9}, + 'slimelord': {'name': '怪王', 'hp': 100, 'atk': 120, 'def': 0, 'money': 10, 'experience': 0, 'special': [1,9]}, 'bat': {'name': '小蝙蝠', 'hp': 100, 'atk': 120, 'def': 0, 'money': 2, 'experience': 0, 'special': 1}, 'bigBat': {'name': '大蝙蝠', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, 'redBat': {'name': '红蝙蝠', 'hp': 100, 'atk': 120, 'def': 0, 'money': 5, 'experience': 0, 'special': 4}, @@ -58,7 +58,7 @@ enemys.prototype.init = function () { 'badPrincess': {'name': '痛苦魔女', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, 'badFairy': {'name': '黑暗仙子', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, 'grayPriest': {'name': '中级法师', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, - 'redSwordsman': {'name': '剑王', 'hp': 100, 'atk': 120, 'def': 0, 'money': 7, 'experience': 0, 'special': 6}, + 'redSwordsman': {'name': '剑王', 'hp': 100, 'atk': 120, 'def': 0, 'money': 7, 'experience': 0, 'special': 6, 'n': 8}, // 多连击需要在后面指定n代表是几连击 'whiteGhost': {'name': '水银战士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, 'poisonZombie': {'name': '绿兽人', 'hp': 100, 'atk': 120, 'def': 0, 'money': 13, 'experience': 0, 'special': 12}, 'magicDragon': {'name': '魔龙', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, @@ -104,7 +104,7 @@ enemys.prototype.getSpecialText = function (enemyId) { if (this.hasSpecial(special, 18)) text.push("阻击"); if (this.hasSpecial(special, 19)) text.push("自爆"); if (this.hasSpecial(special, 20)) text.push("无敌"); - return text.join(" "); + return text; } ////// 获得每个属性的文字提示 ////// @@ -262,6 +262,10 @@ enemys.prototype.getCurrentEnemys = function () { mon_def=core.status.hero.def; } + var specialText = core.enemys.getSpecialText(monsterId); + if (specialText.length>=3) specialText = "多属性..."; + else specialText = specialText.join(" "); + enemys.push({ 'id': monsterId, 'name': monster.name, @@ -270,7 +274,7 @@ enemys.prototype.getCurrentEnemys = function () { 'def': mon_def, 'money': monster.money, 'experience': monster.experience, - 'special': core.enemys.getSpecialText(monsterId), + 'special': specialText, 'damage': this.getDamage(monsterId), 'critical': this.getCritical(monsterId), 'criticalDamage': this.getCriticalDamage(monsterId), diff --git a/libs/events.js b/libs/events.js index b7a906c8..452a4f1b 100644 --- a/libs/events.js +++ b/libs/events.js @@ -805,11 +805,11 @@ events.prototype.keyUpAction = function (keycode) { events.prototype.clickBook = function(x,y) { // 上一页 if ((x == 3 || x == 4) && y == 12) { - core.ui.drawEnemyBook(core.status.event.data - 1); + core.ui.drawEnemyBook(core.status.event.data - 6); } // 下一页 if ((x == 8 || x == 9) && y == 12) { - core.ui.drawEnemyBook(core.status.event.data + 1); + core.ui.drawEnemyBook(core.status.event.data + 6); } // 返回 if (x>=10 && x<=12 && y==12) { diff --git a/libs/items.js b/libs/items.js index 449d2980..ae21b209 100644 --- a/libs/items.js +++ b/libs/items.js @@ -147,7 +147,7 @@ items.prototype.useItem = function (itemId) { if (!this.canUseItem(itemId)) return; var itemCls = core.material.items[itemId].cls; - if (itemId=='book') core.ui.drawEnemyBook(1); + if (itemId=='book') core.ui.drawEnemyBook(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') { diff --git a/libs/ui.js b/libs/ui.js index 314ddbf2..4659a055 100644 --- a/libs/ui.js +++ b/libs/ui.js @@ -423,7 +423,7 @@ ui.prototype.drawBattleAnimate = function(monsterId, callback) { hero_mdef=0; } - var specialText = core.enemys.getSpecialText(monsterId); + var specialTexts = core.enemys.getSpecialText(monsterId); var background = core.canvas.ui.createPattern(core.material.ground, "repeat"); @@ -466,7 +466,6 @@ ui.prototype.drawBattleAnimate = function(monsterId, callback) { core.canvas.ui.textAlign='center'; core.fillText('ui', core.status.hero.name, left+margin+boxWidth/2, top+margin+heroHeight+40, '#FFD700', 'bold 22px Verdana'); core.fillText('ui', "怪物", left+right-margin-boxWidth/2, top+margin+32+40); - var specialTexts = specialText.split(" "); for (var i=0, j=0; i=enemys.length) index=enemys.length-1; var perpage = 6; + var page=parseInt(index/perpage)+1; var totalPage = parseInt((enemys.length - 1) / perpage) + 1; - if (page < 1) page = 1; - if (page > totalPage) page = totalPage; - core.status.event.data = page; + core.status.event.data = index; var start = (page - 1) * perpage, end = Math.min(page * perpage, enemys.length); enemys = enemys.slice(start, end);