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
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ export enum UIID {
|
||||
IBox,
|
||||
Notity,
|
||||
Ranks,
|
||||
Heros,
|
||||
}
|
||||
|
||||
/** 打开界面方式的配置数据 */
|
||||
@@ -29,4 +30,5 @@ export var UIConfigData: { [key: number]: UIConfig } = {
|
||||
[UIID.IBox]: { layer: LayerType.UI, prefab: "gui/element/ibox" },
|
||||
[UIID.Notity]: { layer: LayerType.UI, prefab: "gui/element/notity" },
|
||||
[UIID.Ranks]: { layer: LayerType.UI, prefab: "gui/element/ranks" },
|
||||
[UIID.Heros]: { layer: LayerType.UI, prefab: "gui/element/heros" },
|
||||
}
|
||||
@@ -25,6 +25,7 @@ import { HeroInfo, HeroList } from "../common/config/heroSet";
|
||||
import { IType, SkillSet } from "../common/config/SkillSet";
|
||||
import { oops } from "db://oops-framework/core/Oops";
|
||||
import { mLogger } from "../common/Logger";
|
||||
import { UIID } from "../common/config/GameUIConfig";
|
||||
|
||||
const {property, ccclass } = _decorator;
|
||||
|
||||
@@ -96,7 +97,14 @@ export class HListComp extends CCComp {
|
||||
this.pre_btn?.on(NodeEventType.TOUCH_END, this.onPreClick, this);
|
||||
this.next_btn?.on(NodeEventType.TOUCH_END, this.onNextClick, this);
|
||||
}
|
||||
|
||||
/** 预留:弹窗打开时接收参数 */
|
||||
onAdded(args: any) {
|
||||
|
||||
}
|
||||
/** 关闭排行榜弹窗 */
|
||||
closeHeros(){
|
||||
oops.gui.remove(UIID.Ranks)
|
||||
}
|
||||
start() {
|
||||
// 初始化轮播节点数组和固定位置
|
||||
if (this.phero1_icon && this.phero_icon && this.hero_icon && this.nhero_icon && this.nhero1_icon) {
|
||||
|
||||
@@ -83,7 +83,9 @@ export class MissionHomeComp extends CCComp {
|
||||
openRanks(){
|
||||
oops.gui.open(UIID.Ranks)
|
||||
}
|
||||
|
||||
openHero(){
|
||||
oops.gui.open(UIID.Heros)
|
||||
}
|
||||
/** 任务结束回调:重新显示主页 */
|
||||
mission_end(){
|
||||
mLogger.log(this.debugMode, 'MissionHomeComp', "[MissionHomeComp]=>mission_end")
|
||||
|
||||
Reference in New Issue
Block a user