刷怪完成
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { v3 } from "cc"
|
||||
import { FacSet } from "./BoxSet"
|
||||
|
||||
/**
|
||||
* kind :1:烈焰 2:寒冰 3:自然 4:暗影 5:神圣
|
||||
@@ -27,32 +28,23 @@ export enum HType {
|
||||
remote = 1,
|
||||
mage = 2,
|
||||
}
|
||||
|
||||
export const getHeroList = ()=>{
|
||||
return Masters
|
||||
|
||||
//fac:FacSet.HERO
|
||||
export const getHeroList = (quality:number)=>{
|
||||
return Object.values(HeroInfo).filter(item=>{
|
||||
const facMatch = item.fac === FacSet.HERO;
|
||||
const qualityMatch = quality === 0 || item.quality === quality;
|
||||
return facMatch && qualityMatch;
|
||||
}).map(item=>item.uuid)
|
||||
}
|
||||
//fac:FacSet.MON
|
||||
export const getMonList = (quality:number)=>{
|
||||
return Object.values(HeroInfo).filter(item=>{
|
||||
const facMatch = item.fac === FacSet.MON;
|
||||
const qualityMatch = quality === 0 || item.quality === quality;
|
||||
return facMatch && qualityMatch;
|
||||
}).map(item=>item.uuid)
|
||||
}
|
||||
|
||||
export const getHeroListByCalled = (count:number,called:any[])=>{
|
||||
let list=Masters
|
||||
if(called.length==3){
|
||||
list=called.map((item:any)=>item.uuid)
|
||||
}
|
||||
// 确保请求数量不超过可用卡牌数量
|
||||
count = Math.min(count, list.length);
|
||||
|
||||
// 打乱数组顺序
|
||||
const shuffled = [...list].sort(() => Math.random() - 0.5);
|
||||
|
||||
// 返回指定数量的卡牌
|
||||
return shuffled.slice(0, count).map(uuid => ({
|
||||
uuid
|
||||
}));
|
||||
}
|
||||
|
||||
export const HeroList = [5021,5022,5023,5024,5025,5026,5027,5028]
|
||||
export const MonList = [5201,5202,5203,5204,5205,5206,5219,5220,5221,5222,5223,5224,5225,5226,5227]
|
||||
export const Masters = [5001,5002,5005,5008,5009,5010,5011]
|
||||
|
||||
export const HeroPos={
|
||||
0:{pos:v3(-290,0,0)},
|
||||
@@ -73,193 +65,17 @@ export const MonSet = {
|
||||
3:{pos:v3(340,0,0)},
|
||||
4:{pos:v3(400,0,0)},
|
||||
5:{pos:v3(460,0,0)},
|
||||
6:{pos:v3(520,0,0)},
|
||||
7:{pos:v3(440,0,0)},
|
||||
8:{pos:v3(480,0,0)},
|
||||
9:{pos:v3(520,0,0)},
|
||||
10:{pos:v3(560,0,0)},
|
||||
11:{pos:v3(830,0,0)},
|
||||
12:{pos:v3(870,0,0)},
|
||||
13:{pos:v3(910,0,0)},
|
||||
14:{pos:v3(950,0,0)},
|
||||
15:{pos:v3(990,0,0)},
|
||||
16:{pos:v3(1030,0,0)},
|
||||
17:{pos:v3(1070,0,0)},
|
||||
18:{pos:v3(1110,0,0)},
|
||||
19:{pos:v3(1150,0,0)},
|
||||
20:{pos:v3(1190,0,0)},
|
||||
21:{pos:v3(1230,0,0)},
|
||||
22:{pos:v3(1270,0,0)},
|
||||
23:{pos:v3(1310,0,0)},
|
||||
24:{pos:v3(1350,0,0)},
|
||||
25:{pos:v3(1390,0,0)},
|
||||
26:{pos:v3(1430,0,0)},
|
||||
27:{pos:v3(1470,0,0)},
|
||||
28:{pos:v3(1510,0,0)},
|
||||
29:{pos:v3(1550,0,0)},
|
||||
30:{pos:v3(1590,0,0)},
|
||||
31:{pos:v3(1630,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:"hk1", quality:HQuality.BLUE,lv:1,kind:1,
|
||||
5001:{uuid:5001,name:"火焰骑士",path:"hk1", fac:FacSet.HERO, quality:HQuality.BLUE,lv:1,kind:1,
|
||||
type:HType.warrior,hp:100,ap:15,dis:100,cd:1,speed:150,skills:[6011,6020],
|
||||
buff:[],info:"剑类专精,穿刺伤害额外+10%"},
|
||||
|
||||
5002:{uuid:5002,name:"hk1",path:"hk1", quality:HQuality.BLUE,lv:1,kind:1,
|
||||
5002:{uuid:5002,name:"hk1",path:"hk1", fac:FacSet.HERO, quality:HQuality.BLUE,lv:1,kind:1,
|
||||
type:HType.warrior,hp:100,ap:15,dis:100,cd:1,speed:150,skills:[6011,6004],
|
||||
buff:[],info:"斧类专精,风怒概率增加10%"},
|
||||
|
||||
@@ -271,93 +87,93 @@ export const HeroInfo = {
|
||||
// type:HType.warrior,hp:100,ap:15,dis:400,cd:1,speed:100,skills:[6010,6021,6001],
|
||||
// buff:[],info:"刀类专精,易伤效果额外持续1次"},
|
||||
|
||||
5005:{uuid:5005,name:"ha1",path:"ha1", quality:HQuality.BLUE,lv:1,kind:2,
|
||||
5005:{uuid:5005,name:"ha1",path:"ha1", fac:FacSet.HERO, quality:HQuality.BLUE,lv:1,kind:2,
|
||||
type:HType.remote,hp:100,ap:15,dis:400,cd:1,speed:100,skills:[6025,6031],
|
||||
buff:[],info:"说明"},
|
||||
|
||||
|
||||
5007:{uuid:5007,name:"mh1",path:"hmh1", quality:HQuality.BLUE,lv:1,kind:2,
|
||||
5007:{uuid:5007,name:"mh1",path:"hmh1", fac:FacSet.HERO, quality:HQuality.BLUE,lv:1,kind:2,
|
||||
type:HType.mage,hp:100,ap:15,dis:400,cd:1,speed:100,skills:[6002,6002],
|
||||
buff:[],info:"说明"},
|
||||
|
||||
5008:{uuid:5008,name:"mf1",path:"hmf1", quality:HQuality.BLUE,lv:1,kind:2,
|
||||
5008:{uuid:5008,name:"mf1",path:"hmf1", fac:FacSet.HERO, quality:HQuality.BLUE,lv:1,kind:2,
|
||||
type:HType.mage,hp:100,ap:15,dis:400,cd:1.5,speed:100,skills:[6022,6029],
|
||||
buff:[],info:"说明"},
|
||||
|
||||
5009:{uuid:5009,name:"风暴精灵",path:"hk1", quality:HQuality.BLUE,lv:1,kind:2,
|
||||
5009:{uuid:5009,name:"风暴精灵",path:"hk1", fac:FacSet.HERO, quality:HQuality.BLUE,lv:1,kind:2,
|
||||
type:HType.mage,hp:100,ap:15,dis:400,cd:1.5,speed:100,skills:[6002,6002],
|
||||
buff:[],info:"说明"},
|
||||
|
||||
5010:{uuid:5010,name:"战争祭祀",path:"hk1", quality:HQuality.BLUE,lv:1,kind:2,
|
||||
5010:{uuid:5010,name:"战争祭祀",path:"hk1", fac:FacSet.HERO, quality:HQuality.BLUE,lv:1,kind:2,
|
||||
type:HType.mage,hp:100,ap:15,dis:400,cd:1.5,speed:100,skills:[6024,6002],
|
||||
buff:[],info:"说明"},
|
||||
|
||||
5011:{uuid:5011,name:"ha2",path:"ha2", quality:HQuality.BLUE,lv:1,kind:2,
|
||||
5011:{uuid:5011,name:"ha2",path:"ha2", fac:FacSet.HERO, quality:HQuality.BLUE,lv:1,kind:2,
|
||||
type:HType.remote,hp:100,ap:15,dis:400,cd:1,speed:100,skills:[6003,6003],
|
||||
buff:[],info:"说明"},
|
||||
|
||||
|
||||
|
||||
//怪物
|
||||
5201:{uuid:5201,name:"兽人战士",path:"mo1", quality:HQuality.GREEN,lv:1,kind:1,
|
||||
5201:{uuid:5201,name:"兽人战士",path:"mo1", fac:FacSet.MON, quality:HQuality.GREEN,lv:1,kind:1,
|
||||
type:HType.warrior,hp:25,ap:5,dis:90,cd:2,speed:100,skills:[6010],
|
||||
buff:[],info:"普通怪物-战士型"},
|
||||
|
||||
5202:{uuid:5202,name:"兽人刺客",path:"mo1", quality:HQuality.GREEN,lv:1,kind:1,
|
||||
5202:{uuid:5202,name:"兽人刺客",path:"mo1", fac:FacSet.MON, quality:HQuality.GREEN,lv:1,kind:1,
|
||||
type:HType.remote,hp:20,ap:5,dis:350,cd:1,speed:100,skills:[6008],
|
||||
buff:[],info:"普通怪物-战士型"},
|
||||
|
||||
5203:{uuid:5203,name:"兽人护卫",path:"mo1", quality:HQuality.GREEN,lv:1,kind:1,
|
||||
5203:{uuid:5203,name:"兽人护卫",path:"mo1", fac:FacSet.MON, quality:HQuality.GREEN,lv:1,kind:1,
|
||||
type:HType.warrior,hp:25,ap:5,dis:90,cd:2,speed:100,skills:[6010],
|
||||
buff:[],info:"普通怪物-战士型"},
|
||||
|
||||
5204:{uuid:5204,name:"石卫", path:"mo1",quality:HQuality.GREEN,lv:1,kind:1,
|
||||
5204:{uuid:5204,name:"石卫", path:"mo1", fac:FacSet.MON, quality:HQuality.GREEN,lv:1,kind:1,
|
||||
type:HType.mage,hp:18,ap:5,dis:90,cd:2.5,speed:100,skills:[6010],
|
||||
buff:[],info:"法师怪物-高伤害脆弱"},
|
||||
|
||||
5205:{uuid:5205,name:"土卫", path:"mo1",quality:HQuality.GREEN,lv:1,kind:1,
|
||||
5205:{uuid:5205,name:"土卫", path:"mo1", fac:FacSet.MON, quality:HQuality.GREEN,lv:1,kind:1,
|
||||
type:HType.mage,hp:18,ap:5,dis:90,cd:2.5,speed:100,skills:[6010],
|
||||
buff:[],info:"法师怪物-高伤害脆弱"},
|
||||
|
||||
5206:{uuid:5206,name:"树卫", path:"mo1",quality:HQuality.GREEN,lv:1,kind:1,
|
||||
5206:{uuid:5206,name:"树卫", path:"mo1", fac:FacSet.MON, quality:HQuality.GREEN,lv:1,kind:1,
|
||||
type:HType.mage,hp:18,ap:5,dis:90,cd:2.5,speed:100,skills:[6010],
|
||||
buff:[],info:"法师怪物-高伤害脆弱"},
|
||||
|
||||
|
||||
|
||||
5219:{uuid:5219,name:"牛头战士",path:"mo1", quality:HQuality.GREEN,lv:2,kind:1,
|
||||
5219:{uuid:5219,name:"牛头战士",path:"mo1", fac:FacSet.MON, quality:HQuality.GREEN,lv:2,kind:1,
|
||||
type:HType.warrior,hp:25,ap:5,dis:90,cd:2,speed:100,skills:[6010],
|
||||
buff:[],info:"普通怪物-战士型"},
|
||||
|
||||
5220:{uuid:5220,name:"牛头战士",path:"mo1", quality:HQuality.GREEN,lv:1,kind:1,
|
||||
5220:{uuid:5220,name:"牛头战士",path:"mo1", fac:FacSet.MON, quality:HQuality.GREEN,lv:1,kind:1,
|
||||
type:HType.warrior,hp:25,ap:5,dis:90,cd:2,speed:100,skills:[6010],
|
||||
buff:[],info:"普通怪物-战士型"},
|
||||
|
||||
5221:{uuid:5221,name:"牛头战士",path:"mo1", quality:HQuality.GREEN,lv:1,kind:1,
|
||||
5221:{uuid:5221,name:"牛头战士",path:"mo1", fac:FacSet.MON, quality:HQuality.GREEN,lv:1,kind:1,
|
||||
type:HType.remote,hp:20,ap:5,dis:350,cd:1.5,speed:100,skills:[6008],
|
||||
buff:[],info:"普通怪物-战士型"},
|
||||
|
||||
5222:{uuid:5222,name:"独眼巨人",path:"mo1", quality:HQuality.GREEN,lv:1,kind:1,
|
||||
5222:{uuid:5222,name:"独眼巨人",path:"mo1", fac:FacSet.MON, quality:HQuality.GREEN,lv:1,kind:1,
|
||||
type:HType.warrior,hp:25,ap:5,dis:90,cd:2,speed:100,skills:[6010],
|
||||
buff:[],info:"普通怪物-战士型"},
|
||||
|
||||
5223:{uuid:5223,name:"独眼巨人",path:"mo1", quality:HQuality.GREEN,lv:1,kind:1,
|
||||
5223:{uuid:5223,name:"独眼巨人",path:"mo1", fac:FacSet.MON, quality:HQuality.GREEN,lv:1,kind:1,
|
||||
type:HType.warrior,hp:25,ap:5,dis:90,cd:2,speed:100,skills:[6010],
|
||||
buff:[],info:"普通怪物-战士型"},
|
||||
|
||||
5224:{uuid:5224,name:"独眼巨人",path:"mo1", quality:HQuality.GREEN,lv:1,kind:1,
|
||||
5224:{uuid:5224,name:"独眼巨人",path:"mo1", fac:FacSet.MON, quality:HQuality.GREEN,lv:1,kind:1,
|
||||
type:HType.remote,hp:20,ap:5,dis:350,cd:1.5,speed:100,skills:[6010],
|
||||
buff:[],info:"普通怪物-战士型"},
|
||||
|
||||
5225:{uuid:5225,name:"精英独眼",path:"mo1", quality:HQuality.BLUE,lv:1,kind:1,
|
||||
5225:{uuid:5225,name:"精英独眼",path:"mo1", fac:FacSet.MON, quality:HQuality.BLUE,lv:1,kind:1,
|
||||
type:HType.warrior,hp:45,ap:12,dis:300,cd:2,speed:100,skills:[6006],
|
||||
buff:[],info:"精英怪物-战士型"},
|
||||
|
||||
5226:{uuid:5226,name:"精英牛头",path:"mo1", quality:HQuality.BLUE,lv:1,kind:1,
|
||||
5226:{uuid:5226,name:"精英牛头",path:"mo1", fac:FacSet.MON, quality:HQuality.BLUE,lv:1,kind:1,
|
||||
type:HType.warrior,hp:45,ap:12,dis:300,cd:2,speed:100,skills:[6007],
|
||||
buff:[],info:"精英怪物-战士型"},
|
||||
|
||||
5227:{uuid:5227,name:"精英兽人",path:"mo1", quality:HQuality.BLUE,lv:1,kind:1,
|
||||
5227:{uuid:5227,name:"精英兽人",path:"mo1", fac:FacSet.MON, quality:HQuality.BLUE,lv:1,kind:1,
|
||||
type:HType.warrior,hp:45,ap:12,dis:300,cd:2,speed:100,skills:[6008],
|
||||
buff:[],info:"精英怪物-战士型"},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user