feat(技能): 新增驻场技能系统并集成到游戏机制中
- 在英雄配置中增加驻场技能字段,支持八种全局加成类型 - 实现驻场技能数值计算,影响召唤/死亡/战斗开始结束技能触发次数 - 集成驻场技能到金币收益系统,提升每回合和卖出英雄的金币获取 - 为战斗结束治疗添加驻场技能加成,增强队伍恢复效果
This commit is contained in:
@@ -10,6 +10,7 @@ import { GameEvent } from "../common/config/GameEvent";
|
||||
import { Attrs} from "../common/config/HeroAttrs";
|
||||
import { MoveComp } from "./MoveComp";
|
||||
import { mLogger } from "../common/Logger";
|
||||
import { FieldSkillType } from "../common/config/SkillSet";
|
||||
/** 英雄实体:负责英雄节点创建、属性初始化、入场动画与销毁流程 */
|
||||
@ecs.register(`Hero`)
|
||||
|
||||
@@ -200,14 +201,19 @@ export class Hero extends ecs.Entity {
|
||||
|
||||
// 落地后触发 call 技能
|
||||
if (model && model.call && model.call.length > 0) {
|
||||
model.call.forEach(uuid => {
|
||||
oops.message.dispatchEvent(GameEvent.TriggerSkill, {
|
||||
s_uuid: uuid,
|
||||
heroAttrs: model,
|
||||
heroView: view,
|
||||
triggerType: 'call'
|
||||
let triggerCount = 1 + HeroAttrsComp.getFieldSkillTotalValue(FieldSkillType.SummonCount);
|
||||
triggerCount = Math.max(1, Math.floor(triggerCount));
|
||||
|
||||
for (let i = 0; i < triggerCount; i++) {
|
||||
model.call.forEach(uuid => {
|
||||
oops.message.dispatchEvent(GameEvent.TriggerSkill, {
|
||||
s_uuid: uuid,
|
||||
heroAttrs: model,
|
||||
heroView: view,
|
||||
triggerType: 'call'
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
.start();
|
||||
|
||||
@@ -10,6 +10,7 @@ import { smc } from "../common/SingletonModuleComp";
|
||||
import { HeroInfo } from "../common/config/heroSet";
|
||||
import { oops } from "db://oops-framework/core/Oops";
|
||||
import { GameEvent } from "../common/config/GameEvent";
|
||||
import { FieldSkillType } from "../common/config/SkillSet";
|
||||
|
||||
import { mLogger } from "../common/Logger";
|
||||
|
||||
@@ -276,14 +277,19 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpd
|
||||
if (TAttrsComp.dead && TAttrsComp.dead.length > 0) {
|
||||
const view = entity.get(HeroViewComp);
|
||||
if (view) {
|
||||
TAttrsComp.dead.forEach((uuid: number) => {
|
||||
oops.message.dispatchEvent(GameEvent.TriggerSkill, {
|
||||
s_uuid: uuid,
|
||||
heroAttrs: TAttrsComp,
|
||||
heroView: view,
|
||||
triggerType: 'dead'
|
||||
let triggerCount = 1 + HeroAttrsComp.getFieldSkillTotalValue(FieldSkillType.DeadCount);
|
||||
triggerCount = Math.max(1, Math.floor(triggerCount));
|
||||
|
||||
for (let i = 0; i < triggerCount; i++) {
|
||||
TAttrsComp.dead.forEach((uuid: number) => {
|
||||
oops.message.dispatchEvent(GameEvent.TriggerSkill, {
|
||||
s_uuid: uuid,
|
||||
heroAttrs: TAttrsComp,
|
||||
heroView: view,
|
||||
triggerType: 'dead'
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { HeroDisVal, HSkillInfo, HType } from "../common/config/heroSet";
|
||||
import { HeroDisVal, HeroInfo, HSkillInfo, HType } from "../common/config/heroSet";
|
||||
import { mLogger } from "../common/Logger";
|
||||
import { Timer } from "db://oops-framework/core/common/timer/Timer";
|
||||
import { FightSet } from "../common/config/GameSet";
|
||||
import { FacSet, FightSet } from "../common/config/GameSet";
|
||||
import { FieldSkillSet, FieldSkillType } from "../common/config/SkillSet";
|
||||
@ecs.register('HeroAttrs')
|
||||
export class HeroAttrsComp extends ecs.Comp {
|
||||
public debugMode: boolean = false;
|
||||
@@ -279,8 +280,24 @@ export class HeroAttrsComp extends ecs.Comp {
|
||||
this.dirty_shield = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** 获取指定驻场技能类型的总加成值(只计算存活的英雄) */
|
||||
public static getFieldSkillTotalValue(type: FieldSkillType): number {
|
||||
let total = 0;
|
||||
ecs.query(ecs.allOf(HeroAttrsComp)).forEach((entity: ecs.Entity) => {
|
||||
const model = entity.get(HeroAttrsComp);
|
||||
if (!model || model.is_dead || model.fac !== FacSet.HERO) return;
|
||||
const heroConfig = HeroInfo[model.hero_uuid];
|
||||
if (heroConfig && heroConfig.field) {
|
||||
for (const skillUuid of heroConfig.field) {
|
||||
const skillConfig = FieldSkillSet[skillUuid];
|
||||
if (skillConfig && skillConfig.type === type) {
|
||||
total += skillConfig.value;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return total;
|
||||
}
|
||||
}
|
||||
|
||||
@ecs.register('HeroBuffSystem')
|
||||
|
||||
Reference in New Issue
Block a user