diff --git a/public/img/attribute/critAvoid.png b/public/img/attribute/critAvoid.png new file mode 100644 index 0000000..3f743eb Binary files /dev/null and b/public/img/attribute/critAvoid.png differ diff --git a/public/img/attribute/critDmgReduc.png b/public/img/attribute/critDmgReduc.png new file mode 100644 index 0000000..319f1f6 Binary files /dev/null and b/public/img/attribute/critDmgReduc.png differ diff --git a/public/img/attribute/dmgReduc.png b/public/img/attribute/dmgReduc.png new file mode 100644 index 0000000..c8085a0 Binary files /dev/null and b/public/img/attribute/dmgReduc.png differ diff --git a/public/img/attribute/破甲.png b/public/img/attribute/破甲.png new file mode 100644 index 0000000..2db8c81 Binary files /dev/null and b/public/img/attribute/破甲.png differ diff --git a/public/img/attribute/防御降低.png b/public/img/attribute/防御降低.png new file mode 100644 index 0000000..b71ba19 Binary files /dev/null and b/public/img/attribute/防御降低.png differ diff --git a/src/config/assets.ts b/src/config/assets.ts index 0c4ab29..2714b0e 100644 --- a/src/config/assets.ts +++ b/src/config/assets.ts @@ -30,6 +30,8 @@ export const attr_icon_urls = { def: root + '/img/attribute/icon_11.png', eva: root + '/img/attribute/S_EVA.png', bloc: root + '/img/attribute/S_BLOC.png', + critAvoid: root + '/img/attribute/critAvoid.png', + critDmgReduc: root + '/img/attribute/critDmgReduc.png', recoverSpeed: root + '/img/attribute/recover.png', moveSpeed: root + '/img/attribute/S_EVA.png', battleSpeed: root + '/img/attribute/S_EVA.png', diff --git a/src/config/base.ts b/src/config/base.ts index 47d214d..8f88508 100644 --- a/src/config/base.ts +++ b/src/config/base.ts @@ -1,16 +1,14 @@ -import { Player, RebornPoints } from './beings'; -import { Equip } from './equips'; - export const backpack_num = 32; -export const reborn_arrts = ['hp', 'atk', 'crit', 'critDmg', 'def', 'bloc', 'recoverSpeed', 'moveSpeed', 'battleSpeed']; -export const reborn_point_coefficients = { +export const piont_arrts = ['hp', 'atk', 'crit', 'critDmg', 'def', 'bloc', 'critAvoid', 'critDmgReduc', 'moveSpeed', 'battleSpeed']; +export const point_coefficients = { hp: 10, atk: 3, crit: 0.1, critDmg: 1, def: 2, bloc: 2, - recoverSpeed: 4, + critAvoid: 0.1, + critDmgReduc: 1, moveSpeed: 3, battleSpeed: 4, }; diff --git a/src/config/beings.ts b/src/config/beings.ts index 3b0eb3c..b0df758 100644 --- a/src/config/beings.ts +++ b/src/config/beings.ts @@ -1,4 +1,15 @@ -import { initialWeapon, initialArmor, initialNeck, initialRing, initialJewelry, initialpants, initialshoes, initialbracers, Equip } from '@/config'; +import { + initialWeapon, + initialArmor, + initialNeck, + initialRing, + initialJewelry, + initialpants, + initialshoes, + initialbracers, + Equip, + piont_arrts, +} from '@/config'; export const type_monster = 'monster'; export const type_boss = 'boss'; export const difficultys = ['normal', 'hard', 'pain', 'xiaomi', 'dami']; @@ -32,15 +43,13 @@ export class Attribute { dps: number = 0; skill: string = 'Attack'; - constructor(ra?: RebornAttribute) { - if (ra) { - this.hp += ra.hp; - this.atk += ra.atk; - this.def += ra.def; - this.bloc += ra.bloc; - this.crit += ra.crit; - this.critDmg += ra.critDmg; - this.moveSpeed += ra.moveSpeed; + constructor(base?: Attribute) { + if (base) { + piont_arrts.forEach((attr) => { + if (this[attr] != undefined) { + this[attr] += base[attr]; + } + }); } } } @@ -60,21 +69,16 @@ export class Player { attribute: Attribute = new Attribute(); } -export class RebornAttribute { +export class BaseAttribute extends Attribute { + curHp: number = 0; hp: number = 0; - atk: number = 0; - crit: number = 0; critDmg: number = 0; - def: number = 0; - bloc: number = 0; - recoverSpeed: number = 0; - moveSpeed: number = 0; battleSpeed: number = 0; } -export class RebornPoints extends RebornAttribute { - count: number = 0; - points: number = 0; +export class Points extends BaseAttribute { + total: number = 0; + has: number = 0; } export class Monster extends Attribute { @@ -150,6 +154,7 @@ export class Dungeon { right: string = ''; top: string = ''; layer: number; + points: number = 0; constructor(lv: number, difficulty: string, layer?: number) { this.lv = lv; @@ -166,6 +171,7 @@ export class Dungeon { } const boss = new BossMonster(lv, difficulty, this.layer); this.monsters.push(boss); + this.points = Math.floor(boss.ef * boss.lf); this.needDps = Math.ceil(lv * lv ** 1.1 * 32.5 * base_attr_factor[this.difficulty]); } setLayer = (layer) => { diff --git a/src/config/i18n/index.ts b/src/config/i18n/index.ts index bda7dac..11cb253 100644 --- a/src/config/i18n/index.ts +++ b/src/config/i18n/index.ts @@ -1,4 +1,4 @@ -import { createI18n } from 'vue3-i18n'; +import { createI18n, I18nInstance } from 'vue3-i18n'; import Zh from './zh'; import En from './en'; @@ -11,4 +11,18 @@ const i18n = createI18n({ messages, }); -export default i18n +export const createt = (sufix: string) => { + return (key: string): string => { + key = sufix + key; + return i18n.t(key); + }; +}; + +// export class Myi18n { +// mt: (key: string) => string; +// constructor(sufix: string) { +// this.mt = +// } +// } + +export default i18n; diff --git a/src/config/i18n/zh/index.ts b/src/config/i18n/zh/index.ts index 5f72694..613f85c 100644 --- a/src/config/i18n/zh/index.ts +++ b/src/config/i18n/zh/index.ts @@ -1,5 +1,6 @@ import { weapon, armor, neck, ring, jewelry, pants, shoes, bracers, quality, extraQuality } from './euips'; import * as skills from './skills'; +import * as point from './point'; export default class Zh { title = '挂机放置游戏'; @@ -29,6 +30,8 @@ export default class Zh { extraQuality = extraQuality; skill = skills; + point = point; + lv = '等级'; reborn = ['转生次数', '玩家当前等级与转生次数', '成功挑战首领时会提升等级', '超过30级时可以转生获取更强力的初始属性']; hp = ['生命值', '当前生命值/最大生命值', '每秒会回复2%的最大生命值']; diff --git a/src/config/i18n/zh/point.ts b/src/config/i18n/zh/point.ts new file mode 100644 index 0000000..686cbab --- /dev/null +++ b/src/config/i18n/zh/point.ts @@ -0,0 +1,10 @@ +export const menu = '属性加点(P)'; +export const desc = ['每升级获得1属性点', '满级后通关小秘境和大秘境可以获取属性点', '最多可获取2000属性点']; +export const total = '已获得属性点:'; +export const has = '可用属性点:'; +// canGetPoint = '现在转生可以获得转生点数:'; +// rebornConfirm = '确认转生'; +// rebornLvTip = '等级这么低就先别转了吧,超过lv30再来看看'; +// rebornComfirm = ['你将获得${points}转生点数,同时你的金币和装备都会消失且等级变为1级。', '转了转了', '算了']; +// addPoints = '左键加+1,右键+10'; +// subtractPoints = '左键-1,右键-10'; diff --git a/src/store/action.ts b/src/store/action.ts index ac8a07a..9c2fd2a 100644 --- a/src/store/action.ts +++ b/src/store/action.ts @@ -87,13 +87,13 @@ const loadArchive = (commit, data) => { commit('set_sys_info', { msg: t('loadError'), type: 'warning' }); } else { commit('set_player_equips', data.equips); - commit('set_player_lv', data.lv || 1); commit('set_player_layer', data.layer || 1); commit('set_player_coins', data.coins || 0); commit('set_backpack', data.grid); commit('set_auto_sell', data.autoSell); commit('set_shop', data.shop); - commit('set_reborn_points', data.reborn); + commit('set_points', data.points); + commit('set_player_lv', data.lv || 1); commit('set_sys_info', { msg: t('loadSuccess'), type: 'win' }); } commit('call_player_attribute'); diff --git a/src/store/mutation.ts b/src/store/mutation.ts index 2dd6623..954cd64 100644 --- a/src/store/mutation.ts +++ b/src/store/mutation.ts @@ -1,9 +1,9 @@ import { callPlayerAttribute, conisOfsell, getArrayEmptyIdx, callEuqipTipsLocation } from '@/tool'; -import { reborn_point_coefficients, reborn_arrts, i18n } from '@/config'; +import { i18n, piont_arrts, point_coefficients } from '@/config'; const { t } = i18n; export const call_player_attribute = (state) => { - callPlayerAttribute(state.playerAttribute, state.rebornAttribute); + callPlayerAttribute(state.playerAttribute, state.baseAttribute); }; export const set_player_equips = (state, equips) => { if (equips && equips.length > 0) { @@ -84,19 +84,35 @@ export const set_player_lv = (state, data) => { data = data < 1 ? 1 : data; state.playerAttribute.lv = data; state.playerAttribute.attribute.lv = data; + const total = state.points.total; + if (total < data) { + const add = data - total; + add_point(state, add); + } }; export const set_player_layer = (state, data) => { data = parseInt(data); data = data < 1 ? 1 : data; state.playerAttribute.layer = data; }; -export const set_reborn_points = (state, rebornPoints) => { - state.rebornPoints = rebornPoints; - const rebornAttribute = {}; - reborn_arrts.forEach((attr) => { - rebornAttribute[attr] = rebornPoints[attr] * reborn_point_coefficients[attr]; +export const add_point = (state, add) => { + const total = state.points.total; + if (total >= 2000) { + return; + } + if (total + add > 2000) { + add = 2000 - total; + } + state.points.total += add; + state.points.has += add; +}; +export const set_points = (state, points) => { + state.points = points; + const baseAttribute = {}; + piont_arrts.forEach((attr) => { + baseAttribute[attr] = points[attr] * point_coefficients[attr]; }); - state.rebornAttribute = rebornAttribute; + state.baseAttribute = baseAttribute; call_player_attribute(state); }; export const add_player_curhp = (state, hp) => { diff --git a/src/store/state.ts b/src/store/state.ts index 3580af3..00dcbe5 100644 --- a/src/store/state.ts +++ b/src/store/state.ts @@ -1,4 +1,4 @@ -import { i18n, RebornAttribute, RebornPoints, Player } from '@/config'; +import { i18n, Player, Points, BaseAttribute } from '@/config'; const { t } = i18n; @@ -16,8 +16,8 @@ export default { tipsStyle: {}, tipsStyle2: {}, }, - rebornAttribute: new RebornAttribute(), - rebornPoints: new RebornPoints(), + points: new Points(), + baseAttribute: new BaseAttribute(), grid: new Array(32), autoSell: [], playerAttribute: new Player(), diff --git a/src/tool/archive.ts b/src/tool/archive.ts index 871b5e8..18db076 100644 --- a/src/tool/archive.ts +++ b/src/tool/archive.ts @@ -1,4 +1,4 @@ -import { Equip, Player, RebornPoints } from '@/config'; +import { Equip, Player, Points } from '@/config'; import { getFromStore, insertToStore, store_name_archive } from './IndexedDB'; import { uuid } from './random'; const archive_version = '1.0'; @@ -13,9 +13,9 @@ export class GameArchive { grid: any[]; autoSell: string[]; shop: any[]; - reborn: RebornPoints; + points: Points; - constructor(player: Player, grid: any[], autoSell: any[], shop: any[], reboren: RebornPoints) { + constructor(player: Player, grid: any[], autoSell: any[], shop: any[], points: Points) { this.version = archive_version; this.equips = [player.weapon, player.armor, player.ring, player.neck, player.jewelry, player.pants, player.shoes, player.bracers]; this.lv = player.lv; @@ -24,12 +24,12 @@ export class GameArchive { this.grid = grid; this.autoSell = autoSell; this.shop = shop; - this.reborn = reboren; + this.points = points; } } export const saveArchive = (state) => { - const archive = new GameArchive(state.playerAttribute, state.grid, state.autoSell, state.shop, state.rebornPoints); + const archive = new GameArchive(state.playerAttribute, state.grid, state.autoSell, state.shop, state.points); getFromStore(store_name_archive, archive_version_strengthen).then((flag: any) => { const time = new Date().getTime(); if (!flag || !flag.time || flag.time + 10 * 60 * 1000 < time) { diff --git a/src/tool/caller/attribute.ts b/src/tool/caller/attribute.ts index cffdada..3dbf3fd 100644 --- a/src/tool/caller/attribute.ts +++ b/src/tool/caller/attribute.ts @@ -6,13 +6,13 @@ import { deepCopy } from '.'; * @param player 角色 * @param rA 转生属性 */ -export const callPlayerAttribute = (player: Player, rA: any) => { +export const callPlayerAttribute = (player: Player, base: any) => { const equips = [player.weapon, player.armor, player.neck, player.ring, player.jewelry, player.pants, player.shoes, player.bracers]; const curHp = player.attribute.curHp, hp = player.attribute.hp; const hpP = hp > 0 ? curHp / hp : 1; - const attribute: Attribute = new Attribute(rA); + const attribute: Attribute = new Attribute(base); const entry = new Array(); equips.forEach((equip) => { equip && Array.prototype.push.apply(entry, equip.extraEntry); diff --git a/src/views/backpack/player.vue b/src/views/backpack/player.vue index 070411c..74e718e 100644 --- a/src/views/backpack/player.vue +++ b/src/views/backpack/player.vue @@ -2,7 +2,7 @@