From 9f2084b44350773b65a73ad8a50f132d1e8d24d4 Mon Sep 17 00:00:00 2001 From: milimoe Date: Sat, 28 Dec 2024 21:11:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=96=B0=E7=9A=84=E5=8A=A8?= =?UTF-8?q?=E6=80=81=E6=89=A9=E5=B1=95=E7=89=B9=E6=95=88=EF=BC=8C=E5=8F=AF?= =?UTF-8?q?=E4=BB=A5=E4=BC=A0=E5=85=A5=E5=A4=9A=E4=B8=AA=E5=8F=82=E6=95=B0?= =?UTF-8?q?=EF=BC=9B=E4=BF=AE=E5=A4=8D=E8=AE=A8=E4=BC=90=20boss=20?= =?UTF-8?q?=E4=B8=80=E4=BA=9B=E9=97=AE=E9=A2=98=EF=BC=9B=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=B0=8F=E9=98=9F=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OshimaCore/Controllers/FunGameController.cs | 202 ++++++- OshimaCore/Utils/FunGameActionQueue.cs | 182 ++----- OshimaCore/Utils/FunGameService.cs | 199 +++++-- OshimaModules/Characters/OshimaShiya.cs | 4 +- OshimaModules/Effects/EffectID.cs | 5 + .../Effects/OpenEffects/DynamicsEffect.cs | 502 ++++++++++++++++++ OshimaModules/Effects/OpenEffects/ExMDF.cs | 2 +- OshimaModules/Modules/SkillModule.cs | 1 + OshimaModules/Skills/Oshima/META马.cs | 14 +- 9 files changed, 897 insertions(+), 214 deletions(-) create mode 100644 OshimaModules/Effects/OpenEffects/DynamicsEffect.cs diff --git a/OshimaCore/Controllers/FunGameController.cs b/OshimaCore/Controllers/FunGameController.cs index ec58faf..ed75801 100644 --- a/OshimaCore/Controllers/FunGameController.cs +++ b/OshimaCore/Controllers/FunGameController.cs @@ -1130,18 +1130,29 @@ namespace Oshima.Core.Controllers { User user = FunGameService.GetUser(pc); - if (cIndex > 0 && cIndex <= user.Inventory.Characters.Count) + if (cIndex == 0) { - Character character = user.Inventory.Characters.ToList()[cIndex - 1]; if (isSimple) { - return NetworkUtility.JsonSerialize($"Ϊ {cIndex} ĽɫϢ\r\n{character.GetSimpleInfo(showEXP: true).Trim()}"); + return NetworkUtility.JsonSerialize($"սɫϢ\r\n{user.Inventory.MainCharacter.GetSimpleInfo(showEXP: true).Trim()}"); } - return NetworkUtility.JsonSerialize($"Ϊ {cIndex} ĽɫϸϢ\r\n{character.GetInfo().Trim()}"); + return NetworkUtility.JsonSerialize($"սɫϸϢ\r\n{user.Inventory.MainCharacter.GetInfo().Trim()}"); } else { - return NetworkUtility.JsonSerialize($"ûҵӦĽɫ"); + if (cIndex > 0 && cIndex <= user.Inventory.Characters.Count) + { + Character character = user.Inventory.Characters.ToList()[cIndex - 1]; + if (isSimple) + { + return NetworkUtility.JsonSerialize($"Ϊ {cIndex} ĽɫϢ\r\n{character.GetSimpleInfo(showEXP: true).Trim()}"); + } + return NetworkUtility.JsonSerialize($"Ϊ {cIndex} ĽɫϸϢ\r\n{character.GetInfo().Trim()}"); + } + else + { + return NetworkUtility.JsonSerialize($"ûҵӦĽɫ"); + } } } else @@ -1347,7 +1358,7 @@ namespace Oshima.Core.Controllers if (user1 != null && user2 != null) { - return FunGameActionQueue.StartGame([user1.Inventory.MainCharacter, user2.Inventory.MainCharacter], false, false, false, false, false, showAllRound); + return FunGameActionQueue.StartGame([user1.Inventory.MainCharacter, user2.Inventory.MainCharacter], false, false, false, false, showAllRound); } else { @@ -2839,17 +2850,190 @@ namespace Oshima.Core.Controllers if (FunGameService.Bosses.Values.FirstOrDefault(kv => kv.Id == index) is Character boss) { - List msgs = FunGameActionQueue.StartGame([user.Inventory.MainCharacter, boss], false, false, false, false, false, showAllRound); + if (user.Inventory.MainCharacter.HP < user.Inventory.MainCharacter.MaxHP * 0.1) + { + return [$"սɫδǰֵ 10%ȵȴֵԶظսɫ"]; + } - if (boss.HP <= 0) + Character boss2 = CharacterBuilder.Build(boss, false, true, null, FunGameService.AllItems, FunGameService.AllSkills, false); + List msgs = FunGameActionQueue.StartGame([user.Inventory.MainCharacter, boss2], false, false, false, false, showAllRound); + + if (boss2.HP <= 0) { FunGameService.Bosses.Remove(bossIndex); - double gained = 8 * boss.Level; + double gained = boss.Level; user.Inventory.Materials += gained; msgs.Add($"ϲ Boss {gained} Ͻ"); } else { + boss.HP = boss2.HP; + boss.MP = boss2.MP; + boss.EP = boss2.EP; + msgs.Add($"ս Boss ʧܣԺ"); + } + user.LastTime = DateTime.Now; + pc.Add("user", user); + pc.SaveConfig(); + + return msgs; + } + else + { + return [$"Ҳָŵ Boss"]; + } + } + else + { + return [noSaved]; + } + } + + [HttpPost("addsquad")] + public string AddSquad([FromQuery] long? qq = null, [FromQuery] int? c = null) + { + try + { + long userid = qq ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); + int characterIndex = c ?? 0; + + PluginConfig pc = new("saved", userid.ToString()); + pc.LoadConfig(); + + if (pc.Count > 0) + { + User user = FunGameService.GetUser(pc); + + Character? character = null; + if (characterIndex > 0 && characterIndex <= user.Inventory.Characters.Count) + { + character = user.Inventory.Characters.ToList()[characterIndex - 1]; + } + else + { + return NetworkUtility.JsonSerialize($"ûҵӦĽɫ"); + } + + if (user.Inventory.Squad.Count >= 4) + { + return NetworkUtility.JsonSerialize($"С 4 ˣ޷ӽɫǰСӽɫ£\r\n" + + string.Join("\r\n", user.Inventory.Characters.Where(c => user.Inventory.Squad.Contains(c.Id)))); + } + + if (user.Inventory.Squad.Contains(character.Id)) + { + return NetworkUtility.JsonSerialize($"˽ɫѾСˣ"); + } + + user.Inventory.Squad.Add(character.Id); + user.LastTime = DateTime.Now; + pc.Add("user", user); + pc.SaveConfig(); + return NetworkUtility.JsonSerialize($"Сӽɫɹ{character}\r\nǰСӽɫ£\r\n" + + string.Join("\r\n", user.Inventory.Characters.Where(c => user.Inventory.Squad.Contains(c.Id)))); + } + else + { + return NetworkUtility.JsonSerialize(noSaved); + } + } + catch (Exception e) + { + return NetworkUtility.JsonSerialize(e.ToString()); + } + } + + [HttpPost("removesquad")] + public string RemoveSquad([FromQuery] long? qq = null, [FromQuery] int? c = null) + { + try + { + long userid = qq ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); + int characterIndex = c ?? 0; + + PluginConfig pc = new("saved", userid.ToString()); + pc.LoadConfig(); + + if (pc.Count > 0) + { + User user = FunGameService.GetUser(pc); + + Character? character = null; + if (characterIndex > 0 && characterIndex <= user.Inventory.Characters.Count) + { + character = user.Inventory.Characters.ToList()[characterIndex - 1]; + } + else + { + return NetworkUtility.JsonSerialize($"ûҵӦĽɫ"); + } + + if (!user.Inventory.Squad.Contains(character.Id)) + { + return NetworkUtility.JsonSerialize($"˽ɫСУ"); + } + + user.Inventory.Squad.Remove(character.Id); + user.LastTime = DateTime.Now; + pc.Add("user", user); + pc.SaveConfig(); + return NetworkUtility.JsonSerialize($"ƳСӽɫɹ{character}\r\nǰСӽɫ£\r\n" + + string.Join("\r\n", user.Inventory.Characters.Where(c => user.Inventory.Squad.Contains(c.Id)))); + } + else + { + return NetworkUtility.JsonSerialize(noSaved); + } + } + catch (Exception e) + { + return NetworkUtility.JsonSerialize(e.ToString()); + } + } + + [HttpPost("fightbossteam")] + public List FightBossTeam([FromQuery] long? qq = null, [FromQuery] int? index = null, [FromQuery] bool? all = null) + { + return []; + + long userid = qq ?? Convert.ToInt64("10" + Verification.CreateVerifyCode(VerifyCodeType.NumberVerifyCode, 11)); + int bossIndex = index ?? 0; + bool showAllRound = all ?? false; + + PluginConfig pc = new("saved", userid.ToString()); + pc.LoadConfig(); + + if (pc.Count > 0) + { + User user = FunGameService.GetUser(pc); + + if (FunGameService.Bosses.Values.FirstOrDefault(kv => kv.Id == index) is Character boss) + { + Character[] squad = [.. user.Inventory.Characters.Where(c => user.Inventory.Squad.Contains(c.Id))]; + + if (squad.All(c => c.HP < c.MaxHP * 0.1)) + { + return [$"Сӽɫδǰֵ 10%ȵȴֵԶظСӣ", + "ǰСӽɫ£", + string.Join("\r\n", user.Inventory.Characters.Where(c => user.Inventory.Squad.Contains(c.Id)))]; + } + + Character boss2 = CharacterBuilder.Build(boss, false, true, null, FunGameService.AllItems, FunGameService.AllSkills, false); + //List msgs = FunGameActionQueue.StartGameTeam; + List msgs = []; + + if (boss2.HP <= 0) + { + FunGameService.Bosses.Remove(bossIndex); + double gained = boss.Level; + user.Inventory.Materials += gained; + msgs.Add($"ϲ Boss {gained} Ͻ"); + } + else + { + boss.HP = boss2.HP; + boss.MP = boss2.MP; + boss.EP = boss2.EP; msgs.Add($"ս Boss ʧܣԺ"); } user.LastTime = DateTime.Now; diff --git a/OshimaCore/Utils/FunGameActionQueue.cs b/OshimaCore/Utils/FunGameActionQueue.cs index 37fe23e..9dde426 100644 --- a/OshimaCore/Utils/FunGameActionQueue.cs +++ b/OshimaCore/Utils/FunGameActionQueue.cs @@ -565,7 +565,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, bool showAllRound = false) + public static List StartGame(List characters, bool printout, bool isWeb = false, bool deathMatchRoundDetail = false, bool showRoundEndDetail = false, bool showAllRound = false) { PrintOut = printout; IsWeb = isWeb; @@ -580,12 +580,7 @@ namespace Oshima.Core.Utils if (PrintOut) Console.WriteLine(); // 创建顺序表并排序 - ActionQueue actionQueue = new(characters, isTeam, WriteLine); - if (isTeam) - { - actionQueue.MaxRespawnTimes = -1; - actionQueue.MaxScoreToWin = 30; - } + ActionQueue actionQueue = new(characters, false, WriteLine); if (PrintOut) Console.WriteLine(); // 总游戏时长 @@ -594,47 +589,12 @@ namespace Oshima.Core.Utils // 显示角色信息 if (PrintOut) characters.ForEach(c => Console.WriteLine(c.GetInfo())); - // 团队模式 - if (isTeam) - { - Msg = "=== 团队模式随机分组 ===\r\n\r\n"; - // 打乱角色列表 - List shuffledCharacters = [.. characters.OrderBy(c => Random.Shared.Next())]; - - // 创建两个团队 - List group1 = []; - List group2 = []; - - // 将角色交替分配到两个团队中 - for (int cid = 0; cid < shuffledCharacters.Count; cid++) - { - if (cid % 2 == 0) - { - group1.Add(shuffledCharacters[cid]); - } - else - { - group2.Add(shuffledCharacters[cid]); - } - } - - // 添加到团队字典 - actionQueue.AddTeam("队伍一", group1); - actionQueue.AddTeam("队伍二", group2); - - foreach (string team in actionQueue.Teams.Keys) - { - WriteLine($"团队【{team}】的成员:\r\n{string.Join("\r\n", actionQueue.Teams[team].Members)}\r\n"); - } - result.Add(Msg); - } - // 显示初始顺序表 actionQueue.DisplayQueue(); if (PrintOut) Console.WriteLine(); // 总回合数 - int maxRound = isTeam ? 9999 : 999; + int maxRound = 999; // 随机回合奖励 Dictionary> roundRewards = GenerateRoundRewards(maxRound); @@ -645,31 +605,23 @@ namespace Oshima.Core.Utils Msg = ""; if (i == maxRound - 1) { - if (isTeam) + WriteLine($"=== 终局审判 ==="); + Dictionary 他们的血量百分比 = []; + foreach (Character c in characters) { - WriteLine("两队打到天昏地暗,流局了!!"); - break; + 他们的血量百分比.TryAdd(c, c.HP / c.MaxHP); } - else + double max = 他们的血量百分比.Values.Max(); + Character winner = 他们的血量百分比.Keys.Where(c => 他们的血量百分比[c] == max).First(); + WriteLine("[ " + winner + " ] 成为了天选之人!!"); + foreach (Character c in characters.Where(c => c != winner && c.HP > 0)) { - WriteLine($"=== 终局审判 ==="); - Dictionary 他们的血量百分比 = []; - foreach (Character c in characters) - { - 他们的血量百分比.TryAdd(c, c.HP / c.MaxHP); - } - double max = 他们的血量百分比.Values.Max(); - Character winner = 他们的血量百分比.Keys.Where(c => 他们的血量百分比[c] == max).First(); - WriteLine("[ " + winner + " ] 成为了天选之人!!"); - foreach (Character c in characters.Where(c => c != winner && c.HP > 0)) - { - WriteLine("[ " + winner + " ] 对 [ " + c + " ] 造成了 99999999999 点真实伤害。"); - actionQueue.DeathCalculation(winner, c); - } - actionQueue.EndGameInfo(winner); - result.Add(Msg); - break; + WriteLine("[ " + winner + " ] 对 [ " + c + " ] 造成了 99999999999 点真实伤害。"); + actionQueue.DeathCalculation(winner, c); } + actionQueue.EndGameInfo(winner); + result.Add(Msg); + break; } // 检查是否有角色可以行动 @@ -686,7 +638,7 @@ namespace Oshima.Core.Utils } WriteLine($"=== Round {i++} ==="); - WriteLine("现在是 [ " + characterToAct + (isTeam ? "(" + (actionQueue.GetTeam(characterToAct)?.Name ?? "") + ")" : "") + " ] 的回合!"); + WriteLine($"现在是 [ {characterToAct} ] 的回合!"); // 实际的回合奖励 List realSkillRewards = []; @@ -755,7 +707,7 @@ namespace Oshima.Core.Utils 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)}" : "")}"; + roundMsg = actionQueue.LastRound.ToString().Trim() + "\r\n"; if (showAllRound) { foreach (Character character in actionQueue.Queue) @@ -773,7 +725,7 @@ namespace Oshima.Core.Utils if (roundMsg != "") { - if ((isTeam && deathMatchRoundDetail || !isTeam) && isWeb) + if (isWeb) { roundMsg += "\r\n" + Msg; } @@ -789,7 +741,7 @@ namespace Oshima.Core.Utils } // 赛后统计 - GetCharacterRating(actionQueue.CharacterStatistics, isTeam, actionQueue.EliminatedTeams); + GetCharacterRating(actionQueue.CharacterStatistics, false, actionQueue.EliminatedTeams); // 统计技术得分,评选 MVP Character? mvp = actionQueue.CharacterStatistics.OrderByDescending(d => d.Value.Rating).Select(d => d.Key).FirstOrDefault(); @@ -798,7 +750,7 @@ namespace Oshima.Core.Utils { CharacterStatistics stats = actionQueue.CharacterStatistics[mvp]; stats.MVPs++; - mvpBuilder.AppendLine($"{(isTeam ? "[ " + actionQueue.GetTeamFromEliminated(mvp)?.Name + " ] " : "")}[ {mvp.ToStringWithLevel()} ]"); + mvpBuilder.AppendLine($"[ {mvp.ToStringWithLevel()} ]"); mvpBuilder.AppendLine($"技术得分:{stats.Rating:0.##} / 击杀数:{stats.Kills} / 助攻数:{stats.Assists}{(actionQueue.MaxRespawnTimes != 0 ? " / 死亡数:" + stats.Deaths : "")}"); mvpBuilder.AppendLine($"存活时长:{stats.LiveTime} / 存活回合数:{stats.LiveRound} / 行动回合数:{stats.ActionTurn}"); mvpBuilder.AppendLine($"总计伤害:{stats.TotalDamage} / 总计物理伤害:{stats.TotalPhysicalDamage} / 总计魔法伤害:{stats.TotalMagicDamage}"); @@ -810,49 +762,24 @@ namespace Oshima.Core.Utils int count = 1; Msg = $"=== 技术得分排行榜 TOP{top} ===\r\n"; - if (isTeam) + foreach (Character character in actionQueue.CharacterStatistics.OrderByDescending(d => d.Value.Rating).Select(d => d.Key)) { - foreach (Character character in actionQueue.CharacterStatistics.OrderByDescending(d => d.Value.Rating).Select(d => d.Key)) + StringBuilder builder = new(); + CharacterStatistics stats = actionQueue.CharacterStatistics[character]; + builder.AppendLine($"{count + ". "}[ {character.ToStringWithLevel()} ]"); + builder.AppendLine($"技术得分:{stats.Rating:0.##} / 击杀数:{stats.Kills} / 助攻数:{stats.Assists}{(actionQueue.MaxRespawnTimes != 0 ? " / 死亡数:" + stats.Deaths : "")}"); + builder.AppendLine($"存活时长:{stats.LiveTime} / 存活回合数:{stats.LiveRound} / 行动回合数:{stats.ActionTurn}"); + builder.AppendLine($"总计伤害:{stats.TotalDamage} / 总计物理伤害:{stats.TotalPhysicalDamage} / 总计魔法伤害:{stats.TotalMagicDamage}"); + builder.AppendLine($"总承受伤害:{stats.TotalTakenDamage} / 总承受物理伤害:{stats.TotalTakenPhysicalDamage} / 总承受魔法伤害:{stats.TotalTakenMagicDamage}"); + builder.AppendLine($"每秒伤害:{stats.DamagePerSecond} / 每回合伤害:{stats.DamagePerTurn}"); + builder.Append($"生命值:{character.HP:0.##}/{character.MaxHP:0.##} / 魔法值:{character.MP:0.##}/{character.MaxMP:0.##}"); + if (count++ <= top) { - StringBuilder builder = new(); - CharacterStatistics stats = actionQueue.CharacterStatistics[character]; - builder.AppendLine($"{(isWeb ? count + "." : ("[ " + actionQueue.GetTeamFromEliminated(character)?.Name + " ]" ?? ""))} [ {character.ToStringWithLevel()} ]"); - builder.AppendLine($"技术得分:{stats.Rating:0.##} / 击杀数:{stats.Kills} / 助攻数:{stats.Assists}{(actionQueue.MaxRespawnTimes != 0 ? " / 死亡数:" + stats.Deaths : "")}"); - builder.AppendLine($"存活时长:{stats.LiveTime} / 存活回合数:{stats.LiveRound} / 行动回合数:{stats.ActionTurn}"); - builder.AppendLine($"总计伤害:{stats.TotalDamage} / 总计物理伤害:{stats.TotalPhysicalDamage} / 总计魔法伤害:{stats.TotalMagicDamage}"); - builder.AppendLine($"总承受伤害:{stats.TotalTakenDamage} / 总承受物理伤害:{stats.TotalTakenPhysicalDamage} / 总承受魔法伤害:{stats.TotalTakenMagicDamage}"); - builder.Append($"每秒伤害:{stats.DamagePerSecond} / 每回合伤害:{stats.DamagePerTurn}"); - if (count++ <= top) - { - WriteLine(builder.ToString()); - } - else - { - if (PrintOut) Console.WriteLine(builder.ToString()); - } + WriteLine(builder.ToString()); } - } - else - { - foreach (Character character in actionQueue.CharacterStatistics.OrderByDescending(d => d.Value.Rating).Select(d => d.Key)) + else { - StringBuilder builder = new(); - CharacterStatistics stats = actionQueue.CharacterStatistics[character]; - builder.AppendLine($"{count + ". "}[ {character.ToStringWithLevel()} ]"); - builder.AppendLine($"技术得分:{stats.Rating:0.##} / 击杀数:{stats.Kills} / 助攻数:{stats.Assists}{(actionQueue.MaxRespawnTimes != 0 ? " / 死亡数:" + stats.Deaths : "")}"); - builder.AppendLine($"存活时长:{stats.LiveTime} / 存活回合数:{stats.LiveRound} / 行动回合数:{stats.ActionTurn}"); - builder.AppendLine($"总计伤害:{stats.TotalDamage} / 总计物理伤害:{stats.TotalPhysicalDamage} / 总计魔法伤害:{stats.TotalMagicDamage}"); - builder.AppendLine($"总承受伤害:{stats.TotalTakenDamage} / 总承受物理伤害:{stats.TotalTakenPhysicalDamage} / 总承受魔法伤害:{stats.TotalTakenMagicDamage}"); - builder.AppendLine($"每秒伤害:{stats.DamagePerSecond} / 每回合伤害:{stats.DamagePerTurn}"); - builder.Append($"生命值:{character.HP:0.##}/{character.MaxHP:0.##} / 魔法值:{character.MP:0.##}/{character.MaxMP:0.##}"); - if (count++ <= top) - { - WriteLine(builder.ToString()); - } - else - { - if (PrintOut) Console.WriteLine(builder.ToString()); - } + if (PrintOut) Console.WriteLine(builder.ToString()); } } @@ -861,43 +788,10 @@ namespace Oshima.Core.Utils // 显示每个角色的信息 if (isWeb) { - if (isTeam) + for (i = actionQueue.Eliminated.Count - 1; i >= 0; i--) { - top = 1; - for (i = actionQueue.EliminatedTeams.Count - 1; i >= 0; i--) - { - Team team = actionQueue.EliminatedTeams[i]; - string topTeam = ""; - if (top == 1) - { - topTeam = "冠军"; - } - if (top == 2) - { - topTeam = "亚军"; - } - if (top == 3) - { - topTeam = "季军"; - } - if (top > 3) - { - topTeam = $"第 {top} 名"; - } - foreach (Character character in team.Members) - { - result.Add($"== {topTeam}团队 [ {team.Name} ] ==\r\n== 角色:[ {character} ] ==\r\n{character.GetInfo()}"); - } - top++; - } - } - else - { - for (i = actionQueue.Eliminated.Count - 1; i >= 0; i--) - { - Character character = actionQueue.Eliminated[i]; - result.Add($"=== 角色 [ {character} ] ===\r\n{character.GetInfo()}"); - } + Character character = actionQueue.Eliminated[i]; + result.Add($"=== 角色 [ {character} ] ===\r\n{character.GetInfo()}"); } } diff --git a/OshimaCore/Utils/FunGameService.cs b/OshimaCore/Utils/FunGameService.cs index 80ee2b0..bc11612 100644 --- a/OshimaCore/Utils/FunGameService.cs +++ b/OshimaCore/Utils/FunGameService.cs @@ -1,6 +1,7 @@ using System.Text; using Milimoe.FunGame.Core.Api.Utility; using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Interface.Entity; using Milimoe.FunGame.Core.Library.Constant; using Oshima.FunGame.OshimaModules; using Oshima.FunGame.OshimaModules.Characters; @@ -448,7 +449,7 @@ namespace Oshima.Core.Utils List characters = new(user.Inventory.Characters); List items = new(user.Inventory.Items); Character mc = user.Inventory.MainCharacter; - List squad = [.. user.Inventory.Squad.Select(kv => kv.Id)]; + List squad = [.. user.Inventory.Squad]; Dictionary training = user.Inventory.Training.ToDictionary(kv => kv.Key, kv => kv.Value); user.Inventory.Characters.Clear(); user.Inventory.Items.Clear(); @@ -464,7 +465,53 @@ namespace Oshima.Core.Utils foreach (Character inventoryCharacter in characters) { - Character realCharacter = CharacterBuilder.Build(inventoryCharacter, false, true, user.Inventory, AllItems, AllSkills); + Character realCharacter = CharacterBuilder.Build(inventoryCharacter, false, true, user.Inventory, AllItems, AllSkills, false); + // 自动回血 + DateTime now = DateTime.Now; + int seconds = (int)(now - user.LastTime).TotalSeconds; + double recoveryHP = realCharacter.HR * seconds; + double recoveryMP = realCharacter.MR * seconds; + double recoveryEP = realCharacter.ER * seconds; + realCharacter.HP = inventoryCharacter.HP + recoveryHP; + realCharacter.MP = inventoryCharacter.MP + recoveryMP; + realCharacter.EP = inventoryCharacter.EP + recoveryEP; + // 减少所有技能的冷却时间 + foreach (Skill skill in realCharacter.Skills) + { + skill.CurrentCD -= seconds; + if (skill.CurrentCD <= 0) + { + skill.CurrentCD = 0; + skill.Enable = true; + } + } + // 移除到时间的特效 + List effects = realCharacter.Effects.Where(e => e.Level > 0).ToList(); + foreach (Effect effect in effects) + { + if (effect.Level == 0) + { + realCharacter.Effects.Remove(effect); + continue; + } + effect.OnTimeElapsed(realCharacter, seconds); + // 自身被动不会考虑 + if (effect.EffectType == EffectType.None && effect.Skill.SkillType == SkillType.Passive) + { + continue; + } + + if (effect.Durative) + { + effect.RemainDuration -= seconds; + if (effect.RemainDuration <= 0) + { + effect.RemainDuration = 0; + realCharacter.Effects.Remove(effect); + effect.OnEffectLost(realCharacter); + } + } + } realCharacter.User = user; user.Inventory.Characters.Add(realCharacter); } @@ -478,7 +525,7 @@ namespace Oshima.Core.Utils { if (user.Inventory.Characters.FirstOrDefault(c => c.Id == id) is Character s) { - user.Inventory.Squad.Add(s); + user.Inventory.Squad.Add(id); } } @@ -1012,83 +1059,121 @@ namespace Oshima.Core.Utils if (Bosses.Count < 10) { int genCount = 10 - Bosses.Count; + for (int i = 0; i < genCount; i++) { int nowIndex = Bosses.Count > 0 ? Bosses.Keys.Max() + 1 : 1; Character boss = new CustomCharacter(nowIndex, GenerateRandomChineseUserName(), "", "Boss"); - int cLevel, sLevel, mLevel, naLevel; - switch (Random.Shared.Next(3)) + int cutRate = Random.Shared.Next(3) switch { - case 0: - cLevel = General.GameplayEquilibriumConstant.MaxLevel; - sLevel = General.GameplayEquilibriumConstant.MaxSkillLevel; - mLevel = General.GameplayEquilibriumConstant.MaxMagicLevel; - naLevel = General.GameplayEquilibriumConstant.MaxNormalAttackLevel; - break; - case 1: - cLevel = General.GameplayEquilibriumConstant.MaxLevel / 2; - sLevel = General.GameplayEquilibriumConstant.MaxSkillLevel / 2; - mLevel = General.GameplayEquilibriumConstant.MaxMagicLevel / 2; - naLevel = General.GameplayEquilibriumConstant.MaxNormalAttackLevel / 2; - break; - case 2: - default: - cLevel = General.GameplayEquilibriumConstant.MaxLevel / 4; - sLevel = General.GameplayEquilibriumConstant.MaxSkillLevel / 4; - mLevel = General.GameplayEquilibriumConstant.MaxMagicLevel / 4; - naLevel = General.GameplayEquilibriumConstant.MaxNormalAttackLevel / 4; - break; + 0 => 1, + 1 => 2, + _ => 4, + }; + int cLevel = General.GameplayEquilibriumConstant.MaxLevel / cutRate; + int sLevel = General.GameplayEquilibriumConstant.MaxSkillLevel / cutRate; + int mLevel = General.GameplayEquilibriumConstant.MaxMagicLevel / cutRate; + int naLevel = General.GameplayEquilibriumConstant.MaxNormalAttackLevel / cutRate; + boss.Level = cLevel; + boss.NormalAttack.Level = naLevel; + boss.NormalAttack.HardnessTime = 6; + Item[] weapons = Equipment.Where(i => i.Id.ToString().StartsWith("11") && (int)i.QualityType == 4).ToArray(); + Item[] armors = Equipment.Where(i => i.Id.ToString().StartsWith("12") && (int)i.QualityType == 1).ToArray(); + Item[] shoes = Equipment.Where(i => i.Id.ToString().StartsWith("13") && (int)i.QualityType == 1).ToArray(); + Item[] accessory = Equipment.Where(i => i.Id.ToString().StartsWith("14") && (int)i.QualityType == 3).ToArray(); + Item? a = null, b = null, c = null, d = null, d2 = null; + if (weapons.Length > 0) + { + a = weapons[Random.Shared.Next(weapons.Length)]; } - Item[] 武器 = Equipment.Where(i => i.Id.ToString().StartsWith("11") && (int)i.QualityType == 4).ToArray(); - Item[] 防具 = Equipment.Where(i => i.Id.ToString().StartsWith("12") && (int)i.QualityType == 1).ToArray(); - Item[] 鞋子 = Equipment.Where(i => i.Id.ToString().StartsWith("13") && (int)i.QualityType == 1).ToArray(); - Item[] 饰品 = Equipment.Where(i => i.Id.ToString().StartsWith("14") && (int)i.QualityType == 3).ToArray(); - Item? a = null, b = null, c = null, d = null; - if (武器.Length > 0) + if (armors.Length > 0) { - a = 武器[Random.Shared.Next(武器.Length)]; + b = armors[Random.Shared.Next(armors.Length)]; } - if (防具.Length > 0) + if (shoes.Length > 0) { - b = 防具[Random.Shared.Next(防具.Length)]; + c = shoes[Random.Shared.Next(shoes.Length)]; } - if (鞋子.Length > 0) + if (accessory.Length > 0) { - c = 鞋子[Random.Shared.Next(鞋子.Length)]; + d = accessory[Random.Shared.Next(accessory.Length)]; } - if (饰品.Length > 0) + if (accessory.Length > 0) { - d = 饰品[Random.Shared.Next(饰品.Length)]; + d2 = accessory[Random.Shared.Next(accessory.Length)]; } - List 这次发放的空投 = []; - if (a != null) 这次发放的空投.Add(a); - if (b != null) 这次发放的空投.Add(b); - if (c != null) 这次发放的空投.Add(c); - if (d != null) 这次发放的空投.Add(d); - Item? 魔法卡包 = GenerateMagicCardPack(3, (QualityType)4); - if (魔法卡包 != null) + List dropItems = []; + if (a != null) dropItems.Add(a); + if (b != null) dropItems.Add(b); + if (c != null) dropItems.Add(c); + if (d != null) dropItems.Add(d); + if (d2 != null) dropItems.Add(d2); + Item? magicCardPack = GenerateMagicCardPack(5, (QualityType)4); + if (magicCardPack != null) { - foreach (Skill magic in 魔法卡包.Skills.Magics) + foreach (Skill magic in magicCardPack.Skills.Magics) { magic.Level = mLevel; } - boss.Equip(魔法卡包); + boss.Equip(magicCardPack); } - foreach (Item item in 这次发放的空投) + foreach (Item item in dropItems) { Item realItem = item.Copy(); boss.Equip(realItem); } - boss.Level = cLevel; - boss.NormalAttack.Level = naLevel; - boss.NormalAttack.HardnessTime = 7; - if (boss.CritRate < 65) boss.ExCritRate = 65 - boss.CritRate; - if (boss.CritDMG < 200) boss.ExCritDMG = 200 - boss.CritDMG; - if (boss.AccelerationCoefficient < 0.4) boss.ExAccelerationCoefficient = 0.4 - boss.AccelerationCoefficient; - boss.ExATK2 += boss.PrimaryAttributeValue; - boss.ExDEF2 += boss.PrimaryAttributeValue; - boss.MDF.None += 0.25; - boss.ExHPPercentage += 0.8; + Skill bossSkill = Factory.OpenFactory.GetInstance(0, "BOSS专属被动", []); + bossSkill.Level = 1; + bossSkill.Character = boss; + Effect effect = Factory.OpenFactory.GetInstance((long)EffectID.DynamicsEffect, "", new() + { + { "skill", bossSkill }, + { + "values", + new Dictionary() + { + { "exatk", 200 / cutRate }, + { "exdef", 200 / cutRate }, + { "exhp2", 1.5 }, + { "exmp2", 0.8 }, + { "exhr", 8 / cutRate }, + { "exmr", 4 / cutRate }, + { "excr", 0.35 }, + { "excrd", 0.9 }, + { "excdr", 0.25 }, + { "exacc", 0.25 } + } + } + }); + effect.OnEffectGained(boss); + bossSkill.Effects.Add(effect); + boss.Skills.Add(bossSkill); + effect = Factory.OpenFactory.GetInstance((long)EffectID.ExMDF, "", new() + { + { "skill", bossSkill }, + { + "values", + new Dictionary() + { + { "mdftype", 0 }, + { "mdfvalue", 0.15 } + } + } + }); + effect.OnEffectGained(boss); + bossSkill.Effects.Add(effect); + boss.Skills.Add(bossSkill); + Skill passive = Factory.OpenFactory.GetInstance(Random.Shared.Next(4001, 4013), "", []); + passive.Character = boss; + passive.Level = 1; + boss.Skills.Add(passive); + Skill super = Factory.OpenFactory.GetInstance(Random.Shared.Next(3001, 3013), "", []); + super.Character = boss; + super.Level = sLevel; + boss.Skills.Add(super); + + boss.Recovery(); + Bosses[nowIndex] = boss; } } diff --git a/OshimaModules/Characters/OshimaShiya.cs b/OshimaModules/Characters/OshimaShiya.cs index 7936d2a..5b1cf58 100644 --- a/OshimaModules/Characters/OshimaShiya.cs +++ b/OshimaModules/Characters/OshimaShiya.cs @@ -15,8 +15,8 @@ namespace Oshima.FunGame.OshimaModules.Characters InitialATK = 25; InitialHP = 85; InitialMP = 10; - InitialSTR = 35; - STRGrowth = 3.5; + InitialSTR = 30; + STRGrowth = 3; InitialAGI = 0; AGIGrowth = 0; InitialINT = 0; diff --git a/OshimaModules/Effects/EffectID.cs b/OshimaModules/Effects/EffectID.cs index c0c080d..b8f5cc2 100644 --- a/OshimaModules/Effects/EffectID.cs +++ b/OshimaModules/Effects/EffectID.cs @@ -165,6 +165,11 @@ /// ExMaxMP2 = 8031, + /// + /// 动态扩展特效 + /// + DynamicsEffect = 8032, + /// /// 被动特效终点 /// diff --git a/OshimaModules/Effects/OpenEffects/DynamicsEffect.cs b/OshimaModules/Effects/OpenEffects/DynamicsEffect.cs new file mode 100644 index 0000000..8e4bbcc --- /dev/null +++ b/OshimaModules/Effects/OpenEffects/DynamicsEffect.cs @@ -0,0 +1,502 @@ +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Oshima.FunGame.OshimaModules.Effects.OpenEffects +{ + /// + /// 除了硬直时间减少和魔法抗性,可以都用这个 + /// + public class DynamicsEffect : Effect + { + public override long Id => (long)EffectID.DynamicsEffect; + public override string Name { get; set; } = "动态扩展特效"; + public override string Description => string.Join("", Descriptions) + (Source != null && Skill.Character != Source ? $"来自:[ {Source} ]" + (Skill.Item != null ? $" 的 [ {Skill.Item.Name} ]" : "") : ""); + public override EffectType EffectType => EffectType.Item; + public HashSet Descriptions { get; } = []; + public Dictionary RealDynamicsValues { get; } = []; + + public override void OnEffectGained(Character character) + { + Resolve(character); + } + + public override void OnEffectLost(Character character) + { + Resolve(character, true); + } + + public override void OnAttributeChanged(Character character) + { + // 刷新加成 + OnEffectLost(character); + OnEffectGained(character); + } + + private void Resolve(Character character, bool remove = false) + { + foreach (string key in Values.Keys) + { + string value = Values[key].ToString() ?? ""; + switch (key.ToLower()) + { + case "exatk": + if (double.TryParse(value, out double exATK)) + { + if (!remove) + { + character.ExATK2 += exATK; + } + else + { + character.ExATK2 -= exATK; + } + RealDynamicsValues["exatk"] = exATK; + Descriptions.Add($"{(exATK >= 0 ? "增加" : "减少")}角色 {Math.Abs(exATK):0.##} 点攻击力。"); + } + break; + case "exdef": + if (double.TryParse(value, out double exDEF)) + { + if (!remove) + { + character.ExDEF2 += exDEF; + } + else + { + character.ExDEF2 -= exDEF; + } + RealDynamicsValues["exdef"] = exDEF; + Descriptions.Add($"{(exDEF >= 0 ? "增加" : "减少")}角色 {Math.Abs(exDEF):0.##} 点物理护甲。"); + } + break; + case "exstr": + if (double.TryParse(value, out double exSTR)) + { + if (!remove) + { + character.ExSTR += exSTR; + } + else + { + character.ExSTR -= exSTR; + } + RealDynamicsValues["exstr"] = exSTR; + Descriptions.Add($"{(exSTR >= 0 ? "增加" : "减少")}角色 {Math.Abs(exSTR):0.##} 点力量。"); + } + break; + case "exagi": + if (double.TryParse(value, out double exAGI)) + { + if (!remove) + { + character.ExAGI += exAGI; + } + else + { + character.ExAGI -= exAGI; + } + RealDynamicsValues["exagi"] = exAGI; + Descriptions.Add($"{(exAGI >= 0 ? "增加" : "减少")}角色 {Math.Abs(exAGI):0.##} 点敏捷。"); + } + break; + case "exint": + if (double.TryParse(value, out double exINT)) + { + if (!remove) + { + character.ExINT += exINT; + } + else + { + character.ExINT -= exINT; + } + RealDynamicsValues["exint"] = exINT; + Descriptions.Add($"{(exINT >= 0 ? "增加" : "减少")}角色 {Math.Abs(exINT):0.##} 点智力。"); + } + break; + case "shtr": + if (double.TryParse(value, out double shtr)) + { + if (!remove) + { + foreach (Skill s in character.Skills) + { + s.HardnessTime -= shtr; + } + foreach (Skill? s in character.Items.Select(i => i.Skills.Active)) + { + if (s != null) + s.HardnessTime -= shtr; + } + } + else + { + foreach (Skill s in character.Skills) + { + s.HardnessTime += shtr; + } + foreach (Skill? s in character.Items.Select(i => i.Skills.Active)) + { + if (s != null) + s.HardnessTime += shtr; + } + } + RealDynamicsValues["shtr"] = shtr; + Descriptions.Add($"减少角色的所有主动技能 {shtr:0.##} 硬直时间。"); + } + break; + case "nahtr": + if (double.TryParse(value, out double nahtr)) + { + if (!remove) + { + character.NormalAttack.HardnessTime -= nahtr; + } + else + { + character.NormalAttack.HardnessTime += nahtr; + } + RealDynamicsValues["nahtr"] = nahtr; + Descriptions.Add($"减少角色的普通攻击 {nahtr:0.##} 硬直时间。"); + } + break; + case "exacc": + if (double.TryParse(value, out double exacc)) + { + if (!remove) + { + character.ExAccelerationCoefficient += exacc; + } + else + { + character.ExAccelerationCoefficient -= exacc; + } + RealDynamicsValues["exacc"] = exacc; + Descriptions.Add($"{(exacc >= 0 ? "增加" : "减少")}角色 {Math.Abs(exacc) * 100:0.##}% 加速系数。"); + } + break; + case "exspd": + if (double.TryParse(value, out double exspd)) + { + if (!remove) + { + character.ExSPD += exspd; + } + else + { + character.ExSPD -= exspd; + } + RealDynamicsValues["exspd"] = exspd; + Descriptions.Add($"{(exspd >= 0 ? "增加" : "减少")}角色 {Math.Abs(exspd):0.##} 点行动速度。"); + } + break; + case "exac": + if (double.TryParse(value, out double exac)) + { + if (!remove) + { + character.ExActionCoefficient += exac; + } + else + { + character.ExActionCoefficient -= exac; + } + RealDynamicsValues["exac"] = exac; + Descriptions.Add($"{(exac >= 0 ? "增加" : "减少")}角色 {Math.Abs(exac) * 100:0.##}% 行动系数。"); + } + break; + case "excdr": + if (double.TryParse(value, out double excdr)) + { + if (!remove) + { + character.ExCDR += excdr; + } + else + { + character.ExCDR -= excdr; + } + RealDynamicsValues["excdr"] = excdr; + Descriptions.Add($"{(excdr >= 0 ? "增加" : "减少")}角色 {Math.Abs(excdr) * 100:0.##}% 冷却缩减。"); + } + break; + case "exhp": + if (double.TryParse(value, out double exhp)) + { + if (!remove) + { + character.ExHP2 += exhp; + } + else + { + character.ExHP2 -= exhp; + } + RealDynamicsValues["exhp"] = exhp; + Descriptions.Add($"{(exhp >= 0 ? "增加" : "减少")}角色 {Math.Abs(exhp):0.##} 点最大生命值。"); + } + break; + case "exmp": + if (double.TryParse(value, out double exmp)) + { + if (!remove) + { + character.ExMP2 += exmp; + } + else + { + character.ExMP2 -= exmp; + } + RealDynamicsValues["exmp"] = exmp; + Descriptions.Add($"{(exmp >= 0 ? "增加" : "减少")}角色 {Math.Abs(exmp):0.##} 点最大魔法值。"); + } + break; + case "excr": + if (double.TryParse(value, out double excr)) + { + if (!remove) + { + character.ExCritRate += excr; + } + else + { + character.ExCritRate -= excr; + } + RealDynamicsValues["excr"] = excr; + Descriptions.Add($"{(excr >= 0 ? "增加" : "减少")}角色 {Math.Abs(excr) * 100:0.##}% 暴击率。"); + } + break; + case "excrd": + if (double.TryParse(value, out double excrd)) + { + if (!remove) + { + character.ExCritDMG += excrd; + } + else + { + character.ExCritDMG -= excrd; + } + RealDynamicsValues["excrd"] = excrd; + Descriptions.Add($"{(excrd >= 0 ? "增加" : "减少")}角色 {Math.Abs(excrd) * 100:0.##}% 暴击伤害。"); + } + break; + case "exer": + if (double.TryParse(value, out double exer)) + { + if (!remove) + { + character.ExEvadeRate += exer; + } + else + { + character.ExEvadeRate -= exer; + } + RealDynamicsValues["exer"] = exer; + Descriptions.Add($"{(exer >= 0 ? "增加" : "减少")}角色 {Math.Abs(exer) * 100:0.##}% 闪避率。"); + } + break; + case "exppt": + if (double.TryParse(value, out double exppt)) + { + if (!remove) + { + character.PhysicalPenetration += exppt; + } + else + { + character.PhysicalPenetration -= exppt; + } + RealDynamicsValues["exppt"] = exppt; + Descriptions.Add($"{(exppt >= 0 ? "增加" : "减少")}角色 {Math.Abs(exppt) * 100:0.##}% 物理穿透。"); + } + break; + case "exmpt": + if (double.TryParse(value, out double exmpt)) + { + if (!remove) + { + character.MagicalPenetration += exmpt; + } + else + { + character.MagicalPenetration -= exmpt; + } + RealDynamicsValues["exmpt"] = exmpt; + Descriptions.Add($"{(exmpt >= 0 ? "增加" : "减少")}角色 {Math.Abs(exmpt) * 100:0.##}% 魔法穿透。"); + } + break; + case "expdr": + if (double.TryParse(value, out double expdr)) + { + if (!remove) + { + character.ExPDR += expdr; + } + else + { + character.ExPDR -= expdr; + } + RealDynamicsValues["expdr"] = expdr; + Descriptions.Add($"{(expdr >= 0 ? "增加" : "减少")}角色 {Math.Abs(expdr) * 100:0.##}% 物理伤害减免。"); + } + break; + case "exhr": + if (double.TryParse(value, out double exhr)) + { + if (!remove) + { + character.ExHR += exhr; + } + else + { + character.ExHR -= exhr; + } + RealDynamicsValues["exhr"] = exhr; + Descriptions.Add($"{(exhr >= 0 ? "增加" : "减少")}角色 {Math.Abs(exhr):0.##} 点生命回复。"); + } + break; + case "exmr": + if (double.TryParse(value, out double exmr)) + { + if (!remove) + { + character.ExMR += exmr; + } + else + { + character.ExMR -= exmr; + } + RealDynamicsValues["exmr"] = exmr; + Descriptions.Add($"{(exmr >= 0 ? "增加" : "减少")}角色 {Math.Abs(exmr):0.##} 点魔法回复。"); + } + break; + case "exatk2": + if (double.TryParse(value, out double exATK2)) + { + double real = 0; + if (!remove) + { + real = character.BaseATK * exATK2; + character.ExATKPercentage += exATK2; + } + else if (RealDynamicsValues.TryGetValue("exatk2", out double percentage)) + { + character.ExATKPercentage -= percentage; + } + RealDynamicsValues["exatk2"] = exATK2; + Descriptions.Add($"{(real >= 0 ? "增加" : "减少")}角色 {Math.Abs(exATK2) * 100:0.##}% [ {Math.Abs(real):0.##} ] 点攻击力。"); + } + break; + case "exdef2": + if (double.TryParse(value, out double exDEF2)) + { + double real = 0; + if (!remove) + { + real = character.BaseDEF * exDEF2; + character.ExDEFPercentage += exDEF2; + } + else if (RealDynamicsValues.TryGetValue("exdef2", out double percentage)) + { + character.ExDEFPercentage -= percentage; + } + RealDynamicsValues["exdef2"] = exDEF2; + Descriptions.Add($"{(real >= 0 ? "增加" : "减少")}角色 {Math.Abs(exDEF2) * 100:0.##}% [ {Math.Abs(real):0.##} ] 点物理护甲。"); + } + break; + case "exstr2": + if (double.TryParse(value, out double exSTR2)) + { + double real = 0; + if (!remove) + { + real = character.BaseSTR * exSTR2; + character.ExSTRPercentage += exSTR2; + } + else if (RealDynamicsValues.TryGetValue("exstr2", out double percentage)) + { + character.ExSTRPercentage -= percentage; + } + RealDynamicsValues["exstr2"] = exSTR2; + Descriptions.Add($"{(real >= 0 ? "增加" : "减少")}角色 {Math.Abs(exSTR2) * 100:0.##}% [ {Math.Abs(real):0.##} ] 点力量。"); + } + break; + case "exagi2": + if (double.TryParse(value, out double exAGI2)) + { + double real = 0; + if (!remove) + { + real = character.BaseAGI * exAGI2; + character.ExAGIPercentage += exAGI2; + } + else if (RealDynamicsValues.TryGetValue("exagi2", out double percentage)) + { + character.ExAGIPercentage -= percentage; + } + RealDynamicsValues["exagi2"] = exAGI2; + Descriptions.Add($"{(real >= 0 ? "增加" : "减少")}角色 {Math.Abs(exAGI2) * 100:0.##}% [ {Math.Abs(real):0.##} ] 点敏捷。"); + } + break; + case "exint2": + if (double.TryParse(value, out double exINT2)) + { + double real = 0; + if (!remove) + { + real = character.BaseINT * exINT2; + character.ExINTPercentage += exINT2; + } + else if (RealDynamicsValues.TryGetValue("exint2", out double percentage)) + { + character.ExINTPercentage -= percentage; + } + RealDynamicsValues["exint2"] = exINT2; + Descriptions.Add($"{(real >= 0 ? "增加" : "减少")}角色 {Math.Abs(exINT2) * 100:0.##}% [ {Math.Abs(real):0.##} ] 点智力。"); + } + break; + case "exhp2": + if (double.TryParse(value, out double exhp2)) + { + double real = 0; + if (!remove) + { + real = character.MaxHP * exhp2; + character.ExHPPercentage += exhp2; + } + else if (RealDynamicsValues.TryGetValue("exhp2", out double percentage)) + { + character.ExHPPercentage -= percentage; + } + RealDynamicsValues["exhp2"] = exhp2; + Descriptions.Add($"{(real >= 0 ? "增加" : "减少")}角色 {Math.Abs(exhp2) * 100:0.##}% [ {Math.Abs(real):0.##} ] 点最大生命值。"); + } + break; + case "exmp2": + if (double.TryParse(value, out double exmp2)) + { + double real = 0; + if (!remove) + { + real = character.MaxMP * exmp2; + character.ExMPPercentage += exmp2; + } + else if (RealDynamicsValues.TryGetValue("exmp2", out double percentage)) + { + character.ExMPPercentage -= percentage; + } + RealDynamicsValues["exmp2"] = exmp2; + Descriptions.Add($"{(real >= 0 ? "增加" : "减少")}角色 {Math.Abs(exmp2) * 100:0.##}% [ {Math.Abs(real):0.##} ] 点最大魔法值。"); + } + break; + } + } + } + + public DynamicsEffect(Skill skill, Dictionary args, Character? source = null) : base(skill, args) + { + GamingQueue = skill.GamingQueue; + Source = source; + } + } +} diff --git a/OshimaModules/Effects/OpenEffects/ExMDF.cs b/OshimaModules/Effects/OpenEffects/ExMDF.cs index 3f03e08..e123e76 100644 --- a/OshimaModules/Effects/OpenEffects/ExMDF.cs +++ b/OshimaModules/Effects/OpenEffects/ExMDF.cs @@ -90,7 +90,7 @@ namespace Oshima.FunGame.OshimaModules.Effects.OpenEffects Source = source; if (Values.Count > 0) { - string key = Values.Keys.FirstOrDefault(s => s.Equals("mdfType", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + string key = Values.Keys.FirstOrDefault(s => s.Equals("mdftype", StringComparison.CurrentCultureIgnoreCase)) ?? ""; if (key.Length > 0 && int.TryParse(Values[key].ToString(), out int mdfType)) { if (Enum.IsDefined(typeof(MagicType), mdfType)) diff --git a/OshimaModules/Modules/SkillModule.cs b/OshimaModules/Modules/SkillModule.cs index cc67f95..e7240f0 100644 --- a/OshimaModules/Modules/SkillModule.cs +++ b/OshimaModules/Modules/SkillModule.cs @@ -113,6 +113,7 @@ namespace Oshima.FunGame.OshimaModules EffectID.NormalAttackHardTimeReduce2 => new NormalAttackHardTimeReduce2(skill, dict), EffectID.ExMaxHP2 => new ExMaxHP2(skill, dict), EffectID.ExMaxMP2 => new ExMaxMP2(skill, dict), + EffectID.DynamicsEffect => new DynamicsEffect(skill, dict), EffectID.RecoverHP => new RecoverHP(skill, dict), EffectID.RecoverMP => new RecoverMP(skill, dict), EffectID.RecoverHP2 => new RecoverHP2(skill, dict), diff --git a/OshimaModules/Skills/Oshima/META马.cs b/OshimaModules/Skills/Oshima/META马.cs index 3d5e984..126e24e 100644 --- a/OshimaModules/Skills/Oshima/META马.cs +++ b/OshimaModules/Skills/Oshima/META马.cs @@ -24,7 +24,7 @@ namespace Oshima.FunGame.OshimaModules.Skills { public override long Id => Skill.Id; public override string Name => Skill.Name; - public override string Description => $"META马专属被动:力量+5,力量成长+0.5;在受到伤害时,获得的能量提升50%,每回合开始还能获得额外的 [ {EP:0.##} ] 能量值。"; + public override string Description => $"META马专属被动:初始力量+5,力量成长+0.5;在受到伤害时,获得的能量提升50%,每回合开始还能获得额外的 [ {EP:0.##} ] 能量值。"; public static double EP => 7; @@ -42,5 +42,17 @@ namespace Oshima.FunGame.OshimaModules.Skills WriteLine($"[ {character} ] 发动了META马专属被动!本次获得了 {EP:0.##} 能量!"); } } + + public override void OnEffectGained(Character character) + { + character.InitialSTR += 5; + character.STRGrowth += 0.5; + } + + public override void OnEffectLost(Character character) + { + character.InitialSTR -= 5; + character.STRGrowth -= 0.5; + } } }