This commit is contained in:
2025-07-11 17:23:20 +08:00
parent 43c2dbcfa2
commit 37610439a6
4 changed files with 212 additions and 52 deletions

View File

@@ -215,11 +215,13 @@ export const getInfiniteWaveConfig = (waveNumber: number) => {
};
// 获取怪物等级
export const getMonsterLevel = (waveNumber: number): number => {
return 1 + Math.floor(waveNumber / 1);
};
// 获取装备石掉落数量
export const getStoneDrops = (monsterType: number, level: number = 1): {type: string, count: number} => {
const baseDrops = {
@@ -237,6 +239,7 @@ export const getStoneDrops = (monsterType: number, level: number = 1): {type: st
count: dropCount
};
};
export const getExpDrops = (monsterType: number, level: number = 1): number => {
const baseDrops = {
[HQuality.GREEN]: 10, // 普通怪物
@@ -257,45 +260,7 @@ export const getEquipUpgradeCost = (equipLevel: number, quality: number): number
return baseCosts[quality] * Math.pow(2, equipLevel - 1);
};
export const MonNum = [3,4,5]//对应关卡数MissionMons 的索引
export const MissionMons = [
[5201,5202,5203,5204,5205,5206],
[5201],
[5201],
]
export const Missions = [
[5201,5202,5203,5204,5205,5206,5219,5220,5221],
[5216,5217,5218],
[5225,5226,5227],
]
export const MissionReward = {
1:[1001,1002,1003,1004,1005,1006,1021,1022,1023,1024,1025,1026,1027,1028],
2:[1001,1002,1003,1004,1005,1006,1021,1022,1023,1024,1025,1026,1027,1028],
3:[1001,1002,1003,1004,1005,1006,1021,1022,1023,1024,1025,1026,1027,1028],
}
export const MBSet = {
exp:10,
ap_exp:100,
def_exp:100,
hp_exp:100,
ap_add:2,
def_add:1,
hp_add:5,
crit_add:1,
dodge_add:1,
ap_cost:1,
def_cost:1,
hp_cost:1,
crit_cost:2,
dodge_cost:2,
}
export const MissionStatus = {
ready:0,
ready_skill_select:1,
ready_hero_select:2,
playing:3,
end:4,
}
export enum FightSet {
FRIEND_WAVE_UP=3, //伙伴登场波次
BOSS_WAVE_UP_1=3, //boss登场波次
@@ -353,6 +318,7 @@ export const MissionData = {
skill_stone:0,//技能石
skill_stone_max:10,//技能石最大数量
}
export const VmInfo = {
hp:0,
hp_max:0,
@@ -385,4 +351,208 @@ 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; // 总击杀数
}

View File

@@ -3,7 +3,7 @@ import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ec
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
import { smc } from "../common/SingletonModuleComp";
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
import { FightSet, MissionData, Missions, MissionStatus, VmInfo} from "../common/config/Mission";
import { FightSet, MissionData, VmInfo} from "../common/config/Mission";
import { Timer } from "../../../../extensions/oops-plugin-framework/assets/core/common/timer/Timer";
import { GameEvent } from "../common/config/GameEvent";
import { HeroViewComp } from "../hero/HeroViewComp";

View File

@@ -2,9 +2,8 @@ import { _decorator, v3, Vec3 } from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
import { Monster } from "../hero/Mon";
import { BoxSet } from "../common/config/BoxSet";
import { MonSet } from "../common/config/heroSet";
import { FightSet, Missions, MonNum, WaveConfig, getInfiniteWaveConfig, getMonsterLevel } from "../common/config/Mission";
import { FightSet, WaveConfig, getInfiniteWaveConfig, getMonsterLevel } from "../common/config/Mission";
import { RandomManager } from "db://oops-framework/core/common/random/RandomManager";
import { Timer } from "db://oops-framework/core/common/timer/Timer";
import { smc } from "../common/SingletonModuleComp";

View File

@@ -3,15 +3,6 @@ import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ec
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
import { smc } from "../common/SingletonModuleComp";
import { HeroViewComp } from "../hero/HeroViewComp";
import { RandomManager } from "../../../../extensions/oops-plugin-framework/assets/core/common/random/RandomManager";
import { MissionReward } from "../common/config/Mission";
import { Items } from "../common/config/Items";
import { Item } from "./Item";
import { UIID } from "../common/config/GameUIConfig";
import { PopViewParams, UICallbacks } from "../../../../extensions/oops-plugin-framework/assets/core/gui/layer/Defines";
import { RewardComp} from "./RewardComp";
import { HChipComp } from "../hero/HChipComp";
import { GameEvent } from "../common/config/GameEvent";
const { ccclass, property } = _decorator;