refactor: 替换天赋系统为驻场英雄技能系统
1. 删除已废弃的TalentSet天赋配置文件 2. 重构英雄属性计算逻辑,改为使用驻场技能加成 3. 更新卡牌购买、刷新费用和出售收益的加成逻辑 4. 统一技能配置格式,修复代码格式问题 5. 新增驻场技能类型与配置,兼容原有天赋效果
This commit is contained in:
@@ -367,6 +367,13 @@ export enum FieldSkillType {
|
||||
HeroCrit = 10, // 英雄暴击加成
|
||||
HeroCritDamage = 11, // 英雄暴击伤害加成
|
||||
HeroSpeed = 12, // 英雄攻击速度加成
|
||||
// ---- 13~18 由 TalentSet 迁移而来,统一为驻场口径 ----
|
||||
BuyDiscount = 13, // 购买卡牌费用减免(金币)
|
||||
RefreshDiscount = 14, // 刷新卡牌费用减免(金币)
|
||||
SellBonus = 15, // 出售英雄额外返还(金币)
|
||||
HeroHp = 16, // 英雄最大生命加成
|
||||
HeroWindFury = 17, // 英雄风怒概率加成
|
||||
HeroPuncture = 18, // 英雄穿刺概率加成
|
||||
}
|
||||
|
||||
export interface FieldSkillConfig {
|
||||
@@ -390,4 +397,11 @@ export const FieldSkillSet: Record<number, FieldSkillConfig> = {
|
||||
7010: { uuid: 7010, name: "暴击加成", type: FieldSkillType.HeroCrit, value: 0.1, info: "英雄暴击率+10%" },
|
||||
7011: { uuid: 7011, name: "暴伤加成", type: FieldSkillType.HeroCritDamage, value: 0.5, info: "英雄暴击伤害+50%" },
|
||||
7012: { uuid: 7012, name: "攻速加成", type: FieldSkillType.HeroSpeed, value: 0.2, info: "英雄攻击速度+20%" },
|
||||
// ---- 13~18 来自原 TalentSet,统一为驻场百分比 / 绝对值口径 ----
|
||||
7013: { uuid: 7013, name: "购买优惠", type: FieldSkillType.BuyDiscount, value: 1, info: "购买卡牌费用-1金币" },
|
||||
7014: { uuid: 7014, name: "刷新优惠", type: FieldSkillType.RefreshDiscount, value: 1, info: "刷新卡牌费用-1金币" },
|
||||
7015: { uuid: 7015, name: "出售返还", type: FieldSkillType.SellBonus, value: 1, info: "出售英雄额外+1金币" },
|
||||
7016: { uuid: 7016, name: "生命加成", type: FieldSkillType.HeroHp, value: 0.1, info: "英雄最大生命+10%" },
|
||||
7017: { uuid: 7017, name: "风怒加成", type: FieldSkillType.HeroWindFury, value: 0.1, info: "英雄风怒概率+10%" },
|
||||
7018: { uuid: 7018, name: "穿刺加成", type: FieldSkillType.HeroPuncture, value: 0.1, info: "英雄穿刺概率+10%" },
|
||||
};
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
/**
|
||||
* @file TalentSet.ts
|
||||
* @description 天赋系统配置数据,包含经验要求、消耗、每个天赋的具体加成数值和描述。
|
||||
*/
|
||||
|
||||
export enum TalentType {
|
||||
Attack = 1, // 攻击强化
|
||||
Hp = 2, // 生命强化
|
||||
Critical = 3, // 暴击强化
|
||||
WindFury = 4, // 风怒强化
|
||||
Freeze = 5, // 冰冻强化
|
||||
Puncture = 6, // 穿刺强化
|
||||
DeadTrigger = 7,// 亡语强化
|
||||
Summon = 8, // 召唤强化
|
||||
BuyDiscount = 9,// 采购优惠
|
||||
RefreshDiscount = 10, // 刷新优惠
|
||||
SellBonus = 11 // 出售补贴
|
||||
}
|
||||
|
||||
export interface TalentInfo {
|
||||
/** 天赋 ID */
|
||||
id: number;
|
||||
/** 天赋名称 */
|
||||
name: string;
|
||||
/** 天赋图标或标识(可选) */
|
||||
icon?: string;
|
||||
/** 描述模板,使用 {value} 替换具体数值 */
|
||||
desc: string;
|
||||
/** 最大等级 */
|
||||
maxLevel: number;
|
||||
/** 每一级的加成数值,从第1级到最大级 */
|
||||
values: number[];
|
||||
/** 每一级的金币消耗数量,下标 0 表示升到 1 级 */
|
||||
costs: number[];
|
||||
}
|
||||
|
||||
export const TalentConfig = {
|
||||
// 玩家升级所需经验配置
|
||||
expRequirements: [
|
||||
{ maxLevel: 10, expPerLevel: 100 },
|
||||
{ maxLevel: 20, expPerLevel: 150 },
|
||||
{ maxLevel: 30, expPerLevel: 200 }
|
||||
],
|
||||
|
||||
// 所有天赋定义(使用数组维护)
|
||||
talents: [
|
||||
{ id: TalentType.Attack, name: "攻击", icon: "3109", desc: "+{value}%",
|
||||
maxLevel: 5, values: [3, 6, 9, 12, 15], costs: [1, 1, 2, 2, 3] },
|
||||
{ id: TalentType.Hp, name: "生命", icon: "3056", desc: "+{value}%",
|
||||
maxLevel: 5, values: [5, 10, 15, 20, 25], costs: [1, 1, 2, 2, 3] },
|
||||
{ id: TalentType.Critical, name: "暴击率", icon: "3063", desc: "+{value}%",
|
||||
maxLevel: 5, values: [2, 4, 6, 8, 10], costs: [1, 1, 2, 2, 3] },
|
||||
{ id: TalentType.WindFury, name: "风怒率", icon: "3138", desc: "+{value}%",
|
||||
maxLevel: 5, values: [2, 4, 6, 8, 10], costs: [1, 1, 2, 2, 3] },
|
||||
{ id: TalentType.Freeze, name: "冰冻率", icon: "3136", desc: "+{value}%",
|
||||
maxLevel: 5, values: [2, 4, 6, 8, 10], costs: [1, 1, 2, 2, 3] },
|
||||
{ id: TalentType.Puncture, name: "穿刺", icon: "3105", desc: "+{value}",
|
||||
maxLevel: 5, values: [0.2, 0.4, 0.6, 0.8, 1.0], costs: [1, 1, 2, 2, 3] },
|
||||
{ id: TalentType.DeadTrigger, name: "亡语触发", icon: "3062", desc: "+{value}次",
|
||||
maxLevel: 1, values: [1], costs: [25] },
|
||||
{ id: TalentType.Summon, name: "召唤触发", icon: "3054", desc: "+{value}次",
|
||||
maxLevel: 1, values: [1], costs: [25] },
|
||||
{ id: TalentType.BuyDiscount, name: "购买优惠", icon: "3020", desc: "-{value}金币",
|
||||
maxLevel: 1, values: [1], costs: [10] },
|
||||
{ id: TalentType.RefreshDiscount, name: "刷新优惠", icon: "3019", desc: "-{value}金币",
|
||||
maxLevel: 1, values: [1], costs: [10] },
|
||||
{ id: TalentType.SellBonus, name: "出售返还", icon: "3151", desc: "+{value}金币",
|
||||
maxLevel: 1, values: [1], costs: [10] }
|
||||
] as TalentInfo[]
|
||||
};
|
||||
@@ -132,9 +132,14 @@ export class Hero extends ecs.Entity {
|
||||
model.base_ap = base_ap;
|
||||
model.base_hp = base_hp;
|
||||
|
||||
// 英雄与怪物统一使用基础值(天赋系统已移除)
|
||||
// 英雄享受驻场百分比加成,怪物保持基础值
|
||||
if (model.fac === FacSet.HERO) {
|
||||
model.ap = model.getRuntimeAp(base_ap);
|
||||
model.hp = model.hp_max = model.getRuntimeHp(base_hp);
|
||||
} else {
|
||||
model.ap = base_ap;
|
||||
model.hp = model.hp_max = base_hp;
|
||||
}
|
||||
|
||||
model.speed = hero.speed ?? 800;
|
||||
|
||||
|
||||
@@ -225,7 +225,7 @@ export class HeroAttrsComp extends ecs.Comp {
|
||||
}
|
||||
|
||||
/** 将驻场配置值统一换算成百分比数值,兼容 0.2 和 20 两种写法。 */
|
||||
private getFieldPercentValue(type: FieldSkillType): number {
|
||||
public static getFieldPercentValue(type: FieldSkillType): number {
|
||||
const rawValue = FieldSkillHelper.getFieldSkillTotalValue(type);
|
||||
if (Math.abs(rawValue) <= HeroAttrsComp.percentRateThreshold) {
|
||||
return rawValue * 100;
|
||||
@@ -236,30 +236,49 @@ export class HeroAttrsComp extends ecs.Comp {
|
||||
/** 英雄实时暴击率 = 基础暴击率 + 驻场暴击率。 */
|
||||
public getRuntimeCritical(): number {
|
||||
if (this.fac !== FacSet.HERO) return this.critical;
|
||||
return this.critical + this.getFieldPercentValue(FieldSkillType.HeroCrit);
|
||||
return this.critical + HeroAttrsComp.getFieldPercentValue(FieldSkillType.HeroCrit);
|
||||
}
|
||||
|
||||
/** 英雄实时冰冻率 = 基础冰冻率 + 驻场冰冻率。 */
|
||||
public getRuntimeFreezeChance(): number {
|
||||
if (this.fac !== FacSet.HERO) return this.freeze_chance;
|
||||
return this.freeze_chance + this.getFieldPercentValue(FieldSkillType.HeroFrost);
|
||||
return this.freeze_chance + HeroAttrsComp.getFieldPercentValue(FieldSkillType.HeroFrost);
|
||||
}
|
||||
|
||||
/** 英雄实时穿透概率 = 基础穿透概率。 */
|
||||
/** 英雄实时风怒概率 = 基础风怒 + 驻场风怒。 */
|
||||
public getRuntimeWindFury(): number {
|
||||
if (this.fac !== FacSet.HERO) return this.wfuny;
|
||||
return this.wfuny + HeroAttrsComp.getFieldPercentValue(FieldSkillType.HeroWindFury);
|
||||
}
|
||||
|
||||
/** 英雄实时穿透概率 = 基础穿透 + 驻场穿透。 */
|
||||
public getRuntimePunctureChance(): number {
|
||||
return this.puncture_chance;
|
||||
if (this.fac !== FacSet.HERO) return this.puncture_chance;
|
||||
return this.puncture_chance + HeroAttrsComp.getFieldPercentValue(FieldSkillType.HeroPuncture);
|
||||
}
|
||||
|
||||
/** 英雄实时暴击伤害 = 基础额外暴伤 + 驻场暴伤。 */
|
||||
public getRuntimeCritDamageBonus(): number {
|
||||
if (this.fac !== FacSet.HERO) return this.crit_damage;
|
||||
return this.crit_damage + this.getFieldPercentValue(FieldSkillType.HeroCritDamage);
|
||||
return this.crit_damage + HeroAttrsComp.getFieldPercentValue(FieldSkillType.HeroCritDamage);
|
||||
}
|
||||
|
||||
/** 攻速加成通过缩短普通攻击技能 CD 生效,正值越高,攻击越快。 */
|
||||
public getRuntimeAttackSpeedBonus(): number {
|
||||
if (this.fac !== FacSet.HERO) return 0;
|
||||
return this.getFieldPercentValue(FieldSkillType.HeroSpeed);
|
||||
return HeroAttrsComp.getFieldPercentValue(FieldSkillType.HeroSpeed);
|
||||
}
|
||||
|
||||
/** 英雄实时攻击力 = 基础攻击 × (1 + 驻场攻击百分比)。 */
|
||||
public getRuntimeAp(baseAp: number): number {
|
||||
if (this.fac !== FacSet.HERO) return baseAp;
|
||||
return baseAp * (1 + HeroAttrsComp.getFieldPercentValue(FieldSkillType.HeroAtk) / 100);
|
||||
}
|
||||
|
||||
/** 英雄实时最大生命 = 基础生命 × (1 + 驻场生命百分比)。 */
|
||||
public getRuntimeHp(baseHp: number): number {
|
||||
if (this.fac !== FacSet.HERO) return baseHp;
|
||||
return baseHp * (1 + HeroAttrsComp.getFieldPercentValue(FieldSkillType.HeroHp) / 100);
|
||||
}
|
||||
|
||||
/** 根据攻速加成换算实际攻击间隔,避免直接改写配置里的基础 CD。 */
|
||||
@@ -369,13 +388,6 @@ export class HeroAttrsComp extends ecs.Comp {
|
||||
this.dirty_hp = false;
|
||||
this.dirty_shield = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** 获取指定天赋的加成数值 —— 天赋系统已移除,方法保留为空 stub 防止编译错误 */
|
||||
public static getTalentValue(_talentId: number): number {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ecs.register('HeroBuffSystem')
|
||||
|
||||
@@ -33,6 +33,8 @@ import { smc } from "../common/SingletonModuleComp";
|
||||
|
||||
import { UIID } from "../common/config/GameUIConfig";
|
||||
import { HeroAttrsComp } from "../hero/HeroAttrsComp";
|
||||
import { FieldSkillType } from "../common/config/SkillSet";
|
||||
import { FieldSkillHelper } from "../hero/FieldSkillHelper";
|
||||
import { getLvColor } from "../common/config/GameSet";
|
||||
import { MissionEconomy } from "./MissionEconomy";
|
||||
|
||||
@@ -249,7 +251,11 @@ export class CardComp extends CCComp {
|
||||
this.card_type = data.type;
|
||||
|
||||
let baseCost = data.cost ?? 0;
|
||||
// 天赋系统已移除:购买费用不再有优惠
|
||||
if (this.card_type === CardType.Hero) {
|
||||
// 驻场英雄带来的"购买优惠"折扣
|
||||
const discount = FieldSkillHelper.getFieldSkillTotalValue(FieldSkillType.BuyDiscount);
|
||||
baseCost = Math.max(0, baseCost - discount);
|
||||
}
|
||||
this.card_cost = Math.floor(baseCost);
|
||||
|
||||
this.node.active = true;
|
||||
|
||||
@@ -48,7 +48,9 @@ export class MissionEconomy {
|
||||
*/
|
||||
static getRefreshCost(baseCost: number = 1): number {
|
||||
let cost = baseCost;
|
||||
// 天赋系统已移除:刷新卡牌费用不再有优惠
|
||||
// 驻场英雄带来的"刷新优惠"折扣
|
||||
const discount = FieldSkillHelper.getFieldSkillTotalValue(FieldSkillType.RefreshDiscount);
|
||||
cost = Math.max(0, cost - discount);
|
||||
return Math.floor(cost);
|
||||
}
|
||||
|
||||
@@ -71,8 +73,9 @@ 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);
|
||||
const totalSellGold = baseSellGold + goldBoost;
|
||||
// 天赋系统已移除:不再追加 SellBonus
|
||||
// 驻场英雄带来的"出售返还"加成
|
||||
const sellBonus = FieldSkillHelper.getFieldSkillTotalValue(FieldSkillType.SellBonus);
|
||||
const totalSellGold = baseSellGold + goldBoost + sellBonus;
|
||||
return Math.floor(totalSellGold);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user