Compare commits
3 Commits
da1fc31e26
...
bc226ffd9b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bc226ffd9b | ||
|
|
a65a26b0bc | ||
|
|
e230feab14 |
@@ -100,47 +100,47 @@ 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,speed:800,atking:[{s_uuid:6301,t_num:2}],
|
||||
5001:{uuid:5001,name:"盾战士",path:"hk1", fac:FacSet.HERO,cards_lv:1,lv:1,type:HType.Melee,hp:150,ap:25,speed:800,atking:[{s_uuid:6301,t_num:2}],
|
||||
skills:{6001:{uuid:6001,lv:1,cd:1.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,atked:[{s_uuid:6301,t_num:2}],
|
||||
5002:{uuid:5002,name:"圣骑士",path:"hk3", fac:FacSet.HERO,cards_lv:3,lv:1,type:HType.Melee,hp:150,ap:75,speed:800,atked:[{s_uuid:6301,t_num:2}],
|
||||
skills:{6001:{uuid:6001,lv:1,cd:1.5,ccd:0}},info:"近战,群体护盾 坦克"},
|
||||
5003:{uuid:5003,name:"风行剑士",path:"hk4", fac:FacSet.HERO,cards_lv:2,lv:1,type:HType.Melee,hp:500,ap:100,speed:800,
|
||||
5003:{uuid:5003,name:"风行剑士",path:"hk4", fac:FacSet.HERO,cards_lv:2,lv:1,type:HType.Melee,hp:100,ap:100,speed:800,
|
||||
skills:{6001:{uuid:6001,lv:1,cd:1.5,ccd:0}},info:"近战,闪击 近战dps"},
|
||||
5004:{uuid:5004,name:"刺客",path:"hc1", fac:FacSet.HERO,cards_lv:4,lv:1,type:HType.Melee,hp:1000,ap:200,speed:800,
|
||||
5004:{uuid:5004,name:"刺客",path:"hc1", fac:FacSet.HERO,cards_lv:4,lv:1,type:HType.Melee,hp:100,ap:200,speed:800,
|
||||
skills:{6001:{uuid:6001,lv:1,cd:0.7,ccd:0}},info:"近战,火焰击 近战dps"},
|
||||
5005:{uuid:5005,name:"自然骑士",path:"hk2", fac:FacSet.HERO,cards_lv:4,lv:1,type:HType.Melee,hp:1000,ap:200,speed:800,
|
||||
5005:{uuid:5005,name:"自然骑士",path:"hk2", fac:FacSet.HERO,cards_lv:4,lv:1,type:HType.Melee,hp:100,ap:200,speed:800,
|
||||
skills:{6001:{uuid:6001,lv:1,cd:1.5,ccd:0}},info:"治疗近战,火焰击 近战dps"},
|
||||
|
||||
|
||||
// ========== 法师英雄 ==========
|
||||
5101:{uuid:5101,name:"奥术法师",path:"hm2", fac:FacSet.HERO,cards_lv:1,lv:1,type:HType.Long,hp:150,ap:60,speed:800,
|
||||
5101:{uuid:5101,name:"奥术法师",path:"hm2", fac:FacSet.HERO,cards_lv:1,lv:1,type:HType.Long,hp:50,ap:60,speed:800,
|
||||
skills:{6201:{uuid:6007,lv:1,cd:1,ccd:0}},info:"冰球,冰锥 远法dps"},
|
||||
5102:{uuid:5102,name:"火焰法师",path:"hm1", fac:FacSet.HERO,cards_lv:2,lv:1,type:HType.Long,hp:300,ap:120,speed:800,
|
||||
5102:{uuid:5102,name:"火焰法师",path:"hm1", fac:FacSet.HERO,cards_lv:2,lv:1,type:HType.Long,hp:30,ap:120,speed:800,
|
||||
skills:{6203:{uuid:6002,lv:1,cd:1,ccd:0}},info:"火击,火球 远法dps"},
|
||||
5103:{uuid:5103,name:"冰法法师",path:"hm9", fac:FacSet.HERO,cards_lv:3,lv:1,type:HType.Long,hp:450,ap:180,speed:800,
|
||||
5103:{uuid:5103,name:"冰法法师",path:"hm9", fac:FacSet.HERO,cards_lv:3,lv:1,type:HType.Long,hp:45,ap:180,speed:800,
|
||||
skills:{6201:{uuid:6002,lv:1,cd:1,ccd:0}},info:"冰击,冰锥 远法dps"},
|
||||
5104:{uuid:5104,name:"寒霜术士",path:"hm4", fac:FacSet.HERO,cards_lv:4,lv:1,type:HType.Long,hp:600,ap:240,speed:800,
|
||||
5104:{uuid:5104,name:"寒霜术士",path:"hm4", fac:FacSet.HERO,cards_lv:4,lv:1,type:HType.Long,hp:60,ap:240,speed:800,
|
||||
skills:{6201:{uuid:66002201,lv:1,cd:1,ccd:0}},info:"冰锥,冰刺 远法dps"},
|
||||
5105:{uuid:5105,name:"炎爆法师",path:"hm3", fac:FacSet.HERO,cards_lv:5,lv:1,type:HType.Long,hp:750,ap:300,speed:800,
|
||||
5105:{uuid:5105,name:"炎爆法师",path:"hm3", fac:FacSet.HERO,cards_lv:5,lv:1,type:HType.Long,hp:75,ap:300,speed:800,
|
||||
skills:{6203:{uuid:6002,lv:1,cd:1,ccd:0}},info:"火球,陨石术 远法dps" },
|
||||
|
||||
// ========== 远程英雄 ==========
|
||||
5201:{uuid:5201,name:"射手",path:"ha1", fac:FacSet.HERO,cards_lv:1,lv:1,type:HType.Long,hp:150,ap:60,speed:800,
|
||||
5201:{uuid:5201,name:"射手",path:"ha1", fac:FacSet.HERO,cards_lv:1,lv:1,type:HType.Long,hp:15,ap:60,speed:800,
|
||||
skills:{6101:{uuid:6005,lv:1,cd:0.9,ccd:0}},info:"普通射击,暴射 远dps"},
|
||||
5202:{uuid:5202,name:"游侠",path:"ha2", fac:FacSet.HERO,cards_lv:3,lv:1,type:HType.Long,hp:450,ap:180,speed:800,
|
||||
5202:{uuid:5202,name:"游侠",path:"ha2", fac:FacSet.HERO,cards_lv:3,lv:1,type:HType.Long,hp:45,ap:180,speed:800,
|
||||
skills:{6011:{uuid:6005,lv:1,cd:0.9,ccd:0}},info:"暴射,光箭 远dps"},
|
||||
5203:{uuid:5203,name:"游侠",path:"ha3", fac:FacSet.HERO,cards_lv:3,lv:1,type:HType.Long,hp:450,ap:180,speed:800,
|
||||
5203:{uuid:5203,name:"游侠",path:"ha3", fac:FacSet.HERO,cards_lv:3,lv:1,type:HType.Long,hp:45,ap:180,speed:800,
|
||||
skills:{6011:{uuid:6005,lv:1,cd:0.9,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,atking:[{s_uuid:6302,t_num:2}],
|
||||
5301:{uuid:5301,name:"牧师",path:"hh1", fac:FacSet.HERO,cards_lv:1,lv:1,type:HType.Long,hp:15,ap:20,speed:800,atking:[{s_uuid:6302,t_num:2}],
|
||||
skills:{6202:{uuid:6004,lv:1,cd:1.2,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,atking:[{s_uuid:6304,t_num:2}],
|
||||
5302:{uuid:5302,name:"战地医师",path:"hz1", fac:FacSet.HERO,cards_lv:2,lv:1,type:HType.Long,hp:30,ap:40,speed:800,atking:[{s_uuid:6304,t_num:2}],
|
||||
skills:{6202:{uuid:6004,lv:1,cd:1.2,ccd:0}},info:"冰锥1,群体治疗 远辅助"},
|
||||
|
||||
5303:{uuid:5303,name:"守护祭司",path:"hm6", fac:FacSet.HERO,cards_lv:4,lv:1,type:HType.Long,hp:600,ap:80,speed:800,
|
||||
5303:{uuid:5303,name:"守护祭司",path:"hm6", fac:FacSet.HERO,cards_lv:4,lv:1,type:HType.Long,hp:60,ap:80,speed:800,
|
||||
skills:{6202:{uuid:6004,lv:1,cd:1.2,ccd:0}},info:"普通射击,单体攻击buff 射手辅助"},
|
||||
5304:{uuid:5304,name:"秘法精灵",path:"hm7", fac:FacSet.HERO,cards_lv:6,lv:1,type:HType.Long,hp:900,ap:120,speed:800,
|
||||
5304:{uuid:5304,name:"秘法精灵",path:"hm7", fac:FacSet.HERO,cards_lv:6,lv:1,type:HType.Long,hp:90,ap:120,speed:800,
|
||||
skills:{6202:{uuid:6004,lv:1,cd:1.2,ccd:0}},info:"普通射击,群体攻击buff 射手辅助"},
|
||||
|
||||
|
||||
|
||||
@@ -155,6 +155,28 @@ export class Hero extends ecs.Entity {
|
||||
move.moving = false;
|
||||
hv.as.idle();
|
||||
|
||||
this.playDropAnim(pos, dropToY);
|
||||
}
|
||||
|
||||
/**
|
||||
* 播放英雄入场(下落)动画
|
||||
* @param pos 初始位置(通常在空中)
|
||||
* @param dropToY 最终落地的 Y 坐标
|
||||
*/
|
||||
playDropAnim(pos: Vec3, dropToY: number) {
|
||||
const view = this.get(HeroViewComp);
|
||||
const node = view?.node;
|
||||
if (!node || !node.isValid) return;
|
||||
|
||||
const model = this.get(HeroAttrsComp);
|
||||
const move = this.get(MoveComp);
|
||||
const collider = node.getComponent(BoxCollider2D);
|
||||
|
||||
// 入场过程暂不参与碰撞,防止半空触发战斗逻辑
|
||||
if (collider) collider.enabled = false;
|
||||
move.moving = false;
|
||||
view.as.idle();
|
||||
|
||||
// 依据下落距离自适应入场时长,保证手感稳定
|
||||
const dropDistance = Math.abs(pos.y - dropToY);
|
||||
const dropDuration = Math.max(0.18, Math.min(0.38, dropDistance / 1200));
|
||||
@@ -167,7 +189,7 @@ export class Hero extends ecs.Entity {
|
||||
if (!node || !node.isValid) return;
|
||||
// 落地后锁定最终位置,切换到落地完成状态
|
||||
node.setPosition(pos.x, dropToY, 0);
|
||||
hv.playEnd("down");
|
||||
view.playEnd("down");
|
||||
move.moving = true;
|
||||
// 落地后再启用碰撞,避免空中阶段触发伤害结算
|
||||
if (collider) {
|
||||
@@ -177,12 +199,12 @@ export class Hero extends ecs.Entity {
|
||||
}
|
||||
|
||||
// 落地后触发 call 技能
|
||||
if (model.call && model.call.length > 0) {
|
||||
if (model && model.call && model.call.length > 0) {
|
||||
model.call.forEach(uuid => {
|
||||
oops.message.dispatchEvent(GameEvent.TriggerSkill, {
|
||||
s_uuid: uuid,
|
||||
heroAttrs: model,
|
||||
heroView: hv,
|
||||
heroView: view,
|
||||
triggerType: 'call'
|
||||
});
|
||||
});
|
||||
|
||||
@@ -392,6 +392,7 @@ export class HeroViewComp extends CCComp {
|
||||
|
||||
this.model.is_dead=false
|
||||
this.model.is_count_dead=false
|
||||
this.deadCD = 0;
|
||||
this.as.do_buff();
|
||||
this.status_change("idle");
|
||||
this.model.hp =this.model.hp_max*50/100;
|
||||
@@ -448,17 +449,24 @@ export class HeroViewComp extends CCComp {
|
||||
}
|
||||
|
||||
if(this.model.fac === FacSet.HERO){
|
||||
|
||||
// 将英雄移到玩家看不到的墓地
|
||||
this.node.setPosition(v3(-2000, -2000, 0));
|
||||
const collider = this.node.getComponent(Collider2D);
|
||||
if (collider) {
|
||||
collider.enabled = false;
|
||||
}
|
||||
// 隐藏UI
|
||||
this.top_node.active = false;
|
||||
} else {
|
||||
// 🔥 方案B:治理性措施 - 在销毁实体前先禁用碰撞体,从源头减少"尸体"参与碰撞
|
||||
const collider = this.node.getComponent(Collider2D);
|
||||
if (collider) {
|
||||
collider.enabled = false;
|
||||
}
|
||||
|
||||
this.ent.destroy();
|
||||
}
|
||||
|
||||
// 🔥 方案B:治理性措施 - 在销毁实体前先禁用碰撞体,从源头减少"尸体"参与碰撞
|
||||
const collider = this.getComponent(Collider2D);
|
||||
if (collider) {
|
||||
collider.enabled = false;
|
||||
}
|
||||
|
||||
this.ent.destroy();
|
||||
|
||||
}
|
||||
do_atked(damage:number,isCrit:boolean,s_uuid:number,isBack:boolean=false){
|
||||
// 受到攻击时更新最后更新时间
|
||||
|
||||
@@ -264,7 +264,8 @@ export class MissionCardComp extends CCComp {
|
||||
this.on(GameEvent.MissionEnd, this.onMissionEnd, this);
|
||||
this.on(GameEvent.NewWave, this.onNewWave, this);
|
||||
this.on(GameEvent.FightStart, this.onFightStart, this);
|
||||
/** 全局消息事件 */
|
||||
this.on("PhasePrepareStart", this.onPhasePrepareStart, this);
|
||||
|
||||
oops.message.on(GameEvent.CoinAdd, this.onCoinAdd, this);
|
||||
oops.message.on(GameEvent.MasterCalled, this.onMasterCalled, this);
|
||||
oops.message.on(GameEvent.HeroDead, this.onHeroDead, this);
|
||||
@@ -337,6 +338,10 @@ export class MissionCardComp extends CCComp {
|
||||
this.updatePoolLvUI();
|
||||
}
|
||||
|
||||
private onPhasePrepareStart() {
|
||||
this.updateHeroNumUI(true, true);
|
||||
}
|
||||
|
||||
/** 新一波:展开面板 → 刷新费用 UI → 重新抽卡分发 */
|
||||
private onNewWave() {
|
||||
this.isBattlePhase = false;
|
||||
@@ -849,11 +854,6 @@ export class MissionCardComp extends CCComp {
|
||||
removeKeys.push(eid);
|
||||
return;
|
||||
}
|
||||
if (item.model?.is_dead) {
|
||||
if (item.node.isValid) item.node.destroy();
|
||||
removeKeys.push(eid);
|
||||
return;
|
||||
}
|
||||
if (!item.comp.isModelAlive()) {
|
||||
if (item.node.isValid) item.node.destroy();
|
||||
removeKeys.push(eid);
|
||||
|
||||
@@ -342,6 +342,7 @@ export class MissionComp extends CCComp {
|
||||
smc.vmdata.mission_data.in_fight = false;
|
||||
smc.mission.stop_spawn_mon = true;
|
||||
// 不隐藏开始按钮,点击事件在 onStartFightBtnClick 内部做了阶段拦截
|
||||
oops.message.dispatchEvent("PhasePrepareStart");
|
||||
break;
|
||||
|
||||
case MissionPhase.Prepare:
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
* - FightSet —— 战斗常量(MERGE_NEED / MERGE_MAX)
|
||||
* - oneCom —— 一次性特效组件(控制爆点特效生命周期)
|
||||
*/
|
||||
import { _decorator, instantiate, Prefab, v3, Vec3 } from "cc";
|
||||
import { _decorator, instantiate, Prefab, v3, Vec3, BoxCollider2D } from "cc";
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
||||
import { Hero } from "../hero/Hero";
|
||||
@@ -35,8 +35,9 @@ import { GameEvent } from "../common/config/GameEvent";
|
||||
import { HeroInfo, HeroPos, HType } from "../common/config/heroSet";
|
||||
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||||
import { HeroAttrsComp } from "../hero/HeroAttrsComp";
|
||||
import { FacSet, FightSet } from "../common/config/GameSet";
|
||||
import { FacSet, FightSet, BoxSet } from "../common/config/GameSet";
|
||||
import { oneCom } from "../skill/oncend";
|
||||
import { HeroViewComp } from "../hero/HeroViewComp";
|
||||
const { ccclass } = _decorator;
|
||||
|
||||
/**
|
||||
@@ -89,11 +90,13 @@ export class MissionHeroCompComp extends CCComp {
|
||||
this.on(GameEvent.MissionEnd,this.clear_heros,this)
|
||||
// 注册全局消息
|
||||
oops.message.on(GameEvent.CallHero,this.call_hero,this)
|
||||
oops.message.on("PhasePrepareStart",this.fight_ready,this)
|
||||
}
|
||||
|
||||
onDestroy(){
|
||||
// 清理全部监听
|
||||
oops.message.off(GameEvent.CallHero,this.call_hero,this)
|
||||
oops.message.off("PhasePrepareStart",this.fight_ready,this)
|
||||
oops.message.off(GameEvent.FightReady,this.fight_ready,this)
|
||||
oops.message.off(GameEvent.Zhaohuan,this.zhao_huan,this)
|
||||
oops.message.off(GameEvent.MissionEnd,this.clear_heros,this)
|
||||
@@ -104,17 +107,36 @@ export class MissionHeroCompComp extends CCComp {
|
||||
|
||||
// ======================== 事件处理 ========================
|
||||
|
||||
/** 关卡结束时清理全部存活英雄 ECS 实体 */
|
||||
/** 关卡结束时清理全部英雄 ECS 实体 */
|
||||
clear_heros(){
|
||||
const heroes = this.getAliveHeroes();
|
||||
const heroes = this.getAllHeroes();
|
||||
for (let i = 0; i < heroes.length; i++) {
|
||||
heroes[i].destroy();
|
||||
}
|
||||
}
|
||||
|
||||
/** 战斗准备阶段:重置出战英雄计数 */
|
||||
/** 战斗准备阶段:重置出战英雄计数,恢复满血重新登场 */
|
||||
fight_ready(){
|
||||
smc.vmdata.mission_data.hero_num=0
|
||||
const heroes = this.getAllHeroes();
|
||||
smc.vmdata.mission_data.hero_num = heroes.length;
|
||||
for (let i = 0; i < heroes.length; i++) {
|
||||
const hero = heroes[i];
|
||||
const model = hero.get(HeroAttrsComp);
|
||||
const view = hero.get(HeroViewComp);
|
||||
if (model && view) {
|
||||
if (model.is_dead) {
|
||||
view.alive();
|
||||
const landingPos = this.resolveHeroLandingPos(model.hero_uuid);
|
||||
// 不再直接设置位置,而是播放下落入场动画
|
||||
// 计算出出生点(空中)
|
||||
const spawnPos: Vec3 = v3(landingPos.x, landingPos.y + MissionHeroCompComp.HERO_DROP_HEIGHT, 0);
|
||||
view.node.setPosition(spawnPos);
|
||||
hero.playDropAnim(spawnPos, landingPos.y);
|
||||
}
|
||||
model.hp = model.hp_max;
|
||||
model.dirty_hp = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** 预留:召唤事件扩展入口 */
|
||||
@@ -219,14 +241,13 @@ export class MissionHeroCompComp extends CCComp {
|
||||
|
||||
// ======================== 英雄查询 ========================
|
||||
|
||||
/** 获取当前全部存活友方英雄 ECS 实体列表 */
|
||||
private getAliveHeroes(): Hero[] {
|
||||
/** 获取当前全部友方英雄 ECS 实体列表(包括存活和墓地) */
|
||||
private getAllHeroes(): Hero[] {
|
||||
const heroes: Hero[] = [];
|
||||
ecs.query(ecs.allOf(HeroAttrsComp)).forEach((entity: ecs.Entity) => {
|
||||
const model = entity.get(HeroAttrsComp);
|
||||
if (!model) return;
|
||||
if (model.fac !== FacSet.HERO) return;
|
||||
if (model.is_dead) return;
|
||||
heroes.push(entity as Hero);
|
||||
});
|
||||
return heroes;
|
||||
@@ -321,7 +342,7 @@ export class MissionHeroCompComp extends CCComp {
|
||||
this.addHero(uuid, hero_lv, pool_lv);
|
||||
if (!this.canMergeLevel(hero_lv)) return;
|
||||
const needCount = this.getMergeNeedCount();
|
||||
const aliveHeroes = this.getAliveHeroes();
|
||||
const aliveHeroes = this.getAllHeroes();
|
||||
const mergeHeroes = this.pickMergeHeroes(aliveHeroes, uuid, hero_lv, needCount);
|
||||
if (mergeHeroes.length !== needCount) return;
|
||||
this.is_merging = true;
|
||||
@@ -442,7 +463,7 @@ export class MissionHeroCompComp extends CCComp {
|
||||
if (!this.canMergeLevel(checkLv)) {
|
||||
break;
|
||||
}
|
||||
const aliveHeroes = this.getAliveHeroes();
|
||||
const aliveHeroes = this.getAllHeroes();
|
||||
const sameCount = this.countMergeHeroes(aliveHeroes, uuid, checkLv);
|
||||
if (sameCount < needCount) {
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user