From 0e175a3a2394c90bfb3c9d95da6cace58181af47 Mon Sep 17 00:00:00 2001 From: xian18 <44394537+xian18@users.noreply.github.com> Date: Sun, 18 Jun 2023 16:17:04 +0800 Subject: [PATCH] =?UTF-8?q?Critical=20Condition=EF=BC=9A#16?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 如果技能/物品设置为不暴击,那就把这次行动实际的暴击几率赋值为零 否则,实际暴击率为 攻击者暴击率 - 攻击目标暴击闪避率 --- js/plugins/SF_Objects.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/js/plugins/SF_Objects.js b/js/plugins/SF_Objects.js index e570a9d..3010efe 100644 --- a/js/plugins/SF_Objects.js +++ b/js/plugins/SF_Objects.js @@ -33,6 +33,13 @@ var SF_Plugins = SF_Plugins || {}; return this.subject().hit; }; + Game_Action.prototype.attackCritical = function (target) { + if (!this.item().damage.critical) { + return 0; + } + return this.subject().cri - target.cev; + }; + SF_Objects.Game_Action_apply = Game_Action.prototype.apply; Game_Action.prototype.apply = function (target) { if (this.isAttack() || this.isSkill()) { @@ -49,7 +56,7 @@ var SF_Plugins = SF_Plugins || {}; result.drain = this.isDrain(); if (result.isHit()) { if (this.item().damage.type > 0) { - result.critical = Math.random() < this.subject().cri - target.cev; + result.critical = Math.random() < this.attackCritical(target); var value = this.makeDamageValue(target, result.critical); this.executeDamage(target, value); }