From 2be53ffca81e0dd8db60838d811ef5e959709d29 Mon Sep 17 00:00:00 2001 From: bdf1 Date: Sun, 13 Nov 2022 02:35:25 +1300 Subject: [PATCH] fix: fix hero direction when changefloor, color in statusbar, color on damage, add q/e for down/up --- libs/enemys.js | 2 +- project/functions.js | 52 ++++++++++++++++++++++++------ project/plugins.js | 77 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 120 insertions(+), 11 deletions(-) diff --git a/libs/enemys.js b/libs/enemys.js index 825c3ba..122657a 100644 --- a/libs/enemys.js +++ b/libs/enemys.js @@ -197,7 +197,7 @@ enemys.prototype.getDamageString = function (enemy, x, y, floorId) { color = '#FF2222'; } else { - if (damage < 0) color = '#11FF11'; + if (damage <= 0) color = '#11FF11'; else if (damage < core.status.hero.hp / 3) color = '#FFFFFF'; else if (damage < core.status.hero.hp * 2 / 3) color = '#FFFF00'; else if (damage < core.status.hero.hp) color = '#FF9933'; diff --git a/project/functions.js b/project/functions.js index 2fb8cfa..650a9fc 100644 --- a/project/functions.js +++ b/project/functions.js @@ -120,6 +120,8 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = // 设置勇士的位置 heroLoc.direction = core.turnDirection(heroLoc.direction); core.status.hero.loc = heroLoc; + if (!fromLoad && null == core.getBlock(heroLoc.x, heroLoc.y, floorId)) + core.setHeroLoc('direction', core.turnDirection('down'), true); // 检查重生怪并重置 if (!fromLoad) { core.extractBlocks(floorId); @@ -845,14 +847,44 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = case 68: // D:读档 core.load(true); break; - case 69: // E:打开光标 - core.ui._drawCursor(); + case 69: // E:上 //打开光标 + if ((core.flags.flyNearStair && !core.nearStair())) + core.drawTip("必须在楼梯口才能使用" + core.material.items['fly'].name, 'fly'); + else if (!core.canUseItem('fly')) + core.drawTip("不知道为什么," + core.material.items['fly'].name + "在此层失效了!", 'fly'); + else { + var tmp = core.status.floorId; + if (tmp[0] == 'M' && tmp[1] == 'T' && tmp[2] >= '0' && tmp[2] <= '9') { + tmp = 'MT' + (tmp.substring(2) - (-1)); + } + else if (tmp == 'U1') tmp = 'MT0'; + else if (tmp[0] == 'U' && tmp[1] >= '0' && tmp[1] <= '9') { + tmp = 'U' + (tmp.substring(1) - 1); + } + if (!core.flyTo(tmp)) core.drawTip("您不能去该楼层!", 'fly'); + } + //core.ui._drawCursor(); break; case 84: // T:打开道具栏 core.openToolbox(true); break; - case 81: // Q:打开装备栏 - core.openEquipbox(true); + case 81: // Q:下 //打开装备栏 + if ((core.flags.flyNearStair && !core.nearStair())) + core.drawTip("必须在楼梯口才能使用" + core.material.items['fly'].name, 'fly'); + else if (!core.canUseItem('fly')) + core.drawTip("不知道为什么," + core.material.items['fly'].name + "在此层失效了!", 'fly'); + else { + var tmp = core.status.floorId; + if (tmp[0] == 'U' && tmp[1] >= '0' && tmp[1] <= '9') { + tmp = 'U' + (tmp.substring(1) - (-1)); + } + else if (tmp == 'MT0') tmp = 'U1'; + else if (tmp[0] == 'M' && tmp[1] == 'T' && tmp[2] >= '0' && tmp[2] <= '9') { + tmp = 'MT' + (tmp.substring(2) - 1); + } + if (!core.flyTo(tmp)) core.drawTip("您不能去该楼层!", 'fly'); + } + //core.openEquipbox(true); break; case 90: // Z:转向 core.turnHero(); @@ -1645,14 +1677,14 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = ctx.textAlign = 'left'; if (flags.hard - 4) fill1('[' + core.formatBigNumber(core.getRealStatus('mdef')) + ']', 76, 174, '#FF1495'); core.drawImage(ctx, core.material.images.items, 0, 0, 32, 128, 13, 300, 28, 112); - fill('黄钥匙', 50, 320, '#F0E6BC'); - fill('蓝钥匙', 50, 320 + 28, '#7FFFD4'); - fill('红钥匙', 50, 320 + 56, '#E9967A'); + fill('黄钥匙', 50, 320, '#FFFF80'); + fill('蓝钥匙', 50, 320 + 28, '#80FFFF'); + fill('红钥匙', 50, 320 + 56, '#FF8080'); fill('黑钥匙', 50, 320 + 84, '#000000'); ctx.textAlign = 'right'; - fill(core.itemCount('yellowKey'), 140, 320, '#F0E6BC'); - fill(core.itemCount('blueKey'), 140, 320 + 28, '#7FFFD4'); - fill(core.itemCount('redKey'), 140, 320 + 56, '#E9967A'); + fill(core.itemCount('yellowKey'), 140, 320, '#FFFF80'); + fill(core.itemCount('blueKey'), 140, 320 + 28, '#80FFFF'); + fill(core.itemCount('redKey'), 140, 320 + 56, '#FF8080'); fill(core.itemCount('greenKey'), 140, 320 + 84, '#000000'); core.drawImage(ctx, core.material.images.images[['00005.png','00001.png','00002.png','00003.png','00004.png','00005.png'][flags.hard || 0]], 7, 404 - [0,10,10,0,0,0][flags.hard || 0]); ctx.textAlign = 'left'; diff --git a/project/plugins.js b/project/plugins.js index 6d9f02c..2986045 100644 --- a/project/plugins.js +++ b/project/plugins.js @@ -528,6 +528,83 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = this.afterGetItem(id, x, y, isGentleClick); if (callback) callback(); } + core.enemys.getDamageString = function (enemy, x, y, floorId) { + if (typeof enemy == 'string') enemy = core.material.enemys[enemy]; + var damage = this.getDamage(enemy, x, y, floorId); + + var color = '#000000'; + + if (damage == null) { + damage = "???"; + color = '#FF2222'; + } + else { + if (damage < 0) color = '#11FF11'; + else if (damage == 0) color = '#FFFFFF'; + else if (damage < core.status.hero.hp / 3) color = '#FFFF00'; + else if (damage < core.status.hero.hp * 2 / 3) color = '#FF9933'; + else if (damage < core.status.hero.hp) color = '#FF9933'; + else color = '#FF2222'; + + damage = core.formatBigNumber(damage, true); + if (core.enemys.hasSpecial(enemy, 19)) + damage += "+"; + if (core.enemys.hasSpecial(enemy, 21)) + damage += "-"; + if (core.enemys.hasSpecial(enemy, 11)) + damage += "^"; + } + + return { + "damage": damage, + "color": color + }; + } + core.ui._drawBook_drawBackground = function () { + core.setAlpha('ui', 1); + core.setFillStyle('ui', '#000000'); + core.fillRect('ui', 0, 0, core._PX_, core._PY_); + core.drawWindowSkin('winskin.png', 'ui', 0, 0, core._PX_, core._PY_); + } + core.ui.drawFly = function (page) { + core.status.event.data = page; + var floorId = core.floorIds[page]; + var title = core.status.maps[floorId].title; + core.clearMap('ui'); + core.setAlpha('ui', 0.85); + core.fillRect('ui', 0, 0, core._PX_, core._PY_, '#000000'); + core.setAlpha('ui', 1); + core.setTextAlign('ui', 'center'); + core.fillText('ui', '楼层跳跃', core._PX_ / 2, 48, '#FFFFFF', this._buildFont(28, true)); + core.fillText('ui', '返回游戏', core._PX_ / 2, core._PY_ - 13, null, this._buildFont(15, true)) + core.setTextAlign('ui', 'right'); + core.fillText('ui', '浏览地图时也', core._PX_ - 10, core._PY_ - 23, '#aaaaaa', this._buildFont(10, false)); + core.fillText('ui', '可楼层跳跃!', core._PX_ - 10, core._PY_ - 11, null, this._buildFont(10, false)); + core.setTextAlign('ui', 'center'); + + var middle = core._PY_ / 2 + 39; + + // 换行 + var lines = core.splitLines('ui', title, 120, this._buildFont(19, true)); + var start_y = middle - (lines.length - 1) * 11; + for (var i in lines) { + core.fillText('ui', lines[i], core._PX_ - 53, start_y, '#FFFFFF', this._buildFont(17, true)); + start_y += 22; + } + if (core.actions._getNextFlyFloor(1) != page) { + core.fillText('ui', '▲', core._PX_ - 60, middle - 64, null, this._buildFont(17, false)); + core.fillText('ui', '▲', core._PX_ - 60, middle - 96); + core.fillText('ui', '▲', core._PX_ - 60, middle - 96 - 7); + } + if (core.actions._getNextFlyFloor(-1) != page) { + core.fillText('ui', '▼', core._PX_ - 60, middle + 64, null, this._buildFont(17, false)); + core.fillText('ui', '▼', core._PX_ - 60, middle + 96); + core.fillText('ui', '▼', core._PX_ - 60, middle + 96 + 7); + } + var size = 0.75; + core.strokeRect('ui', 16, 64, size * core._PX_, size * core._PY_, '#FFFFFF', 2); + core.drawThumbnail(floorId, null, { ctx: 'ui', x: 16, y: 64, size: size, damage: true, all: true }); + } }, "drawLight": function () {