chore: 移除游戏内天赋系统相关代码
1. 删除所有TalentType相关导入和天赋数据存储逻辑 2. 移除英雄属性天赋加成计算逻辑 3. 移除卡牌购买、刷新、售卖的天赋优惠逻辑 4. 将getTalentValue方法降级为空实现 5. 清理多余的空行代码格式
This commit is contained in:
@@ -7,7 +7,6 @@ import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/O
|
||||
import { GameEvent } from "./config/GameEvent";
|
||||
import { GameScoreStats } from "./config/HeroAttrs";
|
||||
import { mLogger } from "./Logger";
|
||||
import { TalentType } from "./config/TalentSet";
|
||||
import { gameDataSync } from "./GameDataSync";
|
||||
import { FightSet } from "./config/GameSet";
|
||||
|
||||
@@ -18,12 +17,6 @@ import { FightSet } from "./config/GameSet";
|
||||
export interface GameDate {
|
||||
gold: number,
|
||||
timestamp?: number, // 用于比对本地与云端数据的最新状态
|
||||
collection?: {
|
||||
talents: Record<TalentType, number>,
|
||||
player_level: number,
|
||||
player_exp: number,
|
||||
talent_points?: number,
|
||||
}
|
||||
}
|
||||
export interface CloudData {
|
||||
openid: string;
|
||||
@@ -65,30 +58,6 @@ export class SingletonModuleComp extends ecs.Comp {
|
||||
guides: any = [0, 0, 0, 0, 0]
|
||||
current_guide: number = 0
|
||||
|
||||
collection: {
|
||||
talents: Record<TalentType, number>;
|
||||
player_level: number;
|
||||
player_exp: number;
|
||||
talent_points?: number;
|
||||
} = {
|
||||
talents: {
|
||||
[TalentType.Attack]: 0,
|
||||
[TalentType.Hp]: 0,
|
||||
[TalentType.Critical]: 0,
|
||||
[TalentType.WindFury]: 0,
|
||||
[TalentType.Freeze]: 0,
|
||||
[TalentType.Puncture]: 0,
|
||||
[TalentType.DeadTrigger]: 0,
|
||||
[TalentType.Summon]: 0,
|
||||
[TalentType.BuyDiscount]: 0,
|
||||
[TalentType.RefreshDiscount]: 0,
|
||||
[TalentType.SellBonus]: 0
|
||||
}, // 存储各个天赋的等级: { talent_id: level }
|
||||
player_level: 1, // 玩家等级
|
||||
player_exp: 0, // 玩家当前经验
|
||||
talent_points: 0, // 兼容旧存档的历史字段
|
||||
};
|
||||
|
||||
vmdata: any = {
|
||||
game_over: false,
|
||||
game_pause: false,
|
||||
@@ -249,16 +218,6 @@ export class SingletonModuleComp extends ecs.Comp {
|
||||
if (data.gold !== undefined) {
|
||||
this.vmdata.gold = data.gold;
|
||||
}
|
||||
// 恢复收集记录
|
||||
if (data.collection) {
|
||||
const remoteCol = data.collection;
|
||||
if (remoteCol.talents) {
|
||||
Object.assign(this.collection.talents, remoteCol.talents);
|
||||
}
|
||||
if (typeof remoteCol.player_level === 'number') this.collection.player_level = remoteCol.player_level;
|
||||
if (typeof remoteCol.player_exp === 'number') this.collection.player_exp = remoteCol.player_exp;
|
||||
if (typeof remoteCol.talent_points === 'number') this.collection.talent_points = remoteCol.talent_points;
|
||||
}
|
||||
}
|
||||
|
||||
// 触发UI更新
|
||||
@@ -271,7 +230,6 @@ export class SingletonModuleComp extends ecs.Comp {
|
||||
getGameDate() {
|
||||
let data: GameDate = {
|
||||
gold: this.vmdata.gold,
|
||||
collection: this.collection,
|
||||
timestamp: Date.now() // 每次获取当前数据结构时都附带最新的时间戳
|
||||
};
|
||||
return data;
|
||||
|
||||
@@ -13,7 +13,6 @@ import { Attrs} from "../common/config/HeroAttrs";
|
||||
import { MoveComp } from "./MoveComp";
|
||||
import { mLogger } from "../common/Logger";
|
||||
import { FieldSkillType } from "../common/config/SkillSet";
|
||||
import { TalentType } from "../common/config/TalentSet";
|
||||
/** 英雄实体:负责英雄节点创建、属性初始化、入场动画与销毁流程 */
|
||||
@ecs.register(`Hero`)
|
||||
|
||||
@@ -133,21 +132,9 @@ export class Hero extends ecs.Entity {
|
||||
model.base_ap = base_ap;
|
||||
model.base_hp = base_hp;
|
||||
|
||||
// 应用天赋加成
|
||||
if (model.fac === FacSet.HERO) {
|
||||
let apBonus = HeroAttrsComp.getTalentValue(TalentType.Attack); // 攻击强化
|
||||
let hpBonus = HeroAttrsComp.getTalentValue(TalentType.Hp); // 生命强化
|
||||
model.ap = base_ap * (1 + apBonus / 100);
|
||||
model.hp = model.hp_max = base_hp * (1 + hpBonus / 100);
|
||||
model.critical = HeroAttrsComp.getTalentValue(TalentType.Critical); // 暴击强化
|
||||
model.wfuny = HeroAttrsComp.getTalentValue(TalentType.WindFury); // 风怒强化
|
||||
model.freeze_chance = HeroAttrsComp.getTalentValue(TalentType.Freeze); // 冰冻强化
|
||||
model.puncture_chance = HeroAttrsComp.getTalentValue(TalentType.Puncture); // 穿刺强化
|
||||
// 护盾强化 和 亡语强化 在对应逻辑中应用
|
||||
} else {
|
||||
model.ap = base_ap;
|
||||
model.hp = model.hp_max = base_hp;
|
||||
}
|
||||
// 英雄与怪物统一使用基础值(天赋系统已移除)
|
||||
model.ap = base_ap;
|
||||
model.hp = model.hp_max = base_hp;
|
||||
|
||||
model.speed = hero.speed ?? 800;
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ import { Timer } from "db://oops-framework/core/common/timer/Timer";
|
||||
import { FacSet, FightSet } from "../common/config/GameSet";
|
||||
import { FieldSkillSet, FieldSkillType, SkillOverrides } from "../common/config/SkillSet";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { TalentConfig, TalentType } from "../common/config/TalentSet";
|
||||
import { Attrs } from "../common/config/HeroAttrs";
|
||||
import { FieldSkillHelper } from "./FieldSkillHelper";
|
||||
@ecs.register('HeroAttrs')
|
||||
@@ -373,14 +372,9 @@ export class HeroAttrsComp extends ecs.Comp {
|
||||
|
||||
|
||||
|
||||
/** 获取指定天赋的加成数值 */
|
||||
public static getTalentValue(talentId: TalentType): number {
|
||||
if (!smc || !smc.collection || !smc.collection.talents) return 0;
|
||||
let level = smc.collection.talents[talentId] || 0;
|
||||
if (level <= 0) return 0;
|
||||
let talentInfo = TalentConfig.talents.find(t => t.id === talentId);
|
||||
if (!talentInfo || !talentInfo.values || level > talentInfo.values.length) return 0;
|
||||
return talentInfo.values[level - 1];
|
||||
/** 获取指定天赋的加成数值 —— 天赋系统已移除,方法保留为空 stub 防止编译错误 */
|
||||
public static getTalentValue(_talentId: number): number {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ import { HeroAttrsComp } from "./HeroAttrsComp";
|
||||
import { HeroViewComp } from "./HeroViewComp";
|
||||
import { FacSet } from "../common/config/GameSet";
|
||||
import { FieldSkillType, SkillOverrides } from "../common/config/SkillSet";
|
||||
import { TalentType } from "../common/config/TalentSet";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { FieldSkillHelper } from "./FieldSkillHelper";
|
||||
|
||||
@@ -59,7 +58,7 @@ export class SkillTriggerHelper {
|
||||
|
||||
/**
|
||||
* 处理召唤(落地)触发技能
|
||||
* 支持受【召唤强化羁绊 (SummonCount)】和【召唤强化天赋 (TalentType.Summon)】的多次触发加成。
|
||||
* 支持受【召唤强化羁绊 (SummonCount)】的多次触发加成。
|
||||
*/
|
||||
private static handleCall(model: HeroAttrsComp, view: HeroViewComp) {
|
||||
if (!model.call || model.call.length === 0) return;
|
||||
@@ -68,7 +67,6 @@ export class SkillTriggerHelper {
|
||||
// 仅英雄享受加成,怪物始终只触发 1 次
|
||||
if (model.fac === FacSet.HERO) {
|
||||
triggerCount += FieldSkillHelper.getFieldSkillTotalValue(FieldSkillType.SummonCount);
|
||||
triggerCount += HeroAttrsComp.getTalentValue(TalentType.Summon);
|
||||
}
|
||||
triggerCount = Math.max(1, Math.floor(triggerCount)); // 确保最少触发 1 次
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@ import { smc } from "../common/SingletonModuleComp";
|
||||
|
||||
import { UIID } from "../common/config/GameUIConfig";
|
||||
import { HeroAttrsComp } from "../hero/HeroAttrsComp";
|
||||
import { TalentType } from "../common/config/TalentSet";
|
||||
import { getLvColor } from "../common/config/GameSet";
|
||||
import { MissionEconomy } from "./MissionEconomy";
|
||||
|
||||
@@ -250,10 +249,7 @@ export class CardComp extends CCComp {
|
||||
this.card_type = data.type;
|
||||
|
||||
let baseCost = data.cost ?? 0;
|
||||
if (this.card_type === CardType.Hero) {
|
||||
const discount = HeroAttrsComp.getTalentValue(TalentType.BuyDiscount);
|
||||
baseCost = Math.max(0, baseCost - discount);
|
||||
}
|
||||
// 天赋系统已移除:购买费用不再有优惠
|
||||
this.card_cost = Math.floor(baseCost);
|
||||
|
||||
this.node.active = true;
|
||||
|
||||
@@ -25,7 +25,6 @@ import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/modu
|
||||
import { HeroInfo } from "../common/config/heroSet";
|
||||
import { HeroAttrsComp } from "../hero/HeroAttrsComp";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { TalentType } from "../common/config/TalentSet";
|
||||
import { Hero } from "../hero/Hero";
|
||||
import { FieldSkillType } from "../common/config/SkillSet";
|
||||
import { buildSkillDesc } from "../common/config/HeroSkillDesc";
|
||||
|
||||
@@ -47,7 +47,6 @@ import { HeroViewComp } from "../hero/HeroViewComp";
|
||||
import { FacSet, FightSet } from "../common/config/GameSet";
|
||||
import { MoveComp } from "../hero/MoveComp";
|
||||
import { MissionHeroComp } from "./MissionHeroComp";
|
||||
import { TalentType } from "../common/config/TalentSet";
|
||||
import { MissionEconomy } from "./MissionEconomy";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@@ -3,7 +3,6 @@ import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/O
|
||||
import { GameEvent } from "../common/config/GameEvent";
|
||||
import { HeroAttrsComp } from "../hero/HeroAttrsComp";
|
||||
import { FieldSkillType } from "../common/config/SkillSet";
|
||||
import { TalentType } from "../common/config/TalentSet";
|
||||
import { FightSet } from "../common/config/GameSet";
|
||||
import { FieldSkillHelper } from "../hero/FieldSkillHelper";
|
||||
|
||||
@@ -23,7 +22,7 @@ export class MissionEconomy {
|
||||
amount = Math.floor(amount);
|
||||
smc.vmdata.mission_data.coin = this.getCoin() + amount;
|
||||
smc.vmdata.scores.gold_earned += amount;
|
||||
|
||||
|
||||
// 发送 UI 更新事件,这里我们统一使用 syncOnly 通知 UI 刷新即可
|
||||
oops.message.dispatchEvent(GameEvent.CoinAdd, { delta: amount, syncOnly: true });
|
||||
}
|
||||
@@ -34,10 +33,10 @@ export class MissionEconomy {
|
||||
amount = Math.floor(amount);
|
||||
const current = this.getCoin();
|
||||
if (current < amount) return false;
|
||||
|
||||
|
||||
smc.vmdata.mission_data.coin = current - amount;
|
||||
smc.vmdata.scores.gold_spent += amount;
|
||||
|
||||
|
||||
// 发送 UI 更新事件
|
||||
oops.message.dispatchEvent(GameEvent.CoinAdd, { delta: -amount, syncOnly: true });
|
||||
return true;
|
||||
@@ -49,8 +48,7 @@ export class MissionEconomy {
|
||||
*/
|
||||
static getRefreshCost(baseCost: number = 1): number {
|
||||
let cost = baseCost;
|
||||
const discount = HeroAttrsComp.getTalentValue(TalentType.RefreshDiscount);
|
||||
cost = Math.max(0, cost - discount);
|
||||
// 天赋系统已移除:刷新卡牌费用不再有优惠
|
||||
return Math.floor(cost);
|
||||
}
|
||||
|
||||
@@ -73,12 +71,8 @@ export class MissionEconomy {
|
||||
const sellByLevel: Record<number, number> = { 1: 3, 2: 10, 3: 25 };
|
||||
const baseSellGold = sellByLevel[heroLevel] || 3;
|
||||
const goldBoost = FieldSkillHelper.getFieldSkillTotalValue(FieldSkillType.SellGold);
|
||||
let totalSellGold = baseSellGold + goldBoost;
|
||||
// 应用天赋 SellBonus (增加数值)
|
||||
const bonusGold = HeroAttrsComp.getTalentValue(TalentType.SellBonus);
|
||||
if (bonusGold > 0) {
|
||||
totalSellGold += bonusGold;
|
||||
}
|
||||
const totalSellGold = baseSellGold + goldBoost;
|
||||
// 天赋系统已移除:不再追加 SellBonus
|
||||
return Math.floor(totalSellGold);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user