feat(刷怪): 添加特殊怪物定时刷怪机制
- 在 MissionComp 中添加特殊刷怪检查,根据时间表触发精英/Boss - MissionMonComp 监听刷怪事件,将特殊怪物插入队列头部优先生成 - 调整刷怪配置,移除随机刷怪中的精英/Boss,改为固定时间生成 - 降低同屏怪物数量,提高单体质量,优化游戏节奏
This commit is contained in:
@@ -4,7 +4,7 @@ import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/modu
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||||
import { HeroAttrsComp } from "../hero/HeroAttrsComp";
|
||||
import { MonsterCost, MonType, calculateMonsterGold, getLevelExp, calculateMonsterExp } from "./RogueConfig";
|
||||
import { MonsterCost, MonType, calculateMonsterGold, getLevelExp, calculateMonsterExp, SpecialMonsterSchedule } from "./RogueConfig";
|
||||
import { GameEvent } from "../common/config/GameEvent";
|
||||
import { HeroViewComp } from "../hero/HeroViewComp";
|
||||
import { UIID } from "../common/config/GameUIConfig";
|
||||
@@ -40,6 +40,10 @@ export class MissionComp extends CCComp {
|
||||
gold:0,
|
||||
diamond:0
|
||||
}
|
||||
|
||||
// 记录已触发的特殊刷怪索引
|
||||
private spawnedSpecialIndices: Set<number> = new Set();
|
||||
|
||||
onLoad(){
|
||||
this.on(GameEvent.MissionStart,this.mission_start,this)
|
||||
this.on(GameEvent.MonDead,this.do_mon_dead,this)
|
||||
@@ -58,7 +62,24 @@ export class MissionComp extends CCComp {
|
||||
if(smc.mission.stop_mon_action) return
|
||||
smc.vmdata.mission_data.fight_time+=dt
|
||||
smc.vmdata.mission_data.time-=dt
|
||||
|
||||
// 检查特殊刷怪时间
|
||||
this.checkSpecialSpawns(smc.vmdata.mission_data.fight_time);
|
||||
}
|
||||
}
|
||||
|
||||
private checkSpecialSpawns(fightTime: number) {
|
||||
SpecialMonsterSchedule.forEach((item, index) => {
|
||||
if (!this.spawnedSpecialIndices.has(index) && fightTime >= item.time) {
|
||||
this.spawnedSpecialIndices.add(index);
|
||||
console.log(`[MissionComp] 触发特殊刷怪: ${item.desc}`);
|
||||
oops.message.dispatchEvent("SpawnSpecialMonster", {
|
||||
uuid: item.uuid,
|
||||
type: item.type,
|
||||
level: item.level
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 升级奖励触发
|
||||
@@ -249,6 +270,7 @@ do_ad(){
|
||||
smc.vmdata.mission_data.time=15*60
|
||||
this.rewards=[] // 改为数组,用于存储掉落物品列表
|
||||
this.revive_times = 1; // 每次任务开始重置复活次数
|
||||
this.spawnedSpecialIndices.clear(); // 重置特殊刷怪记录
|
||||
|
||||
// 重置英雄数据,确保新一局是初始状态
|
||||
smc.vmdata.hero = {
|
||||
|
||||
Reference in New Issue
Block a user