解决 技能系统计数器造成的问题,todo:去掉局内成长设定
This commit is contained in:
@@ -5,6 +5,7 @@ import { HeroSkillsComp } from "./heroSkillsComp";
|
||||
import { SkillSet, TargetGroup, TargetType } from "../common/config/SkillSet";
|
||||
import { CdType } from "../common/config/SkillSet";
|
||||
import { oops } from "db://oops-framework/core/Oops";
|
||||
import { GameEvent } from "../common/config/GameEvent";
|
||||
|
||||
|
||||
/** 技能系统 */
|
||||
@@ -13,11 +14,14 @@ export class HeroSkillSystem extends ecs.ComblockSystem implements ecs.ISystemUp
|
||||
private updateInterval: number = 0.1; // 每0.1秒更新一次
|
||||
private accumulator: number = 0;
|
||||
private _timers: { [key: string]: number } = {};
|
||||
|
||||
init(): void {
|
||||
oops.message.on(GameEvent.MissionEnd, this.clear_timer, this);
|
||||
}
|
||||
filter(): ecs.IMatcher {
|
||||
return ecs.allOf(HeroSkillsComp, HeroViewComp);
|
||||
}
|
||||
|
||||
|
||||
update(e: ecs.Entity) {
|
||||
const view = e.get(HeroViewComp);
|
||||
const skills = e.get(HeroSkillsComp);
|
||||
@@ -282,6 +286,12 @@ export class HeroSkillSystem extends ecs.ComblockSystem implements ecs.ISystemUp
|
||||
// 剩余伤害扣除血量
|
||||
if (remainingDamage > 0) {
|
||||
view.hp -= remainingDamage;
|
||||
if(view.hp<=0) {
|
||||
view.BUFFCOMP.dead()
|
||||
view.exp_add(view.dexp)
|
||||
view.to_grave();
|
||||
}
|
||||
|
||||
view.showDamage(result.value, result.isCrit);
|
||||
}else{
|
||||
view.BUFFCOMP.tooltip(5,"*吸收*");
|
||||
@@ -305,11 +315,15 @@ export class HeroSkillSystem extends ecs.ComblockSystem implements ecs.ISystemUp
|
||||
}, delay * 1000);
|
||||
this._timers[timer] = timer;
|
||||
}
|
||||
|
||||
public clear_timer() {
|
||||
console.log("clear_timer");
|
||||
Object.values(this._timers).forEach(clearTimeout);
|
||||
}
|
||||
onDestroy() {
|
||||
Object.values(this._timers).forEach(clearTimeout);
|
||||
}
|
||||
|
||||
|
||||
/** 应用负面状态 */
|
||||
private applyDebuff(target: ecs.Entity, config: typeof SkillSet[keyof typeof SkillSet]) {
|
||||
// 实现debuff逻辑...
|
||||
|
||||
Reference in New Issue
Block a user