feat: 添加英雄界面并移除英雄卡等级概率机制
- 新增英雄界面 UI 配置、预制体和动画资源 - 在 MissionHomeComp 中添加打开英雄界面的方法 - 移除 CardSet 中英雄卡从1级升级到2级的概率逻辑,简化抽卡规则 - 在 HlistComp 中添加关闭英雄界面的方法
This commit is contained in:
@@ -63,8 +63,6 @@ export const CARD_POOL_MAX_LEVEL = CardLV.LV5
|
||||
/** 英雄最高等级限制 */
|
||||
export const CARD_HERO_MAX_LEVEL = 3
|
||||
/** 基础卡池(英雄、技能、功能) */
|
||||
export const HERO_LV2_INIT_PROB = 0
|
||||
export const HERO_LV2_PROB_INC_PER_LV = 0.02
|
||||
|
||||
export const CardPoolList: CardConfig[] = [
|
||||
{ uuid: 5001, type: CardType.Hero, cost: 3, weight: 25, pool_lv: 1, kind: CKind.Hero, hero_lv: 1 },
|
||||
@@ -186,20 +184,6 @@ const pickCards = (cards: CardConfig[], count: number): CardConfig[] => {
|
||||
return selected
|
||||
}
|
||||
|
||||
/** 根据概率尝试将抽到的英雄卡的 hero_lv 提升到 2 */
|
||||
const applyHeroLv2Probability = (cards: CardConfig[], currentPoolLv: number): CardConfig[] => {
|
||||
return cards.map(card => {
|
||||
if (card.type === CardType.Hero && card.hero_lv === 1) {
|
||||
const prob = HERO_LV2_INIT_PROB + HERO_LV2_PROB_INC_PER_LV * (currentPoolLv - card.pool_lv)
|
||||
if (Math.random() < prob) {
|
||||
// 升级到2级时,花费呈指数增长 (1级cost * MERGE_NEED^(2-1))
|
||||
return { ...card, hero_lv: 2, cost: card.cost * Math.pow(FightSet.MERGE_NEED, 1) }
|
||||
}
|
||||
}
|
||||
return card
|
||||
})
|
||||
}
|
||||
|
||||
/** 获取指定等级可出现的基础卡池 */
|
||||
export const getCardPoolByLv = (lv: number, onlyCurrentLv: boolean = false): CardConfig[] => {
|
||||
const cardLv = clampCardLv(lv)
|
||||
@@ -224,13 +208,13 @@ export const getCardsByLv = (
|
||||
if (type !== undefined) {
|
||||
const typeSet = normalizeTypeFilter(type)
|
||||
const filteredPool = pool.filter(card => typeSet.has(card.type))
|
||||
return applyHeroLv2Probability(pickCards(filteredPool, 4), lv)
|
||||
return pickCards(filteredPool, 4)
|
||||
}
|
||||
const heroPool = pool.filter(card => card.type === CardType.Hero)
|
||||
const otherPool = pool.filter(card => card.type !== CardType.Hero)
|
||||
const heroes = pickCards(heroPool, 2)
|
||||
const others = pickCards(otherPool, 2)
|
||||
return applyHeroLv2Probability([...heroes, ...others], lv)
|
||||
return [...heroes, ...others]
|
||||
}
|
||||
|
||||
export const drawCardsByRule = (
|
||||
@@ -270,9 +254,5 @@ export const drawCardsByRule = (
|
||||
})
|
||||
}
|
||||
const picked = pickCards(pool, count)
|
||||
// 如果明确指定了需要的 heroLv,则不触发升级概率
|
||||
if (options.heroLv !== undefined) {
|
||||
return picked
|
||||
}
|
||||
return applyHeroLv2Probability(picked, lv)
|
||||
return picked
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user