Browse Source

攻击时新增伤害随机系数

v1.0
许孟阳 1 week ago
parent
commit
3b24316a1c
  1. 7
      src/tool/caller/battle.ts

7
src/tool/caller/battle.ts

@ -149,7 +149,8 @@ export class BattleRole { @@ -149,7 +149,8 @@ export class BattleRole {
const atkPercent = 1 + (attr.atkPercent + extra.atkPercent) / 100; //攻击加成
this.atk = baseAtk * atkPercent; //回合最终攻击力
const dmgPercent = callDmgPercent(attr.dmgPercent, extra.dmgPercent) / 100; //伤害加成
this.baseDmg = this.atk * (1 + dmgPercent) * (this.skillPercent / 100); //造成伤害
const factor = Math.random() * 0.1 + 0.95; //伤害随机系数
this.baseDmg = this.atk * (1 + dmgPercent) * (this.skillPercent / 100) * factor; //造成伤害
const crit = attr.crit + extra.crit - target.attr.critAvoid - target.extraAttr.critAvoid; //最终暴击率
this.crit = Math.random() < crit / 100;
if (this.crit) {
@ -161,8 +162,8 @@ export class BattleRole { @@ -161,8 +162,8 @@ export class BattleRole {
const dmgReduc = callDmgReduc(target.attr.dmgReduc, target.extraAttr.dmgReduc); //目标伤害减免
const takeDmgPercent = (1 - reducPercent) * (1 - dmgReduc / 100); //目标承受伤害比例
const bloc = target.attr.bloc + target.extraAttr.bloc; //目标格挡值
this.dmg = Math.ceil(this.baseDmg * takeDmgPercent - bloc); //目标承受伤害
this.dmg < 1 && (this.dmg = 1);
const dmg = Math.ceil(this.baseDmg * takeDmgPercent - bloc); //目标承受伤害
this.dmg = dmg < 1 ? 1 : dmg;
};
putBuff(buff: Skills.Buff) {

Loading…
Cancel
Save