refactor(英雄系统): 移除主角特殊逻辑和怪物死亡处理
- 删除 HeroAttrsComp 中的 is_master 字段 - 简化 Hero.load() 方法签名,移除 is_master 和 is_friend 参数 - 移除 MissionComp 中的怪物死亡事件监听和奖励计算逻辑 - 移除 HeroViewComp 中主角复活时恢复怪物行动的逻辑 - 修改 HeroAtkSystem 中复活逻辑,不再区分主角 - 将 MissionHeroComp 中的 CallFriend 事件改为 CallHero,并清理事件监听 - 移除英雄死亡时停止怪物刷新的逻辑,简化阵营判断 这些更改旨在简化英雄系统架构,消除主角与普通英雄之间的特殊处理差异,使系统更加统一和可维护。怪物死亡奖励计算等逻辑被移至其他系统处理。
This commit is contained in:
@@ -56,7 +56,6 @@ export class MissionComp extends CCComp {
|
||||
|
||||
onLoad(){
|
||||
this.on(GameEvent.MissionStart,this.mission_start,this)
|
||||
this.on(GameEvent.MonDead,this.do_mon_dead,this)
|
||||
// this.on(GameEvent.HeroDead,this.do_hero_dead,this)
|
||||
// this.on(GameEvent.FightEnd,this.fight_end,this)
|
||||
this.on(GameEvent.MissionEnd,this.mission_end,this)
|
||||
@@ -106,31 +105,6 @@ export class MissionComp extends CCComp {
|
||||
// 奖励发放
|
||||
}
|
||||
|
||||
do_mon_dead(event:any,data:any){
|
||||
// mLogger.log(this.debugMode, 'MissionComp', " do_mon_dead",event,data)
|
||||
smc.vmdata.mission_data.mon_num--
|
||||
// 计算并增加经验
|
||||
// data 应该是怪物组件或包含怪物信息的对象
|
||||
if (data && data.uuid) {
|
||||
// 默认值处理
|
||||
const level = data.lv || 1;
|
||||
|
||||
// 类型推断
|
||||
let type = MonType.NORMAL;
|
||||
if (data.is_boss) {
|
||||
type = MonType.BOSS;
|
||||
} else if (data.is_elite) {
|
||||
type = MonType.ELITE;
|
||||
} else {
|
||||
// 兜底策略:根据Cost判断是否为精英怪
|
||||
const cost = MonsterCost[data.uuid] || 1;``
|
||||
if (cost >= 10) {
|
||||
type = MonType.ELITE;
|
||||
}
|
||||
}
|
||||
this.cal_gold_reward(data, type);
|
||||
}
|
||||
}
|
||||
|
||||
cal_gold_reward(data: any, type: MonType) {
|
||||
const cost = MonsterCost[data.uuid] || 1;
|
||||
|
||||
Reference in New Issue
Block a user