Compare commits
2 Commits
f74030838a
...
4995097606
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4995097606 | ||
|
|
0508dec313 |
@@ -63,10 +63,11 @@ export interface heroInfo {
|
||||
type: HType; // 攻击定位(近战/中程/远程)
|
||||
hp: number; // 生命值上限
|
||||
ap: number; // 攻击力
|
||||
call?:number; // 召唤后出发的技能uuid
|
||||
dead?:number; // 死亡后出发的技能uuid
|
||||
fstart?:number; //战斗开始时释放的技能uuid
|
||||
fend?:number; //战斗结束时释放的技能uuid
|
||||
call?:number[]; // 召唤后触发的技能uuid列表
|
||||
dead?:number[]; // 死亡后触发的技能uuid列表
|
||||
fstart?:number[]; // 战斗开始时释放的技能uuid列表
|
||||
fend?:number[]; // 战斗结束时释放的技能uuid列表
|
||||
atking?:{s_uuid:number, t_num:number}[]; // 普通攻击后触发的技能配置,s_uuid: 技能id, t_num: 触发所需的普攻次数
|
||||
// dis: number; // 攻击距离(像素)
|
||||
speed: number; // 移动速度(像素/秒)
|
||||
skills: Record<number, HSkillInfo> ; // 携带技能ID列表
|
||||
@@ -98,7 +99,7 @@ export interface HSkillInfo {
|
||||
|
||||
export const HeroInfo: Record<number, heroInfo> = {
|
||||
// ========== 近战英雄 ==========
|
||||
5001:{uuid:5001,name:"盾战士",path:"hk1", fac:FacSet.HERO,cards_lv:1,lv:1,type:HType.Melee,hp:450,ap:25,call:6305,dead:6305,speed:800,
|
||||
5001:{uuid:5001,name:"盾战士",path:"hk1", fac:FacSet.HERO,cards_lv:1,lv:1,type:HType.Melee,hp:450,ap:25,call:[6305],dead:[6305],speed:800,
|
||||
skills:{6001:{uuid:6001,lv:1,cd:1.5,ccd:0},6301:{uuid:6301,lv:1,cd:5,ccd:0}},info:"近战,魔法盾 坦克"},
|
||||
5002:{uuid:5002,name:"圣骑士",path:"hk3", fac:FacSet.HERO,cards_lv:3,lv:1,type:HType.Melee,hp:1350,ap:75,speed:800,
|
||||
skills:{6001:{uuid:6001,lv:1,cd:1.5,ccd:0},6305:{uuid:6305,lv:1,cd:5,ccd:0}},info:"近战,群体护盾 坦克"},
|
||||
@@ -131,7 +132,7 @@ export const HeroInfo: Record<number, heroInfo> = {
|
||||
skills:{6011:{uuid:6101,lv:1,cd:0.9,ccd:0},6101:{uuid:6101,lv:1,cd:5,ccd:0}},info:"暴射,光箭 远dps"},
|
||||
|
||||
// ========== 腐竹英雄 ==========
|
||||
5301:{uuid:5301,name:"牧师",path:"hh1", fac:FacSet.HERO,cards_lv:1,lv:1,type:HType.Long,hp:150,ap:20,speed:800,fstart:6302,fend:6302,
|
||||
5301:{uuid:5301,name:"牧师",path:"hh1", fac:FacSet.HERO,cards_lv:1,lv:1,type:HType.Long,hp:150,ap:20,speed:800,fstart:[6302],fend:[6302],
|
||||
skills:{6202:{uuid:6202,lv:1,cd:1.2,ccd:0},6302:{uuid:6302,lv:1,cd:5,ccd:0}},info:"冰锥1,治疗 远辅助" },
|
||||
5302:{uuid:5302,name:"战地医师",path:"hz1", fac:FacSet.HERO,cards_lv:2,lv:1,type:HType.Long,hp:300,ap:40,speed:800,
|
||||
skills:{6202:{uuid:6202,lv:1,cd:1.2,ccd:0},6304:{uuid:6304,lv:1,cd:5,ccd:0}},info:"冰锥1,群体治疗 远辅助"},
|
||||
|
||||
@@ -144,12 +144,14 @@ export class Hero extends ecs.Entity {
|
||||
hv.as.idle();
|
||||
|
||||
// 触发 call 技能
|
||||
if (hero.call) {
|
||||
oops.message.dispatchEvent(GameEvent.TriggerSkill, {
|
||||
s_uuid: hero.call,
|
||||
heroAttrs: model,
|
||||
heroView: hv,
|
||||
triggerType: 'call'
|
||||
if (hero.call && hero.call.length > 0) {
|
||||
hero.call.forEach(uuid => {
|
||||
oops.message.dispatchEvent(GameEvent.TriggerSkill, {
|
||||
s_uuid: uuid,
|
||||
heroAttrs: model,
|
||||
heroView: hv,
|
||||
triggerType: 'call'
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -255,14 +255,16 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpd
|
||||
|
||||
// 触发死亡技能
|
||||
const heroInfo = HeroInfo[TAttrsComp.hero_uuid];
|
||||
if (heroInfo && heroInfo.dead) {
|
||||
if (heroInfo && heroInfo.dead && heroInfo.dead.length > 0) {
|
||||
const view = entity.get(HeroViewComp);
|
||||
if (view) {
|
||||
oops.message.dispatchEvent(GameEvent.TriggerSkill, {
|
||||
s_uuid: heroInfo.dead,
|
||||
heroAttrs: TAttrsComp,
|
||||
heroView: view,
|
||||
triggerType: 'dead'
|
||||
heroInfo.dead.forEach((uuid: number) => {
|
||||
oops.message.dispatchEvent(GameEvent.TriggerSkill, {
|
||||
s_uuid: uuid,
|
||||
heroAttrs: TAttrsComp,
|
||||
heroView: view,
|
||||
triggerType: 'dead'
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,12 +198,14 @@ export class Monster extends ecs.Entity {
|
||||
move.moving = false;
|
||||
|
||||
// 触发 call 技能
|
||||
if (hero.call) {
|
||||
oops.message.dispatchEvent(GameEvent.TriggerSkill, {
|
||||
s_uuid: hero.call,
|
||||
heroAttrs: model,
|
||||
heroView: view,
|
||||
triggerType: 'call'
|
||||
if (hero.call && hero.call.length > 0) {
|
||||
hero.call.forEach((uuid: number) => {
|
||||
oops.message.dispatchEvent(GameEvent.TriggerSkill, {
|
||||
s_uuid: uuid,
|
||||
heroAttrs: model,
|
||||
heroView: view,
|
||||
triggerType: 'call'
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import { HeroViewComp } from "./HeroViewComp";
|
||||
import { DTType, RType, SkillConfig, SkillKind, SkillSet, SkillUpList, TGroup } from "../common/config/SkillSet";
|
||||
import { Skill } from "../skill/Skill";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { HType } from "../common/config/heroSet";
|
||||
import { HeroInfo, HType } from "../common/config/heroSet";
|
||||
import { Attrs } from "../common/config/HeroAttrs";
|
||||
import { BoxSet, FacSet, FightSet } from "../common/config/GameSet";
|
||||
import { oops } from "db://oops-framework/core/Oops";
|
||||
@@ -300,6 +300,14 @@ export class SCastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
|
||||
//播放角色攻击动画
|
||||
heroView.playSkillAnm(config.act);
|
||||
|
||||
// 因为 castSkill 只由 update 循环调用,处理的必然是 heroAttrs.skills 中的普通技能
|
||||
// 特殊触发技能(call/dead/atking等)走的是 forceCastTriggerSkill,不会调用 castSkill
|
||||
const skillIds = heroAttrs.getSkillIds();
|
||||
if (skillIds.includes(s_uuid)) {
|
||||
heroAttrs.atk_count++;
|
||||
this.checkAndTriggerAtkingSkills(heroAttrs, heroView);
|
||||
}
|
||||
|
||||
// 优先使用技能配置的前摇时间,否则使用全局默认值
|
||||
// 注意:这里仍然是基于时间的延迟,受帧率波动影响。
|
||||
// 若需精确同步,建议在动画中添加帧事件并在 HeroViewComp 中监听。
|
||||
@@ -325,6 +333,23 @@ export class SCastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
|
||||
heroAttrs.triggerSkillCD(s_uuid);
|
||||
}
|
||||
|
||||
/** 检查并触发攻击附加技能 (atking) */
|
||||
private checkAndTriggerAtkingSkills(heroAttrs: HeroAttrsComp, heroView: HeroViewComp) {
|
||||
const heroInfo = HeroInfo[heroAttrs.hero_uuid];
|
||||
if (!heroInfo || !heroInfo.atking || heroInfo.atking.length === 0) return;
|
||||
|
||||
heroInfo.atking.forEach(atkConfig => {
|
||||
if (heroAttrs.atk_count > 0 && heroAttrs.atk_count % atkConfig.t_num === 0) {
|
||||
oops.message.dispatchEvent(GameEvent.TriggerSkill, {
|
||||
s_uuid: atkConfig.s_uuid,
|
||||
heroAttrs: heroAttrs,
|
||||
heroView: heroView,
|
||||
triggerType: 'atking'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private resolveRepeatCastTargetPos(targetPos: Vec3 | null, castIndex: number): Vec3 | null {
|
||||
if (!targetPos) return null;
|
||||
if (castIndex === 1) return new Vec3(targetPos.x, targetPos.y + 15, targetPos.z);
|
||||
|
||||
Reference in New Issue
Block a user