dev
This commit is contained in:
@@ -5,7 +5,7 @@ from typing import Literal
|
||||
from core.basic.property import CharacterInfo
|
||||
from core.basic.skill import Skill
|
||||
|
||||
from core.basic.equipment import get_equipment
|
||||
from core.basic.equipment import get_equipment,EquEffect
|
||||
# from core.basic.equipment import equipments
|
||||
# from core.basic.skill import Skill, ActiveSkill, PassiveSkill
|
||||
from .formula import 获取基础属性
|
||||
@@ -101,6 +101,8 @@ class Character:
|
||||
"""装备版本"""
|
||||
charEquipInfo: dict[str, "CharacterEquipInfo"]
|
||||
"""装备打造信息"""
|
||||
equ_effect:list["EquEffect"] = []
|
||||
"""装备效果列表"""
|
||||
|
||||
# region 角色属性
|
||||
输出类型: str = '物理'
|
||||
|
||||
@@ -118,7 +118,21 @@ class Equipments:
|
||||
result[suit.count] = suit
|
||||
return list(result.values())
|
||||
|
||||
class EquEffect:
|
||||
name: str = ''
|
||||
"""装备技能名称"""
|
||||
icon: str = ''
|
||||
"""技能图标"""
|
||||
cd: float = 0
|
||||
"""技能冷却时间"""
|
||||
data:float = 0
|
||||
"""伤害量"""
|
||||
|
||||
def __init__(self, name: str, icon: str, cd: float, data: float):
|
||||
self.name = name
|
||||
self.icon = icon
|
||||
self.cd = cd
|
||||
self.data = data
|
||||
|
||||
@cache
|
||||
def get_equipment(version: str = '0') -> Equipments:
|
||||
|
||||
@@ -131,8 +131,6 @@ class Skill:
|
||||
elif type.startswith('+'):
|
||||
setattr(skill, type[1:], getattr(skill, type[1:]) + data[new] / 100 - data[old] / 100)
|
||||
|
||||
|
||||
|
||||
class ActiveSkill(Skill):
|
||||
type: str = 'active'
|
||||
"""技能类型 active主动 passive被动"""
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -23,6 +23,7 @@ class SuitData(Base):
|
||||
SkillAttack = Column(Float)
|
||||
Attack = Column(Float)
|
||||
imageUrl = Column(Text)
|
||||
value = Column(Text)
|
||||
|
||||
|
||||
class EquData(Base):
|
||||
|
||||
@@ -32,7 +32,9 @@ const configStore = useConfigStore()
|
||||
onMounted(async () => {
|
||||
await infoStore.createCharacter(props.alter, '0')
|
||||
configStore.loadConfig()
|
||||
console.log(configStore.config)
|
||||
window.addEventListener('beforeunload', () => {
|
||||
configStore.saveConfig()
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
@@ -39,27 +39,37 @@ export default defineComponent({
|
||||
|
||||
const activeSkill = ref<number>(-1)
|
||||
|
||||
const chooseSkill = (skill: ISkill) => {
|
||||
const chooseSkill = (e: Event, skill?: ISkill) => {
|
||||
e.stopPropagation()
|
||||
if (!skill) {
|
||||
activeSkill.value = -1
|
||||
return
|
||||
}
|
||||
if (activeSkill.value == skill.id) activeSkill.value = -1
|
||||
else activeSkill.value = skill.id
|
||||
}
|
||||
|
||||
const actionSkillLv = (skill: ISkill, operation:string) => {
|
||||
if(operation == 'add'){
|
||||
lvInfo.value[skill.id.toString()] = { lv: Math.min(lvInfo.value[skill.id.toString()]?.lv + 1,skill.maxLv) }
|
||||
return;
|
||||
const actionSkillLv = (e: Event, skill: ISkill, operation: string) => {
|
||||
e.stopPropagation()
|
||||
if (operation == 'add') {
|
||||
lvInfo.value[skill.id.toString()] = {
|
||||
lv: Math.min(lvInfo.value[skill.id.toString()]?.lv + 1, skill.maxLv),
|
||||
}
|
||||
return
|
||||
}
|
||||
if(operation == 'addMax'){
|
||||
if (operation == 'addMax') {
|
||||
lvInfo.value[skill.id.toString()] = { lv: skill.maxLearnLv }
|
||||
return;
|
||||
return
|
||||
}
|
||||
if(operation == 'sub'){
|
||||
lvInfo.value[skill.id.toString()] = { lv: Math.max(lvInfo.value[skill.id.toString()]?.lv - 1,0) }
|
||||
return;
|
||||
if (operation == 'sub') {
|
||||
lvInfo.value[skill.id.toString()] = {
|
||||
lv: Math.max(lvInfo.value[skill.id.toString()]?.lv - 1, 0),
|
||||
}
|
||||
return
|
||||
}
|
||||
if(operation == 'subMax'){
|
||||
if (operation == 'subMax') {
|
||||
lvInfo.value[skill.id.toString()] = { lv: 0 }
|
||||
return;
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +79,7 @@ export default defineComponent({
|
||||
{activeSkill.value == skill.id && renderSkillAction(skill)}
|
||||
<div
|
||||
class="w-34px absolute h-auto flex flex-col gap-2px py-2px items-center bg-#2c2d2c rounded-2px z-2 top-1px left-1px"
|
||||
onClick={() => chooseSkill(skill)}
|
||||
onClick={(e) => chooseSkill(e, skill)}
|
||||
key={index}
|
||||
>
|
||||
<img
|
||||
@@ -90,10 +100,10 @@ export default defineComponent({
|
||||
<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="flex bottom--5px relative z-2 transform -translate-x-1/4">
|
||||
<button onClick={() => actionSkillLv(skill, 'subMax')}><</button>
|
||||
<button onClick={() => actionSkillLv(skill, 'sub')}>-</button>
|
||||
<button onClick={() => actionSkillLv(skill, 'add')}>+</button>
|
||||
<button onClick={() => actionSkillLv(skill, 'addMax')}>></button>
|
||||
<button onClick={(e) => actionSkillLv(e, skill, 'subMax')}><</button>
|
||||
<button onClick={(e) => actionSkillLv(e, skill, 'sub')}>-</button>
|
||||
<button onClick={(e) => actionSkillLv(e, skill, 'add')}>+</button>
|
||||
<button onClick={(e) => actionSkillLv(e, skill, 'addMax')}>></button>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
@@ -102,7 +112,7 @@ export default defineComponent({
|
||||
|
||||
return () => (
|
||||
<>
|
||||
<div>
|
||||
<div onClick={() => (activeSkill.value = -1)}>
|
||||
<div class="skill-tree-line flex items-center gap-10px px-10px">
|
||||
<div class="w-34px h-34px flex items-center justify-center text-white">
|
||||
其<br />余
|
||||
@@ -122,7 +132,7 @@ export default defineComponent({
|
||||
const skill = getSkill(lv, lvList[index + 1] ?? 150, column) as ISkill
|
||||
return skill ? renderSkill(skill, index) : <div class="w-34px h-34px"></div>
|
||||
})}
|
||||
<div class="w-34px h-34px"></div>
|
||||
<div class="w-34px h-34px" onClick={() => (activeSkill.value = -1)}></div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
@@ -74,7 +74,13 @@ export const useConfigStore = defineStore('configStore', () => {
|
||||
});
|
||||
}
|
||||
|
||||
const saveConfig = () => {}
|
||||
const saveConfig = () => {
|
||||
const infoStore = useInfoStore()
|
||||
const alter = infoStore.infos?.alter
|
||||
if (alter) {
|
||||
localStorage.setItem(`dcalc/${alter}/config`, JSON.stringify(config.value))
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
config,
|
||||
|
||||
Reference in New Issue
Block a user