From a7455def9df65b0b4c68383c74c4f368eb8bccf7 Mon Sep 17 00:00:00 2001 From: StopWuyu Date: Sat, 7 Jun 2025 20:00:18 +0800 Subject: [PATCH] feat: specific monster to battle --- Command/Command/Cmd/CommandDebug.cs | 32 +++++++++++++++++++++++++ GameServer/Game/Battle/BattleManager.cs | 1 + 2 files changed, 33 insertions(+) diff --git a/Command/Command/Cmd/CommandDebug.cs b/Command/Command/Cmd/CommandDebug.cs index 037967cc..095e9373 100644 --- a/Command/Command/Cmd/CommandDebug.cs +++ b/Command/Command/Cmd/CommandDebug.cs @@ -37,4 +37,36 @@ public class CommandDebug : ICommand player.BattleManager!.NextBattleStageConfig = stage; await arg.SendMsg(I18NManager.Translate("Game.Command.Debug.SetStageId")); } + + [CommandMethod("0 monster")] + public async ValueTask AddMonster(CommandArg arg) + { + var player = arg.Target?.Player; + if (player == null) + { + await arg.SendMsg(I18NManager.Translate("Game.Command.Notice.PlayerNotFound")); + return; + } + + if (arg.BasicArgs.Count == 0) + { + await arg.SendMsg(I18NManager.Translate("Game.Command.Notice.InvalidArguments")); + return; + } + + if (!int.TryParse(arg.BasicArgs[0], out var monsterId)) + { + await arg.SendMsg(I18NManager.Translate("Game.Command.Notice.InvalidArguments")); + return; + } + + if (!GameData.MonsterConfigData.TryGetValue(monsterId, out _)) + { + await arg.SendMsg(I18NManager.Translate("Game.Command.Debug.InvalidStageId")); + return; + } + + player.BattleManager!.NextBattleMonsterIds.Add(monsterId); + await arg.SendMsg(I18NManager.Translate("Game.Command.Debug.SetStageId")); + } } \ No newline at end of file diff --git a/GameServer/Game/Battle/BattleManager.cs b/GameServer/Game/Battle/BattleManager.cs index 7da870fb..a90beb9a 100644 --- a/GameServer/Game/Battle/BattleManager.cs +++ b/GameServer/Game/Battle/BattleManager.cs @@ -18,6 +18,7 @@ namespace EggLink.DanhengServer.GameServer.Game.Battle; public class BattleManager(PlayerInstance player) : BasePlayerManager(player) { public StageConfigExcel? NextBattleStageConfig { get; set; } + public List NextBattleMonsterIds { get; set; } = []; public async ValueTask StartBattle(BaseGameEntity attackEntity, List targetEntityList, bool isSkill)