From d270760796565304ccbcf2ad3b54543ea388f07a Mon Sep 17 00:00:00 2001 From: ckcz123 Date: Tue, 5 May 2020 21:14:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86getExtraDamage=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E5=88=B0=E4=BC=A4=E5=AE=B3=E8=AE=A1=E7=AE=97=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libs/enemys.js | 31 +++++++------------------------ project/functions.js | 8 ++++++++ 2 files changed, 15 insertions(+), 24 deletions(-) diff --git a/libs/enemys.js b/libs/enemys.js index 19b500e9..0d80adfe 100644 --- a/libs/enemys.js +++ b/libs/enemys.js @@ -115,27 +115,6 @@ enemys.prototype.canBattle = function (enemy, x, y, floorId) { return damage != null && damage < core.status.hero.hp; } -////// 获得某个怪物的伤害 ////// -enemys.prototype.getDamage = function (enemy, x, y, floorId) { - if (typeof enemy == 'string') enemy = core.material.enemys[enemy]; - var damage = this._calDamage(enemy, null, x, y, floorId); - if (damage == null) return null; - return damage + this.getExtraDamage(enemy, x, y, floorId); -} - -////// 获得某个怪物的额外伤害 ////// -enemys.prototype.getExtraDamage = function (enemy, x, y, floorId) { - if (typeof enemy == 'string') enemy = core.material.enemys[enemy]; - var extra_damage = 0; - if (this.hasSpecial(enemy.special, 17)) { // 仇恨 - extra_damage += core.getFlag('hatred', 0); - } - if (this.hasSpecial(enemy.special, 22)) { // 固伤 - extra_damage += enemy.damage || 0; - } - return extra_damage; -} - enemys.prototype.getDamageString = function (enemy, x, y, floorId) { if (typeof enemy == 'string') enemy = core.material.enemys[enemy]; var damage = this.getDamage(enemy, x, y, floorId); @@ -281,8 +260,8 @@ enemys.prototype._nextCriticals_useTurn = function (enemy, info, number, x, y, f enemys.prototype.getDefDamage = function (enemy, k, x, y, floorId) { if (typeof enemy == 'string') enemy = core.material.enemys[enemy]; k = k || 1; - var nowDamage = this._calDamage(enemy, null, x, y, floorId); - var nextDamage = this._calDamage(enemy, {"def": core.status.hero.def + k}, x, y, floorId); + var nowDamage = this._getDamage(enemy, null, x, y, floorId); + var nextDamage = this._getDamage(enemy, {"def": core.status.hero.def + k}, x, y, floorId); if (nowDamage == null || nextDamage == null) return "???"; return nowDamage - nextDamage; } @@ -300,7 +279,11 @@ enemys.prototype.getDamageInfo = function (enemy, hero, x, y, floorId) { } ////// 获得在某个勇士属性下怪物伤害 ////// -enemys.prototype._calDamage = function (enemy, hero, x, y, floorId) { +enemys.prototype.getDamage = function (enemy, x, y, floorId) { + return this._getDamage(enemy, null, x, y, floorId); +} + +enemys.prototype._getDamage = function (enemy, hero, x, y, floorId) { if (typeof enemy == 'string') enemy = core.material.enemys[enemy]; var info = this.getDamageInfo(enemy, hero, x, y, floorId); diff --git a/project/functions.js b/project/functions.js index 1b007f8b..98c6c5da 100644 --- a/project/functions.js +++ b/project/functions.js @@ -768,6 +768,14 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = if (!core.flags.enableNegativeDamage) damage = Math.max(0, damage); + // 最后处理仇恨和固伤(因为这两个不能被魔防减伤) + if (core.hasSpecial(mon_special, 17)) { // 仇恨 + damage += core.getFlag('hatred', 0); + } + if (core.hasSpecial(mon_special, 22)) { // 固伤 + damage += enemy.damage || 0; + } + return { "mon_hp": Math.floor(mon_hp), "mon_atk": Math.floor(mon_atk),