diff --git a/src/config/base.ts b/src/config/base.ts index 8f88508..9426804 100644 --- a/src/config/base.ts +++ b/src/config/base.ts @@ -14,3 +14,11 @@ export const point_coefficients = { }; export const player_move_time = 3000; export const player_battle_time = 1000; + +export const battle_msg_types = { + attack: 'attack', + crit: 'crit', + gain: 'gain', + debuff: 'debuff', + extra: 'extra', +}; diff --git a/src/config/i18n/zh/index.ts b/src/config/i18n/zh/index.ts index 7e8e0e9..90d0f06 100644 --- a/src/config/i18n/zh/index.ts +++ b/src/config/i18n/zh/index.ts @@ -153,7 +153,7 @@ export default class Zh { saveGame = ['保存游戏(Ctrl+S)', '每5分钟会自动保存游戏一次', '游戏进度已经保存了。']; archive = ['存档管理(A)', '导入存档前请将存档内容粘贴到输入框内']; - copyArchive = ['复制存档', '已经复制存档了,建议保存到备忘录', '复制存档失败']; + copyArchive = ['复制存档', '已经复制存档了,建议保存到备忘录', '复制存档失败', '复制旧存档']; pasteArchive = ['粘贴存档', '粘贴存档内容到输入框成功', '粘贴失败']; cleanArchive = ['删除存档']; importArchive = ['导入', '导入存档成功,继续游戏吧!', '导入存档失败', '存档版本已过期,无法导入!']; diff --git a/src/config/skill/armor.ts b/src/config/skill/armor.ts index b8a9854..00fa840 100644 --- a/src/config/skill/armor.ts +++ b/src/config/skill/armor.ts @@ -19,7 +19,7 @@ export class BHXDJC extends PrePassiveSkill { takeEffect(owner: BattleRole, target: BattleRole): void { const shield = Math.ceil((owner.attr.hp * this.shieldPercentOfHp) / 100); owner.shield += shield; - owner.battleLog(replace(t('skill.bhxdjc.2'), [shield])); + owner.gainLog(replace(t('skill.bhxdjc.2'), [shield])); } } //铁壁 @@ -35,7 +35,7 @@ export class TieBi extends BuffSkill { owner.extraAttr.dmgReduc = callDmgReduc(owner.extraAttr.dmgReduc, this.dmgReduc); } log(owner: BattleRole, target: BattleRole): void { - owner.battleLog(replace(t('skill.tiebi.2'), [t(owner.type), this.dmgReduc, this.last])); + owner.gainLog(replace(t('skill.tiebi.2'), [t(owner.type), this.dmgReduc, this.last])); } } //督军的潜能 @@ -51,7 +51,7 @@ export class DuJunQianNeng extends PrePassiveSkill { } takeEffect(owner: BattleRole, target: BattleRole): void { owner.extraAttr.dmgReduc = callDmgReduc(owner.extraAttr.dmgReduc, this.dmgReduc); - owner.battleLog(replace(t('skill.dujunqianneng.2'), [this.hpPercent, this.dmgReduc])); + owner.gainLog(replace(t('skill.dujunqianneng.2'), [this.hpPercent, this.dmgReduc])); } } //金光护身 @@ -67,7 +67,7 @@ export class JinGuangHuShen extends CounterSkill { } takeEffect(owner: BattleRole, target: BattleRole): void { owner.addHp((owner.attr.hp * this.hpPercent) / 100); - owner.battleLog(replace(t('skill.jinguanghushen.2'), [this.hpPercent])); + owner.gainLog(replace(t('skill.jinguanghushen.2'), [this.hpPercent])); } } //牢不可破 diff --git a/src/config/skill/base.ts b/src/config/skill/base.ts index 3200154..c44f47a 100644 --- a/src/config/skill/base.ts +++ b/src/config/skill/base.ts @@ -1,5 +1,5 @@ import { BattleRole, callReducPercent, replace } from '@/tool'; -import { type_boss } from '@/config'; +import { battle_msg_types, type_boss } from '@/config'; import i18n from '../i18n'; import { ControlBuff } from './buff'; const { t } = i18n; @@ -139,7 +139,7 @@ export abstract class Vampire extends SufPassiveSkill { owner.addHp(sneak); if (sneak > 0) { const log = replace(t('skill.vampire.2'), [sneak]); - owner.battleLog(log); + owner.gainLog(log); } } } @@ -156,7 +156,7 @@ export abstract class Control extends ActionSkill { log = replace(t('skill.control.0'), [t(target.type), this.last]); } log = log = replace(t('skill.user'), [t(owner.type), t('skill.' + this.name + '.0')]) + log; - owner.battleLog(log); + owner.atteckLog(log); } } //主动攻击技能(普通攻击) @@ -175,7 +175,7 @@ export class Attack extends ActionSkill { 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.atteckLog(log); } } } diff --git a/src/config/skill/bracers.ts b/src/config/skill/bracers.ts index 4ff0eb5..11322f5 100644 --- a/src/config/skill/bracers.ts +++ b/src/config/skill/bracers.ts @@ -18,7 +18,7 @@ export class Xianglong extends PrePassiveSkill { takeEffect(owner: BattleRole, target: BattleRole): void { const extra = owner.extraAttr; extra.dmgPercent = callDmgPercent(extra.dmgPercent, this.dmgPercent); - owner.battleLog(replace(t('skill.xianglong.2'), [this.hpPercent, this.dmgPercent])); + owner.gainLog(replace(t('skill.xianglong.2'), [this.hpPercent, this.dmgPercent])); } } //大力丹 @@ -47,7 +47,7 @@ export class JuDu extends CounterSkill { takeEffect(owner: BattleRole, target: BattleRole): void { const judu = new KuiLan('kuilan', this.last); target.putBuff(judu); - owner.battleLog(replace(t('skill.judu.2'), [t(target.type), this.last])); + owner.gainLog(replace(t('skill.judu.2'), [t(target.type), this.last])); } } //利爪 @@ -63,6 +63,6 @@ export class LiZhao extends PrePassiveSkill { } takeEffect(owner: BattleRole, target: BattleRole): void { owner.skillPercent += this.percent; - owner.battleLog(replace(t('skill.lizhao.2'), [this.percent])); + owner.gainLog(replace(t('skill.lizhao.2'), [this.percent])); } } diff --git a/src/config/skill/buff.ts b/src/config/skill/buff.ts index 8ebe780..fa04392 100644 --- a/src/config/skill/buff.ts +++ b/src/config/skill/buff.ts @@ -151,7 +151,7 @@ export class ControlBuff extends AttackBuff { } takeEffect(owner: BattleRole): void { owner.action = null; - owner.battleLog(replace(t('skill.control.2'), [t('skill.' + this.name + '.0'), t(owner.type)])); + owner.debuffLog(replace(t('skill.control.2'), [t('skill.' + this.name + '.0'), t(owner.type)])); } } //溃烂 @@ -198,6 +198,6 @@ export class LiuXue extends AttackBuff { takeEffect(owner: BattleRole): void { const dmg = Math.ceil(owner.attr.curHp * (this.percent / 100) * this.layer); owner.addHp(-1 * dmg); - owner.battleLog(replace(t('skill.liuxue.1'), [this.layer, t(owner.type), dmg])); + owner.debuffLog(replace(t('skill.liuxue.1'), [this.layer, t(owner.type), dmg])); } } diff --git a/src/config/skill/jewelry.ts b/src/config/skill/jewelry.ts index d48dd1b..c9ded89 100644 --- a/src/config/skill/jewelry.ts +++ b/src/config/skill/jewelry.ts @@ -42,7 +42,7 @@ export class CritFear extends SufPassiveSkill { takeEffect(owner: BattleRole, target: BattleRole): void { const additional = Math.ceil((owner.atk * this.percent) / 100); target.addHp(-1 * additional); - owner.battleLog(replace(t('skill.critFear.2'), [additional])); + owner.extraDmgLog(replace(t('skill.critFear.2'), [additional])); } } //琉璃盘 @@ -75,6 +75,6 @@ export class JHSY extends CounterSkill { const reflected = Math.ceil((target.baseDmg * this.percent) / 100); target.addHp(-1 * reflected); const log = replace(t('skill.JHSY.2'), [t(owner.type), reflected]); - owner.battleLog(log); + owner.extraDmgLog(log); } } diff --git a/src/config/skill/neck.ts b/src/config/skill/neck.ts index 7da152b..e691a97 100644 --- a/src/config/skill/neck.ts +++ b/src/config/skill/neck.ts @@ -19,7 +19,7 @@ export class Duan extends SufPassiveSkill { } takeEffect(owner: BattleRole, target: BattleRole): void { target.addHp(-1 * this.dmg); - owner.battleLog(replace(st('duan.2'), [this.hpPercent, this.dmg])); + owner.extraDmgLog(replace(st('duan.2'), [this.hpPercent, this.dmg])); } } //红眼 @@ -41,7 +41,7 @@ export class HongYan extends PrePassiveSkill { if (this.trigger(owner, target)) { const additional = Math.ceil((owner.atk * this.atkPercent) / 100); target.addHp(-1 * additional); - owner.battleLog(replace(st('hongyan.2'), [this.hpPercent, additional])); + owner.extraDmgLog(replace(st('hongyan.2'), [this.hpPercent, additional])); } } } @@ -61,14 +61,14 @@ export class ShaYi extends SufPassiveSkill { takeEffect(owner: BattleRole, target: BattleRole): void { const shayi = new BaseAtkPercentBuff(this.name, this.atkPercent, 9999, this.maxLayer); owner.putBuff(shayi, this.retains); - owner.battleLog(replace(st('shayi.2'), [shayi.layer])); + owner.gainLog(replace(st('shayi.2'), [shayi.layer])); } onAtked(owner: BattleRole, target: BattleRole): void { if (target.crit) { const shayi = new BaseAtkPercentBuff(this.name, this.atkPercent, 9999, this.maxLayer); shayi.layer = -1 * this.reduc; owner.putBuff(shayi, this.retains); - owner.battleLog(replace(st('shayi.3'), [this.reduc])); + owner.debuffLog(replace(st('shayi.3'), [this.reduc])); } } } @@ -88,7 +88,7 @@ export class NuMu extends CounterSkill { takeEffect(owner: BattleRole, target: BattleRole): void { const numu = new BaseAtkPercentBuff(this.name, this.atkPercent, 9999, this.maxLayer); owner.putBuff(numu); - owner.battleLog(replace(st('numu.2'), [numu.layer])); + owner.gainLog(replace(st('numu.2'), [numu.layer])); } } //龙腾 @@ -109,7 +109,7 @@ export class LongTeng extends CounterSkill { takeEffect(owner: BattleRole, target: BattleRole): void { const shield = Math.ceil((owner.attr.hp * this.shieldPercentOfHp) / 100); owner.shield += shield; - owner.battleLog(replace(st('longteng.2'), [shield])); + owner.gainLog(replace(st('longteng.2'), [shield])); } } //幸运数字 @@ -121,7 +121,7 @@ export class XingYunShuZi extends SufPassiveSkill { } beforeBattle(owner: BattleRole, target: BattleRole): void { this.num = Math.ceil(Math.random() * 9); - owner.battleLog(replace(st('xingyunshuzi.2'), [t(owner.type), this.num])); + owner.gainLog(replace(st('xingyunshuzi.2'), [t(owner.type), this.num])); } trigger(owner: BattleRole, target: BattleRole): boolean { return this.num > 0 && owner.dmg % 10 == this.num; @@ -129,6 +129,6 @@ export class XingYunShuZi extends SufPassiveSkill { takeEffect(owner: BattleRole, target: BattleRole): void { const dmg = owner.dmg * this.num; target.addHp(-1 * dmg); - owner.battleLog(replace(st('xingyunshuzi.3'), [t(target.type), dmg])); + owner.extraDmgLog(replace(st('xingyunshuzi.3'), [t(target.type), dmg])); } } diff --git a/src/config/skill/pants.ts b/src/config/skill/pants.ts index 4d71f82..844386e 100644 --- a/src/config/skill/pants.ts +++ b/src/config/skill/pants.ts @@ -31,7 +31,7 @@ export class FuRenBiHu extends PrePassiveSkill { } takeEffect(owner: BattleRole, target: BattleRole): void { owner.extraAttr.dmgReduc = this.dmgReduc; - owner.battleLog(replace(t('skill.furenbihu.2'), [this.hpPercent, this.dmgReduc])); + owner.gainLog(replace(t('skill.furenbihu.2'), [this.hpPercent, this.dmgReduc])); } } //灵感 @@ -62,7 +62,7 @@ export class WanKang extends CounterSkill { const max = Math.ceil((owner.attr.hp * this.hpPercnet) / 100); reflected > max && (reflected = max); target.addHp(-1 * reflected); - owner.battleLog(replace(t('skill.wankang.2'), [t(owner.type), reflected])); + owner.extraDmgLog(replace(t('skill.wankang.2'), [t(owner.type), reflected])); } } //五味 diff --git a/src/config/skill/ring.ts b/src/config/skill/ring.ts index f807b2c..5813513 100644 --- a/src/config/skill/ring.ts +++ b/src/config/skill/ring.ts @@ -36,7 +36,7 @@ export class JinGangZhuo extends SufPassiveSkill { } takeEffect(owner: BattleRole, target: BattleRole): void { target.putBuff(new ControlBuff(this.name, this.last)); - owner.battleLog(replace(t('skill.jinggangzhuo.2'), [this.last])); + owner.extraDmgLog(replace(t('skill.jinggangzhuo.2'), [this.last])); } } @@ -56,10 +56,10 @@ export class FengXie extends SufPassiveSkill { const fengxie = new CritDmgBuff(this.name, this.critDmg, 9999, this.maxLayer); if (owner.crit) { owner.putBuff(fengxie); - owner.battleLog(replace(t('skill.fengxie.2'), [fengxie.layer])); + owner.gainLog(replace(t('skill.fengxie.2'), [fengxie.layer])); } else { owner.attackBuff.delete(this.name); - owner.battleLog(t('skill.fengxie.3')); + owner.debuffLog(t('skill.fengxie.3')); } } } @@ -79,7 +79,7 @@ export class ShiZhong extends CounterSkill { takeEffect(owner: BattleRole, target: BattleRole): void { const shizhong = new CritDmgReducBuff(this.name, this.critDmgReduc, 9999, this.maxLayer); owner.putBuff(shizhong); - owner.battleLog(replace(t('skill.shizhong.2'), [shizhong.layer])); + owner.gainLog(replace(t('skill.shizhong.2'), [shizhong.layer])); } } @@ -96,7 +96,7 @@ export class ShenShang extends SufPassiveSkill { } takeEffect(owner: BattleRole, target: BattleRole): void { owner.addHp(this.hp); - owner.battleLog(replace(t('skill.shenshang.2'), [this.hp])); + owner.gainLog(replace(t('skill.shenshang.2'), [this.hp])); } } @@ -113,12 +113,12 @@ export class TongJueFanJi extends CounterSkill { takeEffect(owner: BattleRole, target: BattleRole): void { if (!owner.action) { const log = replace(t('skill.tongjuefanji.3'), [t(owner.type)]); - owner.battleLog(log); + owner.debuffLog(log); return; } owner.skillPercent = this.percent; owner.callDmg(target); target.addHp(-1 * owner.dmg); - owner.battleLog(replace(t('skill.tongjuefanji.2'), [owner.dmg])); + owner.atteckLog(replace(t('skill.tongjuefanji.2'), [owner.dmg])); } } diff --git a/src/config/skill/weapon.ts b/src/config/skill/weapon.ts index 634cb7c..efef6aa 100644 --- a/src/config/skill/weapon.ts +++ b/src/config/skill/weapon.ts @@ -21,7 +21,7 @@ export class IceBlade extends SufPassiveSkill { const additional = Math.ceil((owner.atk * this.percent) / 100); target.addHp(-1 * additional); target.putBuff(new ControlBuff(this.name, this.last)); - owner.battleLog(replace(st('iceBlade.2'), [additional, t(target.type), this.last])); + owner.extraDmgLog(replace(st('iceBlade.2'), [additional, t(target.type), this.last])); } } //见红 @@ -37,7 +37,7 @@ export class SeeRed extends ActionSkill { owner.skillPercent = 0; const liuxue = new LiuXue(this.layer, this.last); target.putBuff(liuxue); - owner.battleLog(replace(st('user'), [t(owner.type), st(this.name + '.0')]) + replace(st('seeRed.1'), [this.layer, this.last])); + owner.extraDmgLog(replace(st('user'), [t(owner.type), st(this.name + '.0')]) + replace(st('seeRed.1'), [this.layer, this.last])); } } //鳍刺 @@ -55,7 +55,7 @@ export class QiCi extends SufPassiveSkill { takeEffect(owner: BattleRole, target: BattleRole): void { const liuxue = new LiuXue(this.layer, this.last); target.putBuff(liuxue); - owner.battleLog(replace(st('qici.2'), [t(target.type), this.layer, this.last])); + owner.extraDmgLog(replace(st('qici.2'), [t(target.type), this.layer, this.last])); } } //暴虐 @@ -72,7 +72,7 @@ export class BaoNue extends SufPassiveSkill { takeEffect(owner: BattleRole, target: BattleRole): void { const liuxue = new LiuXue(9999, this.last); target.putBuff(liuxue); - owner.battleLog(replace(st('baonue.2'), [t(target.type), this.last])); + owner.extraDmgLog(replace(st('baonue.2'), [t(target.type), this.last])); } } //扎心 @@ -100,7 +100,7 @@ export class AoZhiDu extends SufPassiveSkill { takeEffect(owner: BattleRole, target: BattleRole): void { const aozhidu = new KuiLan('kuilan', this.last); target.putBuff(aozhidu); - owner.battleLog(replace(st('aozhidu.2'), [t(target.type), this.last])); + owner.extraDmgLog(replace(st('aozhidu.2'), [t(target.type), this.last])); } } //十九叉 @@ -119,7 +119,7 @@ export class ShiJiuCha extends SufPassiveSkill { if (this.cout >= 10) { this.cout = 0; const dmg = owner.dmg * this.times; - owner.battleLog(replace(st('shijiucha.2'), [t(owner.type), dmg])); + owner.extraDmgLog(replace(st('shijiucha.2'), [t(owner.type), dmg])); } } } diff --git a/src/tool/caller/battle.ts b/src/tool/caller/battle.ts index 64a7cad..dbf9393 100644 --- a/src/tool/caller/battle.ts +++ b/src/tool/caller/battle.ts @@ -1,4 +1,4 @@ -import { Equip, Skills, Monster, Attribute, Player } from '@/config'; +import { Equip, Skills, Monster, Attribute, Player, battle_msg_types } from '@/config'; import { randonBootyEquip, deepCopy, replace, callReducPercent, callDmgReduc, callDmgPercent } from '@/tool'; import i18n from '@/config/i18n'; const { t } = i18n; @@ -99,8 +99,21 @@ export class BattleRole { this.initTmp(); }; - battleLog = (log: string) => { - this.commit('set_sys_info', { type: 'battle', msg: log }); + atteckLog = (log: string) => { + const type = (this.crit ? battle_msg_types.crit : battle_msg_types.attack) + '_' + this.type; + this.commit('set_sys_info', { type: type, msg: log }); + }; + gainLog = (log: string) => { + const type = battle_msg_types.gain + '_' + this.type; + this.commit('set_sys_info', { type: type, msg: log }); + }; + debuffLog = (log: string) => { + const type = battle_msg_types.debuff + '_' + this.type; + this.commit('set_sys_info', { type: type, msg: log }); + }; + extraDmgLog = (log: string) => { + const type = battle_msg_types.extra + '_' + this.type; + this.commit('set_sys_info', { type: type, msg: log }); }; addHp = (hp: number) => { diff --git a/src/views/archive.vue b/src/views/archive.vue index dc56177..f1e7853 100644 --- a/src/views/archive.vue +++ b/src/views/archive.vue @@ -3,13 +3,14 @@ - + * {{ t('archive.1') }} @@ -46,9 +47,9 @@ const showMenu = () => { } } -const copyArchive = () => { +const copyArchive = (archive) => { if (navigator.clipboard && window.isSecureContext) { - navigator.clipboard.writeText(archive.value).then(() => { + navigator.clipboard.writeText(archive).then(() => { commit('set_sys_info', { msg: t('copyArchive.1'), type: 'win' }) showMenu(); }).catch(() => { @@ -56,7 +57,7 @@ const copyArchive = () => { }); } else { const textField = document.createElement("textarea"); - textField.innerText = archive.value; + textField.innerText = archive; document.body.appendChild(textField); textField.select(); document.execCommand("copy"); @@ -66,6 +67,11 @@ const copyArchive = () => { } } +const copyOldArchive = () => { + const archive = localStorage.getItem('transmigration_game_archive') || ''; + copyArchive(archive); +} + const pasteArchive = () => { navigator.clipboard.readText().then((text) => { archive.value = text; @@ -134,7 +140,7 @@ onMounted(() => { }); } .textarea { - width: 25rem; + width: 30rem; height: 15rem; user-select: text; background: rgba($color: #ffffff, $alpha: 0.8); diff --git a/src/views/message/sys-info.vue b/src/views/message/sys-info.vue index ee3ea23..e74c521 100644 --- a/src/views/message/sys-info.vue +++ b/src/views/message/sys-info.vue @@ -71,14 +71,11 @@ a { margin-left: 0.3rem; } + .warning>.msg { color: #f90202; } -.battle>.msg { - color: #de8618; -} - .win>.msg { color: #24c4de; } @@ -92,6 +89,46 @@ a { padding-left: 0.3rem; } +.attack_player>.msg, +.extra_player>.msg { + color: #B0E0E6; +} + +.crit_player>.msg { + color: #FFD700; +} + +.gain_player>.msg { + color: #2df805; +} + +.debuff_player>.msg { + color: #489e0291; +} + +.crit_monster, +.crit_boss>.msg { + color: #ff0505; +} + +.attack_monster, +.attack_boss>.msg, +.extra_monster>.msg, +.extra_boss>.msg { + color: #ff0000a1; +} + +.gain_monster, +.gain_boss>.msg { + color: #489e0291; +} + +.debuff_monster, +.debuff_boss>.msg { + color: #2df805; +} + + @media only screen and (max-width: 768px) { .sysInfo { font-size: 0.8rem; diff --git a/src/views/shop/shop.vue b/src/views/shop/shop.vue index a1211dd..28d42be 100644 --- a/src/views/shop/shop.vue +++ b/src/views/shop/shop.vue @@ -3,7 +3,7 @@ - + {{ t('coins.0') }}:{{ coins }}