From 2e5479bed80daa5bea2d2fd9add0c7fd77e8aba6 Mon Sep 17 00:00:00 2001 From: milimoe Date: Wed, 4 Sep 2024 00:38:37 +0800 Subject: [PATCH 01/15] new --- Library/Main.cs | 149 +++++++++++++++++------------ Library/Solutions/ActionQueue.cs | 157 +++++++++++++++++++++++++++++++ Library/Solutions/MyPlugin.cs | 2 +- Library/Solutions/Person.cs | 14 ++- Library/Solutions/TestModule.cs | 84 +++++++++++++++++ Library/Solutions/TestPlugin.cs | 112 ++++++++++++++++++++++ Library/Tests/CheckDLL.cs | 66 +++++++++++++ Library/Tests/Old.cs | 83 ++++++++++++++++ 8 files changed, 604 insertions(+), 63 deletions(-) create mode 100644 Library/Solutions/ActionQueue.cs create mode 100644 Library/Solutions/TestModule.cs create mode 100644 Library/Solutions/TestPlugin.cs create mode 100644 Library/Tests/CheckDLL.cs create mode 100644 Library/Tests/Old.cs diff --git a/Library/Main.cs b/Library/Main.cs index 6db7684..2490795 100644 --- a/Library/Main.cs +++ b/Library/Main.cs @@ -1,74 +1,103 @@ -using System.Collections; -using System.Data; -using ConverterExample; using Milimoe.FunGame.Core.Api.Utility; using Milimoe.FunGame.Core.Entity; -using Milimoe.FunGame.Core.Library.Common.JsonConverter; +using Milimoe.FunGame.Core.Library.Common.Addon; +using Milimoe.FunGame.Core.Library.Common.Event; +using Milimoe.FunGame.Core.Library.Constant; +using Milimoe.FunGame.Testing.Solutions; -DataSet ds = new(); -DataTable table = new("SampleTable1"); -table.Columns.Add("Id", typeof(int)); -table.Columns.Add("Name", typeof(string)); -table.Columns.Add("Age", typeof(int)); -table.Rows.Add(1, "John", 30); -table.Rows.Add(2, "Jane", 25); -table.Rows.Add(3, "Bob", 40); -ds.Tables.Add(table); - -table = new("SampleTable2"); -table.Columns.Add("Id", typeof(int)); -table.Columns.Add("Name", typeof(string)); -table.Columns.Add("Age", typeof(int)); -table.Rows.Add(1, "John", 30); -table.Rows.Add(2, "Jane", 25); -table.Rows.Add(3, "Bob", 40); -ds.Tables.Add(table); - -JsonTool JsonTool = new(); -JsonTool.AddConverters(new System.Text.Json.Serialization.JsonConverter[] { new UserConverter(), new RoomConverter(), new PersonConverter(), new AddressConverter() }); - -Room r = Factory.GetRoom(1294367, "w5rtvh8".ToUpper(), DateTime.Now, Factory.GetUser(), Milimoe.FunGame.Core.Library.Constant.RoomType.Mix, "", "", Milimoe.FunGame.Core.Library.Constant.RoomState.Created); -User u = Factory.GetUser(1, "LUOLI", DateTime.Now, DateTime.Now, "LUOLI@66.COM", "QWQAQW"); - -Hashtable hashtable = new() +PluginLoader plugins = PluginLoader.LoadPlugins([]); +foreach (string plugin in plugins.Plugins.Keys) { - { "table", table }, - { "room", r }, - { "user", u } -}; + Console.WriteLine(plugin + " is loaded."); +} -string json = JsonTool.GetString(hashtable); - -Hashtable hashtable2 = JsonTool.GetObject(json) ?? new(); - -DataTable table2 = JsonTool.GetObject(json) ?? new(); -User u2 = JsonTool.GetObject(hashtable2, "user") ?? Factory.GetUser(); -Room r2 = JsonTool.GetObject(hashtable2, "room") ?? Factory.GetRoom(); - -table2.AsEnumerable().ToList().ForEach(row => +Dictionary plugindllsha512 = []; +foreach (string pfp in PluginLoader.PluginFilePaths.Keys) { - Console.WriteLine("Id: " + row["Id"] + ", Name: "+ row["Name"] + ", Age: " + row["Age"]); -}); + string text = Encryption.FileSha512(PluginLoader.PluginFilePaths[pfp]); + plugindllsha512.Add(pfp, text); + Console.WriteLine(pfp + $" is {text}."); +} -Console.WriteLine(u2.Username + " 进入了 " + r2.Roomid + " 房间"); - -Person p = new() +LoginEventArgs e = new(); +plugins.OnBeforeLoginEvent(plugins, e); +if (!e.Cancel) { - Age = (int)r2.Id, - Name = u2.Username, - Address = new() + plugins.OnSucceedLoginEvent(plugins, e); + plugins.OnFailedLoginEvent(plugins, e); +} +plugins.OnAfterLoginEvent(plugins, e); + +List list = []; + +GameModuleLoader modules = GameModuleLoader.LoadGameModules(FunGameInfo.FunGame.FunGame_Desktop, []); +foreach (CharacterModule cm in modules.Characters.Values) +{ + foreach (Character c in cm.Characters) { - State = "呵呵州(Hehe State)", - City = "哈哈市(Haha City)" + Console.WriteLine(c.Name); + list.Add(c); } -}; +} -json = JsonTool.GetString(p); +Dictionary moduledllsha512 = []; +foreach (string mfp in GameModuleLoader.ModuleFilePaths.Keys) +{ + string text = Encryption.FileSha512(GameModuleLoader.ModuleFilePaths[mfp]); + moduledllsha512.Add(mfp, text); + Console.WriteLine(mfp + $" is {text}."); +} -Person p2 = JsonTool.GetObject(json) ?? new(); +foreach (string moduledll in moduledllsha512.Keys) +{ + string server = moduledllsha512[moduledll]; + if (plugindllsha512.TryGetValue(moduledll, out string? client) && client != "" && server == client) + { + Console.WriteLine(moduledll + $" is checked pass."); + } +} -Console.WriteLine("My name is " + p2.Name + ", I am " + p2.Age + "-year-old. I live at " + p2.Address.State + " " + p2.Address.City); -Console.WriteLine("摆烂了86"); +if (list.Count > 3) +{ + Console.WriteLine(); + Console.WriteLine("Start!!!"); + Console.WriteLine(); -// 生成一对公钥秘钥 -//TwoFactorAuthenticator.CreateSecretKey(); + Character character1 = list[0].Copy(); + Character character2 = list[1].Copy(); + Character character3 = list[2].Copy(); + Character character4 = list[3].Copy(); + + ActionQueue actionQueue = new(); + List characters = [character1, character2, character3, character4]; + + // 初始顺序表排序 + actionQueue.CalculateInitialOrder(characters); + Console.WriteLine(); + + // 显示初始顺序表 + actionQueue.DisplayQueue(); + Console.WriteLine(); + + // 模拟时间流逝 + int i = 1; + while (i < 10) + { + // 检查是否有角色可以行动 + Character? characterToAct = actionQueue.NextCharacter(); + if (characterToAct != null) + { + Console.WriteLine($"=== Round {i++} ==="); + actionQueue.ProcessTurn(characterToAct); + actionQueue.DisplayQueue(); + Console.WriteLine(); + } + + //Thread.Sleep(1); // 模拟时间流逝 + actionQueue.ReduceHardnessTimes(); + } + + Console.WriteLine("--- End ---"); +} + +Console.ReadKey(); diff --git a/Library/Solutions/ActionQueue.cs b/Library/Solutions/ActionQueue.cs new file mode 100644 index 0000000..e0acd13 --- /dev/null +++ b/Library/Solutions/ActionQueue.cs @@ -0,0 +1,157 @@ +using Milimoe.FunGame.Core.Entity; + +namespace Milimoe.FunGame.Testing.Solutions; + +public class ActionQueue +{ + private readonly List _Queue = []; + private readonly Dictionary _HardnessTimes = []; + + public void AddCharacter(Character character, double hardnessTime) + { + // 插队机制:按硬直时间排序 + int insertIndex = _Queue.FindIndex(c => _HardnessTimes[c] > hardnessTime); + if (insertIndex == -1) + { + _Queue.Add(character); + } + else + { + _Queue.Insert(insertIndex, character); + } + _HardnessTimes[character] = hardnessTime; + } + + public void CalculateInitialOrder(List characters) + { + // 排序时,时间会流逝 + int nowTime = 1; + + // 初始排序:按速度排序 + List> groupedBySpeed = [.. characters + .GroupBy(c => c.SPD) + .OrderByDescending(g => g.Key)]; + + Random random = new(); + + foreach (IGrouping group in groupedBySpeed) + { + if (group.Count() == 1) + { + // 如果只有一个角色,直接加入队列 + AddCharacter(group.First(), _Queue.Count + nowTime); + } + else + { + // 如果有多个角色,进行先行决定 + List sortedList = [.. group]; + + while (sortedList.Count > 0) + { + Character? selectedCharacter = null; + bool decided = false; + if (sortedList.Count == 1) + { + selectedCharacter = sortedList[0]; + decided = true; + } + + while (!decided) + { + // 每个角色进行两次随机数抽取 + var randomNumbers = sortedList.Select(c => new + { + Character = c, + FirstRoll = random.Next(1, 21), + SecondRoll = random.Next(1, 21) + }).ToList(); + + randomNumbers.ForEach(a => Console.WriteLine(a.Character.Name + ": " + a.FirstRoll + " / " + a.SecondRoll)); + + nowTime++; + + // 找到两次都大于其他角色的角色 + int maxFirstRoll = randomNumbers.Max(r => r.FirstRoll); + int maxSecondRoll = randomNumbers.Max(r => r.SecondRoll); + + var candidates = randomNumbers + .Where(r => r.FirstRoll == maxFirstRoll && r.SecondRoll == maxSecondRoll) + .ToList(); + + if (candidates.Count == 1) + { + selectedCharacter = candidates.First().Character; + decided = true; + } + } + + // 将决定好的角色加入顺序表 + if (selectedCharacter != null) + { + AddCharacter(selectedCharacter, _Queue.Count + nowTime); + Console.WriteLine("decided: " + selectedCharacter.Name + "\r\n"); + sortedList.Remove(selectedCharacter); + } + } + } + } + } + + public Character? NextCharacter() + { + if (_Queue.Count == 0) return null; + + // 硬直时间为0的角色将执行行动 + Character? character = _Queue.FirstOrDefault(c => _HardnessTimes[c] == 0); + if (character != null) + { + _Queue.Remove(character); + return character; + } + + return null; + } + + public void ProcessTurn(Character character) + { + double baseTime = 15; // 假设基础硬直时间为15 + if (character.Name == "A") + { + baseTime = 10; // A的硬直 + } + double newHardnessTime = Math.Round(baseTime * (1 - character.ActionCoefficient), 2, MidpointRounding.AwayFromZero); + + AddCharacter(character, newHardnessTime); + } + + public void ReduceHardnessTimes() + { + if (_Queue.Count == 0) return; + + // 获取第一个角色的硬直时间 + double timeToReduce = _HardnessTimes[_Queue[0]]; + + Console.WriteLine("Time Lapse: " + timeToReduce); + + // 减少所有角色的硬直时间 + foreach (Character character in _Queue) + { + _HardnessTimes[character] = Math.Round(_HardnessTimes[character] - timeToReduce, 2, MidpointRounding.AwayFromZero); + + // 回血回蓝 + double douHP = Math.Round(character.HR * timeToReduce, 2, MidpointRounding.AwayFromZero); + double douMP = Math.Round(character.MR * timeToReduce, 2, MidpointRounding.AwayFromZero); + Console.WriteLine("角色 " + character.Name + " 回血:" + douHP + " / "+ "回蓝:" + douMP); + } + Console.WriteLine(); + } + + public void DisplayQueue() + { + Console.WriteLine("Current ActionQueue:"); + foreach (var character in _Queue) + { + Console.WriteLine($"{character.Name}: Hardness Time {_HardnessTimes[character]}"); + } + } +} diff --git a/Library/Solutions/MyPlugin.cs b/Library/Solutions/MyPlugin.cs index 3f1545d..8697a14 100644 --- a/Library/Solutions/MyPlugin.cs +++ b/Library/Solutions/MyPlugin.cs @@ -7,7 +7,7 @@ namespace FunGame.Testing.Solutions { public class MyPlugin : Plugin, ILoginEvent, IConnectEvent, IIntoRoomEvent { - public override string Name => "测试插件"; + public override string Name => "milimoe.fungame.testplugin"; public override string Description => "My First Plugin"; diff --git a/Library/Solutions/Person.cs b/Library/Solutions/Person.cs index 889ddae..1372f51 100644 --- a/Library/Solutions/Person.cs +++ b/Library/Solutions/Person.cs @@ -19,7 +19,12 @@ namespace ConverterExample public class AddressConverter : BaseEntityConverter
{ - public override void ReadPropertyName(ref Utf8JsonReader reader, string propertyName, JsonSerializerOptions options, ref Address? result) + public override Address NewInstance() + { + return new(); + } + + public override void ReadPropertyName(ref Utf8JsonReader reader, string propertyName, JsonSerializerOptions options, ref Address result) { result ??= new(); switch (propertyName) @@ -47,7 +52,12 @@ namespace ConverterExample public class PersonConverter : BaseEntityConverter { - public override void ReadPropertyName(ref Utf8JsonReader reader, string propertyName, JsonSerializerOptions options, ref Person? result) + public override Person NewInstance() + { + return new(); + } + + public override void ReadPropertyName(ref Utf8JsonReader reader, string propertyName, JsonSerializerOptions options, ref Person result) { result ??= new(); switch (propertyName) diff --git a/Library/Solutions/TestModule.cs b/Library/Solutions/TestModule.cs new file mode 100644 index 0000000..9b20b69 --- /dev/null +++ b/Library/Solutions/TestModule.cs @@ -0,0 +1,84 @@ +using Milimoe.FunGame.Core.Api.Utility; +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Common.Addon; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Addons +{ + public class ExampleGameModuleConstant + { + public const string Example = "fungame.example.gamemode"; + public const string ExampleCharacter = "fungame.example.character"; + public const string ExampleSkill = "fungame.example.skill"; + public const string ExampleItem = "fungame.example.item"; + } + + public class ExampleCharacterModule : CharacterModule + { + public override string Name => ExampleGameModuleConstant.ExampleCharacter; + + public override string Description => "My First CharacterModule"; + + public override string Version => "1.0.0"; + + public override string Author => "FunGamer"; + + public override List Characters + { + get + { + EntityModuleConfig config = new(ExampleGameModuleConstant.Example, ExampleGameModuleConstant.ExampleCharacter); + config.LoadConfig(); + return [.. config.Values]; + } + } + } + + public class ExampleSkillModule : SkillModule + { + public override string Name => ExampleGameModuleConstant.ExampleSkill; + + public override string Description => "My First SkillModule"; + + public override string Version => "1.0.0"; + + public override string Author => "FunGamer"; + + public override List Skills + { + get + { + List list = []; + Skill s = Factory.GetSkill(); + s.Name = "Example Skill"; + s.MagicType = MagicType.PurityNatural; + list.Add(s); + return list; + } + } + } + + public class ExampleItemModule : ItemModule + { + public override string Name => ExampleGameModuleConstant.ExampleItem; + + public override string Description => "My First ItemModule"; + + public override string Version => "1.0.0"; + + public override string Author => "FunGamer"; + + public override List Items + { + get + { + List list = []; + Item i = Factory.GetItem(); + i.Name = "Example Item"; + i.Price = 20; + list.Add(i); + return list; + } + } + } +} diff --git a/Library/Solutions/TestPlugin.cs b/Library/Solutions/TestPlugin.cs new file mode 100644 index 0000000..f9f20cb --- /dev/null +++ b/Library/Solutions/TestPlugin.cs @@ -0,0 +1,112 @@ +using Milimoe.FunGame.Core.Api.Utility; +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Interface; +using Milimoe.FunGame.Core.Library.Common.Addon; +using Milimoe.FunGame.Core.Library.Common.Event; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Addons +{ + public class TestPlugin : Plugin, ILoginEvent + { + public override string Name => "fungame.example.plugin"; + + public override string Description => "My First Plugin"; + + public override string Version => "1.0.0"; + + public override string Author => "FunGamer"; + + protected override bool BeforeLoad() + { + EntityModuleConfig config = new(ExampleGameModuleConstant.Example, ExampleGameModuleConstant.ExampleCharacter); + // 构建一个你想要的角色 + Character c = Factory.GetCharacter(); + c.Name = "Oshima"; + c.FirstName = "Shiya"; + c.NickName = "OSM"; + c.MagicType = MagicType.PurityNatural; + c.BaseHP = 30; + c.BaseSTR = 20; + c.BaseAGI = 10; + c.BaseINT = 5; + c.BaseATK = 100; + c.BaseDEF = 10; + c.SPD = 250; + c.Init(); + config.Add("OSM", c); + c = Factory.GetCharacter(); + c.Name = "A"; + c.FirstName = "测试1"; + c.NickName = "A"; + c.MagicType = MagicType.Particle; + c.BaseHP = 25; + c.BaseSTR = 15; + c.BaseAGI = 5; + c.BaseINT = 10; + c.BaseATK = 80; + c.BaseDEF = 15; + c.SPD = 290; + c.Init(); + config.Add("A", c); + c = Factory.GetCharacter(); + c.Name = "B"; + c.FirstName = "测试2"; + c.NickName = "B"; + c.MagicType = MagicType.Fleabane; + c.BaseHP = 355; + c.BaseSTR = 5; + c.BaseAGI = 5; + c.BaseINT = 25; + c.BaseATK = 75; + c.BaseDEF = 20; + c.SPD = 320; + c.Init(); + config.Add("B", c); + c = Factory.GetCharacter(); + c.Name = "C"; + c.FirstName = "测试3"; + c.NickName = "B的复制人"; + c.MagicType = MagicType.Fleabane; + c.BaseHP = 355; + c.BaseSTR = 5; + c.BaseAGI = 5; + c.BaseINT = 25; + c.BaseATK = 75; + c.BaseDEF = 20; + c.SPD = 320; + c.Init(); + config.Add("C", c); + config.SaveConfig(); + PluginConfig config2 = new(Name, "config") + { + { "flush", 10000 }, + { "oshima", "呵呵了" } + }; + config2.SaveConfig(); + return true; + } + + public void AfterLoginEvent(object sender, LoginEventArgs e) + { + Console.WriteLine("after"); + } + + public void BeforeLoginEvent(object sender, LoginEventArgs e) + { + Console.WriteLine("before"); + // 如果这里设置Cancel = true,将终止登录 + e.Cancel = true; + } + + public void FailedLoginEvent(object sender, LoginEventArgs e) + { + Console.WriteLine("failed"); + } + + public void SucceedLoginEvent(object sender, LoginEventArgs e) + { + Console.WriteLine("succeed"); + } + } +} diff --git a/Library/Tests/CheckDLL.cs b/Library/Tests/CheckDLL.cs new file mode 100644 index 0000000..419f02f --- /dev/null +++ b/Library/Tests/CheckDLL.cs @@ -0,0 +1,66 @@ +using Milimoe.FunGame.Core.Api.Utility; +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Common.Addon; +using Milimoe.FunGame.Core.Library.Common.Event; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Testing.Tests +{ + internal class CheckDLL + { + internal CheckDLL() + { + PluginLoader plugins = PluginLoader.LoadPlugins([]); + foreach (string plugin in plugins.Plugins.Keys) + { + Console.WriteLine(plugin + " is loaded."); + } + + Dictionary plugindllsha512 = []; + foreach (string pfp in PluginLoader.PluginFilePaths.Keys) + { + string text = Encryption.FileSha512(PluginLoader.PluginFilePaths[pfp]); + plugindllsha512.Add(pfp, text); + Console.WriteLine(pfp + $" is {text}."); + } + + LoginEventArgs e = new(); + plugins.OnBeforeLoginEvent(plugins, e); + if (!e.Cancel) + { + plugins.OnSucceedLoginEvent(plugins, e); + plugins.OnFailedLoginEvent(plugins, e); + } + plugins.OnAfterLoginEvent(plugins, e); + + List list = []; + + GameModuleLoader modules = GameModuleLoader.LoadGameModules(FunGameInfo.FunGame.FunGame_Desktop, []); + foreach (CharacterModule cm in modules.Characters.Values) + { + foreach (Character c in cm.Characters) + { + Console.WriteLine(c.Name); + list.Add(c); + } + } + + Dictionary moduledllsha512 = []; + foreach (string mfp in GameModuleLoader.ModuleFilePaths.Keys) + { + string text = Encryption.FileSha512(GameModuleLoader.ModuleFilePaths[mfp]); + moduledllsha512.Add(mfp, text); + Console.WriteLine(mfp + $" is {text}."); + } + + foreach (string moduledll in moduledllsha512.Keys) + { + string server = moduledllsha512[moduledll]; + if (plugindllsha512.TryGetValue(moduledll, out string? client) && client != "" && server == client) + { + Console.WriteLine(moduledll + $" is checked pass."); + } + } + } + } +} diff --git a/Library/Tests/Old.cs b/Library/Tests/Old.cs new file mode 100644 index 0000000..9b1a425 --- /dev/null +++ b/Library/Tests/Old.cs @@ -0,0 +1,83 @@ +using System.Collections; +using System.Data; +using ConverterExample; +using Milimoe.FunGame.Core.Api.Utility; +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Common.JsonConverter; + +namespace Milimoe.FunGame.Testing.Tests +{ + internal class Old + { + internal Old() + { + DataSet ds = new(); + DataTable table = new("SampleTable1"); + table.Columns.Add("Id", typeof(int)); + table.Columns.Add("Name", typeof(string)); + table.Columns.Add("Age", typeof(int)); + table.Rows.Add(1, "John", 30); + table.Rows.Add(2, "Jane", 25); + table.Rows.Add(3, "Bob", 40); + ds.Tables.Add(table); + + table = new("SampleTable2"); + table.Columns.Add("Id", typeof(int)); + table.Columns.Add("Name", typeof(string)); + table.Columns.Add("Age", typeof(int)); + table.Rows.Add(1, "John", 30); + table.Rows.Add(2, "Jane", 25); + table.Rows.Add(3, "Bob", 40); + ds.Tables.Add(table); + + JsonTool JsonTool = new(); + JsonTool.AddConverters(new System.Text.Json.Serialization.JsonConverter[] { new UserConverter(), new RoomConverter(), new PersonConverter(), new AddressConverter() }); + + Room r = Factory.GetRoom(1294367, "w5rtvh8".ToUpper(), DateTime.Now, Factory.GetUser(), Milimoe.FunGame.Core.Library.Constant.RoomType.Mix, "", "", Milimoe.FunGame.Core.Library.Constant.RoomState.Created); + User u = Factory.GetUser(1, "LUOLI", DateTime.Now, DateTime.Now, "LUOLI@66.COM", "QWQAQW"); + + Hashtable hashtable = new() + { + { "table", table }, + { "room", r }, + { "user", u } + }; + + string json = JsonTool.GetString(hashtable); + + Hashtable hashtable2 = JsonTool.GetObject(json) ?? new(); + + DataTable table2 = JsonTool.GetObject(json) ?? new(); + User u2 = JsonTool.GetObject(hashtable2, "user") ?? Factory.GetUser(); + Room r2 = JsonTool.GetObject(hashtable2, "room") ?? Factory.GetRoom(); + + table2.AsEnumerable().ToList().ForEach(row => + { + Console.WriteLine("Id: " + row["Id"] + ", Name: " + row["Name"] + ", Age: " + row["Age"]); + }); + + Console.WriteLine(u2.Username + " 进入了 " + r2.Roomid + " 房间"); + + Person p = new() + { + Age = (int)r2.Id, + Name = u2.Username, + Address = new() + { + State = "呵呵州(Hehe State)", + City = "哈哈市(Haha City)" + } + }; + + json = JsonTool.GetString(p); + + Person p2 = JsonTool.GetObject(json) ?? new(); + + Console.WriteLine("My name is " + p2.Name + ", I am " + p2.Age + "-year-old. I live at " + p2.Address.State + " " + p2.Address.City); + Console.WriteLine("摆烂了86"); + + // 生成一对公钥秘钥 + //TwoFactorAuthenticator.CreateSecretKey(); + } + } +} From 0667758c29fe4494b7ae8ad5e5aaf7453bd7dfd4 Mon Sep 17 00:00:00 2001 From: milimoe Date: Thu, 5 Sep 2024 00:42:49 +0800 Subject: [PATCH 02/15] UPDATE --- Library/Solutions/ActionQueue.cs | 4 +-- Library/Solutions/TestPlugin.cs | 60 +++++++++++++++----------------- 2 files changed, 30 insertions(+), 34 deletions(-) diff --git a/Library/Solutions/ActionQueue.cs b/Library/Solutions/ActionQueue.cs index e0acd13..9dc3a19 100644 --- a/Library/Solutions/ActionQueue.cs +++ b/Library/Solutions/ActionQueue.cs @@ -141,7 +141,7 @@ public class ActionQueue // 回血回蓝 double douHP = Math.Round(character.HR * timeToReduce, 2, MidpointRounding.AwayFromZero); double douMP = Math.Round(character.MR * timeToReduce, 2, MidpointRounding.AwayFromZero); - Console.WriteLine("角色 " + character.Name + " 回血:" + douHP + " / "+ "回蓝:" + douMP); + Console.WriteLine("角色 " + character.Name + " 回血:" + douHP + " / " + "回蓝:" + douMP); } Console.WriteLine(); } @@ -154,4 +154,4 @@ public class ActionQueue Console.WriteLine($"{character.Name}: Hardness Time {_HardnessTimes[character]}"); } } -} +} \ No newline at end of file diff --git a/Library/Solutions/TestPlugin.cs b/Library/Solutions/TestPlugin.cs index f9f20cb..0e830dc 100644 --- a/Library/Solutions/TestPlugin.cs +++ b/Library/Solutions/TestPlugin.cs @@ -26,56 +26,52 @@ namespace Addons c.FirstName = "Shiya"; c.NickName = "OSM"; c.MagicType = MagicType.PurityNatural; - c.BaseHP = 30; - c.BaseSTR = 20; - c.BaseAGI = 10; - c.BaseINT = 5; - c.BaseATK = 100; - c.BaseDEF = 10; - c.SPD = 250; - c.Init(); + c.InitialHP = 30; + c.InitialSTR = 20; + c.InitialAGI = 10; + c.InitialINT = 5; + c.InitialATK = 100; + c.InitialDEF = 10; + c.InitialSPD = 250; config.Add("OSM", c); c = Factory.GetCharacter(); c.Name = "A"; c.FirstName = "测试1"; c.NickName = "A"; c.MagicType = MagicType.Particle; - c.BaseHP = 25; - c.BaseSTR = 15; - c.BaseAGI = 5; - c.BaseINT = 10; - c.BaseATK = 80; - c.BaseDEF = 15; - c.SPD = 290; - c.Init(); + c.InitialHP = 25; + c.InitialSTR = 15; + c.InitialAGI = 5; + c.InitialINT = 10; + c.InitialATK = 80; + c.InitialDEF = 15; + c.InitialSPD = 290; config.Add("A", c); c = Factory.GetCharacter(); c.Name = "B"; c.FirstName = "测试2"; c.NickName = "B"; c.MagicType = MagicType.Fleabane; - c.BaseHP = 355; - c.BaseSTR = 5; - c.BaseAGI = 5; - c.BaseINT = 25; - c.BaseATK = 75; - c.BaseDEF = 20; - c.SPD = 320; - c.Init(); + c.InitialHP = 355; + c.InitialSTR = 5; + c.InitialAGI = 5; + c.InitialINT = 25; + c.InitialATK = 75; + c.InitialDEF = 20; + c.InitialSPD = 320; config.Add("B", c); c = Factory.GetCharacter(); c.Name = "C"; c.FirstName = "测试3"; c.NickName = "B的复制人"; c.MagicType = MagicType.Fleabane; - c.BaseHP = 355; - c.BaseSTR = 5; - c.BaseAGI = 5; - c.BaseINT = 25; - c.BaseATK = 75; - c.BaseDEF = 20; - c.SPD = 320; - c.Init(); + c.InitialHP = 355; + c.InitialSTR = 5; + c.InitialAGI = 5; + c.InitialINT = 25; + c.InitialATK = 75; + c.InitialDEF = 20; + c.InitialSPD = 320; config.Add("C", c); config.SaveConfig(); PluginConfig config2 = new(Name, "config") From 195f9497d42a390bf6bcdfc63402153c2f75fbf0 Mon Sep 17 00:00:00 2001 From: milimoe Date: Sun, 8 Sep 2024 02:34:47 +0800 Subject: [PATCH 03/15] =?UTF-8?q?=E6=8A=80=E8=83=BD=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=EF=BC=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Library/Characters/Characters.cs | 309 +++++++++++++++++++++++++++++++ Library/Effects/冰霜攻击特效.cs | 39 ++++ Library/Effects/天赐之力特效.cs | 67 +++++++ Library/Main.cs | 51 ++++- Library/Skills/冰霜攻击.cs | 22 +++ Library/Skills/天赐之力.cs | 20 ++ Library/Solutions/ActionQueue.cs | 157 ---------------- Library/Solutions/TestModule.cs | 2 - Library/Solutions/TestPlugin.cs | 74 ++------ 9 files changed, 516 insertions(+), 225 deletions(-) create mode 100644 Library/Characters/Characters.cs create mode 100644 Library/Effects/冰霜攻击特效.cs create mode 100644 Library/Effects/天赐之力特效.cs create mode 100644 Library/Skills/冰霜攻击.cs create mode 100644 Library/Skills/天赐之力.cs delete mode 100644 Library/Solutions/ActionQueue.cs diff --git a/Library/Characters/Characters.cs b/Library/Characters/Characters.cs new file mode 100644 index 0000000..3934186 --- /dev/null +++ b/Library/Characters/Characters.cs @@ -0,0 +1,309 @@ +using Milimoe.FunGame.Core.Api.Utility; +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace FunGame.Testing.Characters +{ + public class Characters + { + public static Character Oshima + { + get + { + Character c = Factory.GetCharacter(); + c.Name = "Oshima"; + c.FirstName = "Shiya"; + c.NickName = "大島シヤ"; + c.PrimaryAttribute = PrimaryAttribute.STR; + c.InitialATK = 25; + c.InitialHP = 160; + c.InitialMP = 10; + c.InitialSTR = 35; + c.STRGrowth = 3.5; + c.InitialAGI = 0; + c.AGIGrowth = 0; + c.InitialINT = 0; + c.INTGrowth = 0; + c.InitialSPD = 300; + c.InitialHR = 4; + c.InitialMR = 2; + return c; + } + } + + public static Character Xinyin + { + get + { + Character c = Factory.GetCharacter(); + c.Name = "Xiyue"; + c.FirstName = "XinYin"; + c.NickName = "心音"; + c.PrimaryAttribute = PrimaryAttribute.AGI; + c.InitialATK = 22; + c.InitialHP = 80; + c.InitialMP = 60; + c.InitialSTR = 8; + c.STRGrowth = 0.9; + c.InitialAGI = 19; + c.AGIGrowth = 1.7; + c.InitialINT = 3; + c.INTGrowth = 0.4; + c.InitialSPD = 300; + c.InitialHR = 4; + c.InitialMR = 2; + return c; + } + } + + public static Character Yang + { + get + { + Character c = Factory.GetCharacter(); + c.Name = "Ya"; + c.FirstName = "Yang"; + c.NickName = "吖养"; + c.PrimaryAttribute = PrimaryAttribute.STR; + c.InitialATK = 23; + c.InitialHP = 105; + c.InitialMP = 55; + c.InitialSTR = 11; + c.STRGrowth = 1.8; + c.InitialAGI = 9; + c.AGIGrowth = 0.5; + c.InitialINT = 10; + c.INTGrowth = 0.7; + c.InitialSPD = 300; + c.InitialHR = 4; + c.InitialMR = 2; + return c; + } + } + + public static Character NanGanyu + { + get + { + Character c = Factory.GetCharacter(); + c.Name = "Nan"; + c.FirstName = "Ganyu"; + c.NickName = "男甘雨"; + c.PrimaryAttribute = PrimaryAttribute.INT; + c.InitialATK = 17; + c.InitialHP = 115; + c.InitialMP = 80; + c.InitialSTR = 6; + c.STRGrowth = 0.6; + c.InitialAGI = 7; + c.AGIGrowth = 0.7; + c.InitialINT = 17; + c.INTGrowth = 0.7; + c.InitialSPD = 300; + c.InitialHR = 4; + c.InitialMR = 2; + return c; + } + } + + public static Character NiuNan + { + get + { + Character c = Factory.GetCharacter(); + c.Name = "Niu"; + c.FirstName = "Nan"; + c.NickName = "牛腩"; + c.PrimaryAttribute = PrimaryAttribute.INT; + c.InitialATK = 16; + c.InitialHP = 75; + c.InitialMP = 90; + c.InitialSTR = 0; + c.STRGrowth = 0; + c.InitialAGI = 0; + c.AGIGrowth = 0; + c.InitialINT = 30; + c.INTGrowth = 3; + c.InitialSPD = 300; + c.InitialHR = 4; + c.InitialMR = 2; + return c; + } + } + + public static Character Mayor + { + get + { + Character c = Factory.GetCharacter(); + c.Name = "Dokyo"; + c.FirstName = "Mayor"; + c.NickName = "铎京市长"; + c.PrimaryAttribute = PrimaryAttribute.AGI; + c.InitialATK = 21; + c.InitialHP = 120; + c.InitialMP = 20; + c.InitialSTR = 7; + c.STRGrowth = 1; + c.InitialAGI = 21; + c.AGIGrowth = 1.8; + c.InitialINT = 2; + c.INTGrowth = 0.2; + c.InitialSPD = 300; + c.InitialHR = 4; + c.InitialMR = 2; + return c; + } + } + + public static Character 马猴烧酒 + { + get + { + Character c = Factory.GetCharacter(); + c.Name = "Magical"; + c.FirstName = "Girl"; + c.NickName = "魔法少女"; + c.PrimaryAttribute = PrimaryAttribute.AGI; + c.InitialATK = 20; + c.InitialHP = 95; + c.InitialMP = 35; + c.InitialSTR = 7; + c.STRGrowth = 0.3; + c.InitialAGI = 15; + c.AGIGrowth = 2.3; + c.InitialINT = 8; + c.INTGrowth = 0.4; + c.InitialSPD = 300; + c.InitialHR = 4; + c.InitialMR = 2; + return c; + } + } + + public static Character QingXiang + { + get + { + Character c = Factory.GetCharacter(); + c.Name = "Qing"; + c.FirstName = "Xiang"; + c.NickName = "清香"; + c.PrimaryAttribute = PrimaryAttribute.INT; + c.InitialATK = 26; + c.InitialHP = 110; + c.InitialMP = 80; + c.InitialSTR = 6; + c.STRGrowth = 0.5; + c.InitialAGI = 4; + c.AGIGrowth = 0.5; + c.InitialINT = 20; + c.INTGrowth = 2; + c.InitialSPD = 300; + c.InitialHR = 4; + c.InitialMR = 2; + return c; + } + } + + public static Character QWQAQW + { + get + { + Character c = Factory.GetCharacter(); + c.Name = "QWQ"; + c.FirstName = "AQW"; + c.NickName = "LUOLI66"; + c.PrimaryAttribute = PrimaryAttribute.INT; + c.InitialATK = 18; + c.InitialHP = 85; + c.InitialMP = 45; + c.InitialSTR = 0; + c.STRGrowth = 0; + c.InitialAGI = 15; + c.AGIGrowth = 1.5; + c.InitialINT = 15; + c.INTGrowth = 1.5; + c.InitialSPD = 300; + c.InitialHR = 4; + c.InitialMR = 2; + return c; + } + } + + public static Character ColdBlue + { + get + { + Character c = Factory.GetCharacter(); + c.Name = "Cold"; + c.FirstName = "Blue"; + c.NickName = "冷蓝"; + c.PrimaryAttribute = PrimaryAttribute.STR; + c.InitialATK = 28; + c.InitialHP = 135; + c.InitialMP = 25; + c.InitialSTR = 22; + c.STRGrowth = 1.9; + c.InitialAGI = 4; + c.AGIGrowth = 0.6; + c.InitialINT = 4; + c.INTGrowth = 0.6; + c.InitialSPD = 300; + c.InitialHR = 4; + c.InitialMR = 2; + return c; + } + } + + public static Character 绿拱门 + { + get + { + Character c = Factory.GetCharacter(); + c.Name = "ddd"; + c.FirstName = "ovo"; + c.NickName = "绿拱门"; + c.PrimaryAttribute = PrimaryAttribute.AGI; + c.InitialATK = 22; + c.InitialHP = 65; + c.InitialMP = 22; + c.InitialSTR = 10; + c.STRGrowth = 1; + c.InitialAGI = 20; + c.AGIGrowth = 2; + c.InitialINT = 0; + c.INTGrowth = 0; + c.InitialSPD = 300; + c.InitialHR = 4; + c.InitialMR = 2; + return c; + } + } + + public static Character QuDuoduo + { + get + { + Character c = Factory.GetCharacter(); + c.Name = "Qu"; + c.FirstName = "Duoduo"; + c.NickName = "趣多多"; + c.PrimaryAttribute = PrimaryAttribute.STR; + c.InitialATK = 19; + c.InitialHP = 90; + c.InitialMP = 40; + c.InitialSTR = 13; + c.STRGrowth = 1.5; + c.InitialAGI = 13; + c.AGIGrowth = 1.2; + c.InitialINT = 4; + c.INTGrowth = 0.3; + c.InitialSPD = 300; + c.InitialHR = 4; + c.InitialMR = 2; + return c; + } + } + } +} diff --git a/Library/Effects/冰霜攻击特效.cs b/Library/Effects/冰霜攻击特效.cs new file mode 100644 index 0000000..f968ed1 --- /dev/null +++ b/Library/Effects/冰霜攻击特效.cs @@ -0,0 +1,39 @@ +using Milimoe.FunGame.Core.Api.Utility; +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Testing.Effects +{ + public class 冰霜攻击特效(Skill skill) : Effect(skill) + { + public override long Id => 1; + public override string Name => "冰霜攻击"; + public override string Description => $"对目标敌人造成 120%(+180%/Lv) + 250%智力 [ {Damage} ] 点元素魔法伤害。"; + public override bool TargetSelf => false; + public override int TargetCount => 1; + public override MagicType MagicType => MagicType.Element; + + private double Damage + { + get + { + double d = 0; + if (Skill.Character != null) + { + d = Calculation.Round2Digits(1.2 * (1 + 1.8 * (Skill.Level - 1)) * Skill.Character.ATK + (Skill.Character.INT * 2.5)); + } + return d; + } + } + + public override void OnSkillCasted(ActionQueue queue, Character actor, List enemys, List teammates, Dictionary others) + { + Character enemy = enemys[new Random().Next(enemys.Count)]; + double damageBase = Damage; + if (queue.CalculateMagicalDamage(actor, enemy, false, MagicType, damageBase, out double damage) != DamageResult.Evaded) + { + queue.DamageToEnemy(actor, enemy, damage, false, true, MagicType); + } + } + } +} diff --git a/Library/Effects/天赐之力特效.cs b/Library/Effects/天赐之力特效.cs new file mode 100644 index 0000000..fcd05f8 --- /dev/null +++ b/Library/Effects/天赐之力特效.cs @@ -0,0 +1,67 @@ +using Milimoe.FunGame.Core.Api.Utility; +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Testing.Effects +{ + public class 天赐之力特效(Skill skill) : Effect(skill) + { + public override long Id => 1; + public override string Name => "天赐之力"; + public override string Description => $"{Duration} 时间内,获得 25% 闪避率,普通攻击硬直时间额外减少 20%,基于 120%(+60%/Lv)核心属性 [ {伤害加成} ] 强化普通攻击的伤害。"; + public override bool TargetSelf => false; + public override int TargetCount => 1; + public override bool Durative => true; + public override double Duration => 40; + public override MagicType MagicType => MagicType.Element; + + private double 伤害加成 + { + get + { + double d = 0; + if (Skill.Character != null) + { + d = Calculation.Round2Digits(1.2 * (1 + 0.6 * (Skill.Level - 1)) * Skill.Character.PrimaryAttributeValue); + } + return d; + } + } + + public override void OnEffectGained(Character character) + { + character.ExEvadeRate += 0.25; + } + + public override void OnEffectLost(Character character) + { + character.ExEvadeRate -= 0.25; + } + + public override bool AlterExpectedDamageBeforeCalculation(Character character, Character enemy, double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, out double newDamage) + { + newDamage = damage; + if (isNormalAttack) + { + newDamage = Calculation.Round2Digits(damage + 伤害加成); + } + return true; + } + + public override bool AlterHardnessTimeAfterNormalAttack(Character character, double baseHardnessTime, out double newHardnessTime) + { + newHardnessTime = Calculation.Round2Digits(baseHardnessTime * 0.8); + return true; + } + + public override void OnSkillCasted(ActionQueue queue, Character actor, List enemys, List teammates, Dictionary others) + { + if (!actor.Effects.ContainsKey(Name)) + { + actor.Effects.Add(Name, this); + RemainDuration = Duration; + OnEffectGained(actor); + } + } + } +} diff --git a/Library/Main.cs b/Library/Main.cs index 2490795..cbf2d15 100644 --- a/Library/Main.cs +++ b/Library/Main.cs @@ -3,7 +3,7 @@ using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Common.Addon; using Milimoe.FunGame.Core.Library.Common.Event; using Milimoe.FunGame.Core.Library.Constant; -using Milimoe.FunGame.Testing.Solutions; +using Milimoe.FunGame.Testing.Skills; PluginLoader plugins = PluginLoader.LoadPlugins([]); foreach (string plugin in plugins.Plugins.Keys) @@ -67,34 +67,65 @@ if (list.Count > 3) Character character2 = list[1].Copy(); Character character3 = list[2].Copy(); Character character4 = list[3].Copy(); + Character character5 = list[4].Copy(); + Character character6 = list[5].Copy(); + Character character7 = list[6].Copy(); + Character character8 = list[7].Copy(); + Character character9 = list[8].Copy(); + Character character10 = list[9].Copy(); + Character character11 = list[10].Copy(); + Character character12 = list[11].Copy(); - ActionQueue actionQueue = new(); - List characters = [character1, character2, character3, character4]; + List characters = [ + character1, character2, character3, character4, + character5, character6, character7, character8, + character9, character10, character11, character12 + ]; - // 初始顺序表排序 - actionQueue.CalculateInitialOrder(characters); + // 升级和赋能 + for (int index = 0; index < characters.Count; index++) + { + characters[index].Level = 60; + characters[index].Skills.Add("冰霜攻击", new 冰霜攻击(characters[index])); + characters[index].Skills["冰霜攻击"].Level += 8; + characters[index].Skills.Add("天赐之力", new 天赐之力(characters[index])); + characters[index].Skills["天赐之力"].Level += 6; + } + + // 显示角色信息 + characters.ForEach(c => Console.WriteLine(c.GetInfo())); + + // 创建顺序表并排序 + ActionQueue actionQueue = new(characters, Console.WriteLine); Console.WriteLine(); // 显示初始顺序表 actionQueue.DisplayQueue(); Console.WriteLine(); - // 模拟时间流逝 + // 总回合数 int i = 1; - while (i < 10) + while (i < 999) { // 检查是否有角色可以行动 Character? characterToAct = actionQueue.NextCharacter(); if (characterToAct != null) { Console.WriteLine($"=== Round {i++} ==="); - actionQueue.ProcessTurn(characterToAct); + Console.WriteLine("现在是 [ " + characterToAct + " ] 的回合!"); + + bool isGameEnd = actionQueue.ProcessTurn(characterToAct); + if (isGameEnd) + { + break; + } + actionQueue.DisplayQueue(); Console.WriteLine(); } - //Thread.Sleep(1); // 模拟时间流逝 - actionQueue.ReduceHardnessTimes(); + // 模拟时间流逝 + actionQueue.TimeLapse(); } Console.WriteLine("--- End ---"); diff --git a/Library/Skills/冰霜攻击.cs b/Library/Skills/冰霜攻击.cs new file mode 100644 index 0000000..2966b25 --- /dev/null +++ b/Library/Skills/冰霜攻击.cs @@ -0,0 +1,22 @@ +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Testing.Effects; + +namespace Milimoe.FunGame.Testing.Skills +{ + public class 冰霜攻击 : Skill + { + public override long Id => 1; + public override string Name => "冰霜攻击"; + public override string Description => Effects.Count > 0 ? Effects.Values.First().Description : ""; + public override double MPCost => BaseMPCost + (50 * (Level - 1)); + public override double CD => 20; + public override double CastTime => 6; + public override double HardnessTime => 3; + protected override double BaseMPCost => 30; + + public 冰霜攻击(Character character) : base(true, true, character) + { + Effects.Add("e1", new 冰霜攻击特效(this)); + } + } +} diff --git a/Library/Skills/天赐之力.cs b/Library/Skills/天赐之力.cs new file mode 100644 index 0000000..7b8702b --- /dev/null +++ b/Library/Skills/天赐之力.cs @@ -0,0 +1,20 @@ +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Testing.Effects; + +namespace Milimoe.FunGame.Testing.Skills +{ + public class 天赐之力 : Skill + { + public override long Id => 1; + public override string Name => "天赐之力"; + public override string Description => Effects.Count > 0 ? Effects.Values.First().Description : ""; + public override double EPCost => 100; + public override double CD => 60; + public override double HardnessTime => 15; + + public 天赐之力(Character character) : base(true, character) + { + Effects.Add("e1", new 天赐之力特效(this)); + } + } +} diff --git a/Library/Solutions/ActionQueue.cs b/Library/Solutions/ActionQueue.cs deleted file mode 100644 index 9dc3a19..0000000 --- a/Library/Solutions/ActionQueue.cs +++ /dev/null @@ -1,157 +0,0 @@ -using Milimoe.FunGame.Core.Entity; - -namespace Milimoe.FunGame.Testing.Solutions; - -public class ActionQueue -{ - private readonly List _Queue = []; - private readonly Dictionary _HardnessTimes = []; - - public void AddCharacter(Character character, double hardnessTime) - { - // 插队机制:按硬直时间排序 - int insertIndex = _Queue.FindIndex(c => _HardnessTimes[c] > hardnessTime); - if (insertIndex == -1) - { - _Queue.Add(character); - } - else - { - _Queue.Insert(insertIndex, character); - } - _HardnessTimes[character] = hardnessTime; - } - - public void CalculateInitialOrder(List characters) - { - // 排序时,时间会流逝 - int nowTime = 1; - - // 初始排序:按速度排序 - List> groupedBySpeed = [.. characters - .GroupBy(c => c.SPD) - .OrderByDescending(g => g.Key)]; - - Random random = new(); - - foreach (IGrouping group in groupedBySpeed) - { - if (group.Count() == 1) - { - // 如果只有一个角色,直接加入队列 - AddCharacter(group.First(), _Queue.Count + nowTime); - } - else - { - // 如果有多个角色,进行先行决定 - List sortedList = [.. group]; - - while (sortedList.Count > 0) - { - Character? selectedCharacter = null; - bool decided = false; - if (sortedList.Count == 1) - { - selectedCharacter = sortedList[0]; - decided = true; - } - - while (!decided) - { - // 每个角色进行两次随机数抽取 - var randomNumbers = sortedList.Select(c => new - { - Character = c, - FirstRoll = random.Next(1, 21), - SecondRoll = random.Next(1, 21) - }).ToList(); - - randomNumbers.ForEach(a => Console.WriteLine(a.Character.Name + ": " + a.FirstRoll + " / " + a.SecondRoll)); - - nowTime++; - - // 找到两次都大于其他角色的角色 - int maxFirstRoll = randomNumbers.Max(r => r.FirstRoll); - int maxSecondRoll = randomNumbers.Max(r => r.SecondRoll); - - var candidates = randomNumbers - .Where(r => r.FirstRoll == maxFirstRoll && r.SecondRoll == maxSecondRoll) - .ToList(); - - if (candidates.Count == 1) - { - selectedCharacter = candidates.First().Character; - decided = true; - } - } - - // 将决定好的角色加入顺序表 - if (selectedCharacter != null) - { - AddCharacter(selectedCharacter, _Queue.Count + nowTime); - Console.WriteLine("decided: " + selectedCharacter.Name + "\r\n"); - sortedList.Remove(selectedCharacter); - } - } - } - } - } - - public Character? NextCharacter() - { - if (_Queue.Count == 0) return null; - - // 硬直时间为0的角色将执行行动 - Character? character = _Queue.FirstOrDefault(c => _HardnessTimes[c] == 0); - if (character != null) - { - _Queue.Remove(character); - return character; - } - - return null; - } - - public void ProcessTurn(Character character) - { - double baseTime = 15; // 假设基础硬直时间为15 - if (character.Name == "A") - { - baseTime = 10; // A的硬直 - } - double newHardnessTime = Math.Round(baseTime * (1 - character.ActionCoefficient), 2, MidpointRounding.AwayFromZero); - - AddCharacter(character, newHardnessTime); - } - - public void ReduceHardnessTimes() - { - if (_Queue.Count == 0) return; - - // 获取第一个角色的硬直时间 - double timeToReduce = _HardnessTimes[_Queue[0]]; - - Console.WriteLine("Time Lapse: " + timeToReduce); - - // 减少所有角色的硬直时间 - foreach (Character character in _Queue) - { - _HardnessTimes[character] = Math.Round(_HardnessTimes[character] - timeToReduce, 2, MidpointRounding.AwayFromZero); - - // 回血回蓝 - double douHP = Math.Round(character.HR * timeToReduce, 2, MidpointRounding.AwayFromZero); - double douMP = Math.Round(character.MR * timeToReduce, 2, MidpointRounding.AwayFromZero); - Console.WriteLine("角色 " + character.Name + " 回血:" + douHP + " / " + "回蓝:" + douMP); - } - Console.WriteLine(); - } - - public void DisplayQueue() - { - Console.WriteLine("Current ActionQueue:"); - foreach (var character in _Queue) - { - Console.WriteLine($"{character.Name}: Hardness Time {_HardnessTimes[character]}"); - } - } -} \ No newline at end of file diff --git a/Library/Solutions/TestModule.cs b/Library/Solutions/TestModule.cs index 9b20b69..29c51bd 100644 --- a/Library/Solutions/TestModule.cs +++ b/Library/Solutions/TestModule.cs @@ -1,7 +1,6 @@ using Milimoe.FunGame.Core.Api.Utility; using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Common.Addon; -using Milimoe.FunGame.Core.Library.Constant; namespace Addons { @@ -51,7 +50,6 @@ namespace Addons List list = []; Skill s = Factory.GetSkill(); s.Name = "Example Skill"; - s.MagicType = MagicType.PurityNatural; list.Add(s); return list; } diff --git a/Library/Solutions/TestPlugin.cs b/Library/Solutions/TestPlugin.cs index 0e830dc..7873b42 100644 --- a/Library/Solutions/TestPlugin.cs +++ b/Library/Solutions/TestPlugin.cs @@ -1,9 +1,9 @@ -using Milimoe.FunGame.Core.Api.Utility; +using FunGame.Testing.Characters; +using Milimoe.FunGame.Core.Api.Utility; using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Interface; using Milimoe.FunGame.Core.Library.Common.Addon; using Milimoe.FunGame.Core.Library.Common.Event; -using Milimoe.FunGame.Core.Library.Constant; namespace Addons { @@ -19,60 +19,22 @@ namespace Addons protected override bool BeforeLoad() { - EntityModuleConfig config = new(ExampleGameModuleConstant.Example, ExampleGameModuleConstant.ExampleCharacter); - // 构建一个你想要的角色 - Character c = Factory.GetCharacter(); - c.Name = "Oshima"; - c.FirstName = "Shiya"; - c.NickName = "OSM"; - c.MagicType = MagicType.PurityNatural; - c.InitialHP = 30; - c.InitialSTR = 20; - c.InitialAGI = 10; - c.InitialINT = 5; - c.InitialATK = 100; - c.InitialDEF = 10; - c.InitialSPD = 250; - config.Add("OSM", c); - c = Factory.GetCharacter(); - c.Name = "A"; - c.FirstName = "测试1"; - c.NickName = "A"; - c.MagicType = MagicType.Particle; - c.InitialHP = 25; - c.InitialSTR = 15; - c.InitialAGI = 5; - c.InitialINT = 10; - c.InitialATK = 80; - c.InitialDEF = 15; - c.InitialSPD = 290; - config.Add("A", c); - c = Factory.GetCharacter(); - c.Name = "B"; - c.FirstName = "测试2"; - c.NickName = "B"; - c.MagicType = MagicType.Fleabane; - c.InitialHP = 355; - c.InitialSTR = 5; - c.InitialAGI = 5; - c.InitialINT = 25; - c.InitialATK = 75; - c.InitialDEF = 20; - c.InitialSPD = 320; - config.Add("B", c); - c = Factory.GetCharacter(); - c.Name = "C"; - c.FirstName = "测试3"; - c.NickName = "B的复制人"; - c.MagicType = MagicType.Fleabane; - c.InitialHP = 355; - c.InitialSTR = 5; - c.InitialAGI = 5; - c.InitialINT = 25; - c.InitialATK = 75; - c.InitialDEF = 20; - c.InitialSPD = 320; - config.Add("C", c); + EntityModuleConfig config = new(ExampleGameModuleConstant.Example, ExampleGameModuleConstant.ExampleCharacter) + { + { "Oshima", Characters.Oshima }, + { "Xinyin", Characters.Xinyin }, + { "Yang", Characters.Yang }, + { "NanGanyu", Characters.NanGanyu }, + { "NiuNan", Characters.NiuNan }, + { "Mayor", Characters.Mayor }, + { "马猴烧酒", Characters.马猴烧酒 }, + { "QingXiang", Characters.QingXiang }, + { "QWQAQW", Characters.QWQAQW }, + { "ColdBlue", Characters.ColdBlue }, + { "绿拱门", Characters.绿拱门 }, + { "QuDuoduo", Characters.QuDuoduo } + }; + config.SaveConfig(); PluginConfig config2 = new(Name, "config") { From 4ed2c0127adfa4f263136921fb337ad035bc63be Mon Sep 17 00:00:00 2001 From: milimoe Date: Mon, 9 Sep 2024 01:42:58 +0800 Subject: [PATCH 04/15] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=96=B0=E7=9A=84?= =?UTF-8?q?=E6=8A=80=E8=83=BD=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Library/Effects/冰霜攻击特效.cs | 6 +++--- Library/Effects/大岛特性特效.cs | 30 ++++++++++++++++++++++++++++++ Library/Effects/天赐之力特效.cs | 8 ++++---- Library/Main.cs | 23 ++++++++++++++++++----- Library/Skills/冰霜攻击.cs | 4 ++-- Library/Skills/大岛特性.cs | 22 ++++++++++++++++++++++ Library/Skills/天赐之力.cs | 4 ++-- 7 files changed, 81 insertions(+), 16 deletions(-) create mode 100644 Library/Effects/大岛特性特效.cs create mode 100644 Library/Skills/大岛特性.cs diff --git a/Library/Effects/冰霜攻击特效.cs b/Library/Effects/冰霜攻击特效.cs index f968ed1..0fdeb53 100644 --- a/Library/Effects/冰霜攻击特效.cs +++ b/Library/Effects/冰霜攻击特效.cs @@ -8,10 +8,10 @@ namespace Milimoe.FunGame.Testing.Effects { public override long Id => 1; public override string Name => "冰霜攻击"; - public override string Description => $"对目标敌人造成 120%(+180%/Lv) + 250%智力 [ {Damage} ] 点元素魔法伤害。"; + public override string Description => $"对目标敌人造成 {Calculation.Round4Digits(1.2 * (1 + 1.8 * (Skill.Level - 1))) * 100}%智力 [ {Damage} ] 点{CharacterSet.GetMagicName(MagicType)}。"; public override bool TargetSelf => false; public override int TargetCount => 1; - public override MagicType MagicType => MagicType.Element; + public override MagicType MagicType => MagicType.None; private double Damage { @@ -20,7 +20,7 @@ namespace Milimoe.FunGame.Testing.Effects double d = 0; if (Skill.Character != null) { - d = Calculation.Round2Digits(1.2 * (1 + 1.8 * (Skill.Level - 1)) * Skill.Character.ATK + (Skill.Character.INT * 2.5)); + d = Calculation.Round2Digits(1.2 * (1 + 1.8 * (Skill.Level - 1)) * Skill.Character.INT); } return d; } diff --git a/Library/Effects/大岛特性特效.cs b/Library/Effects/大岛特性特效.cs new file mode 100644 index 0000000..1385815 --- /dev/null +++ b/Library/Effects/大岛特性特效.cs @@ -0,0 +1,30 @@ +using Milimoe.FunGame.Core.Api.Utility; +using Milimoe.FunGame.Core.Entity; + +namespace Milimoe.FunGame.Testing.Effects +{ + public class 大岛特性特效(Skill skill) : Effect(skill) + { + public override long Id => 1; + public override string Name => "大岛特性"; + public override string Description => $"META马专属被动:力量+5,力量成长+0.5;在受到伤害时,获得的能量提升50%,每回合开始还能获得额外的 [ {EP} ] 能量值。"; + public override bool TargetSelf => true; + public static double EP => 10; + + public override bool AlterEPAfterGetDamage(Character character, double baseEP, out double newEP) + { + newEP = Calculation.Round2Digits(baseEP * 1.5); + if (Skill.Character != null) Console.WriteLine("[ " + Skill.Character + " ] 发动了META马专属被动!本次获得了 " + newEP + " 能量!"); + return true; + } + + public override void OnTurnStart(Character character) + { + if (character.EP < 200) + { + character.EP += EP; + Console.WriteLine("[ " + character + " ] 发动了META马专属被动!本次获得了 " + EP + " 能量!"); + } + } + } +} diff --git a/Library/Effects/天赐之力特效.cs b/Library/Effects/天赐之力特效.cs index fcd05f8..2f3c800 100644 --- a/Library/Effects/天赐之力特效.cs +++ b/Library/Effects/天赐之力特效.cs @@ -8,7 +8,7 @@ namespace Milimoe.FunGame.Testing.Effects { public override long Id => 1; public override string Name => "天赐之力"; - public override string Description => $"{Duration} 时间内,获得 25% 闪避率,普通攻击硬直时间额外减少 20%,基于 120%(+60%/Lv)核心属性 [ {伤害加成} ] 强化普通攻击的伤害。"; + public override string Description => $"{Duration} 时间内,获得 25% 闪避率(不可叠加),普通攻击硬直时间额外减少 20%,基于 {Calculation.Round4Digits((1.2 + (1 + 0.6 * (Skill.Level - 1))) * 100)}% 核心属性 [ {伤害加成} ] 强化普通攻击的伤害。"; public override bool TargetSelf => false; public override int TargetCount => 1; public override bool Durative => true; @@ -56,10 +56,10 @@ namespace Milimoe.FunGame.Testing.Effects public override void OnSkillCasted(ActionQueue queue, Character actor, List enemys, List teammates, Dictionary others) { - if (!actor.Effects.ContainsKey(Name)) + RemainDuration = Duration; + if (!actor.Effects.Contains(this)) { - actor.Effects.Add(Name, this); - RemainDuration = Duration; + actor.Effects.Add(this); OnEffectGained(actor); } } diff --git a/Library/Main.cs b/Library/Main.cs index cbf2d15..29c8faa 100644 --- a/Library/Main.cs +++ b/Library/Main.cs @@ -85,11 +85,24 @@ if (list.Count > 3) // 升级和赋能 for (int index = 0; index < characters.Count; index++) { - characters[index].Level = 60; - characters[index].Skills.Add("冰霜攻击", new 冰霜攻击(characters[index])); - characters[index].Skills["冰霜攻击"].Level += 8; - characters[index].Skills.Add("天赐之力", new 天赐之力(characters[index])); - characters[index].Skills["天赐之力"].Level += 6; + Character c = characters[index]; + c.Level = 60; + c.NormalAttack.Level += 7; + + Skill 冰霜攻击 = new 冰霜攻击(c); + 冰霜攻击.Level += 8; + c.Skills.Add(冰霜攻击); + + if (c.ToString() == character1.ToString()) + { + Skill 大岛特性 = new 大岛特性(c); + 大岛特性.Level++; + c.Skills.Add(大岛特性); + } + + Skill 天赐之力 = new 天赐之力(c); + 天赐之力.Level += 6; + c.Skills.Add(天赐之力); } // 显示角色信息 diff --git a/Library/Skills/冰霜攻击.cs b/Library/Skills/冰霜攻击.cs index 2966b25..6c8ed4f 100644 --- a/Library/Skills/冰霜攻击.cs +++ b/Library/Skills/冰霜攻击.cs @@ -7,7 +7,7 @@ namespace Milimoe.FunGame.Testing.Skills { public override long Id => 1; public override string Name => "冰霜攻击"; - public override string Description => Effects.Count > 0 ? Effects.Values.First().Description : ""; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; public override double MPCost => BaseMPCost + (50 * (Level - 1)); public override double CD => 20; public override double CastTime => 6; @@ -16,7 +16,7 @@ namespace Milimoe.FunGame.Testing.Skills public 冰霜攻击(Character character) : base(true, true, character) { - Effects.Add("e1", new 冰霜攻击特效(this)); + Effects.Add(new 冰霜攻击特效(this)); } } } diff --git a/Library/Skills/大岛特性.cs b/Library/Skills/大岛特性.cs new file mode 100644 index 0000000..22d435e --- /dev/null +++ b/Library/Skills/大岛特性.cs @@ -0,0 +1,22 @@ +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Testing.Effects; + +namespace Milimoe.FunGame.Testing.Skills +{ + public class 大岛特性 : Skill + { + public override long Id => 1; + public override string Name => "大岛特性"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + + public 大岛特性(Character character) : base(false, false, character) + { + Effects.Add(new 大岛特性特效(this)); + } + + public override IEnumerable AddInactiveEffectToCharacter() + { + return Effects; + } + } +} diff --git a/Library/Skills/天赐之力.cs b/Library/Skills/天赐之力.cs index 7b8702b..9c41499 100644 --- a/Library/Skills/天赐之力.cs +++ b/Library/Skills/天赐之力.cs @@ -7,14 +7,14 @@ namespace Milimoe.FunGame.Testing.Skills { public override long Id => 1; public override string Name => "天赐之力"; - public override string Description => Effects.Count > 0 ? Effects.Values.First().Description : ""; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; public override double EPCost => 100; public override double CD => 60; public override double HardnessTime => 15; public 天赐之力(Character character) : base(true, character) { - Effects.Add("e1", new 天赐之力特效(this)); + Effects.Add(new 天赐之力特效(this)); } } } From 9673c1a1b210f8d07d1a2b348fb3535e11449bb8 Mon Sep 17 00:00:00 2001 From: milimoe Date: Tue, 10 Sep 2024 00:54:37 +0800 Subject: [PATCH 05/15] =?UTF-8?q?=E6=96=B0=E7=9A=84=E6=8A=80=E8=83=BD?= =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Library/Effects/冰霜攻击特效.cs | 7 ++- Library/Effects/天赐之力特效.cs | 5 +- Library/Effects/疾风步特效.cs | 85 +++++++++++++++++++++++++++++++++ Library/Main.cs | 16 +++++++ Library/Skills/冰霜攻击.cs | 2 +- Library/Skills/大岛特性.cs | 2 +- Library/Skills/天赐之力.cs | 2 +- Library/Skills/疾风步.cs | 20 ++++++++ 8 files changed, 129 insertions(+), 10 deletions(-) create mode 100644 Library/Effects/疾风步特效.cs create mode 100644 Library/Skills/疾风步.cs diff --git a/Library/Effects/冰霜攻击特效.cs b/Library/Effects/冰霜攻击特效.cs index 0fdeb53..5ae01ca 100644 --- a/Library/Effects/冰霜攻击特效.cs +++ b/Library/Effects/冰霜攻击特效.cs @@ -6,12 +6,11 @@ namespace Milimoe.FunGame.Testing.Effects { public class 冰霜攻击特效(Skill skill) : Effect(skill) { - public override long Id => 1; + public override long Id => Skill.Id; public override string Name => "冰霜攻击"; - public override string Description => $"对目标敌人造成 {Calculation.Round4Digits(1.2 * (1 + 1.8 * (Skill.Level - 1))) * 100}%智力 [ {Damage} ] 点{CharacterSet.GetMagicName(MagicType)}。"; + public override string Description => $"对目标敌人造成 {Calculation.Round2Digits(90 + 60 * (Skill.Level - 1))} + {Calculation.Round2Digits((1.2 + 1.8 * (Skill.Level - 1)) * 100)}%智力 [ {Damage} ] 点{CharacterSet.GetMagicName(MagicType)}。"; public override bool TargetSelf => false; public override int TargetCount => 1; - public override MagicType MagicType => MagicType.None; private double Damage { @@ -20,7 +19,7 @@ namespace Milimoe.FunGame.Testing.Effects double d = 0; if (Skill.Character != null) { - d = Calculation.Round2Digits(1.2 * (1 + 1.8 * (Skill.Level - 1)) * Skill.Character.INT); + d = Calculation.Round2Digits(90 + 60 * (Skill.Level - 1) + (1.2 + 1.8 * (Skill.Level - 1)) * Skill.Character.INT); } return d; } diff --git a/Library/Effects/天赐之力特效.cs b/Library/Effects/天赐之力特效.cs index 2f3c800..2e46a73 100644 --- a/Library/Effects/天赐之力特效.cs +++ b/Library/Effects/天赐之力特效.cs @@ -6,14 +6,13 @@ namespace Milimoe.FunGame.Testing.Effects { public class 天赐之力特效(Skill skill) : Effect(skill) { - public override long Id => 1; + public override long Id => Skill.Id; public override string Name => "天赐之力"; - public override string Description => $"{Duration} 时间内,获得 25% 闪避率(不可叠加),普通攻击硬直时间额外减少 20%,基于 {Calculation.Round4Digits((1.2 + (1 + 0.6 * (Skill.Level - 1))) * 100)}% 核心属性 [ {伤害加成} ] 强化普通攻击的伤害。"; + public override string Description => $"{Duration} 时间内,获得 25% 闪避率(不可叠加),普通攻击硬直时间额外减少 20%,基于 {Calculation.Round2Digits((1.2 + (1 + 0.6 * (Skill.Level - 1))) * 100)}% 核心属性 [ {伤害加成} ] 强化普通攻击的伤害。"; public override bool TargetSelf => false; public override int TargetCount => 1; public override bool Durative => true; public override double Duration => 40; - public override MagicType MagicType => MagicType.Element; private double 伤害加成 { diff --git a/Library/Effects/疾风步特效.cs b/Library/Effects/疾风步特效.cs new file mode 100644 index 0000000..a312856 --- /dev/null +++ b/Library/Effects/疾风步特效.cs @@ -0,0 +1,85 @@ +using Milimoe.FunGame.Core.Api.Utility; +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Testing.Effects +{ + public class 疾风步特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => "疾风步"; + public override string Description => $"进入不可选中状态,获得 100 行动速度,持续 {Duration} 时间。在持续时间内,首次造成伤害会附加 {Calculation.Round2Digits((1.5 + 1.5 * (Skill.Level - 1)) * 100)}% 敏捷 [ {伤害加成} ] 的强化伤害,并解除不可选中状态。剩余的持续时间内,提高 15% 闪避率和暴击率。"; + public override bool TargetSelf => true; + public override bool Durative => true; + public override double Duration => 15 + (2 * (Level - 1)); + + private double 伤害加成 + { + get + { + double d = 0; + if (Skill.Character != null) + { + d = Calculation.Round2Digits((1.5 + 1.5 * (Skill.Level - 1)) * Skill.Character.AGI); + } + return d; + } + } + private bool 首次伤害 { get; set; } = true; + private bool 破隐一击 { get; set; } = false; + + public override void OnEffectGained(Character character) + { + character.IsUnselectable = true; + Skill.IsInEffect = true; + character.ExSPD += 100; + } + + public override void OnEffectLost(Character character) + { + Skill.IsInEffect = false; + if (破隐一击) + { + character.ExEvadeRate -= 0.15; + character.ExCritRate -= 0.15; + } + else + { + character.IsUnselectable = false; + } + character.ExSPD -= 100; + } + + public override bool AlterActualDamageAfterCalculation(Character character, Character enemy, double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, bool isCritical, out double newDamage) + { + if (首次伤害) + { + 首次伤害 = false; + newDamage = Calculation.Round2Digits(damage + 伤害加成); + Console.WriteLine($"[ {character} ] 发动了 [ 疾风步 ] 的特效,获得了 [ {伤害加成} ] 点伤害加成!"); + 破隐一击 = true; + character.ExEvadeRate += 0.15; + character.ExCritRate += 0.15; + character.IsUnselectable = false; + return true; + } + else + { + newDamage = damage; + return true; + } + } + + public override void OnSkillCasted(ActionQueue queue, Character actor, List enemys, List teammates, Dictionary others) + { + if (!actor.Effects.Contains(this)) + { + 首次伤害 = true; + 破隐一击 = false; + RemainDuration = Duration; + actor.Effects.Add(this); + OnEffectGained(actor); + } + } + } +} diff --git a/Library/Main.cs b/Library/Main.cs index 29c8faa..534667c 100644 --- a/Library/Main.cs +++ b/Library/Main.cs @@ -57,6 +57,15 @@ foreach (string moduledll in moduledllsha512.Keys) } } +// M = 0, W = 7, P1 = 1, P3 = 1 +// M = 1, W = 6, P1 = 2, P3 = 0 +// M = 2, W = 4, P1 = 0, P3 = 2 +// M = 2, W = 5, P1 = 0, P3 = 0 +// M = 3, W = 3, P1 = 1, P3 = 1 +// M = 4, W = 2, P1 = 2, P3 = 0 +// M = 5, W = 0, P1 = 0, P3 = 2 +// M = 5, W = 1, P1 = 0, P3 = 0 + if (list.Count > 3) { Console.WriteLine(); @@ -100,6 +109,13 @@ if (list.Count > 3) c.Skills.Add(大岛特性); } + if (c.ToString() == character9.ToString()) + { + Skill 疾风步 = new 疾风步(c); + 疾风步.Level += 6; + c.Skills.Add(疾风步); + } + Skill 天赐之力 = new 天赐之力(c); 天赐之力.Level += 6; c.Skills.Add(天赐之力); diff --git a/Library/Skills/冰霜攻击.cs b/Library/Skills/冰霜攻击.cs index 6c8ed4f..a684833 100644 --- a/Library/Skills/冰霜攻击.cs +++ b/Library/Skills/冰霜攻击.cs @@ -5,7 +5,7 @@ namespace Milimoe.FunGame.Testing.Skills { public class 冰霜攻击 : Skill { - public override long Id => 1; + public override long Id => 2001; public override string Name => "冰霜攻击"; public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; public override double MPCost => BaseMPCost + (50 * (Level - 1)); diff --git a/Library/Skills/大岛特性.cs b/Library/Skills/大岛特性.cs index 22d435e..b482d82 100644 --- a/Library/Skills/大岛特性.cs +++ b/Library/Skills/大岛特性.cs @@ -5,7 +5,7 @@ namespace Milimoe.FunGame.Testing.Skills { public class 大岛特性 : Skill { - public override long Id => 1; + public override long Id => 5001; public override string Name => "大岛特性"; public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; diff --git a/Library/Skills/天赐之力.cs b/Library/Skills/天赐之力.cs index 9c41499..41e2fcd 100644 --- a/Library/Skills/天赐之力.cs +++ b/Library/Skills/天赐之力.cs @@ -5,7 +5,7 @@ namespace Milimoe.FunGame.Testing.Skills { public class 天赐之力 : Skill { - public override long Id => 1; + public override long Id => 3001; public override string Name => "天赐之力"; public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; public override double EPCost => 100; diff --git a/Library/Skills/疾风步.cs b/Library/Skills/疾风步.cs new file mode 100644 index 0000000..5fbd902 --- /dev/null +++ b/Library/Skills/疾风步.cs @@ -0,0 +1,20 @@ +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Testing.Effects; + +namespace Milimoe.FunGame.Testing.Skills +{ + public class 疾风步 : Skill + { + public override long Id => 4001; + public override string Name => "疾风步"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override double EPCost => 35; + public override double CD => 35; + public override double HardnessTime => 5; + + public 疾风步(Character character) : base(true, false, character) + { + Effects.Add(new 疾风步特效(this)); + } + } +} From d2938baf67f8bc9d4fba065bbe632751aaf59e21 Mon Sep 17 00:00:00 2001 From: milimoe Date: Tue, 10 Sep 2024 21:33:49 +0800 Subject: [PATCH 06/15] =?UTF-8?q?=E6=96=B0=E7=9A=84=E6=8A=80=E8=83=BD?= =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Library/Effects/大岛特性特效.cs | 30 ------- Library/Effects/眩晕.cs | 52 ++++++++++++ Library/Main.cs | 81 +++++++++++++++---- Library/Skills/Mayor/致命打击.cs | 35 ++++++++ Library/Skills/NanGanyu/法术操控.cs | 30 +++++++ Library/Skills/NiuNan/智慧与力量.cs | 30 +++++++ Library/Skills/Oshima/META马.cs | 47 +++++++++++ Library/Skills/Oshima/力量爆发.cs | 58 +++++++++++++ .../疾风步特效.cs => Skills/QWQAQW/疾风步.cs} | 56 +++++++------ .../XinYin/天赐之力.cs} | 40 +++++---- Library/Skills/XinYin/心灵之火.cs | 36 +++++++++ Library/Skills/Yang/魔法涌流.cs | 64 +++++++++++++++ Library/Skills/Yang/魔法震荡.cs | 50 ++++++++++++ Library/Skills/冰霜攻击.cs | 22 ----- Library/Skills/大岛特性.cs | 22 ----- Library/Skills/天赐之力.cs | 20 ----- Library/Skills/疾风步.cs | 20 ----- .../马猴烧酒/冰霜攻击.cs} | 29 +++++-- Library/Skills/马猴烧酒/毁灭之势.cs | 30 +++++++ 19 files changed, 578 insertions(+), 174 deletions(-) delete mode 100644 Library/Effects/大岛特性特效.cs create mode 100644 Library/Effects/眩晕.cs create mode 100644 Library/Skills/Mayor/致命打击.cs create mode 100644 Library/Skills/NanGanyu/法术操控.cs create mode 100644 Library/Skills/NiuNan/智慧与力量.cs create mode 100644 Library/Skills/Oshima/META马.cs create mode 100644 Library/Skills/Oshima/力量爆发.cs rename Library/{Effects/疾风步特效.cs => Skills/QWQAQW/疾风步.cs} (51%) rename Library/{Effects/天赐之力特效.cs => Skills/XinYin/天赐之力.cs} (52%) create mode 100644 Library/Skills/XinYin/心灵之火.cs create mode 100644 Library/Skills/Yang/魔法涌流.cs create mode 100644 Library/Skills/Yang/魔法震荡.cs delete mode 100644 Library/Skills/冰霜攻击.cs delete mode 100644 Library/Skills/大岛特性.cs delete mode 100644 Library/Skills/天赐之力.cs delete mode 100644 Library/Skills/疾风步.cs rename Library/{Effects/冰霜攻击特效.cs => Skills/马猴烧酒/冰霜攻击.cs} (54%) create mode 100644 Library/Skills/马猴烧酒/毁灭之势.cs diff --git a/Library/Effects/大岛特性特效.cs b/Library/Effects/大岛特性特效.cs deleted file mode 100644 index 1385815..0000000 --- a/Library/Effects/大岛特性特效.cs +++ /dev/null @@ -1,30 +0,0 @@ -using Milimoe.FunGame.Core.Api.Utility; -using Milimoe.FunGame.Core.Entity; - -namespace Milimoe.FunGame.Testing.Effects -{ - public class 大岛特性特效(Skill skill) : Effect(skill) - { - public override long Id => 1; - public override string Name => "大岛特性"; - public override string Description => $"META马专属被动:力量+5,力量成长+0.5;在受到伤害时,获得的能量提升50%,每回合开始还能获得额外的 [ {EP} ] 能量值。"; - public override bool TargetSelf => true; - public static double EP => 10; - - public override bool AlterEPAfterGetDamage(Character character, double baseEP, out double newEP) - { - newEP = Calculation.Round2Digits(baseEP * 1.5); - if (Skill.Character != null) Console.WriteLine("[ " + Skill.Character + " ] 发动了META马专属被动!本次获得了 " + newEP + " 能量!"); - return true; - } - - public override void OnTurnStart(Character character) - { - if (character.EP < 200) - { - character.EP += EP; - Console.WriteLine("[ " + character + " ] 发动了META马专属被动!本次获得了 " + EP + " 能量!"); - } - } - } -} diff --git a/Library/Effects/眩晕.cs b/Library/Effects/眩晕.cs new file mode 100644 index 0000000..06aeee0 --- /dev/null +++ b/Library/Effects/眩晕.cs @@ -0,0 +1,52 @@ +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Testing.Effects +{ + public class 眩晕 : Effect + { + public override long Id => 4101; + public override string Name => "眩晕"; + public override string Description => $"此角色被眩晕了,不能行动。来自:[ " + _sourceCharacter + " ] 的 [ " + Skill.Name + " ]"; + public override EffectControlType ControlType => EffectControlType.Stun; + public override bool TargetSelf => true; + public override Character Source => _sourceCharacter; + public override bool Durative => _durative; + public override double Duration => _duration; + public override int DurationTurn => _durationTurn; + + private readonly Character _sourceCharacter; + private readonly bool _durative; + private readonly double _duration; + private readonly int _durationTurn; + + public 眩晕(Skill skill, Character sourceCharacter, bool durative = false, double duration = 0, int durationTurn = 1) : base(skill) + { + ActionQueue = skill.ActionQueue; + _sourceCharacter = sourceCharacter; + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + } + + public override void OnEffectGained(Character character) + { + if (_durative) RemainDuration = Duration; + else RemainDurationTurn = DurationTurn; + character.CharacterEffectStates.Add(this, CharacterState.NotActionable); + character.UpdateCharacterState(); + InterruptCasting(character, Source); + } + + public override void OnEffectLost(Character character) + { + character.CharacterEffectStates.Remove(this); + character.UpdateCharacterState(); + } + + public override void OnTurnStart(Character character) + { + + } + } +} diff --git a/Library/Main.cs b/Library/Main.cs index 534667c..ee22d0c 100644 --- a/Library/Main.cs +++ b/Library/Main.cs @@ -91,34 +91,85 @@ if (list.Count > 3) character9, character10, character11, character12 ]; + int clevel = 60; + int slevel = 6; + int mlevel = 8; + // 升级和赋能 for (int index = 0; index < characters.Count; index++) { Character c = characters[index]; - c.Level = 60; - c.NormalAttack.Level += 7; + c.Level = clevel; + c.NormalAttack.Level = mlevel; - Skill 冰霜攻击 = new 冰霜攻击(c); - 冰霜攻击.Level += 8; + Skill 冰霜攻击 = new 冰霜攻击(c) + { + Level = mlevel + }; c.Skills.Add(冰霜攻击); - if (c.ToString() == character1.ToString()) + if (c == character1) { - Skill 大岛特性 = new 大岛特性(c); - 大岛特性.Level++; - c.Skills.Add(大岛特性); + Skill META马 = new META马(c) + { + Level = 1 + }; + c.Skills.Add(META马); + + Skill 力量爆发 = new 力量爆发(c) + { + Level = mlevel + }; + c.Skills.Add(力量爆发); } - if (c.ToString() == character9.ToString()) + if (c == character2) { - Skill 疾风步 = new 疾风步(c); - 疾风步.Level += 6; + Skill 心灵之火 = new 心灵之火(c) + { + Level = 1 + }; + c.Skills.Add(心灵之火); + + Skill 天赐之力 = new 天赐之力(c) + { + Level = slevel + }; + c.Skills.Add(天赐之力); + } + + if (c== character3) + { + Skill 魔法震荡 = new 魔法震荡(c) + { + Level = 1 + }; + c.Skills.Add(魔法震荡); + + Skill 魔法涌流 = new 魔法涌流(c) + { + Level = slevel + }; + c.Skills.Add(魔法涌流); + } + + if (c == character9) + { + Skill 疾风步 = new 疾风步(c) + { + Level = slevel + }; c.Skills.Add(疾风步); } - Skill 天赐之力 = new 天赐之力(c); - 天赐之力.Level += 6; - c.Skills.Add(天赐之力); + if (c != character1 && c != character2 && c != character3) + { + Skill 天赐之力 = new 天赐之力(c) + { + Level = slevel + }; + c.Skills.Add(天赐之力); + } } // 显示角色信息 @@ -138,6 +189,8 @@ if (list.Count > 3) { // 检查是否有角色可以行动 Character? characterToAct = actionQueue.NextCharacter(); + + // 处理回合 if (characterToAct != null) { Console.WriteLine($"=== Round {i++} ==="); diff --git a/Library/Skills/Mayor/致命打击.cs b/Library/Skills/Mayor/致命打击.cs new file mode 100644 index 0000000..1f5f609 --- /dev/null +++ b/Library/Skills/Mayor/致命打击.cs @@ -0,0 +1,35 @@ +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Testing.Skills +{ + public class 致命打击 : Skill + { + public override long Id => 4006; + public override string Name => "致命打击"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + + public 致命打击(Character character) : base(SkillType.Passive, character) + { + Effects.Add(new 致命打击特效(this)); + } + + public override IEnumerable AddInactiveEffectToCharacter() + { + return Effects; + } + } + + public class 致命打击特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"暴击伤害提升 30%。"; + public override bool TargetSelf => true; + + public override void OnEffectGained(Character character) + { + character.ExCritDMG += 0.3; + } + } +} diff --git a/Library/Skills/NanGanyu/法术操控.cs b/Library/Skills/NanGanyu/法术操控.cs new file mode 100644 index 0000000..95d3057 --- /dev/null +++ b/Library/Skills/NanGanyu/法术操控.cs @@ -0,0 +1,30 @@ +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Testing.Skills +{ + public class 法术操控 : Skill + { + public override long Id => 4004; + public override string Name => "法术操控"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + + public 法术操控(Character character) : base(SkillType.Passive, character) + { + Effects.Add(new 法术操控特效(this)); + } + + public override IEnumerable AddInactiveEffectToCharacter() + { + return Effects; + } + } + + public class 法术操控特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"每释放两次魔法才会触发硬直时间,且魔法命中时基于智力获得额外能量值。"; + public override bool TargetSelf => true; + } +} diff --git a/Library/Skills/NiuNan/智慧与力量.cs b/Library/Skills/NiuNan/智慧与力量.cs new file mode 100644 index 0000000..6d1eae8 --- /dev/null +++ b/Library/Skills/NiuNan/智慧与力量.cs @@ -0,0 +1,30 @@ +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Testing.Skills +{ + public class 智慧与力量 : Skill + { + public override long Id => 4005; + public override string Name => "智慧与力量"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + + public 智慧与力量(Character character) : base(SkillType.Passive, character) + { + Effects.Add(new 智慧与力量特效(this)); + } + + public override IEnumerable AddInactiveEffectToCharacter() + { + return Effects; + } + } + + public class 智慧与力量特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"当生命值低于 30% 时,智力转化为力量;当生命值高于或等于 30% 时,力量转化为智力。"; + public override bool TargetSelf => true; + } +} diff --git a/Library/Skills/Oshima/META马.cs b/Library/Skills/Oshima/META马.cs new file mode 100644 index 0000000..27560fa --- /dev/null +++ b/Library/Skills/Oshima/META马.cs @@ -0,0 +1,47 @@ +using Milimoe.FunGame.Core.Api.Utility; +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Testing.Skills +{ + public class META马 : Skill + { + public override long Id => 4001; + public override string Name => "META马"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + + public META马(Character character) : base(SkillType.Passive, character) + { + Effects.Add(new META马特效(this)); + } + + public override IEnumerable AddInactiveEffectToCharacter() + { + return Effects; + } + } + + public class META马特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"META马专属被动:力量+5,力量成长+0.5;在受到伤害时,获得的能量提升50%,每回合开始还能获得额外的 [ {EP} ] 能量值。"; + public override bool TargetSelf => true; + public static double EP => 10; + + public override void AlterEPAfterGetDamage(Character character, ref double baseEP) + { + baseEP = Calculation.Round2Digits(baseEP * 1.5); + if (Skill.Character != null) WriteLine("[ " + Skill.Character + " ] 发动了META马专属被动!本次获得了 " + baseEP + " 能量!"); + } + + public override void OnTurnStart(Character character) + { + if (character.EP < 200) + { + character.EP += EP; + WriteLine("[ " + character + " ] 发动了META马专属被动!本次获得了 " + EP + " 能量!"); + } + } + } +} diff --git a/Library/Skills/Oshima/力量爆发.cs b/Library/Skills/Oshima/力量爆发.cs new file mode 100644 index 0000000..9792e71 --- /dev/null +++ b/Library/Skills/Oshima/力量爆发.cs @@ -0,0 +1,58 @@ +using Milimoe.FunGame.Core.Api.Utility; +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Testing.Skills +{ + public class 力量爆发 : Skill + { + public override long Id => 3002; + public override string Name => "力量爆发"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override double EPCost => 100; + public override double CD => 55; + public override double HardnessTime => 0; + + public 力量爆发(Character character) : base(SkillType.SuperSkill, character) + { + Effects.Add(new 力量爆发特效(this)); + } + } + + public class 力量爆发特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => "力量爆发"; + public override string Description => $"获得 150% 力量 [ {攻击力加成} ] 的攻击力加成,持续 {Duration} 秒,清除硬直时间。"; + public override bool TargetSelf => true; + public override bool Durative => true; + public override double Duration => 10 + 1 * (Level - 1); + + private double 攻击力加成 => Calculation.Round2Digits(Skill.Character?.STR * 1.5 ?? 0); // 300% 攻击力加成 + private double 实际攻击力加成 = 0; + + public override void OnEffectGained(Character character) + { + 实际攻击力加成 = 攻击力加成; + character.ExATK2 += 实际攻击力加成; + WriteLine($"[ {character} ] 的攻击力增加了 [ {实际攻击力加成} ] !"); + } + + public override void OnEffectLost(Character character) + { + // 恢复到原始攻击力 + character.ExATK2 -= 实际攻击力加成; + } + + public override void OnSkillCasted(Character actor, List enemys, List teammates, Dictionary others) + { + RemainDuration = Duration; + if (!actor.Effects.Contains(this)) + { + 实际攻击力加成 = 0; + actor.Effects.Add(this); + OnEffectGained(actor); + } + } + } +} diff --git a/Library/Effects/疾风步特效.cs b/Library/Skills/QWQAQW/疾风步.cs similarity index 51% rename from Library/Effects/疾风步特效.cs rename to Library/Skills/QWQAQW/疾风步.cs index a312856..b8b22c0 100644 --- a/Library/Effects/疾风步特效.cs +++ b/Library/Skills/QWQAQW/疾风步.cs @@ -2,13 +2,28 @@ using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Constant; -namespace Milimoe.FunGame.Testing.Effects +namespace Milimoe.FunGame.Testing.Skills { + public class 疾风步 : Skill + { + public override long Id => 2001; + public override string Name => "疾风步"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override double EPCost => 35; + public override double CD => 35; + public override double HardnessTime => 5; + + public 疾风步(Character character) : base(SkillType.Skill, character) + { + Effects.Add(new 疾风步特效(this)); + } + } + public class 疾风步特效(Skill skill) : Effect(skill) { public override long Id => Skill.Id; - public override string Name => "疾风步"; - public override string Description => $"进入不可选中状态,获得 100 行动速度,持续 {Duration} 时间。在持续时间内,首次造成伤害会附加 {Calculation.Round2Digits((1.5 + 1.5 * (Skill.Level - 1)) * 100)}% 敏捷 [ {伤害加成} ] 的强化伤害,并解除不可选中状态。剩余的持续时间内,提高 15% 闪避率和暴击率。"; + public override string Name => Skill.Name; + public override string Description => $"进入不可选中状态,获得 100 行动速度,提高 15% 闪避率和 15% 暴击率,持续 {Duration} 时间。破隐一击:在持续时间内,首次造成伤害会附加 {Calculation.Round2Digits((1.5 + 1.5 * (Skill.Level - 1)) * 100)}% 敏捷 [ {伤害加成} ] 的强化伤害,并解除不可选中状态。"; public override bool TargetSelf => true; public override bool Durative => true; public override double Duration => 15 + (2 * (Level - 1)); @@ -30,47 +45,40 @@ namespace Milimoe.FunGame.Testing.Effects public override void OnEffectGained(Character character) { - character.IsUnselectable = true; Skill.IsInEffect = true; + character.IsUnselectable = true; character.ExSPD += 100; + character.ExEvadeRate += 0.15; + character.ExCritRate += 0.15; } - + public override void OnEffectLost(Character character) { Skill.IsInEffect = false; - if (破隐一击) - { - character.ExEvadeRate -= 0.15; - character.ExCritRate -= 0.15; - } - else + if (!破隐一击) { + // 在没有打出破隐一击的情况下,恢复角色状态 character.IsUnselectable = false; } character.ExSPD -= 100; + character.ExEvadeRate -= 0.15; + character.ExCritRate -= 0.15; } - public override bool AlterActualDamageAfterCalculation(Character character, Character enemy, double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, bool isCritical, out double newDamage) + public override void AlterActualDamageAfterCalculation(Character character, Character enemy, ref double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, bool isCritical) { - if (首次伤害) + if (character == Skill.Character && 首次伤害) { 首次伤害 = false; - newDamage = Calculation.Round2Digits(damage + 伤害加成); - Console.WriteLine($"[ {character} ] 发动了 [ 疾风步 ] 的特效,获得了 [ {伤害加成} ] 点伤害加成!"); 破隐一击 = true; - character.ExEvadeRate += 0.15; - character.ExCritRate += 0.15; character.IsUnselectable = false; - return true; - } - else - { - newDamage = damage; - return true; + double d = 伤害加成; + damage = Calculation.Round2Digits(damage + d); + WriteLine($"[ {character} ] 触发了疾风步破隐一击,获得了 [ {d} ] 点伤害加成!"); } } - public override void OnSkillCasted(ActionQueue queue, Character actor, List enemys, List teammates, Dictionary others) + public override void OnSkillCasted(Character actor, List enemys, List teammates, Dictionary others) { if (!actor.Effects.Contains(this)) { diff --git a/Library/Effects/天赐之力特效.cs b/Library/Skills/XinYin/天赐之力.cs similarity index 52% rename from Library/Effects/天赐之力特效.cs rename to Library/Skills/XinYin/天赐之力.cs index 2e46a73..a35f36f 100644 --- a/Library/Effects/天赐之力特效.cs +++ b/Library/Skills/XinYin/天赐之力.cs @@ -2,13 +2,28 @@ using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Constant; -namespace Milimoe.FunGame.Testing.Effects +namespace Milimoe.FunGame.Testing.Skills { + public class 天赐之力 : Skill + { + public override long Id => 3001; + public override string Name => "天赐之力"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override double EPCost => 100; + public override double CD => 60; + public override double HardnessTime => 15; + + public 天赐之力(Character character) : base(SkillType.SuperSkill, character) + { + Effects.Add(new 天赐之力特效(this)); + } + } + public class 天赐之力特效(Skill skill) : Effect(skill) { public override long Id => Skill.Id; - public override string Name => "天赐之力"; - public override string Description => $"{Duration} 时间内,获得 25% 闪避率(不可叠加),普通攻击硬直时间额外减少 20%,基于 {Calculation.Round2Digits((1.2 + (1 + 0.6 * (Skill.Level - 1))) * 100)}% 核心属性 [ {伤害加成} ] 强化普通攻击的伤害。"; + public override string Name => Skill.Name; + public override string Description => $"{Duration} 时间内,获得 25% 闪避率(不可叠加),普通攻击硬直时间额外减少 20%,基于 {Calculation.Round2Digits((1.2 + (1 + 0.6 * (Skill.Level - 1))) * 100)}% 敏捷 [ {伤害加成} ] 强化普通攻击的伤害。"; public override bool TargetSelf => false; public override int TargetCount => 1; public override bool Durative => true; @@ -21,7 +36,7 @@ namespace Milimoe.FunGame.Testing.Effects double d = 0; if (Skill.Character != null) { - d = Calculation.Round2Digits(1.2 * (1 + 0.6 * (Skill.Level - 1)) * Skill.Character.PrimaryAttributeValue); + d = Calculation.Round2Digits(1.2 * (1 + 0.6 * (Skill.Level - 1)) * Skill.Character.AGI); } return d; } @@ -31,29 +46,26 @@ namespace Milimoe.FunGame.Testing.Effects { character.ExEvadeRate += 0.25; } - + public override void OnEffectLost(Character character) { character.ExEvadeRate -= 0.25; } - public override bool AlterExpectedDamageBeforeCalculation(Character character, Character enemy, double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, out double newDamage) + public override void AlterExpectedDamageBeforeCalculation(Character character, Character enemy, ref double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType) { - newDamage = damage; - if (isNormalAttack) + if (character == Skill.Character && isNormalAttack) { - newDamage = Calculation.Round2Digits(damage + 伤害加成); + damage = Calculation.Round2Digits(damage + 伤害加成); } - return true; } - public override bool AlterHardnessTimeAfterNormalAttack(Character character, double baseHardnessTime, out double newHardnessTime) + public override void AlterHardnessTimeAfterNormalAttack(Character character, ref double baseHardnessTime) { - newHardnessTime = Calculation.Round2Digits(baseHardnessTime * 0.8); - return true; + baseHardnessTime = Calculation.Round2Digits(baseHardnessTime * 0.8); } - public override void OnSkillCasted(ActionQueue queue, Character actor, List enemys, List teammates, Dictionary others) + public override void OnSkillCasted(Character actor, List enemys, List teammates, Dictionary others) { RemainDuration = Duration; if (!actor.Effects.Contains(this)) diff --git a/Library/Skills/XinYin/心灵之火.cs b/Library/Skills/XinYin/心灵之火.cs new file mode 100644 index 0000000..c57b457 --- /dev/null +++ b/Library/Skills/XinYin/心灵之火.cs @@ -0,0 +1,36 @@ +using Milimoe.FunGame.Core.Api.Utility; +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Testing.Skills +{ + public class 心灵之火 : Skill + { + public override long Id => 4002; + public override string Name => "心灵之火"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + + public 心灵之火(Character character) : base(SkillType.Passive, character) + { + Effects.Add(new 心灵之火特效(this)); + } + + public override IEnumerable AddInactiveEffectToCharacter() + { + return Effects; + } + } + + public class 心灵之火特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"普通攻击硬直时间减少 20%。"; + public override bool TargetSelf => true; + + public override void AlterHardnessTimeAfterNormalAttack(Character character, ref double baseHardnessTime) + { + baseHardnessTime = Calculation.Round2Digits(baseHardnessTime * 0.8); + } + } +} diff --git a/Library/Skills/Yang/魔法涌流.cs b/Library/Skills/Yang/魔法涌流.cs new file mode 100644 index 0000000..0181b23 --- /dev/null +++ b/Library/Skills/Yang/魔法涌流.cs @@ -0,0 +1,64 @@ +using Milimoe.FunGame.Core.Api.Utility; +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Testing.Skills +{ + public class 魔法涌流 : Skill + { + public override long Id => 3003; + public override string Name => "魔法涌流"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override double EPCost => 100; + public override double CD => 65; + public override double HardnessTime => 10; + + public 魔法涌流(Character character) : base(SkillType.SuperSkill, character) + { + Effects.Add(new 魔法涌流特效(this)); + } + } + + public class 魔法涌流特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => "魔法涌流"; + public override string Description => $"{Duration} 秒内,增加所有伤害的20%伤害减免,并将普通攻击转为魔法伤害,可叠加魔法震荡的效果。"; + public override bool TargetSelf => true; + public override bool Durative => true; + public override double Duration => 50; + + private double 减伤比例 => Calculation.Round2Digits(0.2 + 0.02 * (Level -1)); + private double 实际比例 = 0; + + public override void OnEffectGained(Character character) + { + 实际比例 = 减伤比例; + character.NormalAttack.SetMagicType(true, character.MagicType); + } + + public override void OnEffectLost(Character character) + { + character.NormalAttack.SetMagicType(false, character.MagicType); + } + + public override void AlterActualDamageAfterCalculation(Character character, Character enemy, ref double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, bool isCritical) + { + if (enemy == Skill.Character) + { + damage = Calculation.Round2Digits(damage * (1 - 实际比例)); + } + } + + public override void OnSkillCasted(Character actor, List enemys, List teammates, Dictionary others) + { + RemainDuration = Duration; + if (!actor.Effects.Contains(this)) + { + 实际比例 = 0; + actor.Effects.Add(this); + OnEffectGained(actor); + } + } + } +} diff --git a/Library/Skills/Yang/魔法震荡.cs b/Library/Skills/Yang/魔法震荡.cs new file mode 100644 index 0000000..19a3d4e --- /dev/null +++ b/Library/Skills/Yang/魔法震荡.cs @@ -0,0 +1,50 @@ +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; +using Milimoe.FunGame.Testing.Effects; + +namespace Milimoe.FunGame.Testing.Skills +{ + public class 魔法震荡 : Skill + { + public override long Id => 4003; + public override string Name => "魔法震荡"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + + public 魔法震荡(Character character) : base(SkillType.Passive, character) + { + Effects.Add(new 魔法震荡特效(this)); + } + + public override IEnumerable AddInactiveEffectToCharacter() + { + return Effects; + } + } + + public class 魔法震荡特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"造成魔法伤害时有 35% 几率使敌人眩晕 1 回合。"; + public override bool TargetSelf => true; + + public override void AfterDamageCalculation(Character character, Character enemy, double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, bool isCritical) + { + if (character == Skill.Character && isMagicDamage && new Random().NextDouble() < 0.35) + { + IEnumerable effects = enemy.Effects.Where(e => e is 眩晕 && e.Skill == Skill); + if (effects.Any()) + { + effects.First().RemainDurationTurn++; + } + else + { + 眩晕 e = new(Skill, character, false, 0, 1); + enemy.Effects.Add(e); + e.OnEffectGained(enemy); + } + WriteLine($"[ {character} ] 的魔法伤害触发了魔法震荡,[ {enemy} ] 被眩晕了!"); + } + } + } +} diff --git a/Library/Skills/冰霜攻击.cs b/Library/Skills/冰霜攻击.cs deleted file mode 100644 index a684833..0000000 --- a/Library/Skills/冰霜攻击.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Milimoe.FunGame.Core.Entity; -using Milimoe.FunGame.Testing.Effects; - -namespace Milimoe.FunGame.Testing.Skills -{ - public class 冰霜攻击 : Skill - { - public override long Id => 2001; - public override string Name => "冰霜攻击"; - public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; - public override double MPCost => BaseMPCost + (50 * (Level - 1)); - public override double CD => 20; - public override double CastTime => 6; - public override double HardnessTime => 3; - protected override double BaseMPCost => 30; - - public 冰霜攻击(Character character) : base(true, true, character) - { - Effects.Add(new 冰霜攻击特效(this)); - } - } -} diff --git a/Library/Skills/大岛特性.cs b/Library/Skills/大岛特性.cs deleted file mode 100644 index b482d82..0000000 --- a/Library/Skills/大岛特性.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Milimoe.FunGame.Core.Entity; -using Milimoe.FunGame.Testing.Effects; - -namespace Milimoe.FunGame.Testing.Skills -{ - public class 大岛特性 : Skill - { - public override long Id => 5001; - public override string Name => "大岛特性"; - public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; - - public 大岛特性(Character character) : base(false, false, character) - { - Effects.Add(new 大岛特性特效(this)); - } - - public override IEnumerable AddInactiveEffectToCharacter() - { - return Effects; - } - } -} diff --git a/Library/Skills/天赐之力.cs b/Library/Skills/天赐之力.cs deleted file mode 100644 index 41e2fcd..0000000 --- a/Library/Skills/天赐之力.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Milimoe.FunGame.Core.Entity; -using Milimoe.FunGame.Testing.Effects; - -namespace Milimoe.FunGame.Testing.Skills -{ - public class 天赐之力 : Skill - { - public override long Id => 3001; - public override string Name => "天赐之力"; - public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; - public override double EPCost => 100; - public override double CD => 60; - public override double HardnessTime => 15; - - public 天赐之力(Character character) : base(true, character) - { - Effects.Add(new 天赐之力特效(this)); - } - } -} diff --git a/Library/Skills/疾风步.cs b/Library/Skills/疾风步.cs deleted file mode 100644 index 5fbd902..0000000 --- a/Library/Skills/疾风步.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Milimoe.FunGame.Core.Entity; -using Milimoe.FunGame.Testing.Effects; - -namespace Milimoe.FunGame.Testing.Skills -{ - public class 疾风步 : Skill - { - public override long Id => 4001; - public override string Name => "疾风步"; - public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; - public override double EPCost => 35; - public override double CD => 35; - public override double HardnessTime => 5; - - public 疾风步(Character character) : base(true, false, character) - { - Effects.Add(new 疾风步特效(this)); - } - } -} diff --git a/Library/Effects/冰霜攻击特效.cs b/Library/Skills/马猴烧酒/冰霜攻击.cs similarity index 54% rename from Library/Effects/冰霜攻击特效.cs rename to Library/Skills/马猴烧酒/冰霜攻击.cs index 5ae01ca..9148a38 100644 --- a/Library/Effects/冰霜攻击特效.cs +++ b/Library/Skills/马猴烧酒/冰霜攻击.cs @@ -2,12 +2,29 @@ using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Constant; -namespace Milimoe.FunGame.Testing.Effects +namespace Milimoe.FunGame.Testing.Skills { + public class 冰霜攻击 : Skill + { + public override long Id => 2001; + public override string Name => "冰霜攻击"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override double MPCost => BaseMPCost + (50 * (Level - 1)); + public override double CD => 20; + public override double CastTime => 6; + public override double HardnessTime => 3; + protected override double BaseMPCost => 30; + + public 冰霜攻击(Character character) : base(SkillType.Magic, character) + { + Effects.Add(new 冰霜攻击特效(this)); + } + } + public class 冰霜攻击特效(Skill skill) : Effect(skill) { public override long Id => Skill.Id; - public override string Name => "冰霜攻击"; + public override string Name => Skill.Name; public override string Description => $"对目标敌人造成 {Calculation.Round2Digits(90 + 60 * (Skill.Level - 1))} + {Calculation.Round2Digits((1.2 + 1.8 * (Skill.Level - 1)) * 100)}%智力 [ {Damage} ] 点{CharacterSet.GetMagicName(MagicType)}。"; public override bool TargetSelf => false; public override int TargetCount => 1; @@ -25,14 +42,10 @@ namespace Milimoe.FunGame.Testing.Effects } } - public override void OnSkillCasted(ActionQueue queue, Character actor, List enemys, List teammates, Dictionary others) + public override void OnSkillCasted(Character actor, List enemys, List teammates, Dictionary others) { Character enemy = enemys[new Random().Next(enemys.Count)]; - double damageBase = Damage; - if (queue.CalculateMagicalDamage(actor, enemy, false, MagicType, damageBase, out double damage) != DamageResult.Evaded) - { - queue.DamageToEnemy(actor, enemy, damage, false, true, MagicType); - } + DamageToEnemy(actor, enemy, true, MagicType, Damage); } } } diff --git a/Library/Skills/马猴烧酒/毁灭之势.cs b/Library/Skills/马猴烧酒/毁灭之势.cs new file mode 100644 index 0000000..3418b10 --- /dev/null +++ b/Library/Skills/马猴烧酒/毁灭之势.cs @@ -0,0 +1,30 @@ +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Testing.Skills +{ + public class 毁灭之势 : Skill + { + public override long Id => 4007; + public override string Name => "毁灭之势"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + + public 毁灭之势(Character character) : base(SkillType.Passive, character) + { + Effects.Add(new 毁灭之势特效(this)); + } + + public override IEnumerable AddInactiveEffectToCharacter() + { + return Effects; + } + } + + public class 毁灭之势特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"每时间提升 2.5% 所有伤害,无上限,但受到伤害时效果清零。"; + public override bool TargetSelf => true; + } +} From aeb5674d0d960c2044d38ae282326b7b99e93c11 Mon Sep 17 00:00:00 2001 From: milimoe Date: Wed, 11 Sep 2024 00:54:38 +0800 Subject: [PATCH 07/15] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=96=B0=E7=9A=84?= =?UTF-8?q?=E6=8A=80=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Library/Main.cs | 53 +++++++++++++++++- Library/Skills/NanGanyu/三重叠加.cs | 62 +++++++++++++++++++++ Library/Skills/NanGanyu/法术操控.cs | 30 ----------- Library/Skills/NanGanyu/灵能反射.cs | 84 +++++++++++++++++++++++++++++ Library/Skills/NiuNan/变幻之心.cs | 77 ++++++++++++++++++++++++++ Library/Skills/NiuNan/智慧与力量.cs | 66 ++++++++++++++++++++++- Library/Skills/QWQAQW/疾风步.cs | 2 +- Library/Skills/Yang/魔法涌流.cs | 10 ++-- Library/Skills/Yang/魔法震荡.cs | 4 +- 9 files changed, 347 insertions(+), 41 deletions(-) create mode 100644 Library/Skills/NanGanyu/三重叠加.cs delete mode 100644 Library/Skills/NanGanyu/法术操控.cs create mode 100644 Library/Skills/NanGanyu/灵能反射.cs create mode 100644 Library/Skills/NiuNan/变幻之心.cs diff --git a/Library/Main.cs b/Library/Main.cs index ee22d0c..93e76d9 100644 --- a/Library/Main.cs +++ b/Library/Main.cs @@ -152,6 +152,36 @@ if (list.Count > 3) }; c.Skills.Add(魔法涌流); } + + if (c== character4) + { + Skill 灵能反射 = new 灵能反射(c) + { + Level = 1 + }; + c.Skills.Add(灵能反射); + + Skill 三重叠加 = new 三重叠加(c) + { + Level = slevel + }; + c.Skills.Add(三重叠加); + } + + if (c== character5) + { + Skill 智慧与力量 = new 智慧与力量(c) + { + Level = 1 + }; + c.Skills.Add(智慧与力量); + + Skill 变幻之心 = new 变幻之心(c) + { + Level = slevel + }; + c.Skills.Add(变幻之心); + } if (c == character9) { @@ -162,7 +192,8 @@ if (list.Count > 3) c.Skills.Add(疾风步); } - if (c != character1 && c != character2 && c != character3) + if (c != character1 && c != character2 && c != character3 && c != character4 && + c != character5) { Skill 天赐之力 = new 天赐之力(c) { @@ -187,6 +218,26 @@ if (list.Count > 3) int i = 1; while (i < 999) { + if (i == 998) + { + Console.WriteLine($"=== 终局审判 ==="); + Dictionary 他们的血量百分比 = []; + foreach (Character c in characters) + { + 他们的血量百分比.TryAdd(c, Calculation.Round4Digits(c.HP / c.MaxHP)); + } + double max = 他们的血量百分比.Values.Max(); + Character winner = 他们的血量百分比.Keys.Where(c => 他们的血量百分比[c] == max).First(); + Console.WriteLine("[ " + winner + " ] 成为了天选之人!!"); + foreach (Character c in characters.Where(c => c != winner && c.HP > 0)) + { + Console.WriteLine("[ " + winner + " ] 对 [ " + c + " ] 造成了 99999999999 点真实伤害。"); + actionQueue.DeathCalculation(winner, c); + } + actionQueue.EndGameInfo(winner); + break; + } + // 检查是否有角色可以行动 Character? characterToAct = actionQueue.NextCharacter(); diff --git a/Library/Skills/NanGanyu/三重叠加.cs b/Library/Skills/NanGanyu/三重叠加.cs new file mode 100644 index 0000000..151ed09 --- /dev/null +++ b/Library/Skills/NanGanyu/三重叠加.cs @@ -0,0 +1,62 @@ +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Testing.Skills +{ + public class 三重叠加 : Skill + { + public override long Id => 3004; + public override string Name => "三重叠加"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override double EPCost => 100; + public override double CD => 35 - 2 * (Level - 1); + public override double HardnessTime => 10; + + public 三重叠加(Character character) : base(SkillType.SuperSkill, character) + { + Effects.Add(new 三重叠加特效(this)); + } + } + + public class 三重叠加特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => "三重叠加"; + public override string Description => $"使 [ 灵能反射 ] 的当前释放魔法次数归零,并且最大消除次数提高到 {灵能反射次数},并且在魔法命中时能够回复所回复能量值的 10 倍魔法值,持续 {技能持续次数} 次(灵能反射每消除次数达到最大时算一次)。" + + $"(剩余:{剩余持续次数} 次)"; + public override bool TargetSelf => true; + + public int 剩余持续次数 { get; set; } = 0; + private readonly int 灵能反射次数 = 3; + private readonly int 技能持续次数 = 2; + + public override void OnEffectGained(Character character) + { + IEnumerable effects = character.Effects.Where(e => e is 灵能反射特效); + if (effects.Any() && effects.First() is 灵能反射特效 e) + { + e.触发硬直次数 = 3; + e.释放次数 = 0; + } + } + + public override void OnEffectLost(Character character) + { + IEnumerable effects = character.Effects.Where(e => e is 灵能反射特效); + if (effects.Any() && effects.First() is 灵能反射特效 e) + { + e.触发硬直次数 = 2; + } + } + + public override void OnSkillCasted(Character actor, List enemys, List teammates, Dictionary others) + { + 剩余持续次数 = 技能持续次数; + if (!actor.Effects.Contains(this)) + { + actor.Effects.Add(this); + OnEffectGained(actor); + } + } + } +} diff --git a/Library/Skills/NanGanyu/法术操控.cs b/Library/Skills/NanGanyu/法术操控.cs deleted file mode 100644 index 95d3057..0000000 --- a/Library/Skills/NanGanyu/法术操控.cs +++ /dev/null @@ -1,30 +0,0 @@ -using Milimoe.FunGame.Core.Entity; -using Milimoe.FunGame.Core.Library.Constant; - -namespace Milimoe.FunGame.Testing.Skills -{ - public class 法术操控 : Skill - { - public override long Id => 4004; - public override string Name => "法术操控"; - public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; - - public 法术操控(Character character) : base(SkillType.Passive, character) - { - Effects.Add(new 法术操控特效(this)); - } - - public override IEnumerable AddInactiveEffectToCharacter() - { - return Effects; - } - } - - public class 法术操控特效(Skill skill) : Effect(skill) - { - public override long Id => Skill.Id; - public override string Name => Skill.Name; - public override string Description => $"每释放两次魔法才会触发硬直时间,且魔法命中时基于智力获得额外能量值。"; - public override bool TargetSelf => true; - } -} diff --git a/Library/Skills/NanGanyu/灵能反射.cs b/Library/Skills/NanGanyu/灵能反射.cs new file mode 100644 index 0000000..a1a013c --- /dev/null +++ b/Library/Skills/NanGanyu/灵能反射.cs @@ -0,0 +1,84 @@ +using Milimoe.FunGame.Core.Api.Utility; +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Testing.Skills +{ + public class 灵能反射 : Skill + { + public override long Id => 4004; + public override string Name => "灵能反射"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + + public 灵能反射(Character character) : base(SkillType.Passive, character) + { + Effects.Add(new 灵能反射特效(this)); + } + + public override IEnumerable AddInactiveEffectToCharacter() + { + return Effects; + } + } + + public class 灵能反射特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"每释放 {触发硬直次数} 次魔法才会触发硬直时间,且魔法命中时基于 25% 智力 [{获得额外能量值}] 获得额外能量值。"; + public override bool TargetSelf => true; + + public int 触发硬直次数 { get; set; } = 2; + public int 释放次数 { get; set; } = 0; + public double 获得额外能量值 + { + get + { + return Calculation.Round2Digits(0.25 * Skill.Character?.INT ?? 0); + } + } + + public override void AfterDamageCalculation(Character character, Character enemy, double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, DamageResult damageResult) + { + if (character == Skill.Character && isMagicDamage && damageResult != DamageResult.Evaded && character.EP < 200) + { + double 实际获得能量值 = 获得额外能量值; + character.EP += 实际获得能量值; + WriteLine("[ " + character + " ] 发动了灵能反射!额外获得了 " + 实际获得能量值 + " 能量!"); + IEnumerable effects = character.Effects.Where(e => e is 三重叠加特效); + if (effects.Any() && effects.First() is 三重叠加特效 e) + { + double 获得的魔法值 = Calculation.Round2Digits(实际获得能量值 * 10); + character.MP += 获得的魔法值; + WriteLine("[ " + character + " ] 发动了三重叠加!额外获得了 " + 获得的魔法值 + " 魔法值!"); + } + } + } + + public override void AlterHardnessTimeAfterCastSkill(Character character, ref double baseHardnessTime) + { + 释放次数++; + if (释放次数 < 触发硬直次数) + { + baseHardnessTime = 0; + WriteLine($"[ {character} ] 发动了灵能反射,消除了硬直时间!!"); + } + else + { + 释放次数 = 0; + IEnumerable effects = character.Effects.Where(e => e is 三重叠加特效); + if (effects.Any() && effects.First() is 三重叠加特效 e) + { + baseHardnessTime = 0; + WriteLine($"[ {character} ] 发动了灵能反射,消除了硬直时间!!"); + e.剩余持续次数--; + if (e.剩余持续次数 == 0) + { + character.Effects.Remove(e); + e.OnEffectLost(character); + } + } + } + } + } +} diff --git a/Library/Skills/NiuNan/变幻之心.cs b/Library/Skills/NiuNan/变幻之心.cs new file mode 100644 index 0000000..1e39b47 --- /dev/null +++ b/Library/Skills/NiuNan/变幻之心.cs @@ -0,0 +1,77 @@ +using Milimoe.FunGame.Core.Api.Utility; +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Testing.Skills +{ + public class 变幻之心 : Skill + { + public override long Id => 3005; + public override string Name => "变幻之心"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override double EPCost => 100; + public override double CD => 30; + public override double HardnessTime => 10; + + public 变幻之心(Character character) : base(SkillType.SuperSkill, character) + { + Effects.Add(new 变幻之心特效(this)); + } + } + + public class 变幻之心特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => "变幻之心"; + public override string Description => $"检查 [ 智慧与力量 ] 的模式。在力量模式下,立即回复 {生命值回复 * 100}% 生命值;智力模式下,下一次魔法伤害提升 {伤害提升 * 100}%。"; + public override bool TargetSelf => true; + + private double 生命值回复 => Calculation.Round4Digits(0.25 + 0.03 * (Level - 1)); + private double 伤害提升 => Calculation.Round4Digits(0.55 + 0.25 * (Level - 1)); + + public override void OnEffectGained(Character character) + { + Skill.IsInEffect = true; + } + + public override void OnEffectLost(Character character) + { + Skill.IsInEffect = false; + } + + public override void AlterExpectedDamageBeforeCalculation(Character character, Character enemy, ref double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType) + { + if (character == Skill.Character && isMagicDamage) + { + double 实际伤害提升百分比 = 伤害提升; + double 实际伤害提升 = Calculation.Round2Digits(damage * 实际伤害提升百分比); + damage = Calculation.Round2Digits(damage + 实际伤害提升); + WriteLine("[ " + character + " ] 发动了变幻之心!伤害提升了 " + 实际伤害提升 + " 点!"); + character.Effects.Remove(this); + OnEffectLost(character); + } + } + + public override void OnSkillCasted(Character actor, List enemys, List teammates, Dictionary others) + { + IEnumerable effects = actor.Effects.Where(e => e is 智慧与力量特效); + if (effects.Any()) + { + if (actor.PrimaryAttribute == PrimaryAttribute.STR) + { + double 回复的生命 = Calculation.Round2Digits(生命值回复 * actor.MaxHP); + actor.HP += 回复的生命; + WriteLine("[ " + actor + " ] 发动了变幻之心!回复了 " + 回复的生命 + " 点生命值!"); + } + else if (actor.PrimaryAttribute == PrimaryAttribute.INT) + { + if (!actor.Effects.Contains(this)) + { + actor.Effects.Add(this); + OnEffectGained(actor); + } + } + } + } + } +} diff --git a/Library/Skills/NiuNan/智慧与力量.cs b/Library/Skills/NiuNan/智慧与力量.cs index 6d1eae8..d44c6ff 100644 --- a/Library/Skills/NiuNan/智慧与力量.cs +++ b/Library/Skills/NiuNan/智慧与力量.cs @@ -1,4 +1,5 @@ -using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Api.Utility; +using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Constant; namespace Milimoe.FunGame.Testing.Skills @@ -24,7 +25,68 @@ namespace Milimoe.FunGame.Testing.Skills { public override long Id => Skill.Id; public override string Name => Skill.Name; - public override string Description => $"当生命值低于 30% 时,智力转化为力量;当生命值高于或等于 30% 时,力量转化为智力。"; + public override string Description => $"当生命值低于 30% 时,智力转化为力量;当生命值高于或等于 30% 时,力量转化为智力。" + + (Skill.Character != null ? "(当前模式:" + CharacterSet.GetPrimaryAttributeName(Skill.Character.PrimaryAttribute) + ")" : ""); public override bool TargetSelf => true; + + private double 交换前的额外智力 = 0; + private double 交换前的额外力量 = 0; + + public override void OnAttributeChanged(Character character) + { + if (Skill.Character != null) + { + if (Skill.Character.PrimaryAttribute == PrimaryAttribute.INT) + { + double diff = character.ExSTR - 交换前的额外力量; + character.ExINT = 交换前的额外力量 + character.BaseSTR + diff; + } + else if (Skill.Character.PrimaryAttribute == PrimaryAttribute.STR) + { + double diff = character.ExINT - 交换前的额外智力; + character.ExSTR = 交换前的额外智力 + character.BaseINT + diff; + } + } + } + + public override void OnTimeElapsed(Character character, double elapsed) + { + if (Skill.Character != null) + { + Character c = Skill.Character; + if (c.HP < c.MaxHP * 0.3) + { + if (c.PrimaryAttribute == PrimaryAttribute.INT) + { + double pastHP = c.HP; + double pastMaxHP = c.MaxHP; + double pastMP = c.MP; + double pastMaxMP = c.MaxMP; + c.PrimaryAttribute = PrimaryAttribute.STR; + 交换前的额外智力 = c.ExINT; + 交换前的额外力量 = c.ExSTR; + c.ExINT = -c.BaseINT; + c.ExSTR = 交换前的额外智力 + c.BaseINT + 交换前的额外力量; + c.Recovery(pastHP, pastMP, pastMaxHP, pastMaxMP); + } + } + else + { + if (c.PrimaryAttribute == PrimaryAttribute.STR) + { + double pastHP = c.HP; + double pastMaxHP = c.MaxHP; + double pastMP = c.MP; + double pastMaxMP = c.MaxMP; + c.PrimaryAttribute = PrimaryAttribute.INT; + 交换前的额外智力 = c.ExINT; + 交换前的额外力量 = c.ExSTR; + c.ExINT = 交换前的额外力量 + c.BaseSTR + 交换前的额外智力; + c.ExSTR = -c.BaseSTR; + c.Recovery(pastHP, pastMP, pastMaxHP, pastMaxMP); + } + } + } + } } } diff --git a/Library/Skills/QWQAQW/疾风步.cs b/Library/Skills/QWQAQW/疾风步.cs index b8b22c0..0d23c1a 100644 --- a/Library/Skills/QWQAQW/疾风步.cs +++ b/Library/Skills/QWQAQW/疾风步.cs @@ -65,7 +65,7 @@ namespace Milimoe.FunGame.Testing.Skills character.ExCritRate -= 0.15; } - public override void AlterActualDamageAfterCalculation(Character character, Character enemy, ref double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, bool isCritical) + public override void AlterActualDamageAfterCalculation(Character character, Character enemy, ref double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, DamageResult damageResult) { if (character == Skill.Character && 首次伤害) { diff --git a/Library/Skills/Yang/魔法涌流.cs b/Library/Skills/Yang/魔法涌流.cs index 0181b23..f1b01e8 100644 --- a/Library/Skills/Yang/魔法涌流.cs +++ b/Library/Skills/Yang/魔法涌流.cs @@ -10,7 +10,7 @@ namespace Milimoe.FunGame.Testing.Skills public override string Name => "魔法涌流"; public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; public override double EPCost => 100; - public override double CD => 65; + public override double CD => 35; public override double HardnessTime => 10; public 魔法涌流(Character character) : base(SkillType.SuperSkill, character) @@ -23,12 +23,12 @@ namespace Milimoe.FunGame.Testing.Skills { public override long Id => Skill.Id; public override string Name => "魔法涌流"; - public override string Description => $"{Duration} 秒内,增加所有伤害的20%伤害减免,并将普通攻击转为魔法伤害,可叠加魔法震荡的效果。"; + public override string Description => $"{Duration} 秒内,增加所有伤害的 {减伤比例 * 100}% 伤害减免,并将普通攻击转为魔法伤害,可叠加魔法震荡的效果。"; public override bool TargetSelf => true; public override bool Durative => true; - public override double Duration => 50; + public override double Duration => 25; - private double 减伤比例 => Calculation.Round2Digits(0.2 + 0.02 * (Level -1)); + private double 减伤比例 => Calculation.Round2Digits(0.1 + 0.02 * (Level -1)); private double 实际比例 = 0; public override void OnEffectGained(Character character) @@ -42,7 +42,7 @@ namespace Milimoe.FunGame.Testing.Skills character.NormalAttack.SetMagicType(false, character.MagicType); } - public override void AlterActualDamageAfterCalculation(Character character, Character enemy, ref double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, bool isCritical) + public override void AlterActualDamageAfterCalculation(Character character, Character enemy, ref double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, DamageResult damageResult) { if (enemy == Skill.Character) { diff --git a/Library/Skills/Yang/魔法震荡.cs b/Library/Skills/Yang/魔法震荡.cs index 19a3d4e..3440af9 100644 --- a/Library/Skills/Yang/魔法震荡.cs +++ b/Library/Skills/Yang/魔法震荡.cs @@ -28,9 +28,9 @@ namespace Milimoe.FunGame.Testing.Skills public override string Description => $"造成魔法伤害时有 35% 几率使敌人眩晕 1 回合。"; public override bool TargetSelf => true; - public override void AfterDamageCalculation(Character character, Character enemy, double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, bool isCritical) + public override void AfterDamageCalculation(Character character, Character enemy, double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, DamageResult damageResult) { - if (character == Skill.Character && isMagicDamage && new Random().NextDouble() < 0.35) + if (character == Skill.Character && isMagicDamage && damageResult != DamageResult.Evaded && new Random().NextDouble() < 0.35) { IEnumerable effects = enemy.Effects.Where(e => e is 眩晕 && e.Skill == Skill); if (effects.Any()) From 3178fa0569fb031659ee1f708eb15897f7901b22 Mon Sep 17 00:00:00 2001 From: milimoe Date: Thu, 12 Sep 2024 01:24:45 +0800 Subject: [PATCH 08/15] =?UTF-8?q?=E6=96=B0=E7=9A=84=E6=8A=80=E8=83=BD?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=EF=BC=8C=E8=BF=9B=E5=BA=A6=EF=BC=8810/12?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Library/Characters/Characters.cs | 2 +- Library/Effects/眩晕.cs | 9 +- Library/Effects/累积之压标记.cs | 24 +++++ Library/Main.cs | 83 ++++++++++++++++- Library/Skills/ColdBlue/嗜血标记.cs | 65 +++++++++++++ Library/Skills/ColdBlue/累积之压.cs | 90 ++++++++++++++++++ Library/Skills/Mayor/精准打击.cs | 64 +++++++++++++ Library/Skills/Mayor/致命打击.cs | 5 + Library/Skills/NanGanyu/三重叠加.cs | 8 +- Library/Skills/NanGanyu/灵能反射.cs | 2 +- Library/Skills/NiuNan/变幻之心.cs | 20 ++-- Library/Skills/NiuNan/智慧与力量.cs | 3 +- Library/Skills/Oshima/力量爆发.cs | 8 +- Library/Skills/QWQAQW/玻璃大炮.cs | 91 +++++++++++++++++++ Library/Skills/QWQAQW/迅捷之势.cs | 67 ++++++++++++++ Library/Skills/QingXiang/枯竭打击.cs | 57 ++++++++++++ Library/Skills/QingXiang/能量毁灭.cs | 44 +++++++++ Library/Skills/QuDuoduo/弱者猎手.cs | 30 ++++++ Library/Skills/QuDuoduo/血之狂欢.cs | 90 ++++++++++++++++++ Library/Skills/XinYin/天赐之力.cs | 10 +- Library/Skills/XinYin/心灵之火.cs | 2 +- Library/Skills/Yang/魔法涌流.cs | 13 +-- Library/Skills/{QWQAQW => 战技}/疾风步.cs | 28 +++--- Library/Skills/绿拱门/平衡强化.cs | 90 ++++++++++++++++++ Library/Skills/绿拱门/敏捷之刃.cs | 30 ++++++ Library/Skills/马猴烧酒/毁灭之势.cs | 33 ++++++- Library/Skills/马猴烧酒/绝对领域.cs | 74 +++++++++++++++ Library/Skills/{马猴烧酒 => 魔法}/冰霜攻击.cs | 11 ++- Library/Solutions/TestModule.cs | 3 - 29 files changed, 988 insertions(+), 68 deletions(-) create mode 100644 Library/Effects/累积之压标记.cs create mode 100644 Library/Skills/ColdBlue/嗜血标记.cs create mode 100644 Library/Skills/ColdBlue/累积之压.cs create mode 100644 Library/Skills/Mayor/精准打击.cs create mode 100644 Library/Skills/QWQAQW/玻璃大炮.cs create mode 100644 Library/Skills/QWQAQW/迅捷之势.cs create mode 100644 Library/Skills/QingXiang/枯竭打击.cs create mode 100644 Library/Skills/QingXiang/能量毁灭.cs create mode 100644 Library/Skills/QuDuoduo/弱者猎手.cs create mode 100644 Library/Skills/QuDuoduo/血之狂欢.cs rename Library/Skills/{QWQAQW => 战技}/疾风步.cs (70%) create mode 100644 Library/Skills/绿拱门/平衡强化.cs create mode 100644 Library/Skills/绿拱门/敏捷之刃.cs create mode 100644 Library/Skills/马猴烧酒/绝对领域.cs rename Library/Skills/{马猴烧酒 => 魔法}/冰霜攻击.cs (79%) diff --git a/Library/Characters/Characters.cs b/Library/Characters/Characters.cs index 3934186..f0eafe2 100644 --- a/Library/Characters/Characters.cs +++ b/Library/Characters/Characters.cs @@ -98,7 +98,7 @@ namespace FunGame.Testing.Characters c.InitialAGI = 7; c.AGIGrowth = 0.7; c.InitialINT = 17; - c.INTGrowth = 0.7; + c.INTGrowth = 1.7; c.InitialSPD = 300; c.InitialHR = 4; c.InitialMR = 2; diff --git a/Library/Effects/眩晕.cs b/Library/Effects/眩晕.cs index 06aeee0..ec0d51c 100644 --- a/Library/Effects/眩晕.cs +++ b/Library/Effects/眩晕.cs @@ -7,7 +7,7 @@ namespace Milimoe.FunGame.Testing.Effects { public override long Id => 4101; public override string Name => "眩晕"; - public override string Description => $"此角色被眩晕了,不能行动。来自:[ " + _sourceCharacter + " ] 的 [ " + Skill.Name + " ]"; + public override string Description => $"此角色被眩晕了,不能行动。来自:[ {Source} ] 的 [ {Skill.Name} ]"; public override EffectControlType ControlType => EffectControlType.Stun; public override bool TargetSelf => true; public override Character Source => _sourceCharacter; @@ -33,7 +33,7 @@ namespace Milimoe.FunGame.Testing.Effects { if (_durative) RemainDuration = Duration; else RemainDurationTurn = DurationTurn; - character.CharacterEffectStates.Add(this, CharacterState.NotActionable); + character.CharacterEffectStates.Add(this, [CharacterState.NotActionable]); character.UpdateCharacterState(); InterruptCasting(character, Source); } @@ -43,10 +43,5 @@ namespace Milimoe.FunGame.Testing.Effects character.CharacterEffectStates.Remove(this); character.UpdateCharacterState(); } - - public override void OnTurnStart(Character character) - { - - } } } diff --git a/Library/Effects/累积之压标记.cs b/Library/Effects/累积之压标记.cs new file mode 100644 index 0000000..216911f --- /dev/null +++ b/Library/Effects/累积之压标记.cs @@ -0,0 +1,24 @@ +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Testing.Effects +{ + public class 累积之压标记 : Effect + { + public override long Id => 4102; + public override string Name => "累积之压标记"; + public override string Description => $"此角色持有累积之压标记,已累计 {MarkLevel} 层。来自:[ {Source} ]"; + public override EffectControlType ControlType => EffectControlType.Mark; + public override bool TargetSelf => true; + public override Character Source => _sourceCharacter; + public int MarkLevel { get; set; } = 1; + + private readonly Character _sourceCharacter; + + public 累积之压标记(Skill skill, Character sourceCharacter) : base(skill) + { + ActionQueue = skill.ActionQueue; + _sourceCharacter = sourceCharacter; + } + } +} diff --git a/Library/Main.cs b/Library/Main.cs index 93e76d9..2feafc3 100644 --- a/Library/Main.cs +++ b/Library/Main.cs @@ -108,6 +108,12 @@ if (list.Count > 3) }; c.Skills.Add(冰霜攻击); + Skill 疾风步 = new 疾风步(c) + { + Level = slevel + }; + c.Skills.Add(疾风步); + if (c == character1) { Skill META马 = new META马(c) @@ -182,18 +188,85 @@ if (list.Count > 3) }; c.Skills.Add(变幻之心); } - - if (c == character9) + + if (c== character6) { - Skill 疾风步 = new 疾风步(c) + Skill 致命打击 = new 致命打击(c) + { + Level = 1 + }; + c.Skills.Add(致命打击); + + Skill 精准打击 = new 精准打击(c) { Level = slevel }; - c.Skills.Add(疾风步); + c.Skills.Add(精准打击); + } + + if (c== character7) + { + Skill 毁灭之势 = new 毁灭之势(c) + { + Level = 1 + }; + c.Skills.Add(毁灭之势); + + Skill 绝对领域 = new 绝对领域(c) + { + Level = slevel + }; + c.Skills.Add(绝对领域); + } + + if (c== character8) + { + Skill 枯竭打击 = new 枯竭打击(c) + { + Level = 1 + }; + c.Skills.Add(枯竭打击); + + Skill 能量毁灭 = new 能量毁灭(c) + { + Level = slevel + }; + c.Skills.Add(能量毁灭); + } + + if (c == character9) + { + Skill 玻璃大炮 = new 玻璃大炮(c) + { + Level = 1 + }; + c.Skills.Add(玻璃大炮); + + Skill 迅捷之势 = new 迅捷之势(c) + { + Level = slevel + }; + c.Skills.Add(迅捷之势); + } + + if (c == character10) + { + Skill 累积之压 = new 累积之压(c) + { + Level = 1 + }; + c.Skills.Add(累积之压); + + Skill 嗜血标记 = new 嗜血标记(c) + { + Level = slevel + }; + c.Skills.Add(嗜血标记); } if (c != character1 && c != character2 && c != character3 && c != character4 && - c != character5) + c != character5 && c != character6 && c != character7 && c != character8 && + c != character9 && c != character10) //&& c != character11 && c != character12) { Skill 天赐之力 = new 天赐之力(c) { diff --git a/Library/Skills/ColdBlue/嗜血标记.cs b/Library/Skills/ColdBlue/嗜血标记.cs new file mode 100644 index 0000000..59c7f60 --- /dev/null +++ b/Library/Skills/ColdBlue/嗜血标记.cs @@ -0,0 +1,65 @@ +using Milimoe.FunGame.Core.Api.Utility; +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; +using Milimoe.FunGame.Testing.Effects; + +namespace Milimoe.FunGame.Testing.Skills +{ + public class 嗜血标记 : Skill + { + public override long Id => 3010; + public override string Name => "嗜血标记"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override double EPCost => 100; + public override double CD => 42 - 1 * (Level - 1); + public override double HardnessTime => 12; + + public 嗜血标记(Character character) : base(SkillType.SuperSkill, character) + { + Effects.Add(new 嗜血标记特效(this)); + } + } + + public class 嗜血标记特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"{Duration} 秒内,攻击拥有标记的角色将根据标记层数获得 {吸血 * 100:f2}% 吸血每层。"; + public override bool TargetSelf => true; + public override bool Durative => true; + public override double Duration => 30; + + public HashSet 角色有第四层 { get; } = []; + private double 吸血 => Calculation.Round4Digits(0.03 * Level); + + public override void AfterDamageCalculation(Character character, Character enemy, double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, DamageResult damageResult) + { + if (character == Skill.Character && damageResult != DamageResult.Evaded && character.HP < character.MaxHP) + { + int 层数 = 0; + if (enemy.Effects.Where(e => e is 累积之压标记).FirstOrDefault() is 累积之压标记 e) + { + 层数 = e.MarkLevel; + } + else if (角色有第四层.Remove(enemy)) + { + 层数 = 4; + } + double 实际吸血 = Calculation.Round2Digits(吸血 * damage); + character.HP += 实际吸血; + WriteLine($"[ {character} ] 回复了 {实际吸血} 点生命值!"); + } + } + + public override void OnSkillCasted(Character caster, List enemys, List teammates, Dictionary others) + { + RemainDuration = Duration; + if (!caster.Effects.Contains(this)) + { + 角色有第四层.Clear(); + caster.Effects.Add(this); + OnEffectGained(caster); + } + } + } +} diff --git a/Library/Skills/ColdBlue/累积之压.cs b/Library/Skills/ColdBlue/累积之压.cs new file mode 100644 index 0000000..c5e1e30 --- /dev/null +++ b/Library/Skills/ColdBlue/累积之压.cs @@ -0,0 +1,90 @@ +using Milimoe.FunGame.Core.Api.Utility; +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; +using Milimoe.FunGame.Testing.Effects; + +namespace Milimoe.FunGame.Testing.Skills +{ + public class 累积之压 : Skill + { + public override long Id => 4010; + public override string Name => "累积之压"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + + public 累积之压(Character character) : base(SkillType.Passive, character) + { + Effects.Add(new 累积之压特效(this)); + } + + public override IEnumerable AddInactiveEffectToCharacter() + { + return Effects; + } + } + + public class 累积之压特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"每次造成伤害都可以叠一层标记,累计 4 层时回收该角色所有标记并造成眩晕 1 回合,额外对该角色造成 {系数 * 100:f2}% 最大生命值的物理伤害。"; + public override bool TargetSelf => true; + + private readonly double 系数 = 0.12; + private bool 是否是嵌套伤害 = false; + + public override void AfterDamageCalculation(Character character, Character enemy, double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, DamageResult damageResult) + { + if (character == Skill.Character && damageResult != DamageResult.Evaded && !是否是嵌套伤害) + { + // 叠标记 + IEnumerable effects = enemy.Effects.Where(e => e is 累积之压标记); + if (effects.Any() && effects.First() is 累积之压标记 e) + { + e.MarkLevel++; + IEnumerable effects2 = character.Effects.Where(e => e is 嗜血标记特效); + if (effects2.Any() && effects2.First() is 嗜血标记特效 e2) + { + if (e.MarkLevel >= 4) + { + e2.角色有第四层.Add(enemy); + } + else + { + e2.角色有第四层.Remove(enemy); + } + } + if (e.MarkLevel >= 4) + { + // 移除标记 + enemy.Effects.Remove(e); + double 额外伤害 = Calculation.Round2Digits(enemy.MaxHP * 系数); + WriteLine($"[ {character} ] 发动了累积之压!将对 [ {enemy} ] 造成眩晕和额外伤害!"); + // 眩晕 + IEnumerable effects3 = enemy.Effects.Where(e => e is 眩晕 && e.Skill == Skill); + if (effects3.Any()) + { + effects3.First().RemainDurationTurn++; + } + else + { + 眩晕 e3 = new(Skill, character, false, 0, 1); + enemy.Effects.Add(e3); + e3.OnEffectGained(enemy); + } + 是否是嵌套伤害 = true; + DamageToEnemy(character, enemy, false, magicType, 额外伤害); + } + } + else + { + enemy.Effects.Add(new 累积之压标记(Skill, character)); + } + } + + if (character == Skill.Character && 是否是嵌套伤害) + { + 是否是嵌套伤害 = false; + } + } + } +} diff --git a/Library/Skills/Mayor/精准打击.cs b/Library/Skills/Mayor/精准打击.cs new file mode 100644 index 0000000..7ec3768 --- /dev/null +++ b/Library/Skills/Mayor/精准打击.cs @@ -0,0 +1,64 @@ +using Milimoe.FunGame.Core.Api.Utility; +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Testing.Skills +{ + public class 精准打击 : Skill + { + public override long Id => 3006; + public override string Name => "精准打击"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override double EPCost => 100; + public override double CD => 40 - 1 * (Level - 1); + public override double HardnessTime => 8; + + public 精准打击(Character character) : base(SkillType.SuperSkill, character) + { + Effects.Add(new 精准打击特效(this)); + } + } + + public class 精准打击特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"30 时间内暴击率提升 {暴击率提升 * 100:f2}%,暴击伤害再提升 {暴击伤害提升 * 100:f2}%。"; + public override bool TargetSelf => true; + public override bool Durative => true; + public override double Duration => 30; + + private double 暴击率提升 => Calculation.Round4Digits(0.2 + 0.03 * (Level - 1)); + private double 暴击伤害提升 => Calculation.Round4Digits(0.8 + 0.04 * (Level - 1)); + private double 实际暴击率提升 = 0; + private double 实际暴击伤害提升 = 0; + + public override void OnEffectGained(Character character) + { + 实际暴击率提升 = 暴击率提升; + 实际暴击伤害提升 = 暴击伤害提升; + character.ExCritRate += 实际暴击率提升; + WriteLine($"[ {character} ] 的暴击率提升了 [ {实际暴击率提升 * 100:f2}% ] !"); + character.ExCritDMG += 实际暴击伤害提升; + WriteLine($"[ {character} ] 的暴击伤害提升了 [ {实际暴击伤害提升 * 100:f2}% ] !"); + } + + public override void OnEffectLost(Character character) + { + character.ExCritRate -= 实际暴击率提升; + character.ExCritDMG -= 实际暴击伤害提升; + } + + public override void OnSkillCasted(Character caster, List enemys, List teammates, Dictionary others) + { + RemainDuration = Duration; + if (!caster.Effects.Contains(this)) + { + 实际暴击率提升 = 0; + 实际暴击伤害提升 = 0; + caster.Effects.Add(this); + OnEffectGained(caster); + } + } + } +} diff --git a/Library/Skills/Mayor/致命打击.cs b/Library/Skills/Mayor/致命打击.cs index 1f5f609..2a2ca7a 100644 --- a/Library/Skills/Mayor/致命打击.cs +++ b/Library/Skills/Mayor/致命打击.cs @@ -31,5 +31,10 @@ namespace Milimoe.FunGame.Testing.Skills { character.ExCritDMG += 0.3; } + + public override void OnEffectLost(Character character) + { + character.ExCritDMG -= 0.3; + } } } diff --git a/Library/Skills/NanGanyu/三重叠加.cs b/Library/Skills/NanGanyu/三重叠加.cs index 151ed09..a3b910f 100644 --- a/Library/Skills/NanGanyu/三重叠加.cs +++ b/Library/Skills/NanGanyu/三重叠加.cs @@ -49,13 +49,13 @@ namespace Milimoe.FunGame.Testing.Skills } } - public override void OnSkillCasted(Character actor, List enemys, List teammates, Dictionary others) + public override void OnSkillCasted(Character caster, List enemys, List teammates, Dictionary others) { 剩余持续次数 = 技能持续次数; - if (!actor.Effects.Contains(this)) + if (!caster.Effects.Contains(this)) { - actor.Effects.Add(this); - OnEffectGained(actor); + caster.Effects.Add(this); + OnEffectGained(caster); } } } diff --git a/Library/Skills/NanGanyu/灵能反射.cs b/Library/Skills/NanGanyu/灵能反射.cs index a1a013c..de83737 100644 --- a/Library/Skills/NanGanyu/灵能反射.cs +++ b/Library/Skills/NanGanyu/灵能反射.cs @@ -55,7 +55,7 @@ namespace Milimoe.FunGame.Testing.Skills } } - public override void AlterHardnessTimeAfterCastSkill(Character character, ref double baseHardnessTime) + public override void AlterHardnessTimeAfterCastSkill(Character character, ref double baseHardnessTime, ref bool isCheckProtected) { 释放次数++; if (释放次数 < 触发硬直次数) diff --git a/Library/Skills/NiuNan/变幻之心.cs b/Library/Skills/NiuNan/变幻之心.cs index 1e39b47..c598636 100644 --- a/Library/Skills/NiuNan/变幻之心.cs +++ b/Library/Skills/NiuNan/变幻之心.cs @@ -52,23 +52,23 @@ namespace Milimoe.FunGame.Testing.Skills } } - public override void OnSkillCasted(Character actor, List enemys, List teammates, Dictionary others) + public override void OnSkillCasted(Character caster, List enemys, List teammates, Dictionary others) { - IEnumerable effects = actor.Effects.Where(e => e is 智慧与力量特效); + IEnumerable effects = caster.Effects.Where(e => e is 智慧与力量特效); if (effects.Any()) { - if (actor.PrimaryAttribute == PrimaryAttribute.STR) + if (caster.PrimaryAttribute == PrimaryAttribute.STR) { - double 回复的生命 = Calculation.Round2Digits(生命值回复 * actor.MaxHP); - actor.HP += 回复的生命; - WriteLine("[ " + actor + " ] 发动了变幻之心!回复了 " + 回复的生命 + " 点生命值!"); + double 回复的生命 = Calculation.Round2Digits(生命值回复 * caster.MaxHP); + caster.HP += 回复的生命; + WriteLine("[ " + caster + " ] 回复了 " + 回复的生命 + " 点生命值!"); } - else if (actor.PrimaryAttribute == PrimaryAttribute.INT) + else if (caster.PrimaryAttribute == PrimaryAttribute.INT) { - if (!actor.Effects.Contains(this)) + if (!caster.Effects.Contains(this)) { - actor.Effects.Add(this); - OnEffectGained(actor); + caster.Effects.Add(this); + OnEffectGained(caster); } } } diff --git a/Library/Skills/NiuNan/智慧与力量.cs b/Library/Skills/NiuNan/智慧与力量.cs index d44c6ff..b507681 100644 --- a/Library/Skills/NiuNan/智慧与力量.cs +++ b/Library/Skills/NiuNan/智慧与力量.cs @@ -1,5 +1,4 @@ -using Milimoe.FunGame.Core.Api.Utility; -using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Constant; namespace Milimoe.FunGame.Testing.Skills diff --git a/Library/Skills/Oshima/力量爆发.cs b/Library/Skills/Oshima/力量爆发.cs index 9792e71..a9cf8aa 100644 --- a/Library/Skills/Oshima/力量爆发.cs +++ b/Library/Skills/Oshima/力量爆发.cs @@ -44,14 +44,14 @@ namespace Milimoe.FunGame.Testing.Skills character.ExATK2 -= 实际攻击力加成; } - public override void OnSkillCasted(Character actor, List enemys, List teammates, Dictionary others) + public override void OnSkillCasted(Character caster, List enemys, List teammates, Dictionary others) { RemainDuration = Duration; - if (!actor.Effects.Contains(this)) + if (!caster.Effects.Contains(this)) { 实际攻击力加成 = 0; - actor.Effects.Add(this); - OnEffectGained(actor); + caster.Effects.Add(this); + OnEffectGained(caster); } } } diff --git a/Library/Skills/QWQAQW/玻璃大炮.cs b/Library/Skills/QWQAQW/玻璃大炮.cs new file mode 100644 index 0000000..2863dbb --- /dev/null +++ b/Library/Skills/QWQAQW/玻璃大炮.cs @@ -0,0 +1,91 @@ +using Milimoe.FunGame.Core.Api.Utility; +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Testing.Skills +{ + public class 玻璃大炮 : Skill + { + public override long Id => 4009; + public override string Name => "玻璃大炮"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + + public 玻璃大炮(Character character) : base(SkillType.Passive, character) + { + Effects.Add(new 玻璃大炮特效(this)); + } + + public override IEnumerable AddInactiveEffectToCharacter() + { + return Effects; + } + } + + public class 玻璃大炮特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"生命值高于30%时,受到额外的 [ 20~40% ] 伤害,但是获得 [ 上次所受伤害的 80% ] 伤害加成;生命值低于等于30%时,不会受到额外的伤害,但是仅能获得 [ 上次所受伤害的 30% ] 伤害加成。" + + $"在没有受到任何伤害的时候,将获得 {常规伤害加成 * 100:f2}% 伤害加成。(当前伤害加成:{伤害加成 * 100:f2}%)"; + public override bool TargetSelf => true; + + private double 上次受到的伤害 = 0; + private double 这次的伤害加成 = 0; + private double 这次受到的额外伤害 = 0; + private readonly double 常规伤害加成 = 0.2; + private readonly double 高于30的加成 = 0.8; + private readonly double 低于30的加成 = 0.3; + + private double 伤害加成 + { + get + { + double 系数 = 常规伤害加成; + Character? character = Skill.Character; + if (character is null) return 系数; + if (上次受到的伤害 != 0) + { + if (character.HP > character.MaxHP * 0.3) + { + 系数 = 高于30的加成; + } + else + { + 系数 = 低于30的加成; + } + } + return 系数; + } + } + + public override void AlterExpectedDamageBeforeCalculation(Character character, Character enemy, ref double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType) + { + if (character == Skill.Character) + { + 这次的伤害加成 = Calculation.Round2Digits(damage * 伤害加成); + damage = Calculation.Round2Digits(damage + 这次的伤害加成); + WriteLine($"[ {character} ] 发动了玻璃大炮,获得了 {这次的伤害加成} 点伤害加成!"); + } + + if (enemy == Skill.Character) + { + if (character.HP > character.MaxHP * 0.3) + { + // 额外受到伤害 + double 系数 = Calculation.Round4Digits((new Random().Next(20, 40) + 0.0) / 100); + 这次受到的额外伤害 = Calculation.Round2Digits(damage * 系数); + damage = Calculation.Round2Digits(damage + 这次受到的额外伤害); + WriteLine($"[ {character} ] 的玻璃大炮触发,将额外受到 {这次受到的额外伤害} 点伤害!"); + } + } + } + + public override void AfterDamageCalculation(Character character, Character enemy, double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, DamageResult damageResult) + { + if (enemy == Skill.Character && damageResult != DamageResult.Evaded) + { + 上次受到的伤害 = damage; + } + } + } +} diff --git a/Library/Skills/QWQAQW/迅捷之势.cs b/Library/Skills/QWQAQW/迅捷之势.cs new file mode 100644 index 0000000..f2248f9 --- /dev/null +++ b/Library/Skills/QWQAQW/迅捷之势.cs @@ -0,0 +1,67 @@ +using Milimoe.FunGame.Core.Api.Utility; +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Testing.Skills +{ + public class 迅捷之势 : Skill + { + public override long Id => 3009; + public override string Name => "迅捷之势"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override double EPCost => 100; + public override double CD => 60 - 2 * (Level - 1); + public override double HardnessTime => 15; + + public 迅捷之势(Character character) : base(SkillType.SuperSkill, character) + { + Effects.Add(new 迅捷之势特效(this)); + } + } + + public class 迅捷之势特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"{Duration} 秒内,普通攻击转为魔法伤害,且硬直时间减少50%,并基于 {智力系数 * 100:f2}% 智力 [{智力加成}] 强化普通攻击伤害。"; + public override bool TargetSelf => true; + public override bool Durative => true; + public override double Duration => 40; + + private double 智力系数 => Calculation.Round4Digits(1.4 + 0.4 * (Level - 1)); + private double 智力加成 => Calculation.Round2Digits(智力系数 * Skill.Character?.INT ?? 0); + + public override void OnEffectGained(Character character) + { + character.NormalAttack.SetMagicType(true, character.MagicType); + } + + public override void OnEffectLost(Character character) + { + character.NormalAttack.SetMagicType(false, character.MagicType); + } + + public override void AlterExpectedDamageBeforeCalculation(Character character, Character enemy, ref double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType) + { + if (character == Skill.Character && isNormalAttack) + { + damage = Calculation.Round2Digits(damage + 智力加成); + } + } + + public override void AlterHardnessTimeAfterNormalAttack(Character character, ref double baseHardnessTime, ref bool isCheckProtected) + { + baseHardnessTime = Calculation.Round2Digits(baseHardnessTime * 0.5); + } + + public override void OnSkillCasted(Character caster, List enemys, List teammates, Dictionary others) + { + RemainDuration = Duration; + if (!caster.Effects.Contains(this)) + { + caster.Effects.Add(this); + OnEffectGained(caster); + } + } + } +} diff --git a/Library/Skills/QingXiang/枯竭打击.cs b/Library/Skills/QingXiang/枯竭打击.cs new file mode 100644 index 0000000..b603f2e --- /dev/null +++ b/Library/Skills/QingXiang/枯竭打击.cs @@ -0,0 +1,57 @@ +using Milimoe.FunGame.Core.Api.Utility; +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Testing.Skills +{ + public class 枯竭打击 : Skill + { + public override long Id => 4008; + public override string Name => "枯竭打击"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + + public 枯竭打击(Character character) : base(SkillType.Passive, character) + { + Effects.Add(new 枯竭打击特效(this)); + } + + public override IEnumerable AddInactiveEffectToCharacter() + { + return Effects; + } + } + + public class 枯竭打击特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"每次造成伤害都会随机减少对方 [ 10~25 ] 点能量值,对能量值低于一半的角色额外造成 30% 伤害。对于枯竭打击而言,能量值大于100且小于150时,视为低于一半。"; + public override bool TargetSelf => true; + + private bool 是否是嵌套伤害 = false; + + public override void AfterDamageCalculation(Character character, Character enemy, double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, DamageResult damageResult) + { + if (character == Skill.Character && damageResult != DamageResult.Evaded && !是否是嵌套伤害) + { + // 减少能量 + double EP = new Random().Next(10, 25); + enemy.EP -= EP; + WriteLine($"[ {character} ] 发动了枯竭打击![ {enemy} ] 的能量值被减少了 {EP} 点!现有能量:{enemy.EP}。"); + // 伤害提升 + if (enemy.EP >= 0 && enemy.EP < 50 || enemy.EP >= 100 && enemy.EP < 150) + { + double 额外伤害 = Calculation.Round2Digits(damage * 0.3); + WriteLine($"[ {character} ] 发动了枯竭打击!将造成额外伤害!"); + 是否是嵌套伤害 = true; + DamageToEnemy(character, enemy, isMagicDamage, magicType, 额外伤害); + } + } + + if (character == Skill.Character && 是否是嵌套伤害) + { + 是否是嵌套伤害 = false; + } + } + } +} diff --git a/Library/Skills/QingXiang/能量毁灭.cs b/Library/Skills/QingXiang/能量毁灭.cs new file mode 100644 index 0000000..45cdd28 --- /dev/null +++ b/Library/Skills/QingXiang/能量毁灭.cs @@ -0,0 +1,44 @@ +using Milimoe.FunGame.Core.Api.Utility; +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Testing.Skills +{ + public class 能量毁灭 : Skill + { + public override long Id => 3008; + public override string Name => "能量毁灭"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override double EPCost => 100; + public override double CD => 55 - 3 * (Level - 1); + public override double HardnessTime => 15; + + public 能量毁灭(Character character) : base(SkillType.SuperSkill, character) + { + Effects.Add(new 能量毁灭特效(this)); + } + } + + public class 能量毁灭特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"对所有角色造成 " + + $"600% 其现有能量值 + {智力系数 * 100:f2}% 智力 [ {智力伤害} ] 的魔法伤害。"; + public override bool TargetSelf => false; + public override double TargetRange => 999; + + private double 智力系数 => Calculation.Round4Digits(0.55 * Level); + private double 智力伤害 => Calculation.Round2Digits(智力系数 * Skill.Character?.INT ?? 0); + + public override void OnSkillCasted(Character caster, List enemys, List teammates, Dictionary others) + { + foreach (Character c in enemys) + { + WriteLine($"[ {caster} ] 正在毁灭 [ {c} ] 的能量!!"); + double ep = c.EP; + DamageToEnemy(caster, c, true, MagicType, Calculation.Round2Digits(ep * 6.0 + 智力伤害)); + } + } + } +} diff --git a/Library/Skills/QuDuoduo/弱者猎手.cs b/Library/Skills/QuDuoduo/弱者猎手.cs new file mode 100644 index 0000000..7cb13a8 --- /dev/null +++ b/Library/Skills/QuDuoduo/弱者猎手.cs @@ -0,0 +1,30 @@ +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Testing.Skills +{ + public class 弱者猎手 : Skill + { + public override long Id => 4012; + public override string Name => "弱者猎手"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + + public 弱者猎手(Character character) : base(SkillType.Passive, character) + { + Effects.Add(new 弱者猎手特效(this)); + } + + public override IEnumerable AddInactiveEffectToCharacter() + { + return Effects; + } + } + + public class 弱者猎手特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"优先攻击血量更低的角色,对生命值低于自己的角色造成150%伤害。"; + public override bool TargetSelf => true; + } +} diff --git a/Library/Skills/QuDuoduo/血之狂欢.cs b/Library/Skills/QuDuoduo/血之狂欢.cs new file mode 100644 index 0000000..55b2fa3 --- /dev/null +++ b/Library/Skills/QuDuoduo/血之狂欢.cs @@ -0,0 +1,90 @@ +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Testing.Skills +{ + public class 血之狂欢 : Skill + { + public override long Id => 4012; + public override string Name => "血之狂欢"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + + public 血之狂欢(Character character) : base(SkillType.Passive, character) + { + Effects.Add(new 血之狂欢特效(this)); + } + + public override IEnumerable AddInactiveEffectToCharacter() + { + return Effects; + } + } + + public class 血之狂欢特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"30秒内,获得50%吸血。"; + public override bool TargetSelf => true; + + private double 交换前的额外智力 = 0; + private double 交换前的额外力量 = 0; + + public override void OnAttributeChanged(Character character) + { + if (Skill.Character != null) + { + if (Skill.Character.PrimaryAttribute == PrimaryAttribute.INT) + { + double diff = character.ExSTR - 交换前的额外力量; + character.ExINT = 交换前的额外力量 + character.BaseSTR + diff; + } + else if (Skill.Character.PrimaryAttribute == PrimaryAttribute.STR) + { + double diff = character.ExINT - 交换前的额外智力; + character.ExSTR = 交换前的额外智力 + character.BaseINT + diff; + } + } + } + + public override void OnTimeElapsed(Character character, double elapsed) + { + if (Skill.Character != null) + { + Character c = Skill.Character; + if (c.HP < c.MaxHP * 0.3) + { + if (c.PrimaryAttribute == PrimaryAttribute.INT) + { + double pastHP = c.HP; + double pastMaxHP = c.MaxHP; + double pastMP = c.MP; + double pastMaxMP = c.MaxMP; + c.PrimaryAttribute = PrimaryAttribute.STR; + 交换前的额外智力 = c.ExINT; + 交换前的额外力量 = c.ExSTR; + c.ExINT = -c.BaseINT; + c.ExSTR = 交换前的额外智力 + c.BaseINT + 交换前的额外力量; + c.Recovery(pastHP, pastMP, pastMaxHP, pastMaxMP); + } + } + else + { + if (c.PrimaryAttribute == PrimaryAttribute.STR) + { + double pastHP = c.HP; + double pastMaxHP = c.MaxHP; + double pastMP = c.MP; + double pastMaxMP = c.MaxMP; + c.PrimaryAttribute = PrimaryAttribute.INT; + 交换前的额外智力 = c.ExINT; + 交换前的额外力量 = c.ExSTR; + c.ExINT = 交换前的额外力量 + c.BaseSTR + 交换前的额外智力; + c.ExSTR = -c.BaseSTR; + c.Recovery(pastHP, pastMP, pastMaxHP, pastMaxMP); + } + } + } + } + } +} diff --git a/Library/Skills/XinYin/天赐之力.cs b/Library/Skills/XinYin/天赐之力.cs index a35f36f..201f666 100644 --- a/Library/Skills/XinYin/天赐之力.cs +++ b/Library/Skills/XinYin/天赐之力.cs @@ -60,18 +60,18 @@ namespace Milimoe.FunGame.Testing.Skills } } - public override void AlterHardnessTimeAfterNormalAttack(Character character, ref double baseHardnessTime) + public override void AlterHardnessTimeAfterNormalAttack(Character character, ref double baseHardnessTime, ref bool isCheckProtected) { baseHardnessTime = Calculation.Round2Digits(baseHardnessTime * 0.8); } - public override void OnSkillCasted(Character actor, List enemys, List teammates, Dictionary others) + public override void OnSkillCasted(Character caster, List enemys, List teammates, Dictionary others) { RemainDuration = Duration; - if (!actor.Effects.Contains(this)) + if (!caster.Effects.Contains(this)) { - actor.Effects.Add(this); - OnEffectGained(actor); + caster.Effects.Add(this); + OnEffectGained(caster); } } } diff --git a/Library/Skills/XinYin/心灵之火.cs b/Library/Skills/XinYin/心灵之火.cs index c57b457..3ddc709 100644 --- a/Library/Skills/XinYin/心灵之火.cs +++ b/Library/Skills/XinYin/心灵之火.cs @@ -28,7 +28,7 @@ namespace Milimoe.FunGame.Testing.Skills public override string Description => $"普通攻击硬直时间减少 20%。"; public override bool TargetSelf => true; - public override void AlterHardnessTimeAfterNormalAttack(Character character, ref double baseHardnessTime) + public override void AlterHardnessTimeAfterNormalAttack(Character character, ref double baseHardnessTime, ref bool isCheckProtected) { baseHardnessTime = Calculation.Round2Digits(baseHardnessTime * 0.8); } diff --git a/Library/Skills/Yang/魔法涌流.cs b/Library/Skills/Yang/魔法涌流.cs index f1b01e8..65a5e77 100644 --- a/Library/Skills/Yang/魔法涌流.cs +++ b/Library/Skills/Yang/魔法涌流.cs @@ -23,7 +23,7 @@ namespace Milimoe.FunGame.Testing.Skills { public override long Id => Skill.Id; public override string Name => "魔法涌流"; - public override string Description => $"{Duration} 秒内,增加所有伤害的 {减伤比例 * 100}% 伤害减免,并将普通攻击转为魔法伤害,可叠加魔法震荡的效果。"; + public override string Description => $"{Duration} 秒内,增加所有伤害的 {减伤比例 * 100:f2}% 伤害减免,并将普通攻击转为魔法伤害,可叠加魔法震荡的效果。"; public override bool TargetSelf => true; public override bool Durative => true; public override double Duration => 25; @@ -42,22 +42,23 @@ namespace Milimoe.FunGame.Testing.Skills character.NormalAttack.SetMagicType(false, character.MagicType); } - public override void AlterActualDamageAfterCalculation(Character character, Character enemy, ref double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, DamageResult damageResult) + public override bool AlterActualDamageAfterCalculation(Character character, Character enemy, ref double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, DamageResult damageResult) { if (enemy == Skill.Character) { damage = Calculation.Round2Digits(damage * (1 - 实际比例)); } + return false; } - public override void OnSkillCasted(Character actor, List enemys, List teammates, Dictionary others) + public override void OnSkillCasted(Character caster, List enemys, List teammates, Dictionary others) { RemainDuration = Duration; - if (!actor.Effects.Contains(this)) + if (!caster.Effects.Contains(this)) { 实际比例 = 0; - actor.Effects.Add(this); - OnEffectGained(actor); + caster.Effects.Add(this); + OnEffectGained(caster); } } } diff --git a/Library/Skills/QWQAQW/疾风步.cs b/Library/Skills/战技/疾风步.cs similarity index 70% rename from Library/Skills/QWQAQW/疾风步.cs rename to Library/Skills/战技/疾风步.cs index 0d23c1a..017c46c 100644 --- a/Library/Skills/QWQAQW/疾风步.cs +++ b/Library/Skills/战技/疾风步.cs @@ -23,7 +23,7 @@ namespace Milimoe.FunGame.Testing.Skills { public override long Id => Skill.Id; public override string Name => Skill.Name; - public override string Description => $"进入不可选中状态,获得 100 行动速度,提高 15% 闪避率和 15% 暴击率,持续 {Duration} 时间。破隐一击:在持续时间内,首次造成伤害会附加 {Calculation.Round2Digits((1.5 + 1.5 * (Skill.Level - 1)) * 100)}% 敏捷 [ {伤害加成} ] 的强化伤害,并解除不可选中状态。"; + public override string Description => $"进入不可选中状态,获得 100 行动速度,提高 8% 暴击率,持续 {Duration} 时间。破隐一击:在持续时间内,首次造成伤害会附加 {Calculation.Round2Digits((1.5 + 1.5 * (Skill.Level - 1)) * 100)}% 敏捷 [ {伤害加成} ] 的强化伤害,并解除不可选中状态。"; public override bool TargetSelf => true; public override bool Durative => true; public override double Duration => 15 + (2 * (Level - 1)); @@ -46,10 +46,10 @@ namespace Milimoe.FunGame.Testing.Skills public override void OnEffectGained(Character character) { Skill.IsInEffect = true; - character.IsUnselectable = true; + character.CharacterEffectControlTypes.Add(this, [EffectControlType.Unselectable]); + character.UpdateCharacterState(); character.ExSPD += 100; - character.ExEvadeRate += 0.15; - character.ExCritRate += 0.15; + character.ExCritRate += 0.08; } public override void OnEffectLost(Character character) @@ -58,35 +58,37 @@ namespace Milimoe.FunGame.Testing.Skills if (!破隐一击) { // 在没有打出破隐一击的情况下,恢复角色状态 - character.IsUnselectable = false; + character.CharacterEffectControlTypes.Remove(this); + character.UpdateCharacterState(); } character.ExSPD -= 100; - character.ExEvadeRate -= 0.15; - character.ExCritRate -= 0.15; + character.ExCritRate -= 0.08; } - public override void AlterActualDamageAfterCalculation(Character character, Character enemy, ref double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, DamageResult damageResult) + public override bool AlterActualDamageAfterCalculation(Character character, Character enemy, ref double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, DamageResult damageResult) { if (character == Skill.Character && 首次伤害) { 首次伤害 = false; 破隐一击 = true; - character.IsUnselectable = false; + character.CharacterEffectControlTypes.Remove(this); + character.UpdateCharacterState(); double d = 伤害加成; damage = Calculation.Round2Digits(damage + d); WriteLine($"[ {character} ] 触发了疾风步破隐一击,获得了 [ {d} ] 点伤害加成!"); } + return false; } - public override void OnSkillCasted(Character actor, List enemys, List teammates, Dictionary others) + public override void OnSkillCasted(Character caster, List enemys, List teammates, Dictionary others) { - if (!actor.Effects.Contains(this)) + if (!caster.Effects.Contains(this)) { 首次伤害 = true; 破隐一击 = false; RemainDuration = Duration; - actor.Effects.Add(this); - OnEffectGained(actor); + caster.Effects.Add(this); + OnEffectGained(caster); } } } diff --git a/Library/Skills/绿拱门/平衡强化.cs b/Library/Skills/绿拱门/平衡强化.cs new file mode 100644 index 0000000..9415e2e --- /dev/null +++ b/Library/Skills/绿拱门/平衡强化.cs @@ -0,0 +1,90 @@ +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Testing.Skills +{ + public class 平衡强化 : Skill + { + public override long Id => 4011; + public override string Name => "平衡强化"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + + public 平衡强化(Character character) : base(SkillType.Passive, character) + { + Effects.Add(new 平衡强化特效(this)); + } + + public override IEnumerable AddInactiveEffectToCharacter() + { + return Effects; + } + } + + public class 平衡强化特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"敏捷提高20%,然后将目前的力量补充到与敏捷持平,持续30秒。"; + public override bool TargetSelf => true; + + private double 交换前的额外智力 = 0; + private double 交换前的额外力量 = 0; + + public override void OnAttributeChanged(Character character) + { + if (Skill.Character != null) + { + if (Skill.Character.PrimaryAttribute == PrimaryAttribute.INT) + { + double diff = character.ExSTR - 交换前的额外力量; + character.ExINT = 交换前的额外力量 + character.BaseSTR + diff; + } + else if (Skill.Character.PrimaryAttribute == PrimaryAttribute.STR) + { + double diff = character.ExINT - 交换前的额外智力; + character.ExSTR = 交换前的额外智力 + character.BaseINT + diff; + } + } + } + + public override void OnTimeElapsed(Character character, double elapsed) + { + if (Skill.Character != null) + { + Character c = Skill.Character; + if (c.HP < c.MaxHP * 0.3) + { + if (c.PrimaryAttribute == PrimaryAttribute.INT) + { + double pastHP = c.HP; + double pastMaxHP = c.MaxHP; + double pastMP = c.MP; + double pastMaxMP = c.MaxMP; + c.PrimaryAttribute = PrimaryAttribute.STR; + 交换前的额外智力 = c.ExINT; + 交换前的额外力量 = c.ExSTR; + c.ExINT = -c.BaseINT; + c.ExSTR = 交换前的额外智力 + c.BaseINT + 交换前的额外力量; + c.Recovery(pastHP, pastMP, pastMaxHP, pastMaxMP); + } + } + else + { + if (c.PrimaryAttribute == PrimaryAttribute.STR) + { + double pastHP = c.HP; + double pastMaxHP = c.MaxHP; + double pastMP = c.MP; + double pastMaxMP = c.MaxMP; + c.PrimaryAttribute = PrimaryAttribute.INT; + 交换前的额外智力 = c.ExINT; + 交换前的额外力量 = c.ExSTR; + c.ExINT = 交换前的额外力量 + c.BaseSTR + 交换前的额外智力; + c.ExSTR = -c.BaseSTR; + c.Recovery(pastHP, pastMP, pastMaxHP, pastMaxMP); + } + } + } + } + } +} diff --git a/Library/Skills/绿拱门/敏捷之刃.cs b/Library/Skills/绿拱门/敏捷之刃.cs new file mode 100644 index 0000000..802e8a0 --- /dev/null +++ b/Library/Skills/绿拱门/敏捷之刃.cs @@ -0,0 +1,30 @@ +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Testing.Skills +{ + public class 敏捷之刃 : Skill + { + public override long Id => 4011; + public override string Name => "敏捷之刃"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + + public 敏捷之刃(Character character) : base(SkillType.Passive, character) + { + Effects.Add(new 敏捷之刃特效(this)); + } + + public override IEnumerable AddInactiveEffectToCharacter() + { + return Effects; + } + } + + public class 敏捷之刃特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"每次普通攻击都将附带基于敏捷的魔法伤害。"; + public override bool TargetSelf => true; + } +} diff --git a/Library/Skills/马猴烧酒/毁灭之势.cs b/Library/Skills/马猴烧酒/毁灭之势.cs index 3418b10..b4a183f 100644 --- a/Library/Skills/马猴烧酒/毁灭之势.cs +++ b/Library/Skills/马猴烧酒/毁灭之势.cs @@ -1,4 +1,5 @@ -using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Api.Utility; +using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Constant; namespace Milimoe.FunGame.Testing.Skills @@ -24,7 +25,35 @@ namespace Milimoe.FunGame.Testing.Skills { public override long Id => Skill.Id; public override string Name => Skill.Name; - public override string Description => $"每时间提升 2.5% 所有伤害,无上限,但受到伤害时效果清零。"; + public override string Description => $"每时间提升 5.5% 所有伤害,无上限,但受到伤害时效果清零。" + (累计伤害 > 0 ? $"(当前总提升:{累计伤害 * 100:f2}%)" : ""); public override bool TargetSelf => true; + + private readonly double 伤害提升 = 0.055; + private double 累计伤害 = 0; + + public override bool AlterActualDamageAfterCalculation(Character character, Character enemy, ref double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, DamageResult damageResult) + { + if (damageResult != DamageResult.Evaded) + { + if (enemy == Skill.Character && damage > 0 && !enemy.Effects.Where(e => e is 绝对领域特效).Any()) + { + 累计伤害 = 0; + } + + if (character == Skill.Character) + { + double 实际伤害提升 = Calculation.Round2Digits(damage * 累计伤害); + damage = Calculation.Round2Digits(damage + 实际伤害提升); + if (实际伤害提升 > 0) WriteLine($"[ {character} ] 的伤害提升了 {实际伤害提升} 点!"); + } + } + return false; + } + + public override void OnTimeElapsed(Character character, double eapsed) + { + 累计伤害 = Calculation.Round4Digits(累计伤害 + 伤害提升 * eapsed); + WriteLine($"[ {character} ] 的 [ {Name} ] 效果增加了,当前总提升:{累计伤害 * 100:f2}%。"); + } } } diff --git a/Library/Skills/马猴烧酒/绝对领域.cs b/Library/Skills/马猴烧酒/绝对领域.cs new file mode 100644 index 0000000..c2bf02a --- /dev/null +++ b/Library/Skills/马猴烧酒/绝对领域.cs @@ -0,0 +1,74 @@ +using Milimoe.FunGame.Core.Api.Utility; +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Testing.Skills +{ + public class 绝对领域 : Skill + { + public override long Id => 3007; + public override string Name => "绝对领域"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override double EPCost => Math.Max(100, Character?.EP ?? 100); + public override double CD => 32; + public override double HardnessTime => 12; + + public 绝对领域(Character character) : base(SkillType.SuperSkill, character) + { + Effects.Add(new 绝对领域特效(this)); + } + } + + public class 绝对领域特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"{Duration} 时间内无法受到任何伤害,且敏捷提升 {系数 * 100:f2}% [ {敏捷提升} ]。此技能会消耗至少 100 点能量。"; + public override bool TargetSelf => true; + public override bool Durative => true; + public override double Duration => Calculation.Round2Digits(20 + 释放时的能量值 * 0.03); + + private double 系数 => Calculation.Round4Digits(0.3 + 0.04 * (Level - 1)); + private double 敏捷提升 => Calculation.Round2Digits(系数 * Skill.Character?.BaseAGI ?? 0); + private double 实际敏捷提升 = 0; + private double 释放时的能量值 = 0; + + public override void OnEffectGained(Character character) + { + 实际敏捷提升 = 敏捷提升; + character.ExAGI += 实际敏捷提升; + WriteLine($"[ {character} ] 的敏捷提升了 {系数 * 100:f2}% [ {实际敏捷提升} ] !"); + } + + public override void OnEffectLost(Character character) + { + character.ExAGI -= 实际敏捷提升; + } + + public override bool AlterActualDamageAfterCalculation(Character character, Character enemy, ref double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, DamageResult damageResult) + { + if (enemy == Skill.Character && damageResult != DamageResult.Evaded) + { + WriteLine($"[ {enemy} ] 发动了绝对领域,巧妙的化解了此伤害!"); + return true; + } + return false; + } + + public override void OnSkillCasting(Character caster) + { + 释放时的能量值 = caster.EP; + } + + public override void OnSkillCasted(Character caster, List enemys, List teammates, Dictionary others) + { + RemainDuration = Duration; + if (!caster.Effects.Contains(this)) + { + 实际敏捷提升 = 0; + caster.Effects.Add(this); + OnEffectGained(caster); + } + } + } +} diff --git a/Library/Skills/马猴烧酒/冰霜攻击.cs b/Library/Skills/魔法/冰霜攻击.cs similarity index 79% rename from Library/Skills/马猴烧酒/冰霜攻击.cs rename to Library/Skills/魔法/冰霜攻击.cs index 9148a38..66eff5b 100644 --- a/Library/Skills/马猴烧酒/冰霜攻击.cs +++ b/Library/Skills/魔法/冰霜攻击.cs @@ -25,7 +25,7 @@ namespace Milimoe.FunGame.Testing.Skills { public override long Id => Skill.Id; public override string Name => Skill.Name; - public override string Description => $"对目标敌人造成 {Calculation.Round2Digits(90 + 60 * (Skill.Level - 1))} + {Calculation.Round2Digits((1.2 + 1.8 * (Skill.Level - 1)) * 100)}%智力 [ {Damage} ] 点{CharacterSet.GetMagicName(MagicType)}。"; + public override string Description => $"对目标敌人造成 {Calculation.Round2Digits(90 + 60 * (Skill.Level - 1))} + {Calculation.Round2Digits((1.2 + 1.8 * (Skill.Level - 1)) * 100)}% 智力 [ {Damage} ] 点{CharacterSet.GetMagicName(MagicType)}。"; public override bool TargetSelf => false; public override int TargetCount => 1; @@ -42,10 +42,13 @@ namespace Milimoe.FunGame.Testing.Skills } } - public override void OnSkillCasted(Character actor, List enemys, List teammates, Dictionary others) + public override void OnSkillCasted(Character caster, List enemys, List teammates, Dictionary others) { - Character enemy = enemys[new Random().Next(enemys.Count)]; - DamageToEnemy(actor, enemy, true, MagicType, Damage); + if (enemys.Count > 0) + { + Character enemy = enemys[new Random().Next(enemys.Count)]; + DamageToEnemy(caster, enemy, true, MagicType, Damage); + } } } } diff --git a/Library/Solutions/TestModule.cs b/Library/Solutions/TestModule.cs index 29c51bd..a03a53b 100644 --- a/Library/Solutions/TestModule.cs +++ b/Library/Solutions/TestModule.cs @@ -48,9 +48,6 @@ namespace Addons get { List list = []; - Skill s = Factory.GetSkill(); - s.Name = "Example Skill"; - list.Add(s); return list; } } From 6ce313e7c08c79f4f5162cb7e082553313c8b24a Mon Sep 17 00:00:00 2001 From: milimoe Date: Fri, 13 Sep 2024 00:01:08 +0800 Subject: [PATCH 09/15] =?UTF-8?q?=E8=BF=9B=E5=BA=A6=2012/12?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Library/Characters/Characters.cs | 2 +- Library/Main.cs | 35 +++++-- .../ColdBlue/{嗜血标记.cs => 嗜血本能.cs} | 12 +-- Library/Skills/ColdBlue/累积之压.cs | 4 +- Library/Skills/NanGanyu/三重叠加.cs | 4 +- Library/Skills/NanGanyu/灵能反射.cs | 25 ++++- Library/Skills/QWQAQW/玻璃大炮.cs | 9 +- Library/Skills/QingXiang/枯竭打击.cs | 2 +- Library/Skills/QuDuoduo/弱者猎手.cs | 26 ++++- Library/Skills/QuDuoduo/血之狂欢.cs | 78 ++++----------- Library/Skills/战技/疾风步.cs | 2 +- Library/Skills/绿拱门/平衡强化.cs | 96 ++++++++----------- Library/Skills/绿拱门/敏捷之刃.cs | 24 ++++- Library/Skills/马猴烧酒/绝对领域.cs | 6 +- 14 files changed, 175 insertions(+), 150 deletions(-) rename Library/Skills/ColdBlue/{嗜血标记.cs => 嗜血本能.cs} (88%) diff --git a/Library/Characters/Characters.cs b/Library/Characters/Characters.cs index f0eafe2..2fb6982 100644 --- a/Library/Characters/Characters.cs +++ b/Library/Characters/Characters.cs @@ -16,7 +16,7 @@ namespace FunGame.Testing.Characters c.NickName = "大島シヤ"; c.PrimaryAttribute = PrimaryAttribute.STR; c.InitialATK = 25; - c.InitialHP = 160; + c.InitialHP = 145; c.InitialMP = 10; c.InitialSTR = 35; c.STRGrowth = 3.5; diff --git a/Library/Main.cs b/Library/Main.cs index 2feafc3..9184608 100644 --- a/Library/Main.cs +++ b/Library/Main.cs @@ -257,22 +257,41 @@ if (list.Count > 3) }; c.Skills.Add(累积之压); - Skill 嗜血标记 = new 嗜血标记(c) + Skill 嗜血本能 = new 嗜血本能(c) { Level = slevel }; - c.Skills.Add(嗜血标记); + c.Skills.Add(嗜血本能); } - - if (c != character1 && c != character2 && c != character3 && c != character4 && - c != character5 && c != character6 && c != character7 && c != character8 && - c != character9 && c != character10) //&& c != character11 && c != character12) + + if (c == character11) { - Skill 天赐之力 = new 天赐之力(c) + Skill 敏捷之刃 = new 敏捷之刃(c) + { + Level = 1 + }; + c.Skills.Add(敏捷之刃); + + Skill 平衡强化 = new 平衡强化(c) { Level = slevel }; - c.Skills.Add(天赐之力); + c.Skills.Add(平衡强化); + } + + if (c == character12) + { + Skill 弱者猎手 = new 弱者猎手(c) + { + Level = 1 + }; + c.Skills.Add(弱者猎手); + + Skill 血之狂欢 = new 血之狂欢(c) + { + Level = slevel + }; + c.Skills.Add(血之狂欢); } } diff --git a/Library/Skills/ColdBlue/嗜血标记.cs b/Library/Skills/ColdBlue/嗜血本能.cs similarity index 88% rename from Library/Skills/ColdBlue/嗜血标记.cs rename to Library/Skills/ColdBlue/嗜血本能.cs index 59c7f60..cb7f246 100644 --- a/Library/Skills/ColdBlue/嗜血标记.cs +++ b/Library/Skills/ColdBlue/嗜血本能.cs @@ -5,22 +5,22 @@ using Milimoe.FunGame.Testing.Effects; namespace Milimoe.FunGame.Testing.Skills { - public class 嗜血标记 : Skill + public class 嗜血本能 : Skill { public override long Id => 3010; - public override string Name => "嗜血标记"; + public override string Name => "嗜血本能"; public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; public override double EPCost => 100; public override double CD => 42 - 1 * (Level - 1); public override double HardnessTime => 12; - public 嗜血标记(Character character) : base(SkillType.SuperSkill, character) + public 嗜血本能(Character character) : base(SkillType.SuperSkill, character) { - Effects.Add(new 嗜血标记特效(this)); + Effects.Add(new 嗜血本能特效(this)); } } - public class 嗜血标记特效(Skill skill) : Effect(skill) + public class 嗜血本能特效(Skill skill) : Effect(skill) { public override long Id => Skill.Id; public override string Name => Skill.Name; @@ -45,7 +45,7 @@ namespace Milimoe.FunGame.Testing.Skills { 层数 = 4; } - double 实际吸血 = Calculation.Round2Digits(吸血 * damage); + double 实际吸血 = Calculation.Round2Digits(吸血 * 层数 * damage); character.HP += 实际吸血; WriteLine($"[ {character} ] 回复了 {实际吸血} 点生命值!"); } diff --git a/Library/Skills/ColdBlue/累积之压.cs b/Library/Skills/ColdBlue/累积之压.cs index c5e1e30..72b9b9c 100644 --- a/Library/Skills/ColdBlue/累积之压.cs +++ b/Library/Skills/ColdBlue/累积之压.cs @@ -41,8 +41,8 @@ namespace Milimoe.FunGame.Testing.Skills if (effects.Any() && effects.First() is 累积之压标记 e) { e.MarkLevel++; - IEnumerable effects2 = character.Effects.Where(e => e is 嗜血标记特效); - if (effects2.Any() && effects2.First() is 嗜血标记特效 e2) + IEnumerable effects2 = character.Effects.Where(e => e is 嗜血本能特效); + if (effects2.Any() && effects2.First() is 嗜血本能特效 e2) { if (e.MarkLevel >= 4) { diff --git a/Library/Skills/NanGanyu/三重叠加.cs b/Library/Skills/NanGanyu/三重叠加.cs index a3b910f..9fd2114 100644 --- a/Library/Skills/NanGanyu/三重叠加.cs +++ b/Library/Skills/NanGanyu/三重叠加.cs @@ -22,7 +22,7 @@ namespace Milimoe.FunGame.Testing.Skills { public override long Id => Skill.Id; public override string Name => "三重叠加"; - public override string Description => $"使 [ 灵能反射 ] 的当前释放魔法次数归零,并且最大消除次数提高到 {灵能反射次数},并且在魔法命中时能够回复所回复能量值的 10 倍魔法值,持续 {技能持续次数} 次(灵能反射每消除次数达到最大时算一次)。" + + public override string Description => $"使 [ 灵能反射 ] 支持普通攻击,且当前释放魔法次数归零,最大硬直消除次数提高到 {灵能反射次数} 次;在魔法命中和普通攻击命中时能够回复所回复能量值的 10 倍魔法值,持续 {技能持续次数} 次(灵能反射每消除次数达到最大时算一次)。" + $"(剩余:{剩余持续次数} 次)"; public override bool TargetSelf => true; @@ -35,6 +35,7 @@ namespace Milimoe.FunGame.Testing.Skills IEnumerable effects = character.Effects.Where(e => e is 灵能反射特效); if (effects.Any() && effects.First() is 灵能反射特效 e) { + e.是否支持普攻 = true; e.触发硬直次数 = 3; e.释放次数 = 0; } @@ -45,6 +46,7 @@ namespace Milimoe.FunGame.Testing.Skills IEnumerable effects = character.Effects.Where(e => e is 灵能反射特效); if (effects.Any() && effects.First() is 灵能反射特效 e) { + e.是否支持普攻 = false; e.触发硬直次数 = 2; } } diff --git a/Library/Skills/NanGanyu/灵能反射.cs b/Library/Skills/NanGanyu/灵能反射.cs index de83737..79a9582 100644 --- a/Library/Skills/NanGanyu/灵能反射.cs +++ b/Library/Skills/NanGanyu/灵能反射.cs @@ -25,9 +25,10 @@ namespace Milimoe.FunGame.Testing.Skills { public override long Id => Skill.Id; public override string Name => Skill.Name; - public override string Description => $"每释放 {触发硬直次数} 次魔法才会触发硬直时间,且魔法命中时基于 25% 智力 [{获得额外能量值}] 获得额外能量值。"; + public override string Description => $"每释放 {触发硬直次数} 次魔法才会触发硬直时间,且魔法命中时基于 25% 智力 [ {获得额外能量值} ] 获得额外能量值。"; public override bool TargetSelf => true; + public bool 是否支持普攻 { get; set; } = false; public int 触发硬直次数 { get; set; } = 2; public int 释放次数 { get; set; } = 0; public double 获得额外能量值 @@ -40,7 +41,7 @@ namespace Milimoe.FunGame.Testing.Skills public override void AfterDamageCalculation(Character character, Character enemy, double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, DamageResult damageResult) { - if (character == Skill.Character && isMagicDamage && damageResult != DamageResult.Evaded && character.EP < 200) + if (character == Skill.Character && (是否支持普攻 && isNormalAttack || isMagicDamage) && damageResult != DamageResult.Evaded && character.EP < 200) { double 实际获得能量值 = 获得额外能量值; character.EP += 实际获得能量值; @@ -55,12 +56,29 @@ namespace Milimoe.FunGame.Testing.Skills } } - public override void AlterHardnessTimeAfterCastSkill(Character character, ref double baseHardnessTime, ref bool isCheckProtected) + public override void AlterHardnessTimeAfterNormalAttack(Character character, ref double baseHardnessTime, ref bool isCheckProtected) + { + if (是否支持普攻) + { + AlterHardnessTime(character, ref baseHardnessTime, ref isCheckProtected); + } + } + + public override void AlterHardnessTimeAfterCastSkill(Character character, Skill skill, ref double baseHardnessTime, ref bool isCheckProtected) + { + if (skill.SkillType == SkillType.Magic) + { + AlterHardnessTime(character, ref baseHardnessTime, ref isCheckProtected); + } + } + + public void AlterHardnessTime(Character character, ref double baseHardnessTime, ref bool isCheckProtected) { 释放次数++; if (释放次数 < 触发硬直次数) { baseHardnessTime = 0; + isCheckProtected = false; WriteLine($"[ {character} ] 发动了灵能反射,消除了硬直时间!!"); } else @@ -70,6 +88,7 @@ namespace Milimoe.FunGame.Testing.Skills if (effects.Any() && effects.First() is 三重叠加特效 e) { baseHardnessTime = 0; + isCheckProtected = false; WriteLine($"[ {character} ] 发动了灵能反射,消除了硬直时间!!"); e.剩余持续次数--; if (e.剩余持续次数 == 0) diff --git a/Library/Skills/QWQAQW/玻璃大炮.cs b/Library/Skills/QWQAQW/玻璃大炮.cs index 2863dbb..50a83a7 100644 --- a/Library/Skills/QWQAQW/玻璃大炮.cs +++ b/Library/Skills/QWQAQW/玻璃大炮.cs @@ -25,7 +25,7 @@ namespace Milimoe.FunGame.Testing.Skills { public override long Id => Skill.Id; public override string Name => Skill.Name; - public override string Description => $"生命值高于30%时,受到额外的 [ 20~40% ] 伤害,但是获得 [ 上次所受伤害的 80% ] 伤害加成;生命值低于等于30%时,不会受到额外的伤害,但是仅能获得 [ 上次所受伤害的 30% ] 伤害加成。" + + public override string Description => $"生命值高于30%时,受到额外的 [ 20~40% ] 伤害,但是获得 [ 上次所受伤害的 110~140% ] 伤害加成;生命值低于等于30%时,不会受到额外的伤害,仅能获得 [ 上次所受伤害的 35% ] 伤害加成。" + $"在没有受到任何伤害的时候,将获得 {常规伤害加成 * 100:f2}% 伤害加成。(当前伤害加成:{伤害加成 * 100:f2}%)"; public override bool TargetSelf => true; @@ -33,8 +33,9 @@ namespace Milimoe.FunGame.Testing.Skills private double 这次的伤害加成 = 0; private double 这次受到的额外伤害 = 0; private readonly double 常规伤害加成 = 0.2; - private readonly double 高于30的加成 = 0.8; - private readonly double 低于30的加成 = 0.3; + private readonly int 高于30的加成上限 = 40; + private readonly int 高于30的加成下限 = 10; + private readonly double 低于30的加成 = 0.35; private double 伤害加成 { @@ -47,7 +48,7 @@ namespace Milimoe.FunGame.Testing.Skills { if (character.HP > character.MaxHP * 0.3) { - 系数 = 高于30的加成; + 系数 = Calculation.Round2Digits(1.0 + ((new Random().Next(高于30的加成下限, 高于30的加成上限) + 0.0) / 100)); } else { diff --git a/Library/Skills/QingXiang/枯竭打击.cs b/Library/Skills/QingXiang/枯竭打击.cs index b603f2e..28b414b 100644 --- a/Library/Skills/QingXiang/枯竭打击.cs +++ b/Library/Skills/QingXiang/枯竭打击.cs @@ -38,7 +38,7 @@ namespace Milimoe.FunGame.Testing.Skills double EP = new Random().Next(10, 25); enemy.EP -= EP; WriteLine($"[ {character} ] 发动了枯竭打击![ {enemy} ] 的能量值被减少了 {EP} 点!现有能量:{enemy.EP}。"); - // 伤害提升 + // 额外伤害 if (enemy.EP >= 0 && enemy.EP < 50 || enemy.EP >= 100 && enemy.EP < 150) { double 额外伤害 = Calculation.Round2Digits(damage * 0.3); diff --git a/Library/Skills/QuDuoduo/弱者猎手.cs b/Library/Skills/QuDuoduo/弱者猎手.cs index 7cb13a8..7c30379 100644 --- a/Library/Skills/QuDuoduo/弱者猎手.cs +++ b/Library/Skills/QuDuoduo/弱者猎手.cs @@ -1,4 +1,5 @@ -using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Api.Utility; +using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Constant; namespace Milimoe.FunGame.Testing.Skills @@ -24,7 +25,28 @@ namespace Milimoe.FunGame.Testing.Skills { public override long Id => Skill.Id; public override string Name => Skill.Name; - public override string Description => $"优先攻击血量更低的角色,对生命值低于自己的角色造成150%伤害。"; + public override string Description => $"优先攻击血量更低的角色,对生命值百分比低于自己的角色造成 150% 伤害。"; public override bool TargetSelf => true; + + public override void AlterExpectedDamageBeforeCalculation(Character character, Character enemy, ref double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType) + { + if (character == Skill.Character && (enemy.HP / enemy.MaxHP) <= (character.HP / character.MaxHP)) + { + double 额外伤害 = Calculation.Round2Digits(damage * 1.5); + damage = Calculation.Round2Digits(damage + 额外伤害); + } + } + + public override bool AlterEnemyListBeforeAction(Character character, List enemys, List teammates, List skills, Dictionary continuousKilling, Dictionary earnedMoney) + { + IEnumerable list = [.. enemys.OrderBy(e => Calculation.Round4Digits(e.HP / e.MaxHP))]; + if (list.Any()) + { + enemys.Clear(); + enemys.Add(list.First()); + WriteLine($"[ {character} ] 发动了弱者猎手![ {list.First()} ] 被盯上了!"); + } + return true; + } } } diff --git a/Library/Skills/QuDuoduo/血之狂欢.cs b/Library/Skills/QuDuoduo/血之狂欢.cs index 55b2fa3..991a178 100644 --- a/Library/Skills/QuDuoduo/血之狂欢.cs +++ b/Library/Skills/QuDuoduo/血之狂欢.cs @@ -1,5 +1,7 @@ -using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Api.Utility; +using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Constant; +using Milimoe.FunGame.Testing.Effects; namespace Milimoe.FunGame.Testing.Skills { @@ -8,82 +10,42 @@ namespace Milimoe.FunGame.Testing.Skills public override long Id => 4012; public override string Name => "血之狂欢"; public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override double EPCost => 100; + public override double CD => 45; + public override double HardnessTime => 7; - public 血之狂欢(Character character) : base(SkillType.Passive, character) + public 血之狂欢(Character character) : base(SkillType.SuperSkill, character) { Effects.Add(new 血之狂欢特效(this)); } - - public override IEnumerable AddInactiveEffectToCharacter() - { - return Effects; - } } public class 血之狂欢特效(Skill skill) : Effect(skill) { public override long Id => Skill.Id; public override string Name => Skill.Name; - public override string Description => $"30秒内,获得50%吸血。"; + public override string Description => $"获得 40% 吸血,持续 {Duration} 时间。"; public override bool TargetSelf => true; + public override bool Durative => true; + public override double Duration => 30; - private double 交换前的额外智力 = 0; - private double 交换前的额外力量 = 0; - - public override void OnAttributeChanged(Character character) + public override void AfterDamageCalculation(Character character, Character enemy, double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, DamageResult damageResult) { - if (Skill.Character != null) + if (character == Skill.Character && damageResult != DamageResult.Evaded && character.HP < character.MaxHP) { - if (Skill.Character.PrimaryAttribute == PrimaryAttribute.INT) - { - double diff = character.ExSTR - 交换前的额外力量; - character.ExINT = 交换前的额外力量 + character.BaseSTR + diff; - } - else if (Skill.Character.PrimaryAttribute == PrimaryAttribute.STR) - { - double diff = character.ExINT - 交换前的额外智力; - character.ExSTR = 交换前的额外智力 + character.BaseINT + diff; - } + double 实际吸血 = Calculation.Round2Digits(0.4 * damage); + character.HP += 实际吸血; + WriteLine($"[ {character} ] 回复了 {实际吸血} 点生命值!"); } } - public override void OnTimeElapsed(Character character, double elapsed) + public override void OnSkillCasted(Character caster, List enemys, List teammates, Dictionary others) { - if (Skill.Character != null) + RemainDuration = Duration; + if (!caster.Effects.Contains(this)) { - Character c = Skill.Character; - if (c.HP < c.MaxHP * 0.3) - { - if (c.PrimaryAttribute == PrimaryAttribute.INT) - { - double pastHP = c.HP; - double pastMaxHP = c.MaxHP; - double pastMP = c.MP; - double pastMaxMP = c.MaxMP; - c.PrimaryAttribute = PrimaryAttribute.STR; - 交换前的额外智力 = c.ExINT; - 交换前的额外力量 = c.ExSTR; - c.ExINT = -c.BaseINT; - c.ExSTR = 交换前的额外智力 + c.BaseINT + 交换前的额外力量; - c.Recovery(pastHP, pastMP, pastMaxHP, pastMaxMP); - } - } - else - { - if (c.PrimaryAttribute == PrimaryAttribute.STR) - { - double pastHP = c.HP; - double pastMaxHP = c.MaxHP; - double pastMP = c.MP; - double pastMaxMP = c.MaxMP; - c.PrimaryAttribute = PrimaryAttribute.INT; - 交换前的额外智力 = c.ExINT; - 交换前的额外力量 = c.ExSTR; - c.ExINT = 交换前的额外力量 + c.BaseSTR + 交换前的额外智力; - c.ExSTR = -c.BaseSTR; - c.Recovery(pastHP, pastMP, pastMaxHP, pastMaxMP); - } - } + caster.Effects.Add(this); + OnEffectGained(caster); } } } diff --git a/Library/Skills/战技/疾风步.cs b/Library/Skills/战技/疾风步.cs index 017c46c..9627bae 100644 --- a/Library/Skills/战技/疾风步.cs +++ b/Library/Skills/战技/疾风步.cs @@ -26,7 +26,7 @@ namespace Milimoe.FunGame.Testing.Skills public override string Description => $"进入不可选中状态,获得 100 行动速度,提高 8% 暴击率,持续 {Duration} 时间。破隐一击:在持续时间内,首次造成伤害会附加 {Calculation.Round2Digits((1.5 + 1.5 * (Skill.Level - 1)) * 100)}% 敏捷 [ {伤害加成} ] 的强化伤害,并解除不可选中状态。"; public override bool TargetSelf => true; public override bool Durative => true; - public override double Duration => 15 + (2 * (Level - 1)); + public override double Duration => 12 + (1 * (Level - 1)); private double 伤害加成 { diff --git a/Library/Skills/绿拱门/平衡强化.cs b/Library/Skills/绿拱门/平衡强化.cs index 9415e2e..cb0941b 100644 --- a/Library/Skills/绿拱门/平衡强化.cs +++ b/Library/Skills/绿拱门/平衡强化.cs @@ -8,82 +8,62 @@ namespace Milimoe.FunGame.Testing.Skills public override long Id => 4011; public override string Name => "平衡强化"; public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override double EPCost => 100; + public override double CD => 55 - (1 * (Level - 1)); + public override double HardnessTime => 12; - public 平衡强化(Character character) : base(SkillType.Passive, character) + public 平衡强化(Character character) : base(SkillType.SuperSkill, character) { Effects.Add(new 平衡强化特效(this)); } - - public override IEnumerable AddInactiveEffectToCharacter() - { - return Effects; - } } public class 平衡强化特效(Skill skill) : Effect(skill) { public override long Id => Skill.Id; public override string Name => Skill.Name; - public override string Description => $"敏捷提高20%,然后将目前的力量补充到与敏捷持平,持续30秒。"; + public override string Description => $"敏捷提高 20%,然后将目前的力量补充到与敏捷持平,持续 {Duration} 时间。"; public override bool TargetSelf => true; + public override bool Durative => true; + public override double Duration => 30; - private double 交换前的额外智力 = 0; - private double 交换前的额外力量 = 0; + private double 本次提升的敏捷 = 0; + private double 本次提升的力量 = 0; - public override void OnAttributeChanged(Character character) + public override void OnEffectGained(Character character) { - if (Skill.Character != null) - { - if (Skill.Character.PrimaryAttribute == PrimaryAttribute.INT) - { - double diff = character.ExSTR - 交换前的额外力量; - character.ExINT = 交换前的额外力量 + character.BaseSTR + diff; - } - else if (Skill.Character.PrimaryAttribute == PrimaryAttribute.STR) - { - double diff = character.ExINT - 交换前的额外智力; - character.ExSTR = 交换前的额外智力 + character.BaseINT + diff; - } - } + double pastHP = character.HP; + double pastMaxHP = character.MaxHP; + double pastMP = character.MP; + double pastMaxMP = character.MaxMP; + 本次提升的敏捷 = character.BaseAGI * 0.2; + character.ExAGI += 本次提升的敏捷; + 本次提升的力量 = character.AGI - character.STR; + character.ExSTR += 本次提升的力量; + character.Recovery(pastHP, pastMP, pastMaxHP, pastMaxMP); + WriteLine($"[ {character} ] 敏捷提升了 {本次提升的敏捷:f2},力量提升了 {本次提升的力量:f2}!"); } - public override void OnTimeElapsed(Character character, double elapsed) + public override void OnEffectLost(Character character) { - if (Skill.Character != null) + double pastHP = character.HP; + double pastMaxHP = character.MaxHP; + double pastMP = character.MP; + double pastMaxMP = character.MaxMP; + character.ExAGI -= character.BaseAGI * 0.2; + character.ExSTR -= 本次提升的力量; + character.Recovery(pastHP, pastMP, pastMaxHP, pastMaxMP); + } + + public override void OnSkillCasted(Character caster, List enemys, List teammates, Dictionary others) + { + RemainDuration = Duration; + if (!caster.Effects.Contains(this)) { - Character c = Skill.Character; - if (c.HP < c.MaxHP * 0.3) - { - if (c.PrimaryAttribute == PrimaryAttribute.INT) - { - double pastHP = c.HP; - double pastMaxHP = c.MaxHP; - double pastMP = c.MP; - double pastMaxMP = c.MaxMP; - c.PrimaryAttribute = PrimaryAttribute.STR; - 交换前的额外智力 = c.ExINT; - 交换前的额外力量 = c.ExSTR; - c.ExINT = -c.BaseINT; - c.ExSTR = 交换前的额外智力 + c.BaseINT + 交换前的额外力量; - c.Recovery(pastHP, pastMP, pastMaxHP, pastMaxMP); - } - } - else - { - if (c.PrimaryAttribute == PrimaryAttribute.STR) - { - double pastHP = c.HP; - double pastMaxHP = c.MaxHP; - double pastMP = c.MP; - double pastMaxMP = c.MaxMP; - c.PrimaryAttribute = PrimaryAttribute.INT; - 交换前的额外智力 = c.ExINT; - 交换前的额外力量 = c.ExSTR; - c.ExINT = 交换前的额外力量 + c.BaseSTR + 交换前的额外智力; - c.ExSTR = -c.BaseSTR; - c.Recovery(pastHP, pastMP, pastMaxHP, pastMaxMP); - } - } + 本次提升的敏捷 = 0; + 本次提升的力量 = 0; + caster.Effects.Add(this); + OnEffectGained(caster); } } } diff --git a/Library/Skills/绿拱门/敏捷之刃.cs b/Library/Skills/绿拱门/敏捷之刃.cs index 802e8a0..2e7fba6 100644 --- a/Library/Skills/绿拱门/敏捷之刃.cs +++ b/Library/Skills/绿拱门/敏捷之刃.cs @@ -1,4 +1,5 @@ -using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Api.Utility; +using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Constant; namespace Milimoe.FunGame.Testing.Skills @@ -24,7 +25,26 @@ namespace Milimoe.FunGame.Testing.Skills { public override long Id => Skill.Id; public override string Name => Skill.Name; - public override string Description => $"每次普通攻击都将附带基于敏捷的魔法伤害。"; + public override string Description => $"每次普通攻击都将附带基于 {敏捷系数 * 100:f2}% 敏捷 [ {敏捷伤害} ] 的魔法伤害。"; public override bool TargetSelf => true; + + private double 敏捷伤害 => Calculation.Round2Digits(敏捷系数 * Skill.Character?.AGI ?? 0); + private readonly double 敏捷系数 = 2.5; + private bool 是否是嵌套伤害 = false; + + public override void AfterDamageCalculation(Character character, Character enemy, double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, DamageResult damageResult) + { + if (character == Skill.Character && isNormalAttack && damageResult != DamageResult.Evaded && !是否是嵌套伤害) + { + WriteLine($"[ {character} ] 发动了敏捷之刃!将造成额外伤害!"); + 是否是嵌套伤害 = true; + DamageToEnemy(character, enemy, true, magicType, 敏捷伤害); + } + + if (character == Skill.Character && 是否是嵌套伤害) + { + 是否是嵌套伤害 = false; + } + } } } diff --git a/Library/Skills/马猴烧酒/绝对领域.cs b/Library/Skills/马猴烧酒/绝对领域.cs index c2bf02a..577735f 100644 --- a/Library/Skills/马猴烧酒/绝对领域.cs +++ b/Library/Skills/马猴烧酒/绝对领域.cs @@ -10,7 +10,7 @@ namespace Milimoe.FunGame.Testing.Skills public override string Name => "绝对领域"; public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; public override double EPCost => Math.Max(100, Character?.EP ?? 100); - public override double CD => 32; + public override double CD => 32 + (1 * (Level - 1)); public override double HardnessTime => 12; public 绝对领域(Character character) : base(SkillType.SuperSkill, character) @@ -26,9 +26,9 @@ namespace Milimoe.FunGame.Testing.Skills public override string Description => $"{Duration} 时间内无法受到任何伤害,且敏捷提升 {系数 * 100:f2}% [ {敏捷提升} ]。此技能会消耗至少 100 点能量。"; public override bool TargetSelf => true; public override bool Durative => true; - public override double Duration => Calculation.Round2Digits(20 + 释放时的能量值 * 0.03); + public override double Duration => Calculation.Round2Digits(16 + 释放时的能量值 * 0.03); - private double 系数 => Calculation.Round4Digits(0.3 + 0.04 * (Level - 1)); + private double 系数 => Calculation.Round4Digits(0.3 + 0.03 * (Level - 1)); private double 敏捷提升 => Calculation.Round2Digits(系数 * Skill.Character?.BaseAGI ?? 0); private double 实际敏捷提升 = 0; private double 释放时的能量值 = 0; From 1972867e732683dc38bd1f16161d9a16d7c066de Mon Sep 17 00:00:00 2001 From: milimoe Date: Fri, 13 Sep 2024 01:44:58 +0800 Subject: [PATCH 10/15] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Library/Main.cs | 358 +--------------------------------- Library/Tests/FunGame.cs | 411 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 413 insertions(+), 356 deletions(-) create mode 100644 Library/Tests/FunGame.cs diff --git a/Library/Main.cs b/Library/Main.cs index 9184608..27018fd 100644 --- a/Library/Main.cs +++ b/Library/Main.cs @@ -1,359 +1,5 @@ -using Milimoe.FunGame.Core.Api.Utility; -using Milimoe.FunGame.Core.Entity; -using Milimoe.FunGame.Core.Library.Common.Addon; -using Milimoe.FunGame.Core.Library.Common.Event; -using Milimoe.FunGame.Core.Library.Constant; -using Milimoe.FunGame.Testing.Skills; +using FunGame.Testing.Tests; -PluginLoader plugins = PluginLoader.LoadPlugins([]); -foreach (string plugin in plugins.Plugins.Keys) -{ - Console.WriteLine(plugin + " is loaded."); -} - -Dictionary plugindllsha512 = []; -foreach (string pfp in PluginLoader.PluginFilePaths.Keys) -{ - string text = Encryption.FileSha512(PluginLoader.PluginFilePaths[pfp]); - plugindllsha512.Add(pfp, text); - Console.WriteLine(pfp + $" is {text}."); -} - -LoginEventArgs e = new(); -plugins.OnBeforeLoginEvent(plugins, e); -if (!e.Cancel) -{ - plugins.OnSucceedLoginEvent(plugins, e); - plugins.OnFailedLoginEvent(plugins, e); -} -plugins.OnAfterLoginEvent(plugins, e); - -List list = []; - -GameModuleLoader modules = GameModuleLoader.LoadGameModules(FunGameInfo.FunGame.FunGame_Desktop, []); -foreach (CharacterModule cm in modules.Characters.Values) -{ - foreach (Character c in cm.Characters) - { - Console.WriteLine(c.Name); - list.Add(c); - } -} - -Dictionary moduledllsha512 = []; -foreach (string mfp in GameModuleLoader.ModuleFilePaths.Keys) -{ - string text = Encryption.FileSha512(GameModuleLoader.ModuleFilePaths[mfp]); - moduledllsha512.Add(mfp, text); - Console.WriteLine(mfp + $" is {text}."); -} - -foreach (string moduledll in moduledllsha512.Keys) -{ - string server = moduledllsha512[moduledll]; - if (plugindllsha512.TryGetValue(moduledll, out string? client) && client != "" && server == client) - { - Console.WriteLine(moduledll + $" is checked pass."); - } -} - -// M = 0, W = 7, P1 = 1, P3 = 1 -// M = 1, W = 6, P1 = 2, P3 = 0 -// M = 2, W = 4, P1 = 0, P3 = 2 -// M = 2, W = 5, P1 = 0, P3 = 0 -// M = 3, W = 3, P1 = 1, P3 = 1 -// M = 4, W = 2, P1 = 2, P3 = 0 -// M = 5, W = 0, P1 = 0, P3 = 2 -// M = 5, W = 1, P1 = 0, P3 = 0 - -if (list.Count > 3) -{ - Console.WriteLine(); - Console.WriteLine("Start!!!"); - Console.WriteLine(); - - Character character1 = list[0].Copy(); - Character character2 = list[1].Copy(); - Character character3 = list[2].Copy(); - Character character4 = list[3].Copy(); - Character character5 = list[4].Copy(); - Character character6 = list[5].Copy(); - Character character7 = list[6].Copy(); - Character character8 = list[7].Copy(); - Character character9 = list[8].Copy(); - Character character10 = list[9].Copy(); - Character character11 = list[10].Copy(); - Character character12 = list[11].Copy(); - - List characters = [ - character1, character2, character3, character4, - character5, character6, character7, character8, - character9, character10, character11, character12 - ]; - - int clevel = 60; - int slevel = 6; - int mlevel = 8; - - // 升级和赋能 - for (int index = 0; index < characters.Count; index++) - { - Character c = characters[index]; - c.Level = clevel; - c.NormalAttack.Level = mlevel; - - Skill 冰霜攻击 = new 冰霜攻击(c) - { - Level = mlevel - }; - c.Skills.Add(冰霜攻击); - - Skill 疾风步 = new 疾风步(c) - { - Level = slevel - }; - c.Skills.Add(疾风步); - - if (c == character1) - { - Skill META马 = new META马(c) - { - Level = 1 - }; - c.Skills.Add(META马); - - Skill 力量爆发 = new 力量爆发(c) - { - Level = mlevel - }; - c.Skills.Add(力量爆发); - } - - if (c == character2) - { - Skill 心灵之火 = new 心灵之火(c) - { - Level = 1 - }; - c.Skills.Add(心灵之火); - - Skill 天赐之力 = new 天赐之力(c) - { - Level = slevel - }; - c.Skills.Add(天赐之力); - } - - if (c== character3) - { - Skill 魔法震荡 = new 魔法震荡(c) - { - Level = 1 - }; - c.Skills.Add(魔法震荡); - - Skill 魔法涌流 = new 魔法涌流(c) - { - Level = slevel - }; - c.Skills.Add(魔法涌流); - } - - if (c== character4) - { - Skill 灵能反射 = new 灵能反射(c) - { - Level = 1 - }; - c.Skills.Add(灵能反射); - - Skill 三重叠加 = new 三重叠加(c) - { - Level = slevel - }; - c.Skills.Add(三重叠加); - } - - if (c== character5) - { - Skill 智慧与力量 = new 智慧与力量(c) - { - Level = 1 - }; - c.Skills.Add(智慧与力量); - - Skill 变幻之心 = new 变幻之心(c) - { - Level = slevel - }; - c.Skills.Add(变幻之心); - } - - if (c== character6) - { - Skill 致命打击 = new 致命打击(c) - { - Level = 1 - }; - c.Skills.Add(致命打击); - - Skill 精准打击 = new 精准打击(c) - { - Level = slevel - }; - c.Skills.Add(精准打击); - } - - if (c== character7) - { - Skill 毁灭之势 = new 毁灭之势(c) - { - Level = 1 - }; - c.Skills.Add(毁灭之势); - - Skill 绝对领域 = new 绝对领域(c) - { - Level = slevel - }; - c.Skills.Add(绝对领域); - } - - if (c== character8) - { - Skill 枯竭打击 = new 枯竭打击(c) - { - Level = 1 - }; - c.Skills.Add(枯竭打击); - - Skill 能量毁灭 = new 能量毁灭(c) - { - Level = slevel - }; - c.Skills.Add(能量毁灭); - } - - if (c == character9) - { - Skill 玻璃大炮 = new 玻璃大炮(c) - { - Level = 1 - }; - c.Skills.Add(玻璃大炮); - - Skill 迅捷之势 = new 迅捷之势(c) - { - Level = slevel - }; - c.Skills.Add(迅捷之势); - } - - if (c == character10) - { - Skill 累积之压 = new 累积之压(c) - { - Level = 1 - }; - c.Skills.Add(累积之压); - - Skill 嗜血本能 = new 嗜血本能(c) - { - Level = slevel - }; - c.Skills.Add(嗜血本能); - } - - if (c == character11) - { - Skill 敏捷之刃 = new 敏捷之刃(c) - { - Level = 1 - }; - c.Skills.Add(敏捷之刃); - - Skill 平衡强化 = new 平衡强化(c) - { - Level = slevel - }; - c.Skills.Add(平衡强化); - } - - if (c == character12) - { - Skill 弱者猎手 = new 弱者猎手(c) - { - Level = 1 - }; - c.Skills.Add(弱者猎手); - - Skill 血之狂欢 = new 血之狂欢(c) - { - Level = slevel - }; - c.Skills.Add(血之狂欢); - } - } - - // 显示角色信息 - characters.ForEach(c => Console.WriteLine(c.GetInfo())); - - // 创建顺序表并排序 - ActionQueue actionQueue = new(characters, Console.WriteLine); - Console.WriteLine(); - - // 显示初始顺序表 - actionQueue.DisplayQueue(); - Console.WriteLine(); - - // 总回合数 - int i = 1; - while (i < 999) - { - if (i == 998) - { - Console.WriteLine($"=== 终局审判 ==="); - Dictionary 他们的血量百分比 = []; - foreach (Character c in characters) - { - 他们的血量百分比.TryAdd(c, Calculation.Round4Digits(c.HP / c.MaxHP)); - } - double max = 他们的血量百分比.Values.Max(); - Character winner = 他们的血量百分比.Keys.Where(c => 他们的血量百分比[c] == max).First(); - Console.WriteLine("[ " + winner + " ] 成为了天选之人!!"); - foreach (Character c in characters.Where(c => c != winner && c.HP > 0)) - { - Console.WriteLine("[ " + winner + " ] 对 [ " + c + " ] 造成了 99999999999 点真实伤害。"); - actionQueue.DeathCalculation(winner, c); - } - actionQueue.EndGameInfo(winner); - break; - } - - // 检查是否有角色可以行动 - Character? characterToAct = actionQueue.NextCharacter(); - - // 处理回合 - if (characterToAct != null) - { - Console.WriteLine($"=== Round {i++} ==="); - Console.WriteLine("现在是 [ " + characterToAct + " ] 的回合!"); - - bool isGameEnd = actionQueue.ProcessTurn(characterToAct); - if (isGameEnd) - { - break; - } - - actionQueue.DisplayQueue(); - Console.WriteLine(); - } - - // 模拟时间流逝 - actionQueue.TimeLapse(); - } - - Console.WriteLine("--- End ---"); -} +FunGameSimulation.StartGame(true); Console.ReadKey(); diff --git a/Library/Tests/FunGame.cs b/Library/Tests/FunGame.cs new file mode 100644 index 0000000..1ac8366 --- /dev/null +++ b/Library/Tests/FunGame.cs @@ -0,0 +1,411 @@ +using System.Reflection; +using Milimoe.FunGame.Core.Api.Utility; +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Common.Addon; +using Milimoe.FunGame.Core.Library.Common.Event; +using Milimoe.FunGame.Core.Library.Constant; +using Milimoe.FunGame.Testing.Skills; + +namespace FunGame.Testing.Tests +{ + public class FunGameSimulation + { + public static bool IsRuning { get; set; } = false; + public static bool PrintOut { get; set; } = false; + public static string Msg { get; set; } = ""; + + public static List StartGame(bool printout) + { + PrintOut = printout; + try + { + if (IsRuning) return ["游戏正在模拟中,请勿重复请求!"]; + + List result = []; + int death = 0; + Msg = ""; + + IsRuning = true; + + PluginLoader plugins = PluginLoader.LoadPlugins([]); + foreach (string plugin in plugins.Plugins.Keys) + { + Console.WriteLine(plugin + " is loaded."); + } + + Dictionary plugindllsha512 = []; + foreach (string pfp in PluginLoader.PluginFilePaths.Keys) + { + string text = Encryption.FileSha512(PluginLoader.PluginFilePaths[pfp]); + plugindllsha512.Add(pfp, text); + if (PrintOut) Console.WriteLine(pfp + $" is {text}."); + } + + List list = []; + + GameModuleLoader modules = GameModuleLoader.LoadGameModules(FunGameInfo.FunGame.FunGame_Desktop, []); + foreach (CharacterModule cm in modules.Characters.Values) + { + foreach (Character c in cm.Characters) + { + if (PrintOut) Console.WriteLine(c.Name); + list.Add(c); + } + } + + Dictionary moduledllsha512 = []; + foreach (string mfp in GameModuleLoader.ModuleFilePaths.Keys) + { + string text = Encryption.FileSha512(GameModuleLoader.ModuleFilePaths[mfp]); + moduledllsha512.Add(mfp, text); + if (PrintOut) Console.WriteLine(mfp + $" is {text}."); + } + + foreach (string moduledll in moduledllsha512.Keys) + { + string server = moduledllsha512[moduledll]; + if (plugindllsha512.TryGetValue(moduledll, out string? client) && client != "" && server == client) + { + Console.WriteLine(moduledll + $" is checked pass."); + } + } + + // M = 0, W = 7, P1 = 1, P3 = 1 + // M = 1, W = 6, P1 = 2, P3 = 0 + // M = 2, W = 4, P1 = 0, P3 = 2 + // M = 2, W = 5, P1 = 0, P3 = 0 + // M = 3, W = 3, P1 = 1, P3 = 1 + // M = 4, W = 2, P1 = 2, P3 = 0 + // M = 5, W = 0, P1 = 0, P3 = 2 + // M = 5, W = 1, P1 = 0, P3 = 0 + + if (list.Count > 3) + { + if (PrintOut) Console.WriteLine(); + if (PrintOut) Console.WriteLine("Start!!!"); + if (PrintOut) Console.WriteLine(); + + Character character1 = list[0].Copy(); + Character character2 = list[1].Copy(); + Character character3 = list[2].Copy(); + Character character4 = list[3].Copy(); + Character character5 = list[4].Copy(); + Character character6 = list[5].Copy(); + Character character7 = list[6].Copy(); + Character character8 = list[7].Copy(); + Character character9 = list[8].Copy(); + Character character10 = list[9].Copy(); + Character character11 = list[10].Copy(); + Character character12 = list[11].Copy(); + + List characters = [ + character1, character2, character3, character4, + character5, character6, character7, character8, + character9, character10, character11, character12 + ]; + + int clevel = 60; + int slevel = 6; + int mlevel = 8; + + // 升级和赋能 + for (int index = 0; index < characters.Count; index++) + { + Character c = characters[index]; + c.Level = clevel; + c.NormalAttack.Level = mlevel; + + Skill 冰霜攻击 = new 冰霜攻击(c) + { + Level = mlevel + }; + c.Skills.Add(冰霜攻击); + + Skill 疾风步 = new 疾风步(c) + { + Level = slevel + }; + c.Skills.Add(疾风步); + + if (c == character1) + { + Skill META马 = new META马(c) + { + Level = 1 + }; + c.Skills.Add(META马); + + Skill 力量爆发 = new 力量爆发(c) + { + Level = mlevel + }; + c.Skills.Add(力量爆发); + } + + if (c == character2) + { + Skill 心灵之火 = new 心灵之火(c) + { + Level = 1 + }; + c.Skills.Add(心灵之火); + + Skill 天赐之力 = new 天赐之力(c) + { + Level = slevel + }; + c.Skills.Add(天赐之力); + } + + if (c == character3) + { + Skill 魔法震荡 = new 魔法震荡(c) + { + Level = 1 + }; + c.Skills.Add(魔法震荡); + + Skill 魔法涌流 = new 魔法涌流(c) + { + Level = slevel + }; + c.Skills.Add(魔法涌流); + } + + if (c == character4) + { + Skill 灵能反射 = new 灵能反射(c) + { + Level = 1 + }; + c.Skills.Add(灵能反射); + + Skill 三重叠加 = new 三重叠加(c) + { + Level = slevel + }; + c.Skills.Add(三重叠加); + } + + if (c == character5) + { + Skill 智慧与力量 = new 智慧与力量(c) + { + Level = 1 + }; + c.Skills.Add(智慧与力量); + + Skill 变幻之心 = new 变幻之心(c) + { + Level = slevel + }; + c.Skills.Add(变幻之心); + } + + if (c == character6) + { + Skill 致命打击 = new 致命打击(c) + { + Level = 1 + }; + c.Skills.Add(致命打击); + + Skill 精准打击 = new 精准打击(c) + { + Level = slevel + }; + c.Skills.Add(精准打击); + } + + if (c == character7) + { + Skill 毁灭之势 = new 毁灭之势(c) + { + Level = 1 + }; + c.Skills.Add(毁灭之势); + + Skill 绝对领域 = new 绝对领域(c) + { + Level = slevel + }; + c.Skills.Add(绝对领域); + } + + if (c == character8) + { + Skill 枯竭打击 = new 枯竭打击(c) + { + Level = 1 + }; + c.Skills.Add(枯竭打击); + + Skill 能量毁灭 = new 能量毁灭(c) + { + Level = slevel + }; + c.Skills.Add(能量毁灭); + } + + if (c == character9) + { + Skill 玻璃大炮 = new 玻璃大炮(c) + { + Level = 1 + }; + c.Skills.Add(玻璃大炮); + + Skill 迅捷之势 = new 迅捷之势(c) + { + Level = slevel + }; + c.Skills.Add(迅捷之势); + } + + if (c == character10) + { + Skill 累积之压 = new 累积之压(c) + { + Level = 1 + }; + c.Skills.Add(累积之压); + + Skill 嗜血本能 = new 嗜血本能(c) + { + Level = slevel + }; + c.Skills.Add(嗜血本能); + } + + if (c == character11) + { + Skill 敏捷之刃 = new 敏捷之刃(c) + { + Level = 1 + }; + c.Skills.Add(敏捷之刃); + + Skill 平衡强化 = new 平衡强化(c) + { + Level = slevel + }; + c.Skills.Add(平衡强化); + } + + if (c == character12) + { + Skill 弱者猎手 = new 弱者猎手(c) + { + Level = 1 + }; + c.Skills.Add(弱者猎手); + + Skill 血之狂欢 = new 血之狂欢(c) + { + Level = slevel + }; + c.Skills.Add(血之狂欢); + } + } + + // 显示角色信息 + if (PrintOut) characters.ForEach(c => Console.WriteLine(c.GetInfo())); + + // 创建顺序表并排序 + ActionQueue actionQueue = new(characters, WriteLine); + if (PrintOut) Console.WriteLine(); + + // 显示初始顺序表 + actionQueue.DisplayQueue(); + if (PrintOut) Console.WriteLine(); + + // 总回合数 + int i = 1; + while (i < 999) + { + Msg = ""; + if (i == 998) + { + WriteLine($"=== 终局审判 ==="); + Dictionary 他们的血量百分比 = []; + foreach (Character c in characters) + { + 他们的血量百分比.TryAdd(c, Calculation.Round4Digits(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; + } + + // 检查是否有角色可以行动 + Character? characterToAct = actionQueue.NextCharacter(); + + // 处理回合 + if (characterToAct != null) + { + WriteLine($"=== Round {i++} ==="); + WriteLine("现在是 [ " + characterToAct + " ] 的回合!"); + + bool isGameEnd = actionQueue.ProcessTurn(characterToAct); + if (isGameEnd) + { + result.Add(Msg); + break; + } + + actionQueue.DisplayQueue(); + WriteLine(""); + } + + // 模拟时间流逝 + actionQueue.TimeLapse(); + + // 使用反射获取私有字段 + FieldInfo? eliminatedField = actionQueue.GetType().GetField("_eliminated", BindingFlags.NonPublic | BindingFlags.Instance); + // 从对象中获取该字段的值 + if (eliminatedField != null) + { + if (eliminatedField.GetValue(actionQueue) is List eliminatedList && eliminatedList.Count > death) + { + death = eliminatedList.Count; + string roundMsg = Msg; + string[] strs = roundMsg.Split("==== 角色状态 ===="); + if (strs.Length > 0) + { + roundMsg = strs[0]; + } + result.Add(roundMsg); + } + } + } + + if (PrintOut) Console.WriteLine("--- End ---"); + + IsRuning = false; + } + + return result; + } + catch (Exception ex) + { + IsRuning = false; + Console.WriteLine(ex); + return [ex.ToString()]; + } + } + + public static void WriteLine(string str) + { + Msg += str + "\r\n"; + if (PrintOut) Console.WriteLine(str); + } + } +} From 25b53ab0dfd235985b7e24ea30a8262dc112ab42 Mon Sep 17 00:00:00 2001 From: milimoe Date: Fri, 13 Sep 2024 01:45:16 +0800 Subject: [PATCH 11/15] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=97=A0=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Library/Tests/FunGame.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Library/Tests/FunGame.cs b/Library/Tests/FunGame.cs index 1ac8366..878b54f 100644 --- a/Library/Tests/FunGame.cs +++ b/Library/Tests/FunGame.cs @@ -2,7 +2,6 @@ using Milimoe.FunGame.Core.Api.Utility; using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Common.Addon; -using Milimoe.FunGame.Core.Library.Common.Event; using Milimoe.FunGame.Core.Library.Constant; using Milimoe.FunGame.Testing.Skills; From d88cab8337300fee5b87798a57bcf0a3635b2525 Mon Sep 17 00:00:00 2001 From: milimoe Date: Fri, 13 Sep 2024 23:43:23 +0800 Subject: [PATCH 12/15] modify namespace --- Library/Main.cs | 2 +- Library/Tests/FunGame.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Library/Main.cs b/Library/Main.cs index 27018fd..87d4354 100644 --- a/Library/Main.cs +++ b/Library/Main.cs @@ -1,4 +1,4 @@ -using FunGame.Testing.Tests; +using Milimoe.FunGame.Testing.Tests; FunGameSimulation.StartGame(true); diff --git a/Library/Tests/FunGame.cs b/Library/Tests/FunGame.cs index 878b54f..ce3f18d 100644 --- a/Library/Tests/FunGame.cs +++ b/Library/Tests/FunGame.cs @@ -5,7 +5,7 @@ using Milimoe.FunGame.Core.Library.Common.Addon; using Milimoe.FunGame.Core.Library.Constant; using Milimoe.FunGame.Testing.Skills; -namespace FunGame.Testing.Tests +namespace Milimoe.FunGame.Testing.Tests { public class FunGameSimulation { From 1169656ced4ff9b509179983a975a9b785e6220c Mon Sep 17 00:00:00 2001 From: milimoe Date: Sat, 14 Sep 2024 01:10:00 +0800 Subject: [PATCH 13/15] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=80=E4=BA=9B?= =?UTF-8?q?=E5=8F=82=E6=95=B0=EF=BC=8C=E5=92=8C=E6=A0=BC=E5=BC=8F=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Desktop/Solutions/ChessBoardExample.cs | 10 +++++----- Library/Skills/ColdBlue/嗜血本能.cs | 2 +- Library/Skills/ColdBlue/累积之压.cs | 2 +- Library/Skills/Mayor/精准打击.cs | 6 +++--- Library/Skills/QWQAQW/玻璃大炮.cs | 2 +- Library/Skills/QWQAQW/迅捷之势.cs | 2 +- Library/Skills/QingXiang/能量毁灭.cs | 4 ++-- Library/Skills/QuDuoduo/弱者猎手.cs | 2 +- Library/Skills/XinYin/天赐之力.cs | 23 ++++++++++------------- Library/Skills/XinYin/心灵之火.cs | 15 ++++++++++++++- Library/Skills/Yang/魔法涌流.cs | 2 +- Library/Skills/战技/疾风步.cs | 16 +++------------- Library/Skills/绿拱门/平衡强化.cs | 2 +- Library/Skills/绿拱门/敏捷之刃.cs | 2 +- Library/Skills/马猴烧酒/毁灭之势.cs | 4 ++-- Library/Skills/马猴烧酒/绝对领域.cs | 4 ++-- 16 files changed, 49 insertions(+), 49 deletions(-) diff --git a/Desktop/Solutions/ChessBoardExample.cs b/Desktop/Solutions/ChessBoardExample.cs index 7c6a739..4610cf6 100644 --- a/Desktop/Solutions/ChessBoardExample.cs +++ b/Desktop/Solutions/ChessBoardExample.cs @@ -13,11 +13,11 @@ InitializeComponent(); InitializeChessboard(); - foreach (var panel in chessboardDict.Values) - { - panel.MouseEnter += OnCellMouseEnter; - panel.MouseLeave += OnCellMouseLeave; - } + //foreach (var panel in chessboardDict.Values) + //{ + // panel.MouseEnter += OnCellMouseEnter; + // panel.MouseLeave += OnCellMouseLeave; + //} string key = "5_9"; Button b = new Button(); diff --git a/Library/Skills/ColdBlue/嗜血本能.cs b/Library/Skills/ColdBlue/嗜血本能.cs index cb7f246..a363c97 100644 --- a/Library/Skills/ColdBlue/嗜血本能.cs +++ b/Library/Skills/ColdBlue/嗜血本能.cs @@ -24,7 +24,7 @@ namespace Milimoe.FunGame.Testing.Skills { public override long Id => Skill.Id; public override string Name => Skill.Name; - public override string Description => $"{Duration} 秒内,攻击拥有标记的角色将根据标记层数获得 {吸血 * 100:f2}% 吸血每层。"; + public override string Description => $"{Duration} 秒内,攻击拥有标记的角色将根据标记层数获得 {吸血 * 100:0.##}% 吸血每层。"; public override bool TargetSelf => true; public override bool Durative => true; public override double Duration => 30; diff --git a/Library/Skills/ColdBlue/累积之压.cs b/Library/Skills/ColdBlue/累积之压.cs index 72b9b9c..cf64549 100644 --- a/Library/Skills/ColdBlue/累积之压.cs +++ b/Library/Skills/ColdBlue/累积之压.cs @@ -26,7 +26,7 @@ namespace Milimoe.FunGame.Testing.Skills { public override long Id => Skill.Id; public override string Name => Skill.Name; - public override string Description => $"每次造成伤害都可以叠一层标记,累计 4 层时回收该角色所有标记并造成眩晕 1 回合,额外对该角色造成 {系数 * 100:f2}% 最大生命值的物理伤害。"; + public override string Description => $"每次造成伤害都可以叠一层标记,累计 4 层时回收该角色所有标记并造成眩晕 1 回合,额外对该角色造成 {系数 * 100:0.##}% 最大生命值的物理伤害。"; public override bool TargetSelf => true; private readonly double 系数 = 0.12; diff --git a/Library/Skills/Mayor/精准打击.cs b/Library/Skills/Mayor/精准打击.cs index 7ec3768..d1cd1f2 100644 --- a/Library/Skills/Mayor/精准打击.cs +++ b/Library/Skills/Mayor/精准打击.cs @@ -23,7 +23,7 @@ namespace Milimoe.FunGame.Testing.Skills { public override long Id => Skill.Id; public override string Name => Skill.Name; - public override string Description => $"30 时间内暴击率提升 {暴击率提升 * 100:f2}%,暴击伤害再提升 {暴击伤害提升 * 100:f2}%。"; + public override string Description => $"30 时间内暴击率提升 {暴击率提升 * 100:0.##}%,暴击伤害再提升 {暴击伤害提升 * 100:0.##}%。"; public override bool TargetSelf => true; public override bool Durative => true; public override double Duration => 30; @@ -38,9 +38,9 @@ namespace Milimoe.FunGame.Testing.Skills 实际暴击率提升 = 暴击率提升; 实际暴击伤害提升 = 暴击伤害提升; character.ExCritRate += 实际暴击率提升; - WriteLine($"[ {character} ] 的暴击率提升了 [ {实际暴击率提升 * 100:f2}% ] !"); + WriteLine($"[ {character} ] 的暴击率提升了 [ {实际暴击率提升 * 100:0.##}% ] !"); character.ExCritDMG += 实际暴击伤害提升; - WriteLine($"[ {character} ] 的暴击伤害提升了 [ {实际暴击伤害提升 * 100:f2}% ] !"); + WriteLine($"[ {character} ] 的暴击伤害提升了 [ {实际暴击伤害提升 * 100:0.##}% ] !"); } public override void OnEffectLost(Character character) diff --git a/Library/Skills/QWQAQW/玻璃大炮.cs b/Library/Skills/QWQAQW/玻璃大炮.cs index 50a83a7..0d42a99 100644 --- a/Library/Skills/QWQAQW/玻璃大炮.cs +++ b/Library/Skills/QWQAQW/玻璃大炮.cs @@ -26,7 +26,7 @@ namespace Milimoe.FunGame.Testing.Skills public override long Id => Skill.Id; public override string Name => Skill.Name; public override string Description => $"生命值高于30%时,受到额外的 [ 20~40% ] 伤害,但是获得 [ 上次所受伤害的 110~140% ] 伤害加成;生命值低于等于30%时,不会受到额外的伤害,仅能获得 [ 上次所受伤害的 35% ] 伤害加成。" + - $"在没有受到任何伤害的时候,将获得 {常规伤害加成 * 100:f2}% 伤害加成。(当前伤害加成:{伤害加成 * 100:f2}%)"; + $"在没有受到任何伤害的时候,将获得 {常规伤害加成 * 100:0.##}% 伤害加成。(当前伤害加成:{伤害加成 * 100:0.##}%)"; public override bool TargetSelf => true; private double 上次受到的伤害 = 0; diff --git a/Library/Skills/QWQAQW/迅捷之势.cs b/Library/Skills/QWQAQW/迅捷之势.cs index f2248f9..f8056a5 100644 --- a/Library/Skills/QWQAQW/迅捷之势.cs +++ b/Library/Skills/QWQAQW/迅捷之势.cs @@ -23,7 +23,7 @@ namespace Milimoe.FunGame.Testing.Skills { public override long Id => Skill.Id; public override string Name => Skill.Name; - public override string Description => $"{Duration} 秒内,普通攻击转为魔法伤害,且硬直时间减少50%,并基于 {智力系数 * 100:f2}% 智力 [{智力加成}] 强化普通攻击伤害。"; + public override string Description => $"{Duration} 秒内,普通攻击转为魔法伤害,且硬直时间减少50%,并基于 {智力系数 * 100:0.##}% 智力 [{智力加成}] 强化普通攻击伤害。"; public override bool TargetSelf => true; public override bool Durative => true; public override double Duration => 40; diff --git a/Library/Skills/QingXiang/能量毁灭.cs b/Library/Skills/QingXiang/能量毁灭.cs index 45cdd28..0a8c72d 100644 --- a/Library/Skills/QingXiang/能量毁灭.cs +++ b/Library/Skills/QingXiang/能量毁灭.cs @@ -11,7 +11,7 @@ namespace Milimoe.FunGame.Testing.Skills public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; public override double EPCost => 100; public override double CD => 55 - 3 * (Level - 1); - public override double HardnessTime => 15; + public override double HardnessTime => 25; public 能量毁灭(Character character) : base(SkillType.SuperSkill, character) { @@ -24,7 +24,7 @@ namespace Milimoe.FunGame.Testing.Skills public override long Id => Skill.Id; public override string Name => Skill.Name; public override string Description => $"对所有角色造成 " + - $"600% 其现有能量值 + {智力系数 * 100:f2}% 智力 [ {智力伤害} ] 的魔法伤害。"; + $"450% 其现有能量值 + {智力系数 * 100:0.##}% 智力 [ {智力伤害} ] 的魔法伤害。"; public override bool TargetSelf => false; public override double TargetRange => 999; diff --git a/Library/Skills/QuDuoduo/弱者猎手.cs b/Library/Skills/QuDuoduo/弱者猎手.cs index 7c30379..955e1b8 100644 --- a/Library/Skills/QuDuoduo/弱者猎手.cs +++ b/Library/Skills/QuDuoduo/弱者猎手.cs @@ -32,7 +32,7 @@ namespace Milimoe.FunGame.Testing.Skills { if (character == Skill.Character && (enemy.HP / enemy.MaxHP) <= (character.HP / character.MaxHP)) { - double 额外伤害 = Calculation.Round2Digits(damage * 1.5); + double 额外伤害 = Calculation.Round2Digits(damage * 0.5); damage = Calculation.Round2Digits(damage + 额外伤害); } } diff --git a/Library/Skills/XinYin/天赐之力.cs b/Library/Skills/XinYin/天赐之力.cs index 201f666..d330cdb 100644 --- a/Library/Skills/XinYin/天赐之力.cs +++ b/Library/Skills/XinYin/天赐之力.cs @@ -23,32 +23,29 @@ namespace Milimoe.FunGame.Testing.Skills { public override long Id => Skill.Id; public override string Name => Skill.Name; - public override string Description => $"{Duration} 时间内,获得 25% 闪避率(不可叠加),普通攻击硬直时间额外减少 20%,基于 {Calculation.Round2Digits((1.2 + (1 + 0.6 * (Skill.Level - 1))) * 100)}% 敏捷 [ {伤害加成} ] 强化普通攻击的伤害。"; + public override string Description => $"{Duration} 时间内,增加 40% 攻击力 [ {攻击力提升} ]、30% 物理穿透和 25% 闪避率(不可叠加),普通攻击硬直时间额外减少 20%,基于 {系数 * 100:0.##}% 敏捷 [ {伤害加成} ] 强化普通攻击的伤害。"; public override bool TargetSelf => false; public override int TargetCount => 1; public override bool Durative => true; public override double Duration => 40; - private double 伤害加成 - { - get - { - double d = 0; - if (Skill.Character != null) - { - d = Calculation.Round2Digits(1.2 * (1 + 0.6 * (Skill.Level - 1)) * Skill.Character.AGI); - } - return d; - } - } + private double 系数 => Calculation.Round4Digits(1.2 * (1 + 0.6 * (Skill.Level - 1))); + private double 伤害加成 => Calculation.Round2Digits(系数 * Skill.Character?.AGI ?? 0); + private double 攻击力提升 => Calculation.Round2Digits(0.4 * Skill.Character?.BaseATK ?? 0); + private double 实际的攻击力提升 = 0; public override void OnEffectGained(Character character) { + 实际的攻击力提升 = 攻击力提升; + character.ExATK2 += 实际的攻击力提升; + character.PhysicalPenetration += 0.3; character.ExEvadeRate += 0.25; } public override void OnEffectLost(Character character) { + character.ExATK2 -= 实际的攻击力提升; + character.PhysicalPenetration -= 0.3; character.ExEvadeRate -= 0.25; } diff --git a/Library/Skills/XinYin/心灵之火.cs b/Library/Skills/XinYin/心灵之火.cs index 3ddc709..250b5db 100644 --- a/Library/Skills/XinYin/心灵之火.cs +++ b/Library/Skills/XinYin/心灵之火.cs @@ -25,9 +25,22 @@ namespace Milimoe.FunGame.Testing.Skills { public override long Id => Skill.Id; public override string Name => Skill.Name; - public override string Description => $"普通攻击硬直时间减少 20%。"; + public override string Description => $"增加 20% 攻击力且普通攻击硬直时间减少 20%。"; public override bool TargetSelf => true; + private double 实际增加攻击力 = 0; + + public override void OnEffectGained(Character character) + { + 实际增加攻击力 = character.BaseATK * 0.2; + character.ExATK2 += 实际增加攻击力; + } + + public override void OnEffectLost(Character character) + { + character.ExATK2 -= 实际增加攻击力; + } + public override void AlterHardnessTimeAfterNormalAttack(Character character, ref double baseHardnessTime, ref bool isCheckProtected) { baseHardnessTime = Calculation.Round2Digits(baseHardnessTime * 0.8); diff --git a/Library/Skills/Yang/魔法涌流.cs b/Library/Skills/Yang/魔法涌流.cs index 65a5e77..d3e62b8 100644 --- a/Library/Skills/Yang/魔法涌流.cs +++ b/Library/Skills/Yang/魔法涌流.cs @@ -23,7 +23,7 @@ namespace Milimoe.FunGame.Testing.Skills { public override long Id => Skill.Id; public override string Name => "魔法涌流"; - public override string Description => $"{Duration} 秒内,增加所有伤害的 {减伤比例 * 100:f2}% 伤害减免,并将普通攻击转为魔法伤害,可叠加魔法震荡的效果。"; + public override string Description => $"{Duration} 秒内,增加所有伤害的 {减伤比例 * 100:0.##}% 伤害减免,并将普通攻击转为魔法伤害,可叠加魔法震荡的效果。"; public override bool TargetSelf => true; public override bool Durative => true; public override double Duration => 25; diff --git a/Library/Skills/战技/疾风步.cs b/Library/Skills/战技/疾风步.cs index 9627bae..e40ef58 100644 --- a/Library/Skills/战技/疾风步.cs +++ b/Library/Skills/战技/疾风步.cs @@ -23,23 +23,13 @@ namespace Milimoe.FunGame.Testing.Skills { public override long Id => Skill.Id; public override string Name => Skill.Name; - public override string Description => $"进入不可选中状态,获得 100 行动速度,提高 8% 暴击率,持续 {Duration} 时间。破隐一击:在持续时间内,首次造成伤害会附加 {Calculation.Round2Digits((1.5 + 1.5 * (Skill.Level - 1)) * 100)}% 敏捷 [ {伤害加成} ] 的强化伤害,并解除不可选中状态。"; + public override string Description => $"进入不可选中状态,获得 100 行动速度,提高 8% 暴击率,持续 {Duration} 时间。破隐一击:在持续时间内,首次造成伤害会附加 {系数 * 100:0.##}% 敏捷 [ {伤害加成} ] 的强化伤害,并解除不可选中状态。"; public override bool TargetSelf => true; public override bool Durative => true; public override double Duration => 12 + (1 * (Level - 1)); - private double 伤害加成 - { - get - { - double d = 0; - if (Skill.Character != null) - { - d = Calculation.Round2Digits((1.5 + 1.5 * (Skill.Level - 1)) * Skill.Character.AGI); - } - return d; - } - } + private double 系数 => Calculation.Round4Digits(0.5 + 0.5 * (Skill.Level - 1)); + private double 伤害加成 => Calculation.Round2Digits(系数 * Skill.Character?.AGI ?? 0); private bool 首次伤害 { get; set; } = true; private bool 破隐一击 { get; set; } = false; diff --git a/Library/Skills/绿拱门/平衡强化.cs b/Library/Skills/绿拱门/平衡强化.cs index cb0941b..48a3593 100644 --- a/Library/Skills/绿拱门/平衡强化.cs +++ b/Library/Skills/绿拱门/平衡强化.cs @@ -41,7 +41,7 @@ namespace Milimoe.FunGame.Testing.Skills 本次提升的力量 = character.AGI - character.STR; character.ExSTR += 本次提升的力量; character.Recovery(pastHP, pastMP, pastMaxHP, pastMaxMP); - WriteLine($"[ {character} ] 敏捷提升了 {本次提升的敏捷:f2},力量提升了 {本次提升的力量:f2}!"); + WriteLine($"[ {character} ] 敏捷提升了 {本次提升的敏捷:0.##},力量提升了 {本次提升的力量:0.##}!"); } public override void OnEffectLost(Character character) diff --git a/Library/Skills/绿拱门/敏捷之刃.cs b/Library/Skills/绿拱门/敏捷之刃.cs index 2e7fba6..c5b33a2 100644 --- a/Library/Skills/绿拱门/敏捷之刃.cs +++ b/Library/Skills/绿拱门/敏捷之刃.cs @@ -25,7 +25,7 @@ namespace Milimoe.FunGame.Testing.Skills { public override long Id => Skill.Id; public override string Name => Skill.Name; - public override string Description => $"每次普通攻击都将附带基于 {敏捷系数 * 100:f2}% 敏捷 [ {敏捷伤害} ] 的魔法伤害。"; + public override string Description => $"每次普通攻击都将附带基于 {敏捷系数 * 100:0.##}% 敏捷 [ {敏捷伤害} ] 的魔法伤害。"; public override bool TargetSelf => true; private double 敏捷伤害 => Calculation.Round2Digits(敏捷系数 * Skill.Character?.AGI ?? 0); diff --git a/Library/Skills/马猴烧酒/毁灭之势.cs b/Library/Skills/马猴烧酒/毁灭之势.cs index b4a183f..ce5afe8 100644 --- a/Library/Skills/马猴烧酒/毁灭之势.cs +++ b/Library/Skills/马猴烧酒/毁灭之势.cs @@ -25,7 +25,7 @@ namespace Milimoe.FunGame.Testing.Skills { public override long Id => Skill.Id; public override string Name => Skill.Name; - public override string Description => $"每时间提升 5.5% 所有伤害,无上限,但受到伤害时效果清零。" + (累计伤害 > 0 ? $"(当前总提升:{累计伤害 * 100:f2}%)" : ""); + public override string Description => $"每时间提升 5.5% 所有伤害,无上限,但受到伤害时效果清零。" + (累计伤害 > 0 ? $"(当前总提升:{累计伤害 * 100:0.##}%)" : ""); public override bool TargetSelf => true; private readonly double 伤害提升 = 0.055; @@ -53,7 +53,7 @@ namespace Milimoe.FunGame.Testing.Skills public override void OnTimeElapsed(Character character, double eapsed) { 累计伤害 = Calculation.Round4Digits(累计伤害 + 伤害提升 * eapsed); - WriteLine($"[ {character} ] 的 [ {Name} ] 效果增加了,当前总提升:{累计伤害 * 100:f2}%。"); + WriteLine($"[ {character} ] 的 [ {Name} ] 效果增加了,当前总提升:{累计伤害 * 100:0.##}%。"); } } } diff --git a/Library/Skills/马猴烧酒/绝对领域.cs b/Library/Skills/马猴烧酒/绝对领域.cs index 577735f..bef228a 100644 --- a/Library/Skills/马猴烧酒/绝对领域.cs +++ b/Library/Skills/马猴烧酒/绝对领域.cs @@ -23,7 +23,7 @@ namespace Milimoe.FunGame.Testing.Skills { public override long Id => Skill.Id; public override string Name => Skill.Name; - public override string Description => $"{Duration} 时间内无法受到任何伤害,且敏捷提升 {系数 * 100:f2}% [ {敏捷提升} ]。此技能会消耗至少 100 点能量。"; + public override string Description => $"{Duration} 时间内无法受到任何伤害,且敏捷提升 {系数 * 100:0.##}% [ {敏捷提升} ]。此技能会消耗至少 100 点能量。"; public override bool TargetSelf => true; public override bool Durative => true; public override double Duration => Calculation.Round2Digits(16 + 释放时的能量值 * 0.03); @@ -37,7 +37,7 @@ namespace Milimoe.FunGame.Testing.Skills { 实际敏捷提升 = 敏捷提升; character.ExAGI += 实际敏捷提升; - WriteLine($"[ {character} ] 的敏捷提升了 {系数 * 100:f2}% [ {实际敏捷提升} ] !"); + WriteLine($"[ {character} ] 的敏捷提升了 {系数 * 100:0.##}% [ {实际敏捷提升} ] !"); } public override void OnEffectLost(Character character) From 9c0f001bc0b1e525e09fe6f07e75dba0a3c59d6b Mon Sep 17 00:00:00 2001 From: milimoe Date: Sun, 15 Sep 2024 01:22:35 +0800 Subject: [PATCH 14/15] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=BC=A4=E5=AE=B3?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=EF=BC=8C=E8=B0=83=E6=95=B4=E6=8A=80=E8=83=BD?= =?UTF-8?q?=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FunGame.Testing.sln | 8 +++- Library/Main.cs | 11 ++++- Library/Skills/ColdBlue/嗜血本能.cs | 2 +- Library/Skills/NanGanyu/灵能反射.cs | 2 +- Library/Skills/NiuNan/变幻之心.cs | 2 +- Library/Skills/Oshima/力量爆发.cs | 4 +- Library/Skills/QWQAQW/玻璃大炮.cs | 63 ++++++++++++++++------------ Library/Skills/QWQAQW/迅捷之势.cs | 2 +- Library/Skills/QingXiang/能量毁灭.cs | 5 ++- Library/Skills/XinYin/天赐之力.cs | 17 +++++++- Library/Skills/XinYin/心灵之火.cs | 34 +++++++++++---- Library/Skills/Yang/魔法涌流.cs | 2 +- Library/Tests/FunGame.cs | 60 ++++++++++++++++++-------- 13 files changed, 149 insertions(+), 63 deletions(-) diff --git a/FunGame.Testing.sln b/FunGame.Testing.sln index c4be892..74e6c9f 100644 --- a/FunGame.Testing.sln +++ b/FunGame.Testing.sln @@ -5,7 +5,9 @@ VisualStudioVersion = 17.5.33516.290 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FunGame.Testing", "Library\FunGame.Testing.csproj", "{6F6B4A21-8F39-4B0D-84E8-98AE3E93F06F}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FunGame.Testing.Desktop", "Desktop\FunGame.Testing.Desktop.csproj", "{05FA61CB-22AA-4834-8C45-1161C42DF2C7}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FunGame.Testing.Desktop", "Desktop\FunGame.Testing.Desktop.csproj", "{05FA61CB-22AA-4834-8C45-1161C42DF2C7}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FunGame.Core", "..\FunGame.Core\FunGame.Core.csproj", "{94B564CD-7A1E-4B3C-AF78-23EBCD5D627E}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -21,6 +23,10 @@ Global {05FA61CB-22AA-4834-8C45-1161C42DF2C7}.Debug|Any CPU.Build.0 = Debug|Any CPU {05FA61CB-22AA-4834-8C45-1161C42DF2C7}.Release|Any CPU.ActiveCfg = Release|Any CPU {05FA61CB-22AA-4834-8C45-1161C42DF2C7}.Release|Any CPU.Build.0 = Release|Any CPU + {94B564CD-7A1E-4B3C-AF78-23EBCD5D627E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {94B564CD-7A1E-4B3C-AF78-23EBCD5D627E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {94B564CD-7A1E-4B3C-AF78-23EBCD5D627E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {94B564CD-7A1E-4B3C-AF78-23EBCD5D627E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Library/Main.cs b/Library/Main.cs index 87d4354..95f2043 100644 --- a/Library/Main.cs +++ b/Library/Main.cs @@ -1,5 +1,14 @@ using Milimoe.FunGame.Testing.Tests; -FunGameSimulation.StartGame(true); +bool printout = false; +List strs = FunGameSimulation.StartGame(printout); +if (printout == false) +{ + foreach (string str in strs) + { + Console.WriteLine(str); + } +} + Console.ReadKey(); diff --git a/Library/Skills/ColdBlue/嗜血本能.cs b/Library/Skills/ColdBlue/嗜血本能.cs index a363c97..2123a47 100644 --- a/Library/Skills/ColdBlue/嗜血本能.cs +++ b/Library/Skills/ColdBlue/嗜血本能.cs @@ -24,7 +24,7 @@ namespace Milimoe.FunGame.Testing.Skills { public override long Id => Skill.Id; public override string Name => Skill.Name; - public override string Description => $"{Duration} 秒内,攻击拥有标记的角色将根据标记层数获得 {吸血 * 100:0.##}% 吸血每层。"; + public override string Description => $"{Duration} 时间内,攻击拥有标记的角色将根据标记层数获得 {吸血 * 100:0.##}% 吸血每层。"; public override bool TargetSelf => true; public override bool Durative => true; public override double Duration => 30; diff --git a/Library/Skills/NanGanyu/灵能反射.cs b/Library/Skills/NanGanyu/灵能反射.cs index 79a9582..5ad32f0 100644 --- a/Library/Skills/NanGanyu/灵能反射.cs +++ b/Library/Skills/NanGanyu/灵能反射.cs @@ -51,7 +51,7 @@ namespace Milimoe.FunGame.Testing.Skills { double 获得的魔法值 = Calculation.Round2Digits(实际获得能量值 * 10); character.MP += 获得的魔法值; - WriteLine("[ " + character + " ] 发动了三重叠加!额外获得了 " + 获得的魔法值 + " 魔法值!"); + WriteLine("[ " + character + " ] 发动了三重叠加!回复了 " + 获得的魔法值 + " 魔法值!"); } } } diff --git a/Library/Skills/NiuNan/变幻之心.cs b/Library/Skills/NiuNan/变幻之心.cs index c598636..f2954b4 100644 --- a/Library/Skills/NiuNan/变幻之心.cs +++ b/Library/Skills/NiuNan/变幻之心.cs @@ -23,7 +23,7 @@ namespace Milimoe.FunGame.Testing.Skills { public override long Id => Skill.Id; public override string Name => "变幻之心"; - public override string Description => $"检查 [ 智慧与力量 ] 的模式。在力量模式下,立即回复 {生命值回复 * 100}% 生命值;智力模式下,下一次魔法伤害提升 {伤害提升 * 100}%。"; + public override string Description => $"检查 [ 智慧与力量 ] 的模式。在力量模式下,立即回复 {生命值回复 * 100:0.##}% 生命值;智力模式下,下一次魔法伤害提升 {伤害提升 * 100:0.##}%。"; public override bool TargetSelf => true; private double 生命值回复 => Calculation.Round4Digits(0.25 + 0.03 * (Level - 1)); diff --git a/Library/Skills/Oshima/力量爆发.cs b/Library/Skills/Oshima/力量爆发.cs index a9cf8aa..3c9e6d4 100644 --- a/Library/Skills/Oshima/力量爆发.cs +++ b/Library/Skills/Oshima/力量爆发.cs @@ -23,12 +23,12 @@ namespace Milimoe.FunGame.Testing.Skills { public override long Id => Skill.Id; public override string Name => "力量爆发"; - public override string Description => $"获得 150% 力量 [ {攻击力加成} ] 的攻击力加成,持续 {Duration} 秒,清除硬直时间。"; + public override string Description => $"获得 150% 力量 [ {攻击力加成} ] 的攻击力加成,持续 {Duration} 时间。"; public override bool TargetSelf => true; public override bool Durative => true; public override double Duration => 10 + 1 * (Level - 1); - private double 攻击力加成 => Calculation.Round2Digits(Skill.Character?.STR * 1.5 ?? 0); // 300% 攻击力加成 + private double 攻击力加成 => Calculation.Round2Digits(Skill.Character?.STR * 1.5 ?? 0); private double 实际攻击力加成 = 0; public override void OnEffectGained(Character character) diff --git a/Library/Skills/QWQAQW/玻璃大炮.cs b/Library/Skills/QWQAQW/玻璃大炮.cs index 0d42a99..b5da0b4 100644 --- a/Library/Skills/QWQAQW/玻璃大炮.cs +++ b/Library/Skills/QWQAQW/玻璃大炮.cs @@ -25,59 +25,63 @@ namespace Milimoe.FunGame.Testing.Skills { public override long Id => Skill.Id; public override string Name => Skill.Name; - public override string Description => $"生命值高于30%时,受到额外的 [ 20~40% ] 伤害,但是获得 [ 上次所受伤害的 110~140% ] 伤害加成;生命值低于等于30%时,不会受到额外的伤害,仅能获得 [ 上次所受伤害的 35% ] 伤害加成。" + - $"在没有受到任何伤害的时候,将获得 {常规伤害加成 * 100:0.##}% 伤害加成。(当前伤害加成:{伤害加成 * 100:0.##}%)"; + public override string Description => $"生命值高于 30% 时,受到额外的 [ {高于30额外伤害下限}~{高于30额外伤害上限}% ] 伤害,但是获得 [ 累计所受伤害的 {高于30的加成下限}~{高于30的加成上限}% ] 伤害加成;生命值低于等于 30% 时,不会受到额外的伤害,仅能获得 [ 累计受到的伤害 {低于30的加成下限}~{低于30的加成上限}% ] 伤害加成。" + + $"在没有受到任何伤害的时候,将获得 {常规伤害加成 * 100:0.##}% 伤害加成。" + (累计受到的伤害 > 0 ? $"(当前伤害加成:{伤害加成(累计受到的伤害) * 100:0.##}%)" : ""); public override bool TargetSelf => true; - private double 上次受到的伤害 = 0; + private double 累计受到的伤害 = 0; private double 这次的伤害加成 = 0; + private double 受到伤害之前的HP = 0; private double 这次受到的额外伤害 = 0; - private readonly double 常规伤害加成 = 0.2; - private readonly int 高于30的加成上限 = 40; - private readonly int 高于30的加成下限 = 10; - private readonly double 低于30的加成 = 0.35; + private readonly double 常规伤害加成 = 0.35; + private readonly int 高于30额外伤害上限 = 40; + private readonly int 高于30额外伤害下限 = 20; + private readonly int 高于30的加成上限 = 100; + private readonly int 高于30的加成下限 = 80; + private readonly int 低于30的加成上限 = 60; + private readonly int 低于30的加成下限 = 40; - private double 伤害加成 + private double 伤害加成(double damage) { - get + double 系数 = 常规伤害加成; + Character? character = Skill.Character; + if (character != null && 累计受到的伤害 != 0) { - double 系数 = 常规伤害加成; - Character? character = Skill.Character; - if (character is null) return 系数; - if (上次受到的伤害 != 0) + if (character.HP > character.MaxHP * 0.3) { - if (character.HP > character.MaxHP * 0.3) - { - 系数 = Calculation.Round2Digits(1.0 + ((new Random().Next(高于30的加成下限, 高于30的加成上限) + 0.0) / 100)); - } - else - { - 系数 = 低于30的加成; - } + 系数 = Calculation.Round4Digits(1.0 + ((new Random().Next(高于30的加成下限, 高于30的加成上限) + 0.0) / 100)); } - return 系数; + else + { + 系数 = Calculation.Round4Digits(1.0 + ((new Random().Next(低于30的加成下限, 低于30的加成上限) + 0.0) / 100)); + } + return Calculation.Round2Digits(系数 * 累计受到的伤害); } + return Calculation.Round2Digits(系数 * damage); } public override void AlterExpectedDamageBeforeCalculation(Character character, Character enemy, ref double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType) { if (character == Skill.Character) { - 这次的伤害加成 = Calculation.Round2Digits(damage * 伤害加成); + 这次的伤害加成 = 伤害加成(damage); damage = Calculation.Round2Digits(damage + 这次的伤害加成); WriteLine($"[ {character} ] 发动了玻璃大炮,获得了 {这次的伤害加成} 点伤害加成!"); + 累计受到的伤害 = 0; } if (enemy == Skill.Character) { - if (character.HP > character.MaxHP * 0.3) + 受到伤害之前的HP = enemy.HP; + if (enemy.HP > enemy.MaxHP * 0.3) { // 额外受到伤害 - double 系数 = Calculation.Round4Digits((new Random().Next(20, 40) + 0.0) / 100); + double 系数 = Calculation.Round4Digits((new Random().Next(高于30额外伤害下限, 高于30额外伤害上限) + 0.0) / 100); 这次受到的额外伤害 = Calculation.Round2Digits(damage * 系数); damage = Calculation.Round2Digits(damage + 这次受到的额外伤害); - WriteLine($"[ {character} ] 的玻璃大炮触发,将额外受到 {这次受到的额外伤害} 点伤害!"); + WriteLine($"[ {enemy} ] 的玻璃大炮触发,将额外受到 {这次受到的额外伤害} 点伤害!"); } + else 这次受到的额外伤害 = 0; } } @@ -85,7 +89,12 @@ namespace Milimoe.FunGame.Testing.Skills { if (enemy == Skill.Character && damageResult != DamageResult.Evaded) { - 上次受到的伤害 = damage; + 累计受到的伤害 = Calculation.Round2Digits(累计受到的伤害 + damage); + if (enemy.HP < 0 && 受到伤害之前的HP - damage + 这次受到的额外伤害 > 0) + { + enemy.HP = 10; + WriteLine($"[ {enemy} ] 的玻璃大炮触发,保护了自己不进入死亡!!"); + } } } } diff --git a/Library/Skills/QWQAQW/迅捷之势.cs b/Library/Skills/QWQAQW/迅捷之势.cs index f8056a5..48ec85d 100644 --- a/Library/Skills/QWQAQW/迅捷之势.cs +++ b/Library/Skills/QWQAQW/迅捷之势.cs @@ -23,7 +23,7 @@ namespace Milimoe.FunGame.Testing.Skills { public override long Id => Skill.Id; public override string Name => Skill.Name; - public override string Description => $"{Duration} 秒内,普通攻击转为魔法伤害,且硬直时间减少50%,并基于 {智力系数 * 100:0.##}% 智力 [{智力加成}] 强化普通攻击伤害。"; + public override string Description => $"{Duration} 时间内,普通攻击转为魔法伤害,且硬直时间减少50%,并基于 {智力系数 * 100:0.##}% 智力 [{智力加成}] 强化普通攻击伤害。"; public override bool TargetSelf => true; public override bool Durative => true; public override double Duration => 40; diff --git a/Library/Skills/QingXiang/能量毁灭.cs b/Library/Skills/QingXiang/能量毁灭.cs index 0a8c72d..272bfaf 100644 --- a/Library/Skills/QingXiang/能量毁灭.cs +++ b/Library/Skills/QingXiang/能量毁灭.cs @@ -24,12 +24,13 @@ namespace Milimoe.FunGame.Testing.Skills public override long Id => Skill.Id; public override string Name => Skill.Name; public override string Description => $"对所有角色造成 " + - $"450% 其现有能量值 + {智力系数 * 100:0.##}% 智力 [ {智力伤害} ] 的魔法伤害。"; + $"{能量系数 * 100:0.##}% 其现有能量值 + {智力系数 * 100:0.##}% 智力 [ {智力伤害} ] 的魔法伤害。"; public override bool TargetSelf => false; public override double TargetRange => 999; private double 智力系数 => Calculation.Round4Digits(0.55 * Level); private double 智力伤害 => Calculation.Round2Digits(智力系数 * Skill.Character?.INT ?? 0); + private readonly double 能量系数 = Calculation.Round4Digits(4.5); public override void OnSkillCasted(Character caster, List enemys, List teammates, Dictionary others) { @@ -37,7 +38,7 @@ namespace Milimoe.FunGame.Testing.Skills { WriteLine($"[ {caster} ] 正在毁灭 [ {c} ] 的能量!!"); double ep = c.EP; - DamageToEnemy(caster, c, true, MagicType, Calculation.Round2Digits(ep * 6.0 + 智力伤害)); + DamageToEnemy(caster, c, true, MagicType, Calculation.Round2Digits(ep * 能量系数 + 智力伤害)); } } } diff --git a/Library/Skills/XinYin/天赐之力.cs b/Library/Skills/XinYin/天赐之力.cs index d330cdb..d753ee2 100644 --- a/Library/Skills/XinYin/天赐之力.cs +++ b/Library/Skills/XinYin/天赐之力.cs @@ -23,7 +23,7 @@ namespace Milimoe.FunGame.Testing.Skills { public override long Id => Skill.Id; public override string Name => Skill.Name; - public override string Description => $"{Duration} 时间内,增加 40% 攻击力 [ {攻击力提升} ]、30% 物理穿透和 25% 闪避率(不可叠加),普通攻击硬直时间额外减少 20%,基于 {系数 * 100:0.##}% 敏捷 [ {伤害加成} ] 强化普通攻击的伤害。"; + public override string Description => $"{Duration} 时间内,增加 40% 攻击力 [ {攻击力提升} ]、30% 物理穿透和 25% 闪避率(不可叠加),普通攻击硬直时间额外减少 20%,基于 {系数 * 100:0.##}% 敏捷 [ {伤害加成} ] 强化普通攻击的伤害。在持续时间内,【心灵之火】的冷却时间降低至 3 时间。"; public override bool TargetSelf => false; public override int TargetCount => 1; public override bool Durative => true; @@ -40,6 +40,11 @@ namespace Milimoe.FunGame.Testing.Skills character.ExATK2 += 实际的攻击力提升; character.PhysicalPenetration += 0.3; character.ExEvadeRate += 0.25; + if (character.Effects.Where(e => e is 心灵之火特效).FirstOrDefault() is 心灵之火特效 e) + { + e.基础冷却时间 = 3; + if (e.冷却时间 > e.基础冷却时间) e.冷却时间 = e.基础冷却时间; + } } public override void OnEffectLost(Character character) @@ -47,6 +52,16 @@ namespace Milimoe.FunGame.Testing.Skills character.ExATK2 -= 实际的攻击力提升; character.PhysicalPenetration -= 0.3; character.ExEvadeRate -= 0.25; + if (character.Effects.Where(e => e is 心灵之火特效).FirstOrDefault() is 心灵之火特效 e) + { + e.基础冷却时间 = 8; + } + } + + public override CharacterActionType AlterActionTypeBeforeAction(Character character, CharacterState state, ref bool canUseItem, ref bool canCastSkill, ref double pUseItem, ref double pCastSkill, ref double pNormalAttack) + { + pNormalAttack += 0.1; + return CharacterActionType.None; } public override void AlterExpectedDamageBeforeCalculation(Character character, Character enemy, ref double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType) diff --git a/Library/Skills/XinYin/心灵之火.cs b/Library/Skills/XinYin/心灵之火.cs index 250b5db..e52acba 100644 --- a/Library/Skills/XinYin/心灵之火.cs +++ b/Library/Skills/XinYin/心灵之火.cs @@ -25,20 +25,40 @@ namespace Milimoe.FunGame.Testing.Skills { public override long Id => Skill.Id; public override string Name => Skill.Name; - public override string Description => $"增加 20% 攻击力且普通攻击硬直时间减少 20%。"; + public override string Description => $"普通攻击硬直时间减少 20%。每次使用普通攻击时,额外再发动一次普通攻击,伤害特效可叠加,冷却 {基础冷却时间:0.##} 时间。" + + (冷却时间 > 0 ? $"(正在冷却:剩余 {冷却时间:0.##} 时间)" : ""); public override bool TargetSelf => true; - private double 实际增加攻击力 = 0; + public double 冷却时间 { get; set; } = 0; + public double 基础冷却时间 { get; set; } = 20; + private bool 是否是嵌套普通攻击 = false; - public override void OnEffectGained(Character character) + public override void AfterDamageCalculation(Character character, Character enemy, double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, DamageResult damageResult) { - 实际增加攻击力 = character.BaseATK * 0.2; - character.ExATK2 += 实际增加攻击力; + if (character == Skill.Character && isNormalAttack && 冷却时间 == 0 && !是否是嵌套普通攻击 && ActionQueue != null) + { + WriteLine($"[ {character} ] 发动了心灵之火!额外进行一次普通攻击!"); + 冷却时间 = 基础冷却时间; + 是否是嵌套普通攻击 = true; + character.NormalAttack.Attack(ActionQueue, character, enemy); + } + + if (character == Skill.Character && 是否是嵌套普通攻击) + { + 是否是嵌套普通攻击 = false; + } } - public override void OnEffectLost(Character character) + public override void OnTimeElapsed(Character character, double elapsed) { - character.ExATK2 -= 实际增加攻击力; + if (冷却时间 > 0) + { + 冷却时间 = Calculation.Round2Digits(冷却时间 - elapsed); + if (冷却时间 <= 0) + { + 冷却时间 = 0; + } + } } public override void AlterHardnessTimeAfterNormalAttack(Character character, ref double baseHardnessTime, ref bool isCheckProtected) diff --git a/Library/Skills/Yang/魔法涌流.cs b/Library/Skills/Yang/魔法涌流.cs index d3e62b8..209589d 100644 --- a/Library/Skills/Yang/魔法涌流.cs +++ b/Library/Skills/Yang/魔法涌流.cs @@ -23,7 +23,7 @@ namespace Milimoe.FunGame.Testing.Skills { public override long Id => Skill.Id; public override string Name => "魔法涌流"; - public override string Description => $"{Duration} 秒内,增加所有伤害的 {减伤比例 * 100:0.##}% 伤害减免,并将普通攻击转为魔法伤害,可叠加魔法震荡的效果。"; + public override string Description => $"{Duration} 时间内,增加所有伤害的 {减伤比例 * 100:0.##}% 伤害减免,并将普通攻击转为魔法伤害,可叠加魔法震荡的效果。"; public override bool TargetSelf => true; public override bool Durative => true; public override double Duration => 25; diff --git a/Library/Tests/FunGame.cs b/Library/Tests/FunGame.cs index ce3f18d..6688107 100644 --- a/Library/Tests/FunGame.cs +++ b/Library/Tests/FunGame.cs @@ -1,4 +1,4 @@ -using System.Reflection; +using System.Text; using Milimoe.FunGame.Core.Api.Utility; using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Common.Addon; @@ -21,7 +21,7 @@ namespace Milimoe.FunGame.Testing.Tests if (IsRuning) return ["游戏正在模拟中,请勿重复请求!"]; List result = []; - int death = 0; + int deaths = 0; Msg = ""; IsRuning = true; @@ -318,6 +318,9 @@ namespace Milimoe.FunGame.Testing.Tests actionQueue.DisplayQueue(); if (PrintOut) Console.WriteLine(); + // 总游戏时长 + double totalTime = 0; + // 总回合数 int i = 1; while (i < 999) @@ -365,28 +368,51 @@ namespace Milimoe.FunGame.Testing.Tests } // 模拟时间流逝 - actionQueue.TimeLapse(); + totalTime += actionQueue.TimeLapse(); - // 使用反射获取私有字段 - FieldInfo? eliminatedField = actionQueue.GetType().GetField("_eliminated", BindingFlags.NonPublic | BindingFlags.Instance); - // 从对象中获取该字段的值 - if (eliminatedField != null) + if (actionQueue.Eliminated.Count > deaths) { - if (eliminatedField.GetValue(actionQueue) is List eliminatedList && eliminatedList.Count > death) + deaths = actionQueue.Eliminated.Count; + string roundMsg = Msg; + string[] strs = roundMsg.Split("==== 角色状态 ===="); + if (strs.Length > 0) { - death = eliminatedList.Count; - string roundMsg = Msg; - string[] strs = roundMsg.Split("==== 角色状态 ===="); - if (strs.Length > 0) - { - roundMsg = strs[0]; - } - result.Add(roundMsg); + roundMsg = strs[0]; } + result.Add(roundMsg); } } - if (PrintOut) Console.WriteLine("--- End ---"); + if (PrintOut) + { + Console.WriteLine("--- End ---"); + Console.WriteLine("总游戏时长:" + Calculation.Round2Digits(totalTime)); + Console.WriteLine(""); + } + + // 赛后统计 + WriteLine("==== 伤害排行榜 TOP6 ===="); + Msg = "==== 伤害排行榜 TOP6 ====\r\n"; + // 显示前四的角色统计 + int count = 1; + foreach (Character character in actionQueue.CharacterStatistics.OrderByDescending(d => d.Value.TotalDamage).Select(d => d.Key)) + { + StringBuilder builder = new(); + CharacterStatistics stats = actionQueue.CharacterStatistics[character]; + builder.AppendLine($"{count}. [ {character.ToStringWithLevel()} ]"); + builder.AppendLine($"存活时长:{stats.LiveTime} / 存活回合数:{stats.LiveRound} / 行动回合数:{stats.ActionTurn}"); + builder.AppendLine($"总计伤害:{stats.TotalDamage} / 每秒伤害:{stats.DamagePerSecond} / 每回合伤害:{stats.DamagePerTurn}"); + builder.Append($"总计物理伤害:{stats.TotalPhysicalDamage} / 总计魔法伤害:{stats.TotalMagicDamage}"); + if (count++ <= 6) + { + WriteLine(builder.ToString()); + } + else + { + Console.WriteLine(builder.ToString()); + } + } + result.Add(Msg); IsRuning = false; } From 2f668aa1f59b5c03b23a2aee51dd32dd4f89ec8b Mon Sep 17 00:00:00 2001 From: milimoe Date: Sun, 15 Sep 2024 01:30:35 +0800 Subject: [PATCH 15/15] PrintOut --- Library/Tests/FunGame.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Tests/FunGame.cs b/Library/Tests/FunGame.cs index 6688107..7cad331 100644 --- a/Library/Tests/FunGame.cs +++ b/Library/Tests/FunGame.cs @@ -409,7 +409,7 @@ namespace Milimoe.FunGame.Testing.Tests } else { - Console.WriteLine(builder.ToString()); + if (PrintOut) Console.WriteLine(builder.ToString()); } } result.Add(Msg);