- MiniMap: 添加缩放/平移功能,优化节点显示样式 - 新增洞穴相关敌人和Boss(洞穴蝙蝠、洞穴领主) - 新增义体类物品(钢制义臂、光学义眼、真皮护甲) - 扩展武器技能系统(剑、斧、钝器、弓箭精通) - 更新商店配置和义体相关功能 - 完善玩家/游戏Store状态管理 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
131 lines
2.5 KiB
JavaScript
131 lines
2.5 KiB
JavaScript
import { defineStore } from 'pinia'
|
|
import { ref, computed } from 'vue'
|
|
|
|
export const usePlayerStore = defineStore('player', () => {
|
|
// 基础属性
|
|
const baseStats = ref({
|
|
strength: 10, // 力量
|
|
agility: 6, // 敏捷(降低以提高被命中率)
|
|
dexterity: 8, // 灵巧
|
|
intuition: 10, // 智力
|
|
vitality: 10 // 体质(影响HP)
|
|
})
|
|
|
|
// 当前资源
|
|
const currentStats = ref({
|
|
health: 100,
|
|
maxHealth: 100,
|
|
stamina: 100,
|
|
maxStamina: 100,
|
|
sanity: 100,
|
|
maxSanity: 100
|
|
})
|
|
|
|
// 主等级
|
|
const level = ref({
|
|
current: 1,
|
|
exp: 0,
|
|
maxExp: 100
|
|
})
|
|
|
|
// 技能
|
|
const skills = ref({})
|
|
|
|
// 装备
|
|
const equipment = ref({
|
|
weapon: null,
|
|
armor: null,
|
|
shield: null,
|
|
accessory: null,
|
|
prosthetic: null // 义体装备位
|
|
})
|
|
|
|
// 义体适应性(使用义体时增加)
|
|
const prostheticAdaptation = ref(0)
|
|
|
|
// 背包
|
|
const inventory = ref([])
|
|
|
|
// 货币(以铜币为单位)
|
|
const currency = ref({
|
|
copper: 0
|
|
})
|
|
|
|
// 当前位置
|
|
const currentLocation = ref('camp')
|
|
|
|
// 标记
|
|
const flags = ref({})
|
|
|
|
// 击杀统计(用于成就和解锁条件)
|
|
const killCount = ref({})
|
|
|
|
// 访问过的位置
|
|
const visitedLocations = ref(new Set())
|
|
|
|
// 计算属性:总货币
|
|
const totalCurrency = computed(() => {
|
|
return {
|
|
gold: Math.floor(currency.value.copper / 10000),
|
|
silver: Math.floor((currency.value.copper % 10000) / 100),
|
|
copper: currency.value.copper % 100
|
|
}
|
|
})
|
|
|
|
// 重置玩家数据
|
|
function resetPlayer() {
|
|
baseStats.value = {
|
|
strength: 10,
|
|
agility: 6, // 降低以提高被命中率
|
|
dexterity: 8,
|
|
intuition: 10,
|
|
vitality: 10
|
|
}
|
|
currentStats.value = {
|
|
health: 100,
|
|
maxHealth: 100,
|
|
stamina: 100,
|
|
maxStamina: 100,
|
|
sanity: 100,
|
|
maxSanity: 100
|
|
}
|
|
level.value = {
|
|
current: 1,
|
|
exp: 0,
|
|
maxExp: 100
|
|
}
|
|
skills.value = {}
|
|
equipment.value = {
|
|
weapon: null,
|
|
armor: null,
|
|
shield: null,
|
|
accessory: null,
|
|
prosthetic: null
|
|
}
|
|
prostheticAdaptation.value = 0
|
|
inventory.value = []
|
|
currency.value = { copper: 0 }
|
|
currentLocation.value = 'camp'
|
|
flags.value = {}
|
|
killCount.value = {}
|
|
visitedLocations.value = new Set()
|
|
}
|
|
|
|
return {
|
|
baseStats,
|
|
currentStats,
|
|
level,
|
|
skills,
|
|
equipment,
|
|
prostheticAdaptation,
|
|
inventory,
|
|
currency,
|
|
totalCurrency,
|
|
currentLocation,
|
|
flags,
|
|
killCount,
|
|
visitedLocations,
|
|
resetPlayer
|
|
}
|
|
})
|