diff --git a/assets/script/game/common/config/GameSet.ts b/assets/script/game/common/config/GameSet.ts index 167e25b4..0780fb03 100644 --- a/assets/script/game/common/config/GameSet.ts +++ b/assets/script/game/common/config/GameSet.ts @@ -50,6 +50,8 @@ export enum FightSet { BASE_COST = 5, INIT_COIN = 7, // 初始金币数 INIT_REFRESH_STONE = 3, // 初始刷新石数量 + /** 单次刷新消耗的刷新石数量 */ + REFRESH_STONE_COST = 1, } /** diff --git a/assets/script/game/map/MissionCardComp.ts b/assets/script/game/map/MissionCardComp.ts index f082ea49..d7b91576 100644 --- a/assets/script/game/map/MissionCardComp.ts +++ b/assets/script/game/map/MissionCardComp.ts @@ -1699,10 +1699,11 @@ export class MissionCardComp extends CCComp { private updateDrawCostUI() { const stones = MissionEconomy.getRefreshStone(); - this.updateOneRefreshBtnUI(this.cards_chou, stones); - this.updateOneRefreshBtnUI(this.equip_refresh, stones); - this.updateOneRefreshBtnUI(this.shop_refresh, stones); - this.updateOneRefreshBtnUI(this.skill_refresh, stones); + const stoneCost = MissionEconomy.getRefreshStoneCost(); + this.updateOneRefreshBtnUI(this.cards_chou, stones, stoneCost); + this.updateOneRefreshBtnUI(this.equip_refresh, stones, stoneCost); + this.updateOneRefreshBtnUI(this.shop_refresh, stones, stoneCost); + this.updateOneRefreshBtnUI(this.skill_refresh, stones, stoneCost); } /** @@ -1717,11 +1718,13 @@ export class MissionCardComp extends CCComp { * * @param btnNode 刷新按钮节点 * @param stones 当前刷新石数量(外部统一读取,避免 4 次重复访问) + * @param stoneCost 单次刷新消耗的刷新石数量 */ - private updateOneRefreshBtnUI(btnNode: Node | null, stones: number) { + private updateOneRefreshBtnUI(btnNode: Node | null, stones: number, stoneCost: number) { if (!btnNode || !btnNode.isValid) return; - const useStone = stones > 0; + // 刷新石足够一次消耗时走刷新石通道,否则走金币通道 + const useStone = stones >= stoneCost; // 置灰遮罩:有刷新石必定可刷新,否则按金币判断 const nobg = btnNode.getChildByName("nobg"); @@ -1745,14 +1748,14 @@ export class MissionCardComp extends CCComp { } } - // 刷新石费用节点(显示当前持有数量) + // 刷新石费用节点(显示单次刷新消耗数量) const stoneNode = container.getChildByName("stone"); if (stoneNode) { stoneNode.active = useStone; if (useStone) { const numLabel = stoneNode.getChildByName("num")?.getComponent(Label); if (numLabel) { - numLabel.string = `${stones}`; + numLabel.string = `${stoneCost}`; } } } diff --git a/assets/script/game/map/MissionEconomy.ts b/assets/script/game/map/MissionEconomy.ts index 38cf6d8f..69f10ff2 100644 --- a/assets/script/game/map/MissionEconomy.ts +++ b/assets/script/game/map/MissionEconomy.ts @@ -1,6 +1,7 @@ import { smc } from "../common/SingletonModuleComp"; import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops"; import { GameEvent } from "../common/config/GameEvent"; +import { FightSet } from "../common/config/GameSet"; import { FieldSkillType } from "../common/config/SkillSet"; import { FieldSkillHelper } from "../hero/FieldSkillHelper"; @@ -70,26 +71,32 @@ export class MissionEconomy { oops.message.dispatchEvent(GameEvent.RefreshStone, { delta: amount }); } + /** 单次刷新消耗的刷新石数量 */ + static getRefreshStoneCost(): number { + return Math.max(1, Math.floor(FightSet.REFRESH_STONE_COST)); + } + /** - * 判断当前是否可以执行一次刷新(有刷新石或金币足够) + * 判断当前是否可以执行一次刷新(刷新石足够或金币足够) */ static canRefresh(baseCost: number = 1): boolean { - if (this.getRefreshStone() > 0) return true; + if (this.getRefreshStone() >= this.getRefreshStoneCost()) return true; return this.getCoin() >= this.getRefreshCost(baseCost); } - /** + /** * 执行刷新卡牌: - * 1. 刷新石 > 0 时优先扣除 1 颗刷新石(不消耗金币)。 + * 1. 刷新石足够时优先扣除 REFRESH_STONE_COST 颗刷新石(不消耗金币)。 * 2. 刷新石不足时扣除金币(含刷新优惠折扣)。 */ static executeRefresh(baseCost: number = 1): boolean { // 优先消耗刷新石 + const stoneCost = this.getRefreshStoneCost(); const stones = this.getRefreshStone(); - if (stones > 0) { - smc.vmdata.mission_data.refresh_stone = stones - 1; + if (stones >= stoneCost) { + smc.vmdata.mission_data.refresh_stone = stones - stoneCost; smc.vmdata.scores.refresh_count++; - oops.message.dispatchEvent(GameEvent.RefreshStone, { delta: -1 }); + oops.message.dispatchEvent(GameEvent.RefreshStone, { delta: -stoneCost }); return true; }