From 7201a35cfbb5e6a96bad0ac8a21320fc4faf210a Mon Sep 17 00:00:00 2001 From: milimoe Date: Wed, 18 Dec 2024 01:53:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BB=8F=E9=AA=8C=E4=B9=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OshimaCore/Controllers/FunGameController.cs | 9 +-- OshimaCore/Utils/FunGameActionQueue.cs | 13 +++- OshimaCore/Utils/FunGameService.cs | 9 +++ OshimaModules/Items/Consumable/经验书.cs | 69 +++++++++++++++++++++ OshimaModules/Items/ItemID.cs | 7 +++ OshimaModules/Skills/SkillID.cs | 2 +- 6 files changed, 101 insertions(+), 8 deletions(-) create mode 100644 OshimaModules/Items/Consumable/经验书.cs diff --git a/OshimaCore/Controllers/FunGameController.cs b/OshimaCore/Controllers/FunGameController.cs index 5d13aaf..bd8bf88 100644 --- a/OshimaCore/Controllers/FunGameController.cs +++ b/OshimaCore/Controllers/FunGameController.cs @@ -1294,12 +1294,13 @@ namespace Oshima.Core.Controllers } [HttpPost("fightcustom")] - public List FightCustom([FromQuery] long? qq = null, [FromQuery] long? eqq = null) + public List FightCustom([FromQuery] long? qq = null, [FromQuery] long? eqq = null, [FromQuery] bool? all = null) { try { long userid = qq ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); long enemyid = eqq ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); + bool showAllRound = all ?? false; PluginConfig pc = new("saved", userid.ToString()); pc.LoadConfig(); @@ -1340,7 +1341,7 @@ namespace Oshima.Core.Controllers return [$"ԷƺûԽɫ뷢͡Խɫ"]; } - return FunGameActionQueue.StartGame([character1, character2], false, false, false, false, false); + return FunGameActionQueue.StartGame([character1, character2], false, false, false, false, false, showAllRound); } else { @@ -1354,7 +1355,7 @@ namespace Oshima.Core.Controllers } [HttpPost("fightcustom2")] - public List FightCustom2([FromQuery] long? qq = null, [FromQuery] string? name = null) + public List FightCustom2([FromQuery] long? qq = null, [FromQuery] string? name = null, [FromQuery] bool? all = null) { try { @@ -1365,7 +1366,7 @@ namespace Oshima.Core.Controllers { return [$"ҲƶӦң"]; } - return FightCustom(qq, enemyid); + return FightCustom(qq, enemyid, all); } return [$"ʧܣ"]; } diff --git a/OshimaCore/Utils/FunGameActionQueue.cs b/OshimaCore/Utils/FunGameActionQueue.cs index 56725a3..257338c 100644 --- a/OshimaCore/Utils/FunGameActionQueue.cs +++ b/OshimaCore/Utils/FunGameActionQueue.cs @@ -561,7 +561,7 @@ namespace Oshima.Core.Utils } } - public static List StartGame(List characters, bool printout, bool isWeb = false, bool isTeam = false, bool deathMatchRoundDetail = false, bool showRoundEndDetail = false) + public static List StartGame(List characters, bool printout, bool isWeb = false, bool isTeam = false, bool deathMatchRoundDetail = false, bool showRoundEndDetail = false, bool showAllRound = false) { PrintOut = printout; IsWeb = isWeb; @@ -746,12 +746,19 @@ namespace Oshima.Core.Utils } string roundMsg = ""; - if (actionQueue.LastRound.HasKill) + if (actionQueue.LastRound.HasKill || showAllRound) { roundMsg = Msg; if (!deathMatchRoundDetail) { - roundMsg = actionQueue.LastRound.ToString().Trim() + $"\r\n{(isTeam ? $"比分:{string.Join(" / ", actionQueue.Teams.Values.Select(t => $"{t.Name}({t.Score})"))},击杀来自{actionQueue.GetTeam(actionQueue.LastRound.Actor)}" : "")}\r\n"; + roundMsg = actionQueue.LastRound.ToString().Trim() + $"\r\n{(isTeam ? $"比分:{string.Join(" / ", actionQueue.Teams.Values.Select(t => $"{t.Name}({t.Score})"))},击杀来自{actionQueue.GetTeam(actionQueue.LastRound.Actor)}" : "")}"; + if (showAllRound) + { + foreach (Character character in actionQueue.Queue) + { + roundMsg += $"[ {character} ] 生命值:{character.HP:0.##}/{character.MaxHP:0.##} / 魔法值:{character.MP:0.##}/{character.MaxMP:0.##}\r\n"; + } + } } Msg = ""; } diff --git a/OshimaCore/Utils/FunGameService.cs b/OshimaCore/Utils/FunGameService.cs index 93e4ad6..90dea69 100644 --- a/OshimaCore/Utils/FunGameService.cs +++ b/OshimaCore/Utils/FunGameService.cs @@ -6,6 +6,7 @@ using Oshima.FunGame.OshimaModules; using Oshima.FunGame.OshimaModules.Characters; using Oshima.FunGame.OshimaModules.Effects.OpenEffects; using Oshima.FunGame.OshimaModules.Items; +using Oshima.FunGame.OshimaModules.Items.Consumable; using Oshima.FunGame.OshimaModules.Skills; namespace Oshima.Core.Utils @@ -46,6 +47,7 @@ namespace Oshima.Core.Utils Equipment.AddRange([new 攻击之爪5(), new 攻击之爪15(), new 攻击之爪25(), new 攻击之爪35()]); Items.AddRange(exItems.Values.Where(i => (int)i.ItemType > 4)); + Items.AddRange([new 小经验书(), new 中经验书(), new 大经验书()]); AllItems.AddRange(Equipment); AllItems.AddRange(Items); @@ -582,6 +584,13 @@ namespace Oshima.Core.Utils user.Inventory.Items.Add(mfk); msg += ItemSet.GetQualityTypeName(mfk.QualityType) + ItemSet.GetItemTypeName(mfk.ItemType) + "【" + mfk.Name + "】!\r\n" + mfk.Description; break; + + case 7: + Item 物品 = Items[Random.Shared.Next(Items.Count)].Copy(); + SetSellAndTradeTime(物品); + user.Inventory.Items.Add(物品); + msg += ItemSet.GetQualityTypeName(物品.QualityType) + ItemSet.GetItemTypeName(物品.ItemType) + "【" + 物品.Name + "】!\r\n" + 物品.Description; + break; case 0: default: diff --git a/OshimaModules/Items/Consumable/经验书.cs b/OshimaModules/Items/Consumable/经验书.cs new file mode 100644 index 0000000..4d48363 --- /dev/null +++ b/OshimaModules/Items/Consumable/经验书.cs @@ -0,0 +1,69 @@ +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; +using Oshima.FunGame.OshimaModules.Effects.ItemEffects; +using Oshima.FunGame.OshimaModules.Skills; + +namespace Oshima.FunGame.OshimaModules.Items.Consumable +{ + public class 小经验书 : Item + { + public override long Id => (long)ConsumableID.小经验书; + public override string Name => "小经验书"; + public override string Description => Skills.Active?.Description ?? ""; + public override QualityType QualityType => QualityType.White; + + public 小经验书(User? user = null, int remainUseTimes = 1) : base(ItemType.Consumable) + { + User = user; + Skills.Active = new 经验书技能(this, 200); + RemainUseTimes = remainUseTimes; + } + } + + public class 中经验书 : Item + { + public override long Id => (long)ConsumableID.中经验书; + public override string Name => "中经验书"; + public override string Description => Skills.Active?.Description ?? ""; + public override QualityType QualityType => QualityType.Green; + + public 中经验书(User? user = null, int remainUseTimes = 1) : base(ItemType.Consumable) + { + User = user; + Skills.Active = new 经验书技能(this, 500); + RemainUseTimes = remainUseTimes; + } + } + + public class 大经验书 : Item + { + public override long Id => (long)ConsumableID.大经验书; + public override string Name => "大经验书"; + public override string Description => Skills.Active?.Description ?? ""; + public override QualityType QualityType => QualityType.Blue; + + public 大经验书(User? user = null, int remainUseTimes = 1) : base(ItemType.Consumable) + { + User = user; + Skills.Active = new 经验书技能(this, 1000); + RemainUseTimes = remainUseTimes; + } + } + + public class 经验书技能 : Skill + { + public override long Id => (long)ItemActiveID.经验书; + public override string Name => "经验书"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + + public 经验书技能(Item? item = null, double exp = 0) : base(SkillType.Item) + { + Level = 1; + Item = item; + Effects.Add(new GetEXP(this, new() + { + { "exp", exp } + })); + } + } +} diff --git a/OshimaModules/Items/ItemID.cs b/OshimaModules/Items/ItemID.cs index 4382b04..ea1de79 100644 --- a/OshimaModules/Items/ItemID.cs +++ b/OshimaModules/Items/ItemID.cs @@ -7,4 +7,11 @@ 攻击之爪25 = 14003, 攻击之爪35 = 14004, } + + public enum ConsumableID : long + { + 小经验书 = 15001, + 中经验书 = 15002, + 大经验书 = 15003, + } } diff --git a/OshimaModules/Skills/SkillID.cs b/OshimaModules/Skills/SkillID.cs index 5fdf3bb..48e9f8a 100644 --- a/OshimaModules/Skills/SkillID.cs +++ b/OshimaModules/Skills/SkillID.cs @@ -104,6 +104,6 @@ public enum ItemActiveID : long { - + 经验书 = 6001, } }