feat: 扩展游戏内容和地图系统优化
- MiniMap: 添加缩放/平移功能,优化节点显示样式 - 新增洞穴相关敌人和Boss(洞穴蝙蝠、洞穴领主) - 新增义体类物品(钢制义臂、光学义眼、真皮护甲) - 扩展武器技能系统(剑、斧、钝器、弓箭精通) - 更新商店配置和义体相关功能 - 完善玩家/游戏Store状态管理 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -29,6 +29,7 @@ export const useGameStore = defineStore('game', () => {
|
||||
const combatState = ref(null)
|
||||
const autoCombat = ref(false) // 自动战斗模式
|
||||
const isSearching = ref(false) // 正在寻找敌人中(自动战斗间隔期间)
|
||||
const preferredStance = ref('balance') // 记住玩家偏好的战斗姿态
|
||||
|
||||
// 活动任务
|
||||
const activeTasks = ref([])
|
||||
@@ -45,6 +46,16 @@ export const useGameStore = defineStore('game', () => {
|
||||
// 当前事件
|
||||
const currentEvent = ref(null)
|
||||
|
||||
// 成就系统
|
||||
const achievements = ref({})
|
||||
const achievementProgress = ref({
|
||||
totalKills: 0,
|
||||
bossKills: 0,
|
||||
prostheticEquipped: 0,
|
||||
visitedLocations: new Set(),
|
||||
totalEarned: 0
|
||||
})
|
||||
|
||||
// 添加日志
|
||||
function addLog(message, type = 'info') {
|
||||
const time = `${String(gameTime.value.hour).padStart(2, '0')}:${String(gameTime.value.minute).padStart(2, '0')}`
|
||||
@@ -60,6 +71,54 @@ export const useGameStore = defineStore('game', () => {
|
||||
}
|
||||
}
|
||||
|
||||
// 检查成就
|
||||
function checkAchievements(triggerType, data = {}) {
|
||||
const { ACHIEVEMENT_CONFIG } = require('@/config/achievements.js')
|
||||
let newAchievements = []
|
||||
|
||||
for (const [id, achievement] of Object.entries(ACHIEVEMENT_CONFIG)) {
|
||||
// 已完成的跳过
|
||||
if (achievements.value[id]) continue
|
||||
|
||||
let unlocked = false
|
||||
|
||||
switch (achievement.condition.type) {
|
||||
case 'kill':
|
||||
unlocked = achievementProgress.value.totalKills >= achievement.condition.count
|
||||
break
|
||||
case 'boss_kill':
|
||||
unlocked = achievementProgress.value.bossKills >= achievement.condition.count
|
||||
break
|
||||
case 'equip_prosthetic':
|
||||
unlocked = data.prostheticCount >= achievement.condition.count
|
||||
break
|
||||
case 'skill_level':
|
||||
unlocked = data.maxSkillLevel >= achievement.condition.level
|
||||
break
|
||||
case 'visit_locations':
|
||||
unlocked = achievementProgress.value.visitedLocations.size >= achievement.condition.count
|
||||
break
|
||||
case 'total_earned':
|
||||
unlocked = achievementProgress.value.totalEarned >= achievement.condition.amount
|
||||
break
|
||||
case 'survive_days':
|
||||
unlocked = gameTime.value.day >= achievement.condition.days
|
||||
break
|
||||
}
|
||||
|
||||
if (unlocked) {
|
||||
achievements.value[id] = {
|
||||
unlocked: true,
|
||||
timestamp: Date.now()
|
||||
}
|
||||
newAchievements.push(achievement)
|
||||
addLog(`🏆 解锁成就: ${achievement.icon} ${achievement.name}`, 'reward')
|
||||
}
|
||||
}
|
||||
|
||||
return newAchievements
|
||||
}
|
||||
|
||||
// 重置游戏状态
|
||||
function resetGame() {
|
||||
currentTab.value = 'status'
|
||||
@@ -79,6 +138,7 @@ export const useGameStore = defineStore('game', () => {
|
||||
combatState.value = null
|
||||
autoCombat.value = false
|
||||
isSearching.value = false
|
||||
preferredStance.value = 'balance'
|
||||
activeTasks.value = []
|
||||
negativeStatus.value = []
|
||||
marketPrices.value = {
|
||||
@@ -86,6 +146,14 @@ export const useGameStore = defineStore('game', () => {
|
||||
prices: {}
|
||||
}
|
||||
currentEvent.value = null
|
||||
achievements.value = {}
|
||||
achievementProgress.value = {
|
||||
totalKills: 0,
|
||||
bossKills: 0,
|
||||
prostheticEquipped: 0,
|
||||
visitedLocations: new Set(),
|
||||
totalEarned: 0
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
@@ -97,11 +165,15 @@ export const useGameStore = defineStore('game', () => {
|
||||
combatState,
|
||||
autoCombat,
|
||||
isSearching,
|
||||
preferredStance,
|
||||
activeTasks,
|
||||
negativeStatus,
|
||||
marketPrices,
|
||||
currentEvent,
|
||||
achievements,
|
||||
achievementProgress,
|
||||
addLog,
|
||||
resetGame
|
||||
resetGame,
|
||||
checkAchievements
|
||||
}
|
||||
})
|
||||
|
||||
@@ -5,7 +5,7 @@ export const usePlayerStore = defineStore('player', () => {
|
||||
// 基础属性
|
||||
const baseStats = ref({
|
||||
strength: 10, // 力量
|
||||
agility: 8, // 敏捷
|
||||
agility: 6, // 敏捷(降低以提高被命中率)
|
||||
dexterity: 8, // 灵巧
|
||||
intuition: 10, // 智力
|
||||
vitality: 10 // 体质(影响HP)
|
||||
@@ -36,9 +36,13 @@ export const usePlayerStore = defineStore('player', () => {
|
||||
weapon: null,
|
||||
armor: null,
|
||||
shield: null,
|
||||
accessory: null
|
||||
accessory: null,
|
||||
prosthetic: null // 义体装备位
|
||||
})
|
||||
|
||||
// 义体适应性(使用义体时增加)
|
||||
const prostheticAdaptation = ref(0)
|
||||
|
||||
// 背包
|
||||
const inventory = ref([])
|
||||
|
||||
@@ -53,6 +57,12 @@ export const usePlayerStore = defineStore('player', () => {
|
||||
// 标记
|
||||
const flags = ref({})
|
||||
|
||||
// 击杀统计(用于成就和解锁条件)
|
||||
const killCount = ref({})
|
||||
|
||||
// 访问过的位置
|
||||
const visitedLocations = ref(new Set())
|
||||
|
||||
// 计算属性:总货币
|
||||
const totalCurrency = computed(() => {
|
||||
return {
|
||||
@@ -66,7 +76,7 @@ export const usePlayerStore = defineStore('player', () => {
|
||||
function resetPlayer() {
|
||||
baseStats.value = {
|
||||
strength: 10,
|
||||
agility: 8,
|
||||
agility: 6, // 降低以提高被命中率
|
||||
dexterity: 8,
|
||||
intuition: 10,
|
||||
vitality: 10
|
||||
@@ -89,12 +99,16 @@ export const usePlayerStore = defineStore('player', () => {
|
||||
weapon: null,
|
||||
armor: null,
|
||||
shield: null,
|
||||
accessory: 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 {
|
||||
@@ -103,11 +117,14 @@ export const usePlayerStore = defineStore('player', () => {
|
||||
level,
|
||||
skills,
|
||||
equipment,
|
||||
prostheticAdaptation,
|
||||
inventory,
|
||||
currency,
|
||||
totalCurrency,
|
||||
currentLocation,
|
||||
flags,
|
||||
killCount,
|
||||
visitedLocations,
|
||||
resetPlayer
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user