功能性卡牌功能继续

This commit is contained in:
2025-06-18 17:17:29 +08:00
parent b6a2ab2921
commit ab9ff70f77
4 changed files with 69 additions and 38 deletions

View File

@@ -16,18 +16,21 @@ export const cardType={
HERO:1,
SKILL:2,
EQUIP:3,
SPECIAL:4,
}
// 获取随机卡牌UUID
export function getRandomCardUUID(
heroRate: number = 1, // 伙伴出现概率修正系数
skillRate: number = 1, // 技能出现概率修正系数
equipRate: number = 1 // 装备出现概率修正系数
equipRate: number = 1, // 装备出现概率修正系数
specialRate: number = 1 // 功能卡牌出现概率修正系数
): { type: number; uuid: number } {
// 计算修正后的概率
const adjustedProbability = {
1: CardProbability[1] * heroRate,
2: CardProbability[2] * skillRate,
3: CardProbability[3] * equipRate
3: CardProbability[3] * equipRate,
4: CardProbability[4] * specialRate
};
// 计算总概率
@@ -38,47 +41,53 @@ export function getRandomCardUUID(
let cumulativeProbability = 0;
// 根据修正后的概率确定卡牌类型
let cardType = 1; // 默认类型为伙伴
let c_type = 1; // 默认类型为伙伴
for (const [type, probability] of Object.entries(adjustedProbability)) {
cumulativeProbability += probability;
if (random <= cumulativeProbability) {
cardType = parseInt(type);
c_type = parseInt(type);
break;
}
}
// 根据类型获取对应的卡牌列表
let cardList: number[] = [];
switch (cardType) {
case 1: // 伙伴
switch (c_type) {
case cardType.HERO: // 伙伴
cardList = HeroList;
break;
case 2: // 技能
case cardType.SKILL: // 技能
cardList = HeroSkillList;
break;
case 3: // 装备
case cardType.EQUIP: // 装备
cardList = equip_list;
break;
case cardType.SPECIAL: // 功能卡牌
cardList = SuperCardsList;
break;
}
// 从对应类型的卡牌列表中随机选择一个
const randomIndex = Math.floor(Math.random() * cardList.length);
return {type:cardType,uuid:cardList[randomIndex]};
return {type:c_type,uuid:cardList[randomIndex]};
}
// 获取指定类型的随机卡牌UUID
export function getRandomCardUUIDByType(type: number): number {
let cardList: number[] = [];
switch (type) {
case 1: // 伙伴
case cardType.HERO: // 伙伴
cardList = HeroList;
break;
case 2: // 技能
case cardType.SKILL: // 技能
cardList = HeroSkillList;
break;
case 3: // 装备
case cardType.EQUIP: // 装备
cardList = equip_list;
break;
case cardType.SPECIAL: // 功能卡牌
cardList = SuperCardsList;
break;
default:
throw new Error(`Invalid card type: ${type}`);
}
@@ -103,6 +112,9 @@ export function getRandomCardsByType(
case cardType.EQUIP:
cardList = equip_list;
break;
case cardType.SPECIAL:
cardList = SuperCardsList;
break;
default:
throw new Error(`Invalid card type: ${type}`);
}
@@ -125,6 +137,7 @@ export const SuperCardsType={
BUFF:3, //buff技能 范围buff
DEBUFF:4, //debuff技能 范围debuff
}
export const SuperCardsList=[3001,3002,3101,3201,3301];
export const SuperCards={
3001:{uuid:3001,name:"附魔宝典",path:"3001",type:SuperCardsType.SPECIAL,value1:1,value2:0,value3:0,tals:"你的提升英雄/伙伴属性的装备效果,额外添加+1攻击力"},
3002:{uuid:3002,name:"附魔宝典",path:"3002",type:SuperCardsType.SPECIAL,value1:0,value2:1,value3:0,tals:"你的提升英雄/伙伴属性的装备效果,额外添加+1生命值"},