refactor(map): 移除所有卡牌购买的扣费逻辑,改为免费获取
统一调整四个卡牌组件的购买流程,删除MissionEconomy导入和扣费校验代码,更新注释说明当前为免费购买模式,简化日志输出内容
This commit is contained in:
@@ -25,10 +25,6 @@ import { oops } from "db://oops-framework/core/Oops";
|
||||
import { GameEvent } from "../common/config/GameEvent";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { HeroAttrsComp } from "../hero/HeroAttrsComp";
|
||||
import { FieldSkillType } from "../common/config/SkillSet";
|
||||
import { FieldSkillHelper } from "../hero/FieldSkillHelper";
|
||||
import { MissionEconomy } from "./MissionEconomy";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/**
|
||||
@@ -538,10 +534,11 @@ export class CHeroComp extends CCComp {
|
||||
* 购买点击处理:
|
||||
* 1. 播放按钮点击回弹动画。
|
||||
* 2. 英雄卡先通过 UseHeroCard 事件做数量上限校验(guard 模式,可被取消)。
|
||||
* 3. 扣除金币(失败则提示并中止)。
|
||||
* 4. 按卡牌类型分发效果:英雄卡 → CallHero 召唤英雄;特殊卡 → UseSpecialCard。
|
||||
* 5. 派发 CardUsed 通知 MissionCardComp 刷新英雄卡池。
|
||||
* 6. 标记已购买,隐藏购买按钮。
|
||||
* 3. 按卡牌类型分发效果:英雄卡 → CallHero 召唤英雄;特殊卡 → UseSpecialCard。
|
||||
* 4. 派发 CardUsed 通知 MissionCardComp 刷新英雄卡池。
|
||||
* 5. 标记已购买,隐藏购买按钮。
|
||||
*
|
||||
* 注:购买不花费金币(免费获取),原扣费逻辑已移除。
|
||||
*/
|
||||
private onBuyClick() {
|
||||
if (!this.cardData || this.isPurchased) return;
|
||||
@@ -564,22 +561,6 @@ export class CHeroComp extends CCComp {
|
||||
if (guard.cancel) return;
|
||||
}
|
||||
|
||||
// 扣费(英雄卡享受驻场"购买优惠"折扣)
|
||||
let cost = this.cardData.cost ?? 0;
|
||||
if (this.cardData.type === CardType.Hero) {
|
||||
const discount = FieldSkillHelper.getFieldSkillTotalValue(FieldSkillType.BuyDiscount);
|
||||
cost = Math.max(0, cost - discount);
|
||||
}
|
||||
const success = MissionEconomy.spendCoin(Math.floor(cost));
|
||||
if (!success) {
|
||||
oops.message.dispatchEvent(GameEvent.ShowSmallTip, "buy_coin");
|
||||
mLogger.log(this.debugMode, "CHeroComp", "purchase failed: not enough coin", {
|
||||
uuid: this.cardData.uuid,
|
||||
cost
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
smc.vmdata.scores.refresh_hit_count++;
|
||||
|
||||
const used = this.cardData;
|
||||
@@ -609,8 +590,7 @@ export class CHeroComp extends CCComp {
|
||||
|
||||
mLogger.log(this.debugMode, "CHeroComp", "hero card purchased", {
|
||||
uuid: used.uuid,
|
||||
type: used.type,
|
||||
cost
|
||||
type: used.type
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user