433 lines
14 KiB
TypeScript
433 lines
14 KiB
TypeScript
import { v3 } from "cc"
|
||
import { BuffAttr } from "./SkillSet"
|
||
|
||
/**
|
||
* kind :1:烈焰 2:寒冰 3:自然 4:暗影 5:神圣
|
||
**/
|
||
// export enum HeroKind {
|
||
// /**
|
||
// * 词条解释:
|
||
// * 烈焰:攻击带击退效果
|
||
// * 寒冰:攻击带速度效果
|
||
// * 自然:攻击偷取生命
|
||
// * 暗影:攻击偷取攻击
|
||
// * 神圣:攻击带2倍伤害
|
||
// * */
|
||
// fire = 1,
|
||
// water = 2,
|
||
// nature = 3,
|
||
// shadow = 4,
|
||
// holy = 5,
|
||
// }
|
||
/**
|
||
* 词条解释:
|
||
* 0:战士 1:远程 2:法师
|
||
* * */
|
||
export enum HType {
|
||
warrior = 0,
|
||
remote = 1,
|
||
mage = 2,
|
||
}
|
||
|
||
export const getHeroList = (is_master:number=0)=>{
|
||
if(is_master==1){
|
||
return Masters
|
||
}else{
|
||
return HeroList
|
||
}
|
||
}
|
||
export const HeroList = [5021,5022,5023,5024,5025,5026,5027,5028]
|
||
export const MonList = [5201,5202,5203,5204,5205,5206,5216,5217,5218,5219,5220,5221,5222,5223,5224,5225,5226,5227]
|
||
export const Masters = [5001,5002,5003,5004]
|
||
|
||
export const HeroPos={
|
||
0:{pos:v3(-290,10,0)},
|
||
1:{pos:v3(-200,0,0)},
|
||
2:{pos:v3(-100,0,0)},
|
||
}
|
||
export const HQuality = {
|
||
WHITE:1,
|
||
GREEN:2,
|
||
BLUE:3,
|
||
PURPLE:4,
|
||
ORANGE:5,
|
||
}
|
||
export const MonSet = {
|
||
0:{pos:v3(340,0,0)},
|
||
1:{pos:v3(360,0,0)},
|
||
2:{pos:v3(380,0,0)},
|
||
3:{pos:v3(400,0,0)},
|
||
4:{pos:v3(420,0,0)},
|
||
5:{pos:v3(440,0,0)},
|
||
6:{pos:v3(460,0,0)},
|
||
7:{pos:v3(480,0,0)},
|
||
8:{pos:v3(500,0,0)},
|
||
9:{pos:v3(520,0,0)},
|
||
10:{pos:v3(540,0,0)},
|
||
11:{pos:v3(560,0,0)},
|
||
12:{pos:v3(580,0,0)},
|
||
13:{pos:v3(600,0,0)},
|
||
14:{pos:v3(620,0,0)},
|
||
15:{pos:v3(640,0,0)},
|
||
16:{pos:v3(660,0,0)},
|
||
17:{pos:v3(680,0,0)},
|
||
}
|
||
|
||
// 经验值计算函数 - 复杂递增规律
|
||
// 基础经验值:100
|
||
// 递增值:每级递增10,且递增值本身也会递增
|
||
// 公式:基础经验值 + 递增值累加
|
||
// 递增值规律:第1级递增值=10,第2级递增值=20,第3级递增值=30...
|
||
export const getUpExp = (currentLevel: number): number => {
|
||
const baseExp = 100; // 基础经验值
|
||
let totalIncrement = 0;
|
||
|
||
// 计算从1级到当前等级的递增值累加
|
||
for (let level = 1; level < currentLevel; level++) {
|
||
totalIncrement += level * 10; // 每级的递增值 = 等级 * 10
|
||
}
|
||
|
||
return baseExp + totalIncrement;
|
||
};
|
||
|
||
// 获取从当前等级升级到目标等级所需的总经验值
|
||
export const getTotalUpExp = (currentLevel: number, targetLevel: number): number => {
|
||
let totalExp = 0;
|
||
for (let level = currentLevel; level < targetLevel; level++) {
|
||
totalExp += getUpExp(level);
|
||
}
|
||
return totalExp;
|
||
};
|
||
|
||
// 简化的升级属性增长计算
|
||
// 基于 HType 的攻击力增长配置
|
||
export const ApGrowthByType = {
|
||
[HType.warrior]: (baseAp: number) => Math.floor(baseAp * 0.05) + 3, // 战士:+5% + 3
|
||
[HType.remote]: (baseAp: number) => Math.floor(baseAp * 0.10) + 2, // 远程:+10% + 2
|
||
[HType.mage]: (baseAp: number) => Math.floor(baseAp * 0.15) + 1, // 法师:+15% + 1
|
||
};
|
||
|
||
// 基于 HType 的HP增长配置
|
||
export const HpGrowthByType = {
|
||
[HType.warrior]: (baseHp: number) => Math.floor(baseHp * 0.08) + 10, // 战士:+8% + 10
|
||
[HType.remote]: (baseHp: number) => Math.floor(baseHp * 0.05) + 5, // 远程:+5% + 5
|
||
[HType.mage]: (baseHp: number) => Math.floor(baseHp * 0.03) + 3, // 法师:+3% + 3
|
||
};
|
||
|
||
// 获取从1级升级到2级增加的攻击力
|
||
export const getUpAp = (heroId: number): number => {
|
||
const heroInfo = HeroInfo[heroId];
|
||
if (!heroInfo) {
|
||
console.warn(`[getUpAp] 英雄 ${heroId} 不存在`);
|
||
return 0;
|
||
}
|
||
|
||
const baseAp = heroInfo.ap;
|
||
const heroType = heroInfo.type;
|
||
const growthFunction = ApGrowthByType[heroType] || ApGrowthByType[HType.warrior];
|
||
return growthFunction(baseAp);
|
||
};
|
||
|
||
// 获取从1级升级到2级增加的HP
|
||
export const getUpHp = (heroId: number): number => {
|
||
const heroInfo = HeroInfo[heroId];
|
||
if (!heroInfo) {
|
||
console.warn(`[getUpHp] 英雄 ${heroId} 不存在`);
|
||
return 0;
|
||
}
|
||
|
||
const baseHp = heroInfo.hp;
|
||
const heroType = heroInfo.type;
|
||
const growthFunction = HpGrowthByType[heroType] || HpGrowthByType[HType.warrior];
|
||
return growthFunction(baseHp);
|
||
};
|
||
|
||
// 获取英雄在指定等级的总攻击力
|
||
export const getHeroTotalAp = (heroId: number, level: number): number => {
|
||
const heroInfo = HeroInfo[heroId];
|
||
if (!heroInfo) {
|
||
console.warn(`[getHeroTotalAp] 英雄 ${heroId} 不存在`);
|
||
return 0;
|
||
}
|
||
|
||
const baseAp = heroInfo.ap;
|
||
const heroType = heroInfo.type;
|
||
const growthFunction = ApGrowthByType[heroType] || ApGrowthByType[HType.warrior];
|
||
const levelUpAp = growthFunction(baseAp);
|
||
return baseAp + levelUpAp;
|
||
};
|
||
|
||
// 获取英雄在指定等级的总HP
|
||
export const getHeroTotalHp = (heroId: number, level: number): number => {
|
||
const heroInfo = HeroInfo[heroId];
|
||
if (!heroInfo) {
|
||
console.warn(`[getHeroTotalHp] 英雄 ${heroId} 不存在`);
|
||
return 0;
|
||
}
|
||
|
||
const baseHp = heroInfo.hp;
|
||
const heroType = heroInfo.type;
|
||
const growthFunction = HpGrowthByType[heroType] || HpGrowthByType[HType.warrior];
|
||
const levelUpHp = growthFunction(baseHp);
|
||
return baseHp + levelUpHp;
|
||
};
|
||
|
||
// 获取从当前等级升级到目标等级增加的攻击力
|
||
export const getApIncrease = (heroId: number, currentLevel: number, targetLevel: number): number => {
|
||
const heroInfo = HeroInfo[heroId];
|
||
if (!heroInfo) {
|
||
console.warn(`[getApIncrease] 英雄 ${heroId} 不存在`);
|
||
return 0;
|
||
}
|
||
|
||
const baseAp = heroInfo.ap;
|
||
const heroType = heroInfo.type;
|
||
const growthFunction = ApGrowthByType[heroType] || ApGrowthByType[HType.warrior];
|
||
return growthFunction(baseAp);
|
||
};
|
||
|
||
// 获取从当前等级升级到目标等级增加的HP
|
||
export const getHpIncrease = (heroId: number, currentLevel: number, targetLevel: number): number => {
|
||
const heroInfo = HeroInfo[heroId];
|
||
if (!heroInfo) {
|
||
console.warn(`[getHpIncrease] 英雄 ${heroId} 不存在`);
|
||
return 0;
|
||
}
|
||
|
||
const baseHp = heroInfo.hp;
|
||
const heroType = heroInfo.type;
|
||
const growthFunction = HpGrowthByType[heroType] || HpGrowthByType[HType.warrior];
|
||
return growthFunction(baseHp);
|
||
};
|
||
|
||
// 获取升级后的完整属性信息
|
||
export const getLevelUpStats = (heroId: number, currentLevel: number, targetLevel: number) => {
|
||
return {
|
||
apIncrease: getApIncrease(heroId, currentLevel, targetLevel),
|
||
hpIncrease: getHpIncrease(heroId, currentLevel, targetLevel),
|
||
newTotalAp: getHeroTotalAp(heroId, targetLevel),
|
||
newTotalHp: getHeroTotalHp(heroId, targetLevel)
|
||
};
|
||
};
|
||
|
||
// 根据英雄类型获取增长模式描述
|
||
export const getGrowthModeDescription = (heroType: HType): string => {
|
||
switch (heroType) {
|
||
case HType.warrior:
|
||
return "战士型:AP固定增长为主(每级+3,+5%),HP高增长(每级+10,+8%)";
|
||
case HType.remote:
|
||
return "远程型:AP平衡增长(每级+2,+10%),HP中等增长(每级+5,+5%)";
|
||
case HType.mage:
|
||
return "法师型:AP百分比增长为主(每级+1,+15%),HP低增长(每级+3,+3%)";
|
||
default:
|
||
return "未知类型";
|
||
}
|
||
};
|
||
|
||
export const HeroInfo = {
|
||
|
||
//主将
|
||
5001:{uuid:5001,name:"刺心.艾吉斯",path:"k1", quality:HQuality.BLUE,lv:1,kind:1,
|
||
type:HType.warrior,hp:50,ap:10,dis:600,cd:1.5,speed:50,skills:[6005],
|
||
buff:[
|
||
{buff_type:BuffAttr.PUNCTURE,value:10},
|
||
],info:"剑类专精,穿刺伤害额外+10%"},
|
||
|
||
5002:{uuid:5002,name:"飓风.格罗姆",path:"k2", quality:HQuality.BLUE,lv:1,kind:1,
|
||
type:HType.warrior,hp:50,ap:10,dis:600,cd:1.5,speed:50,skills:[6006],
|
||
buff:[
|
||
{buff_type:BuffAttr.WFUNY,value:10},
|
||
],info:"斧类专精,风怒概率增加10%"},
|
||
|
||
5003:{uuid:5003,name:"碎颅.赫克托",path:"k4", quality:HQuality.BLUE,lv:1,kind:1,
|
||
type:HType.warrior,hp:50,ap:10,dis:600,cd:1.5,speed:50,skills:[6007],
|
||
buff:[
|
||
{buff_type:BuffAttr.CRITICAL,value:10},
|
||
],info:"锤类专精,暴击概率增加10%"},
|
||
|
||
5004:{uuid:5004,name:"裂伤.塔米拉",path:"k3", quality:HQuality.BLUE,lv:1,kind:1,
|
||
type:HType.warrior,hp:50,ap:10,dis:600,cd:1.5,speed:50,skills:[6008],
|
||
buff:[
|
||
{buff_type:BuffAttr.BURN_COUNT,value:1},
|
||
],info:"刀类专精,易伤效果额外持续1次"},
|
||
|
||
5005:{uuid:5005,name:"烈焰.艾尔文",path:"zh1", quality:HQuality.BLUE,lv:1,kind:2,
|
||
type:HType.mage,hp:50,ap:10,dis:600,cd:1.5,speed:50,skills:[6005],
|
||
buff:[
|
||
|
||
],info:"说明"},
|
||
|
||
5006:{uuid:5006,name:"风暴.艾尔文",path:"zh2", quality:HQuality.BLUE,lv:1,kind:2,
|
||
type:HType.mage,hp:50,ap:10,dis:600,cd:1.5,speed:50,skills:[6005],
|
||
buff:[
|
||
|
||
],info:"说明"},
|
||
|
||
5007:{uuid:5007,name:"战争.艾尔文",path:"zh3", quality:HQuality.BLUE,lv:1,kind:2,
|
||
type:HType.mage,hp:50,ap:10,dis:600,cd:1.5,speed:50,skills:[6005],
|
||
buff:[
|
||
|
||
],info:"说明"},
|
||
|
||
|
||
//伙伴
|
||
5021:{uuid:5021,name:"幽灵射手",path:"a4", quality:HQuality.BLUE,lv:1,kind:2,
|
||
type:HType.remote,hp:50,ap:15,dis:600,cd:1.5,speed:50,skills:[6002],
|
||
buff:[
|
||
|
||
],info:"说明"},
|
||
5022:{uuid:5022,name:"战争领主",path:"k5", quality:HQuality.BLUE,lv:1,kind:2,
|
||
type:HType.warrior,hp:50,ap:10,dis:600,cd:1.5,speed:50,skills:[6001],
|
||
buff:[
|
||
|
||
],info:"说明"},
|
||
|
||
5023:{uuid:5023,name:"混沌法师",path:"zh1", quality:HQuality.BLUE,lv:1,kind:2,
|
||
type:HType.mage,hp:50,ap:10,dis:600,cd:1.5,speed:50,skills:[6001],
|
||
buff:[
|
||
|
||
],info:"说明"},
|
||
|
||
5024:{uuid:5024,name:"火焰法师",path:"zh2", quality:HQuality.BLUE,lv:1,kind:2,
|
||
type:HType.mage,hp:50,ap:15,dis:600,cd:1.5,speed:50,skills:[6001],
|
||
buff:[
|
||
|
||
],info:"说明"},
|
||
|
||
5025:{uuid:5025,name:"风暴精灵",path:"m4", quality:HQuality.BLUE,lv:1,kind:2,
|
||
type:HType.mage,hp:50,ap:15,dis:600,cd:1.5,speed:50,skills:[6001],
|
||
buff:[
|
||
|
||
],info:"说明"},
|
||
|
||
5026:{uuid:5026,name:"战争祭祀",path:"d2", quality:HQuality.BLUE,lv:1,kind:2,
|
||
type:HType.mage,hp:50,ap:10,dis:600,cd:1.5,speed:50,skills:[6001],
|
||
buff:[
|
||
|
||
],info:"说明"},
|
||
|
||
5027:{uuid:5027,name:"暴风射手",path:"a5", quality:HQuality.BLUE,lv:1,kind:2,
|
||
type:HType.remote,hp:50,ap:15,dis:600,cd:1.5,speed:50,skills:[6002],
|
||
buff:[
|
||
|
||
],info:"说明"},
|
||
|
||
5028:{uuid:5028,name:"苍穹射手",path:"a3", quality:HQuality.BLUE,lv:1,kind:1,
|
||
type:HType.remote,hp:50,ap:15,dis:600,cd:1.5,speed:50,skills:[6002],
|
||
buff:[
|
||
|
||
],info:"说明"},
|
||
|
||
|
||
//怪物
|
||
5201:{uuid:5201,name:"兽人战士",path:"mor1", quality:HQuality.GREEN,lv:1,kind:1,
|
||
type:HType.warrior,hp:25,ap:8,dis:200,cd:1.5,speed:45,skills:[6007],
|
||
buff:[
|
||
|
||
],info:"普通怪物-战士型"},
|
||
|
||
5202:{uuid:5202,name:"兽人刺客",path:"mor2", quality:HQuality.GREEN,lv:1,kind:1,
|
||
type:HType.warrior,hp:25,ap:8,dis:200,cd:1.5,speed:45,skills:[6007],
|
||
buff:[
|
||
|
||
],info:"普通怪物-战士型"},
|
||
|
||
5203:{uuid:5203,name:"兽人护卫",path:"mor3", quality:HQuality.GREEN,lv:1,kind:1,
|
||
type:HType.remote,hp:20,ap:12,dis:200,cd:1.5,speed:50,skills:[6007],
|
||
buff:[
|
||
|
||
],info:"远程怪物-高伤害"},
|
||
|
||
5204:{uuid:5204,name:"石卫", path:"mgem1",quality:HQuality.GREEN,lv:1,kind:1,
|
||
type:HType.warrior,hp:25,ap:8,dis:200,cd:1.5,speed:45,skills:[6007],
|
||
buff:[
|
||
|
||
],info:"普通怪物-战士型"},
|
||
|
||
5205:{uuid:5205,name:"土卫", path:"mgem2",quality:HQuality.GREEN,lv:1,kind:1,
|
||
type:HType.warrior,hp:25,ap:8,dis:200,cd:1.5,speed:45,skills:[6007],
|
||
buff:[
|
||
|
||
],info:"普通怪物-战士型"},
|
||
|
||
5206:{uuid:5206,name:"树人", path:"mgem3",quality:HQuality.GREEN,lv:1,kind:1,
|
||
type:HType.warrior,hp:25,ap:8,dis:200,cd:1.5,speed:45,skills:[6007],
|
||
buff:[
|
||
|
||
],info:"普通怪物-战士型"},
|
||
|
||
5216:{uuid:5216,name:"元素1", path:"my1", quality:HQuality.GREEN,lv:2,kind:1,
|
||
type:HType.mage,hp:18,ap:15,dis:350,cd:1.2,speed:40,skills:[6007],
|
||
buff:[
|
||
|
||
],info:"法师怪物-高伤害脆弱"},
|
||
|
||
5217:{uuid:5217,name:"元素2", path:"my2", quality:HQuality.GREEN,lv:2,kind:1,
|
||
type:HType.mage,hp:18,ap:15,dis:350,cd:1.2,speed:40,skills:[6007],
|
||
buff:[
|
||
|
||
],info:"法师怪物-高伤害脆弱"},
|
||
|
||
5218:{uuid:5218,name:"元素3", path:"my3", quality:HQuality.GREEN,lv:2,kind:1,
|
||
type:HType.mage,hp:18,ap:15,dis:350,cd:1.2,speed:40,skills:[6007],
|
||
buff:[
|
||
|
||
],info:"法师怪物-高伤害脆弱"},
|
||
|
||
5219:{uuid:5219,name:"牛头战士",path:"mn1", quality:HQuality.GREEN,lv:2,kind:1,
|
||
type:HType.warrior,hp:25,ap:8,dis:200,cd:1.5,speed:45,skills:[6007],
|
||
buff:[
|
||
|
||
],info:"普通怪物-战士型"},
|
||
|
||
5220:{uuid:5220,name:"牛头战士",path:"mn2", quality:HQuality.GREEN,lv:1,kind:1,
|
||
type:HType.remote,hp:20,ap:12,dis:200,cd:1.5,speed:50,skills:[6007],
|
||
buff:[
|
||
|
||
],info:"远程怪物-高伤害"},
|
||
|
||
5221:{uuid:5221,name:"牛头战士",path:"mn3", quality:HQuality.GREEN,lv:1,kind:1,
|
||
type:HType.warrior,hp:25,ap:8,dis:200,cd:1.5,speed:45,skills:[6007],
|
||
buff:[
|
||
|
||
],info:"普通怪物-战士型"},
|
||
|
||
5222:{uuid:5222,name:"独眼巨人",path:"md1", quality:HQuality.GREEN,lv:1,kind:1,
|
||
type:HType.warrior,hp:25,ap:8,dis:200,cd:1.5,speed:45,skills:[6007],
|
||
buff:[
|
||
|
||
],info:"普通怪物-战士型"},
|
||
|
||
5223:{uuid:5223,name:"独眼巨人",path:"md2", quality:HQuality.GREEN,lv:1,kind:1,
|
||
type:HType.warrior,hp:25,ap:8,dis:200,cd:1.5,speed:45,skills:[6007],
|
||
buff:[
|
||
|
||
],info:"普通怪物-战士型"},
|
||
|
||
5224:{uuid:5224,name:"独眼巨人",path:"md3", quality:HQuality.GREEN,lv:1,kind:1,
|
||
type:HType.remote,hp:20,ap:12,dis:200,cd:1.5,speed:50,skills:[6007],
|
||
buff:[
|
||
|
||
],info:"远程怪物-高伤害"},
|
||
|
||
5225:{uuid:5225,name:"精英独眼",path:"md4", quality:HQuality.BLUE,lv:1,kind:1,
|
||
type:HType.mage,hp:18,ap:15,dis:400,cd:1.2,speed:40,skills:[6007],
|
||
buff:[
|
||
|
||
],info:"法师怪物-高伤害脆弱"},
|
||
|
||
5226:{uuid:5226,name:"精英牛头",path:"mn4", quality:HQuality.BLUE,lv:1,kind:1,
|
||
type:HType.mage,hp:18,ap:15,dis:400,cd:1.2,speed:40,skills:[6007],
|
||
buff:[
|
||
|
||
],info:"法师怪物-高伤害脆弱"},
|
||
|
||
5227:{uuid:5227,name:"精英兽人",path:"mor4", quality:HQuality.BLUE,lv:1,kind:1,
|
||
type:HType.mage,hp:18,ap:15,dis:400,cd:1.2,speed:40,skills:[6007],
|
||
buff:[
|
||
|
||
],info:"法师怪物-高伤害脆弱"}
|
||
};
|
||
|
||
|