diff --git a/public/img/equips/armor/东方.png b/public/img/equips/armor/东方.png new file mode 100644 index 0000000..dd34762 Binary files /dev/null and b/public/img/equips/armor/东方.png differ diff --git a/public/img/equips/armor/五行压贴.png b/public/img/equips/armor/五行压贴.png new file mode 100644 index 0000000..567eff2 Binary files /dev/null and b/public/img/equips/armor/五行压贴.png differ diff --git a/public/img/equips/armor/吞鬼甲.png b/public/img/equips/armor/吞鬼甲.png new file mode 100644 index 0000000..bd1ffca Binary files /dev/null and b/public/img/equips/armor/吞鬼甲.png differ diff --git a/public/img/equips/armor/天成.png b/public/img/equips/armor/天成.png new file mode 100644 index 0000000..be4cd01 Binary files /dev/null and b/public/img/equips/armor/天成.png differ diff --git a/public/img/equips/armor/斗融之甲.png b/public/img/equips/armor/斗融之甲.png new file mode 100644 index 0000000..a38dcae Binary files /dev/null and b/public/img/equips/armor/斗融之甲.png differ diff --git a/public/img/equips/armor/炎狱.png b/public/img/equips/armor/炎狱.png new file mode 100644 index 0000000..ff0e5b3 Binary files /dev/null and b/public/img/equips/armor/炎狱.png differ diff --git a/public/img/equips/armor/狐不归.png b/public/img/equips/armor/狐不归.png new file mode 100644 index 0000000..ece5d3c Binary files /dev/null and b/public/img/equips/armor/狐不归.png differ diff --git a/public/img/equips/armor/百花内甲.png b/public/img/equips/armor/百花内甲.png new file mode 100644 index 0000000..a5b39fc Binary files /dev/null and b/public/img/equips/armor/百花内甲.png differ diff --git a/public/img/equips/armor/美人鼓.png b/public/img/equips/armor/美人鼓.png new file mode 100644 index 0000000..6969aed Binary files /dev/null and b/public/img/equips/armor/美人鼓.png differ diff --git a/public/img/equips/armor/蝙蝠氅.png b/public/img/equips/armor/蝙蝠氅.png new file mode 100644 index 0000000..169054f Binary files /dev/null and b/public/img/equips/armor/蝙蝠氅.png differ diff --git a/public/img/equips/armor/鬼蜮焚天.png b/public/img/equips/armor/鬼蜮焚天.png new file mode 100644 index 0000000..40e6596 Binary files /dev/null and b/public/img/equips/armor/鬼蜮焚天.png differ diff --git a/public/img/equips/armor/鬼门甲.png b/public/img/equips/armor/鬼门甲.png new file mode 100644 index 0000000..f15430f Binary files /dev/null and b/public/img/equips/armor/鬼门甲.png differ diff --git a/public/img/equips/armor/鱼腹.png b/public/img/equips/armor/鱼腹.png new file mode 100644 index 0000000..b6f51a4 Binary files /dev/null and b/public/img/equips/armor/鱼腹.png differ diff --git a/public/img/equips/armor/黑犀.png b/public/img/equips/armor/黑犀.png new file mode 100644 index 0000000..cd4ebd0 Binary files /dev/null and b/public/img/equips/armor/黑犀.png differ diff --git a/public/img/equips/armor/龟纹铠.png b/public/img/equips/armor/龟纹铠.png new file mode 100644 index 0000000..2657e29 Binary files /dev/null and b/public/img/equips/armor/龟纹铠.png differ diff --git a/public/img/equips/bracers/刑枷.png b/public/img/equips/bracers/刑枷.png new file mode 100644 index 0000000..dcbe2fd Binary files /dev/null and b/public/img/equips/bracers/刑枷.png differ diff --git a/public/img/equips/pants/鬼甲.png b/public/img/equips/pants/鬼甲.png new file mode 100644 index 0000000..5490f88 Binary files /dev/null and b/public/img/equips/pants/鬼甲.png differ diff --git a/public/img/map/boos_close.png b/public/img/map/boos_close.png new file mode 100644 index 0000000..4960e0b Binary files /dev/null and b/public/img/map/boos_close.png differ diff --git a/public/img/map/boss_lava.png b/public/img/map/boss_lava.png new file mode 100644 index 0000000..fb1e82f Binary files /dev/null and b/public/img/map/boss_lava.png differ diff --git a/public/img/map/boss_warrior.png b/public/img/map/boss_warrior.png new file mode 100644 index 0000000..c55a02c Binary files /dev/null and b/public/img/map/boss_warrior.png differ diff --git a/src/config/beings.ts b/src/config/beings.ts index 59b9688..e25bd97 100644 --- a/src/config/beings.ts +++ b/src/config/beings.ts @@ -86,13 +86,12 @@ export class Monster extends Attribute { ef: number; lf: number; - constructor(lv, difficulty: string, layer?: number) { + constructor(lv, difficulty: string, layer: number) { super(); this.lv = lv; this.difficulty = difficulty; this.df = base_attr_factor[this.difficulty]; this.ef = extra_factor[difficulty]; - layer = layer || 0; this.lf = ((this.lv + layer) / this.lv) ** 2; this.callAtk(2.5); this.callHp(17); @@ -123,7 +122,7 @@ export class Monster extends Attribute { export class BossMonster extends Monster { type: string = type_boss; - constructor(lv, difficulty, layer?: number) { + constructor(lv, difficulty, layer: number) { super(lv, difficulty, layer); this.callAtk(3.5); this.callHp(31); @@ -148,23 +147,29 @@ export class Dungeon { left: string = ''; right: string = ''; top: string = ''; + layer: number; constructor(lv: number, difficulty: string, layer?: number) { this.lv = lv; this.difficulty = difficulty; - this.setDifficulty(difficulty, layer); + this.layer = layer || 0; + this.setDifficulty(difficulty); } - setDifficulty(difficulty: string, layer?: number) { + setDifficulty(difficulty: string) { const lv = this.lv; this.difficulty = difficulty; this.monsters = new Array(); for (let i = 0; i < 4; i++) { - this.monsters.push(new Monster(lv, this.difficulty, layer)); + this.monsters.push(new Monster(lv, this.difficulty, this.layer)); } - const boss = new BossMonster(lv, difficulty, layer); + const boss = new BossMonster(lv, difficulty, this.layer); this.monsters.push(boss); this.needDps = Math.ceil(lv * lv ** 1.1 * 32.5 * base_attr_factor[this.difficulty]); } + setLayer = (layer) => { + this.layer = layer; + this.setDifficulty(this.difficulty); + }; } export const createdDungeons = () => {}; diff --git a/src/config/equips/armor.ts b/src/config/equips/armor.ts index 428e43a..1fbe0de 100644 --- a/src/config/equips/armor.ts +++ b/src/config/equips/armor.ts @@ -3,7 +3,18 @@ import { qualitys, entry_initor, extra_entry_num } from './constant'; const extraEntrys = ['atk', 'hp', 'def', 'defPercent', 'hpPercent', 'dmgReduc', 'critAvoid', 'critDmgReduc']; const coefficient = { shabby: 0.7, ordinary: 1, artifact: 1.5, epic: 1.8, unique: 2, colorful: 2 }; -export const armorColorfulCategorys = []; +export const armorColorfulCategorys = [ + { + name: 'baihua', + icon: 'armor/百花内甲.png', + entry: [ + { type: 'def', valCoefficient: 1.0 }, + { type: 'hp', valCoefficient: 1.4 }, + { type: 'atk', valCoefficient: 1.4 }, + ], + skill: 'BHXDJC', + }, +]; export const armorUniqueCategorys = [ { @@ -150,7 +161,7 @@ const createBase = (quality, lv, category) => { const qualityCoefficient = coefficient[quality]; entry.push(initor(lv, qualityCoefficient, item.valCoefficient)); }); - return new EquipBase(category.name, category.icon, entry); + return new EquipBase(category.name, category.icon, entry, category.skill); }; const getCategory = (quality) => { diff --git a/src/config/equips/bracers.ts b/src/config/equips/bracers.ts index 36c634c..ed5d8cd 100644 --- a/src/config/equips/bracers.ts +++ b/src/config/equips/bracers.ts @@ -7,62 +7,14 @@ const coefficient = { shabby: 0.6, ordinary: 0.9, artifact: 1.3, epic: 1.6, uniq export const bracersColorfulCategorys = [ { - name: 'shuzhuang', - icon: 'bracers/梳妆镜.png', + name: 'xianglong', + icon: 'bracers/降龙.png', entry: [ + { type: 'critDmg', valCoefficient: 1.2 }, + { type: 'atkPercent', valCoefficient: 0.7 }, { type: 'atk', valCoefficient: 1 }, - { type: 'hp', valCoefficient: 0.7 }, - { type: 'def', valCoefficient: 0.4 }, - ], - skill: 'JHSY', - }, - { - name: 'liulipan', - icon: 'bracers/琉璃盘.png', - entry: [ - { type: 'atk', valCoefficient: 0.6 }, - { type: 'hp', valCoefficient: 1.5 }, - ], - skill: 'Liulipan', - }, - { - name: 'ghdp', - icon: 'bracers/勾魂夺魂.png', - entry: [ - { type: 'critDmg', valCoefficient: 1 }, - { type: 'crit', valCoefficient: 0.4 }, - { type: 'atk', valCoefficient: 0.5 }, - ], - skill: 'CritFear', - }, - { - name: 'youerhuan', - icon: 'bracers/白骨夫人的右耳环.png', - entry: [ - { type: 'critDmg', valCoefficient: 1.5 }, - { type: 'atk', valCoefficient: 0.8 }, - ], - skill: 'Vampire1', - }, - { - name: 'jingboyu', - icon: 'bracers/金钵盂.png', - entry: [ - { type: 'atk', valCoefficient: 0.8 }, - { type: 'hp', valCoefficient: 0.6 }, - { type: 'def', valCoefficient: 0.6 }, - ], - skill: 'Prototype', - }, - { - name: 'zijingboyu', - icon: 'bracers/紫金钵盂.png', - entry: [ - { type: 'atk', valCoefficient: 0.8 }, - { type: 'hp', valCoefficient: 0.6 }, - { type: 'def', valCoefficient: 0.6 }, ], - skill: 'Fate', + skill: 'Xianglong', }, ]; export const bracersUniqueCategorys = [ diff --git a/src/config/equips/constant.ts b/src/config/equips/constant.ts index c3104d6..5f1afc6 100644 --- a/src/config/equips/constant.ts +++ b/src/config/equips/constant.ts @@ -64,9 +64,9 @@ export const entry_initor = { return new Entry('hp', value, '+' + value, max, min); }, hpPercent: (lv: number, qualityCoefficient: number) => { - const value = Math.round((lv * 0.13 + ((Math.random() * lv) / 10 + 4)) * qualityCoefficient) || 1; - const max = Math.round((lv * 0.13 + (lv / 10 + 4)) * qualityCoefficient) || 1; - const min = Math.round((lv * 0.13 + 4) * qualityCoefficient) || 1; + const value = Math.round((lv * 0.1 + ((Math.random() * lv) / 10 + 4)) * qualityCoefficient) || 1; + const max = Math.round((lv * 0.1 + (lv / 10 + 4)) * qualityCoefficient) || 1; + const min = Math.round((lv * 0.1 + 4) * qualityCoefficient) || 1; return new Entry('hpPercent', value, '+' + value + '%', max, min); }, def: (lv: number, qualityCoefficient: number, valCoefficient?: number) => { @@ -77,9 +77,9 @@ export const entry_initor = { return new Entry('def', value, '+' + value, max, min); }, defPercent: (lv: number, qualityCoefficient: number) => { - const value = Math.round(lv * 0.1 + ((Math.random() * lv) / 10 + 4) * qualityCoefficient) || 1; - const max = Math.round(lv * 0.1 + (lv / 10 + 4) * qualityCoefficient) || 1; - const min = Math.round(lv * 0.1 + 4 * qualityCoefficient) || 1; + const value = Math.round(lv * 0.13 + ((Math.random() * lv) / 10 + 4) * qualityCoefficient) || 1; + const max = Math.round(lv * 0.13 + (lv / 10 + 4) * qualityCoefficient) || 1; + const min = Math.round(lv * 0.13 + 4 * qualityCoefficient) || 1; return new Entry('defPercent', value, '+' + value + '%', max, min); }, bloc: (lv: number, qualityCoefficient: number, valCoefficient?: number) => { @@ -97,9 +97,6 @@ export const entry_initor = { }, crit: (lv: number, qualityCoefficient: number, valCoefficient?: number) => { valCoefficient = valCoefficient || 0; - // const value = Math.round((Math.random() * 5 + 5 + 2 * valCoefficient) * qualityCoefficient) || 1; - // const max = Math.round((5 + 5 + 2 * valCoefficient) * qualityCoefficient) || 1; - // const min = Math.round((5 + 2 * valCoefficient) * qualityCoefficient) || 1; const value = Math.round(((0.5 * lv) / 100 + 0.5) * (Math.random() * 5 + 5 + 2 * valCoefficient) * qualityCoefficient) || 1; const max = Math.round(((0.5 * lv) / 100 + 0.5) * (5 + 5 + 2 * valCoefficient) * qualityCoefficient) || 1; const min = Math.round(((0.5 * lv) / 100 + 0.5) * (5 + 2 * valCoefficient) * qualityCoefficient) || 1; @@ -113,7 +110,7 @@ export const entry_initor = { return new Entry('critDmg', value, '+' + value + '%', max, min); }, dmgPercent: (lv: number, qualityCoefficient: number, valCoefficient?: number) => { - valCoefficient = valCoefficient || 0.5; + valCoefficient = valCoefficient || 1; const value = Math.round(((Math.random() + 1) * lv * 0.08 + 3) * valCoefficient * qualityCoefficient) || 1; const max = Math.round((lv * 0.16 + 3) * valCoefficient * qualityCoefficient) || 1; const min = Math.round((lv * 0.08 + 3) * valCoefficient * qualityCoefficient) || 1; diff --git a/src/config/i18n/zh/euips.ts b/src/config/i18n/zh/euips.ts index e66f95c..4929a2a 100644 --- a/src/config/i18n/zh/euips.ts +++ b/src/config/i18n/zh/euips.ts @@ -53,6 +53,21 @@ export const weapon = { }; export const armor = { type: '防具', + baihua: ['百花内甲', '内甲缝着一个香囊,本有百花香,如今只余勿忘我。'], + bianfu: ['蝙蝠氅', '穿上它,你能在一秒钟内分辨二百五十组回音。'], + dongfang: ['东方', '陆吾时常遥望东方,没有人知道他看到了什么。'], + dourong: ['斗融之甲', '它的主人最后成了一条龙的食物。'], + guiwen: ['龟纹铠', '督军穿上这件铠甲后觉得自己有了顶撞正妻的勇气,时候证明是幻觉。'], + guimen: ['鬼门甲', '不要妄图破坏它,它曾经是冥界之门的一部分。'], + gyft: ['鬼蜮焚天', '三途河岸那魅惑者亡灵、怒火焚天的红花。'], + heixi: ['黑犀', '本是七星剑的剑鞘,被小妖偷来做成了皮甲一副,冬暖夏凉。'], + hubugui: ['狐不归', '刀锋冷,映月辉;世情浊,胡不归?'], + meirengu: ['美人鼓', '白骨夫人曾鼓与花果山以壮百万妖君,声阙五百里'], + tiancheng: ['天成', '石像天成,好事者略施雕琢。'], + tungui: ['吞鬼甲', '执搏挫锐,噬食鬼魅。画虎于门,鬼不敢入。'], + wuxing: ['五行压贴', '除了玄奘,谁都不准动!'], + yanyu: ['炎狱', '穿在身上全身毛孔都要冒烟了。'], + yufu: ['鱼腹', '藏玉泥中,匿珪鱼腹'], dispute: ['争执连身衣', '争执连身衣'], jianHao: ['剑豪盔甲', '剑豪盔甲'], samurai: ['隐武士铠甲', '隐武士铠甲'], @@ -122,6 +137,7 @@ export const quality = { }; export const pants = { type: '裤子', + guijia: ['鬼甲', '据说是由鬼魂的怨念凝聚而成。'], baizhequn: ['荃英的百褶裙', '每一个褶子里,都是荃英的心血。'], yulan: ['鱼篮', '观世音菩萨在紫竹林以六十二亿根竹篾编织而成。'], mhlg: ['梦回龙宫', '沧海离歌一阕悲,梦里龙宫几度回。'], @@ -150,6 +166,8 @@ export const shoes = { initial: ['新手鞋子', '新手菜鸡使用的破旧鞋子'], }; export const bracers = { + type: '护腕', + xingjia: ['刑枷', '我无法为野心套上邢枷,所以只好走向毁灭。'], xuedun: ['毒蛇', '即使血是冷的,但你又怎知它不向往温暖。'], xianglong: ['降龙', '见龙在田,利见大人。'], huojing: ['火晶环', '闻上去有股老君八卦炉中单屑的味道。'], diff --git a/src/config/i18n/zh/skills.ts b/src/config/i18n/zh/skills.ts index a1efdbf..ec7f4df 100644 --- a/src/config/i18n/zh/skills.ts +++ b/src/config/i18n/zh/skills.ts @@ -8,6 +8,12 @@ export const iceBlade = ['冰刃', '暴击时有${0}几率释放冰线冲击,附 export const seeRed = ['见红', '造成${0}%攻击力的基础伤害,冷却${1}回合。']; export const qici = ['鳍刺', '攻击时有${0}%概率对目标造成流血,持续${1}回合。']; +export const bhxdjc = [ + '百花羞的矜持', + '当生命值低于${0}%时,获得自身最大生命值${1}%的护盾(护盾能吸收等额伤害,但是每回合自然衰减10%),此效果每场战斗只能触发一次。', + '触发百花羞得矜持,获得${0}点护盾。', +]; + export const fate = ['化缘', '副本掉落金币奖励提高${0}%。']; export const vampire = ['汲血', '生命偷取${0}%。', '触发汲血,偷取${0}点生命']; export const prototype = ['现原形', '将目标变为猴子,持续${0}回合,冷却${1}回合,对boss只有${2}%成功率。']; @@ -15,3 +21,5 @@ export const attack = ['普通攻击', '造成100%攻击力的基础伤害', '${ export const critFear = ['暴击恐惧', '暴击时附加${0}%攻击力的额外伤害。', '触发暴击恐惧,附加${0}点伤害']; export const liulipan = ['琉璃盘', '使用后产生黑红内丹,临时提高${0}点基础攻击力进行攻击,冷却${1}回合。']; export const JHSY = ['镜花水月', '受到伤害时有${0}%概率反弹${1}%所受伤害。', '${0}触发了镜花水月,反弹${1}点伤害']; + +export const xianglong = ['降龙', '攻击时,若生命值低于${0}%,增加${1}%伤害加成。', '触发降龙,增加${1}%伤害加成。']; diff --git a/src/config/skill/armor.ts b/src/config/skill/armor.ts new file mode 100644 index 0000000..903fd00 --- /dev/null +++ b/src/config/skill/armor.ts @@ -0,0 +1,23 @@ +import { CounterSkill, Attack, Control, GainsSkill, SufPassiveSkill, Vampire, PrePassiveSkill } from './base'; +import i18n from '../i18n'; +import { BattleRole, replace } from '@/tool'; +const { t } = i18n; + +export class BHXDJC extends PrePassiveSkill { + name: string = 'bhxdjc'; + hpPercent: number = 60; + shieldPercentOfHp: number = 80; + triggered: boolean = false; + desc(): string { + return replace(t('skill.bhxdjc.1'), [this.hpPercent, this.shieldPercentOfHp]); + } + trigger(owner: BattleRole, target: BattleRole): boolean { + return !this.triggered && owner.attr.curHp / owner.attr.hp < this.hpPercent / 100; + } + takeEffect(owner: BattleRole, target: BattleRole): void { + this.triggered = true; + owner.shield = Math.ceil((owner.attr.hp * this.shieldPercentOfHp) / 100); + const log = replace(t('skill.bhxdjc.2'), [owner.shield]); + owner.battleLog(log); + } +} diff --git a/src/config/skill/base.ts b/src/config/skill/base.ts index 8a3f1dd..3274749 100644 --- a/src/config/skill/base.ts +++ b/src/config/skill/base.ts @@ -156,36 +156,18 @@ export class Attack extends ActionSkill { order: number = 999; name: string = 'attack'; cd: number = 1; - extraAtk = 0; precent: number = 100; desc(): string { return t('skill.attack.1'); } use(owner: BattleRole, target: BattleRole) { - if (owner.control > 0) { - const log = replace(t('skill.control.3'), [t(owner.type), owner.control]); + owner.extraAttr.baseAtk += (owner.attr.baseAtk * (this.precent - 100)) / 100; + owner.callDmg(target); + let critLog = owner.crit ? t('skill.crit.0') : ''; + if (owner.dmg) { + target.addHp(-1 * owner.dmg); + const log = replace(t('skill.attack.2'), [t(owner.type), t('skill.' + this.name + '.0'), t(target.type), owner.dmg, critLog]); owner.battleLog(log); - owner.control--; - return; - } - const attr = owner.attr; - const baseAtk = attr.baseAtk + this.extraAtk; - let dmg = ((baseAtk * (1 + attr.atkPercent / 100) * this.precent) / 100) * (1 + attr.dmgPercent / 100); - // const reducPercent = callReducPercent(target.attr.def); - const reducPercent = target.attr.reducPercent; - dmg = dmg * (1 - reducPercent) * (1 - target.attr.dmgReduc / 100) - target.attr.bloc; - owner.crit = Math.random() < (owner.attr.crit - target.attr.critAvoid) / 100; - let critLog = ''; - if (owner.crit) { - let critDmg = owner.attr.critDmg - target.attr.critDmgReduc; - critDmg < 100 ? 100 : critDmg; - dmg *= critDmg / 100; - critLog = t('skill.crit.0'); } - dmg = dmg < 1 ? 1 : dmg; - owner.dmg = Math.ceil(dmg); - target.addHp(-1 * owner.dmg); - const log = replace(t('skill.attack.2'), [t(owner.type), t('skill.' + this.name + '.0'), t(target.type), owner.dmg, critLog]); - owner.battleLog(log); } } diff --git a/src/config/skill/bracers.ts b/src/config/skill/bracers.ts new file mode 100644 index 0000000..bd29c29 --- /dev/null +++ b/src/config/skill/bracers.ts @@ -0,0 +1,24 @@ +import { CounterSkill, Attack, Control, GainsSkill, SufPassiveSkill, Vampire, PrePassiveSkill } from './base'; +import i18n from '../i18n'; +import { BattleRole, replace } from '@/tool'; +const { t } = i18n; + +export class Xianglong extends PrePassiveSkill { + name: string = 'xianglong'; + hpPercent: number = 30; + dmgPercent: number = 100; + last: number = 1; + desc(): string { + return replace(t('skill.xianglong.1'), [this.hpPercent, this.dmgPercent]); + } + trigger(owner: BattleRole, target: BattleRole): boolean { + console.log(owner.attr.curHp / owner.attr.hp); + return owner.attr.curHp / owner.attr.hp < this.hpPercent / 100; + } + takeEffect(owner: BattleRole, target: BattleRole): void { + const extra = owner.extraAttr; + extra.dmgPercent = Math.ceil((100 + extra.dmgPercent) * (1 + this.dmgPercent / 100) - 100); + const log = replace(t('skill.xianglong.2'), [this.hpPercent, this.dmgPercent]); + owner.battleLog(log); + } +} diff --git a/src/config/skill/index.ts b/src/config/skill/index.ts index 4cf5db5..db08774 100644 --- a/src/config/skill/index.ts +++ b/src/config/skill/index.ts @@ -1,3 +1,5 @@ export * from './base'; export * from './weapon'; export * from './jewelry'; +export * from './bracers'; +export * from './armor'; diff --git a/src/config/skill/jewelry.ts b/src/config/skill/jewelry.ts index 13b9ae3..7bb68bc 100644 --- a/src/config/skill/jewelry.ts +++ b/src/config/skill/jewelry.ts @@ -58,7 +58,7 @@ export class Liulipan extends Attack { return replace(t('skill.liulipan.1'), [(this.lv || 1) * this.atk, this.cd]); } beforeAtk(owner: BattleRole, target: BattleRole): void { - this.extraAtk = (this.lv || 1) * this.atk; + owner.extraAttr.baseAtk += (this.lv || 1) * this.atk; super.beforeAtk(owner, target); } } diff --git a/src/tool/caller/attribute.ts b/src/tool/caller/attribute.ts index 1b08c11..01bb8a1 100644 --- a/src/tool/caller/attribute.ts +++ b/src/tool/caller/attribute.ts @@ -46,7 +46,7 @@ export const callPlayerAttribute = (player: Player, rA: any) => { }); //计算秒伤 const atk = attribute.atk, - crit = attribute.crit / 100, + crit = (attribute.crit > 100 ? 100 : attribute.crit) / 100, critdmg = attribute.critDmg / 100, dmgPercent = attribute.dmgPercent / 100; attribute.dps = Math.ceil((1 - crit + crit * critdmg) * atk * (1 + dmgPercent)); diff --git a/src/tool/caller/battle.ts b/src/tool/caller/battle.ts index d57c7ea..dc7e4a6 100644 --- a/src/tool/caller/battle.ts +++ b/src/tool/caller/battle.ts @@ -1,5 +1,5 @@ import { Equip, Skills, Monster, Attribute, Player } from '@/config'; -import { randonBootyEquip, deepCopy } from '@/tool'; +import { randonBootyEquip, deepCopy, replace, callReducPercent } from '@/tool'; import i18n from '@/config/i18n'; const { t } = i18n; @@ -14,14 +14,27 @@ export class BattleRole { action: Skills.ActionSkill | null = null; dmg: number = 0; crit: boolean = false; + extraAttr: Attribute = new Attribute(); + shield: number = 0; constructor(attr: Attribute, commit, type: string) { this.attr = attr; this.commit = commit; this.type = type; this.addSkill(attr.skill); //添加默认主动技能普通攻击 + this.initTmp(); } + initTmp = () => { + this.action = null; + this.dmg = 0; + this.crit = false; + this.extraAttr = new Attribute(); + this.extraAttr.hp = 0; + this.extraAttr.critDmg = 0; + this.shield = Math.ceil(this.shield * 0.9); + }; + addSkill = (skillName, lv?) => { lv = lv || 1; const skills = createSkill(skillName, lv); @@ -63,9 +76,7 @@ export class BattleRole { //触发攻击目标的反制技能 target.onAttacked(this); //初始化临时状态 - this.action = null; - this.dmg = 0; - this.crit = false; + this.initTmp(); }; onAttacked = (target: BattleRole) => { @@ -80,6 +91,15 @@ export class BattleRole { }; addHp = (hp: number) => { + if (hp < 0 && this.shield > 0) { + if (this.shield > -1 * hp) { + this.shield += hp; + return; + } else { + hp += this.shield; + this.shield = 0; + } + } if (this.type == 'player') { this.commit('add_player_curhp', hp); } else { @@ -100,11 +120,36 @@ export class BattleRole { isDeath = () => { return this.attr.curHp <= 0; }; + + callDmg = (target: BattleRole) => { + if (this.control > 0) { + const log = replace(t('skill.control.3'), [t(this.type), this.control]); + this.battleLog(log); + this.control--; + return; + } + const attr = this.attr; + const extra = this.extraAttr; + const baseAtk = attr.baseAtk + extra.baseAtk; + const atkPercent = 1 + (attr.atkPercent + extra.atkPercent) / 100; + const dmgPercent = (1 + attr.dmgPercent / 100) * (1 + extra.dmgPercent / 100); + let dmg = baseAtk * atkPercent * dmgPercent; + const reducPercent = callReducPercent(target.attr.def + target.extraAttr.def); + dmg = dmg * (1 - reducPercent) * (1 - target.attr.dmgReduc / 100) - target.attr.bloc; + this.crit = Math.random() < (attr.crit - target.attr.critAvoid) / 100; + if (this.crit) { + let critDmg = attr.critDmg - target.attr.critDmgReduc; + critDmg < 100 ? 100 : critDmg; + dmg *= critDmg / 100; + } + dmg = dmg <= 0 ? 1 : dmg; + this.dmg = Math.ceil(dmg); + }; } export const createBattleRole = (player: Player, monster: Monster, commit) => { const playerRole = new BattleRole(player.attribute, commit, 'player'); - const palyerEquips = [player.weapon, player.armor, player.neck, player.ring, player.jewelry]; + const palyerEquips = [player.weapon, player.armor, player.neck, player.ring, player.jewelry, player.pants, player.shoes, player.bracers]; palyerEquips.forEach((equip) => { equip && playerRole.addSkill(equip.base.skill); }); diff --git a/src/views/backpack/auto-sell.vue b/src/views/backpack/auto-sell.vue index 8cbcba3..631b8d2 100644 --- a/src/views/backpack/auto-sell.vue +++ b/src/views/backpack/auto-sell.vue @@ -13,12 +13,14 @@ - -