Files
pixelheros/assets/script/game/common/config/GameSet.ts
pan 2273aeaf01 refactor(hero): 重构英雄等级升级逻辑,对齐英雄加载行为
1. 将英雄等级升级的属性计算逻辑与Hero.load保持一致,新增base属性快照
2. 新增对加成属性按等级累加的处理
3. 重新解析各触发/光环/复活技能的运行时缓存
4. 调整英雄升级倍率为2,优化英雄养成节奏
5. 调整英雄头像预制体的UI布局尺寸与偏移

fix: 修正战斗属性计算与技能缓存不一致的问题
2026-08-06 15:55:31 +08:00

161 lines
4.7 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 { Color } from "cc";
/** 碰撞分组 */
export enum BoxSet {
//物理碰撞tag
SKILL_TAG = 8,
ATK_RANGE = 4,
//group
DEFAULT = 1,
MONSTER = 2,
HERO = 4,
//地图边界
LETF_END = -360,
RIGHT_END = 360,
//游戏地平线
GAME_LINE = 160,
/** 技能/装备各自独立的上限 */
BOX_MAX = 6,
}
export enum FacSet {
HERO = 0,
MON = 1,
}
export enum FightSet {
WAVE_COIN_BASE = 7, // 波次金币基础奖励
WAVE_COIN_GROW = 2, // 波次金币递增值
WAVE_COIN_MAX = 17, // 波次金币最大基础奖励
CRIT_DAMAGE = 50,//暴击伤害
MORE_RC = 10,//更多次数 广告获取的次数
HEARTPOS = -320,//基地位置
HERO_MAX_NUM = 3,//英雄最大数量
/** 英雄可升级到的最高等级(通过升级卡提升) */
HERO_MAX_LV = 6,
/** 英雄属性随等级成长的倍率ap/hp = base * MULTIPLIER^(lv-1) */
HERO_LV_MULTIPLIER = 2,
// BACK_RANG=30,//后退范围
BACK_RANG = 30,//后退范围
FiIGHT_TIME = 30,//战斗时间
// BACK_CHANCE=40,//击退概率
FROST_TIME = 3,//冰冻时间
STUN_TIME = 2,//击晕时间
SKILL_CAST_DELAY = 0.15,
CSKILL_START_X = -340,
CSKILL_START_Y = 30,
SHIELD_MAX = 5,
WAVE_HEAL_RATE = 0.5, // 回合结束时所有英雄恢复最大生命值的比例
PUNCTURE_DOWN = 50,
REFRESH_COST = 2,
BASE_COST = 5,
INIT_COIN = 7, // 初始金币数
INIT_REFRESH_STONE = 3, // 初始刷新石数量
/** 单次刷新消耗的刷新石数量 */
REFRESH_STONE_COST = 1,
}
/**
* 技能卡牌出现的波次配置(单一数据源)。
* 数组索引 i 对应卡牌档位 card_lv = i + 1
* - 第 1 个波次 → LV1 档(基础强度)
* - 第 2 个波次 → LV2 档(强度 ×2
* - 第 3 个波次 → LV3 档(强度 ×3
* 需与 CardSet.SkillCardData 的 wave 字段严格对齐,否则抽卡时池子为空。
*/
export const SKILL_CARD_WAVES: number[] = [1, 5, 8];
export const laneIdx = {
2: [-180, 90],
1: [-180, 0],
3: [-180, -90],
5: [-280, 90],
4: [-280, 0],
6: [-280, -90],
}
export enum IndexSet {
/** 英雄基础层级 */
HERO = -2000,
/** 一线怪物基础层级(y=120) - 层级较低,在后面 */
MON1 = 1000,
/** 二线怪物基础层级(y=80) - 层级较高,在前面 */
MON2 = -3000,
/** 每个怪物的层级增量,确保后生成的在前面 */
MON_INCREMENT = 1,
SLILL = 4000,
BOSS = 2100,
}
export const TooltipTypes = {
life: 1,
health: 2,
skill: 3,
crit: 4,
uskill: 5,
lvup: 6,
apup: 7,
hpup: 8,
addmp: 9,
shield: 10,
}
/** 数字格式化工具函数 */
export class NumberFormatter {
/**
* 将数字转换为易读格式
* @param num 要转换的数字
* @returns 格式化后的字符串
* 例如1234 -> "1.2k", 1234567 -> "1.2M", 1234567890 -> "1.2B"
*/
static formatNumber(num: number): string {
if (num < 1000) {
return num.toString();
} else if (num < 1000000) {
// 5位数用k表示 (1000-999999)
return (num / 1000).toFixed(1).replace(/\.0$/, '') + 'k';
} else if (num < 1000000000) {
// 7位数用M表示 (1000000-999999999)
return (num / 1000000).toFixed(1).replace(/\.0$/, '') + 'M';
} else if (num < 1000000000000) {
// 10位数用B表示 (1000000000-999999999999)
return (num / 1000000000).toFixed(1).replace(/\.0$/, '') + 'B';
} else {
// 更大的数字用T表示
return (num / 1000000000000).toFixed(1).replace(/\.0$/, '') + 'T';
}
}
/**
* 将数字转换为中文格式
* @param num 要转换的数字
* @returns 中文格式的字符串
* 例如1234 -> "1.2千", 1234567 -> "1.2百万"
*/
static formatNumberChinese(num: number): string {
if (num < 10000) {
return num.toString();
} else if (num < 100000000) {
// 万级别
return (num / 10000).toFixed(1).replace(/\.0$/, '') + '万';
} else if (num < 1000000000000) {
// 亿级别
return (num / 100000000).toFixed(1).replace(/\.0$/, '') + '亿';
} else {
// 万亿级别
return (num / 1000000000000).toFixed(1).replace(/\.0$/, '') + '万亿';
}
}
}
export function getLvColor(lv: number): Color {
switch (lv) {
case 2: return new Color("#2ECC71");
case 3: return new Color("#3498DB");
case 4: return new Color("#9B59B6");
case 5: return new Color("#F1C40F");
case 6: return new Color("#E74C3C");
default: return Color.WHITE;
}
}