From e1f0492f3403b80c8fe551aedd212890e8a2af13 Mon Sep 17 00:00:00 2001 From: panw Date: Wed, 22 Oct 2025 11:13:56 +0800 Subject: [PATCH] =?UTF-8?q?refactor(game-config):=20=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E8=BF=87=E6=97=B6=E7=9A=84=E9=85=8D=E7=BD=AE=E5=92=8C=E7=AE=80?= =?UTF-8?q?=E5=8C=96=E4=BB=A3=E7=A0=81=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除 BoxSet.ts 中未使用的 HeroConSet 和 QualitySet 枚举定义 - 清理 Mission.ts 中冗余的得分系统及相关计算函数 - 删除 HeroUI、VmInfo 等无用状态对象 - 删除复杂得分计算逻辑及远征奖励配置相关代码 - 简化 heroSet.ts,添加 HeroConf 枚举定义优化配置管理 --- assets/script/game/common/config/BoxSet.ts | 10 - assets/script/game/common/config/Mission.ts | 286 +------------------- assets/script/game/common/config/heroSet.ts | 4 +- 3 files changed, 4 insertions(+), 296 deletions(-) diff --git a/assets/script/game/common/config/BoxSet.ts b/assets/script/game/common/config/BoxSet.ts index e21190b3..d685ed04 100644 --- a/assets/script/game/common/config/BoxSet.ts +++ b/assets/script/game/common/config/BoxSet.ts @@ -58,16 +58,6 @@ export enum FacSet { HERO=0, MON=1, } -export enum HeroConSet{ - INFO=0, - SELECT=1, -} -export enum QualitySet{ - GREEN=0, - BLUE=1, - PURPLE=2, - ORANGE=3, -} /** 数字格式化工具函数 */ export class NumberFormatter { diff --git a/assets/script/game/common/config/Mission.ts b/assets/script/game/common/config/Mission.ts index 4dc80817..bc983f7e 100644 --- a/assets/script/game/common/config/Mission.ts +++ b/assets/script/game/common/config/Mission.ts @@ -1,43 +1,3 @@ -import { QualitySet } from "./BoxSet"; -// 获取装备石掉落数量 -export const getStoneDrops = (monsterType: number, level: number = 1): {type: string, count: number} => { - const baseDrops = { - [QualitySet.GREEN]: 2, // 普通怪物 - [QualitySet.BLUE]: 4, // 精英怪物 - [QualitySet.PURPLE]: 8 // Boss怪物 - }; - - // 50%概率掉落装备石,50%概率掉落技能石 - const dropType = Math.random() < 0.5 ? "equip" : "skill"; - const dropCount = Math.floor(baseDrops[monsterType] * (1 + (level - 1) * 0.2)); - - return { - type: dropType, - count: dropCount - }; -}; - -export const getExpDrops = (monsterType: number, level: number = 1): number => { - const baseDrops = { - [QualitySet.GREEN]: 10, // 普通怪物 - [QualitySet.BLUE]: 20, // 精英怪物 - [QualitySet.PURPLE]: 40 // Boss怪物 - }; - return Math.floor(baseDrops[monsterType] * (1 + (level - 1) * 0.2)); -} -// 获取装备升级成本 -export const getEquipUpgradeCost = (equipLevel: number, quality: number): number => { - const baseCosts = { - 2: 50, // GREEN - 3: 80, // BLUE - 4: 120 // PURPLE - }; - - // 每次升级成本翻倍 - return baseCosts[quality] * Math.pow(2, equipLevel - 1); -}; - - export enum FightSet { FRIEND_WAVE_UP=3, //伙伴登场波次 BOSS_WAVE_UP_1=3, //boss登场波次 @@ -88,46 +48,6 @@ export enum FightSet { // AP_CHANGE_RATE=0, } -export const HeroUI = { - uuid:0, - name:"", - count:0, - hp:0, - hp_max:0, - cd:0, - cd_max:0, -} -export const VmInfo = { - hp:0, - hp_max:0, - hp_buff:0, - lv:1, - exp:0, - next_exp:100, - power:0, - power_max:100, - cd:3, - skill_cd_buff:0,//技能cd修正 - damage:0, - ap:0, - equip_ap:0, - buff_ap:0, - debuff_ap:0, - def:0, - crit:0, - crit_d:99, - dod:99, - dod_no:false, - crit_no:false, - wind:0, - thorns:0, - lifesteal:0, - POWER_UP:0, - atk_count:0, - atked_count:0, - crit_count:0, - dod_count:0, -} export const TooltipTypes = { life:1, health:2, @@ -137,208 +57,4 @@ export const TooltipTypes = { lvup:6, apup:7, hpup:8, -} - -// ==================== 得分系统配置表 ==================== - -// 游戏模式枚举 -export enum GameMode { - MAIN_STORY = "main_story", // 主线模式:固定30波 - EXPEDITION = "expedition" // 限时远征模式:30秒倒计时 -} - -// 得分系统配置 -export const ScoreSystem = { - // 主线分计算(满分1000) - MAIN_STORY_SCORE: { - // 基础分数:通关波次 × 10 - WAVE_BASE_SCORE: 10, - - // 剩余血量奖励:剩余血量 × 0.2 - HP_REMAINING_MULTIPLIER: 0.2, - - // 时间惩罚:耗时秒数 × 0.5 - TIME_PENALTY_MULTIPLIER: 0.5, - - // 事件选择奖励(每个事件选择的价值) - EVENT_CHOICE_BONUS: { - BOSS_WEAKNESS: 50, // Boss弱点选择 - EQUIPMENT_BOOST: 30, // 装备强化选择 - SKILL_UPGRADE: 40, // 技能升级选择 - STAT_BOOST: 25, // 属性提升选择 - WAVE_SKIP: 20 // 跳过波次选择 - }, - - // 里程碑奖励(每10波) - MILESTONE_BONUS: { - 10: 100, // 第10波里程碑 - 20: 200, // 第20波里程碑 - 30: 300 // 第30波里程碑(通关) - } - }, - - // 远征分计算 - EXPEDITION_SCORE: { - // 每波基础分 - WAVE_BASE_SCORE: 200, - - // 击杀怪物延长倒计时(秒) - KILL_TIME_EXTENSION: 3, - - // 每秒自动累计分 - PER_SECOND_SCORE: 10, - - // 远征倍率计算:1.0 + 0.02 × 远征波次 - MULTIPLIER_BASE: 1.0, - MULTIPLIER_PER_WAVE: 0.02, - MAX_MULTIPLIER: 3.0 - }, - - // 总分计算公式 - TOTAL_SCORE_FORMULA: { - // 总分 = 主线分 × 远征倍率 - // 远征倍率 = 1.0 + 0.02 × 远征波次(最大3.0倍) - calculate: (mainStoryScore: number, expeditionWaves: number): number => { - const multiplier = Math.min( - ScoreSystem.EXPEDITION_SCORE.MAX_MULTIPLIER, - ScoreSystem.EXPEDITION_SCORE.MULTIPLIER_BASE + - (expeditionWaves * ScoreSystem.EXPEDITION_SCORE.MULTIPLIER_PER_WAVE) - ); - return Math.floor(mainStoryScore * multiplier); - } - } -}; - -// 主线分计算函数 -export const calculateMainStoryScore = ( - completedWaves: number, - remainingHp: number, - timeSpent: number, - eventChoices: string[], - isVictory: boolean -): number => { - let score = 0; - - // 基础分数:通关波次 × 10 - score += completedWaves * ScoreSystem.MAIN_STORY_SCORE.WAVE_BASE_SCORE; - - // 剩余血量奖励 - score += Math.floor(remainingHp * ScoreSystem.MAIN_STORY_SCORE.HP_REMAINING_MULTIPLIER); - - // 时间惩罚 - score -= Math.floor(timeSpent * ScoreSystem.MAIN_STORY_SCORE.TIME_PENALTY_MULTIPLIER); - - // 事件选择奖励 - eventChoices.forEach(choice => { - const bonus = ScoreSystem.MAIN_STORY_SCORE.EVENT_CHOICE_BONUS[choice]; - if (bonus) { - score += bonus; - } - }); - - // 里程碑奖励 - Object.entries(ScoreSystem.MAIN_STORY_SCORE.MILESTONE_BONUS).forEach(([wave, bonus]) => { - if (completedWaves >= parseInt(wave)) { - score += bonus; - } - }); - - // 确保分数不为负数 - return Math.max(0, score); -}; - -// 远征分计算函数 -export const calculateExpeditionScore = ( - completedWaves: number, - timeSpent: number, - totalKills: number -): number => { - let score = 0; - - // 每波基础分 - score += completedWaves * ScoreSystem.EXPEDITION_SCORE.WAVE_BASE_SCORE; - - // 每秒自动累计分 - score += Math.floor(timeSpent * ScoreSystem.EXPEDITION_SCORE.PER_SECOND_SCORE); - - // 击杀奖励(可选,根据设计调整) - score += totalKills * 5; - - return score; -}; - -// 远征倍率计算函数 -export const calculateExpeditionMultiplier = (expeditionWaves: number): number => { - return Math.min( - ScoreSystem.EXPEDITION_SCORE.MAX_MULTIPLIER, - ScoreSystem.EXPEDITION_SCORE.MULTIPLIER_BASE + - (expeditionWaves * ScoreSystem.EXPEDITION_SCORE.MULTIPLIER_PER_WAVE) - ); -}; - -// 总分计算函数 -export const calculateTotalScore = ( - mainStoryScore: number, - expeditionWaves: number -): number => { - return ScoreSystem.TOTAL_SCORE_FORMULA.calculate(mainStoryScore, expeditionWaves); -}; - -// 分数等级系统 -export const ScoreRanking = { - // 分数等级 - RANKS: { - BRONZE: { min: 0, max: 999, name: "青铜" }, - SILVER: { min: 1000, max: 1999, name: "白银" }, - GOLD: { min: 2000, max: 2999, name: "黄金" }, - PLATINUM: { min: 3000, max: 3999, name: "铂金" }, - DIAMOND: { min: 4000, max: 4999, name: "钻石" }, - MASTER: { min: 5000, max: Infinity, name: "大师" } - }, - - // 获取分数等级 - getRank: (score: number): string => { - for (const [rank, data] of Object.entries(ScoreRanking.RANKS)) { - if (score >= data.min && score <= data.max) { - return data.name; - } - } - return "未知"; - } -}; - -// 远征奖励系统 -export const ExpeditionRewards = { - // 远征10波奖励:免广告券 - WAVE_10_REWARD: { - type: "ad_free_ticket", - count: 1, - maxCount: 1, // 最多1张 - description: "远征10波奖励:免广告券" - }, - - // 远征里程碑奖励 - MILESTONE_REWARDS: { - 10: { type: "ad_free_ticket", count: 1 }, - 20: { type: "skill_stone", count: 5 }, - 30: { type: "equip_stone", count: 10 }, - 50: { type: "rare_equipment", count: 1 }, - 100: { type: "legendary_equipment", count: 1 } - } -}; - -// 分数记录结构 -export interface ScoreRecord { - mainStoryScore: number; // 主线分数 - expeditionWaves: number; // 远征波次 - expeditionScore: number; // 远征分数 - totalScore: number; // 总分 - rank: string; // 等级 - timestamp: number; // 时间戳 - gameMode: GameMode; // 游戏模式 - completedWaves: number; // 完成波次 - remainingHp: number; // 剩余血量 - timeSpent: number; // 耗时 - eventChoices: string[]; // 事件选择 - totalKills: number; // 总击杀数 -} +} \ No newline at end of file diff --git a/assets/script/game/common/config/heroSet.ts b/assets/script/game/common/config/heroSet.ts index 81c3511e..b57c420e 100644 --- a/assets/script/game/common/config/heroSet.ts +++ b/assets/script/game/common/config/heroSet.ts @@ -61,7 +61,9 @@ export const MonSet = { 7:{pos:v3(560,100,0)}, } - +export enum HeroConf{ + COST=1500, +} export enum HeroUpSet { MP=5, HP=10,