Files
heros/assets/script/game/common/config/Mission.ts
2025-07-31 22:57:04 +08:00

356 lines
10 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { HQuality } from "./heroSet";
// 获取装备石掉落数量
export const getStoneDrops = (monsterType: number, level: number = 1): {type: string, count: number} => {
const baseDrops = {
[HQuality.GREEN]: 2, // 普通怪物
[HQuality.BLUE]: 4, // 精英怪物
[HQuality.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 = {
[HQuality.GREEN]: 10, // 普通怪物
[HQuality.BLUE]: 20, // 精英怪物
[HQuality.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登场波次
BOSS_WAVE_UP_2=5, //boss登场波次
BOSS_WAVE_UP_3=7, //boss登场波次
EQUIP_WAVE_UP_1=4, //装备登场波次
EQUIP_WAVE_UP_2=6, //装备登场波次
EQUIP_WAVE_UP_3=8, //装备登场波次
SKILL_WAVE_UP_1=2, //技能登场波次
SKILL_WAVE_UP_2=5, //技能登场波次
SKILL_WAVE_UP_3=7, //技能登场波次
MON_WAVE_TIME=10,//怪物波次时间
ATK_ADD_COUNT=4,//伙伴攻击力增加
ATK_ADD_GLOD=1,//金币增加
CRIT_DAMAGE=50,//暴击伤害
DOUBLE_ATK_RATE=100,//额外攻击默认概率
GREEN_GOLD=1,//绿色金币
BLUE_GOLD=2,//蓝色金币
PURPLE_GOLD=3,//紫色金币
ORANGE_GOLD=4,//橙色金币
BURN_COUNT=5,//默认易伤次数 5秒
STUN_TIME=0.5,//默认晕时间
WEAPON_LV=2,//武器等级
SHIELD_LV=3,//护盾等级
ARMOR_LV=4,//防具等级
ACCESSORY_LV=5,//饰品等级
ATKED_TO_POWER=1,//被攻击涨能量
ATK_TO_POWER=1,//攻击涨能量
CRIT_TO_POWER=1,//暴击涨能量
DODGE_TO_POWER=1,//闪避涨能量
ONE_WAVE_TIME=30,//单波时间
DOWN_TIME=5,//倒计时时间
// ATK_TO_ATK_RATIO=0.1,
// ATK_TO_HP_RATIO=0.2,
// ATK_TO_SHIELD_RATIO=2,
// ATK_LINES = 3, //英雄数
// MON_GOLD_ADD =2,
// MON_COIN_ADD=2,
// COIN_ADD=1,
// DEF_RATE=0.7,
// DODGE_MAX=70,
// HERO_NUM=3,
// AP_UPDATE_RATE=100,
// AP_CHANGE_RATE=0,
}
export const MissionData = {
gold:1000,//金币
score:0,//分数
refrsh_time:5, //刷新时间
refresh_gold:1,//刷新金币
call_gold:0,//召唤金币
add_gold:1,//金币增加
change_gold:0,//金币变化
back_gold:1,//返还金币
buff_back_gold:0,//额外返还金币
buff_add_gold:0,//额外增加金币
buff_refrsh_time:0,//额外刷新时间
buff_refresh_gold:0,//额外发现所需的金币
current_wave:0,
mon_num:0,//怪物数量
wave_time_num:0,//波次时间
in_fight:false,
fight_time:0,//战斗时间
equip_stone:0,//装备石
equip_stone_max:10,//装备石最大数量
skill_stone:0,//技能石
skill_stone_max:10,//技能石最大数量
refresh_count:5,//刷新次
}
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,
skill:3,
crit:4,
uskill:5,
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; // 总击杀数
}