This commit is contained in:
2025-03-30 14:47:54 +08:00
parent ec261a1c3d
commit 5811c18fd7
11 changed files with 228 additions and 59 deletions
+22 -44
View File
@@ -134,6 +134,8 @@ class Character:
# self.equs = get_equ(self.equVersion) # self.equs = get_equ(self.equVersion)
self.STR = 0 self.STR = 0
self.INT = 0 self.INT = 0
self.Spirit = 0
self.Vitality = 0
self.AtkP = 0 self.AtkP = 0
self.AtkM = 0 self.AtkM = 0
self.AtkI = 0 self.AtkI = 0
@@ -287,9 +289,9 @@ class Character:
self.AtkP += 物攻 + kwargs.get('AtkP', 0) + 三攻 self.AtkP += 物攻 + kwargs.get('AtkP', 0) + 三攻
self.AtkM += 魔攻 + kwargs.get('AtkM', 0) + 三攻 self.AtkM += 魔攻 + kwargs.get('AtkM', 0) + 三攻
self.AtkI += 独立 + kwargs.get('AtkI', 0) + 三攻 self.AtkI += 独立 + kwargs.get('AtkI', 0) + 三攻
self.PAtkP *= kwargs.get('PAtkP', 0) self.PAtkP *= kwargs.get('PAtkP', 1.0)
self.PAtkM *= kwargs.get('PAtkM', 0) self.PAtkM *= kwargs.get('PAtkM', 1.0)
self.PAtkI *= kwargs.get('PAtkI', 0) self.PAtkI *= kwargs.get('PAtkI', 1.0)
for elem in ['火', '冰', '光', '暗']: for elem in ['火', '冰', '光', '暗']:
self.ElementA[elem] = kwargs.get(f'{elem}属性攻击', False) or kwargs.get('ElementA', {}).get(elem, False) or self.ElementA[elem] self.ElementA[elem] = kwargs.get(f'{elem}属性攻击', False) or kwargs.get('ElementA', {}).get(elem, False) or self.ElementA[elem]
self.ElementDB[elem] += kwargs.get(f'{elem}强', 0) + kwargs.get('ElementDB', {}).get(elem, 0) + kwargs.get('全属强', 0) self.ElementDB[elem] += kwargs.get(f'{elem}强', 0) + kwargs.get('ElementDB', {}).get(elem, 0) + kwargs.get('全属强', 0)
@@ -351,7 +353,7 @@ class Character:
self.charEquipInfo[key] = CharacterEquipInfo(info['equips'][key], self.equVersion, key) self.charEquipInfo[key] = CharacterEquipInfo(info['equips'][key], self.equVersion, key)
"""辟邪玉""" """辟邪玉"""
self.jadeInfo = {} self.jadeInfo = {}
for key in info['jades']: for key in info.get('jades', {}):
self.jadeInfo[key] = info['jades'][key] self.jadeInfo[key] = info['jades'][key]
"""时装""" """时装"""
"""杂项""" """杂项"""
@@ -562,48 +564,24 @@ class Character:
skill = self.GetSkillByName('G-35L感电手雷') skill = self.GetSkillByName('G-35L感电手雷')
print(skill.getSkillDate(skill.lv), skill.skillDamage, skill.skillRation) print(skill.getSkillDate(skill.lv), skill.skillDamage, skill.skillRation)
# #
self.calc_damage_ration()
return return
# 技能影响角色的属性,如属强、抗性等 # 技能影响角色的属性,如属强、抗性等
for skill in self.skills:
skill.effect(self) def calc_damage_ration(self):
for i in self.charEquipInfo: """计算最终属性"""
# region 装备效果 # 计算最终属性
fun = self.equs.get_func_by_id(f'equ_{self.charEquipInfo[i].id}') print(self.AtkI, self.PAtkI)
equ = self.equs.get_equ_by_id(self.charEquipInfo[i].id) # 角色基础属性
if equ is None: # 角色装备属性
continue # 角色技能属性
self.SetStatus(**equ.__dict__) # 角色增益属性
funcs.append(fun + (equ,)) # 角色套装属性
# 护甲精通计算 # 角色徽章属性
if equ.typeSon2Id == self.防具类型: # 角色附魔属性
self.SetStatus(**精通计算(equ.lv, equ.rarity, equ.typeSon1Id, equ.typeSon2Id, self.输出类型, self.buffer)) # 角色辟邪玉属性
# 套装效果 pass
suits += (equ.suit or '').split(',')
# endregion
# region 附魔效果
fun = self.equs.get_func_by_id(f'prop_{self.charEquipInfo[i].enchant}')
funcs.append(fun + (equ,))
# endregion
# region 徽章效果
for emblem in self.charEquipInfo[i].emblems:
fun = self.equs.get_func_by_id(f'prop_{emblem}')
funcs.append(fun + (equ,))
# endregion
# region 魔法封印效果
for seal in self.charEquipInfo[i].seals:
fun = self.equs.get_func_by_id(f'seal_{seal}')
funcs.append(fun + (equ,))
# endregion
funcs.sort(key=lambda x: x[2])
for func in funcs:
# 站街
func[1](self, func[3], 0)
# 进图
func[1](self, func[3], 1)
return {
'basicInfo': self.getBasicInos(),
'skillInfo': [],
}
# endregion # endregion
@@ -0,0 +1,15 @@
<template>
<div class="h-160px bg-red" :style="{background: `url(${getImageURL('/common/equ-back.png')}) no-repeat center`}"></div>
</template>
<script lang="ts" setup name="EquList">
import { getImageURL } from '@/utils/images'
</script>
<style lang="scss" scoped>
</style>
@@ -2,6 +2,7 @@
import { computed, defineComponent, ref, renderList } from 'vue' import { computed, defineComponent, ref, renderList } from 'vue'
import type { IEnchantingInfo } from '@/api/info/type' import type { IEnchantingInfo } from '@/api/info/type'
import { useInfoStore, useConfigStore } from '@/stores' import { useInfoStore, useConfigStore } from '@/stores'
import EquList from '@/components/dnf/Equipment/List/index.vue'
export default defineComponent({ export default defineComponent({
name: 'Equip', name: 'Equip',
props: { props: {
@@ -117,6 +118,9 @@ export default defineComponent({
// 锻造数值 // 锻造数值
const dz_number = currentInfo<string | number>('dz_number') const dz_number = currentInfo<string | number>('dz_number')
// 调适
const adaptation = currentInfo<string | number>('adaptation')
/** /**
* 同步徽章1到徽章2 * 同步徽章1到徽章2
* @param val * @param val
@@ -129,6 +133,8 @@ export default defineComponent({
return () => { return () => {
return ( return (
<>
<EquList/>
<div class="flex flex-wrap equ-profile"> <div class="flex flex-wrap equ-profile">
<div class="equ-profile-item"> <div class="equ-profile-item">
<div class="mr-10px row-name">当前部位</div> <div class="mr-10px row-name">当前部位</div>
@@ -147,8 +153,8 @@ export default defineComponent({
<div class="equ-profile-item"> <div class="equ-profile-item">
<div class="row-name">增幅</div> <div class="row-name">增幅</div>
<calc-select v-model={reinforce_type.value} class="flex-1 !h-20px"> <calc-select v-model={reinforce_type.value} class="flex-1 !h-20px">
<calc-option value={1}>增幅</calc-option> <calc-option value={0}>增幅</calc-option>
<calc-option value={2}>强化</calc-option> <calc-option value={1}>强化</calc-option>
</calc-select> </calc-select>
<calc-select v-model={reinforce.value} class="flex-1 !h-20px"> <calc-select v-model={reinforce.value} class="flex-1 !h-20px">
{renderList(32, (i) => ( {renderList(32, (i) => (
@@ -204,7 +210,22 @@ export default defineComponent({
) : ( ) : (
<div></div> <div></div>
)} )}
{can_upgrade.value ? (
<div class="equ-profile-item">
<div class="row-name">调适</div>
<calc-select v-model={adaptation.value} class="flex-1 !h-20px">
{renderList(4, (i) => (
<calc-option value={i - 1}>{i - 1}</calc-option>
))}
</calc-select>
</div> </div>
) : (
<div></div>
)}
</div>
</>
) )
} }
}, },
+24
View File
@@ -22,6 +22,23 @@ const props = defineProps<{
const infoStore = useInfoStore() const infoStore = useInfoStore()
const configStore = useConfigStore() const configStore = useConfigStore()
const result = useAsyncState(
() => {
return configStore.calc()
},
{},
{ resetOnExecute: false },
)
const stopWatch = watch<any>(
() => {
return JSON.stringify(configStore.config)
},
useDebounceFn(async () => {
await result.execute()
}, 800),
)
onMounted(async () => { onMounted(async () => {
await infoStore.createCharacter(props.alter, '0') await infoStore.createCharacter(props.alter, '0')
configStore.loadConfig() configStore.loadConfig()
@@ -29,6 +46,13 @@ onMounted(async () => {
configStore.saveConfig() configStore.saveConfig()
}) })
}) })
onUnmounted(() => {
stopWatch()
window.removeEventListener('beforeunload', () => {
configStore.saveConfig()
})
})
</script> </script>
<style lang="scss"> <style lang="scss">
@@ -0,0 +1,26 @@
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<g filter="url(#filter0_i_43_35)">
<rect x="1" y="1" width="16" height="16" fill="url(#paint0_linear_43_35)"/>
</g>
<rect x="0.5" y="0.5" width="17" height="17" stroke="#5D4F30"/>
<rect x="8" y="4" width="2" height="10" fill="#B7975F"/>
<rect x="14" y="8" width="2" height="10" transform="rotate(90 14 8)" fill="#B7975F"/>
<defs>
<filter id="filter0_i_43_35" x="0" y="0" width="18" height="18" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feMorphology radius="1" operator="erode" in="SourceAlpha" result="effect1_innerShadow_43_35"/>
<feOffset/>
<feGaussianBlur stdDeviation="2"/>
<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.5 0"/>
<feBlend mode="normal" in2="shape" result="effect1_innerShadow_43_35"/>
</filter>
<linearGradient id="paint0_linear_43_35" x1="9" y1="1" x2="9" y2="17" gradientUnits="userSpaceOnUse">
<stop stop-color="#451A1F"/>
<stop offset="0.407132" stop-color="#391619"/>
<stop offset="1" stop-color="#271111"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

@@ -0,0 +1,26 @@
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<g filter="url(#filter0_i_43_36)">
<rect x="1" y="1" width="16" height="16" fill="url(#paint0_linear_43_36)"/>
</g>
<rect x="0.5" y="0.5" width="17" height="17" stroke="#5D4F30"/>
<path d="M9 9L3.75 14.1962V3.80385L9 9Z" fill="#B7975F"/>
<path d="M15 9L9.75 14.1962V3.80385L15 9Z" fill="#B7975F"/>
<defs>
<filter id="filter0_i_43_36" x="0" y="0" width="18" height="19" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feMorphology radius="1" operator="erode" in="SourceAlpha" result="effect1_innerShadow_43_36"/>
<feOffset dy="1"/>
<feGaussianBlur stdDeviation="2"/>
<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.5 0"/>
<feBlend mode="normal" in2="shape" result="effect1_innerShadow_43_36"/>
</filter>
<linearGradient id="paint0_linear_43_36" x1="9" y1="1" x2="9" y2="17" gradientUnits="userSpaceOnUse">
<stop stop-color="#451A1F"/>
<stop offset="0.407132" stop-color="#391619"/>
<stop offset="1" stop-color="#271111"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

@@ -0,0 +1,25 @@
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<g filter="url(#filter0_i_43_33)">
<rect x="1" y="1" width="16" height="16" fill="url(#paint0_linear_43_33)"/>
</g>
<rect x="0.5" y="0.5" width="17" height="17" stroke="#5D4F30"/>
<path d="M9 9L14.25 3.80385V14.1962L9 9Z" fill="#B7975F"/>
<path d="M3 9L8.25 3.80385V14.1962L3 9Z" fill="#B7975F"/>
<defs>
<filter id="filter0_i_43_33" x="0" y="0" width="18" height="18" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feMorphology radius="1" operator="erode" in="SourceAlpha" result="effect1_innerShadow_43_33"/>
<feOffset/>
<feGaussianBlur stdDeviation="2"/>
<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.5 0"/>
<feBlend mode="normal" in2="shape" result="effect1_innerShadow_43_33"/>
</filter>
<linearGradient id="paint0_linear_43_33" x1="9" y1="1" x2="9" y2="17" gradientUnits="userSpaceOnUse">
<stop stop-color="#103562"/>
<stop offset="1" stop-color="#092343"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

@@ -0,0 +1,24 @@
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<g filter="url(#filter0_i_43_34)">
<rect x="1" y="1" width="16" height="16" fill="url(#paint0_linear_43_34)"/>
</g>
<rect x="0.5" y="0.5" width="17" height="17" stroke="#5D4F30"/>
<rect x="14" y="8" width="2" height="10" transform="rotate(90 14 8)" fill="#B7975F"/>
<defs>
<filter id="filter0_i_43_34" x="0" y="0" width="18" height="18" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feMorphology radius="1" operator="erode" in="SourceAlpha" result="effect1_innerShadow_43_34"/>
<feOffset/>
<feGaussianBlur stdDeviation="2"/>
<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.5 0"/>
<feBlend mode="normal" in2="shape" result="effect1_innerShadow_43_34"/>
</filter>
<linearGradient id="paint0_linear_43_34" x1="9" y1="1" x2="9" y2="17" gradientUnits="userSpaceOnUse">
<stop stop-color="#103562"/>
<stop offset="1" stop-color="#092343"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

@@ -1,8 +1,7 @@
import { getImageURL } from '@/utils/images' import { getImageURL, getLocalImageURL } from '@/utils/images'
import type { ISkill } from '@/api/info/type' import type { ISkill } from '@/api/info/type'
import { useVModel } from '@vueuse/core' import { useVModel } from '@vueuse/core'
import './style.scss' import './style.scss'
import CalcButton from '@/components/calc/button/index.vue'
export default defineComponent({ export default defineComponent({
name: 'SkillTree', name: 'SkillTree',
@@ -106,11 +105,37 @@ export default defineComponent({
<> <>
<div class="absolute"> <div class="absolute">
<div class="w-36px h-55px bg-gradient-linear bg-gradient-[180deg,#f8e26c_0%,#f87c43_94.34%] z-1"></div> <div class="w-36px h-55px bg-gradient-linear bg-gradient-[180deg,#f8e26c_0%,#f87c43_94.34%] z-1"></div>
<div class="flex bottom--5px relative z-2 transform -translate-x-1/4"> <div class="bottom--5px relative z-5 transform -translate-x-1/4 border-1px border-solid border-black left--2">
<div onClick={(e:Event) => {e.stopPropagation();actionSkillLv(skill, 'subMax')}}>&lt;</div> <div class="flex gap-1 bg-gradient-linear bg-gradient-[180deg,#351d14_0%,#070507_100%] p-1 border-solid border-#9A6329 border-1px">
<div onClick={(e:Event) => {e.stopPropagation();actionSkillLv(skill, 'sub')}}>-</div> <img
<div onClick={(e:Event) => {e.stopPropagation();actionSkillLv(skill, 'add')}}>+</div> src={`${new URL('./img/min.svg', import.meta.url).href}`}
<div onClick={(e:Event) => {e.stopPropagation();actionSkillLv(skill, 'addMax')}}>&gt;</div> onClick={(e: Event) => {
e.stopPropagation()
actionSkillLv(skill, 'subMax')
}}
></img>
<img
src={`${new URL('./img/sub.svg', import.meta.url).href}`}
onClick={(e: Event) => {
e.stopPropagation()
actionSkillLv(skill, 'sub')
}}
></img>
<img
src={`${new URL('./img/add.svg', import.meta.url).href}`}
onClick={(e: Event) => {
e.stopPropagation()
actionSkillLv(skill, 'add')
}}
></img>
<img
src={`${new URL('./img/max.svg', import.meta.url).href}`}
onClick={(e: Event) => {
e.stopPropagation()
actionSkillLv(skill, 'addMax')
}}
></img>
</div>
</div> </div>
</div> </div>
</> </>
+6 -1
View File
@@ -29,6 +29,7 @@ export interface IConfig {
adaptation: number adaptation: number
} }
> >
jades: Record<string, number>
} }
const defaultEqusConfig = { const defaultEqusConfig = {
@@ -47,6 +48,7 @@ export const useConfigStore = defineStore('configStore', () => {
const config = ref<IConfig>({ const config = ref<IConfig>({
skills: {}, skills: {},
equips: {}, equips: {},
jades: {},
}) })
const loadConfig = () => { const loadConfig = () => {
@@ -63,9 +65,11 @@ export const useConfigStore = defineStore('configStore', () => {
config.value = { config.value = {
skills: {}, skills: {},
equips: {}, equips: {},
jades: {},
} }
if (!config.value?.equips) config.value.equips = {} if (!config.value?.equips) config.value.equips = {}
if (!config.value?.skills) config.value.skills = {} if (!config.value?.skills) config.value.skills = {}
if (!config.value?.jades) config.value.jades = {}
const part = infoStore.parts.filter((a) => !config.value?.equips.hasOwnProperty(a)) const part = infoStore.parts.filter((a) => !config.value?.equips.hasOwnProperty(a))
@@ -94,7 +98,8 @@ export const useConfigStore = defineStore('configStore', () => {
} }
const calc = async () => { const calc = async () => {
await api.calc(config.value) if(!useInfoStore().infos?.alter) return undefined
return await api.calc(config.value)
} }
return { return {