commit f9052358a94a4777f2dec13ced6d34068ed0cccf Author: milimoe Date: Mon Nov 9 19:38:28 2026 +0800 chore: initialize OshimaBot repository (rename from Enhancement) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a4f9a9f --- /dev/null +++ b/.gitignore @@ -0,0 +1,20 @@ +# 本地策划资料,不纳入版本控制 +/docs/ + +# .NET 构建产物 +bin/ +obj/ + +# Visual Studio / IDE 本地状态 +.vs/ +*.user +*.suo +*.userosscache +*.sln.docstates + +# 本地运行期与凭据文件 +appsettings.*.local.json +*.pfx + +# WorkBuddy 会话数据 +.workbuddy/ diff --git a/OshimaBot.Content/Characters/CHAOS.cs b/OshimaBot.Content/Characters/CHAOS.cs new file mode 100644 index 0000000..3e8f28f --- /dev/null +++ b/OshimaBot.Content/Characters/CHAOS.cs @@ -0,0 +1,29 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; + +namespace OshimaBot.Content.Characters +{ + public class CHAOS : Character + { + public CHAOS() : base() + { + Id = 16; + Name = "CHAO"; + FirstName = "SHI"; + NickName = "超市"; + PrimaryAttribute = PrimaryAttribute.STR; + InitialATK = 27; + InitialHP = 100; + InitialMP = 40; + InitialSTR = 14; + STRGrowth = 1.8; + InitialAGI = 12; + AGIGrowth = 1.1; + InitialINT = 4; + INTGrowth = 0.1; + InitialSPD = 300; + InitialHR = 4; + InitialMR = 2; + } + } +} diff --git a/OshimaBot.Content/Characters/ColdBlue.cs b/OshimaBot.Content/Characters/ColdBlue.cs new file mode 100644 index 0000000..477a7ef --- /dev/null +++ b/OshimaBot.Content/Characters/ColdBlue.cs @@ -0,0 +1,29 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; + +namespace OshimaBot.Content.Characters +{ + public class ColdBlue : Character + { + public ColdBlue() : base() + { + Id = 10; + Name = "Cold"; + FirstName = "Blue"; + NickName = "冷蓝"; + PrimaryAttribute = PrimaryAttribute.STR; + InitialATK = 28; + InitialHP = 95; + InitialMP = 25; + InitialSTR = 22; + STRGrowth = 1.9; + InitialAGI = 4; + AGIGrowth = 0.6; + InitialINT = 4; + INTGrowth = 0.6; + InitialSPD = 300; + InitialHR = 4; + InitialMR = 2; + } + } +} diff --git a/OshimaBot.Content/Characters/CustomCharacter.cs b/OshimaBot.Content/Characters/CustomCharacter.cs new file mode 100644 index 0000000..9f211c7 --- /dev/null +++ b/OshimaBot.Content/Characters/CustomCharacter.cs @@ -0,0 +1,80 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; + +namespace OshimaBot.Content.Characters +{ + public class CustomCharacter : Character + { + public CustomCharacter(long user_id, string name, string firstname = "", string nickname = "", PrimaryAttribute primaryAttribute = PrimaryAttribute.None) : base() + { + Id = user_id; + Name = name; + FirstName = firstname; + NickName = nickname; + PrimaryAttribute = (PrimaryAttribute)Random.Next(1, 4); + InitialATK = Random.Next(15, 26); + InitialHP = Random.Next(40, 86); + InitialMP = Random.Next(20, 56); + + int reduce = 0; + int reduceGrowth = 0; + if (primaryAttribute != PrimaryAttribute.None) + { + int attribute = Random.Next(15, 31); + int growth = Random.Next(15, 31); + switch (primaryAttribute) + { + case PrimaryAttribute.STR: + InitialSTR = attribute; + STRGrowth = Calculation.Round(Convert.ToDouble(growth) / 10, 2); + break; + case PrimaryAttribute.AGI: + InitialAGI = attribute; + AGIGrowth = Calculation.Round(Convert.ToDouble(growth) / 10, 2); + break; + case PrimaryAttribute.INT: + InitialINT = attribute; + INTGrowth = Calculation.Round(Convert.ToDouble(growth) / 10, 2); + break; + } + PrimaryAttribute = primaryAttribute; + reduce = attribute; + reduceGrowth = growth; + } + + int value = 31 - reduce; + int valueGrowth = 31 - reduceGrowth; + for (int i = 0; i < 3; i++) + { + if (value == 0) break; + int attribute = i < 2 ? Random.Next(value) : (value - 1); + int growth = i < 2 ? Random.Next(0, valueGrowth) : (valueGrowth - 1); + switch (i) + { + case 1: + if (primaryAttribute == PrimaryAttribute.AGI) continue; + InitialAGI = attribute; + AGIGrowth = Calculation.Round(Convert.ToDouble(growth) / 10, 2); + break; + case 2: + if (primaryAttribute == PrimaryAttribute.INT) continue; + InitialINT = attribute; + INTGrowth = Calculation.Round(Convert.ToDouble(growth) / 10, 2); + break; + case 0: + default: + if (primaryAttribute == PrimaryAttribute.STR) continue; + InitialSTR = attribute; + STRGrowth = Calculation.Round(Convert.ToDouble(growth) / 10, 2); + break; + } + value -= attribute; + valueGrowth -= growth; + } + InitialSPD = Random.Next(220, 291); + InitialHR = Random.Next(1, 6); + InitialMR = Random.Next(1, 6); + } + } +} diff --git a/OshimaBot.Content/Characters/Dddovo.cs b/OshimaBot.Content/Characters/Dddovo.cs new file mode 100644 index 0000000..3fc6430 --- /dev/null +++ b/OshimaBot.Content/Characters/Dddovo.cs @@ -0,0 +1,29 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; + +namespace OshimaBot.Content.Characters +{ + public class Dddovo : Character + { + public Dddovo() : base() + { + Id = 11; + Name = "ddd"; + FirstName = "ovo"; + NickName = "绿拱门"; + PrimaryAttribute = PrimaryAttribute.AGI; + InitialATK = 22; + InitialHP = 65; + InitialMP = 22; + InitialSTR = 10; + STRGrowth = 1; + InitialAGI = 20; + AGIGrowth = 2; + InitialINT = 0; + INTGrowth = 0; + InitialSPD = 300; + InitialHR = 4; + InitialMR = 2; + } + } +} diff --git a/OshimaBot.Content/Characters/DokyoMayor.cs b/OshimaBot.Content/Characters/DokyoMayor.cs new file mode 100644 index 0000000..e77f3e8 --- /dev/null +++ b/OshimaBot.Content/Characters/DokyoMayor.cs @@ -0,0 +1,29 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; + +namespace OshimaBot.Content.Characters +{ + public class DokyoMayor : Character + { + public DokyoMayor() : base() + { + Id = 6; + Name = "Dokyo"; + FirstName = "Mayor"; + NickName = "铎京市长"; + PrimaryAttribute = PrimaryAttribute.AGI; + InitialATK = 21; + InitialHP = 120; + InitialMP = 20; + InitialSTR = 7; + STRGrowth = 1; + InitialAGI = 21; + AGIGrowth = 1.8; + InitialINT = 2; + INTGrowth = 0.2; + InitialSPD = 300; + InitialHR = 4; + InitialMR = 2; + } + } +} diff --git a/OshimaBot.Content/Characters/MagicalGirl.cs b/OshimaBot.Content/Characters/MagicalGirl.cs new file mode 100644 index 0000000..33641f1 --- /dev/null +++ b/OshimaBot.Content/Characters/MagicalGirl.cs @@ -0,0 +1,29 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; + +namespace OshimaBot.Content.Characters +{ + public class MagicalGirl : Character + { + public MagicalGirl() : base() + { + Id = 7; + Name = "Magical"; + FirstName = "Girl"; + NickName = "魔法少女"; + PrimaryAttribute = PrimaryAttribute.AGI; + InitialATK = 20; + InitialHP = 95; + InitialMP = 35; + InitialSTR = 7; + STRGrowth = 0.3; + InitialAGI = 15; + AGIGrowth = 2.3; + InitialINT = 8; + INTGrowth = 0.4; + InitialSPD = 300; + InitialHR = 4; + InitialMR = 2; + } + } +} diff --git a/OshimaBot.Content/Characters/NanGanYu.cs b/OshimaBot.Content/Characters/NanGanYu.cs new file mode 100644 index 0000000..312659f --- /dev/null +++ b/OshimaBot.Content/Characters/NanGanYu.cs @@ -0,0 +1,29 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; + +namespace OshimaBot.Content.Characters +{ + public class NanGanYu : Character + { + public NanGanYu() : base() + { + Id = 4; + Name = "Nan"; + FirstName = "Ganyu"; + NickName = "男甘雨"; + PrimaryAttribute = PrimaryAttribute.INT; + InitialATK = 17; + InitialHP = 115; + InitialMP = 80; + InitialSTR = 6; + STRGrowth = 0.6; + InitialAGI = 7; + AGIGrowth = 0.7; + InitialINT = 17; + INTGrowth = 1.7; + InitialSPD = 300; + InitialHR = 4; + InitialMR = 2; + } + } +} diff --git a/OshimaBot.Content/Characters/Neptune.cs b/OshimaBot.Content/Characters/Neptune.cs new file mode 100644 index 0000000..1e2827e --- /dev/null +++ b/OshimaBot.Content/Characters/Neptune.cs @@ -0,0 +1,29 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; + +namespace OshimaBot.Content.Characters +{ + public class Neptune : Character + { + public Neptune() : base() + { + Id = 15; + Name = "Nep"; + FirstName = "tune"; + NickName = "海王星"; + PrimaryAttribute = PrimaryAttribute.STR; + InitialATK = 26; + InitialHP = 95; + InitialMP = 55; + InitialSTR = 16; + STRGrowth = 1.4; + InitialAGI = 7; + AGIGrowth = 1; + InitialINT = 7; + INTGrowth = 0.6; + InitialSPD = 300; + InitialHR = 4; + InitialMR = 2; + } + } +} diff --git a/OshimaBot.Content/Characters/NiuNan.cs b/OshimaBot.Content/Characters/NiuNan.cs new file mode 100644 index 0000000..df5dae3 --- /dev/null +++ b/OshimaBot.Content/Characters/NiuNan.cs @@ -0,0 +1,29 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; + +namespace OshimaBot.Content.Characters +{ + public class NiuNan : Character + { + public NiuNan() : base() + { + Id = 5; + Name = "Niu"; + FirstName = "Nan"; + NickName = "牛腩"; + PrimaryAttribute = PrimaryAttribute.INT; + InitialATK = 16; + InitialHP = 75; + InitialMP = 90; + InitialSTR = 0; + STRGrowth = 0; + InitialAGI = 0; + AGIGrowth = 0; + InitialINT = 30; + INTGrowth = 3; + InitialSPD = 300; + InitialHR = 4; + InitialMR = 2; + } + } +} diff --git a/OshimaBot.Content/Characters/Organisms.cs b/OshimaBot.Content/Characters/Organisms.cs new file mode 100644 index 0000000..e313a28 --- /dev/null +++ b/OshimaBot.Content/Characters/Organisms.cs @@ -0,0 +1,7 @@ +namespace OshimaBot.Content.Characters +{ + public class Organisms + { + + } +} diff --git a/OshimaBot.Content/Characters/OshimaShiya.cs b/OshimaBot.Content/Characters/OshimaShiya.cs new file mode 100644 index 0000000..3b88040 --- /dev/null +++ b/OshimaBot.Content/Characters/OshimaShiya.cs @@ -0,0 +1,29 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; + +namespace OshimaBot.Content.Characters +{ + public class OshimaShiya : Character + { + public OshimaShiya() : base() + { + Id = 1; + Name = "Oshima"; + FirstName = "Shiya"; + NickName = "大島シヤ"; + PrimaryAttribute = PrimaryAttribute.STR; + InitialATK = 25; + InitialHP = 85; + InitialMP = 10; + InitialSTR = 30; + STRGrowth = 3; + InitialAGI = 0; + AGIGrowth = 0; + InitialINT = 0; + INTGrowth = 0; + InitialSPD = 300; + InitialHR = 4; + InitialMR = 2; + } + } +} diff --git a/OshimaBot.Content/Characters/QWQAQW.cs b/OshimaBot.Content/Characters/QWQAQW.cs new file mode 100644 index 0000000..9c55b4c --- /dev/null +++ b/OshimaBot.Content/Characters/QWQAQW.cs @@ -0,0 +1,29 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; + +namespace OshimaBot.Content.Characters +{ + public class QWQAQW : Character + { + public QWQAQW() : base() + { + Id = 9; + Name = "QWQ"; + FirstName = "AQW"; + NickName = "LUOLI66"; + PrimaryAttribute = PrimaryAttribute.INT; + InitialATK = 18; + InitialHP = 100; + InitialMP = 45; + InitialSTR = 0; + STRGrowth = 0; + InitialAGI = 15; + AGIGrowth = 1.5; + InitialINT = 15; + INTGrowth = 1.5; + InitialSPD = 300; + InitialHR = 4; + InitialMR = 2; + } + } +} diff --git a/OshimaBot.Content/Characters/QingXiang.cs b/OshimaBot.Content/Characters/QingXiang.cs new file mode 100644 index 0000000..315939a --- /dev/null +++ b/OshimaBot.Content/Characters/QingXiang.cs @@ -0,0 +1,29 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; + +namespace OshimaBot.Content.Characters +{ + public class QingXiang : Character + { + public QingXiang() : base() + { + Id = 8; + Name = "Qing"; + FirstName = "Xiang"; + NickName = "清香"; + PrimaryAttribute = PrimaryAttribute.INT; + InitialATK = 26; + InitialHP = 110; + InitialMP = 80; + InitialSTR = 6; + STRGrowth = 0.5; + InitialAGI = 4; + AGIGrowth = 0.5; + InitialINT = 20; + INTGrowth = 2; + InitialSPD = 300; + InitialHR = 4; + InitialMR = 2; + } + } +} diff --git a/OshimaBot.Content/Characters/Quduoduo.cs b/OshimaBot.Content/Characters/Quduoduo.cs new file mode 100644 index 0000000..c94f991 --- /dev/null +++ b/OshimaBot.Content/Characters/Quduoduo.cs @@ -0,0 +1,29 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; + +namespace OshimaBot.Content.Characters +{ + public class Quduoduo : Character + { + public Quduoduo() : base() + { + Id = 12; + Name = "Qu"; + FirstName = "Duoduo"; + NickName = "趣多多"; + PrimaryAttribute = PrimaryAttribute.STR; + InitialATK = 19; + InitialHP = 90; + InitialMP = 40; + InitialSTR = 13; + STRGrowth = 1.5; + InitialAGI = 13; + AGIGrowth = 1.2; + InitialINT = 4; + INTGrowth = 0.3; + InitialSPD = 300; + InitialHR = 4; + InitialMR = 2; + } + } +} diff --git a/OshimaBot.Content/Characters/Ryuko.cs b/OshimaBot.Content/Characters/Ryuko.cs new file mode 100644 index 0000000..1c63d85 --- /dev/null +++ b/OshimaBot.Content/Characters/Ryuko.cs @@ -0,0 +1,29 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; + +namespace OshimaBot.Content.Characters +{ + public class Ryuko : Character + { + public Ryuko() : base() + { + Id = 17; + Name = "Ryu"; + FirstName = "ko"; + NickName = "流"; + PrimaryAttribute = PrimaryAttribute.AGI; + InitialATK = 22; + InitialHP = 100; + InitialMP = 45; + InitialSTR = 11; + STRGrowth = 0.8; + InitialAGI = 15; + AGIGrowth = 1.9; + InitialINT = 4; + INTGrowth = 0.3; + InitialSPD = 300; + InitialHR = 4; + InitialMR = 2; + } + } +} diff --git a/OshimaBot.Content/Characters/ShiYu.cs b/OshimaBot.Content/Characters/ShiYu.cs new file mode 100644 index 0000000..0ad0e33 --- /dev/null +++ b/OshimaBot.Content/Characters/ShiYu.cs @@ -0,0 +1,29 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; + +namespace OshimaBot.Content.Characters +{ + public class ShiYu : Character + { + public ShiYu() : base() + { + Id = 13; + Name = "Shi"; + FirstName = "Yu"; + NickName = "时雨"; + PrimaryAttribute = PrimaryAttribute.AGI; + InitialATK = 20; + InitialHP = 105; + InitialMP = 65; + InitialSTR = 7; + STRGrowth = 0.7; + InitialAGI = 14; + AGIGrowth = 1.5; + InitialINT = 9; + INTGrowth = 0.8; + InitialSPD = 300; + InitialHR = 4; + InitialMR = 2; + } + } +} diff --git a/OshimaBot.Content/Characters/TheGodK.cs b/OshimaBot.Content/Characters/TheGodK.cs new file mode 100644 index 0000000..0db3849 --- /dev/null +++ b/OshimaBot.Content/Characters/TheGodK.cs @@ -0,0 +1,29 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; + +namespace OshimaBot.Content.Characters +{ + public class TheGodK : Character + { + public TheGodK() : base() + { + Id = 18; + Name = "The God"; + FirstName = "K"; + NickName = "K神"; + PrimaryAttribute = PrimaryAttribute.INT; + InitialATK = 23; + InitialHP = 80; + InitialMP = 70; + InitialSTR = 6; + STRGrowth = 0.6; + InitialAGI = 11; + AGIGrowth = 1.1; + InitialINT = 13; + INTGrowth = 1.3; + InitialSPD = 300; + InitialHR = 4; + InitialMR = 2; + } + } +} diff --git a/OshimaBot.Content/Characters/XReouni.cs b/OshimaBot.Content/Characters/XReouni.cs new file mode 100644 index 0000000..735e7b0 --- /dev/null +++ b/OshimaBot.Content/Characters/XReouni.cs @@ -0,0 +1,29 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; + +namespace OshimaBot.Content.Characters +{ + public class XReouni : Character + { + public XReouni() : base() + { + Id = 14; + Name = "X"; + FirstName = "Reouni"; + NickName = "雷欧尼"; + PrimaryAttribute = PrimaryAttribute.INT; + InitialATK = 19; + InitialHP = 90; + InitialMP = 75; + InitialSTR = 9; + STRGrowth = 0.9; + InitialAGI = 9; + AGIGrowth = 0.6; + InitialINT = 12; + INTGrowth = 1.5; + InitialSPD = 300; + InitialHR = 4; + InitialMR = 2; + } + } +} diff --git a/OshimaBot.Content/Characters/XinYin.cs b/OshimaBot.Content/Characters/XinYin.cs new file mode 100644 index 0000000..5a2a248 --- /dev/null +++ b/OshimaBot.Content/Characters/XinYin.cs @@ -0,0 +1,30 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; + +namespace OshimaBot.Content.Characters +{ + public class XinYin : Character + { + public XinYin() : base() + { + Id = 2; + Name = "Xiyue"; + FirstName = "XinYin"; + NickName = "心音"; + PrimaryAttribute = PrimaryAttribute.AGI; + InitialATK = 22; + InitialHP = 85; + InitialMP = 60; + InitialSTR = 8; + STRGrowth = 0.9; + InitialAGI = 19; + AGIGrowth = 1.7; + InitialINT = 3; + INTGrowth = 0.4; + InitialSPD = 300; + InitialHR = 4; + InitialMR = 2; + + } + } +} diff --git a/OshimaBot.Content/Characters/Yang.cs b/OshimaBot.Content/Characters/Yang.cs new file mode 100644 index 0000000..c8f7462 --- /dev/null +++ b/OshimaBot.Content/Characters/Yang.cs @@ -0,0 +1,29 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; + +namespace OshimaBot.Content.Characters +{ + public class Yang : Character + { + public Yang() : base() + { + Id = 3; + Name = "Ya"; + FirstName = "Yang"; + NickName = "吖养"; + PrimaryAttribute = PrimaryAttribute.STR; + InitialATK = 23; + InitialHP = 105; + InitialMP = 55; + InitialSTR = 11; + STRGrowth = 1.8; + InitialAGI = 9; + AGIGrowth = 0.5; + InitialINT = 10; + INTGrowth = 0.7; + InitialSPD = 300; + InitialHR = 4; + InitialMR = 2; + } + } +} diff --git a/OshimaBot.Content/Classes/OshimaClasses.cs b/OshimaBot.Content/Classes/OshimaClasses.cs new file mode 100644 index 0000000..8e54e0e --- /dev/null +++ b/OshimaBot.Content/Classes/OshimaClasses.cs @@ -0,0 +1,115 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.ClassPlan; +using FunGame.Core.Model.Framework; +using OshimaBot.Content.Skills; + +namespace OshimaBot.Content.Classes +{ + /// + /// 首个真实职业内容:职业「剑士」与流派「剑豪」 + /// · 技能池:4 个真实战技 + 2 个被动,供路线图「职业技能选择权」消耗 + /// · 天赋池:核心 / 先锋 / 近卫 三系(核心天赋由内核自动附加「全等级 +1」) + /// · 固有被动:1 级与 6 级各 1 个,与路线图 InherentPassive 档位一致 + /// · 职业模板属性上下限:约束 1 级初始分配(30 点 + 3.0 成长) + /// · 路线图数值:沿用 默认表,不做职业专属覆盖 + /// + public static class OshimaClasses + { + /// 职业编号:剑士 + public const long 剑士职业 = 7001; + + /// 流派编号:剑豪 + public const long 剑豪流派 = 7002; + + /// 天赋编号:核心·剑心通明 + public const long 剑心通明 = 7010; + + /// 天赋编号:先锋·疾风剑势 + public const long 疾风剑势 = 7011; + + /// 天赋编号:近卫·铁壁架势 + public const long 铁壁架势 = 7012; + + /// 天赋编号:核心·剑意凝聚(与剑心通明同定位,用于验证同定位多天赋) + public const long 剑意凝聚 = 7013; + + /// 固有被动编号:剑士体魄(1 级) + public const long 剑士体魄 = 7020; + + /// 固有被动编号:剑豪意志(6 级) + public const long 剑豪意志 = 7021; + + /// + /// 创建职业「剑士」定义(每次返回新实例,供规划器 Copy 为玩家职业记录) + /// + public static Class Create剑士() + { + Class definition = new() { Id = 剑士职业, Name = "剑士" }; + + // 职业模板属性上下限:1 级初始分配必须落在该区间内(与角色模板限值取交集) + definition.AttributeLimit = new ClassAttributeLimit( + strMin: 8, strMax: 24, + agiMax: 16, + intMax: 10, + strGrowthMax: 2.4, + agiGrowthMax: 1.6, + intGrowthMax: 1.0); + + // 技能池:战技 + definition.Skills.Add(new 绞丝棍 { Level = 1 }); + definition.Skills.Add(new 金刚击 { Level = 1 }); + definition.Skills.Add(new 旋风轮 { Level = 1 }); + definition.Skills.Add(new 双连击 { Level = 1 }); + + // 技能池:被动(消耗被动选择权习得) + definition.PassiveSkills.Add(new 强攻 { Level = 1 }); + definition.PassiveSkills.Add(new 征服者 { Level = 1 }); + + // 天赋池:按定位索引,战斗天赋绑定职业;同一定位可提供多个候选 + definition.CombatTalents[RoleType.Core] = + [ + new OpenSkill(剑心通明, "剑心通明", []) { Level = 1 }, + new OpenSkill(剑意凝聚, "剑意凝聚", []) { Level = 1 } + ]; + definition.CombatTalents[RoleType.Vanguard] = [new OpenSkill(疾风剑势, "疾风剑势", []) { Level = 1 }]; + definition.CombatTalents[RoleType.Guardian] = [new OpenSkill(铁壁架势, "铁壁架势", []) { Level = 1 }]; + + return definition; + } + + /// + /// 创建流派「剑豪」定义(提供核心 / 先锋 / 近卫定位候选与 1 / 6 级固有被动) + /// + /// 所属职业记录(流派等级委托给该职业) + public static SubClass Create剑豪(Class owner) + { + SubClass definition = new(owner) { Id = 剑豪流派, Name = "剑豪" }; + definition.RoleTypes.Add(RoleType.Core); + definition.RoleTypes.Add(RoleType.Vanguard); + definition.RoleTypes.Add(RoleType.Guardian); + definition.InherentPassives[1] = [new OpenSkill(剑士体魄, "剑士体魄", []) { Level = 1 }]; + definition.InherentPassives[6] = [new OpenSkill(剑豪意志, "剑豪意志", []) { Level = 1 }]; + return definition; + } + + /// + /// 创建【转换战斗天赋】战技实例,交给 注入 + /// + /// 目标定位;null 时由内核自动选择当前未激活的已学天赋 + public static Skill Create转换战斗天赋(RoleType? targetRoleType = null) + { + return new 转换战斗天赋(null, targetRoleType); + } + + /// + /// 把本模块的职业 / 流派 / 转换战斗天赋战技注册到核心库定义注册表(进程启动时调用一次) + /// 注册后职业计划存档才能按 IdName 重建职业与流派记录 + /// + public static void RegisterAll() + { + ClassDefinitionRegistry.Register(Create剑士, Create剑豪); + ClassDefinitionRegistry.RegisterSwitchSkill(Create转换战斗天赋().GetIdName(), () => Create转换战斗天赋()); + } + } +} diff --git a/OshimaBot.Content/Classes/OshimaWorldClasses.cs b/OshimaBot.Content/Classes/OshimaWorldClasses.cs new file mode 100644 index 0000000..c2c28cf --- /dev/null +++ b/OshimaBot.Content/Classes/OshimaWorldClasses.cs @@ -0,0 +1,357 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.ClassPlan; +using OshimaBot.Content.Skills; + +namespace OshimaBot.Content.Classes +{ + /// + /// 筽祀牻世界观职业内容:3 个职业,每个职业 2 个流派(共 6 组) + /// 世界观依据见 docs_internal/筽祀牻-世界观.md(来源 https://docs.milimoe.com/story/) + /// · 职业取自大陆三方势力:铎京(科技中枢 · 秩序)、META🐴(熵之吞噬 · 混沌)、深海同盟(潮汐复仇 · 第三方) + /// · 技能池一律从模组**通用战技 / 通用被动**中取材(Skills/战技/ 与 Skills/被动/), + /// 每职业 10 个战技 + 4 个被动:路线图共发放 8 次主动技能选择权、3 份「被动或数值提升」共享份额,池子略大于额度以保留取舍 + /// · 战斗天赋池按 索引,每职业 4 个(核心 / 先锋 / 近卫 / 特色定位) + /// · 流派提供 1 级与 6 级各 1 个固有被动,并按设定开放相应的角色定位 + /// · 职业模板属性上下限约束 1 级初始分配(30 点 + 3.0 成长):导械师偏敏捷智力、熵噬者偏力量、深潮行者均衡偏力量 + /// · 号段:职业 7x01、流派 7x11 / 7x12、天赋 7x21–7x24、固有被动 7x31–7x34(x = 1 铎京 / 2 META🐴 / 3 深海) + /// + public static class OshimaWorldClasses + { + #region 铎京:导械师(7101) + + /// 职业编号:导械师(铎京 · 导力机械与能量研究) + public const long 导械师职业 = 7101; + + /// 流派编号:晶枢术士(能量节点操控者) + public const long 晶枢术士流派 = 7111; + + /// 流派编号:铳械猎手(远程精准打击) + public const long 铳械猎手流派 = 7112; + + /// 天赋编号:核心·晶枢共鸣 + public const long 晶枢共鸣 = 7121; + + /// 天赋编号:先锋·过载推进 + public const long 过载推进 = 7122; + + /// 天赋编号:近卫·力场护盾 + public const long 力场护盾 = 7123; + + /// 天赋编号:辅助·后勤补给 + public const long 后勤补给 = 7124; + + /// 固有被动编号:能量感知(晶枢术士 · 1 级) + public const long 能量感知 = 7131; + + /// 固有被动编号:节点共鸣(晶枢术士 · 6 级) + public const long 节点共鸣 = 7132; + + /// 固有被动编号:枪械精通(铳械猎手 · 1 级) + public const long 枪械精通 = 7133; + + /// 固有被动编号:穿透弹头(铳械猎手 · 6 级) + public const long 穿透弹头 = 7134; + + /// + /// 创建职业「导械师」:铎京的导力技师,以精密机械、枪械与能量节点研究为业 + /// + public static Class Create导械师() + { + Class definition = new() { Id = 导械师职业, Name = "导械师" }; + + // 铎京技师:主敏捷与智力,力量受机械外骨骼限制 + definition.AttributeLimit = new ClassAttributeLimit( + strMax: 16, + agiMin: 8, agiMax: 24, + intMin: 6, intMax: 22, + strGrowthMax: 1.6, + agiGrowthMax: 2.4, + intGrowthMax: 2.0); + + // 技能池:战技(导力、枪械、机动、指挥) + definition.Skills.Add(new 导力装甲 { Level = 1 }); + definition.Skills.Add(new 快速狙击 { Level = 1 }); + definition.Skills.Add(new 精准射击 { Level = 1 }); + definition.Skills.Add(new 跳跃点射 { Level = 1 }); + definition.Skills.Add(new 回复弹 { Level = 1 }); + definition.Skills.Add(new 闪现 { Level = 1 }); + definition.Skills.Add(new 疾走 { Level = 1 }); + definition.Skills.Add(new 号令 { Level = 1 }); + definition.Skills.Add(new 助威 { Level = 1 }); + definition.Skills.Add(new 挑拨 { Level = 1 }); + + // 技能池:被动(先手、持续输出、机动、续航) + definition.PassiveSkills.Add(new 先攻 { Level = 1 }); + definition.PassiveSkills.Add(new 致命节奏 { Level = 1 }); + definition.PassiveSkills.Add(new 迅捷步法 { Level = 1 }); + definition.PassiveSkills.Add(new 饼干配送 { Level = 1 }); + + // 天赋池 + definition.CombatTalents[RoleType.Core] = [new OpenSkill(晶枢共鸣, "晶枢共鸣", []) { Level = 1 }]; + definition.CombatTalents[RoleType.Vanguard] = [new OpenSkill(过载推进, "过载推进", []) { Level = 1 }]; + definition.CombatTalents[RoleType.Guardian] = [new OpenSkill(力场护盾, "力场护盾", []) { Level = 1 }]; + definition.CombatTalents[RoleType.Support] = [new OpenSkill(后勤补给, "后勤补给", []) { Level = 1 }]; + + return definition; + } + + /// + /// 创建流派「晶枢术士」:操控能量节点的铎京技术官,兼顾防护与支援 + /// + public static SubClass Create晶枢术士(Class owner) + { + SubClass definition = new(owner) { Id = 晶枢术士流派, Name = "晶枢术士" }; + definition.RoleTypes.Add(RoleType.Core); + definition.RoleTypes.Add(RoleType.Guardian); + definition.RoleTypes.Add(RoleType.Support); + definition.InherentPassives[1] = [new OpenSkill(能量感知, "能量感知", []) { Level = 1 }]; + definition.InherentPassives[6] = [new OpenSkill(节点共鸣, "节点共鸣", []) { Level = 1 }]; + return definition; + } + + /// + /// 创建流派「铳械猎手」:铎京军备体系下的远程射手,追求精准与输出 + /// + public static SubClass Create铳械猎手(Class owner) + { + SubClass definition = new(owner) { Id = 铳械猎手流派, Name = "铳械猎手" }; + definition.RoleTypes.Add(RoleType.Core); + definition.RoleTypes.Add(RoleType.Vanguard); + definition.InherentPassives[1] = [new OpenSkill(枪械精通, "枪械精通", []) { Level = 1 }]; + definition.InherentPassives[6] = [new OpenSkill(穿透弹头, "穿透弹头", []) { Level = 1 }]; + return definition; + } + + #endregion + + #region META🐴:熵噬者(7201) + + /// 职业编号:熵噬者(META🐴 · 信奉「力量即真理」,驾驭熵之力) + public const long 熵噬者职业 = 7201; + + /// 流派编号:熵灭剑徒(承袭大岛シヤ双手剑「熵灭」的剑之道路) + public const long 熵灭剑徒流派 = 7211; + + /// 流派编号:实验体(META🐴 人体实验的成品,以极致回复换取失控力量) + public const long 实验体流派 = 7212; + + /// 天赋编号:核心·熵灭回响 + public const long 熵灭回响 = 7221; + + /// 天赋编号:先锋·噬能突进 + public const long 噬能突进 = 7222; + + /// 天赋编号:近卫·熵壁 + public const long 熵壁 = 7223; + + /// 天赋编号:医疗·熵愈(掠夺他人生气填补自身,呼应主角「流」的极致回复) + public const long 熵愈 = 7224; + + /// 固有被动编号:熵之亲和(熵灭剑徒 · 1 级) + public const long 熵之亲和 = 7231; + + /// 固有被动编号:剑势·灭(熵灭剑徒 · 6 级) + public const long 剑势灭 = 7232; + + /// 固有被动编号:再生因子(实验体 · 1 级) + public const long 再生因子 = 7233; + + /// 固有被动编号:熵核觉醒(实验体 · 6 级) + public const long 熵核觉醒 = 7234; + + /// + /// 创建职业「熵噬者」:META🐴 的战斗人员,通过吞噬能量换取压倒性的破坏力 + /// + public static Class Create熵噬者() + { + Class definition = new() { Id = 熵噬者职业, Name = "熵噬者" }; + + // 熵噬者:主力量,智力被熵之力侵蚀而受限 + definition.AttributeLimit = new ClassAttributeLimit( + strMin: 10, strMax: 26, + agiMax: 18, + intMax: 12, + strGrowthMax: 2.6, + agiGrowthMax: 1.8, + intGrowthMax: 1.0); + + // 技能池:战技(剑技、收割、暗影、灾厄) + definition.Skills.Add(new 千剑之雨 { Level = 1 }); + definition.Skills.Add(new 无尽剑制 { Level = 1 }); + definition.Skills.Add(new 光破斩 { Level = 1 }); + definition.Skills.Add(new 光鬼斩 { Level = 1 }); + definition.Skills.Add(new 断罪斩 { Level = 1 }); + definition.Skills.Add(new 血腥旋转 { Level = 1 }); + definition.Skills.Add(new 死亡制裁 { Level = 1 }); + definition.Skills.Add(new 灾难一掷 { Level = 1 }); + definition.Skills.Add(new 绝影 { Level = 1 }); + definition.Skills.Add(new 魔眼 { Level = 1 }); + + // 技能池:被动(征服、收割、贪欲、爆发) + definition.PassiveSkills.Add(new 征服者 { Level = 1 }); + definition.PassiveSkills.Add(new 黑暗收割 { Level = 1 }); + definition.PassiveSkills.Add(new 贪欲猎手 { Level = 1 }); + definition.PassiveSkills.Add(new 电刑 { Level = 1 }); + + // 天赋池 + definition.CombatTalents[RoleType.Core] = [new OpenSkill(熵灭回响, "熵灭回响", []) { Level = 1 }]; + definition.CombatTalents[RoleType.Vanguard] = [new OpenSkill(噬能突进, "噬能突进", []) { Level = 1 }]; + definition.CombatTalents[RoleType.Guardian] = [new OpenSkill(熵壁, "熵壁", []) { Level = 1 }]; + definition.CombatTalents[RoleType.Medic] = [new OpenSkill(熵愈, "熵愈", []) { Level = 1 }]; + + return definition; + } + + /// + /// 创建流派「熵灭剑徒」:以剑承载熵之力,追求极致的歼灭 + /// + public static SubClass Create熵灭剑徒(Class owner) + { + SubClass definition = new(owner) { Id = 熵灭剑徒流派, Name = "熵灭剑徒" }; + definition.RoleTypes.Add(RoleType.Core); + definition.RoleTypes.Add(RoleType.Vanguard); + definition.RoleTypes.Add(RoleType.Guardian); + definition.InherentPassives[1] = [new OpenSkill(熵之亲和, "熵之亲和", []) { Level = 1 }]; + definition.InherentPassives[6] = [new OpenSkill(剑势灭, "剑势·灭", []) { Level = 1 }]; + return definition; + } + + /// + /// 创建流派「实验体」:META🐴 人体实验的成品,拥有极致回复能力,代价是体内熵之力持续失控 + /// + public static SubClass Create实验体(Class owner) + { + SubClass definition = new(owner) { Id = 实验体流派, Name = "实验体" }; + definition.RoleTypes.Add(RoleType.Core); + definition.RoleTypes.Add(RoleType.Guardian); + definition.RoleTypes.Add(RoleType.Medic); + definition.InherentPassives[1] = [new OpenSkill(再生因子, "再生因子", []) { Level = 1 }]; + definition.InherentPassives[6] = [new OpenSkill(熵核觉醒, "熵核觉醒", []) { Level = 1 }]; + return definition; + } + + #endregion + + #region 深海同盟:深潮行者(7301) + + /// 职业编号:深潮行者(深海同盟 · 驾驭潮汐与海兽之力的复仇者) + public const long 深潮行者职业 = 7301; + + /// 流派编号:潮汐守卫(以肉身与潮汐抵御冲击的守护者) + public const long 潮汐守卫流派 = 7311; + + /// 流派编号:深渊猎手(在暗流中猎杀目标的刺杀者) + public const long 深渊猎手流派 = 7312; + + /// 天赋编号:核心·潮汐共鸣 + public const long 潮汐共鸣 = 7321; + + /// 天赋编号:先锋·暗流突袭 + public const long 暗流突袭 = 7322; + + /// 天赋编号:近卫·深渊庇佑 + public const long 深渊庇佑 = 7323; + + /// 天赋编号:医疗·生命之泉(源自筽祀牻之眼的净化之力) + public const long 生命之泉 = 7324; + + /// 固有被动编号:潮汐之躯(潮汐守卫 · 1 级) + public const long 潮汐之躯 = 7331; + + /// 固有被动编号:海兽庇佑(潮汐守卫 · 6 级) + public const long 海兽庇佑 = 7332; + + /// 固有被动编号:深渊感知(深渊猎手 · 1 级) + public const long 深渊感知 = 7333; + + /// 固有被动编号:猎杀本能(深渊猎手 · 6 级) + public const long 猎杀本能 = 7334; + + /// + /// 创建职业「深潮行者」:深海同盟的战士,以海兽般的体魄与洋流操控立足战场 + /// + public static Class Create深潮行者() + { + Class definition = new() { Id = 深潮行者职业, Name = "深潮行者" }; + + // 深潮行者:力量为主、敏捷次之,深海环境限制了智力发展 + definition.AttributeLimit = new ClassAttributeLimit( + strMin: 8, strMax: 24, + agiMax: 20, + intMax: 16, + strGrowthMax: 2.4, + agiGrowthMax: 2.0, + intGrowthMax: 1.4); + + // 技能池:战技(锚击、鞭缚、洋流、回旋) + definition.Skills.Add(new 鲨鱼锚击 { Level = 1 }); + definition.Skills.Add(new 雷索吸缚 { Level = 1 }); + definition.Skills.Add(new 拘束之鞭 { Level = 1 }); + definition.Skills.Add(new 风之鞭 { Level = 1 }); + definition.Skills.Add(new 岚 { Level = 1 }); + definition.Skills.Add(new 螺旋之刃 { Level = 1 }); + definition.Skills.Add(new 陀螺舞 { Level = 1 }); + definition.Skills.Add(new 落叶 { Level = 1 }); + definition.Skills.Add(new 狂刃剑舞 { Level = 1 }); + definition.Skills.Add(new 旋风轮 { Level = 1 }); + + // 技能池:被动(深海外壳、重击、坚韧、反击) + definition.PassiveSkills.Add(new 海妖外壳 { Level = 1 }); + definition.PassiveSkills.Add(new 深海重击 { Level = 1 }); + definition.PassiveSkills.Add(new 不灭之握 { Level = 1 }); + definition.PassiveSkills.Add(new 反击螺旋 { Level = 1 }); + + // 天赋池 + definition.CombatTalents[RoleType.Core] = [new OpenSkill(潮汐共鸣, "潮汐共鸣", []) { Level = 1 }]; + definition.CombatTalents[RoleType.Vanguard] = [new OpenSkill(暗流突袭, "暗流突袭", []) { Level = 1 }]; + definition.CombatTalents[RoleType.Guardian] = [new OpenSkill(深渊庇佑, "深渊庇佑", []) { Level = 1 }]; + definition.CombatTalents[RoleType.Medic] = [new OpenSkill(生命之泉, "生命之泉", []) { Level = 1 }]; + + return definition; + } + + /// + /// 创建流派「潮汐守卫」:如利维坦般承受冲击,守护同袍与海域 + /// + public static SubClass Create潮汐守卫(Class owner) + { + SubClass definition = new(owner) { Id = 潮汐守卫流派, Name = "潮汐守卫" }; + definition.RoleTypes.Add(RoleType.Guardian); + definition.RoleTypes.Add(RoleType.Vanguard); + definition.RoleTypes.Add(RoleType.Medic); + definition.InherentPassives[1] = [new OpenSkill(潮汐之躯, "潮汐之躯", []) { Level = 1 }]; + definition.InherentPassives[6] = [new OpenSkill(海兽庇佑, "海兽庇佑", []) { Level = 1 }]; + return definition; + } + + /// + /// 创建流派「深渊猎手」:潜行于暗流之中,一击定生死 + /// + public static SubClass Create深渊猎手(Class owner) + { + SubClass definition = new(owner) { Id = 深渊猎手流派, Name = "深渊猎手" }; + definition.RoleTypes.Add(RoleType.Core); + definition.RoleTypes.Add(RoleType.Vanguard); + definition.InherentPassives[1] = [new OpenSkill(深渊感知, "深渊感知", []) { Level = 1 }]; + definition.InherentPassives[6] = [new OpenSkill(猎杀本能, "猎杀本能", []) { Level = 1 }]; + return definition; + } + + #endregion + + /// + /// 把本文件的职业 / 流派注册到核心库定义注册表(进程启动时调用一次) + /// 共 3 职业 × 2 流派 = 6 组;【转换战斗天赋】战技复用 的全局注册,此处不重复注册 + /// + public static void RegisterAll() + { + ClassDefinitionRegistry.Register(Create导械师, Create晶枢术士); + ClassDefinitionRegistry.Register(Create导械师, Create铳械猎手); + ClassDefinitionRegistry.Register(Create熵噬者, Create熵灭剑徒); + ClassDefinitionRegistry.Register(Create熵噬者, Create实验体); + ClassDefinitionRegistry.Register(Create深潮行者, Create潮汐守卫); + ClassDefinitionRegistry.Register(Create深潮行者, Create深渊猎手); + } + } +} diff --git a/OshimaBot.Content/Effects/EffectID.cs b/OshimaBot.Content/Effects/EffectID.cs new file mode 100644 index 0000000..4829f3d --- /dev/null +++ b/OshimaBot.Content/Effects/EffectID.cs @@ -0,0 +1,283 @@ +namespace OshimaBot.Content.Effects.OpenEffects +{ + public enum EffectID : long + { + /// + /// 被动特效起点 + /// + Passive_Start = 8000, + + /// + /// 数值攻击力,参数:exatk + /// + ExATK = 8001, + + /// + /// 数值物理护甲,参数:exdef + /// + ExDEF = 8002, + + /// + /// 数值力量,参数:exstr + /// + ExSTR = 8003, + + /// + /// 数值敏捷,参数:exagi + /// + ExAGI = 8004, + + /// + /// 数值智力,参数:exint + /// + ExINT = 8005, + + /// + /// 数值技能硬直时间减少,参数:shtr + /// + SkillHardTimeReduce = 8006, + + /// + /// 数值普攻硬直时间减少,参数:nahtr + /// + NormalAttackHardTimeReduce = 8007, + + /// + /// 加速系数%,参数:exacc + /// + AccelerationCoefficient = 8008, + + /// + /// 数值行动速度,参数:exspd + /// + ExSPD = 8009, + + /// + /// 行动系数%,参考:exac + /// + ExActionCoefficient = 8010, + + /// + /// 冷却缩减%,参数:excdr + /// + ExCDR = 8011, + + /// + /// 数值生命值,参数:exhp + /// + ExMaxHP = 8012, + + /// + /// 数值魔法值,参数:exmp + /// + ExMaxMP = 8013, + + /// + /// 暴击率%,参数:excr + /// + ExCritRate = 8014, + + /// + /// 暴击伤害%,参数:excrd + /// + ExCritDMG = 8015, + + /// + /// 闪避率%,参数:exer + /// + ExEvadeRate = 8016, + + /// + /// 物理穿透%,参数:exppt + /// + PhysicalPenetration = 8017, + + /// + /// 魔法穿透%,参数:exmpt + /// + MagicalPenetration = 8018, + + /// + /// 物理伤害减免%,参数:expdr + /// + ExPDR = 8019, + + /// + /// 魔法抗性% + /// 参数: + /// 魔法类型(对应MagicType,0为所有):mdftype + /// 魔法抗性%:mdfvalue + /// + ExMDF = 8020, + + /// + /// 数值生命回复,参数:exhr + /// + ExHR = 8021, + + /// + /// 数值魔法回复,参数:exmr + /// + ExMR = 8022, + + /// + /// 攻击力%,参数:exatk + /// + ExATK2 = 8023, + + /// + /// 物理护甲%,参数:exdef + /// + ExDEF2 = 8024, + + /// + /// 力量%,参数:exstr + /// + ExSTR2 = 8025, + + /// + /// 敏捷%,参数:exagi + /// + ExAGI2 = 8026, + + /// + /// 智力%,参数:exint + /// + ExINT2 = 8027, + + /// + /// 技能硬直时间减少%,参数:shtr + /// + SkillHardTimeReduce2 = 8028, + + /// + /// 普攻硬直时间减少%,参数:nahtr + /// + NormalAttackHardTimeReduce2 = 8029, + + /// + /// 最大生命值%,参数:exhp + /// + ExMaxHP2 = 8030, + + /// + /// 最大魔法值%,参数:exmp + /// + ExMaxMP2 = 8031, + + /// + /// 动态扩展特效 + /// + DynamicsEffect = 8032, + + /// + /// 无视闪避率,参数:p + /// + IgnoreEvade = 8033, + + /// + /// 数值攻击距离,参数:exatr + /// + ExATR = 8034, + + /// + /// 数值移动距离,参数:exmov + /// + ExMOV = 8035, + + /// + /// 生命偷取%,参数:exls + /// + ExLifesteal = 8038, + + /// + /// 被动特效终点 + /// + Passive_End = 8699, + + /// + /// 主动特效起点 + /// + Active_Start = 8700, + + /// + /// 立即回复生命值,参数:hp + /// + RecoverHP = 8701, + + /// + /// 立即回复魔法值,参数:mp + /// + RecoverMP = 8702, + + /// + /// 立即回复生命值%,参数:hp + /// + RecoverHP2 = 8703, + + /// + /// 立即回复魔法值%,参数:mp + /// + RecoverMP2 = 8704, + + /// + /// 立即获得能量值,参数:ep + /// + GetEP = 8705, + + /// + /// 立即获得经验值,参数:exp + /// + GetEXP = 8706, + + /// + /// 主动特效终点 + /// + Active_End = 8999 + } + + public enum PassiveEffectID : long + { + 完全行动不能 = 4101, + 行动受限 = 4102, + 战斗不能 = 4103, + 封技 = 4104, + 缴械 = 4105, + 标记 = 4106, + 眩晕 = 4107, + 石化 = 4108, + 冻结 = 4109, + 烧伤 = 4110, + 中毒 = 4111, + 诅咒 = 4112, + 愤怒 = 4113, + 混乱 = 4114, + 气绝 = 4115, + 虚弱 = 4116, + 迟滞 = 4117, + 易伤 = 4118, + 物理护盾 = 4119, + 魔法护盾 = 4120, + 物理免疫 = 4121, + 魔法免疫 = 4122, + 技能免疫 = 4123, + 完全免疫 = 4124, + 持续性弱驱散 = 4125, + 持续性强驱散 = 4126, + 累积之压标记 = 4127, + 易损 = 4128, + 电刑标记 = 4129, + 海王星的野望标记 = 4130, + 持续回复 = 4131, + 禁止治疗 = 4132, + 长期监视 = 4133, + 时雨标记 = 4134, + 宫监手标记 = 4135, + 复制技能 = 4136, + 持续伤害 = 4137, + 强运 = 4138, + 巡诊标记 = 4139, + 共鸣标记 = 4140, + 信标标记 = 4141 + } +} diff --git a/OshimaBot.Content/Effects/EfficacyHit.cs b/OshimaBot.Content/Effects/EfficacyHit.cs new file mode 100644 index 0000000..b1942d4 --- /dev/null +++ b/OshimaBot.Content/Effects/EfficacyHit.cs @@ -0,0 +1,56 @@ +using FunGame.Core.Entity; + +namespace OshimaBot.Content.Effects +{ + /// + /// 统一的「魔法效能 → 命中率」口径(2026-09-23 建立)。 + /// ⚙ 背景:`Skill.MagicEfficacy` 是**乘算系数** + /// (`clamp(1 + (施法者INT − 魔法瓶颈) / 魔法瓶颈, 0.01, 2.0)`)。 + /// 此前各处写法不一:`施加概率负面/增益`、`银色荆棘` 只把效能乘在**等级成长项**上 + /// (`基础 + 成长×(Lv−1)×效能`)⇒ **效能对基础概率完全无效**,最终命中率算不直观; + /// 而纯机制魔法(削决策点、施加状态)根本不吃效能乘算,瓶颈形同虚设。 + /// ✅ 统一口径(唯一实现点): + /// + /// 命中率 = clamp( (基础概率 + 概率等级成长 × (Level − 1)) × 魔法效能 , 0, 1 ) + /// + /// ⇒ 效能 100% 时命中率 = 基础概率(**与旧版 Lv6 的数值一致,不改变既有平衡**); + /// 效能 200% 时翻倍(封顶 100%);效能 → 0% 时 → 0%。 + /// ✅ **被非魔法技能混用也安全(无需分流)**:全库 55 处重写 `MagicBottleneck` 的技能 + /// **清一色是魔法**,战技 / 爆发技 / 物品 / 被动都不重写 ⇒ 瓶颈取默认 **0** + /// ⇒ `MagicEfficacy` 在 `瓶颈 == 0` 时**直接返回 1.0**(精确值) + /// ⇒ 本口径对它们退化成**恒等变换**(`(基础+成长×(Lv−1)) × 1.0` ≡ 旧写法)。 + /// 因此「必中型控制」在非魔法技能上也不会被拉低,**一个类型判断分支都不需要**。 + /// 📌 反过来说:**只有重写了 `MagicBottleneck` 的技能**才会真正吃到效能检定。 + /// 📌 **纯机制魔法**(无自身概率,如"削 N 点决策点")取 + /// = 0.5、成长 0 ⇒ 恰好得到 + /// 效能 200% 必中 / 100% 命中 50% / 0% 命中 0%。 + /// + public static class EfficacyHit + { + /// 纯机制魔法的默认基础概率(效能 100% 时命中 50%) + public const double 默认基础概率 = 0.5; + + /// 统一命中率:基础概率(含等级成长)再乘魔法效能,封顶 [0, 1]。 + public static double 命中率(double 基础概率, double 概率等级成长, double 指定等级, double 魔法效能) + { + int level = (int)指定等级; + double baseProb = level > 0 ? 基础概率 + 概率等级成长 * (level - 1) : 基础概率; + return Math.Clamp(baseProb * 魔法效能, 0.0, 1.0); + } + + /// 按 求命中率(自动取技能等级)。 + public static double 命中率(Skill skill, double 基础概率 = 默认基础概率, double 概率等级成长 = 0) + => 命中率(基础概率, 概率等级成长, skill.Level, skill.MagicEfficacy); + + /// + /// 命中检定:**效能 ≥ 200%(命中率封顶 100%)时视为必中,且不消耗随机数** —— + /// 避免无谓推进随机序列,保持整局确定性稳定。 + /// + public static bool 检定(double 命中率, System.Random random) + => 命中率 >= 1.0 || random.NextDouble() <= 命中率; + + /// 日志用:统一的效能/命中率文本。 + public static string 文本(Skill skill, double 命中率) + => $"魔法效能 {skill.MagicEfficacy * 100:0.##}%,命中率 {命中率 * 100:0.##}%"; + } +} diff --git a/OshimaBot.Content/Effects/ItemEffects/GetEP.cs b/OshimaBot.Content/Effects/ItemEffects/GetEP.cs new file mode 100644 index 0000000..72983b8 --- /dev/null +++ b/OshimaBot.Content/Effects/ItemEffects/GetEP.cs @@ -0,0 +1,54 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Effects.ItemEffects +{ + public class GetEP : Effect + { + public override long Id => (long)EffectID.GetEP; + public override string Name => "立即获得能量值"; + public override string Description => $"{Skill.TargetDescription()}立即获得 {实际获得:0.##} 点能量值。" + (Source != null && (Skill.Character != Source || Skill is not OpenSkill) ? $"来自:[ {Source} ]" + (Skill.Item != null ? $" 的 [ {Skill.Item.Name} ]" : (Skill is OpenSkill ? "" : $" 的 [ {Skill.Name} ]")) : ""); + public override EffectType EffectType { get; set; } = EffectType.Item; + + private readonly double 实际获得 = 0; + + public GetEP(Skill skill, Dictionary args, Character? source = null) : base(skill, args) + { + GamingQueue = skill.GamingQueue; + Source = source; + if (Values.Count > 0) + { + string key = Values.Keys.FirstOrDefault(s => s.Equals("ep", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(Values[key].ToString(), out double ep) && ep > 0) + { + 实际获得 = ep; + } + } + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + foreach (Character target in targets) + { + target.EP += 实际获得; + WriteLine($"[ {target} ] 获得了 {实际获得:0.##} 点能量值!"); + } + } + + public override void OnSkillCastedOutside(SkillCastContext ctx) + { + if (ctx.User is not User user) return; + List targets = ctx.Targets; + base.OnSkillCastedOutside(ctx); + foreach (Character target in targets) + { + target.EP += 实际获得; + } + } + } +} diff --git a/OshimaBot.Content/Effects/ItemEffects/GetEXP.cs b/OshimaBot.Content/Effects/ItemEffects/GetEXP.cs new file mode 100644 index 0000000..ec73e83 --- /dev/null +++ b/OshimaBot.Content/Effects/ItemEffects/GetEXP.cs @@ -0,0 +1,54 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Effects.ItemEffects +{ + public class GetEXP : Effect + { + public override long Id => (long)EffectID.GetEXP; + public override string Name => "立即获得经验值"; + public override string Description => $"{Skill.TargetDescription()}立即获得 {实际获得:0.##} 点经验值。" + (Source != null && (Skill.Character != Source || Skill is not OpenSkill) ? $"来自:[ {Source} ]" + (Skill.Item != null ? $" 的 [ {Skill.Item.Name} ]" : (Skill is OpenSkill ? "" : $" 的 [ {Skill.Name} ]")) : ""); + public override EffectType EffectType { get; set; } = EffectType.Item; + + private readonly double 实际获得 = 0; + + public GetEXP(Skill skill, Dictionary args, Character? source = null) : base(skill, args) + { + GamingQueue = skill.GamingQueue; + Source = source; + if (Values.Count > 0) + { + string key = Values.Keys.FirstOrDefault(s => s.Equals("exp", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(Values[key].ToString(), out double exp) && exp > 0) + { + 实际获得 = exp; + } + } + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + foreach (Character target in targets) + { + target.EXP += 实际获得; + WriteLine($"[ {target} ] 获得了 {实际获得:0.##} 点经验值!"); + } + } + + public override void OnSkillCastedOutside(SkillCastContext ctx) + { + if (ctx.User is not User user) return; + List targets = ctx.Targets; + base.OnSkillCastedOutside(ctx); + foreach (Character target in targets) + { + target.EXP += 实际获得; + } + } + } +} \ No newline at end of file diff --git a/OshimaBot.Content/Effects/ItemEffects/RecoverHP.cs b/OshimaBot.Content/Effects/ItemEffects/RecoverHP.cs new file mode 100644 index 0000000..db203e5 --- /dev/null +++ b/OshimaBot.Content/Effects/ItemEffects/RecoverHP.cs @@ -0,0 +1,59 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Effects.ItemEffects +{ + public class RecoverHP : Effect + { + public override long Id => (long)EffectID.RecoverHP; + public override string Name => "立即回复生命值"; + public override string Description => $"立即回复{Skill.TargetDescription()} {实际回复:0.##} 点生命值({(能复活 ? "" : "不")}可用于复活)。" + (Source != null && (Skill.Character != Source || Skill is not OpenSkill) ? $"来自:[ {Source} ]" + (Skill.Item != null ? $" 的 [ {Skill.Item.Name} ]" : (Skill is OpenSkill ? "" : $" 的 [ {Skill.Name} ]")) : ""); + public override EffectType EffectType { get; set; } = EffectType.Item; + + private readonly double 实际回复 = 0; + private readonly bool 能复活 = false; + + public RecoverHP(Skill skill, Dictionary args, Character? source = null) : base(skill, args) + { + GamingQueue = skill.GamingQueue; + Source = source; + if (Values.Count > 0) + { + string key = Values.Keys.FirstOrDefault(s => s.Equals("hp", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(Values[key].ToString(), out double hp) && hp > 0) + { + 实际回复 = hp; + } + key = Values.Keys.FirstOrDefault(s => s.Equals("respawn", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && bool.TryParse(Values[key].ToString(), out bool respawn) && respawn) + { + 能复活 = respawn; + } + } + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + foreach (Character target in targets) + { + HealToTarget(caster, target, 实际回复, 能复活); + } + } + + public override void OnSkillCastedOutside(SkillCastContext ctx) + { + if (ctx.User is not User user) return; + List targets = ctx.Targets; + base.OnSkillCastedOutside(ctx); + foreach (Character target in targets) + { + target.HP += 实际回复; + } + } + } +} diff --git a/OshimaBot.Content/Effects/ItemEffects/RecoverHP2.cs b/OshimaBot.Content/Effects/ItemEffects/RecoverHP2.cs new file mode 100644 index 0000000..f6dacba --- /dev/null +++ b/OshimaBot.Content/Effects/ItemEffects/RecoverHP2.cs @@ -0,0 +1,59 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Effects.ItemEffects +{ + public class RecoverHP2 : Effect + { + public override long Id => (long)EffectID.RecoverHP2; + public override string Name => "立即回复生命值"; + public override string Description => $"立即回复{Skill.TargetDescription()} {回复比例 * 100:0.##}% 最大生命值({(能复活 ? "" : "不")}可用于复活)。" + (Source != null && (Skill.Character != Source || Skill is not OpenSkill) ? $"来自:[ {Source} ]" + (Skill.Item != null ? $" 的 [ {Skill.Item.Name} ]" : (Skill is OpenSkill ? "" : $" 的 [ {Skill.Name} ]")) : ""); + public override EffectType EffectType { get; set; } = EffectType.Item; + + private readonly double 回复比例 = 0; + private readonly bool 能复活 = false; + + public RecoverHP2(Skill skill, Dictionary args, Character? source = null) : base(skill, args) + { + GamingQueue = skill.GamingQueue; + Source = source; + if (Values.Count > 0) + { + string key = Values.Keys.FirstOrDefault(s => s.Equals("hp", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(Values[key].ToString(), out double hp) && hp > 0) + { + 回复比例 = hp; + } + key = Values.Keys.FirstOrDefault(s => s.Equals("respawn", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && bool.TryParse(Values[key].ToString(), out bool respawn) && respawn) + { + 能复活 = respawn; + } + } + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + foreach (Character target in targets) + { + HealToTarget(caster, target, 回复比例 * (target?.MaxHP ?? 0), 能复活); + } + } + + public override void OnSkillCastedOutside(SkillCastContext ctx) + { + if (ctx.User is not User user) return; + List targets = ctx.Targets; + base.OnSkillCastedOutside(ctx); + foreach (Character target in targets) + { + target.HP += 回复比例 * (target?.MaxHP ?? 0); + } + } + } +} diff --git a/OshimaBot.Content/Effects/ItemEffects/RecoverMP.cs b/OshimaBot.Content/Effects/ItemEffects/RecoverMP.cs new file mode 100644 index 0000000..6c723ea --- /dev/null +++ b/OshimaBot.Content/Effects/ItemEffects/RecoverMP.cs @@ -0,0 +1,54 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Effects.ItemEffects +{ + public class RecoverMP : Effect + { + public override long Id => (long)EffectID.RecoverMP; + public override string Name => "立即回复魔法值"; + public override string Description => $"立即回复{Skill.TargetDescription()} {实际回复:0.##} 点魔法值。" + (Source != null && (Skill.Character != Source || Skill is not OpenSkill) ? $"来自:[ {Source} ]" + (Skill.Item != null ? $" 的 [ {Skill.Item.Name} ]" : (Skill is OpenSkill ? "" : $" 的 [ {Skill.Name} ]")) : ""); + public override EffectType EffectType { get; set; } = EffectType.Item; + + private readonly double 实际回复 = 0; + + public RecoverMP(Skill skill, Dictionary args, Character? source = null) : base(skill, args) + { + GamingQueue = skill.GamingQueue; + Source = source; + if (Values.Count > 0) + { + string key = Values.Keys.FirstOrDefault(s => s.Equals("mp", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(Values[key].ToString(), out double mp) && mp > 0) + { + 实际回复 = mp; + } + } + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + foreach (Character target in targets) + { + target.MP += 实际回复; + WriteLine($"[ {target} ] 回复了 {实际回复:0.##} 点魔法值!"); + } + } + + public override void OnSkillCastedOutside(SkillCastContext ctx) + { + if (ctx.User is not User user) return; + List targets = ctx.Targets; + base.OnSkillCastedOutside(ctx); + foreach (Character target in targets) + { + target.MP += 实际回复; + } + } + } +} diff --git a/OshimaBot.Content/Effects/ItemEffects/RecoverMP2.cs b/OshimaBot.Content/Effects/ItemEffects/RecoverMP2.cs new file mode 100644 index 0000000..65ee638 --- /dev/null +++ b/OshimaBot.Content/Effects/ItemEffects/RecoverMP2.cs @@ -0,0 +1,55 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Effects.ItemEffects +{ + public class RecoverMP2 : Effect + { + public override long Id => (long)EffectID.RecoverMP2; + public override string Name => "立即回复魔法值"; + public override string Description => $"立即回复{Skill.TargetDescription()} {回复比例 * 100:0.##}% 最大魔法值。" + (Source != null && (Skill.Character != Source || Skill is not OpenSkill) ? $"来自:[ {Source} ]" + (Skill.Item != null ? $" 的 [ {Skill.Item.Name} ]" : (Skill is OpenSkill ? "" : $" 的 [ {Skill.Name} ]")) : ""); + public override EffectType EffectType { get; set; } = EffectType.Item; + + private readonly double 回复比例 = 0; + + public RecoverMP2(Skill skill, Dictionary args, Character? source = null) : base(skill, args) + { + GamingQueue = skill.GamingQueue; + Source = source; + if (Values.Count > 0) + { + string key = Values.Keys.FirstOrDefault(s => s.Equals("mp", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(Values[key].ToString(), out double mp) && mp > 0) + { + 回复比例 = mp; + } + } + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + foreach (Character target in targets) + { + double mp = 回复比例 * target.MaxMP; + target.MP += mp; + WriteLine($"[ {target} ] 回复了 {mp:0.##} 点魔法值!"); + } + } + + public override void OnSkillCastedOutside(SkillCastContext ctx) + { + if (ctx.User is not User user) return; + List targets = ctx.Targets; + base.OnSkillCastedOutside(ctx); + foreach (Character target in targets) + { + target.MP += 回复比例 * (target?.MaxHP ?? 0); + } + } + } +} diff --git a/OshimaBot.Content/Effects/OpenEffects/AccelerationCoefficient.cs b/OshimaBot.Content/Effects/OpenEffects/AccelerationCoefficient.cs new file mode 100644 index 0000000..2484156 --- /dev/null +++ b/OshimaBot.Content/Effects/OpenEffects/AccelerationCoefficient.cs @@ -0,0 +1,51 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.OpenEffects +{ + public class AccelerationCoefficient : Effect + { + public override long Id => (long)EffectID.AccelerationCoefficient; + public override string Name { get; set; } = "加速系数加成"; + public override string Description => $"{(实际加成 >= 0 ? "增加" : "减少")}角色 {Math.Abs(实际加成) * 100:0.##}% 加速系数。" + (Source != null && (Skill.Character != Source || Skill is not OpenSkill) ? $"来自:[ {Source} ]" + (Skill.Item != null ? $" 的 [ {Skill.Item.Name} ]" : (Skill is OpenSkill ? "" : $" 的 [ {Skill.Name} ]")) : ""); + public double Value => 实际加成; + + private readonly double 实际加成 = 0; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (Durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + character.ExAccelerationCoefficient += 实际加成; + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + character.ExAccelerationCoefficient -= 实际加成; + } + + public AccelerationCoefficient(Skill skill, Dictionary args, Character? source = null) : base(skill, args) + { + EffectType = EffectType.Item; + GamingQueue = skill.GamingQueue; + Source = source; + if (Values.Count > 0) + { + string key = Values.Keys.FirstOrDefault(s => s.Equals("exacc", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(Values[key].ToString(), out double exACC)) + { + 实际加成 = exACC; + } + } + } + } +} diff --git a/OshimaBot.Content/Effects/OpenEffects/DynamicsEffect.cs b/OshimaBot.Content/Effects/OpenEffects/DynamicsEffect.cs new file mode 100644 index 0000000..baef7a3 --- /dev/null +++ b/OshimaBot.Content/Effects/OpenEffects/DynamicsEffect.cs @@ -0,0 +1,654 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.OpenEffects +{ + public class DynamicsEffect : Effect + { + public override long Id => (long)EffectID.DynamicsEffect; + public override string Name { get; set; } = "动态扩展特效"; + public override string Description => string.Join("", Descriptions) + (Source != null && (Skill.Character != Source || Skill is not OpenSkill) ? $"来自:[ {Source} ]" + (Skill.Item != null ? $" 的 [ {Skill.Item.Name} ]" : (Skill is OpenSkill ? "" : $" 的 [ {Skill.Name} ]")) : ""); + public HashSet Descriptions { get; } = []; + public Dictionary RealDynamicsValues { get; } = []; + + /// + /// 加成是否已生效,用于保证移除与重复触发都只结算一次 + /// + private bool 已应用 = false; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (!已应用) + { + // 仅首次获得时初始化剩余时间,避免后续刷新时被重置 + if (Durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + } + else + { + // 已生效过:先还原旧值再套用,避免重复叠加 + Resolve(character, true); + } + Resolve(character); + 已应用 = true; + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (!已应用) return; + Resolve(character, true); + RealDynamicsValues.Clear(); + 已应用 = false; + } + + public override void OnAttributeChanged(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (!已应用) return; + // 各键的加成要么是配置常量、要么是百分比(会随基础属性实时变化),属性侧无需重新结算; + // 这里通过「先还原再套用」重新生成描述中展示的点数,并保护剩余时间不被重置 + double remainDuration = RemainDuration; + int remainDurationTurn = RemainDurationTurn; + Resolve(character, true); + Resolve(character); + RemainDuration = remainDuration; + RemainDurationTurn = remainDurationTurn; + } + + private void Resolve(Character character, bool remove = false) + { + Descriptions.Clear(); + foreach (string key in Values.Keys) + { + string value = Values[key].ToString() ?? ""; + switch (key.ToLower()) + { + case "exatk": + if (double.TryParse(value, out double exATK)) + { + if (!remove) + { + character.ExATK2 += exATK; + } + else if (RealDynamicsValues.TryGetValue("exatk", out double current)) + { + character.ExATK2 -= current; + } + RealDynamicsValues["exatk"] = exATK; + Descriptions.Add($"{(exATK >= 0 ? "增加" : "减少")}角色 {Math.Abs(exATK):0.##} 点攻击力。"); + } + break; + case "exdef": + if (double.TryParse(value, out double exDEF)) + { + if (!remove) + { + character.ExDEF2 += exDEF; + } + else if (RealDynamicsValues.TryGetValue("exdef", out double current)) + { + character.ExDEF2 -= current; + } + RealDynamicsValues["exdef"] = exDEF; + Descriptions.Add($"{(exDEF >= 0 ? "增加" : "减少")}角色 {Math.Abs(exDEF):0.##} 点物理护甲。"); + } + break; + case "exstr": + if (double.TryParse(value, out double exSTR)) + { + if (!remove) + { + character.ExSTR += exSTR; + } + else if (RealDynamicsValues.TryGetValue("exstr", out double current)) + { + character.ExSTR -= current; + } + RealDynamicsValues["exstr"] = exSTR; + Descriptions.Add($"{(exSTR >= 0 ? "增加" : "减少")}角色 {Math.Abs(exSTR):0.##} 点力量。"); + } + break; + case "exagi": + if (double.TryParse(value, out double exAGI)) + { + if (!remove) + { + character.ExAGI += exAGI; + } + else if (RealDynamicsValues.TryGetValue("exagi", out double current)) + { + character.ExAGI -= current; + } + RealDynamicsValues["exagi"] = exAGI; + Descriptions.Add($"{(exAGI >= 0 ? "增加" : "减少")}角色 {Math.Abs(exAGI):0.##} 点敏捷。"); + } + break; + case "exint": + if (double.TryParse(value, out double exINT)) + { + if (!remove) + { + character.ExINT += exINT; + } + else if (RealDynamicsValues.TryGetValue("exint", out double current)) + { + character.ExINT -= current; + } + RealDynamicsValues["exint"] = exINT; + Descriptions.Add($"{(exINT >= 0 ? "增加" : "减少")}角色 {Math.Abs(exINT):0.##} 点智力。"); + } + break; + case "shtr": + if (double.TryParse(value, out double shtr)) + { + if (!remove) + { + foreach (Skill s in character.Skills) + { + s.ExHardnessTime -= shtr; + } + foreach (Skill? s in character.Items.Select(i => i.Skills.Active)) + { + if (s != null) + s.ExHardnessTime -= shtr; + } + } + else if (RealDynamicsValues.TryGetValue("shtr", out double current)) + { + foreach (Skill s in character.Skills) + { + s.ExHardnessTime += current; + } + foreach (Skill? s in character.Items.Select(i => i.Skills.Active)) + { + if (s != null) + s.ExHardnessTime += current; + } + } + RealDynamicsValues["shtr"] = shtr; + Descriptions.Add($"{(shtr < 0 ? "增加" : "减少")}角色的所有主动技能 {Math.Abs(shtr):0.##} {GameplayEquilibriumConstant.InGameTime}硬直时间。"); + } + break; + case "nahtr": + if (double.TryParse(value, out double nahtr)) + { + if (!remove) + { + character.NormalAttack.ExHardnessTime -= nahtr; + } + else if (RealDynamicsValues.TryGetValue("nahtr", out double current)) + { + character.NormalAttack.ExHardnessTime += current; + } + RealDynamicsValues["nahtr"] = nahtr; + Descriptions.Add($"{(nahtr < 0 ? "增加" : "减少")}角色的普通攻击 {Math.Abs(nahtr):0.##} {GameplayEquilibriumConstant.InGameTime}硬直时间。"); + } + break; + case "shtr2": + if (double.TryParse(value, out double shtr2)) + { + if (!remove) + { + foreach (Skill s in character.Skills) + { + s.ExHardnessTime2 -= shtr2; + } + foreach (Skill? s in character.Items.Select(i => i.Skills.Active)) + { + if (s != null) + s.ExHardnessTime2 -= shtr2; + } + } + else if (RealDynamicsValues.TryGetValue("shtr2", out double current)) + { + foreach (Skill s in character.Skills) + { + s.ExHardnessTime2 += current; + } + foreach (Skill? s in character.Items.Select(i => i.Skills.Active)) + { + if (s != null) + s.ExHardnessTime2 += current; + } + } + RealDynamicsValues["shtr2"] = shtr2; + Descriptions.Add($"{(shtr2 < 0 ? "增加" : "减少")}角色的所有主动技能 {Math.Abs(shtr2 * 100):0.##}% 硬直时间。"); + } + break; + case "nahtr2": + if (double.TryParse(value, out double nahtr2)) + { + if (!remove) + { + character.NormalAttack.ExHardnessTime2 -= nahtr2; + } + else if (RealDynamicsValues.TryGetValue("nahtr2", out double current)) + { + character.NormalAttack.ExHardnessTime2 += current; + } + RealDynamicsValues["nahtr2"] = nahtr2; + Descriptions.Add($"{(nahtr2 < 0 ? "增加" : "减少")}角色的普通攻击 {Math.Abs(nahtr2 * 100):0.##}% 硬直时间。"); + } + break; + case "exacc": + if (double.TryParse(value, out double exacc)) + { + if (!remove) + { + character.ExAccelerationCoefficient += exacc; + } + else if (RealDynamicsValues.TryGetValue("exacc", out double current)) + { + character.ExAccelerationCoefficient -= current; + } + RealDynamicsValues["exacc"] = exacc; + Descriptions.Add($"{(exacc >= 0 ? "增加" : "减少")}角色 {Math.Abs(exacc) * 100:0.##}% 加速系数。"); + } + break; + case "exspd": + if (double.TryParse(value, out double exspd)) + { + if (!remove) + { + character.ExSPD += exspd; + } + else if (RealDynamicsValues.TryGetValue("exspd", out double current)) + { + character.ExSPD -= current; + } + RealDynamicsValues["exspd"] = exspd; + Descriptions.Add($"{(exspd >= 0 ? "增加" : "减少")}角色 {Math.Abs(exspd):0.##} 点行动速度。"); + } + break; + case "exac": + if (double.TryParse(value, out double exac)) + { + if (!remove) + { + character.ExActionCoefficient += exac; + } + else if (RealDynamicsValues.TryGetValue("exac", out double current)) + { + character.ExActionCoefficient -= current; + } + RealDynamicsValues["exac"] = exac; + Descriptions.Add($"{(exac >= 0 ? "增加" : "减少")}角色 {Math.Abs(exac) * 100:0.##}% 行动系数。"); + } + break; + case "excdr": + if (double.TryParse(value, out double excdr)) + { + if (!remove) + { + character.ExCDR += excdr; + } + else if (RealDynamicsValues.TryGetValue("excdr", out double current)) + { + character.ExCDR -= current; + } + RealDynamicsValues["excdr"] = excdr; + Descriptions.Add($"{(excdr >= 0 ? "增加" : "减少")}角色 {Math.Abs(excdr) * 100:0.##}% 冷却缩减。"); + } + break; + case "exhp": + if (double.TryParse(value, out double exhp)) + { + if (!remove) + { + character.ExHP2 += exhp; + } + else if (RealDynamicsValues.TryGetValue("exhp", out double current)) + { + character.ExHP2 -= current; + } + RealDynamicsValues["exhp"] = exhp; + Descriptions.Add($"{(exhp >= 0 ? "增加" : "减少")}角色 {Math.Abs(exhp):0.##} 点最大生命值。"); + } + break; + case "exmp": + if (double.TryParse(value, out double exmp)) + { + if (!remove) + { + character.ExMP2 += exmp; + } + else if (RealDynamicsValues.TryGetValue("exmp", out double current)) + { + character.ExMP2 -= current; + } + RealDynamicsValues["exmp"] = exmp; + Descriptions.Add($"{(exmp >= 0 ? "增加" : "减少")}角色 {Math.Abs(exmp):0.##} 点最大魔法值。"); + } + break; + case "excr": + if (double.TryParse(value, out double excr)) + { + if (!remove) + { + character.ExCritRate += excr; + } + else if (RealDynamicsValues.TryGetValue("excr", out double current)) + { + character.ExCritRate -= current; + } + RealDynamicsValues["excr"] = excr; + Descriptions.Add($"{(excr >= 0 ? "增加" : "减少")}角色 {Math.Abs(excr) * 100:0.##}% 暴击率。"); + } + break; + case "excrd": + if (double.TryParse(value, out double excrd)) + { + if (!remove) + { + character.ExCritDMG += excrd; + } + else if (RealDynamicsValues.TryGetValue("excrd", out double current)) + { + character.ExCritDMG -= current; + } + RealDynamicsValues["excrd"] = excrd; + Descriptions.Add($"{(excrd >= 0 ? "增加" : "减少")}角色 {Math.Abs(excrd) * 100:0.##}% 暴击伤害。"); + } + break; + case "exer": + if (double.TryParse(value, out double exer)) + { + if (!remove) + { + character.ExEvadeRate += exer; + } + else if (RealDynamicsValues.TryGetValue("exer", out double current)) + { + character.ExEvadeRate -= current; + } + RealDynamicsValues["exer"] = exer; + Descriptions.Add($"{(exer >= 0 ? "增加" : "减少")}角色 {Math.Abs(exer) * 100:0.##}% 闪避率。"); + } + break; + case "exppt": + if (double.TryParse(value, out double exppt)) + { + if (!remove) + { + character.PhysicalPenetration += exppt; + } + else if (RealDynamicsValues.TryGetValue("exppt", out double current)) + { + character.PhysicalPenetration -= current; + } + RealDynamicsValues["exppt"] = exppt; + Descriptions.Add($"{(exppt >= 0 ? "增加" : "减少")}角色 {Math.Abs(exppt) * 100:0.##}% 物理穿透。"); + } + break; + case "exmpt": + if (double.TryParse(value, out double exmpt)) + { + if (!remove) + { + character.MagicalPenetration += exmpt; + } + else if (RealDynamicsValues.TryGetValue("exmpt", out double current)) + { + character.MagicalPenetration -= current; + } + RealDynamicsValues["exmpt"] = exmpt; + Descriptions.Add($"{(exmpt >= 0 ? "增加" : "减少")}角色 {Math.Abs(exmpt) * 100:0.##}% 魔法穿透。"); + } + break; + case "expdr": + if (double.TryParse(value, out double expdr)) + { + if (!remove) + { + character.ExPDR += expdr; + } + else if (RealDynamicsValues.TryGetValue("expdr", out double current)) + { + character.ExPDR -= current; + } + RealDynamicsValues["expdr"] = expdr; + Descriptions.Add($"{(expdr >= 0 ? "增加" : "减少")}角色 {Math.Abs(expdr) * 100:0.##}% 物理伤害减免。"); + } + break; + case "exhr": + if (double.TryParse(value, out double exhr)) + { + if (!remove) + { + character.ExHR += exhr; + } + else if (RealDynamicsValues.TryGetValue("exhr", out double current)) + { + character.ExHR -= current; + } + RealDynamicsValues["exhr"] = exhr; + Descriptions.Add($"{(exhr >= 0 ? "增加" : "减少")}角色 {Math.Abs(exhr):0.##} 点生命回复。"); + } + break; + case "exmr": + if (double.TryParse(value, out double exmr)) + { + if (!remove) + { + character.ExMR += exmr; + } + else if (RealDynamicsValues.TryGetValue("exmr", out double current)) + { + character.ExMR -= current; + } + RealDynamicsValues["exmr"] = exmr; + Descriptions.Add($"{(exmr >= 0 ? "增加" : "减少")}角色 {Math.Abs(exmr):0.##} 点魔法回复。"); + } + break; + case "exatk2": + if (double.TryParse(value, out double exATK2)) + { + double real = 0; + if (!remove) + { + real = character.BaseATK * exATK2; + character.ExATKPercentage += exATK2; + } + else if (RealDynamicsValues.TryGetValue("exatk2", out double percentage)) + { + character.ExATKPercentage -= percentage; + } + RealDynamicsValues["exatk2"] = exATK2; + Descriptions.Add($"{(real >= 0 ? "增加" : "减少")}角色 {Math.Abs(exATK2) * 100:0.##}% [ {(real == 0 ? "基于基础攻击力" : $"{Math.Abs(real):0.##}")} ] 点攻击力。"); + } + break; + case "exdef2": + if (double.TryParse(value, out double exDEF2)) + { + double real = 0; + if (!remove) + { + real = character.BaseDEF * exDEF2; + character.ExDEFPercentage += exDEF2; + } + else if (RealDynamicsValues.TryGetValue("exdef2", out double percentage)) + { + character.ExDEFPercentage -= percentage; + } + RealDynamicsValues["exdef2"] = exDEF2; + Descriptions.Add($"{(real >= 0 ? "增加" : "减少")}角色 {Math.Abs(exDEF2) * 100:0.##}% [ {(real == 0 ? "基于基础物理护甲" : $"{Math.Abs(real):0.##}")} ] 点物理护甲。"); + } + break; + case "exstr2": + if (double.TryParse(value, out double exSTR2)) + { + double real = 0; + if (!remove) + { + real = character.BaseSTR * exSTR2; + character.ExSTRPercentage += exSTR2; + } + else if (RealDynamicsValues.TryGetValue("exstr2", out double percentage)) + { + character.ExSTRPercentage -= percentage; + } + RealDynamicsValues["exstr2"] = exSTR2; + Descriptions.Add($"{(real >= 0 ? "增加" : "减少")}角色 {Math.Abs(exSTR2) * 100:0.##}% [ {(real == 0 ? "基于基础力量" : $"{Math.Abs(real):0.##}")} ] 点力量。"); + } + break; + case "exagi2": + if (double.TryParse(value, out double exAGI2)) + { + double real = 0; + if (!remove) + { + real = character.BaseAGI * exAGI2; + character.ExAGIPercentage += exAGI2; + } + else if (RealDynamicsValues.TryGetValue("exagi2", out double percentage)) + { + character.ExAGIPercentage -= percentage; + } + RealDynamicsValues["exagi2"] = exAGI2; + Descriptions.Add($"{(real >= 0 ? "增加" : "减少")}角色 {Math.Abs(exAGI2) * 100:0.##}% [ {(real == 0 ? "基于基础敏捷" : $"{Math.Abs(real):0.##}")} ] 点敏捷。"); + } + break; + case "exint2": + if (double.TryParse(value, out double exINT2)) + { + double real = 0; + if (!remove) + { + real = character.BaseINT * exINT2; + character.ExINTPercentage += exINT2; + } + else if (RealDynamicsValues.TryGetValue("exint2", out double percentage)) + { + character.ExINTPercentage -= percentage; + } + RealDynamicsValues["exint2"] = exINT2; + Descriptions.Add($"{(real >= 0 ? "增加" : "减少")}角色 {Math.Abs(exINT2) * 100:0.##}% [ {(real == 0 ? "基于基础智力" : $"{Math.Abs(real):0.##}")} ] 点智力。"); + } + break; + case "exhp2": + if (double.TryParse(value, out double exhp2)) + { + double real = 0; + if (!remove) + { + real = character.MaxHP * exhp2; + character.ExHPPercentage += exhp2; + } + else if (RealDynamicsValues.TryGetValue("exhp2", out double percentage)) + { + character.ExHPPercentage -= percentage; + } + RealDynamicsValues["exhp2"] = exhp2; + Descriptions.Add($"{(real >= 0 ? "增加" : "减少")}角色 {Math.Abs(exhp2) * 100:0.##}% [ {(real == 0 ? "基于基础生命值" : $"{Math.Abs(real):0.##}")} ] 点最大生命值。"); + } + break; + case "exmp2": + if (double.TryParse(value, out double exmp2)) + { + double real = 0; + if (!remove) + { + real = character.MaxMP * exmp2; + character.ExMPPercentage += exmp2; + } + else if (RealDynamicsValues.TryGetValue("exmp2", out double percentage)) + { + character.ExMPPercentage -= percentage; + } + RealDynamicsValues["exmp2"] = exmp2; + Descriptions.Add($"{(real >= 0 ? "增加" : "减少")}角色 {Math.Abs(exmp2) * 100:0.##}% [ {(real == 0 ? "基于基础魔法值" : $"{Math.Abs(real):0.##}")} ] 点最大魔法值。"); + } + break; + case "mdftype": + if (int.TryParse(value, out int mdftype)) + { + double mdfValue = 0; + MagicType magicType = MagicType.None; + if (!remove) + { + magicType = (MagicType)mdftype; + string mdfvalueKey = Values.Keys.FirstOrDefault(s => s.Equals("mdfvalue", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (mdfvalueKey.Length > 0 && double.TryParse(Values[mdfvalueKey].ToString(), out mdfValue)) + { + character.MDF[magicType] += mdfValue; + } + } + else if (RealDynamicsValues.TryGetValue("mdftype", out double currentType)) + { + magicType = (MagicType)(int)currentType; + if (RealDynamicsValues.TryGetValue("mdfvalue", out mdfValue)) + { + character.MDF[magicType] -= mdfValue; + } + } + RealDynamicsValues["mdftype"] = mdftype; + RealDynamicsValues["mdfvalue"] = mdfValue; + Descriptions.Add($"{(mdfValue >= 0 ? "增加" : "减少")}角色 {Math.Abs(mdfValue) * 100:0.##}% {CharacterSet.GetMagicResistanceName(magicType)}。"); + } + break; + case "exls": + if (double.TryParse(value, out double exls)) + { + if (!remove) + { + character.Lifesteal += exls; + } + else if (RealDynamicsValues.TryGetValue("exls", out double current)) + { + character.Lifesteal -= current; + } + RealDynamicsValues["exls"] = exls; + Descriptions.Add($"{(exls >= 0 ? "增加" : "减少")}角色 {Math.Abs(exls) * 100:0.##}% 生命偷取。"); + } + break; + case "exatr": + if (int.TryParse(value, out int exatr)) + { + if (!remove) + { + character.ExATR += exatr; + } + else if (RealDynamicsValues.TryGetValue("exatr", out double current)) + { + character.ExATR -= (int)current; + } + RealDynamicsValues["exatr"] = exatr; + Descriptions.Add($"{(exatr >= 0 ? "增加" : "减少")}角色 {Math.Abs(exatr)} 格攻击距离。"); + } + break; + case "exmov": + if (int.TryParse(value, out int exmov)) + { + if (!remove) + { + character.ExMOV += exmov; + } + else if (RealDynamicsValues.TryGetValue("exmov", out double current)) + { + character.ExMOV -= (int)current; + } + RealDynamicsValues["exmov"] = exmov; + Descriptions.Add($"{(exmov >= 0 ? "增加" : "减少")}角色 {Math.Abs(exmov)} 格移动距离。"); + } + break; + } + } + } + + public DynamicsEffect(Skill skill, Dictionary args, Character? source = null) : base(skill, args) + { + EffectType = EffectType.Item; + GamingQueue = skill.GamingQueue; + Source = source; + } + } +} diff --git a/OshimaBot.Content/Effects/OpenEffects/ExAGI.cs b/OshimaBot.Content/Effects/OpenEffects/ExAGI.cs new file mode 100644 index 0000000..bb5cdad --- /dev/null +++ b/OshimaBot.Content/Effects/OpenEffects/ExAGI.cs @@ -0,0 +1,51 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.OpenEffects +{ + public class ExAGI : Effect + { + public override long Id => (long)EffectID.ExAGI; + public override string Name { get; set; } = "敏捷加成"; + public override string Description => $"{(实际加成 >= 0 ? "增加" : "减少")}角色 {Math.Abs(实际加成):0.##} 点敏捷。" + (Source != null && (Skill.Character != Source || Skill is not OpenSkill) ? $"来自:[ {Source} ]" + (Skill.Item != null ? $" 的 [ {Skill.Item.Name} ]" : (Skill is OpenSkill ? "" : $" 的 [ {Skill.Name} ]")) : ""); + public double Value => 实际加成; + + private readonly double 实际加成 = 0; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (Durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + character.ExAGI += 实际加成; + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + character.ExAGI -= 实际加成; + } + + public ExAGI(Skill skill, Dictionary args, Character? source = null) : base(skill, args) + { + EffectType = EffectType.Item; + GamingQueue = skill.GamingQueue; + Source = source; + if (Values.Count > 0) + { + string key = Values.Keys.FirstOrDefault(s => s.Equals("exagi", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(Values[key].ToString(), out double exAGI)) + { + 实际加成 = exAGI; + } + } + } + } +} diff --git a/OshimaBot.Content/Effects/OpenEffects/ExAGI2.cs b/OshimaBot.Content/Effects/OpenEffects/ExAGI2.cs new file mode 100644 index 0000000..2e00445 --- /dev/null +++ b/OshimaBot.Content/Effects/OpenEffects/ExAGI2.cs @@ -0,0 +1,80 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.OpenEffects +{ + public class ExAGI2 : Effect + { + public override long Id => (long)EffectID.ExAGI2; + public override string Name { get; set; } = "敏捷加成"; + public override string Description => $"{(实际加成 >= 0 ? "增加" : "减少")}角色 {Math.Abs(加成比例) * 100:0.##}% [ {(实际加成 == 0 ? "基于基础敏捷" : $"{Math.Abs(实际加成):0.##}")} ] 点敏捷。" + (Source != null && (Skill.Character != Source || Skill is not OpenSkill) ? $"来自:[ {Source} ]" + (Skill.Item != null ? $" 的 [ {Skill.Item.Name} ]" : (Skill is OpenSkill ? "" : $" 的 [ {Skill.Name} ]")) : ""); + public double Value => 实际加成; + + private readonly double 加成比例 = 0; + private double 实际加成 = 0; + private bool 加成已应用 = false; + private double 已应用加成比例 = 0; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (!加成已应用) + { + // 仅首次获得时初始化剩余时间,避免后续刷新时被重置 + if (Durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + } + else + { + // 已生效过:先还原旧值再套用新值,避免重复叠加 + character.ExAGIPercentage -= 已应用加成比例; + } + 实际加成 = character.BaseAGI * 加成比例; + 已应用加成比例 = 加成比例; + character.ExAGIPercentage += 已应用加成比例; + 加成已应用 = true; + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (!加成已应用) return; + character.ExAGIPercentage -= 已应用加成比例; + 已应用加成比例 = 0; + 实际加成 = 0; + 加成已应用 = false; + } + + public override void OnAttributeChanged(HookContext ctx) + { + // 属性侧是百分比加成,基础敏捷变化时会实时反映到 ExAGI3,无需重新结算; + // 此处只更新描述中展示的点数 + if (ctx.Trigger is Character character && 加成已应用) + { + 实际加成 = character.BaseAGI * 加成比例; + } + } + + public ExAGI2(Skill skill, Dictionary args, Character? source = null) : base(skill, args) + { + EffectType = EffectType.Item; + GamingQueue = skill.GamingQueue; + Source = source; + if (Values.Count > 0) + { + string key = Values.Keys.FirstOrDefault(s => s.Equals("exagi", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(Values[key].ToString(), out double exAGI)) + { + 加成比例 = exAGI; + } + } + } + } +} diff --git a/OshimaBot.Content/Effects/OpenEffects/ExATK.cs b/OshimaBot.Content/Effects/OpenEffects/ExATK.cs new file mode 100644 index 0000000..1a63db3 --- /dev/null +++ b/OshimaBot.Content/Effects/OpenEffects/ExATK.cs @@ -0,0 +1,51 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.OpenEffects +{ + public class ExATK : Effect + { + public override long Id => (long)EffectID.ExATK; + public override string Name { get; set; } = "攻击力加成"; + public override string Description => $"{(实际加成 >= 0 ? "增加" : "减少")}角色 {Math.Abs(实际加成):0.##} 点攻击力。" + (Source != null && (Skill.Character != Source || Skill is not OpenSkill) ? $"来自:[ {Source} ]" + (Skill.Item != null ? $" 的 [ {Skill.Item.Name} ]" : (Skill is OpenSkill ? "" : $" 的 [ {Skill.Name} ]")) : ""); + public double Value => 实际加成; + + private readonly double 实际加成 = 0; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (Durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + character.ExATK2 += 实际加成; + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + character.ExATK2 -= 实际加成; + } + + public ExATK(Skill skill, Dictionary args, Character? source = null) : base(skill, args) + { + EffectType = EffectType.Item; + GamingQueue = skill.GamingQueue; + Source = source; + if (Values.Count > 0) + { + string key = Values.Keys.FirstOrDefault(s => s.Equals("exatk", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(Values[key].ToString(), out double exATK)) + { + 实际加成 = exATK; + } + } + } + } +} diff --git a/OshimaBot.Content/Effects/OpenEffects/ExATK2.cs b/OshimaBot.Content/Effects/OpenEffects/ExATK2.cs new file mode 100644 index 0000000..78d3c27 --- /dev/null +++ b/OshimaBot.Content/Effects/OpenEffects/ExATK2.cs @@ -0,0 +1,80 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.OpenEffects +{ + public class ExATK2 : Effect + { + public override long Id => (long)EffectID.ExATK2; + public override string Name { get; set; } = "攻击力加成"; + public override string Description => $"{(实际加成 >= 0 ? "增加" : "减少")}角色 {Math.Abs(加成比例) * 100:0.##}% [ {(实际加成 == 0 ? "基于基础攻击力" : $"{Math.Abs(实际加成):0.##}")} ] 点攻击力。" + (Source != null && (Skill.Character != Source || Skill is not OpenSkill) ? $"来自:[ {Source} ]" + (Skill.Item != null ? $" 的 [ {Skill.Item.Name} ]" : (Skill is OpenSkill ? "" : $" 的 [ {Skill.Name} ]")) : ""); + public double Value => 实际加成; + + private readonly double 加成比例 = 0; + private double 实际加成 = 0; + private bool 加成已应用 = false; + private double 已应用加成比例 = 0; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (!加成已应用) + { + // 仅首次获得时初始化剩余时间,避免后续刷新时被重置 + if (Durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + } + else + { + // 已生效过:先还原旧值再套用新值,避免重复叠加 + character.ExATKPercentage -= 已应用加成比例; + } + 实际加成 = character.BaseATK * 加成比例; + 已应用加成比例 = 加成比例; + character.ExATKPercentage += 已应用加成比例; + 加成已应用 = true; + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (!加成已应用) return; + character.ExATKPercentage -= 已应用加成比例; + 已应用加成比例 = 0; + 实际加成 = 0; + 加成已应用 = false; + } + + public override void OnAttributeChanged(HookContext ctx) + { + // 属性侧是百分比加成,基础攻击力变化时会实时反映到 ExATK3,无需重新结算; + // 此处只更新描述中展示的点数 + if (ctx.Trigger is Character character && 加成已应用) + { + 实际加成 = character.BaseATK * 加成比例; + } + } + + public ExATK2(Skill skill, Dictionary args, Character? source = null) : base(skill, args) + { + EffectType = EffectType.Item; + GamingQueue = skill.GamingQueue; + Source = source; + if (Values.Count > 0) + { + string key = Values.Keys.FirstOrDefault(s => s.Equals("exatk", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(Values[key].ToString(), out double exATK)) + { + 加成比例 = exATK; + } + } + } + } +} diff --git a/OshimaBot.Content/Effects/OpenEffects/ExATR.cs b/OshimaBot.Content/Effects/OpenEffects/ExATR.cs new file mode 100644 index 0000000..586b2bb --- /dev/null +++ b/OshimaBot.Content/Effects/OpenEffects/ExATR.cs @@ -0,0 +1,51 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.OpenEffects +{ + public class ExATR : Effect + { + public override long Id => (long)EffectID.ExATR; + public override string Name { get; set; } = "攻击距离加成"; + public override string Description => $"{(实际加成 >= 0 ? "增加" : "减少")}角色 {Math.Abs(实际加成)} 格攻击距离。" + (Source != null && (Skill.Character != Source || Skill is not OpenSkill) ? $"来自:[ {Source} ]" + (Skill.Item != null ? $" 的 [ {Skill.Item.Name} ]" : (Skill is OpenSkill ? "" : $" 的 [ {Skill.Name} ]")) : ""); + public int Value => 实际加成; + + private readonly int 实际加成 = 0; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (Durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + character.ExATR += 实际加成; + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + character.ExATR -= 实际加成; + } + + public ExATR(Skill skill, Dictionary args, Character? source = null) : base(skill, args) + { + EffectType = EffectType.Item; + GamingQueue = skill.GamingQueue; + Source = source; + if (Values.Count > 0) + { + string key = Values.Keys.FirstOrDefault(s => s.Equals("exatr", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && int.TryParse(Values[key].ToString(), out int exATR)) + { + 实际加成 = exATR; + } + } + } + } +} diff --git a/OshimaBot.Content/Effects/OpenEffects/ExActionCoefficient.cs b/OshimaBot.Content/Effects/OpenEffects/ExActionCoefficient.cs new file mode 100644 index 0000000..9154503 --- /dev/null +++ b/OshimaBot.Content/Effects/OpenEffects/ExActionCoefficient.cs @@ -0,0 +1,51 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.OpenEffects +{ + public class ExActionCoefficient : Effect + { + public override long Id => (long)EffectID.ExActionCoefficient; + public override string Name { get; set; } = "行动系数加成"; + public override string Description => $"{(实际加成 >= 0 ? "增加" : "减少")}角色 {Math.Abs(实际加成) * 100:0.##}% 行动系数。" + (Source != null && (Skill.Character != Source || Skill is not OpenSkill) ? $"来自:[ {Source} ]" + (Skill.Item != null ? $" 的 [ {Skill.Item.Name} ]" : (Skill is OpenSkill ? "" : $" 的 [ {Skill.Name} ]")) : ""); + public double Value => 实际加成; + + private readonly double 实际加成 = 0; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (Durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + character.ExActionCoefficient += 实际加成; + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + character.ExActionCoefficient -= 实际加成; + } + + public ExActionCoefficient(Skill skill, Dictionary args, Character? source = null) : base(skill, args) + { + EffectType = EffectType.Item; + GamingQueue = skill.GamingQueue; + Source = source; + if (Values.Count > 0) + { + string key = Values.Keys.FirstOrDefault(s => s.Equals("exac", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(Values[key].ToString(), out double exAC)) + { + 实际加成 = exAC; + } + } + } + } +} diff --git a/OshimaBot.Content/Effects/OpenEffects/ExCDR.cs b/OshimaBot.Content/Effects/OpenEffects/ExCDR.cs new file mode 100644 index 0000000..6c04d1c --- /dev/null +++ b/OshimaBot.Content/Effects/OpenEffects/ExCDR.cs @@ -0,0 +1,51 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.OpenEffects +{ + public class ExCDR : Effect + { + public override long Id => (long)EffectID.ExCDR; + public override string Name { get; set; } = "冷却缩减加成"; + public override string Description => $"{(实际加成 >= 0 ? "增加" : "减少")}角色 {Math.Abs(实际加成) * 100:0.##}% 冷却缩减。" + (Source != null && (Skill.Character != Source || Skill is not OpenSkill) ? $"来自:[ {Source} ]" + (Skill.Item != null ? $" 的 [ {Skill.Item.Name} ]" : (Skill is OpenSkill ? "" : $" 的 [ {Skill.Name} ]")) : ""); + public double Value => 实际加成; + + private readonly double 实际加成 = 0; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (Durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + character.ExCDR += 实际加成; + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + character.ExCDR -= 实际加成; + } + + public ExCDR(Skill skill, Dictionary args, Character? source = null) : base(skill, args) + { + EffectType = EffectType.Item; + GamingQueue = skill.GamingQueue; + Source = source; + if (Values.Count > 0) + { + string key = Values.Keys.FirstOrDefault(s => s.Equals("excdr", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(Values[key].ToString(), out double exCDR)) + { + 实际加成 = exCDR; + } + } + } + } +} diff --git a/OshimaBot.Content/Effects/OpenEffects/ExCritDMG.cs b/OshimaBot.Content/Effects/OpenEffects/ExCritDMG.cs new file mode 100644 index 0000000..fa077b3 --- /dev/null +++ b/OshimaBot.Content/Effects/OpenEffects/ExCritDMG.cs @@ -0,0 +1,51 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.OpenEffects +{ + public class ExCritDMG : Effect + { + public override long Id => (long)EffectID.ExCritDMG; + public override string Name { get; set; } = "暴击伤害加成"; + public override string Description => $"{(实际加成 >= 0 ? "增加" : "减少")}角色 {Math.Abs(实际加成) * 100:0.##}% 暴击伤害。" + (Source != null && (Skill.Character != Source || Skill is not OpenSkill) ? $"来自:[ {Source} ]" + (Skill.Item != null ? $" 的 [ {Skill.Item.Name} ]" : (Skill is OpenSkill ? "" : $" 的 [ {Skill.Name} ]")) : ""); + public double Value => 实际加成; + + private readonly double 实际加成 = 0; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (Durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + character.ExCritDMG += 实际加成; + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + character.ExCritDMG -= 实际加成; + } + + public ExCritDMG(Skill skill, Dictionary args, Character? source = null) : base(skill, args) + { + EffectType = EffectType.Item; + GamingQueue = skill.GamingQueue; + Source = source; + if (Values.Count > 0) + { + string key = Values.Keys.FirstOrDefault(s => s.Equals("excrd", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(Values[key].ToString(), out double exCRD)) + { + 实际加成 = exCRD; + } + } + } + } +} diff --git a/OshimaBot.Content/Effects/OpenEffects/ExCritRate.cs b/OshimaBot.Content/Effects/OpenEffects/ExCritRate.cs new file mode 100644 index 0000000..302dad7 --- /dev/null +++ b/OshimaBot.Content/Effects/OpenEffects/ExCritRate.cs @@ -0,0 +1,51 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.OpenEffects +{ + public class ExCritRate : Effect + { + public override long Id => (long)EffectID.ExCritRate; + public override string Name { get; set; } = "暴击率加成"; + public override string Description => $"{(实际加成 >= 0 ? "增加" : "减少")}角色 {Math.Abs(实际加成) * 100:0.##}% 暴击率。" + (Source != null && (Skill.Character != Source || Skill is not OpenSkill) ? $"来自:[ {Source} ]" + (Skill.Item != null ? $" 的 [ {Skill.Item.Name} ]" : (Skill is OpenSkill ? "" : $" 的 [ {Skill.Name} ]")) : ""); + public double Value => 实际加成; + + private readonly double 实际加成 = 0; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (Durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + character.ExCritRate += 实际加成; + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + character.ExCritRate -= 实际加成; + } + + public ExCritRate(Skill skill, Dictionary args, Character? source = null) : base(skill, args) + { + EffectType = EffectType.Item; + GamingQueue = skill.GamingQueue; + Source = source; + if (Values.Count > 0) + { + string key = Values.Keys.FirstOrDefault(s => s.Equals("excr", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(Values[key].ToString(), out double exCR)) + { + 实际加成 = exCR; + } + } + } + } +} diff --git a/OshimaBot.Content/Effects/OpenEffects/ExDEF.cs b/OshimaBot.Content/Effects/OpenEffects/ExDEF.cs new file mode 100644 index 0000000..dc49721 --- /dev/null +++ b/OshimaBot.Content/Effects/OpenEffects/ExDEF.cs @@ -0,0 +1,51 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.OpenEffects +{ + public class ExDEF : Effect + { + public override long Id => (long)EffectID.ExDEF; + public override string Name { get; set; } = "物理护甲加成"; + public override string Description => $"{(实际加成 >= 0 ? "增加" : "减少")}角色 {Math.Abs(实际加成):0.##} 点物理护甲。" + (Source != null && (Skill.Character != Source || Skill is not OpenSkill) ? $"来自:[ {Source} ]" + (Skill.Item != null ? $" 的 [ {Skill.Item.Name} ]" : (Skill is OpenSkill ? "" : $" 的 [ {Skill.Name} ]")) : ""); + public double Value => 实际加成; + + private readonly double 实际加成 = 0; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (Durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + character.ExDEF2 += 实际加成; + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + character.ExDEF2 -= 实际加成; + } + + public ExDEF(Skill skill, Dictionary args, Character? source = null) : base(skill, args) + { + EffectType = EffectType.Item; + GamingQueue = skill.GamingQueue; + Source = source; + if (Values.Count > 0) + { + string key = Values.Keys.FirstOrDefault(s => s.Equals("exdef", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(Values[key].ToString(), out double exDEF)) + { + 实际加成 = exDEF; + } + } + } + } +} diff --git a/OshimaBot.Content/Effects/OpenEffects/ExDEF2.cs b/OshimaBot.Content/Effects/OpenEffects/ExDEF2.cs new file mode 100644 index 0000000..b3724de --- /dev/null +++ b/OshimaBot.Content/Effects/OpenEffects/ExDEF2.cs @@ -0,0 +1,80 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.OpenEffects +{ + public class ExDEF2 : Effect + { + public override long Id => (long)EffectID.ExDEF2; + public override string Name { get; set; } = "物理护甲加成"; + public override string Description => $"{(实际加成 >= 0 ? "增加" : "减少")}角色 {Math.Abs(加成比例) * 100:0.##}% [ {(实际加成 == 0 ? "基于基础物理护甲" : $"{Math.Abs(实际加成):0.##}")} ] 点物理护甲。" + (Source != null && (Skill.Character != Source || Skill is not OpenSkill) ? $"来自:[ {Source} ]" + (Skill.Item != null ? $" 的 [ {Skill.Item.Name} ]" : (Skill is OpenSkill ? "" : $" 的 [ {Skill.Name} ]")) : ""); + public double Value => 实际加成; + + private readonly double 加成比例 = 0; + private double 实际加成 = 0; + private bool 加成已应用 = false; + private double 已应用加成比例 = 0; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (!加成已应用) + { + // 仅首次获得时初始化剩余时间,避免后续刷新时被重置 + if (Durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + } + else + { + // 已生效过:先还原旧值再套用新值,避免重复叠加 + character.ExDEFPercentage -= 已应用加成比例; + } + 实际加成 = character.BaseDEF * 加成比例; + 已应用加成比例 = 加成比例; + character.ExDEFPercentage += 已应用加成比例; + 加成已应用 = true; + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (!加成已应用) return; + character.ExDEFPercentage -= 已应用加成比例; + 已应用加成比例 = 0; + 实际加成 = 0; + 加成已应用 = false; + } + + public override void OnAttributeChanged(HookContext ctx) + { + // 属性侧是百分比加成,基础物理护甲变化时会实时反映到 ExDEF3,无需重新结算; + // 此处只更新描述中展示的点数 + if (ctx.Trigger is Character character && 加成已应用) + { + 实际加成 = character.BaseDEF * 加成比例; + } + } + + public ExDEF2(Skill skill, Dictionary args, Character? source = null) : base(skill, args) + { + EffectType = EffectType.Item; + GamingQueue = skill.GamingQueue; + Source = source; + if (Values.Count > 0) + { + string key = Values.Keys.FirstOrDefault(s => s.Equals("exdef", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(Values[key].ToString(), out double exDEF)) + { + 加成比例 = exDEF; + } + } + } + } +} diff --git a/OshimaBot.Content/Effects/OpenEffects/ExEvadeRate.cs b/OshimaBot.Content/Effects/OpenEffects/ExEvadeRate.cs new file mode 100644 index 0000000..f2ef1f5 --- /dev/null +++ b/OshimaBot.Content/Effects/OpenEffects/ExEvadeRate.cs @@ -0,0 +1,51 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.OpenEffects +{ + public class ExEvadeRate : Effect + { + public override long Id => (long)EffectID.ExEvadeRate; + public override string Name { get; set; } = "闪避率加成"; + public override string Description => $"{(实际加成 >= 0 ? "增加" : "减少")}角色 {Math.Abs(实际加成) * 100:0.##}% 闪避率。" + (Source != null && (Skill.Character != Source || Skill is not OpenSkill) ? $"来自:[ {Source} ]" + (Skill.Item != null ? $" 的 [ {Skill.Item.Name} ]" : (Skill is OpenSkill ? "" : $" 的 [ {Skill.Name} ]")) : ""); + public double Value => 实际加成; + + private readonly double 实际加成 = 0; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (Durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + character.ExEvadeRate += 实际加成; + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + character.ExEvadeRate -= 实际加成; + } + + public ExEvadeRate(Skill skill, Dictionary args, Character? source = null) : base(skill, args) + { + EffectType = EffectType.Item; + GamingQueue = skill.GamingQueue; + Source = source; + if (Values.Count > 0) + { + string key = Values.Keys.FirstOrDefault(s => s.Equals("exer", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(Values[key].ToString(), out double exER)) + { + 实际加成 = exER; + } + } + } + } +} diff --git a/OshimaBot.Content/Effects/OpenEffects/ExHR.cs b/OshimaBot.Content/Effects/OpenEffects/ExHR.cs new file mode 100644 index 0000000..2dfc0b7 --- /dev/null +++ b/OshimaBot.Content/Effects/OpenEffects/ExHR.cs @@ -0,0 +1,51 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.OpenEffects +{ + public class ExHR : Effect + { + public override long Id => (long)EffectID.ExHR; + public override string Name { get; set; } = "生命回复加成"; + public override string Description => $"{(实际加成 >= 0 ? "增加" : "减少")}角色 {Math.Abs(实际加成):0.##} 点生命回复。" + (Source != null && (Skill.Character != Source || Skill is not OpenSkill) ? $"来自:[ {Source} ]" + (Skill.Item != null ? $" 的 [ {Skill.Item.Name} ]" : (Skill is OpenSkill ? "" : $" 的 [ {Skill.Name} ]")) : ""); + public double Value => 实际加成; + + private readonly double 实际加成 = 0; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (Durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + character.ExHR += 实际加成; + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + character.ExHR -= 实际加成; + } + + public ExHR(Skill skill, Dictionary args, Character? source = null) : base(skill, args) + { + EffectType = EffectType.Item; + GamingQueue = skill.GamingQueue; + Source = source; + if (Values.Count > 0) + { + string key = Values.Keys.FirstOrDefault(s => s.Equals("exhr", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(Values[key].ToString(), out double exHR)) + { + 实际加成 = exHR; + } + } + } + } +} diff --git a/OshimaBot.Content/Effects/OpenEffects/ExINT.cs b/OshimaBot.Content/Effects/OpenEffects/ExINT.cs new file mode 100644 index 0000000..ed5aef8 --- /dev/null +++ b/OshimaBot.Content/Effects/OpenEffects/ExINT.cs @@ -0,0 +1,51 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.OpenEffects +{ + public class ExINT : Effect + { + public override long Id => (long)EffectID.ExINT; + public override string Name { get; set; } = "智力加成"; + public override string Description => $"{(实际加成 >= 0 ? "增加" : "减少")}角色 {Math.Abs(实际加成):0.##} 点智力。" + (Source != null && (Skill.Character != Source || Skill is not OpenSkill) ? $"来自:[ {Source} ]" + (Skill.Item != null ? $" 的 [ {Skill.Item.Name} ]" : (Skill is OpenSkill ? "" : $" 的 [ {Skill.Name} ]")) : ""); + public double Value => 实际加成; + + private readonly double 实际加成 = 0; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (Durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + character.ExINT += 实际加成; + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + character.ExINT -= 实际加成; + } + + public ExINT(Skill skill, Dictionary args, Character? source = null) : base(skill, args) + { + EffectType = EffectType.Item; + GamingQueue = skill.GamingQueue; + Source = source; + if (Values.Count > 0) + { + string key = Values.Keys.FirstOrDefault(s => s.Equals("exint", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(Values[key].ToString(), out double exINT)) + { + 实际加成 = exINT; + } + } + } + } +} diff --git a/OshimaBot.Content/Effects/OpenEffects/ExINT2.cs b/OshimaBot.Content/Effects/OpenEffects/ExINT2.cs new file mode 100644 index 0000000..2fd8df2 --- /dev/null +++ b/OshimaBot.Content/Effects/OpenEffects/ExINT2.cs @@ -0,0 +1,80 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.OpenEffects +{ + public class ExINT2 : Effect + { + public override long Id => (long)EffectID.ExINT2; + public override string Name { get; set; } = "智力加成"; + public override string Description => $"{(实际加成 >= 0 ? "增加" : "减少")}角色 {Math.Abs(加成比例) * 100:0.##}% [ {(实际加成 == 0 ? "基于基础智力" : $"{Math.Abs(实际加成):0.##}")} ] 点智力。" + (Source != null && (Skill.Character != Source || Skill is not OpenSkill) ? $"来自:[ {Source} ]" + (Skill.Item != null ? $" 的 [ {Skill.Item.Name} ]" : (Skill is OpenSkill ? "" : $" 的 [ {Skill.Name} ]")) : ""); + public double Value => 实际加成; + + private readonly double 加成比例 = 0; + private double 实际加成 = 0; + private bool 加成已应用 = false; + private double 已应用加成比例 = 0; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (!加成已应用) + { + // 仅首次获得时初始化剩余时间,避免后续刷新时被重置 + if (Durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + } + else + { + // 已生效过:先还原旧值再套用新值,避免重复叠加 + character.ExINTPercentage -= 已应用加成比例; + } + 实际加成 = character.BaseINT * 加成比例; + 已应用加成比例 = 加成比例; + character.ExINTPercentage += 已应用加成比例; + 加成已应用 = true; + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (!加成已应用) return; + character.ExINTPercentage -= 已应用加成比例; + 已应用加成比例 = 0; + 实际加成 = 0; + 加成已应用 = false; + } + + public override void OnAttributeChanged(HookContext ctx) + { + // 属性侧是百分比加成,基础智力变化时会实时反映到 ExINT3,无需重新结算; + // 此处只更新描述中展示的点数 + if (ctx.Trigger is Character character && 加成已应用) + { + 实际加成 = character.BaseINT * 加成比例; + } + } + + public ExINT2(Skill skill, Dictionary args, Character? source = null) : base(skill, args) + { + EffectType = EffectType.Item; + GamingQueue = skill.GamingQueue; + Source = source; + if (Values.Count > 0) + { + string key = Values.Keys.FirstOrDefault(s => s.Equals("exint", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(Values[key].ToString(), out double exINT)) + { + 加成比例 = exINT; + } + } + } + } +} diff --git a/OshimaBot.Content/Effects/OpenEffects/ExLifesteal.cs b/OshimaBot.Content/Effects/OpenEffects/ExLifesteal.cs new file mode 100644 index 0000000..f68f9ca --- /dev/null +++ b/OshimaBot.Content/Effects/OpenEffects/ExLifesteal.cs @@ -0,0 +1,51 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.OpenEffects +{ + public class ExLifesteal : Effect + { + public override long Id => (long)EffectID.ExLifesteal; + public override string Name { get; set; } = "生命偷取加成"; + public override string Description => $"{(实际加成 >= 0 ? "增加" : "减少")}角色 {Math.Abs(实际加成) * 100:0.##}% 生命偷取。" + (Source != null && (Skill.Character != Source || Skill is not OpenSkill) ? $"来自:[ {Source} ]" + (Skill.Item != null ? $" 的 [ {Skill.Item.Name} ]" : (Skill is OpenSkill ? "" : $" 的 [ {Skill.Name} ]")) : ""); + public double Value => 实际加成; + + private readonly double 实际加成 = 0; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (Durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + character.Lifesteal += 实际加成; + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + character.Lifesteal -= 实际加成; + } + + public ExLifesteal(Skill skill, Dictionary args, Character? source = null) : base(skill, args) + { + EffectType = EffectType.Item; + GamingQueue = skill.GamingQueue; + Source = source; + if (Values.Count > 0) + { + string key = Values.Keys.FirstOrDefault(s => s.Equals("exls", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(Values[key].ToString(), out double exLS)) + { + 实际加成 = exLS; + } + } + } + } +} diff --git a/OshimaBot.Content/Effects/OpenEffects/ExMDF.cs b/OshimaBot.Content/Effects/OpenEffects/ExMDF.cs new file mode 100644 index 0000000..4e4b581 --- /dev/null +++ b/OshimaBot.Content/Effects/OpenEffects/ExMDF.cs @@ -0,0 +1,64 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.OpenEffects +{ + public class ExMDF : Effect + { + public override long Id => (long)EffectID.ExMDF; + public override string Name { get; set; } = "魔法抗性加成"; + public override string Description => $"{(实际加成 >= 0 ? "增加" : "减少")}角色 {Math.Abs(实际加成) * 100:0.##}% {CharacterSet.GetMagicResistanceName(魔法类型)}。" + (Source != null && (Skill.Character != Source || Skill is not OpenSkill) ? $"来自:[ {Source} ]" + (Skill.Item != null ? $" 的 [ {Skill.Item.Name} ]" : (Skill is OpenSkill ? "" : $" 的 [ {Skill.Name} ]")) : ""); + public double Value => 实际加成; + + private readonly double 实际加成 = 0; + private readonly MagicType 魔法类型 = MagicType.None; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (Durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + character.MDF[魔法类型] += 实际加成; + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + character.MDF[魔法类型] -= 实际加成; + } + + public ExMDF(Skill skill, Dictionary args, Character? source = null) : base(skill, args) + { + EffectType = EffectType.Item; + GamingQueue = skill.GamingQueue; + Source = source; + if (Values.Count > 0) + { + string key = Values.Keys.FirstOrDefault(s => s.Equals("mdftype", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && int.TryParse(Values[key].ToString(), out int mdfType)) + { + if (Enum.IsDefined(typeof(MagicType), mdfType)) + { + 魔法类型 = (MagicType)mdfType; + } + else + { + 魔法类型 = MagicType.None; + } + } + key = Values.Keys.FirstOrDefault(s => s.Equals("mdfvalue", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(Values[key].ToString(), out double mdfValue)) + { + 实际加成 = mdfValue; + } + } + } + } +} diff --git a/OshimaBot.Content/Effects/OpenEffects/ExMOV.cs b/OshimaBot.Content/Effects/OpenEffects/ExMOV.cs new file mode 100644 index 0000000..6081651 --- /dev/null +++ b/OshimaBot.Content/Effects/OpenEffects/ExMOV.cs @@ -0,0 +1,51 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.OpenEffects +{ + public class ExMOV : Effect + { + public override long Id => (long)EffectID.ExMOV; + public override string Name { get; set; } = "移动距离加成"; + public override string Description => $"{(实际加成 >= 0 ? "增加" : "减少")}角色 {Math.Abs(实际加成)} 格移动距离。" + (Source != null && (Skill.Character != Source || Skill is not OpenSkill) ? $"来自:[ {Source} ]" + (Skill.Item != null ? $" 的 [ {Skill.Item.Name} ]" : (Skill is OpenSkill ? "" : $" 的 [ {Skill.Name} ]")) : ""); + public int Value => 实际加成; + + private readonly int 实际加成 = 0; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (Durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + character.ExMOV += 实际加成; + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + character.ExMOV -= 实际加成; + } + + public ExMOV(Skill skill, Dictionary args, Character? source = null) : base(skill, args) + { + EffectType = EffectType.Item; + GamingQueue = skill.GamingQueue; + Source = source; + if (Values.Count > 0) + { + string key = Values.Keys.FirstOrDefault(s => s.Equals("exmov", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && int.TryParse(Values[key].ToString(), out int exMOV)) + { + 实际加成 = exMOV; + } + } + } + } +} diff --git a/OshimaBot.Content/Effects/OpenEffects/ExMR.cs b/OshimaBot.Content/Effects/OpenEffects/ExMR.cs new file mode 100644 index 0000000..4ff45e6 --- /dev/null +++ b/OshimaBot.Content/Effects/OpenEffects/ExMR.cs @@ -0,0 +1,51 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.OpenEffects +{ + public class ExMR : Effect + { + public override long Id => (long)EffectID.ExMR; + public override string Name { get; set; } = "魔法回复加成"; + public override string Description => $"{(实际加成 >= 0 ? "增加" : "减少")}角色 {Math.Abs(实际加成):0.##} 点魔法回复。" + (Source != null && (Skill.Character != Source || Skill is not OpenSkill) ? $"来自:[ {Source} ]" + (Skill.Item != null ? $" 的 [ {Skill.Item.Name} ]" : (Skill is OpenSkill ? "" : $" 的 [ {Skill.Name} ]")) : ""); + public double Value => 实际加成; + + private readonly double 实际加成 = 0; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (Durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + character.ExMR += 实际加成; + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + character.ExMR -= 实际加成; + } + + public ExMR(Skill skill, Dictionary args, Character? source = null) : base(skill, args) + { + EffectType = EffectType.Item; + GamingQueue = skill.GamingQueue; + Source = source; + if (Values.Count > 0) + { + string key = Values.Keys.FirstOrDefault(s => s.Equals("exmr", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(Values[key].ToString(), out double exMR)) + { + 实际加成 = exMR; + } + } + } + } +} diff --git a/OshimaBot.Content/Effects/OpenEffects/ExMaxHP.cs b/OshimaBot.Content/Effects/OpenEffects/ExMaxHP.cs new file mode 100644 index 0000000..277065f --- /dev/null +++ b/OshimaBot.Content/Effects/OpenEffects/ExMaxHP.cs @@ -0,0 +1,51 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.OpenEffects +{ + public class ExMaxHP : Effect + { + public override long Id => (long)EffectID.ExMaxHP; + public override string Name { get; set; } = "最大生命值加成"; + public override string Description => $"{(实际加成 >= 0 ? "增加" : "减少")}角色 {Math.Abs(实际加成):0.##} 点最大生命值。" + (Source != null && (Skill.Character != Source || Skill is not OpenSkill) ? $"来自:[ {Source} ]" + (Skill.Item != null ? $" 的 [ {Skill.Item.Name} ]" : (Skill is OpenSkill ? "" : $" 的 [ {Skill.Name} ]")) : ""); + public double Value => 实际加成; + + private readonly double 实际加成 = 0; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (Durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + character.ExHP2 += 实际加成; + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + character.ExHP2 -= 实际加成; + } + + public ExMaxHP(Skill skill, Dictionary args, Character? source = null) : base(skill, args) + { + EffectType = EffectType.Item; + GamingQueue = skill.GamingQueue; + Source = source; + if (Values.Count > 0) + { + string key = Values.Keys.FirstOrDefault(s => s.Equals("exhp", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(Values[key].ToString(), out double exHP)) + { + 实际加成 = exHP; + } + } + } + } +} diff --git a/OshimaBot.Content/Effects/OpenEffects/ExMaxHP2.cs b/OshimaBot.Content/Effects/OpenEffects/ExMaxHP2.cs new file mode 100644 index 0000000..9cd5c4d --- /dev/null +++ b/OshimaBot.Content/Effects/OpenEffects/ExMaxHP2.cs @@ -0,0 +1,80 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.OpenEffects +{ + public class ExMaxHP2 : Effect + { + public override long Id => (long)EffectID.ExMaxHP2; + public override string Name { get; set; } = "最大生命值加成"; + public override string Description => $"{(实际加成 >= 0 ? "增加" : "减少")}角色 {Math.Abs(加成比例) * 100:0.##}% [ {(实际加成 == 0 ? "基于基础生命值" : $"{Math.Abs(实际加成):0.##}")} ] 点最大生命值。" + (Source != null && (Skill.Character != Source || Skill is not OpenSkill) ? $"来自:[ {Source} ]" + (Skill.Item != null ? $" 的 [ {Skill.Item.Name} ]" : (Skill is OpenSkill ? "" : $" 的 [ {Skill.Name} ]")) : ""); + public double Value => 实际加成; + + private readonly double 加成比例 = 0; + private double 实际加成 = 0; + private bool 加成已应用 = false; + private double 已应用加成比例 = 0; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (!加成已应用) + { + // 仅首次获得时初始化剩余时间,避免后续刷新时被重置 + if (Durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + } + else + { + // 已生效过:先还原旧值再套用新值,避免重复叠加 + character.ExHPPercentage -= 已应用加成比例; + } + 实际加成 = character.BaseHP * 加成比例; + 已应用加成比例 = 加成比例; + character.ExHPPercentage += 已应用加成比例; + 加成已应用 = true; + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (!加成已应用) return; + character.ExHPPercentage -= 已应用加成比例; + 已应用加成比例 = 0; + 实际加成 = 0; + 加成已应用 = false; + } + + public override void OnAttributeChanged(HookContext ctx) + { + // 属性侧是百分比加成,基础生命值变化时会实时反映到 ExHP3,无需重新结算; + // 此处只更新描述中展示的点数 + if (ctx.Trigger is Character character && 加成已应用) + { + 实际加成 = character.BaseHP * 加成比例; + } + } + + public ExMaxHP2(Skill skill, Dictionary args, Character? source = null) : base(skill, args) + { + EffectType = EffectType.Item; + GamingQueue = skill.GamingQueue; + Source = source; + if (Values.Count > 0) + { + string key = Values.Keys.FirstOrDefault(s => s.Equals("exhp", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(Values[key].ToString(), out double exHP)) + { + 加成比例 = exHP; + } + } + } + } +} diff --git a/OshimaBot.Content/Effects/OpenEffects/ExMaxMP.cs b/OshimaBot.Content/Effects/OpenEffects/ExMaxMP.cs new file mode 100644 index 0000000..65ce472 --- /dev/null +++ b/OshimaBot.Content/Effects/OpenEffects/ExMaxMP.cs @@ -0,0 +1,51 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.OpenEffects +{ + public class ExMaxMP : Effect + { + public override long Id => (long)EffectID.ExMaxMP; + public override string Name { get; set; } = "最大魔法值加成"; + public override string Description => $"{(实际加成 >= 0 ? "增加" : "减少")}角色 {Math.Abs(实际加成):0.##} 点最大魔法值。" + (Source != null && (Skill.Character != Source || Skill is not OpenSkill) ? $"来自:[ {Source} ]" + (Skill.Item != null ? $" 的 [ {Skill.Item.Name} ]" : (Skill is OpenSkill ? "" : $" 的 [ {Skill.Name} ]")) : ""); + public double Value => 实际加成; + + private readonly double 实际加成 = 0; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (Durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + character.ExMP2 += 实际加成; + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + character.ExMP2 -= 实际加成; + } + + public ExMaxMP(Skill skill, Dictionary args, Character? source = null) : base(skill, args) + { + EffectType = EffectType.Item; + GamingQueue = skill.GamingQueue; + Source = source; + if (Values.Count > 0) + { + string key = Values.Keys.FirstOrDefault(s => s.Equals("exmp", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(Values[key].ToString(), out double exMP)) + { + 实际加成 = exMP; + } + } + } + } +} diff --git a/OshimaBot.Content/Effects/OpenEffects/ExMaxMP2.cs b/OshimaBot.Content/Effects/OpenEffects/ExMaxMP2.cs new file mode 100644 index 0000000..6a3b408 --- /dev/null +++ b/OshimaBot.Content/Effects/OpenEffects/ExMaxMP2.cs @@ -0,0 +1,83 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.OpenEffects +{ + public class ExMaxMP2 : Effect + { + public override long Id => (long)EffectID.ExMaxMP2; + public override string Name { get; set; } = "最大魔法值加成"; + public override string Description => $"{(实际加成 >= 0 ? "增加" : "减少")}角色 {Math.Abs(加成比例) * 100:0.##}% [ {(实际加成 == 0 ? "基于基础魔法值" : $"{Math.Abs(实际加成):0.##}")} ] 点最大魔法值。" + (Source != null && (Skill.Character != Source || Skill is not OpenSkill) ? $"来自:[ {Source} ]" + (Skill.Item != null ? $" 的 [ {Skill.Item.Name} ]" : (Skill is OpenSkill ? "" : $" 的 [ {Skill.Name} ]")) : ""); + public double Value => 实际加成; + + private readonly double 加成比例 = 0; + private double 实际加成 = 0; + private bool 加成已应用 = false; + private double 已应用加成 = 0; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (!加成已应用) + { + // 仅首次获得时初始化剩余时间,避免后续刷新时被重置 + if (Durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + } + else + { + // 已生效过:先还原旧值再套用新值,避免重复叠加 + character.ExMP2 -= 已应用加成; + } + 实际加成 = character.BaseMP * 加成比例; + 已应用加成 = 实际加成; + character.ExMP2 += 已应用加成; + 加成已应用 = true; + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (!加成已应用) return; + character.ExMP2 -= 已应用加成; + 已应用加成 = 0; + 实际加成 = 0; + 加成已应用 = false; + } + + public override void OnAttributeChanged(HookContext ctx) + { + // 注意:此处与 ExATK2 等百分比加成不同,ExMP2 是固定点数加成, + // 基础魔法值变化后不会自动跟随,必须重算并替换已生效的数值 + if (ctx.Trigger is Character character && 加成已应用) + { + character.ExMP2 -= 已应用加成; + 实际加成 = character.BaseMP * 加成比例; + 已应用加成 = 实际加成; + character.ExMP2 += 已应用加成; + } + } + + public ExMaxMP2(Skill skill, Dictionary args, Character? source = null) : base(skill, args) + { + EffectType = EffectType.Item; + GamingQueue = skill.GamingQueue; + Source = source; + if (Values.Count > 0) + { + string key = Values.Keys.FirstOrDefault(s => s.Equals("exmp", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(Values[key].ToString(), out double exMP)) + { + 加成比例 = exMP; + } + } + } + } +} diff --git a/OshimaBot.Content/Effects/OpenEffects/ExPDR.cs b/OshimaBot.Content/Effects/OpenEffects/ExPDR.cs new file mode 100644 index 0000000..6f01af1 --- /dev/null +++ b/OshimaBot.Content/Effects/OpenEffects/ExPDR.cs @@ -0,0 +1,51 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.OpenEffects +{ + public class ExPDR : Effect + { + public override long Id => (long)EffectID.ExPDR; + public override string Name { get; set; } = "物理伤害减免加成"; + public override string Description => $"{(实际加成 >= 0 ? "增加" : "减少")}角色 {Math.Abs(实际加成) * 100:0.##}% 物理伤害减免。" + (Source != null && (Skill.Character != Source || Skill is not OpenSkill) ? $"来自:[ {Source} ]" + (Skill.Item != null ? $" 的 [ {Skill.Item.Name} ]" : (Skill is OpenSkill ? "" : $" 的 [ {Skill.Name} ]")) : ""); + public double Value => 实际加成; + + private readonly double 实际加成 = 0; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (Durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + character.ExPDR += 实际加成; + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + character.ExPDR -= 实际加成; + } + + public ExPDR(Skill skill, Dictionary args, Character? source = null) : base(skill, args) + { + EffectType = EffectType.Item; + GamingQueue = skill.GamingQueue; + Source = source; + if (Values.Count > 0) + { + string key = Values.Keys.FirstOrDefault(s => s.Equals("expdr", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(Values[key].ToString(), out double exPDR)) + { + 实际加成 = exPDR; + } + } + } + } +} diff --git a/OshimaBot.Content/Effects/OpenEffects/ExSPD.cs b/OshimaBot.Content/Effects/OpenEffects/ExSPD.cs new file mode 100644 index 0000000..0cb99c8 --- /dev/null +++ b/OshimaBot.Content/Effects/OpenEffects/ExSPD.cs @@ -0,0 +1,51 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.OpenEffects +{ + public class ExSPD : Effect + { + public override long Id => (long)EffectID.ExSPD; + public override string Name { get; set; } = "行动速度加成"; + public override string Description => $"{(实际加成 >= 0 ? "增加" : "减少")}角色 {Math.Abs(实际加成):0.##} 点行动速度。" + (Source != null && (Skill.Character != Source || Skill is not OpenSkill) ? $"来自:[ {Source} ]" + (Skill.Item != null ? $" 的 [ {Skill.Item.Name} ]" : (Skill is OpenSkill ? "" : $" 的 [ {Skill.Name} ]")) : ""); + public double Value => 实际加成; + + private readonly double 实际加成 = 0; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (Durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + character.ExSPD += 实际加成; + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + character.ExSPD -= 实际加成; + } + + public ExSPD(Skill skill, Dictionary args, Character? source = null) : base(skill, args) + { + EffectType = EffectType.Item; + GamingQueue = skill.GamingQueue; + Source = source; + if (Values.Count > 0) + { + string key = Values.Keys.FirstOrDefault(s => s.Equals("exspd", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(Values[key].ToString(), out double exSPD)) + { + 实际加成 = exSPD; + } + } + } + } +} diff --git a/OshimaBot.Content/Effects/OpenEffects/ExSTR.cs b/OshimaBot.Content/Effects/OpenEffects/ExSTR.cs new file mode 100644 index 0000000..40d389b --- /dev/null +++ b/OshimaBot.Content/Effects/OpenEffects/ExSTR.cs @@ -0,0 +1,51 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.OpenEffects +{ + public class ExSTR : Effect + { + public override long Id => (long)EffectID.ExSTR; + public override string Name { get; set; } = "力量加成"; + public override string Description => $"{(实际加成 >= 0 ? "增加" : "减少")}角色 {Math.Abs(实际加成):0.##} 点力量。" + (Source != null && (Skill.Character != Source || Skill is not OpenSkill) ? $"来自:[ {Source} ]" + (Skill.Item != null ? $" 的 [ {Skill.Item.Name} ]" : (Skill is OpenSkill ? "" : $" 的 [ {Skill.Name} ]")) : ""); + public double Value => 实际加成; + + private readonly double 实际加成 = 0; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (Durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + character.ExSTR += 实际加成; + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + character.ExSTR -= 实际加成; + } + + public ExSTR(Skill skill, Dictionary args, Character? source = null) : base(skill, args) + { + EffectType = EffectType.Item; + GamingQueue = skill.GamingQueue; + Source = source; + if (Values.Count > 0) + { + string key = Values.Keys.FirstOrDefault(s => s.Equals("exstr", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(Values[key].ToString(), out double exSTR)) + { + 实际加成 = exSTR; + } + } + } + } +} diff --git a/OshimaBot.Content/Effects/OpenEffects/ExSTR2.cs b/OshimaBot.Content/Effects/OpenEffects/ExSTR2.cs new file mode 100644 index 0000000..0f2d372 --- /dev/null +++ b/OshimaBot.Content/Effects/OpenEffects/ExSTR2.cs @@ -0,0 +1,80 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.OpenEffects +{ + public class ExSTR2 : Effect + { + public override long Id => (long)EffectID.ExSTR2; + public override string Name { get; set; } = "力量加成"; + public override string Description => $"{(实际加成 >= 0 ? "增加" : "减少")}角色 {Math.Abs(加成比例) * 100:0.##}% [ {(实际加成 == 0 ? "基于基础力量" : $"{Math.Abs(实际加成):0.##}")} ] 点力量。" + (Source != null && (Skill.Character != Source || Skill is not OpenSkill) ? $"来自:[ {Source} ]" + (Skill.Item != null ? $" 的 [ {Skill.Item.Name} ]" : (Skill is OpenSkill ? "" : $" 的 [ {Skill.Name} ]")) : ""); + public double Value => 实际加成; + + private readonly double 加成比例 = 0; + private double 实际加成 = 0; + private bool 加成已应用 = false; + private double 已应用加成比例 = 0; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (!加成已应用) + { + // 仅首次获得时初始化剩余时间,避免后续刷新时被重置 + if (Durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + } + else + { + // 已生效过:先还原旧值再套用新值,避免重复叠加 + character.ExSTRPercentage -= 已应用加成比例; + } + 实际加成 = character.BaseSTR * 加成比例; + 已应用加成比例 = 加成比例; + character.ExSTRPercentage += 已应用加成比例; + 加成已应用 = true; + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (!加成已应用) return; + character.ExSTRPercentage -= 已应用加成比例; + 已应用加成比例 = 0; + 实际加成 = 0; + 加成已应用 = false; + } + + public override void OnAttributeChanged(HookContext ctx) + { + // 属性侧是百分比加成,基础力量变化时会实时反映到 ExSTR3,无需重新结算; + // 此处只更新描述中展示的点数 + if (ctx.Trigger is Character character && 加成已应用) + { + 实际加成 = character.BaseSTR * 加成比例; + } + } + + public ExSTR2(Skill skill, Dictionary args, Character? source = null) : base(skill, args) + { + EffectType = EffectType.Item; + GamingQueue = skill.GamingQueue; + Source = source; + if (Values.Count > 0) + { + string key = Values.Keys.FirstOrDefault(s => s.Equals("exstr", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(Values[key].ToString(), out double exSTR)) + { + 加成比例 = exSTR; + } + } + } + } +} diff --git a/OshimaBot.Content/Effects/OpenEffects/IgnoreEvade.cs b/OshimaBot.Content/Effects/OpenEffects/IgnoreEvade.cs new file mode 100644 index 0000000..b5fb28a --- /dev/null +++ b/OshimaBot.Content/Effects/OpenEffects/IgnoreEvade.cs @@ -0,0 +1,43 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.EffectResult; + +namespace OshimaBot.Content.Effects.OpenEffects +{ + public class IgnoreEvade : Effect + { + public override long Id => (long)EffectID.IgnoreEvade; + public override string Name { get; set; } = "无视闪避"; + public override string Description => $"普通攻击有 {概率 * 100:0.##}% 概率无视闪避。" + (Source != null && (Skill.Character != Source || Skill is not OpenSkill) ? $"来自:[ {Source} ]" + (Skill.Item != null ? $" 的 [ {Skill.Item.Name} ]" : (Skill is OpenSkill ? "" : $" 的 [ {Skill.Name} ]")) : ""); + public double Value => 概率; + + private readonly double 概率 = 0; + + public override BeforeEvadeCheckResult BeforeEvadeCheck(DamageContext ctx) + { + if (ctx.Trigger is not Character actor) return default; + if (actor == Skill.Character && Random.NextDouble() < 概率) + { + if (GamingQueue != null) WriteLine($"[ {actor} ] 的普通攻击无视了 [ {ctx.Enemy} ] 的闪避!"); + return new BeforeEvadeCheckResult { SkipEvadeCheck = true }; + } + return default; + } + + public IgnoreEvade(Skill skill, Dictionary args, Character? source = null) : base(skill, args) + { + EffectType = EffectType.Item; + GamingQueue = skill.GamingQueue; + Source = source; + if (Values.Count > 0) + { + string key = Values.Keys.FirstOrDefault(s => s.Equals("p", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(Values[key].ToString(), out double p) && p >= 0 && p <= 1) + { + 概率 = p; + } + } + } + } +} diff --git a/OshimaBot.Content/Effects/OpenEffects/MagicalPenetration.cs b/OshimaBot.Content/Effects/OpenEffects/MagicalPenetration.cs new file mode 100644 index 0000000..5d2ab22 --- /dev/null +++ b/OshimaBot.Content/Effects/OpenEffects/MagicalPenetration.cs @@ -0,0 +1,51 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.OpenEffects +{ + public class MagicalPenetration : Effect + { + public override long Id => (long)EffectID.MagicalPenetration; + public override string Name { get; set; } = "魔法穿透加成"; + public override string Description => $"{(实际加成 >= 0 ? "增加" : "减少")}角色 {Math.Abs(实际加成) * 100:0.##}% 魔法穿透。" + (Source != null && (Skill.Character != Source || Skill is not OpenSkill) ? $"来自:[ {Source} ]" + (Skill.Item != null ? $" 的 [ {Skill.Item.Name} ]" : (Skill is OpenSkill ? "" : $" 的 [ {Skill.Name} ]")) : ""); + public double Value => 实际加成; + + private readonly double 实际加成 = 0; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (Durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + character.MagicalPenetration += 实际加成; + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + character.MagicalPenetration -= 实际加成; + } + + public MagicalPenetration(Skill skill, Dictionary args, Character? source = null) : base(skill, args) + { + EffectType = EffectType.Item; + GamingQueue = skill.GamingQueue; + Source = source; + if (Values.Count > 0) + { + string key = Values.Keys.FirstOrDefault(s => s.Equals("exmpt", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(Values[key].ToString(), out double exMPT)) + { + 实际加成 = exMPT; + } + } + } + } +} diff --git a/OshimaBot.Content/Effects/OpenEffects/NormalAttackHardTimeReduce.cs b/OshimaBot.Content/Effects/OpenEffects/NormalAttackHardTimeReduce.cs new file mode 100644 index 0000000..f10f41f --- /dev/null +++ b/OshimaBot.Content/Effects/OpenEffects/NormalAttackHardTimeReduce.cs @@ -0,0 +1,50 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.OpenEffects +{ + public class NormalAttackHardTimeReduce : Effect + { + public override long Id => (long)EffectID.NormalAttackHardTimeReduce; + public override string Name { get; set; } = "普通攻击硬直减少"; + public override string Description => $"{(实际硬直时间减少 < 0 ? "增加" : "减少")}角色的普通攻击 {实际硬直时间减少:0.##} {GameplayEquilibriumConstant.InGameTime}硬直时间。" + (Source != null && (Skill.Character != Source || Skill is not OpenSkill) ? $"来自:[ {Source} ]" + (Skill.Item != null ? $" 的 [ {Skill.Item.Name} ]" : (Skill is OpenSkill ? "" : $" 的 [ {Skill.Name} ]")) : ""); + + private readonly double 实际硬直时间减少 = 0; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (Durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + character.NormalAttack.ExHardnessTime -= 实际硬直时间减少; + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + character.NormalAttack.ExHardnessTime += 实际硬直时间减少; + } + + public NormalAttackHardTimeReduce(Skill skill, Dictionary args, Character? source = null) : base(skill, args) + { + EffectType = EffectType.Item; + GamingQueue = skill.GamingQueue; + Source = source; + if (Values.Count > 0) + { + string key = Values.Keys.FirstOrDefault(s => s.Equals("nahtr", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(Values[key].ToString(), out double nahtr) && nahtr > 0) + { + 实际硬直时间减少 = nahtr; + } + } + } + } +} diff --git a/OshimaBot.Content/Effects/OpenEffects/NormalAttackHardTimeReduce2.cs b/OshimaBot.Content/Effects/OpenEffects/NormalAttackHardTimeReduce2.cs new file mode 100644 index 0000000..da393cb --- /dev/null +++ b/OshimaBot.Content/Effects/OpenEffects/NormalAttackHardTimeReduce2.cs @@ -0,0 +1,50 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.OpenEffects +{ + public class NormalAttackHardTimeReduce2 : Effect + { + public override long Id => (long)EffectID.NormalAttackHardTimeReduce2; + public override string Name { get; set; } = "普通攻击硬直减少"; + public override string Description => $"{(减少比例 < 0 ? "增加" : "减少")}角色的普通攻击 {减少比例 * 100:0.##}% 硬直时间。" + (Source != null && (Skill.Character != Source || Skill is not OpenSkill) ? $"来自:[ {Source} ]" + (Skill.Item != null ? $" 的 [ {Skill.Item.Name} ]" : (Skill is OpenSkill ? "" : $" 的 [ {Skill.Name} ]")) : ""); + + private readonly double 减少比例 = 0; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (Durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + character.NormalAttack.ExHardnessTime2 -= 减少比例; + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + character.NormalAttack.ExHardnessTime2 += 减少比例; + } + + public NormalAttackHardTimeReduce2(Skill skill, Dictionary args, Character? source = null) : base(skill, args) + { + EffectType = EffectType.Item; + GamingQueue = skill.GamingQueue; + Source = source; + if (Values.Count > 0) + { + string key = Values.Keys.FirstOrDefault(s => s.Equals("nahtr", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(Values[key].ToString(), out double nahtr) && nahtr > 0) + { + 减少比例 = nahtr; + } + } + } + } +} diff --git a/OshimaBot.Content/Effects/OpenEffects/PhysicalPenetration.cs b/OshimaBot.Content/Effects/OpenEffects/PhysicalPenetration.cs new file mode 100644 index 0000000..d0055aa --- /dev/null +++ b/OshimaBot.Content/Effects/OpenEffects/PhysicalPenetration.cs @@ -0,0 +1,51 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.OpenEffects +{ + public class PhysicalPenetration : Effect + { + public override long Id => (long)EffectID.PhysicalPenetration; + public override string Name { get; set; } = "物理穿透加成"; + public override string Description => $"{(实际加成 >= 0 ? "增加" : "减少")}角色 {Math.Abs(实际加成) * 100:0.##}% 物理穿透。" + (Source != null && (Skill.Character != Source || Skill is not OpenSkill) ? $"来自:[ {Source} ]" + (Skill.Item != null ? $" 的 [ {Skill.Item.Name} ]" : (Skill is OpenSkill ? "" : $" 的 [ {Skill.Name} ]")) : ""); + public double Value => 实际加成; + + private readonly double 实际加成 = 0; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (Durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + character.PhysicalPenetration += 实际加成; + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + character.PhysicalPenetration -= 实际加成; + } + + public PhysicalPenetration(Skill skill, Dictionary args, Character? source = null) : base(skill, args) + { + EffectType = EffectType.Item; + GamingQueue = skill.GamingQueue; + Source = source; + if (Values.Count > 0) + { + string key = Values.Keys.FirstOrDefault(s => s.Equals("exppt", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(Values[key].ToString(), out double exPPT)) + { + 实际加成 = exPPT; + } + } + } + } +} diff --git a/OshimaBot.Content/Effects/OpenEffects/SkillHardTimeReduce.cs b/OshimaBot.Content/Effects/OpenEffects/SkillHardTimeReduce.cs new file mode 100644 index 0000000..4d0fe8e --- /dev/null +++ b/OshimaBot.Content/Effects/OpenEffects/SkillHardTimeReduce.cs @@ -0,0 +1,66 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.OpenEffects +{ + public class SkillHardTimeReduce : Effect + { + public override long Id => (long)EffectID.SkillHardTimeReduce; + public override string Name { get; set; } = "主动技能硬直减少"; + public override string Description => $"减少角色的所有主动技能 {实际硬直时间减少:0.##} {GameplayEquilibriumConstant.InGameTime}硬直时间。" + (Source != null && (Skill.Character != Source || Skill is not OpenSkill) ? $"来自:[ {Source} ]" + (Skill.Item != null ? $" 的 [ {Skill.Item.Name} ]" : (Skill is OpenSkill ? "" : $" 的 [ {Skill.Name} ]")) : ""); + + private readonly double 实际硬直时间减少 = 0; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (Durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + foreach (Skill s in character.Skills) + { + s.ExHardnessTime -= 实际硬直时间减少; + } + foreach (Skill? s in character.Items.Select(i => i.Skills.Active)) + { + if (s != null) + s.ExHardnessTime -= 实际硬直时间减少; + } + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + foreach (Skill s in character.Skills) + { + s.ExHardnessTime += 实际硬直时间减少; + } + foreach (Skill? s in character.Items.Select(i => i.Skills.Active)) + { + if (s != null) + s.ExHardnessTime += 实际硬直时间减少; + } + } + + public SkillHardTimeReduce(Skill skill, Dictionary args, Character? source = null) : base(skill, args) + { + EffectType = EffectType.Item; + GamingQueue = skill.GamingQueue; + Source = source; + if (Values.Count > 0) + { + string key = Values.Keys.FirstOrDefault(s => s.Equals("shtr", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(Values[key].ToString(), out double shtr) && shtr > 0) + { + 实际硬直时间减少 = shtr; + } + } + } + } +} diff --git a/OshimaBot.Content/Effects/OpenEffects/SkillHardTimeReduce2.cs b/OshimaBot.Content/Effects/OpenEffects/SkillHardTimeReduce2.cs new file mode 100644 index 0000000..3a0031c --- /dev/null +++ b/OshimaBot.Content/Effects/OpenEffects/SkillHardTimeReduce2.cs @@ -0,0 +1,66 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.OpenEffects +{ + public class SkillHardTimeReduce2 : Effect + { + public override long Id => (long)EffectID.SkillHardTimeReduce2; + public override string Name { get; set; } = "主动技能硬直减少"; + public override string Description => $"减少角色的所有主动技能 {减少比例 * 100:0.##}% 硬直时间。" + (Source != null && (Skill.Character != Source || Skill is not OpenSkill) ? $"来自:[ {Source} ]" + (Skill.Item != null ? $" 的 [ {Skill.Item.Name} ]" : (Skill is OpenSkill ? "" : $" 的 [ {Skill.Name} ]")) : ""); + + private readonly double 减少比例 = 0; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (Durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + foreach (Skill s in character.Skills) + { + s.ExHardnessTime2 -= 减少比例; + } + foreach (Skill? s in character.Items.Select(i => i.Skills.Active)) + { + if (s != null) + s.ExHardnessTime2 -= 减少比例; + } + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + foreach (Skill s in character.Skills) + { + s.ExHardnessTime2 += 减少比例; + } + foreach (Skill? s in character.Items.Select(i => i.Skills.Active)) + { + if (s != null) + s.ExHardnessTime2 += 减少比例; + } + } + + public SkillHardTimeReduce2(Skill skill, Dictionary args, Character? source = null) : base(skill, args) + { + EffectType = EffectType.Item; + GamingQueue = skill.GamingQueue; + Source = source; + if (Values.Count > 0) + { + string key = Values.Keys.FirstOrDefault(s => s.Equals("shtr", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(Values[key].ToString(), out double shtr) && shtr > 0) + { + 减少比例 = shtr; + } + } + } + } +} diff --git a/OshimaBot.Content/Effects/PassiveEffects/信标标记.cs b/OshimaBot.Content/Effects/PassiveEffects/信标标记.cs new file mode 100644 index 0000000..9c721d3 --- /dev/null +++ b/OshimaBot.Content/Effects/PassiveEffects/信标标记.cs @@ -0,0 +1,70 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.EffectResult; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Effects.PassiveEffects +{ + /// + /// 装备【接力信标】的指引标记 —— 装备期间由穿戴者挂到每名队友的状态栏上。 + /// 与前两个标记不同,本标记自身即收益:硬直钩子只通知「行动者自己」的特效, + /// 因此把标记挂在队友身上,等价于把"硬直减免"当作一层光环施加给队友。 + /// 无状态增减(只在钩子里返回比率),因此天然幂等; + /// 卸装 / 换装时由【接力信标特效】撤回,撤销光环。 + /// + public class 信标标记 : Effect + { + public override long Id => (long)PassiveEffectID.信标标记; + public override string Name => "信标标记"; + public override string Description => $"此角色正受 [ {Source} ] 的接力信标指引,普攻与技能硬直减少 {_硬直减免 * 100:0.##}%。"; + public override EffectType EffectType => EffectType.Mark; + + /// 友方标记,非负面效果 + public override bool IsDebuff => false; + + /// 无具体时长,随装备存续 + public override bool DurativeWithoutDuration => true; + + /// 内部簿记标记,不可被任何形态的驱散移除 + public override DispelledType DispelledType => DispelledType.CannotBeDispelled; + + public override Character Source => _sourceCharacter; + + private readonly Character _sourceCharacter; + private readonly double _硬直减免; + + /// 标记宿主(由 捕获;标记总是通过 挂载) + private Character? _host; + + public 信标标记(Skill skill, Character sourceCharacter, double 硬直减免) : base(skill) + { + GamingQueue = skill.GamingQueue; + _sourceCharacter = sourceCharacter; + _硬直减免 = 硬直减免; + } + + public override void OnEffectGained(HookContext ctx) + { + _host = ctx.Trigger; + } + + public override AlterHardnessTimeResult AlterHardnessTimeAfterNormalAttack(HardnessContext ctx) + { + return 计算(ctx); + } + + public override AlterHardnessTimeResult AlterHardnessTimeAfterCastSkill(HardnessContext ctx) + { + return 计算(ctx); + } + + private AlterHardnessTimeResult 计算(HardnessContext ctx) + { + // 硬直钩子按「行动者的特效」分发,本标记只可能挂在行动中的队友身上;仍做一次归属校验 + if (_host is null || ctx.Trigger != _host) return default; + // Factor 语义:最终硬直 = 基础硬直 × (1 + Factor),故"减少 N%"传 -N;default(0) 即不干预 + return new AlterHardnessTimeResult { Factor = -_硬直减免 }; + } + } +} diff --git a/OshimaBot.Content/Effects/PassiveEffects/共鸣标记.cs b/OshimaBot.Content/Effects/PassiveEffects/共鸣标记.cs new file mode 100644 index 0000000..3fc5d8d --- /dev/null +++ b/OshimaBot.Content/Effects/PassiveEffects/共鸣标记.cs @@ -0,0 +1,63 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.OpenEffects; +using OshimaBot.Content.Items; + +namespace OshimaBot.Content.Effects.PassiveEffects +{ + /// + /// 装备【共鸣核心】的监听标记 —— 穿戴时由穿戴者挂到每名队友的状态栏上。 + /// 与【巡诊标记】同理:框架中大部分细粒度钩子只通知「触发者 + 目标」的特效, + /// 穿戴者无法直接监听队友的出手,必须把本标记挂进队友状态栏, + /// 让标记以宿主的身份收到 ,再转发给【共鸣核心特效】。 + /// 本标记自身不产生任何收益,是内部簿记用标记,不可被驱散; + /// 卸装 / 换装时由控制器统一撤回,保证幂等。 + /// + public class 共鸣标记 : Effect + { + public override long Id => (long)PassiveEffectID.共鸣标记; + public override string Name => "共鸣标记"; + public override string Description => $"此角色与 [ {Source} ] 的共鸣核心产生了共鸣。"; + public override EffectType EffectType => EffectType.Mark; + + /// 友方标记,非负面效果 + public override bool IsDebuff => false; + + /// 无具体时长,随装备存续 + public override bool DurativeWithoutDuration => true; + + /// 内部簿记标记,不可被任何形态的驱散移除 + public override DispelledType DispelledType => DispelledType.CannotBeDispelled; + + public override Character Source => _sourceCharacter; + + private readonly Character _sourceCharacter; + private readonly 共鸣核心特效 _controller; + + /// 标记宿主(由 捕获;标记总是通过 挂载) + private Character? _host; + + public 共鸣标记(Skill skill, Character sourceCharacter, 共鸣核心特效 controller) : base(skill) + { + GamingQueue = skill.GamingQueue; + _sourceCharacter = sourceCharacter; + _controller = controller; + } + + public override void OnEffectGained(HookContext ctx) + { + _host = ctx.Trigger; + } + + public override void AfterDamageCalculation(DamageContext ctx) + { + // 本标记会随宿主收到「宿主参与的所有伤害结算」,只关心宿主作为攻击方造成伤害的那一次 + Character? host = _host; + if (host is null || ctx.Trigger != host) return; + if (ctx.DamageResult != DamageResult.Normal && ctx.DamageResult != DamageResult.Critical) return; + if (ctx.ActualDamage <= 0) return; + _controller.TryGainEnergy(host); + } + } +} diff --git a/OshimaBot.Content/Effects/PassiveEffects/冻结.cs b/OshimaBot.Content/Effects/PassiveEffects/冻结.cs new file mode 100644 index 0000000..e292ae1 --- /dev/null +++ b/OshimaBot.Content/Effects/PassiveEffects/冻结.cs @@ -0,0 +1,11 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Effects.PassiveEffects +{ + public class 冻结(Skill skill, Character sourceCharacter, bool durative = false, double duration = 0, int durationTurn = 1) : 完全行动不能(nameof(冻结), EffectType.Petrify, skill, sourceCharacter, durative, duration, durationTurn) + { + public override long Id => (long)PassiveEffectID.冻结; + } +} diff --git a/OshimaBot.Content/Effects/PassiveEffects/复制技能.cs b/OshimaBot.Content/Effects/PassiveEffects/复制技能.cs new file mode 100644 index 0000000..7b8770c --- /dev/null +++ b/OshimaBot.Content/Effects/PassiveEffects/复制技能.cs @@ -0,0 +1,46 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Effects.PassiveEffects +{ + public class 复制技能 : Effect + { + public override long Id => (long)PassiveEffectID.复制技能; + public override string Name => "复制技能"; + public override string Description => $"此角色持有技能 [ {_skill.Name} ] 的复制品。来自:[ {Source} ]"; + public override EffectType EffectType => EffectType.Mark; + public override Character Source => _sourceCharacter; + public override DispelledType DispelledType => DispelledType.CannotBeDispelled; + public Skill CopiedSkill => _skill; + + private readonly Character _sourceCharacter; + private readonly Skill _skill; + + public 复制技能(Skill skill, Character sourceCharacter, Skill copiedSkill) : base(skill) + { + GamingQueue = skill.GamingQueue; + _sourceCharacter = sourceCharacter; + _skill = copiedSkill.Copy(); + _skill.Level = copiedSkill.Level; + } + + public CharacterActionType LastType { get; set; } = CharacterActionType.None; + public Skill? LastSkill { get; set; } = null; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + _skill.Character = character; + _skill.OnLevelUp(); + character.Skills.Add(_skill); + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + _skill.RemoveSkillFromCharacter(character); + } + } +} diff --git a/OshimaBot.Content/Effects/PassiveEffects/完全免疫.cs b/OshimaBot.Content/Effects/PassiveEffects/完全免疫.cs new file mode 100644 index 0000000..a4c98b8 --- /dev/null +++ b/OshimaBot.Content/Effects/PassiveEffects/完全免疫.cs @@ -0,0 +1,67 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.EffectResult; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Effects.PassiveEffects +{ + public class 完全免疫 : Effect + { + public override long Id => (long)PassiveEffectID.完全免疫; + public override string Name => "完全免疫"; + public override string Description => $"此角色处于完全免疫状态,无法选中其作为普通攻击和技能的目标(自释放技能除外),免疫物理伤害和魔法伤害。来自:[ {Source} ] 的 [ {Skill.Name} ]"; + public override EffectType EffectType => EffectType.PhysicalImmune; + public override DispelledType DispelledType => DispelledType.Strong; + public override bool IsDebuff => false; + 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) + { + GamingQueue = skill.GamingQueue; + _sourceCharacter = sourceCharacter; + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + } + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (_durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + AddImmuneTypesToCharacter(character, [ImmuneType.All]); + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + RemoveImmuneTypesFromCharacter(character); + } + + public override OnImmuneCheckResult OnImmuneCheck(ImmuneContext ctx) + { + if (ctx.Trigger is not Character character) return default; + Character? target = ctx.Target; + if (character == target) + { + return new OnImmuneCheckResult { IgnoreImmunity = true }; + } + return default; + } + } +} diff --git a/OshimaBot.Content/Effects/PassiveEffects/完全行动不能.cs b/OshimaBot.Content/Effects/PassiveEffects/完全行动不能.cs new file mode 100644 index 0000000..1a35ac5 --- /dev/null +++ b/OshimaBot.Content/Effects/PassiveEffects/完全行动不能.cs @@ -0,0 +1,61 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Effects.PassiveEffects +{ + public class 完全行动不能 : Effect + { + public override long Id => (long)PassiveEffectID.完全行动不能; + public override string Name => _name; + public override string Description => $"此角色被{Name}了,不能行动。来自:[ {Source} ] 的 [ {Skill.Name} ]"; + public override EffectType EffectType => _type; + public override DispelledType DispelledType => DispelledType.Strong; + public override bool IsDebuff => true; + public override Character Source => _sourceCharacter; + public override bool Durative => _durative; + public override double Duration => _duration; + public override int DurationTurn => _durationTurn; + public override bool ExemptDuration => true; + + private readonly string _name; + private readonly EffectType _type; + private readonly Character _sourceCharacter; + private readonly bool _durative; + private readonly double _duration; + private readonly int _durationTurn; + + public 完全行动不能(string name, EffectType type, Skill skill, Character sourceCharacter, bool durative = false, double duration = 0, int durationTurn = 1) : base(skill) + { + _name = name; + _type = type; + GamingQueue = skill.GamingQueue; + _sourceCharacter = sourceCharacter; + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + } + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (_durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + AddEffectStatesToCharacter(character, [CharacterState.NotActionable]); + InterruptCasting(character, Source); + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + RemoveEffectStatesFromCharacter(character); + } + } +} diff --git a/OshimaBot.Content/Effects/PassiveEffects/宫监手标记.cs b/OshimaBot.Content/Effects/PassiveEffects/宫监手标记.cs new file mode 100644 index 0000000..f779341 --- /dev/null +++ b/OshimaBot.Content/Effects/PassiveEffects/宫监手标记.cs @@ -0,0 +1,127 @@ +using FunGame.Core.Entity; +using FunGame.Core.Interface.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.EffectResult; +using OshimaBot.Content.Effects.OpenEffects; +using OshimaBot.Content.Skills; + +namespace OshimaBot.Content.Effects.PassiveEffects +{ + public class 宫监手标记 : Effect + { + public override long Id => (long)PassiveEffectID.宫监手标记; + public override string Name => "宫监手标记"; + public override string Description => $"{放监.任务要求}。来自:[ {Source} ]"; + public override EffectType EffectType => EffectType.Mark; + public override bool IsDebuff => true; + public override Character Source => _sourceCharacter; + public override DispelledType DispelledType { get; set; } = DispelledType.CannotBeDispelled; + + private readonly Character _sourceCharacter; + private readonly Character _targetCharacter; + private readonly 放监特效 放监; + private bool 已完成普攻任务 = false; + private bool 已完成指向性技能任务 = false; + + public 宫监手标记(Skill skill, Character sourceCharacter, Character targetCharacter, 放监特效 effect) : base(skill) + { + GamingQueue = skill.GamingQueue; + _sourceCharacter = sourceCharacter; + _targetCharacter = targetCharacter; + 放监 = effect; + } + + public void 普攻任务完成(Character character) + { + WriteLine($"[ {character} ] 的「放监」任务 [ 对友方角色普通攻击 ] 完成!"); + 已完成普攻任务 = true; + CheckComplete(character); + } + + public void 指向性技能任务完成(Character character) + { + WriteLine($"[ {character} ] 的「放监」任务 [ 对{Source}释放指向性技能 ] 完成!"); + 已完成指向性技能任务 = true; + CheckComplete(character); + } + + public void CheckComplete(Character character) + { + if (已完成普攻任务 && 已完成指向性技能任务) + { + character.Effects.Remove(this); + WriteLine($"[ {character} ] 已消除宫监手标记!"); + } + } + + public override void AlterSelectListBeforeSelection(SelectionContext ctx) + { + ISkill? skill = ctx.Skill; + List enemys = ctx.Enemys; + List teammates = ctx.Teammates; + if (skill is NormalAttack) + { + enemys.AddRange(teammates); + } + } + + public override BeforeCriticalCheckResult BeforeCriticalCheck(DamageContext ctx) + { + if (ctx.Trigger is not Character actor) return default; + bool isNormalAttack = ctx.IsNormalAttack; + if (actor == _targetCharacter && isNormalAttack) + { + return new BeforeCriticalCheckResult { ThrowingBonusDelta = 300 }; + } + return default; + } + + public override BeforeEvadeCheckResult BeforeEvadeCheck(DamageContext ctx) + { + if (ctx.Trigger is not Character actor) return default; + if (actor == _targetCharacter) + { + return new BeforeEvadeCheckResult { SkipEvadeCheck = true }; + } + return default; + } + + public override void AfterDamageCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (ctx.Enemy is not Character enemy) return; + bool isNormalAttack = ctx.IsNormalAttack; + DamageResult damageResult = ctx.DamageResult; + if (character == _targetCharacter && isNormalAttack && (damageResult == DamageResult.Normal || damageResult == DamageResult.Critical)) + { + if (GamingQueue != null && GamingQueue.IsTeammate(character, enemy)) + { + 普攻任务完成(character); + } + } + } + + public override void AfterDeathCalculation(DeathContext ctx) + { + if (ctx.Trigger is not Character death) return; + if (death == _targetCharacter) + { + death.Effects.Remove(this); + } + if (death == _sourceCharacter) + { + _targetCharacter.Effects.Remove(this); + } + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (!已完成普攻任务 || !已完成指向性技能任务) + { + 放监.造成伤害(character, !已完成普攻任务 && !已完成指向性技能任务 ? 2 : 1); + } + } + } +} diff --git a/OshimaBot.Content/Effects/PassiveEffects/封技.cs b/OshimaBot.Content/Effects/PassiveEffects/封技.cs new file mode 100644 index 0000000..a044978 --- /dev/null +++ b/OshimaBot.Content/Effects/PassiveEffects/封技.cs @@ -0,0 +1,57 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Effects.PassiveEffects +{ + public class 封技 : Effect + { + public override long Id => (long)PassiveEffectID.封技; + public override string Name => "封技"; + public override string Description => $"此角色被封技了,不能使用技能(魔法、战技和爆发技)。来自:[ {Source} ] 的 [ {Skill.Name} ]"; + public override EffectType EffectType => EffectType.Silence; + public override DispelledType DispelledType => DispelledType.Weak; + public override bool IsDebuff => true; + public override Character Source => _sourceCharacter; + public override bool Durative => _durative; + public override double Duration => _duration; + public override int DurationTurn => _durationTurn; + public override bool ExemptDuration => true; + + 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) + { + GamingQueue = skill.GamingQueue; + _sourceCharacter = sourceCharacter; + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + } + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (_durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + AddEffectStatesToCharacter(character, [CharacterState.SkillRestricted]); + InterruptCasting(character, Source); + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + RemoveEffectStatesFromCharacter(character); + } + } +} diff --git a/OshimaBot.Content/Effects/PassiveEffects/巡诊标记.cs b/OshimaBot.Content/Effects/PassiveEffects/巡诊标记.cs new file mode 100644 index 0000000..3a7996b --- /dev/null +++ b/OshimaBot.Content/Effects/PassiveEffects/巡诊标记.cs @@ -0,0 +1,64 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.OpenEffects; +using OshimaBot.Content.Items; + +namespace OshimaBot.Content.Effects.PassiveEffects +{ + /// + /// 装备【行军医箱】的监听标记 —— 穿戴时由穿戴者挂到每名队友的状态栏上。 + /// 存在意义:框架中大部分细粒度钩子(如 ) + /// 只通知「触发者 + 目标」的特效,穿戴者无法直接监听队友的受击事件。 + /// 因此必须像【开宫】挂【长期监视】那样,把本标记挂进队友状态栏, + /// 让标记以宿主自己的身份收到钩子,再把信号转发给穿戴者侧的【行军医箱特效】。 + /// 本标记自身不产生任何收益,是内部簿记用标记,不可被驱散; + /// 当装备被卸下 / 被空投替换时,由控制器统一撤回,保证幂等。 + /// + public class 巡诊标记 : Effect + { + public override long Id => (long)PassiveEffectID.巡诊标记; + public override string Name => "巡诊标记"; + public override string Description => $"此角色处于 [ {Source} ] 的行军医箱巡诊范围内。"; + public override EffectType EffectType => EffectType.Mark; + + /// 友方标记,非负面效果 + public override bool IsDebuff => false; + + /// 无具体时长,随装备存续 + public override bool DurativeWithoutDuration => true; + + /// 内部簿记标记,不可被任何形态的驱散移除 + public override DispelledType DispelledType => DispelledType.CannotBeDispelled; + + public override Character Source => _sourceCharacter; + + private readonly Character _sourceCharacter; + private readonly 行军医箱特效 _controller; + + /// 标记宿主(由 捕获;标记总是通过 挂载) + private Character? _host; + + public 巡诊标记(Skill skill, Character sourceCharacter, 行军医箱特效 controller) : base(skill) + { + GamingQueue = skill.GamingQueue; + _sourceCharacter = sourceCharacter; + _controller = controller; + } + + public override void OnEffectGained(HookContext ctx) + { + _host = ctx.Trigger; + } + + public override void AfterDamageCalculation(DamageContext ctx) + { + // 本标记会随宿主收到「宿主参与的所有伤害结算」,只关心宿主作为受击方的那一次 + Character? host = _host; + if (host is null || ctx.Enemy != host) return; + if (ctx.DamageResult != DamageResult.Normal && ctx.DamageResult != DamageResult.Critical) return; + if (ctx.ActualDamage <= 0) return; + _controller.TryEmergencyHeal(host); + } + } +} diff --git a/OshimaBot.Content/Effects/PassiveEffects/强运.cs b/OshimaBot.Content/Effects/PassiveEffects/强运.cs new file mode 100644 index 0000000..fa99272 --- /dev/null +++ b/OshimaBot.Content/Effects/PassiveEffects/强运.cs @@ -0,0 +1,116 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.OpenEffects; +using Milimoe.FunGameTesting.Others; + +namespace OshimaBot.Content.Effects.PassiveEffects +{ + /// + /// 强运:被动状态(由【十二宫星环】等来源施加,按回合计时) + /// · 所属角色每个回合结束时,随机生成 2~3 份绑定自身的【回合奖励】 + /// · 奖励取自模组公共的 (与队列内置奖励同构): + /// 用 构造奖励技能(Skill 由 OpenSkill 承载、Effect 按 EffectID 构造), + /// 再经 绑定到角色名下 + /// · 仅在启用「角色绑定的回合奖励」时才能真正生成(否则 AddRoundReward 返回 false) + /// + public class 强运 : Effect + { + public override long Id => (long)PassiveEffectID.强运; + public override string Name => "强运"; + public override string Description => + $"此角色处于强运状态:每个回合结束时,随机生成 {最小生成数量}~{最大生成数量} 份绑定自身的回合奖励,并顺延到其下一个行动回合。持续 {DurationTurn} 回合。来自:[ {Source} ] 的 [ {Skill.Name} ]"; + public override bool IsDebuff => false; + public override Character? Source => _sourceCharacter; + public override bool Durative => _durative; + public override double Duration => _duration; + public override int DurationTurn => _durationTurn; + public override DispelledType DispelledType => DispelledType.CannotBeDispelled; + + /// 每次触发最少生成的奖励数量 + public const int 最小生成数量 = 2; + + /// 每次触发最多生成的奖励数量 + public const int 最大生成数量 = 3; + + private readonly Character _targetCharacter; + private readonly Character _sourceCharacter; + private readonly bool _durative; + private readonly double _duration; + private readonly int _durationTurn; + + public 强运(Skill skill, Character targetCharacter, Character sourceCharacter, bool durative = false, double duration = 0, int durationTurn = 1) : base(skill) + { + GamingQueue = skill.GamingQueue; + _targetCharacter = targetCharacter; + _sourceCharacter = sourceCharacter; + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + } + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (_durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + } + + public override void OnTurnEnd(TurnContext ctx) + { + if (ctx.Trigger is not Character character || character != _targetCharacter || character.HP <= 0) return; + if (GamingQueue is null) return; + + Dictionary> 奖励池 = RoundRewardPool.Create(Random); + EffectID[] ids = [.. 奖励池.Keys]; + int count = Random.Next(最小生成数量, 最大生成数量 + 1); + List generatedNames = []; + for (int i = 0; i < count; i++) + { + EffectID id = ids[Random.Next(ids.Length)]; + Skill reward = 构造奖励(id, 奖励池[id]); + if (!GamingQueue.AddRoundReward(character, 1, reward)) + { + break; + } + generatedNames.Add(reward.Name); + } + + if (generatedNames.Count > 0) + { + WriteLine($"[ {character} ] 受到强运眷顾,为下一行动回合生成了 {generatedNames.Count} 份回合奖励:{string.Join("、", generatedNames)}!"); + } + else + { + WriteLine($"[ {character} ] 的强运未能生成回合奖励(未启用角色绑定的回合奖励)。"); + } + } + + /// + /// 从公共奖励池构造一份奖励技能(与队列的 CreateRoundRewardSkill 同构) + /// + private static Skill 构造奖励(EffectID id, Dictionary effectArgs) + { + Dictionary skillArgs = []; + if (RoundRewardPool.IsActive(id)) + { + skillArgs.Add("active", true); + skillArgs.Add("self", true); + skillArgs.Add("enemy", false); + } + + Skill skill = Factory.OpenFactory.GetInstance((long)id, "", skillArgs); + Effect effect = Factory.OpenFactory.GetInstance((long)id, "", skill, new(effectArgs)); + skill.Effects.Add(effect); + skill.Name = $"[R] {effect.Name}"; + return skill; + } + } +} diff --git a/OshimaBot.Content/Effects/PassiveEffects/愤怒.cs b/OshimaBot.Content/Effects/PassiveEffects/愤怒.cs new file mode 100644 index 0000000..c120831 --- /dev/null +++ b/OshimaBot.Content/Effects/PassiveEffects/愤怒.cs @@ -0,0 +1,113 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.EffectResult; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Effects.PassiveEffects +{ + public class 愤怒 : Effect + { + public override long Id => (long)PassiveEffectID.愤怒; + public override string Name => "愤怒"; + public override string Description => $"此角色处于愤怒状态,行动受限且失控,行动回合中无法自主行动,仅能对 [ {_targetCharacter} ] 发起普通攻击。来自:[ {Source} ] 的 [ {Skill.Name} ]"; + public override EffectType EffectType => EffectType.Taunt; + public override DispelledType DispelledType => DispelledType.Strong; + public override bool IsDebuff => true; + public override Character Source => _sourceCharacter; + public override bool Durative => _durative; + public override double Duration => _duration; + public override int DurationTurn => _durationTurn; + public override bool ExemptDuration => true; + + private readonly Character _sourceCharacter; + private readonly Character _targetCharacter; + private readonly bool _durative; + private readonly double _duration; + private readonly int _durationTurn; + + public 愤怒(Skill skill, Character sourceCharacter, Character targetCharacter, bool durative = false, double duration = 0, int durationTurn = 1) : base(skill) + { + GamingQueue = skill.GamingQueue; + _sourceCharacter = sourceCharacter; + _targetCharacter = targetCharacter; + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + } + + public override void AlterSelectListBeforeAction(SelectionContext ctx) + { + if (ctx.Trigger is not Character character) return; + List enemys = ctx.Enemys; + List teammates = ctx.Teammates; + // 为了确保角色能够自动化行动,这里需要将角色设置为可行动 + if (character.CharacterState == CharacterState.ActionRestricted) + { + GamingQueue?.SetCharactersToAIControl(true, false, character); + character.CharacterState = CharacterState.Actionable; + } + enemys.Clear(); + teammates.Clear(); + if (_targetCharacter.HP > 0) + { + enemys.Add(_targetCharacter); + } + } + + public override AlterActionTypeResult AlterActionTypeBeforeAction(DecisionContext ctx) + { + if (_targetCharacter.HP > 0) + { + // 目标存活:强制倾向普通攻击,禁止使用物品与技能 + return new AlterActionTypeResult { ForceAction = true, PNormalAttack = 1, CanUseItem = false, CanCastSkill = false }; + } + // 如果目标已死亡,则放弃本回合行动,并在回合结束后自动移除愤怒状态 + RemainDuration = 0; + RemainDurationTurn = 0; + return new AlterActionTypeResult { ForceAction = true, ActionType = CharacterActionType.EndTurn }; + } + + public override void AfterDeathCalculation(DeathContext ctx) + { + if (ctx.Trigger is not Character death) return; + if (death == _targetCharacter) + { + // 如果目标死亡,则在下次时间流逝时自动移除愤怒状态 + RemainDuration = 0; + RemainDurationTurn = 0; + } + } + + public override void OnTurnEnd(TurnContext ctx) + { + if (ctx.Trigger is not Character character) return; + character.UpdateCharacterState(); + } + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (_durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + GamingQueue?.SetCharactersToAIControl(true, false, character); + AddEffectStatesToCharacter(character, [CharacterState.ActionRestricted]); + AddEffectTypeToCharacter(character, [EffectType.Taunt]); + InterruptCasting(character, Source); + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + GamingQueue?.SetCharactersToAIControl(true, true, character); + RemoveEffectStatesFromCharacter(character); + RemoveEffectTypesFromCharacter(character); + } + } +} diff --git a/OshimaBot.Content/Effects/PassiveEffects/战斗不能.cs b/OshimaBot.Content/Effects/PassiveEffects/战斗不能.cs new file mode 100644 index 0000000..d8f80ad --- /dev/null +++ b/OshimaBot.Content/Effects/PassiveEffects/战斗不能.cs @@ -0,0 +1,57 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Effects.PassiveEffects +{ + public class 战斗不能 : Effect + { + public override long Id => (long)PassiveEffectID.战斗不能; + public override string Name => "战斗不能"; + public override string Description => $"此角色处于战斗不能状态,无法普通攻击和使用技能(魔法、战技和爆发技),无法对敌人或者队友使用物品。来自:[ {Source} ] 的 [ {Skill.Name} ]"; + public override EffectType EffectType => EffectType.Cripple; + public override DispelledType DispelledType => DispelledType.Strong; + public override bool IsDebuff => true; + public override Character Source => _sourceCharacter; + public override bool Durative => _durative; + public override double Duration => _duration; + public override int DurationTurn => _durationTurn; + public override bool ExemptDuration => true; + + 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) + { + GamingQueue = skill.GamingQueue; + _sourceCharacter = sourceCharacter; + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + } + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (_durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + AddEffectStatesToCharacter(character, [CharacterState.BattleRestricted]); + InterruptCasting(character, Source); + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + RemoveEffectStatesFromCharacter(character); + } + } +} diff --git a/OshimaBot.Content/Effects/PassiveEffects/技能免疫.cs b/OshimaBot.Content/Effects/PassiveEffects/技能免疫.cs new file mode 100644 index 0000000..883b73a --- /dev/null +++ b/OshimaBot.Content/Effects/PassiveEffects/技能免疫.cs @@ -0,0 +1,67 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.EffectResult; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Effects.PassiveEffects +{ + public class 技能免疫 : Effect + { + public override long Id => (long)PassiveEffectID.技能免疫; + public override string Name => "技能免疫"; + public override string Description => $"此角色处于技能免疫状态,无法选中其作为技能目标(自释放技能除外),并免疫来自技能的伤害。来自:[ {Source} ] 的 [ {Skill.Name} ]"; + public override EffectType EffectType => EffectType.SkilledImmune; + public override DispelledType DispelledType => DispelledType.Weak; + public override bool IsDebuff => false; + 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) + { + GamingQueue = skill.GamingQueue; + _sourceCharacter = sourceCharacter; + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + } + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (_durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + AddImmuneTypesToCharacter(character, [ImmuneType.Skilled]); + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + RemoveImmuneTypesFromCharacter(character); + } + + public override OnImmuneCheckResult OnImmuneCheck(ImmuneContext ctx) + { + if (ctx.Trigger is not Character character) return default; + Character? target = ctx.Target; + if (character == target) + { + return new OnImmuneCheckResult { IgnoreImmunity = true }; + } + return default; + } + } +} diff --git a/OshimaBot.Content/Effects/PassiveEffects/持续伤害.cs b/OshimaBot.Content/Effects/PassiveEffects/持续伤害.cs new file mode 100644 index 0000000..667ef6e --- /dev/null +++ b/OshimaBot.Content/Effects/PassiveEffects/持续伤害.cs @@ -0,0 +1,107 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Effects.PassiveEffects +{ + public class 持续伤害 : Effect + { + public override long Id => (long)PassiveEffectID.持续伤害; + public override string Name { get; set; } = "持续伤害"; + public override string Description => $"此角色正受到持续伤害,每{GameplayEquilibriumConstant.InGameTime}受到 {(_isPercentage ? $"{_durationDamagePercent * 100:0.##}% 当前生命值 [ {Damage:0.##} ]" : Damage.ToString("0.##"))} 点{CharacterSet.GetDamageTypeName(_damageType)}。来自:[ {Source} ] 的 [ {Skill.Name} ]"; + public override bool IsDebuff { get; set; } = true; + public override Character Source => _sourceCharacter; + public override bool Durative => _durative; + public override double Duration => _duration; + public override int DurationTurn => _durationTurn; + + private readonly Character _targetCharacter; + private readonly Character _sourceCharacter; + private readonly bool _durative; + private readonly double _duration; + private readonly int _durationTurn; + private readonly bool _isPercentage; + private readonly double _durationDamage; + private readonly double _durationDamagePercent; + private readonly DamageType _damageType = DamageType.Physical; + private readonly DamageCalculationOptions? _options = null; + private double Damage => _isPercentage ? _targetCharacter.HP * _durationDamagePercent : _durationDamage; + + public 持续伤害(Skill skill, Character targetCharacter, Character sourceCharacter, bool durative = false, double duration = 0, int durationTurn = 1, + bool isPercentage = true, double durationDamage = 100, double durationDamagePercent = 0.02, DamageType damageType = DamageType.Physical, DamageCalculationOptions? options = null) : base(skill) + { + GamingQueue = skill.GamingQueue; + _targetCharacter = targetCharacter; + _sourceCharacter = sourceCharacter; + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + _isPercentage = isPercentage; + _durationDamage = durationDamage; + _durationDamagePercent = durationDamagePercent; + _damageType = damageType; + _options = options; + } + + private double GetDamage(double hp, double elapsed) + { + if (hp <= 0) + { + return 0; + } + double damage = _isPercentage ? hp * _durationDamagePercent : _durationDamage; + return damage * elapsed; + } + + public override void OnTimeElapsed(TimeLapseContext ctx) + { + if (ctx.Trigger is not Character character) return; + double elapsed = ctx.Elapsed; + if (character == _targetCharacter && character.HP > 0) + { + double hp = character.HP; + double damage = GetDamage(hp, elapsed); + if (elapsed > 1) + { + damage = 0; + int loop = 0; + int elapsedSecond = (int)elapsed; + for (; loop < elapsedSecond; loop++) + { + double current = GetDamage(hp, 1); + damage += current; + hp -= current; + elapsed--; + } + if (elapsed > 0) + { + damage += GetDamage(hp, elapsed); + } + } + DamageToEnemy(Source, character, _damageType, MagicType, damage, _options); + } + } + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (_durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + AddEffectTypeToCharacter(character, [EffectType]); + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + RemoveEffectTypesFromCharacter(character); + } + } +} diff --git a/OshimaBot.Content/Effects/PassiveEffects/持续回复.cs b/OshimaBot.Content/Effects/PassiveEffects/持续回复.cs new file mode 100644 index 0000000..7c44588 --- /dev/null +++ b/OshimaBot.Content/Effects/PassiveEffects/持续回复.cs @@ -0,0 +1,103 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Effects.PassiveEffects +{ + public class 持续回复 : Effect + { + public override long Id => (long)PassiveEffectID.持续回复; + public override string Name => "持续回复"; + public override string Description => $"此角色处于持续回复状态,每{GameplayEquilibriumConstant.InGameTime}回复 {(_isPercentage ? $"{_durationHealPercent * 100:0.##}% [ {Heal:0.##} ]" : Heal.ToString("0.##"))} 点当前生命值。来自:[ {Source} ] 的 [ {Skill.Name} ]"; + public override EffectType EffectType => EffectType.HealOverTime; + public override bool IsDebuff => false; + public override Character Source => _sourceCharacter; + public override bool Durative => _durative; + public override double Duration => _duration; + public override int DurationTurn => _durationTurn; + + private readonly Character _targetCharacter; + private readonly Character _sourceCharacter; + private readonly bool _durative; + private readonly double _duration; + private readonly int _durationTurn; + private readonly bool _isPercentage; + private readonly double _durationHeal; + private readonly double _durationHealPercent; + private double Heal => _isPercentage ? _targetCharacter.HP * _durationHealPercent : _durationHeal; + + public 持续回复(Skill skill, Character targetCharacter, Character sourceCharacter, bool durative = false, double duration = 0, int durationTurn = 1, + bool isPercentage = true, double durationHeal = 100, double durationHealPercent = 0.02) : base(skill) + { + GamingQueue = skill.GamingQueue; + _targetCharacter = targetCharacter; + _sourceCharacter = sourceCharacter; + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + _isPercentage = isPercentage; + _durationHeal = durationHeal; + _durationHealPercent = durationHealPercent; + } + + private double GetHeal(double hp, double elapsed) + { + if (hp <= 0) + { + return 0; + } + double heal = _isPercentage ? hp * _durationHealPercent : _durationHeal; + return heal * elapsed; + } + + public override void OnTimeElapsed(TimeLapseContext ctx) + { + if (ctx.Trigger is not Character character) return; + double elapsed = ctx.Elapsed; + if (character == _targetCharacter && character.HP > 0) + { + double hp = character.HP; + double heal = GetHeal(hp, elapsed); + if (elapsed > 1) + { + heal = 0; + int loop = 0; + int elapsedSecond = (int)elapsed; + for (; loop < elapsedSecond; loop++) + { + double current = GetHeal(hp, 1); + heal += current; + hp -= current; + elapsed--; + } + if (elapsed > 0) + { + heal += GetHeal(hp, elapsed); + } + } + HealToTarget(Source, character, heal, triggerEffects: false); + } + } + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (_durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + AddEffectTypeToCharacter(character, [EffectType.HealOverTime]); + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + RemoveEffectTypesFromCharacter(character); + } + } +} diff --git a/OshimaBot.Content/Effects/PassiveEffects/持续性弱驱散.cs b/OshimaBot.Content/Effects/PassiveEffects/持续性弱驱散.cs new file mode 100644 index 0000000..b489a1f --- /dev/null +++ b/OshimaBot.Content/Effects/PassiveEffects/持续性弱驱散.cs @@ -0,0 +1,59 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.EffectResult; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Effects.PassiveEffects +{ + public class 持续性弱驱散 : Effect + { + public override long Id => (long)PassiveEffectID.持续性弱驱散; + public override string Name => "持续性弱驱散"; + public override string Description => $"此角色正在被持续性弱驱散。来自:[ {Source} ] 的 [ {Skill.Name} ]"; + public override EffectType EffectType => EffectType.WeakDispelling; + public override DispelType DispelType => DispelType.DurativeWeak; + public override Character Source => _sourceCharacter; + public override bool DurativeWithoutDuration => _durativeWithoutDuration; + public override bool Durative => _durative; + public override double Duration => _duration; + public override int DurationTurn => _durationTurn; + + private readonly Character _sourceCharacter; + private readonly bool _durativeWithoutDuration; + private readonly bool _durative; + private readonly double _duration; + private readonly int _durationTurn; + + public 持续性弱驱散(Skill skill, Character sourceCharacter, bool durativeWithoutDuration = false, bool durative = false, double duration = 0, int durationTurn = 1) : base(skill) + { + GamingQueue = skill.GamingQueue; + DispelledType = DispelledType.Weak; + _sourceCharacter = sourceCharacter; + _durativeWithoutDuration = durativeWithoutDuration; + if (!_durativeWithoutDuration) + { + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + } + } + + public override BeforeSkillCastWillBeInterruptedResult BeforeSkillCastWillBeInterrupted(SkillCastContext ctx) + { + return new BeforeSkillCastWillBeInterruptedResult { BlockInterruption = true }; + } + + public override void OnEffectGained(HookContext ctx) + { + if (_durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + } + } +} diff --git a/OshimaBot.Content/Effects/PassiveEffects/持续性强驱散.cs b/OshimaBot.Content/Effects/PassiveEffects/持续性强驱散.cs new file mode 100644 index 0000000..3262adb --- /dev/null +++ b/OshimaBot.Content/Effects/PassiveEffects/持续性强驱散.cs @@ -0,0 +1,59 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.EffectResult; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Effects.PassiveEffects +{ + public class 持续性强驱散 : Effect + { + public override long Id => (long)PassiveEffectID.持续性强驱散; + public override string Name => "持续性强驱散"; + public override string Description => $"此角色正在被持续性强驱散。来自:[ {Source} ] 的 [ {Skill.Name} ]"; + public override EffectType EffectType => EffectType.StrongDispelling; + public override DispelType DispelType => DispelType.DurativeStrong; + public override Character Source => _sourceCharacter; + public override bool DurativeWithoutDuration => _durativeWithoutDuration; + public override bool Durative => _durative; + public override double Duration => _duration; + public override int DurationTurn => _durationTurn; + + private readonly Character _sourceCharacter; + private readonly bool _durativeWithoutDuration; + private readonly bool _durative; + private readonly double _duration; + private readonly int _durationTurn; + + public 持续性强驱散(Skill skill, Character sourceCharacter, bool durativeWithoutDuration = false, bool durative = false, double duration = 0, int durationTurn = 1) : base(skill) + { + GamingQueue = skill.GamingQueue; + DispelledType = DispelledType.Strong; + _sourceCharacter = sourceCharacter; + _durativeWithoutDuration = durativeWithoutDuration; + if (!_durativeWithoutDuration) + { + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + } + } + + public override BeforeSkillCastWillBeInterruptedResult BeforeSkillCastWillBeInterrupted(SkillCastContext ctx) + { + return new BeforeSkillCastWillBeInterruptedResult { BlockInterruption = true }; + } + + public override void OnEffectGained(HookContext ctx) + { + if (_durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + } + } +} diff --git a/OshimaBot.Content/Effects/PassiveEffects/时雨标记.cs b/OshimaBot.Content/Effects/PassiveEffects/时雨标记.cs new file mode 100644 index 0000000..102d5ff --- /dev/null +++ b/OshimaBot.Content/Effects/PassiveEffects/时雨标记.cs @@ -0,0 +1,66 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.EffectResult; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Effects.PassiveEffects +{ + public class 时雨标记 : Effect + { + public override long Id => (long)PassiveEffectID.时雨标记; + public override string Name => "时雨标记"; + public override string Description => $"此角色持有时雨标记。来自:[ {Source} ]"; + public override EffectType EffectType => EffectType.Mark; + public override bool IsDebuff => true; + public override Character Source => _sourceCharacter; + public override DispelledType DispelledType { get; set; } = DispelledType.Weak; + + private readonly Character _sourceCharacter; + + public 时雨标记(Skill skill, Character sourceCharacter) : base(skill) + { + GamingQueue = skill.GamingQueue; + _sourceCharacter = sourceCharacter; + } + + public override void OnTurnStart(TurnContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (GamingQueue is null) + { + return; + } + List enemies = GamingQueue.GetEnemies(character); + if (enemies.Contains(Source) && Random.NextDouble() < 0.65) + { + WriteLine($"[ {character} ] 受到了{nameof(时雨标记)}的影响,陷入了混乱!!!"); + Effect e = new 混乱(Skill, character, false, 0, 1); + character.Effects.Add(e); + e.OnEffectGained(new HookContext(GamingQueue, character)); + } + } + + public override AlterActualDamageResult AlterActualDamageAfterCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character) return default; + if (ctx.Enemy is not Character enemy) return default; + double damage = ctx.Damage; + if (GamingQueue is null) + { + return default; + + } + List teammates = GamingQueue.GetTeammates(character); + if ((character == Source || teammates.Contains(Source)) && character.Effects.Any(e => e is 时雨标记) && enemy.Effects.Any(e => e is 时雨标记)) + { + double bonus = damage * 0.25; + WriteLine($"[ {character} ] 受到了{nameof(时雨标记)}的影响,伤害提高了 {bonus:0.##} 点!"); + return new AlterActualDamageResult { DamageDelta = bonus }; + + } + return default; + + } + } +} diff --git a/OshimaBot.Content/Effects/PassiveEffects/易伤.cs b/OshimaBot.Content/Effects/PassiveEffects/易伤.cs new file mode 100644 index 0000000..3451220 --- /dev/null +++ b/OshimaBot.Content/Effects/PassiveEffects/易伤.cs @@ -0,0 +1,77 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.EffectResult; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Effects.PassiveEffects +{ + public class 易伤 : Effect + { + public override long Id => (long)PassiveEffectID.易伤; + public override string Name => "易伤"; + public override string Description => $"此角色处于易伤状态,额外受到 {_exDamagePercent * 100:0.##}% {CharacterSet.GetDamageTypeName(_damageType)}。来自:[ {Source} ] 的 [ {Skill.Name} ]"; + public override EffectType EffectType => EffectType.Vulnerable; + public override bool IsDebuff => true; + public override Character Source => _sourceCharacter; + public override bool Durative => _durative; + public override double Duration => _duration; + public override int DurationTurn => _durationTurn; + public override bool ExemptDuration => true; + + private readonly DamageType _damageType; + private readonly Character _targetCharacter; + private readonly Character _sourceCharacter; + private readonly bool _durative; + private readonly double _duration; + private readonly int _durationTurn; + private readonly double _exDamagePercent; + + public 易伤(Skill skill, Character targetCharacter, Character sourceCharacter, bool durative = false, double duration = 0, int durationTurn = 1, + DamageType damageType = DamageType.Magical, double exDamagePercent = 0) : base(skill) + { + GamingQueue = skill.GamingQueue; + _targetCharacter = targetCharacter; + _sourceCharacter = sourceCharacter; + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + _damageType = damageType; + _exDamagePercent = exDamagePercent; + } + + public override AlterActualDamageResult AlterActualDamageAfterCalculation(DamageContext ctx) + { + if (ctx.Enemy is not Character enemy) return default; + double damage = ctx.Damage; + DamageType damageType = ctx.DamageType; + if (enemy == _targetCharacter && damageType == _damageType) + { + return new AlterActualDamageResult { DamageDelta = damage * _exDamagePercent }; + + } + return default; + + } + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (_durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + AddEffectTypeToCharacter(character, [EffectType.Vulnerable]); + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + RemoveEffectTypesFromCharacter(character); + } + } +} diff --git a/OshimaBot.Content/Effects/PassiveEffects/易损.cs b/OshimaBot.Content/Effects/PassiveEffects/易损.cs new file mode 100644 index 0000000..51a8af8 --- /dev/null +++ b/OshimaBot.Content/Effects/PassiveEffects/易损.cs @@ -0,0 +1,73 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.EffectResult; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Effects.PassiveEffects +{ + public class 易损 : Effect + { + public override long Id => (long)PassiveEffectID.易损; + public override string Name => "易损"; + public override string Description => $"此角色处于易损状态,承受伤害提升 {_exDamagePercent * 100:0.##}%。来自:[ {Source} ] 的 [ {Skill.Name} ]"; + public override EffectType EffectType => EffectType.Vulnerable; + public override bool IsDebuff => true; + public override Character Source => _sourceCharacter; + public override bool Durative => _durative; + public override double Duration => _duration; + public override int DurationTurn => _durationTurn; + public override bool ExemptDuration => true; + + private readonly Character _targetCharacter; + private readonly Character _sourceCharacter; + private readonly bool _durative; + private readonly double _duration; + private readonly int _durationTurn; + private readonly double _exDamagePercent; + + public 易损(Skill skill, Character targetCharacter, Character sourceCharacter, bool durative = false, double duration = 0, int durationTurn = 1, double exDamagePercent = 0) : base(skill) + { + GamingQueue = skill.GamingQueue; + _targetCharacter = targetCharacter; + _sourceCharacter = sourceCharacter; + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + _exDamagePercent = exDamagePercent; + } + + public override AlterActualDamageResult AlterActualDamageAfterCalculation(DamageContext ctx) + { + if (ctx.Enemy is not Character enemy) return default; + double damage = ctx.Damage; + if (enemy == _targetCharacter) + { + return new AlterActualDamageResult { DamageDelta = damage * _exDamagePercent }; + + } + return default; + + } + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (_durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + AddEffectTypeToCharacter(character, [EffectType.Vulnerable]); + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + RemoveEffectTypesFromCharacter(character); + } + } +} diff --git a/OshimaBot.Content/Effects/PassiveEffects/标记.cs b/OshimaBot.Content/Effects/PassiveEffects/标记.cs new file mode 100644 index 0000000..7f3a62d --- /dev/null +++ b/OshimaBot.Content/Effects/PassiveEffects/标记.cs @@ -0,0 +1,27 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Effects.PassiveEffects +{ + public class 标记 : Effect + { + public override long Id => (long)PassiveEffectID.标记; + public override string Name => $"{_name}标记"; + public override string Description => $"此角色持有{Name}。{OtherDescription}来自:[ {Source} ]"; + public override EffectType EffectType => EffectType.Mark; + public override bool IsDebuff => true; + public override Character Source => _sourceCharacter; + public string OtherDescription { get; set; } = ""; + + private readonly string _name; + private readonly Character _sourceCharacter; + + public 标记(Skill skill, string name, Character sourceCharacter) : base(skill) + { + GamingQueue = skill.GamingQueue; + _name = name; + _sourceCharacter = sourceCharacter; + } + } +} diff --git a/OshimaBot.Content/Effects/PassiveEffects/气绝.cs b/OshimaBot.Content/Effects/PassiveEffects/气绝.cs new file mode 100644 index 0000000..eb3cd89 --- /dev/null +++ b/OshimaBot.Content/Effects/PassiveEffects/气绝.cs @@ -0,0 +1,114 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Effects.PassiveEffects +{ + public class 气绝 : Effect + { + public override long Id => (long)PassiveEffectID.气绝; + public override string Name => "气绝"; + public override string Description => $"此角色处于气绝状态,行动受限并且每{GameplayEquilibriumConstant.InGameTime}流失 {(_isPercentage ? $"{_durationDamagePercent * 100:0.##}% [ {Damage:0.##} ]" : Damage.ToString("0.##"))} 点当前生命值,此生命流失效果不会导致角色死亡。来自:[ {Source} ] 的 [ {Skill.Name} ]"; + public override EffectType EffectType => EffectType.Bleed; + public override DispelledType DispelledType => DispelledType.Strong; + public override bool IsDebuff => true; + public override Character Source => _sourceCharacter; + public override bool Durative => _durative; + public override double Duration => _duration; + public override int DurationTurn => _durationTurn; + public override bool ExemptDuration => true; + + private readonly Character _targetCharacter; + private readonly Character _sourceCharacter; + private readonly bool _durative; + private readonly double _duration; + private readonly int _durationTurn; + private readonly bool _isPercentage; + private readonly double _durationDamage; + private readonly double _durationDamagePercent; + private double Damage => _isPercentage ? _targetCharacter.HP * _durationDamagePercent : _durationDamage; + + public 气绝(Skill skill, Character targetCharacter, Character sourceCharacter, bool durative = false, double duration = 0, int durationTurn = 1, + bool isPercentage = true, double durationDamage = 100, double durationDamagePercent = 0.02) : base(skill) + { + GamingQueue = skill.GamingQueue; + _targetCharacter = targetCharacter; + _sourceCharacter = sourceCharacter; + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + _isPercentage = isPercentage; + _durationDamage = durationDamage; + _durationDamagePercent = durationDamagePercent; + } + + private double GetDamage(double hp, double elapsed) + { + if (hp <= 0) + { + return 0; + } + double damage = _isPercentage ? hp * _durationDamagePercent : _durationDamage; + return damage * elapsed; + } + + public override void OnTimeElapsed(TimeLapseContext ctx) + { + if (ctx.Trigger is not Character character) return; + double elapsed = ctx.Elapsed; + if (character == _targetCharacter && character.HP > 0) + { + double hp = character.HP; + double damage = GetDamage(hp, elapsed); + if (elapsed > 1) + { + damage = 0; + int loop = 0; + int elapsedSecond = (int)elapsed; + for (; loop < elapsedSecond; loop++) + { + double current = GetDamage(hp, 1); + damage += current; + hp -= current; + elapsed--; + } + if (elapsed > 0) + { + damage += GetDamage(hp, elapsed); + } + } + character.HP -= damage; + if (character.HP <= 0) + { + character.HP = 1; + } + GamingQueue?.CalculateCharacterDamageStatistics(Source, character, damage, DamageType.True); + WriteLine($"[ {character} ] 因气绝而流失了 {damage:0.##} 点生命值!"); + } + } + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (_durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + AddEffectTypeToCharacter(character, [EffectType.Bleed]); + AddEffectStatesToCharacter(character, [CharacterState.ActionRestricted]); + InterruptCasting(character, Source); + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + RemoveEffectTypesFromCharacter(character); + RemoveEffectStatesFromCharacter(character); + } + } +} diff --git a/OshimaBot.Content/Effects/PassiveEffects/海王星的野望标记.cs b/OshimaBot.Content/Effects/PassiveEffects/海王星的野望标记.cs new file mode 100644 index 0000000..1bc9cc5 --- /dev/null +++ b/OshimaBot.Content/Effects/PassiveEffects/海王星的野望标记.cs @@ -0,0 +1,25 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Effects.PassiveEffects +{ + public class 海王星的野望标记 : Effect + { + public override long Id => (long)PassiveEffectID.海王星的野望标记; + public override string Name => "海王星的野望标记"; + public override string Description => $"此角色持有海王星的野望标记。来自:[ {Source} ]"; + public override EffectType EffectType => EffectType.Mark; + public override bool IsDebuff => true; + public override Character Source => _sourceCharacter; + public override DispelledType DispelledType => DispelledType.CannotBeDispelled; + + private readonly Character _sourceCharacter; + + public 海王星的野望标记(Skill skill, Character sourceCharacter) : base(skill) + { + GamingQueue = skill.GamingQueue; + _sourceCharacter = sourceCharacter; + } + } +} diff --git a/OshimaBot.Content/Effects/PassiveEffects/混乱.cs b/OshimaBot.Content/Effects/PassiveEffects/混乱.cs new file mode 100644 index 0000000..4b3115b --- /dev/null +++ b/OshimaBot.Content/Effects/PassiveEffects/混乱.cs @@ -0,0 +1,94 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.EffectResult; +using FunGame.Core.Model.Framework; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Effects.PassiveEffects +{ + public class 混乱 : Effect + { + public override long Id => (long)PassiveEffectID.混乱; + public override string Name => "混乱"; + public override string Description => $"此角色处于混乱状态,行动受限且失控,行动回合中无法自主行动而是随机行动,在进行攻击指令时,可能会选取友方角色为目标。来自:[ {Source} ] 的 [ {Skill.Name} ]"; + public override EffectType EffectType => EffectType.Confusion; + public override DispelledType DispelledType => DispelledType.Strong; + public override bool IsDebuff => true; + public override Character Source => _sourceCharacter; + public override bool Durative => _durative; + public override double Duration => _duration; + public override int DurationTurn => _durationTurn; + public override bool ExemptDuration => true; + + 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) + { + GamingQueue = skill.GamingQueue; + _sourceCharacter = sourceCharacter; + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + } + + public override void AlterSelectListBeforeAction(SelectionContext ctx) + { + if (ctx.Trigger is not Character character) return; + List enemys = ctx.Enemys; + List teammates = ctx.Teammates; + // 为了确保角色能够混乱行动,这里需要将角色设置为可行动 + if (character.CharacterState == CharacterState.ActionRestricted) + { + GamingQueue?.SetCharactersToAIControl(true, false, character); + character.CharacterState = CharacterState.Actionable; + } + enemys.AddRange(teammates); + teammates.AddRange(enemys); + } + + public override AlterActionTypeResult AlterActionTypeBeforeAction(DecisionContext ctx) + { + DecisionPoints dp = ctx.DP; + return new AlterActionTypeResult + { + ForceAction = true, + ActionType = GamingQueue?.GetActionType(dp, ctx.PUseItem, ctx.PCastSkill, ctx.PNormalAttack) ?? CharacterActionType.EndTurn + }; + } + + public override void OnTurnEnd(TurnContext ctx) + { + if (ctx.Trigger is not Character character) return; + character.UpdateCharacterState(); + } + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (_durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + GamingQueue?.SetCharactersToAIControl(true, false, character); + AddEffectStatesToCharacter(character, [CharacterState.ActionRestricted]); + AddEffectTypeToCharacter(character, [EffectType.Confusion]); + InterruptCasting(character, Source); + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + GamingQueue?.SetCharactersToAIControl(true, true, character); + RemoveEffectStatesFromCharacter(character); + RemoveEffectTypesFromCharacter(character); + } + } +} diff --git a/OshimaBot.Content/Effects/PassiveEffects/物理免疫.cs b/OshimaBot.Content/Effects/PassiveEffects/物理免疫.cs new file mode 100644 index 0000000..6f94155 --- /dev/null +++ b/OshimaBot.Content/Effects/PassiveEffects/物理免疫.cs @@ -0,0 +1,55 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Effects.PassiveEffects +{ + public class 物理免疫 : Effect + { + public override long Id => (long)PassiveEffectID.物理免疫; + public override string Name => "物理免疫"; + public override string Description => $"此角色处于物理免疫状态,免疫物理伤害。来自:[ {Source} ] 的 [ {Skill.Name} ]"; + public override EffectType EffectType => EffectType.PhysicalImmune; + public override DispelledType DispelledType => DispelledType.Weak; + public override bool IsDebuff => false; + 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) + { + GamingQueue = skill.GamingQueue; + _sourceCharacter = sourceCharacter; + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + } + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (_durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + AddImmuneTypesToCharacter(character, [ImmuneType.Physical]); + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + RemoveImmuneTypesFromCharacter(character); + } + } +} diff --git a/OshimaBot.Content/Effects/PassiveEffects/物理护盾.cs b/OshimaBot.Content/Effects/PassiveEffects/物理护盾.cs new file mode 100644 index 0000000..6c5a968 --- /dev/null +++ b/OshimaBot.Content/Effects/PassiveEffects/物理护盾.cs @@ -0,0 +1,84 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.EffectResult; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Effects.PassiveEffects +{ + public class 物理护盾 : Effect + { + public override long Id => (long)PassiveEffectID.物理护盾; + public override string Name => "物理护盾"; + public override string Description => $"此角色拥有物理护盾{CurrentShield}。来自:[ {Source} ] 的 [ {Skill.Name} ]"; + public override EffectType EffectType => EffectType.Shield; + public override DispelledType DispelledType => DispelledType.CannotBeDispelled; + public override bool DurativeWithoutDuration => true; + public override bool IsDebuff => false; + public override Character Source => _sourceCharacter; + public override bool Durative => _durative; + public override double Duration => _duration; + public override int DurationTurn => _durationTurn; + + private string CurrentShield + { + get + { + if (_targetCharacter != null && _targetCharacter.Shield.ShieldOfEffects.TryGetValue(this, out ShieldOfEffect? value) && value != null) + { + return $",护盾值:{value.Shield:0.##} 点"; + } + else return ""; + } + } + private readonly Character _targetCharacter; + private readonly Character _sourceCharacter; + private readonly double _shield; + private readonly bool _durative; + private readonly double _duration; + private readonly int _durationTurn; + + public 物理护盾(Skill skill, Character targetCharacter, Character sourceCharacter, double shield, bool durative = false, double duration = 0, int durationTurn = 0) : base(skill) + { + GamingQueue = skill.GamingQueue; + _targetCharacter = targetCharacter; + _sourceCharacter = sourceCharacter; + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + _shield = shield; + } + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (_durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + character.Shield.AddShieldOfEffect(new(this, _shield, ShieldType.Physical, MagicType.None)); + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + character.Shield.RemoveShieldOfEffect(this); + } + + public override OnShieldBrokenResult OnShieldBroken(ShieldContext ctx) + { + if (ctx.Trigger is not Character character) return default; + Effect? effet = ctx.ShieldEffect; + if (effet == this) + { + character.Shield.RemoveShieldOfEffect(this); + character.Effects.Remove(this); + } + return default; + } + } +} diff --git a/OshimaBot.Content/Effects/PassiveEffects/电刑标记.cs b/OshimaBot.Content/Effects/PassiveEffects/电刑标记.cs new file mode 100644 index 0000000..2ed61ba --- /dev/null +++ b/OshimaBot.Content/Effects/PassiveEffects/电刑标记.cs @@ -0,0 +1,25 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Effects.PassiveEffects +{ + public class 电刑标记 : Effect + { + public override long Id => (long)PassiveEffectID.电刑标记; + public override string Name => "电刑标记"; + public override string Description => $"此角色持有电刑标记,层数:{层数} 层。来自:[ {Source} ]"; + public override EffectType EffectType => EffectType.Mark; + public override bool IsDebuff => true; + public override Character Source => _sourceCharacter; + public int 层数 { get; set; } = 1; + + private readonly Character _sourceCharacter; + + public 电刑标记(Skill skill, Character sourceCharacter) : base(skill) + { + GamingQueue = skill.GamingQueue; + _sourceCharacter = sourceCharacter; + } + } +} diff --git a/OshimaBot.Content/Effects/PassiveEffects/眩晕.cs b/OshimaBot.Content/Effects/PassiveEffects/眩晕.cs new file mode 100644 index 0000000..11925e5 --- /dev/null +++ b/OshimaBot.Content/Effects/PassiveEffects/眩晕.cs @@ -0,0 +1,11 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Effects.PassiveEffects +{ + public class 眩晕(Skill skill, Character sourceCharacter, bool durative = false, double duration = 0, int durationTurn = 1) : 完全行动不能(nameof(眩晕), EffectType.Stun, skill, sourceCharacter, durative, duration, durationTurn) + { + public override long Id => (long)PassiveEffectID.眩晕; + } +} diff --git a/OshimaBot.Content/Effects/PassiveEffects/石化.cs b/OshimaBot.Content/Effects/PassiveEffects/石化.cs new file mode 100644 index 0000000..b8c561e --- /dev/null +++ b/OshimaBot.Content/Effects/PassiveEffects/石化.cs @@ -0,0 +1,11 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Effects.PassiveEffects +{ + public class 石化(Skill skill, Character sourceCharacter, bool durative = false, double duration = 0, int durationTurn = 1) : 完全行动不能(nameof(石化), EffectType.Petrify, skill, sourceCharacter, durative, duration, durationTurn) + { + public override long Id => (long)PassiveEffectID.石化; + } +} diff --git a/OshimaBot.Content/Effects/PassiveEffects/禁止治疗.cs b/OshimaBot.Content/Effects/PassiveEffects/禁止治疗.cs new file mode 100644 index 0000000..8e847cd --- /dev/null +++ b/OshimaBot.Content/Effects/PassiveEffects/禁止治疗.cs @@ -0,0 +1,102 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.EffectResult; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Effects.PassiveEffects +{ + public class 禁止治疗 : Effect + { + public override long Id => (long)PassiveEffectID.禁止治疗; + public override string Name => "禁止治疗"; + public override string Description => $"此角色已被禁止治疗{禁止类型}。来自:[ {Source} ] 的 [ {Skill.Name} ]"; + public override EffectType EffectType => EffectType.GrievousWound; + public override Character Source => _sourceCharacter; + public override bool Durative => _durative; + public override double Duration => _duration; + public override int DurationTurn => _durationTurn; + + public string 禁止类型 + { + get + { + if (_allowRecovery && _allowLifeSteal && _allowHealing) + { + return ""; + } + List strings = []; + if (!_allowRecovery) + { + strings.Add("自然回复"); + } + if (!_allowLifeSteal) + { + strings.Add("生命偷取"); + } + if (!_allowHealing) + { + strings.Add("应用治疗"); + } + return $"({string.Join("、", strings)})"; + } + } + private readonly Character _sourceCharacter; + private readonly bool _allowRecovery; + private readonly bool _allowLifeSteal; + private readonly bool _allowHealing; + private readonly bool _durative; + private readonly double _duration; + private readonly int _durationTurn; + + public 禁止治疗(Skill skill, Character sourceCharacter, bool allowRecovery = false, bool allowLifeSteal = false, bool allowHealing = false, bool durative = false, double duration = 0, int durationTurn = 1) : base(skill) + { + GamingQueue = skill.GamingQueue; + _sourceCharacter = sourceCharacter; + _allowRecovery = allowRecovery; + _allowLifeSteal = allowLifeSteal; + _allowHealing = allowHealing; + if (!_allowHealing) + { + _allowLifeSteal = false; + _allowRecovery = false; + } + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + } + + public override BeforeApplyRecoveryResult BeforeApplyRecoveryAtTimeLapsing(TimeLapseContext ctx) + { + return new BeforeApplyRecoveryResult { CancelRecovery = !_allowRecovery }; + } + + public override BeforeLifestealResult BeforeLifesteal(LifestealContext ctx) + { + return new BeforeLifestealResult { CancelLifesteal = !_allowLifeSteal }; + } + + public override BeforeHealToTargetResult BeforeHealToTarget(HealContext ctx) + { + return new BeforeHealToTargetResult { CancelHeal = !_allowHealing }; + } + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (_allowRecovery && _allowLifeSteal && _allowHealing) + { + character.Effects.Remove(this); + return; + } + if (_durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + } + } +} diff --git a/OshimaBot.Content/Effects/PassiveEffects/累积之压标记.cs b/OshimaBot.Content/Effects/PassiveEffects/累积之压标记.cs new file mode 100644 index 0000000..cfc1ba3 --- /dev/null +++ b/OshimaBot.Content/Effects/PassiveEffects/累积之压标记.cs @@ -0,0 +1,25 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Effects.PassiveEffects +{ + public class 累积之压标记 : Effect + { + public override long Id => (long)PassiveEffectID.累积之压标记; + public override string Name => "累积之压标记"; + public override string Description => $"此角色持有累积之压标记。来自:[ {Source} ]"; + public override EffectType EffectType => EffectType.Mark; + public override bool IsDebuff => true; + public override bool DurativeWithoutDuration => true; + public override Character Source => _sourceCharacter; + + private readonly Character _sourceCharacter; + + public 累积之压标记(Skill skill, Character sourceCharacter) : base(skill) + { + GamingQueue = skill.GamingQueue; + _sourceCharacter = sourceCharacter; + } + } +} diff --git a/OshimaBot.Content/Effects/PassiveEffects/缴械.cs b/OshimaBot.Content/Effects/PassiveEffects/缴械.cs new file mode 100644 index 0000000..6e74030 --- /dev/null +++ b/OshimaBot.Content/Effects/PassiveEffects/缴械.cs @@ -0,0 +1,56 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Effects.PassiveEffects +{ + public class 缴械 : Effect + { + public override long Id => (long)PassiveEffectID.缴械; + public override string Name => "缴械"; + public override string Description => $"此角色被缴械了,不能使用普通攻击。来自:[ {Source} ] 的 [ {Skill.Name} ]"; + public override EffectType EffectType => EffectType.Disarm; + public override DispelledType DispelledType => DispelledType.Weak; + public override bool IsDebuff => true; + public override Character Source => _sourceCharacter; + public override bool Durative => _durative; + public override double Duration => _duration; + public override int DurationTurn => _durationTurn; + public override bool ExemptDuration => true; + + 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) + { + GamingQueue = skill.GamingQueue; + _sourceCharacter = sourceCharacter; + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + } + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (_durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + AddEffectStatesToCharacter(character, [CharacterState.AttackRestricted]); + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + RemoveEffectStatesFromCharacter(character); + } + } +} diff --git a/OshimaBot.Content/Effects/PassiveEffects/虚弱.cs b/OshimaBot.Content/Effects/PassiveEffects/虚弱.cs new file mode 100644 index 0000000..466c1c3 --- /dev/null +++ b/OshimaBot.Content/Effects/PassiveEffects/虚弱.cs @@ -0,0 +1,97 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.EffectResult; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Effects.PassiveEffects +{ + public class 虚弱 : Effect + { + public override long Id => (long)PassiveEffectID.虚弱; + public override string Name => "虚弱"; + public override string Description => $"此角色处于虚弱状态,伤害降低 {_damageReductionPercent * 100:0.##}%," + + $"物理护甲降低 {_DEFReductionPercent * 100:0.##}%,魔法抗性降低 {_MDFReductionPercent * 100:0.##}%,治疗效果降低 {_healingReductionPercent * 100:0.##}%。来自:[ {Source} ] 的 [ {Skill.Name} ]"; + public override EffectType EffectType => EffectType.Weaken; + public override DispelledType DispelledType => DispelledType.Weak; + public override bool IsDebuff => true; + public override Character Source => _sourceCharacter; + public override bool Durative => _durative; + public override double Duration => _duration; + public override int DurationTurn => _durationTurn; + public override bool ExemptDuration => true; + + private readonly Character _targetCharacter; + private readonly Character _sourceCharacter; + private readonly bool _durative; + private readonly double _duration; + private readonly int _durationTurn; + private readonly double _damageReductionPercent; + private readonly double _DEFReductionPercent; + private readonly double _MDFReductionPercent; + private readonly double _healingReductionPercent; + + public 虚弱(Skill skill, Character targetCharacter, Character sourceCharacter, bool durative = false, double duration = 0, int durationTurn = 1, + double damageReductionPercent = 0, double DEFReductionPercent = 0, double MDFReductionPercent = 0, double healingReductionPercent = 0) : base(skill) + { + GamingQueue = skill.GamingQueue; + _targetCharacter = targetCharacter; + _sourceCharacter = sourceCharacter; + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + _damageReductionPercent = damageReductionPercent; + _DEFReductionPercent = DEFReductionPercent; + _MDFReductionPercent = MDFReductionPercent; + _healingReductionPercent = healingReductionPercent; + } + + public override AlterActualDamageResult AlterActualDamageAfterCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character) return default; + double damage = ctx.Damage; + if (character == _targetCharacter) + { + return new AlterActualDamageResult { DamageDelta = -(damage * _damageReductionPercent) }; + + } + return default; + + } + + public override AlterHealValueResult AlterHealValueBeforeHealToTarget(HealContext ctx) + { + if (ctx.Target is not Character target) return default; + double heal = ctx.Heal; + if (target == _targetCharacter) + { + return new AlterHealValueResult { HealDelta = -(heal * _healingReductionPercent) }; + } + return default; + } + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (_durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + character.ExDEFPercentage -= _DEFReductionPercent; + character.MDF[character.MagicType] -= _MDFReductionPercent; + AddEffectTypeToCharacter(character, [EffectType.Weaken, EffectType.GrievousWound]); + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + character.ExDEFPercentage += _DEFReductionPercent; + character.MDF[character.MagicType] += _MDFReductionPercent; + RemoveEffectTypesFromCharacter(character); + } + } +} diff --git a/OshimaBot.Content/Effects/PassiveEffects/迟滞.cs b/OshimaBot.Content/Effects/PassiveEffects/迟滞.cs new file mode 100644 index 0000000..1721f29 --- /dev/null +++ b/OshimaBot.Content/Effects/PassiveEffects/迟滞.cs @@ -0,0 +1,74 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.EffectResult; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Effects.PassiveEffects +{ + public class 迟滞 : Effect + { + public override long Id => (long)PassiveEffectID.迟滞; + public override string Name { get; set; } = "迟滞"; + public override string Description => $"此角色处于迟滞状态,普通攻击和技能的硬直时间、当前行动等待时间延长 {_hardnessReductionPercent * 100:0.##}%。来自:[ {Source} ] 的 [ {Skill.Name} ]"; + public override EffectType EffectType => EffectType.Slow; + public override DispelledType DispelledType => DispelledType.Weak; + public override bool IsDebuff => true; + public override Character Source => _sourceCharacter; + public override bool Durative => _durative; + public override double Duration => _duration; + public override int DurationTurn => _durationTurn; + public override bool ExemptDuration => true; + + private readonly Character _sourceCharacter; + private readonly bool _durative; + private readonly double _duration; + private readonly int _durationTurn; + private readonly double _hardnessReductionPercent; + + public 迟滞(Skill skill, Character sourceCharacter, bool durative = false, double duration = 0, int durationTurn = 1, double healingReductionPercent = 0) : base(skill) + { + GamingQueue = skill.GamingQueue; + _sourceCharacter = sourceCharacter; + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + _hardnessReductionPercent = healingReductionPercent; + } + + public override AlterHardnessTimeResult AlterHardnessTimeAfterCastSkill(HardnessContext ctx) + { + return new AlterHardnessTimeResult { Factor = _hardnessReductionPercent }; + } + + public override AlterHardnessTimeResult AlterHardnessTimeAfterNormalAttack(HardnessContext ctx) + { + return new AlterHardnessTimeResult { Factor = _hardnessReductionPercent }; + } + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (_durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + AddEffectTypeToCharacter(character, [EffectType.Slow]); + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + RemoveEffectTypesFromCharacter(character); + } + + public void ApplyChange(Character character) + { + GamingQueue?.ChangeCharacterHardnessTime(character, _hardnessReductionPercent, true, false); + } + } +} diff --git a/OshimaBot.Content/Effects/PassiveEffects/长期监视.cs b/OshimaBot.Content/Effects/PassiveEffects/长期监视.cs new file mode 100644 index 0000000..507a7de --- /dev/null +++ b/OshimaBot.Content/Effects/PassiveEffects/长期监视.cs @@ -0,0 +1,111 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.EffectResult; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Effects.PassiveEffects +{ + public class 长期监视 : Effect + { + public override long Id => (long)PassiveEffectID.长期监视; + public override string Name => "长期监视"; + public override string Description => $"此角色正在被长期监视。来自:[ {Source} ]"; + public override EffectType EffectType => EffectType.Mark; + public override bool IsDebuff => true; + public override bool DurativeWithoutDuration => true; + public override Character Source => _sourceCharacter; + public override DispelledType DispelledType => DispelledType.CannotBeDispelled; + + private readonly Character _sourceCharacter; + private readonly Character _targetCharacter; + + public 长期监视(Skill skill, Character sourceCharacter, Character targetCharacter) : base(skill) + { + GamingQueue = skill.GamingQueue; + _sourceCharacter = sourceCharacter; + _targetCharacter = targetCharacter; + } + + public CharacterActionType LastType { get; set; } = CharacterActionType.None; + public Skill? LastSkill { get; set; } = null; + + public override void OnCharacterActionStart(ActionContext ctx) + { + CharacterActionType type = ctx.ActionType; + if (type == CharacterActionType.NormalAttack) + { + LastType = type; + } + } + + public override BeforeSkillCastedOnStatusResult BeforeSkillCastedOnStatus(SkillCastContext ctx) + { + LastType = CharacterActionType.CastSkill; + LastSkill = ctx.Skill; + return default; + } + + public override void AfterDeathCalculation(DeathContext ctx) + { + if (ctx.Trigger is not Character death) return; + bool hasMaster = ctx.HasMaster; + Character? killer = ctx.Killer; + if (GamingQueue != null && !hasMaster && killer != null && killer == _targetCharacter && Source != null && death != Source && GamingQueue.Queue.Contains(Source)) + { + WriteLine($"[ {Source} ] 正在观察 [ {killer} ] 的情绪。"); + if (LastType == CharacterActionType.NormalAttack) + { + Source.NormalAttack.SetMagicType(new(Skill.Effects.First(), true, MagicType, 999), GamingQueue); + Effect e = new IgnoreEvade(Skill, new() + { + { "p", 1 } + }, Source) + { + Name = Name, + Durative = false, + DurationTurn = 3, + RemainDurationTurn = 3 + }; + e.OnEffectGained(new HookContext(GamingQueue, Source)); + Source.Effects.Add(e); + WriteLine($"[ {Source} ] 获得了无视闪避效果,持续 3 回合!"); + } + else if (LastType == CharacterActionType.CastSkill && LastSkill != null) + { + 复制技能 e = new(Skill, Source, LastSkill) + { + Durative = false, + DurationTurn = 3, + RemainDurationTurn = 3 + }; + e.CopiedSkill.Values[nameof(时雨标记)] = 1; + e.CopiedSkill.CurrentCD = 0; + e.CopiedSkill.FreeCostEP = true; + e.CopiedSkill.FreeCostMP = true; + e.CopiedSkill.Enable = true; + e.CopiedSkill.IsInEffect = false; + e.OnEffectGained(new HookContext(GamingQueue, Source)); + Source.Effects.Add(e); + WriteLine($"[ {Source} ] 复制了 [ {killer} ] 的技能:{LastSkill.Name}!!"); + } + if (killer.Effects.FirstOrDefault(e => e is 时雨标记 && e.Source == Source) is 时雨标记 e2) + { + e2.RemainDurationTurn = 3; + } + else + { + e2 = new 时雨标记(Skill, Source) + { + Durative = false, + DurationTurn = 3, + RemainDurationTurn = 3 + }; + e2.OnEffectGained(new HookContext(GamingQueue, killer)); + killer.Effects.Add(e2); + WriteLine($"[ {Source} ] 给予了 [ {killer} ] 时雨标记!"); + } + } + } + } +} diff --git a/OshimaBot.Content/Effects/PassiveEffects/魔法免疫.cs b/OshimaBot.Content/Effects/PassiveEffects/魔法免疫.cs new file mode 100644 index 0000000..c2e29c4 --- /dev/null +++ b/OshimaBot.Content/Effects/PassiveEffects/魔法免疫.cs @@ -0,0 +1,67 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.EffectResult; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Effects.PassiveEffects +{ + public class 魔法免疫 : Effect + { + public override long Id => (long)PassiveEffectID.魔法免疫; + public override string Name => "魔法免疫"; + public override string Description => $"此角色处于魔法免疫状态,无法选中其作为魔法技能的目标(自释放魔法技能除外),并且免疫魔法伤害。来自:[ {Source} ] 的 [ {Skill.Name} ]"; + public override EffectType EffectType => EffectType.MagicalImmune; + public override DispelledType DispelledType => DispelledType.Weak; + public override bool IsDebuff => false; + 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) + { + GamingQueue = skill.GamingQueue; + _sourceCharacter = sourceCharacter; + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + } + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (_durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + AddImmuneTypesToCharacter(character, [ImmuneType.Magical]); + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + RemoveImmuneTypesFromCharacter(character); + } + + public override OnImmuneCheckResult OnImmuneCheck(ImmuneContext ctx) + { + if (ctx.Trigger is not Character character) return default; + Character? target = ctx.Target; + if (character == target) + { + return new OnImmuneCheckResult { IgnoreImmunity = true }; + } + return default; + } + } +} diff --git a/OshimaBot.Content/Effects/PassiveEffects/魔法护盾.cs b/OshimaBot.Content/Effects/PassiveEffects/魔法护盾.cs new file mode 100644 index 0000000..aac41ec --- /dev/null +++ b/OshimaBot.Content/Effects/PassiveEffects/魔法护盾.cs @@ -0,0 +1,84 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.EffectResult; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Effects.PassiveEffects +{ + public class 魔法护盾 : Effect + { + public override long Id => (long)PassiveEffectID.魔法护盾; + public override string Name => "魔法护盾"; + public override string Description => $"此角色拥有魔法护盾{CurrentShield}。来自:[ {Source} ] 的 [ {Skill.Name} ]"; + public override EffectType EffectType => EffectType.Shield; + public override DispelledType DispelledType => DispelledType.CannotBeDispelled; + public override bool DurativeWithoutDuration => true; + public override bool IsDebuff => false; + public override Character Source => _sourceCharacter; + public override bool Durative => _durative; + public override double Duration => _duration; + public override int DurationTurn => _durationTurn; + + private string CurrentShield + { + get + { + if (_targetCharacter != null && _targetCharacter.Shield.ShieldOfEffects.TryGetValue(this, out ShieldOfEffect? value) && value != null) + { + return $",护盾值:{value.Shield:0.##} 点"; + } + else return ""; + } + } + private readonly Character _targetCharacter; + private readonly Character _sourceCharacter; + private readonly double _shield; + private readonly bool _durative; + private readonly double _duration; + private readonly int _durationTurn; + + public 魔法护盾(Skill skill, Character targetCharacter, Character sourceCharacter, double shield, bool durative = false, double duration = 0, int durationTurn = 0) : base(skill) + { + GamingQueue = skill.GamingQueue; + _targetCharacter = targetCharacter; + _sourceCharacter = sourceCharacter; + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + _shield = shield; + } + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (_durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + character.Shield.AddShieldOfEffect(new(this, _shield, ShieldType.Magical, MagicType.None)); + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + character.Shield.RemoveShieldOfEffect(this); + } + + public override OnShieldBrokenResult OnShieldBroken(ShieldContext ctx) + { + if (ctx.Trigger is not Character character) return default; + Effect? effet = ctx.ShieldEffect; + if (effet == this) + { + character.Shield.RemoveShieldOfEffect(this); + character.Effects.Remove(this); + } + return default; + } + } +} diff --git a/OshimaBot.Content/Effects/SkillEffects/吸取生命值.cs b/OshimaBot.Content/Effects/SkillEffects/吸取生命值.cs new file mode 100644 index 0000000..d64b1e7 --- /dev/null +++ b/OshimaBot.Content/Effects/SkillEffects/吸取生命值.cs @@ -0,0 +1,57 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.SkillEffects +{ + public class 吸取生命值 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"吸取{Skill.TargetDescription()}的{(是否是百分比 ? $" {Calculation.PercentageCheck(Earned) * 100:0.##}% 当前" : $"至多 {Earned:0.##} 点")}生命值(每个角色)," + + $"并将吸取总量的 {转化百分比 * 100:0.##}% 转化为自身生命值。"; + + private double Earned => Skill.Level > 0 ? 基础数值 + 等级成长 * (Skill.Level - 1) : 基础数值; + private double 基础数值 { get; set; } = 200; + private double 等级成长 { get; set; } = 100; + private bool 是否是百分比 { get; set; } = false; + private double 转化百分比 { get; set; } = 1; + + public 吸取生命值(Skill skill, double 基础数值, double 等级成长, bool 是否是百分比 = false, double 转化百分比 = 1) : base(skill) + { + GamingQueue = skill.GamingQueue; + this.基础数值 = 基础数值; + this.等级成长 = 等级成长; + this.是否是百分比 = 是否是百分比; + this.转化百分比 = Calculation.PercentageCheck(转化百分比); + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + double total = 0; + foreach (Character target in targets) + { + double earned = Earned; + if (是否是百分比) + { + earned = target.HP * earned; + } + else if (earned > target.HP) + { + earned = target.HP; + } + if (earned > 0) + { + target.HP -= earned; + total += earned; + GamingQueue?.CalculateCharacterDamageStatistics(caster, target, earned, FunGame.Core.Library.Constant.DamageType.True); + } + } + total *= 转化百分比; + caster.HP += total; + WriteLine($"[ {caster} ] 吸取了 [ {string.Join(" ] / [ ", targets)} ] 的 {total:0.##} 点生命值!"); + } + } +} diff --git a/OshimaBot.Content/Effects/SkillEffects/吸取能量值.cs b/OshimaBot.Content/Effects/SkillEffects/吸取能量值.cs new file mode 100644 index 0000000..98dc3c7 --- /dev/null +++ b/OshimaBot.Content/Effects/SkillEffects/吸取能量值.cs @@ -0,0 +1,56 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.SkillEffects +{ + public class 吸取能量值 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"吸取{Skill.TargetDescription()}的{(是否是百分比 ? $" {Calculation.PercentageCheck(Earned) * 100:0.##}% 当前" : $"至多 {Earned:0.##} 点")}能量值(每个角色)," + + $"并将吸取总量的 {转化百分比 * 100:0.##}% 转化为自身能量值。"; + + private double Earned => Skill.Level > 0 ? 基础数值 + 等级成长 * (Skill.Level - 1) : 基础数值; + private double 基础数值 { get; set; } = 5; + private double 等级成长 { get; set; } = 1; + private bool 是否是百分比 { get; set; } = false; + private double 转化百分比 { get; set; } = 1; + + public 吸取能量值(Skill skill, double 基础数值, double 等级成长, bool 是否是百分比 = false, double 转化百分比 = 1) : base(skill) + { + GamingQueue = skill.GamingQueue; + this.基础数值 = 基础数值; + this.等级成长 = 等级成长; + this.是否是百分比 = 是否是百分比; + this.转化百分比 = Calculation.PercentageCheck(转化百分比); + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + double total = 0; + foreach (Character target in targets) + { + double earned = Earned; + if (是否是百分比) + { + earned = target.EP * earned; + } + else if (earned > target.EP) + { + earned = target.EP; + } + if (earned > 0) + { + target.EP -= earned; + total += earned; + } + } + total *= 转化百分比; + caster.EP += total; + WriteLine($"[ {caster} ] 吸取了 [ {string.Join(" ] / [ ", targets)} ] 的 {total:0.##} 点能量值!"); + } + } +} diff --git a/OshimaBot.Content/Effects/SkillEffects/吸取魔法值.cs b/OshimaBot.Content/Effects/SkillEffects/吸取魔法值.cs new file mode 100644 index 0000000..9e75475 --- /dev/null +++ b/OshimaBot.Content/Effects/SkillEffects/吸取魔法值.cs @@ -0,0 +1,56 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.SkillEffects +{ + public class 吸取魔法值 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"吸取{Skill.TargetDescription()}的{(是否是百分比 ? $" {Calculation.PercentageCheck(Earned) * 100:0.##}% 当前" : $"至多 {Earned:0.##} 点")}魔法值(每个角色)," + + $"并将吸取总量的 {转化百分比 * 100:0.##}% 转化为自身魔法值。"; + + private double Earned => Skill.Level > 0 ? 基础数值 + 等级成长 * (Skill.Level - 1) : 基础数值; + private double 基础数值 { get; set; } = 150; + private double 等级成长 { get; set; } = 75; + private bool 是否是百分比 { get; set; } = false; + private double 转化百分比 { get; set; } = 1; + + public 吸取魔法值(Skill skill, double 基础数值, double 等级成长, bool 是否是百分比 = false, double 转化百分比 = 1) : base(skill) + { + GamingQueue = skill.GamingQueue; + this.基础数值 = 基础数值; + this.等级成长 = 等级成长; + this.是否是百分比 = 是否是百分比; + this.转化百分比 = Calculation.PercentageCheck(转化百分比); + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + double total = 0; + foreach (Character target in targets) + { + double earned = Earned; + if (是否是百分比) + { + earned = target.MP * earned; + } + else if (earned > target.MP) + { + earned = target.MP; + } + if (earned > 0) + { + target.MP -= earned; + total += earned; + } + } + total *= 转化百分比; + caster.MP += total; + WriteLine($"[ {caster} ] 吸取了 [ {string.Join(" ] / [ ", targets)} ] 的 {total:0.##} 点魔法值!"); + } + } +} diff --git a/OshimaBot.Content/Effects/SkillEffects/基于属性的伤害.cs b/OshimaBot.Content/Effects/SkillEffects/基于属性的伤害.cs new file mode 100644 index 0000000..29a7545 --- /dev/null +++ b/OshimaBot.Content/Effects/SkillEffects/基于属性的伤害.cs @@ -0,0 +1,62 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.SkillEffects +{ + public class 基于属性的伤害 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"对{Skill.TargetDescription()}造成 {BaseDamage:0.##} + {AttributeCoefficient * 100:0.##}% {CharacterSet.GetPrimaryAttributeName(基于属性)} [ {Damage:0.##} ] 点{CharacterSet.GetDamageTypeName(DamageType, MagicType)}。"; + private double BaseDamage => Skill.Level > 0 ? 基础数值伤害 + 基础伤害等级成长 * (Skill.Level - 1) : 基础数值伤害; + private double AttributeCoefficient => Skill.Level > 0 ? 基础属性系数 + 基础系数等级成长 * (Skill.Level - 1) : 基础属性系数; + private double Damage + { + get + { + if (Skill.Character != null) + { + double paValue = 基于属性 switch + { + PrimaryAttribute.STR => Skill.Character.STR, + PrimaryAttribute.AGI => Skill.Character.AGI, + _ => Skill.Character.INT, + }; + return BaseDamage + AttributeCoefficient * paValue; + } + return BaseDamage; + } + } + + private PrimaryAttribute 基于属性 { get; set; } = PrimaryAttribute.INT; + private double 基础数值伤害 { get; set; } = 100; + private double 基础伤害等级成长 { get; set; } = 50; + private double 基础属性系数 { get; set; } = 0.4; + private double 基础系数等级成长 { get; set; } = 0.4; + private DamageType DamageType { get; set; } = DamageType.Magical; + + public 基于属性的伤害(Skill skill, PrimaryAttribute 基于属性, double 基础数值伤害, double 基础伤害等级成长, double 基础属性系数, double 基础系数等级成长, DamageType damageType = DamageType.Magical, MagicType magicType = MagicType.None) : base(skill) + { + GamingQueue = skill.GamingQueue; + this.基于属性 = 基于属性; + this.基础数值伤害 = 基础数值伤害; + this.基础伤害等级成长 = 基础伤害等级成长; + this.基础属性系数 = 基础属性系数; + this.基础系数等级成长 = 基础系数等级成长; + DamageType = damageType; + MagicType = magicType; + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + foreach (Character enemy in targets) + { + DamageToEnemy(caster, enemy, DamageType, MagicType, Damage); + } + } + } +} diff --git a/OshimaBot.Content/Effects/SkillEffects/基于攻击力的伤害_带基础伤害.cs b/OshimaBot.Content/Effects/SkillEffects/基于攻击力的伤害_带基础伤害.cs new file mode 100644 index 0000000..4796dbb --- /dev/null +++ b/OshimaBot.Content/Effects/SkillEffects/基于攻击力的伤害_带基础伤害.cs @@ -0,0 +1,44 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.SkillEffects +{ + public class 基于攻击力的伤害_带基础伤害 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"对{Skill.TargetDescription()}造成 {BaseDamage:0.##} + {ATKCoefficient * 100:0.##}% 攻击力 [ {Damage:0.##} ] 点{CharacterSet.GetDamageTypeName(DamageType, MagicType)}。"; + + private double BaseDamage => Skill.Level > 0 ? 基础数值伤害 + 基础伤害等级成长 * (Skill.Level - 1) : 基础数值伤害; + private double ATKCoefficient => Skill.Level > 0 ? 基础攻击力系数 + 基础系数等级成长 * (Skill.Level - 1) : 基础攻击力系数; + private double Damage => BaseDamage + (ATKCoefficient * Skill.Character?.ATK ?? 0); + private double 基础数值伤害 { get; set; } = 100; + private double 基础伤害等级成长 { get; set; } = 50; + private double 基础攻击力系数 { get; set; } = 0.2; + private double 基础系数等级成长 { get; set; } = 0.2; + private DamageType DamageType { get; set; } = DamageType.Magical; + + public 基于攻击力的伤害_带基础伤害(Skill skill, double 基础数值伤害, double 基础伤害等级成长, double 基础攻击力系数, double 基础系数等级成长, DamageType damageType = DamageType.Magical, MagicType magicType = MagicType.None) : base(skill) + { + GamingQueue = skill.GamingQueue; + this.基础数值伤害 = 基础数值伤害; + this.基础伤害等级成长 = 基础伤害等级成长; + this.基础攻击力系数 = 基础攻击力系数; + this.基础系数等级成长 = 基础系数等级成长; + DamageType = damageType; + MagicType = magicType; + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + foreach (Character enemy in targets) + { + DamageToEnemy(caster, enemy, DamageType, MagicType, Damage); + } + } + } +} diff --git a/OshimaBot.Content/Effects/SkillEffects/基于攻击力的伤害_无基础伤害.cs b/OshimaBot.Content/Effects/SkillEffects/基于攻击力的伤害_无基础伤害.cs new file mode 100644 index 0000000..d2b55e5 --- /dev/null +++ b/OshimaBot.Content/Effects/SkillEffects/基于攻击力的伤害_无基础伤害.cs @@ -0,0 +1,39 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.SkillEffects +{ + public class 基于攻击力的伤害_无基础伤害 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"对{Skill.TargetDescription()}造成 {ATKCoefficient * 100:0.##}% 攻击力 [ {Damage:0.##} ] 点{CharacterSet.GetDamageTypeName(DamageType, MagicType)}。"; + + private double ATKCoefficient => Skill.Level > 0 ? 基础攻击力系数 + 基础系数等级成长 * (Skill.Level - 1) : 基础攻击力系数; + private double Damage => ATKCoefficient * Skill.Character?.ATK ?? 0; + private double 基础攻击力系数 { get; set; } = 1.5; + private double 基础系数等级成长 { get; set; } = 0.25; + private DamageType DamageType { get; set; } = DamageType.Magical; + + public 基于攻击力的伤害_无基础伤害(Skill skill, double 基础攻击力系数, double 基础系数等级成长, DamageType damageType = DamageType.Magical, MagicType magicType = MagicType.None) : base(skill) + { + GamingQueue = skill.GamingQueue; + this.基础攻击力系数 = 基础攻击力系数; + this.基础系数等级成长 = 基础系数等级成长; + DamageType = damageType; + MagicType = magicType; + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + foreach (Character enemy in targets) + { + DamageToEnemy(caster, enemy, DamageType, MagicType, Damage); + } + } + } +} diff --git a/OshimaBot.Content/Effects/SkillEffects/基于核心属性的伤害.cs b/OshimaBot.Content/Effects/SkillEffects/基于核心属性的伤害.cs new file mode 100644 index 0000000..27fff54 --- /dev/null +++ b/OshimaBot.Content/Effects/SkillEffects/基于核心属性的伤害.cs @@ -0,0 +1,44 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.SkillEffects +{ + public class 基于核心属性的伤害 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"对{Skill.TargetDescription()}造成 {BaseDamage:0.##} + {AttributeCoefficient * 100:0.##}% {CharacterSet.GetPrimaryAttributeName(Skill.Character?.PrimaryAttribute ?? PrimaryAttribute.INT)} [ {Damage:0.##} ] 点{CharacterSet.GetDamageTypeName(DamageType, MagicType)}。"; + + private double BaseDamage => Skill.Level > 0 ? 基础数值伤害 + 基础伤害等级成长 * (Skill.Level - 1) : 基础数值伤害; + private double AttributeCoefficient => Skill.Level > 0 ? 基础属性系数 + 基础系数等级成长 * (Skill.Level - 1) : 基础属性系数; + private double Damage => BaseDamage + (AttributeCoefficient * Skill.Character?.PrimaryAttributeValue ?? 0); + private double 基础数值伤害 { get; set; } = 100; + private double 基础伤害等级成长 { get; set; } = 50; + private double 基础属性系数 { get; set; } = 0.4; + private double 基础系数等级成长 { get; set; } = 0.4; + private DamageType DamageType { get; set; } = DamageType.Magical; + + public 基于核心属性的伤害(Skill skill, double 基础数值伤害, double 基础伤害等级成长, double 基础属性系数, double 基础系数等级成长, DamageType damageType = DamageType.Magical, MagicType magicType = MagicType.None) : base(skill) + { + GamingQueue = skill.GamingQueue; + this.基础数值伤害 = 基础数值伤害; + this.基础伤害等级成长 = 基础伤害等级成长; + this.基础属性系数 = 基础属性系数; + this.基础系数等级成长 = 基础系数等级成长; + DamageType = damageType; + MagicType = magicType; + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + foreach (Character enemy in targets) + { + DamageToEnemy(caster, enemy, DamageType, MagicType, Damage); + } + } + } +} diff --git a/OshimaBot.Content/Effects/SkillEffects/增加混合护盾值.cs b/OshimaBot.Content/Effects/SkillEffects/增加混合护盾值.cs new file mode 100644 index 0000000..0dafdf6 --- /dev/null +++ b/OshimaBot.Content/Effects/SkillEffects/增加混合护盾值.cs @@ -0,0 +1,36 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.SkillEffects +{ + public class 增加混合护盾值 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"为{Skill.TargetDescription()}提供 {护盾值:0.##} 点混合护盾值。"; + + private double 护盾值 => Level > 0 ? Math.Abs(基础数值护盾 + 基础护盾等级成长 * (Level - 1)) : Math.Abs(基础数值护盾); + private double 基础数值护盾 { get; set; } = 200; + private double 基础护盾等级成长 { get; set; } = 100; + + public 增加混合护盾值(Skill skill, double 基础数值护盾, double 基础护盾等级成长) : base(skill) + { + GamingQueue = skill.GamingQueue; + this.基础数值护盾 = 基础数值护盾; + this.基础护盾等级成长 = 基础护盾等级成长; + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + List targets = ctx.Targets; + foreach (Character target in targets) + { + target.Shield.Mix += 护盾值; + WriteLine($"[ {target} ] 获得了 {护盾值:0.##} 点混合护盾值!"); + GamingQueue?.AddApplyEffects(target, EffectType.Shield); + } + } + } +} diff --git a/OshimaBot.Content/Effects/SkillEffects/增加物理护盾_护盾值型.cs b/OshimaBot.Content/Effects/SkillEffects/增加物理护盾_护盾值型.cs new file mode 100644 index 0000000..f32f4a4 --- /dev/null +++ b/OshimaBot.Content/Effects/SkillEffects/增加物理护盾_护盾值型.cs @@ -0,0 +1,36 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.SkillEffects +{ + public class 增加物理护盾_护盾值型 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"为{Skill.TargetDescription()}提供 {护盾值:0.##} 点物理护盾值。"; + + private double 护盾值 => Level > 0 ? Math.Abs(基础数值护盾 + 基础护盾等级成长 * (Level - 1)) : Math.Abs(基础数值护盾); + private double 基础数值护盾 { get; set; } = 200; + private double 基础护盾等级成长 { get; set; } = 100; + + public 增加物理护盾_护盾值型(Skill skill, double 基础数值护盾, double 基础护盾等级成长) : base(skill) + { + GamingQueue = skill.GamingQueue; + this.基础数值护盾 = 基础数值护盾; + this.基础护盾等级成长 = 基础护盾等级成长; + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + List targets = ctx.Targets; + foreach (Character target in targets) + { + target.Shield[false] += 护盾值; + WriteLine($"[ {target} ] 获得了 {护盾值:0.##} 点物理护盾值!"); + GamingQueue?.AddApplyEffects(target, EffectType.Shield); + } + } + } +} diff --git a/OshimaBot.Content/Effects/SkillEffects/增加物理护盾_特效持续型.cs b/OshimaBot.Content/Effects/SkillEffects/增加物理护盾_特效持续型.cs new file mode 100644 index 0000000..b351d60 --- /dev/null +++ b/OshimaBot.Content/Effects/SkillEffects/增加物理护盾_特效持续型.cs @@ -0,0 +1,51 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.PassiveEffects; + +namespace OshimaBot.Content.Effects.SkillEffects +{ + public class 增加物理护盾_特效持续型 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"为{Skill.TargetDescription()}提供 {护盾值:0.##} 点物理护盾,持续 {持续时间}。"; + + private string 持续时间 => _durative && _duration > 0 ? _duration + $" {GameplayEquilibriumConstant.InGameTime}" : (!_durative && _durationTurn > 0 ? _durationTurn + " 回合" : $"0 {GameplayEquilibriumConstant.InGameTime}"); + private double 护盾值 => Level > 0 ? Math.Abs(基础数值护盾 + 基础护盾等级成长 * (Level - 1)) : Math.Abs(基础数值护盾); + private double 基础数值护盾 { get; set; } = 200; + private double 基础护盾等级成长 { get; set; } = 100; + private readonly bool _durative; + private readonly double _duration; + private readonly int _durationTurn; + + public 增加物理护盾_特效持续型(Skill skill, double 基础数值护盾, double 基础护盾等级成长, bool durative = false, double duration = 0, int durationTurn = 0) : base(skill) + { + GamingQueue = skill.GamingQueue; + this.基础数值护盾 = 基础数值护盾; + this.基础护盾等级成长 = 基础护盾等级成长; + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + foreach (Character target in targets) + { + WriteLine($"[ {target} ] 获得了 {护盾值:0.##} 点物理护盾!"); + 物理护盾 e = new(Skill, target, caster, 护盾值, _durative, _duration, _durationTurn) + { + ParentEffect = ParentEffect + }; + target.Effects.Add(e); + e.OnEffectGained(new HookContext(GamingQueue, target)); + e.DispelledType = DispelledType; + GamingQueue?.AddApplyEffects(target, EffectType.Shield); + } + } + } +} diff --git a/OshimaBot.Content/Effects/SkillEffects/增加魔法护盾_护盾值型.cs b/OshimaBot.Content/Effects/SkillEffects/增加魔法护盾_护盾值型.cs new file mode 100644 index 0000000..188f342 --- /dev/null +++ b/OshimaBot.Content/Effects/SkillEffects/增加魔法护盾_护盾值型.cs @@ -0,0 +1,36 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.SkillEffects +{ + public class 增加魔法护盾_护盾值型 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"为{Skill.TargetDescription()}提供 {护盾值:0.##} 点魔法护盾值。"; + + private double 护盾值 => Level > 0 ? Math.Abs(基础数值护盾 + 基础护盾等级成长 * (Level - 1)) : Math.Abs(基础数值护盾); + private double 基础数值护盾 { get; set; } = 200; + private double 基础护盾等级成长 { get; set; } = 100; + + public 增加魔法护盾_护盾值型(Skill skill, double 基础数值护盾, double 基础护盾等级成长) : base(skill) + { + GamingQueue = skill.GamingQueue; + this.基础数值护盾 = 基础数值护盾; + this.基础护盾等级成长 = 基础护盾等级成长; + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + List targets = ctx.Targets; + foreach (Character target in targets) + { + target.Shield[true, MagicType.None] += 护盾值; + WriteLine($"[ {target} ] 获得了 {护盾值:0.##} 点魔法护盾值!"); + GamingQueue?.AddApplyEffects(target, EffectType.Shield); + } + } + } +} diff --git a/OshimaBot.Content/Effects/SkillEffects/增加魔法护盾_特效持续型.cs b/OshimaBot.Content/Effects/SkillEffects/增加魔法护盾_特效持续型.cs new file mode 100644 index 0000000..efb0cf7 --- /dev/null +++ b/OshimaBot.Content/Effects/SkillEffects/增加魔法护盾_特效持续型.cs @@ -0,0 +1,51 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.PassiveEffects; + +namespace OshimaBot.Content.Effects.SkillEffects +{ + public class 增加魔法护盾_特效持续型 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"为{Skill.TargetDescription()}提供 {护盾值:0.##} 点魔法护盾,持续 {持续时间}。"; + + private string 持续时间 => _durative && _duration > 0 ? _duration + $" {GameplayEquilibriumConstant.InGameTime}" : (!_durative && _durationTurn > 0 ? _durationTurn + " 回合" : $"0 {GameplayEquilibriumConstant.InGameTime}"); + private double 护盾值 => Level > 0 ? Math.Abs(基础数值护盾 + 基础护盾等级成长 * (Level - 1)) : Math.Abs(基础数值护盾); + private double 基础数值护盾 { get; set; } = 200; + private double 基础护盾等级成长 { get; set; } = 100; + private readonly bool _durative; + private readonly double _duration; + private readonly int _durationTurn; + + public 增加魔法护盾_特效持续型(Skill skill, double 基础数值护盾, double 基础护盾等级成长, bool durative = false, double duration = 0, int durationTurn = 0) : base(skill) + { + GamingQueue = skill.GamingQueue; + this.基础数值护盾 = 基础数值护盾; + this.基础护盾等级成长 = 基础护盾等级成长; + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + foreach (Character target in targets) + { + WriteLine($"[ {target} ] 获得了 {护盾值:0.##} 点魔法护盾!"); + 魔法护盾 e = new(Skill, target, caster, 护盾值, _durative, _duration, _durationTurn) + { + ParentEffect = ParentEffect + }; + target.Effects.Add(e); + e.OnEffectGained(new HookContext(GamingQueue, target)); + e.DispelledType = DispelledType; + GamingQueue?.AddApplyEffects(target, EffectType.Shield); + } + } + } +} diff --git a/OshimaBot.Content/Effects/SkillEffects/弱驱散特效.cs b/OshimaBot.Content/Effects/SkillEffects/弱驱散特效.cs new file mode 100644 index 0000000..81b521f --- /dev/null +++ b/OshimaBot.Content/Effects/SkillEffects/弱驱散特效.cs @@ -0,0 +1,37 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.SkillEffects +{ + public class 弱驱散特效 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"弱驱散{Skill.TargetDescription()}。"; + public override DispelType DispelType => DispelType.Weak; + + public 弱驱散特效(Skill skill) : base(skill) + { + GamingQueue = skill.GamingQueue; + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + Dictionary isTeammateDictionary = GamingQueue?.GetIsTeammateDictionary(caster, targets) ?? []; + foreach (Character target in targets) + { + WriteLine($"[ {caster} ] 弱驱散了 [ {target} ] !"); + bool isEnemy = true; + if (isTeammateDictionary.TryGetValue(target, out bool value)) + { + isEnemy = !value; + } + Dispel(caster, target, isEnemy); + } + } + } +} diff --git a/OshimaBot.Content/Effects/SkillEffects/强驱散特效.cs b/OshimaBot.Content/Effects/SkillEffects/强驱散特效.cs new file mode 100644 index 0000000..c0229ad --- /dev/null +++ b/OshimaBot.Content/Effects/SkillEffects/强驱散特效.cs @@ -0,0 +1,37 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.SkillEffects +{ + public class 强驱散特效 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"强驱散{Skill.TargetDescription()}。"; + public override DispelType DispelType => DispelType.Strong; + + public 强驱散特效(Skill skill) : base(skill) + { + GamingQueue = skill.GamingQueue; + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + Dictionary isTeammateDictionary = GamingQueue?.GetIsTeammateDictionary(caster, targets) ?? []; + foreach (Character target in targets) + { + WriteLine($"[ {caster} ] 强驱散了 [ {target} ] !"); + bool isEnemy = true; + if (isTeammateDictionary.TryGetValue(target, out bool value)) + { + isEnemy = !value; + } + Dispel(caster, target, isEnemy); + } + } + } +} diff --git a/OshimaBot.Content/Effects/SkillEffects/打断施法.cs b/OshimaBot.Content/Effects/SkillEffects/打断施法.cs new file mode 100644 index 0000000..e4a8711 --- /dev/null +++ b/OshimaBot.Content/Effects/SkillEffects/打断施法.cs @@ -0,0 +1,33 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.SkillEffects +{ + public class 打断施法 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"对{Skill.TargetDescription()}施加打断施法效果:中断其正在进行的吟唱。"; + public override EffectType EffectType => EffectType.InterruptCasting; + + public 打断施法(Skill skill) : base(skill) + { + GamingQueue = skill.GamingQueue; + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + foreach (Character target in targets) + { + if (!CheckExemption(caster, target, this)) + { + InterruptCasting(target, caster); + } + } + } + } +} diff --git a/OshimaBot.Content/Effects/SkillEffects/提升友方行动速度.cs b/OshimaBot.Content/Effects/SkillEffects/提升友方行动速度.cs new file mode 100644 index 0000000..1eec2ca --- /dev/null +++ b/OshimaBot.Content/Effects/SkillEffects/提升友方行动速度.cs @@ -0,0 +1,58 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Effects.SkillEffects +{ + public class 提升友方行动速度 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"提升{Skill.TargetDescription()} {SPD:0.##} 点行动速度 {持续时间}。并缩短目标 30% 的行动等待时间(当前硬直时间)。"; + + private double SPD => Level > 0 ? Math.Abs(基础数值速度 + 基础速度等级成长 * (Level - 1)) : Math.Abs(基础数值速度); + private double 基础数值速度 { get; set; } = 65; + private double 基础速度等级成长 { get; set; } = 25; + private string 持续时间 => _durative && _duration > 0 ? _duration + $" {GameplayEquilibriumConstant.InGameTime}" : (!_durative && _durationTurn > 0 ? _durationTurn + " 回合" : $"0 {GameplayEquilibriumConstant.InGameTime}"); + private readonly bool _durative; + private readonly double _duration; + private readonly int _durationTurn; + + public 提升友方行动速度(Skill skill, double 基础数值速度, double 基础速度等级成长, bool durative = true, double duration = 40, int durationTurn = 0) : base(skill) + { + GamingQueue = skill.GamingQueue; + this.基础数值速度 = 基础数值速度; + this.基础速度等级成长 = 基础速度等级成长; + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + foreach (Character target in targets) + { + WriteLine($"[ {target} ] 的行动速度提升了 {SPD:0.##} 点,行动等待时间(当前硬直时间)被缩短了 30%!持续时间:{持续时间}!"); + ExSPD e = new(Skill, new Dictionary() + { + { "exspd", SPD } + }, caster) + { + Name = Name, + Durative = _durative, + Duration = _duration, + DurationTurn = _durationTurn + }; + target.Effects.Add(e); + e.OnEffectGained(new HookContext(GamingQueue, target)); + e.EffectType = EffectType.Haste; + GamingQueue?.AddApplyEffects(target, e.EffectType); + GamingQueue?.ChangeCharacterHardnessTime(target, -0.3, true, false); + } + } + } +} diff --git a/OshimaBot.Content/Effects/SkillEffects/施加免疫.cs b/OshimaBot.Content/Effects/SkillEffects/施加免疫.cs new file mode 100644 index 0000000..d15df99 --- /dev/null +++ b/OshimaBot.Content/Effects/SkillEffects/施加免疫.cs @@ -0,0 +1,92 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.PassiveEffects; + +namespace OshimaBot.Content.Effects.SkillEffects +{ + public class 施加免疫 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"对{Skill.TargetDescription()}施加{CharacterSet.GetImmuneTypeName(ImmuneType)},持续 {持续时间}。"; + public override DispelledType DispelledType => _dispelledType; + + private ImmuneType ImmuneType { get; set; } = ImmuneType.None; + private string 持续时间 => _durative && _duration > 0 ? 实际持续时间 + $" {GameplayEquilibriumConstant.InGameTime}" : (!_durative && _durationTurn > 0 ? 实际持续时间 + " 回合" : $"0 {GameplayEquilibriumConstant.InGameTime}"); + private double 实际持续时间 => _durative && _duration > 0 ? (_duration + _levelGrowth * (Level - 1) * MagicEfficacy) : (!_durative && _durationTurn > 0 ? ((int)Math.Round(_durationTurn + _levelGrowth * (Level - 1) * MagicEfficacy, 0, MidpointRounding.ToPositiveInfinity)) : 0); + private DispelledType _dispelledType = DispelledType.Weak; + private readonly bool _durative; + private readonly double _duration; + private readonly int _durationTurn; + private readonly double _levelGrowth; + + public 施加免疫(Skill skill, ImmuneType type, bool durative = false, double duration = 0, int durationTurn = 1, double levelGrowth = 0) : base(skill) + { + GamingQueue = skill.GamingQueue; + ImmuneType = type; + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + _levelGrowth = levelGrowth; + _dispelledType = type switch + { + ImmuneType.All => DispelledType.Strong, + ImmuneType.Special => DispelledType.Special, + _ => DispelledType.Weak + }; + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + foreach (Character target in targets) + { + if (target.HP <= 0) continue; + WriteLine($"[ {caster} ] 获得了{CharacterSet.GetImmuneTypeName(ImmuneType)}!持续 {持续时间}!"); + switch (ImmuneType) + { + case ImmuneType.Physical: + { + EffectType = EffectType.PhysicalImmune; + 物理免疫 e = new(Skill, caster, _durative, _duration + _levelGrowth * (Level - 1), Convert.ToInt32(_durationTurn + _levelGrowth * (Level - 1))); + _dispelledType = DispelledType.Weak; + target.Effects.Add(e); + e.OnEffectGained(new HookContext(GamingQueue, target)); + break; + } + case ImmuneType.Magical: + { + EffectType = EffectType.MagicalImmune; + 魔法免疫 e = new(Skill, caster, _durative, _duration + _levelGrowth * (Level - 1), Convert.ToInt32(_durationTurn + _levelGrowth * (Level - 1))); + _dispelledType = DispelledType.Weak; + target.Effects.Add(e); + e.OnEffectGained(new HookContext(GamingQueue, target)); + break; + } + case ImmuneType.Skilled: + { + EffectType = EffectType.SkilledImmune; + 技能免疫 e = new(Skill, caster, _durative, _duration + _levelGrowth * (Level - 1), Convert.ToInt32(_durationTurn + _levelGrowth * (Level - 1))); + _dispelledType = DispelledType.Weak; + target.Effects.Add(e); + e.OnEffectGained(new HookContext(GamingQueue, target)); + break; + } + case ImmuneType.All: + { + EffectType = EffectType.AllImmune; + 完全免疫 e = new(Skill, caster, _durative, _duration + _levelGrowth * (Level - 1), Convert.ToInt32(_durationTurn + _levelGrowth * (Level - 1))); + _dispelledType = DispelledType.Strong; + target.Effects.Add(e); + e.OnEffectGained(new HookContext(GamingQueue, target)); + break; + } + } + GamingQueue?.AddApplyEffects(target, EffectType); + } + } + } +} diff --git a/OshimaBot.Content/Effects/SkillEffects/施加持续性弱驱散.cs b/OshimaBot.Content/Effects/SkillEffects/施加持续性弱驱散.cs new file mode 100644 index 0000000..f36ff35 --- /dev/null +++ b/OshimaBot.Content/Effects/SkillEffects/施加持续性弱驱散.cs @@ -0,0 +1,76 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.PassiveEffects; + +namespace OshimaBot.Content.Effects.SkillEffects +{ + public class 施加持续性弱驱散 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"持续弱驱散{Skill.TargetDescription()}{(_durativeWithoutDuration ? _durationString : $",持续 {持续时间}")}。\r\n持续性驱散是持续性临时驱散,它会在持续时间结束之后恢复目标尚未结束的特效。"; + public override DispelType DispelType => DispelType.DurativeWeak; + + private string 持续时间 => _durative && _duration > 0 ? 实际持续时间 + $" {GameplayEquilibriumConstant.InGameTime}" : (!_durative && _durationTurn > 0 ? 实际持续时间 + " 回合" : $"0 {GameplayEquilibriumConstant.InGameTime}"); + private double 实际持续时间 => _durative && _duration > 0 ? (_duration + _levelGrowth * (Level - 1) * MagicEfficacy) : (!_durative && _durationTurn > 0 ? ((int)Math.Round(_durationTurn + _levelGrowth * (Level - 1) * MagicEfficacy, 0, MidpointRounding.ToPositiveInfinity)) : 0); + private readonly bool _durativeWithoutDuration; + private readonly string _durationString; + private readonly bool _durative; + private readonly double _duration; + private readonly int _durationTurn; + private readonly double _levelGrowth; + + public 施加持续性弱驱散(Skill skill, bool durativeWithoutDuration = false, string durationString = "", bool durative = false, double duration = 0, int durationTurn = 1, double levelGrowth = 0) : base(skill) + { + GamingQueue = skill.GamingQueue; + _durativeWithoutDuration = durativeWithoutDuration; + _durationString = durationString; + if (!_durativeWithoutDuration) + { + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + _levelGrowth = levelGrowth; + } + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + Dictionary isTeammateDictionary = GamingQueue?.GetIsTeammateDictionary(caster, targets) ?? []; + foreach (Character target in targets) + { + WriteLine($"[ {caster} ] 对 [ {target} ] 施加了持续性弱驱散!持续时间:{持续时间}!"); + bool isDebuff = true; + if (isTeammateDictionary.TryGetValue(target, out bool value)) + { + isDebuff = !value; + } + if (target == caster) + { + isDebuff = false; + } + if (target.Effects.FirstOrDefault(e => e is 持续性弱驱散 && e.Source == Source) is 持续性弱驱散 e && e.DurativeWithoutDuration == _durativeWithoutDuration && e.Durative == _durative && e.IsDebuff == isDebuff) + { + if (_duration > e.Duration) e.Duration = _duration; + if (_durationTurn > e.DurationTurn) e.DurationTurn = _durationTurn; + e.DispelledType = DispelledType; + e.ParentEffect = ParentEffect; + } + else + { + e = new(Skill, caster, _durativeWithoutDuration, _durative, _duration + _levelGrowth * (Level - 1), Convert.ToInt32(_durationTurn + _levelGrowth * (Level - 1))); + target.Effects.Add(e); + e.OnEffectGained(new HookContext(GamingQueue, target)); + e.IsDebuff = isDebuff; + e.DispelledType = DispelledType; + e.ParentEffect = ParentEffect; + } + GamingQueue?.AddApplyEffects(target, e.EffectType); + } + } + } +} diff --git a/OshimaBot.Content/Effects/SkillEffects/施加持续性强驱散.cs b/OshimaBot.Content/Effects/SkillEffects/施加持续性强驱散.cs new file mode 100644 index 0000000..4a50723 --- /dev/null +++ b/OshimaBot.Content/Effects/SkillEffects/施加持续性强驱散.cs @@ -0,0 +1,76 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.PassiveEffects; + +namespace OshimaBot.Content.Effects.SkillEffects +{ + public class 施加持续性强驱散 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"持续强驱散{Skill.TargetDescription()}{(_durativeWithoutDuration ? _durationString : $",持续 {持续时间}")}。\r\n持续性驱散是持续性临时驱散,它会在持续时间结束之后恢复目标尚未结束的特效。"; + public override DispelType DispelType => DispelType.DurativeStrong; + + private string 持续时间 => _durative && _duration > 0 ? 实际持续时间 + $" {GameplayEquilibriumConstant.InGameTime}" : (!_durative && _durationTurn > 0 ? 实际持续时间 + " 回合" : $"0 {GameplayEquilibriumConstant.InGameTime}"); + private double 实际持续时间 => _durative && _duration > 0 ? (_duration + _levelGrowth * (Level - 1) * MagicEfficacy) : (!_durative && _durationTurn > 0 ? ((int)Math.Round(_durationTurn + _levelGrowth * (Level - 1) * MagicEfficacy, 0, MidpointRounding.ToPositiveInfinity)) : 0); + private readonly bool _durativeWithoutDuration; + private readonly string _durationString; + private readonly bool _durative; + private readonly double _duration; + private readonly int _durationTurn; + private readonly double _levelGrowth; + + public 施加持续性强驱散(Skill skill, bool durativeWithoutDuration = false, string durationString = "", bool durative = false, double duration = 0, int durationTurn = 1, double levelGrowth = 0) : base(skill) + { + GamingQueue = skill.GamingQueue; + _durativeWithoutDuration = durativeWithoutDuration; + _durationString = durationString; + if (!_durativeWithoutDuration) + { + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + _levelGrowth = levelGrowth; + } + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + Dictionary isTeammateDictionary = GamingQueue?.GetIsTeammateDictionary(caster, targets) ?? []; + foreach (Character target in targets) + { + WriteLine($"[ {caster} ] 对 [ {target} ] 施加了持续性强驱散!持续时间:{持续时间}!"); + bool isDebuff = true; + if (isTeammateDictionary.TryGetValue(target, out bool value)) + { + isDebuff = !value; + } + if (target == caster) + { + isDebuff = false; + } + if (target.Effects.FirstOrDefault(e => e is 持续性强驱散 && e.Source == Source) is 持续性强驱散 e && e.DurativeWithoutDuration == _durativeWithoutDuration && e.Durative == _durative && e.IsDebuff == isDebuff) + { + if (_duration > e.Duration) e.Duration = _duration; + if (_durationTurn > e.DurationTurn) e.DurationTurn = _durationTurn; + e.DispelledType = DispelledType; + e.ParentEffect = ParentEffect; + } + else + { + e = new(Skill, caster, _durativeWithoutDuration, _durative, _duration + _levelGrowth * (Level - 1), Convert.ToInt32(_durationTurn + _levelGrowth * (Level - 1))); + target.Effects.Add(e); + e.OnEffectGained(new HookContext(GamingQueue, target)); + e.IsDebuff = isDebuff; + e.DispelledType = DispelledType; + e.ParentEffect = ParentEffect; + } + GamingQueue?.AddApplyEffects(target, e.EffectType); + } + } + } +} diff --git a/OshimaBot.Content/Effects/SkillEffects/施加概率增益.cs b/OshimaBot.Content/Effects/SkillEffects/施加概率增益.cs new file mode 100644 index 0000000..9e95fc6 --- /dev/null +++ b/OshimaBot.Content/Effects/SkillEffects/施加概率增益.cs @@ -0,0 +1,175 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using OshimaBot.Content.Effects; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.PassiveEffects; + +namespace OshimaBot.Content.Effects.SkillEffects +{ + public class 施加概率增益 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description + { + get + { + SetDescription(); + return $"{概率文本}对{Skill.TargetDescription()}施加{GetEffectTypeName(_effectType)} {持续时间}。{(_description != "" ? _description : "")}"; + } + } + public override EffectType EffectType => _effectType; + public override DispelledType DispelledType => _dispelledType; + public override bool ExemptDuration => true; + + private string 概率文本 => ActualProbability == 1 ? "" : $"{ActualProbability * 100:0.##}% 概率"; + /// + /// 实际命中概率 —— 统一走 (2026-09-23 统一口径)。 + /// ✅ **为什么本效果类被战技 / 爆发技混用也安全**(Admin 指出,已实测核对): + /// 全库 **55 处**重写 `MagicBottleneck` 的技能**清一色是魔法**(`SkillType.Magic`), + /// 战技 / 爆发技 / 物品 / 被动**都不重写** ⇒ 它们的 `MagicBottleneck` 取基类默认 **0** + /// ⇒ `MagicEfficacy` 在 `瓶颈 == 0` 时**直接返回 1.0**(不是浮点近似,是精确值) + /// ⇒ 统一公式 `(基础 + 成长×(Lv−1)) × 1.0` 与旧公式 `基础 + 成长×(Lv−1)×1.0` **完全等价**。 + /// 同理,那批「基础概率 ≥ 1 且无成长」的**必中型控制**(石化之矢 / 无相飞刀 / 陀螺舞 / + /// 鲨鱼锚击 / 裁决塔罗 …)全是战技或爆发技 ⇒ `clamp(1.0 × 1.0) = 1.0` ⇒ **仍然必中**。 + /// 所以**无需按技能类型或必中性分流**,一个分支都不用 —— 这是机制保证的结果,不是巧合。 + /// + private double ActualProbability => EfficacyHit.命中率(_probability, _probabilityLevelGrowth, Level, MagicEfficacy); + private string 持续时间 => _durative && _duration > 0 ? $"{实际持续时间:0.##}" + $" {GameplayEquilibriumConstant.InGameTime}" : (!_durative && _durationTurn > 0 ? 实际持续时间 + " 回合" : $"0 {GameplayEquilibriumConstant.InGameTime}"); + private double 实际持续时间 => _durative && _duration > 0 ? (_duration + _levelGrowth * (Level - 1) * MagicEfficacy) : (!_durative && _durationTurn > 0 ? ((int)Math.Round(_durationTurn + _levelGrowth * (Level - 1) * MagicEfficacy, 0, MidpointRounding.ToPositiveInfinity)) : 0); + private readonly EffectType _effectType; + private readonly bool _durative; + private readonly double _duration; + private readonly int _durationTurn; + private readonly double _levelGrowth; + private readonly double _probability; + private readonly double _probabilityLevelGrowth; + private readonly object[] _args; + private DispelledType _dispelledType = DispelledType.Weak; + private string _description = ""; + + public 施加概率增益(Skill skill, EffectType effectType, bool durative = false, double duration = 0, int durationTurn = 1, double levelGrowth = 0, double probability = 0, double probabilityLevelGrowth = 0, params object[] args) : base(skill) + { + GamingQueue = skill.GamingQueue; + _effectType = effectType; + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + _levelGrowth = levelGrowth; + _probability = probability; + _probabilityLevelGrowth = probabilityLevelGrowth; + _args = args; + SetDescription(); + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + foreach (Character target in targets) + { + if (target.HP <= 0 || Random.NextDouble() > ActualProbability) continue; + Effect? e = null; + double duration = _duration + _levelGrowth * (Level - 1); + int durationTurn = Convert.ToInt32(_durationTurn + _levelGrowth * (Level - 1)); + string tip = ""; + switch (_effectType) + { + case EffectType.HealOverTime: + bool isPercentage = false; + double durationHeal = 0; + double durationHealPercent = 0; + double durationHealLevelGrowth = 0; + if (_args.Length > 0 && _args[0] is bool _) + { + isPercentage = (bool)_args[0]; + } + if (_args.Length > 1 && _args[1] is double _) + { + durationHeal = (double)_args[1]; + } + if (_args.Length > 2 && _args[2] is double _) + { + durationHealPercent = (double)_args[2]; + } + if (_args.Length > 3 && _args[3] is double _) + { + durationHealLevelGrowth = (double)_args[3]; + } + if (isPercentage && durationHealPercent > 0 || !isPercentage && durationHeal > 0) + { + if (Level > 0) + { + durationHeal += durationHealLevelGrowth * (Level - 1); + durationHealPercent += durationHealLevelGrowth * (Level - 1); + } + string healString = $"每{GameplayEquilibriumConstant.InGameTime}回复 {(isPercentage ? $"{durationHealPercent * 100:0.##}% 当前生命值" : durationHeal.ToString("0.##"))} 点生命值"; + tip = $"[ {caster} ] 对 [ {target} ] 施加了{GetEffectTypeName(_effectType)}! [ {target} ] 每{GameplayEquilibriumConstant.InGameTime}{healString}!持续时间:{持续时间}!"; + e = new 持续回复(Skill, target, caster, _durative, duration, durationTurn, isPercentage, durationHeal, durationHealPercent) + { + EffectType = _effectType + }; + } + break; + default: + break; + } + if (e != null && !CheckExemption(caster, target, e)) + { + WriteLine(tip); + target.Effects.Add(e); + e.OnEffectGained(new HookContext(GamingQueue, target)); + GamingQueue?.AddApplyEffects(target, e.EffectType); + } + } + } + + private void SetDescription() + { + switch (_effectType) + { + case EffectType.HealOverTime: + _dispelledType = DispelledType.Weak; + bool isPercentage = false; + double durationHeal = 0; + double durationHealPercent = 0; + double durationHealLevelGrowth = 0; + if (_args.Length > 0 && _args[0] is bool _) + { + isPercentage = (bool)_args[0]; + } + if (_args.Length > 1 && _args[1] is double _) + { + durationHeal = (double)_args[1]; + } + if (_args.Length > 2 && _args[2] is double _) + { + durationHealPercent = (double)_args[2]; + } + if (_args.Length > 3 && _args[3] is double _) + { + durationHealLevelGrowth = (double)_args[3]; + } + if (isPercentage && durationHealPercent > 0 || !isPercentage && durationHeal > 0) + { + if (Level > 0) durationHeal += durationHealLevelGrowth * (Level - 1); + if (Level > 0) durationHealPercent += durationHealLevelGrowth * (Level - 1); + string healString = $"每{GameplayEquilibriumConstant.InGameTime}回复 {(isPercentage ? $"{durationHealPercent * 100:0.##}% 当前生命值" : durationHeal.ToString("0.##"))} 点生命值"; + _description = $"{GetEffectTypeName(_effectType)}:每{GameplayEquilibriumConstant.InGameTime}{healString}!持续时间:{持续时间}!"; + } + break; + default: + break; + } + } + + private static string GetEffectTypeName(EffectType type) + { + return type switch + { + _ => SkillSet.GetEffectTypeName(type) + }; + } + } +} diff --git a/OshimaBot.Content/Effects/SkillEffects/施加概率负面.cs b/OshimaBot.Content/Effects/SkillEffects/施加概率负面.cs new file mode 100644 index 0000000..780b020 --- /dev/null +++ b/OshimaBot.Content/Effects/SkillEffects/施加概率负面.cs @@ -0,0 +1,387 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using OshimaBot.Content.Effects; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; +using OshimaBot.Content.Effects.PassiveEffects; + +namespace OshimaBot.Content.Effects.SkillEffects +{ + public class 施加概率负面 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description + { + get + { + SetDescription(); + return $"{概率文本}对{Skill.TargetDescription()}造成{GetEffectTypeName(_effectType)} {持续时间}。{(_description != "" ? _description : "")}"; + } + } + public override EffectType EffectType => _effectType; + public override DispelledType DispelledType => _dispelledType; + public override bool ExemptDuration => true; + + private string 概率文本 => ActualProbability == 1 ? "" : $"{ActualProbability * 100:0.##}% 概率"; + /// + /// 实际命中概率 —— 统一走 (2026-09-23 统一口径)。 + /// ✅ **为什么本效果类被战技 / 爆发技混用也安全**(Admin 指出,已实测核对): + /// 全库 **55 处**重写 `MagicBottleneck` 的技能**清一色是魔法**(`SkillType.Magic`), + /// 战技 / 爆发技 / 物品 / 被动**都不重写** ⇒ 它们的 `MagicBottleneck` 取基类默认 **0** + /// ⇒ `MagicEfficacy` 在 `瓶颈 == 0` 时**直接返回 1.0**(不是浮点近似,是精确值) + /// ⇒ 统一公式 `(基础 + 成长×(Lv−1)) × 1.0` 与旧公式 `基础 + 成长×(Lv−1)×1.0` **完全等价**。 + /// 同理,那批「基础概率 ≥ 1 且无成长」的**必中型控制**(石化之矢 / 无相飞刀 / 陀螺舞 / + /// 鲨鱼锚击 / 裁决塔罗 …)全是战技或爆发技 ⇒ `clamp(1.0 × 1.0) = 1.0` ⇒ **仍然必中**。 + /// 所以**无需按技能类型或必中性分流**,一个分支都不用 —— 这是机制保证的结果,不是巧合。 + /// + private double ActualProbability => EfficacyHit.命中率(_probability, _probabilityLevelGrowth, Level, MagicEfficacy); + private string 持续时间 => _durative && _duration > 0 ? $"{实际持续时间:0.##}" + $" {GameplayEquilibriumConstant.InGameTime}" : (!_durative && _durationTurn > 0 ? 实际持续时间 + " 回合" : $"0 {GameplayEquilibriumConstant.InGameTime}"); + private double 实际持续时间 => _durative && _duration > 0 ? (_duration + _levelGrowth * (Level - 1) * MagicEfficacy) : (!_durative && _durationTurn > 0 ? ((int)Math.Round(_durationTurn + _levelGrowth * (Level - 1) * MagicEfficacy, 0, MidpointRounding.ToPositiveInfinity)) : 0); + private readonly EffectType _effectType; + private readonly bool _durative; + private readonly double _duration; + private readonly int _durationTurn; + private readonly double _levelGrowth; + private readonly double _probability; + private readonly double _probabilityLevelGrowth; + private readonly object[] _args; + private DispelledType _dispelledType = DispelledType.Weak; + private string _description = ""; + + public 施加概率负面(Skill skill, EffectType effectType, bool durative = false, double duration = 0, int durationTurn = 1, double levelGrowth = 0, double probability = 0, double probabilityLevelGrowth = 0, params object[] args) : base(skill) + { + GamingQueue = skill.GamingQueue; + _effectType = effectType; + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + _levelGrowth = levelGrowth; + _probability = probability; + _probabilityLevelGrowth = probabilityLevelGrowth; + _args = args; + SetDescription(); + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + foreach (Character target in targets) + { + if (target.HP <= 0 || Random.NextDouble() > ActualProbability) continue; + Effect? e = null; + double duration = _duration + _levelGrowth * (Level - 1); + int durationTurn = Convert.ToInt32(_durationTurn + _levelGrowth * (Level - 1)); + string tip = ""; + switch (_effectType) + { + case EffectType.Silence: + tip = $"[ {caster} ] 对 [ {target} ] 造成了封技和施法解除!持续时间:{持续时间}!"; + e = new 封技(Skill, caster, _durative, duration, durationTurn); + break; + case EffectType.Confusion: + tip = $"[ {target} ] 陷入了混乱!!持续时间:{持续时间}!"; + e = new 混乱(Skill, caster, _durative, duration, durationTurn); + break; + case EffectType.Taunt: + tip = $"[ {target} ] 被 [ {caster} ] 嘲讽了!持续时间:{持续时间}!"; + e = new 愤怒(Skill, caster, caster, _durative, duration, durationTurn); + break; + case EffectType.Delay: + double healingReductionPercent = 0.3; + if (_args.Length > 0 && _args[0] is double healingReduce) + { + healingReductionPercent = healingReduce; + } + tip = $"[ {caster} ] 对 [ {target} ] 造成了迟滞!普通攻击和技能的硬直时间、当前行动等待时间延长了 {healingReductionPercent * 100:0.##}%!持续时间:{持续时间}!"; + e = new 迟滞(Skill, caster, _durative, duration, durationTurn, healingReductionPercent); + break; + case EffectType.Stun: + tip = $"[ {caster} ] 对 [ {target} ] 造成了眩晕!持续时间:{持续时间}!"; + e = new 眩晕(Skill, caster, _durative, duration, durationTurn); + break; + case EffectType.Freeze: + tip = $"[ {caster} ] 对 [ {target} ] 造成了冻结!持续时间:{持续时间}!"; + e = new 冻结(Skill, caster, _durative, duration, durationTurn); + break; + case EffectType.Petrify: + tip = $"[ {caster} ] 对 [ {target} ] 造成了石化!持续时间:{持续时间}!"; + e = new 石化(Skill, caster, _durative, duration, durationTurn); + break; + case EffectType.Vulnerable: + DamageType damageType = DamageType.Magical; + if (_args.Length > 0 && _args[0] is DamageType dt) + { + damageType = dt; + } + double exDamagePercent = 0; + if (_args.Length > 1 && _args[1] is double percent) + { + exDamagePercent = percent; + } + if (exDamagePercent > 0) + { + tip = $"[ {caster} ] 对 [ {target} ] 造成了易伤,额外受到 {exDamagePercent * 100:0.##}% {CharacterSet.GetDamageTypeName(damageType)}!持续时间:{持续时间}!"; + e = new 易伤(Skill, target, caster, _durative, duration, durationTurn, damageType, exDamagePercent); + } + break; + case EffectType.Bleed: + bool isPercentage = false; + double durationDamage = 0; + double durationDamagePercent = 0; + double durationDamageLevelGrowth = 0; + if (_args.Length > 0 && _args[0] is bool isPerc) + { + isPercentage = isPerc; + } + if (_args.Length > 1 && _args[1] is double durDamage) + { + durationDamage = durDamage; + } + if (_args.Length > 2 && _args[2] is double durDamagePercent) + { + durationDamagePercent = durDamagePercent; + } + if (_args.Length > 3 && _args[3] is double durDamageLevelGrowth) + { + durationDamageLevelGrowth = durDamageLevelGrowth; + } + if (isPercentage && durationDamagePercent > 0 || !isPercentage && durationDamage > 0) + { + if (Level > 0) durationDamage += durationDamageLevelGrowth * (Level - 1); + if (Level > 0) durationDamagePercent += durationDamageLevelGrowth * (Level - 1); + string damageString = isPercentage ? $"流失 {durationDamagePercent * 100:0.##}% 当前生命值" : $"流失 {durationDamage:0.##} 点生命值"; + tip = $"[ {caster} ] 对 [ {target} ] 造成了气绝! [ {target} ] 进入行动受限状态且每{GameplayEquilibriumConstant.InGameTime}{damageString}!持续时间:{持续时间}!"; + e = new 气绝(Skill, target, caster, _durative, duration, durationTurn, isPercentage, durationDamage, durationDamagePercent); + } + break; + case EffectType.Cripple: + tip = $"[ {caster} ] 对 [ {target} ] 造成了战斗不能,禁止普通攻击和使用技能(魔法、战技和爆发技)!持续时间:{持续时间}!"; + e = new 战斗不能(Skill, caster, _durative, duration, durationTurn); + break; + case EffectType.Disarm: + tip = $"[ {caster} ] 对 [ {target} ] 造成了缴械!持续时间:{持续时间}!"; + e = new 缴械(Skill, caster, _durative, duration, durationTurn); + break; + case EffectType.Burn: + case EffectType.Poison: + isPercentage = false; + durationDamage = 0; + durationDamagePercent = 0; + durationDamageLevelGrowth = 0; + damageType = DamageType.Magical; + DamageCalculationOptions? options = null; + if (_args.Length > 0 && _args[0] is bool _) + { + isPercentage = (bool)_args[0]; + } + if (_args.Length > 1 && _args[1] is double _) + { + durationDamage = (double)_args[1]; + } + if (_args.Length > 2 && _args[2] is double _) + { + durationDamagePercent = (double)_args[2]; + } + if (_args.Length > 3 && _args[3] is double _) + { + durationDamageLevelGrowth = (double)_args[3]; + } + if (_args.Length > 0 && _args[4] is DamageType _) + { + damageType = (DamageType)_args[4]; + } + if (_args.Length > 0 && _args[5] is DamageCalculationOptions _) + { + options = (DamageCalculationOptions)_args[5]; + } + if (isPercentage && durationDamagePercent > 0 || !isPercentage && durationDamage > 0) + { + if (Level > 0) durationDamage += durationDamageLevelGrowth * (Level - 1); + if (Level > 0) durationDamagePercent += durationDamageLevelGrowth * (Level - 1); + string damageString = isPercentage ? $"受到 {durationDamagePercent * 100:0.##}% 当前生命值的" : $"受到 {durationDamage:0.##} 点" + CharacterSet.GetDamageTypeName(damageType); + tip = $"[ {caster} ] 对 [ {target} ] 造成了{GetEffectTypeName(_effectType)}! [ {target} ] 每{GameplayEquilibriumConstant.InGameTime}{damageString}!持续时间:{持续时间}!"; + e = new 持续伤害(Skill, target, caster, _durative, duration, durationTurn, isPercentage, durationDamage, durationDamagePercent, damageType, options) + { + EffectType = _effectType + }; + } + break; + case EffectType.InterruptCasting: + e = new 打断施法(Skill); + break; + default: + break; + } + if (e != null && !CheckExemption(caster, target, e)) + { + if (e is 打断施法 ddsf) + { + ddsf.Activate(caster, [target]); + continue; + } + WriteLine(tip); + target.Effects.Add(e); + e.OnEffectGained(new HookContext(GamingQueue, target)); + GamingQueue?.AddApplyEffects(target, e.EffectType); + if (e is 迟滞 cz) + { + cz.ApplyChange(target); + } + } + } + } + + private void SetDescription() + { + switch (_effectType) + { + case EffectType.Silence: + _dispelledType = DispelledType.Weak; + _description = "封技:不能使用技能(魔法、战技和爆发技),并解除当前施法。"; + break; + case EffectType.Confusion: + _dispelledType = DispelledType.Strong; + _description = "混乱:进入行动受限状态,失控并随机行动,且所有指令均会在所有角色中随机选取目标。"; + break; + case EffectType.Taunt: + _dispelledType = DispelledType.Strong; + _description = "愤怒:进入行动受限状态,失控并随机行动,行动回合内仅能对嘲讽者发起普通攻击。"; + break; + case EffectType.Delay: + double healingReductionPercent = 0.3; + if (_args.Length > 0 && _args[0] is double healingReduce) + { + healingReductionPercent = healingReduce; + } + _dispelledType = DispelledType.Weak; + _description = $"迟滞:普通攻击和技能的硬直时间、当前行动等待时间延长 {healingReductionPercent * 100:0.##}%。"; + break; + case EffectType.Stun: + _dispelledType = DispelledType.Strong; + _description = "眩晕:进入完全行动不能状态。"; + break; + case EffectType.Freeze: + _dispelledType = DispelledType.Strong; + _description = "冻结:进入完全行动不能状态。"; + break; + case EffectType.Petrify: + _dispelledType = DispelledType.Strong; + _description = "石化:进入完全行动不能状态。"; + break; + case EffectType.Vulnerable: + DamageType damageType = DamageType.Magical; + if (_args.Length > 0 && _args[0] is DamageType dt) + { + damageType = dt; + } + double exDamagePercent = 0; + if (_args.Length > 1 && _args[1] is double percent) + { + exDamagePercent = percent; + } + if (exDamagePercent > 0) + { + _dispelledType = DispelledType.Weak; + _description = $"易伤:额外受到 {exDamagePercent * 100:0.##}% {CharacterSet.GetDamageTypeName(damageType)}。"; + } + break; + case EffectType.Bleed: + _dispelledType = DispelledType.Strong; + bool isPercentage = false; + double durationDamage = 0; + double durationDamagePercent = 0; + double durationDamageLevelGrowth = 0; + if (_args.Length > 0 && _args[0] is bool isPerc) + { + isPercentage = isPerc; + } + if (_args.Length > 1 && _args[1] is double durDamage) + { + durationDamage = durDamage; + } + if (_args.Length > 2 && _args[2] is double durDamagePercent) + { + durationDamagePercent = durDamagePercent; + } + if (_args.Length > 3 && _args[3] is double durDamageLevelGrowth) + { + durationDamageLevelGrowth = durDamageLevelGrowth; + } + if (isPercentage && durationDamagePercent > 0 || !isPercentage && durationDamage > 0) + { + if (Level > 0) durationDamage += durationDamageLevelGrowth * (Level - 1); + if (Level > 0) durationDamagePercent += durationDamageLevelGrowth * (Level - 1); + string damageString = isPercentage ? $"流失 {durationDamagePercent * 100:0.##}% 当前生命值" : $"流失 {durationDamage:0.##} 点生命值"; + _description = $"气绝:进入行动受限状态并每{GameplayEquilibriumConstant.InGameTime}{damageString},此效果不会导致角色死亡。"; + } + break; + case EffectType.Cripple: + _dispelledType = DispelledType.Strong; + _description = "战斗不能:无法普通攻击和使用技能(魔法、战技和爆发技)。"; + break; + case EffectType.Disarm: + _dispelledType = DispelledType.Weak; + _description = "缴械:无法普通攻击。"; + break; + case EffectType.Burn: + case EffectType.Poison: + _dispelledType = DispelledType.Weak; + isPercentage = false; + durationDamage = 0; + durationDamagePercent = 0; + durationDamageLevelGrowth = 0; + damageType = DamageType.Magical; + if (_args.Length > 0 && _args[0] is bool _) + { + isPercentage = (bool)_args[0]; + } + if (_args.Length > 1 && _args[1] is double _) + { + durationDamage = (double)_args[1]; + } + if (_args.Length > 2 && _args[2] is double _) + { + durationDamagePercent = (double)_args[2]; + } + if (_args.Length > 3 && _args[3] is double _) + { + durationDamageLevelGrowth = (double)_args[3]; + } + if (_args.Length > 0 && _args[4] is DamageType _) + { + damageType = (DamageType)_args[4]; + } + if (isPercentage && durationDamagePercent > 0 || !isPercentage && durationDamage > 0) + { + if (Level > 0) durationDamage += durationDamageLevelGrowth * (Level - 1); + if (Level > 0) durationDamagePercent += durationDamageLevelGrowth * (Level - 1); + string damageString = isPercentage ? $"受到 {durationDamagePercent * 100:0.##}% 当前生命值的" : $"受到 {durationDamage:0.##} 点" + CharacterSet.GetDamageTypeName(damageType); + _description = $"{GetEffectTypeName(_effectType)}:每{GameplayEquilibriumConstant.InGameTime}{damageString}!持续时间:{持续时间}!"; + } + break; + case EffectType.InterruptCasting: + _description = "打断施法:中断其正在进行的吟唱。"; + break; + default: + break; + } + } + + private static string GetEffectTypeName(EffectType type) + { + return type switch + { + EffectType.Taunt => "愤怒", + EffectType.Silence => "封技", + EffectType.Bleed => "气绝", + EffectType.Cripple => "战斗不能", + EffectType.Burn => "燃烧", + EffectType.Poison => "中毒", + _ => SkillSet.GetEffectTypeName(type) + }; + } + } +} diff --git a/OshimaBot.Content/Effects/SkillEffects/百分比回复生命值.cs b/OshimaBot.Content/Effects/SkillEffects/百分比回复生命值.cs new file mode 100644 index 0000000..561b455 --- /dev/null +++ b/OshimaBot.Content/Effects/SkillEffects/百分比回复生命值.cs @@ -0,0 +1,37 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.SkillEffects +{ + public class 百分比回复生命值 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"为{Skill.TargetDescription()}回复 {百分比 * 100:0.##}% 最大生命值。{(CanRespawn ? "如果目标已死亡,将复活目标。" : "")}"; + + private double 基础回复 { get; set; } = 0.03; + private double 回复成长 { get; set; } = 0.03; + private double 百分比 => Skill.Level > 0 ? 基础回复 + 回复成长 * (Skill.Level - 1) : 基础回复; + private bool CanRespawn { get; set; } = false; + + public 百分比回复生命值(Skill skill, double 基础回复, double 回复成长, bool canRespawn = false) : base(skill) + { + GamingQueue = skill.GamingQueue; + this.基础回复 = 基础回复; + this.回复成长 = 回复成长; + CanRespawn = canRespawn; + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + foreach (Character target in targets) + { + double heal = 百分比 * target.MaxHP; + HealToTarget(caster, target, heal, CanRespawn); + } + } + } +} diff --git a/OshimaBot.Content/Effects/SkillEffects/纯数值伤害.cs b/OshimaBot.Content/Effects/SkillEffects/纯数值伤害.cs new file mode 100644 index 0000000..5f34244 --- /dev/null +++ b/OshimaBot.Content/Effects/SkillEffects/纯数值伤害.cs @@ -0,0 +1,38 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.SkillEffects +{ + public class 纯数值伤害 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"对{Skill.TargetDescription()}造成 {Damage:0.##} 点{CharacterSet.GetDamageTypeName(DamageType, MagicType)}。"; + + private double Damage => Skill.Level > 0 ? 基础数值伤害 + 基础伤害等级成长 * (Skill.Level - 1) : 基础数值伤害; + private double 基础数值伤害 { get; set; } = 200; + private double 基础伤害等级成长 { get; set; } = 100; + private DamageType DamageType { get; set; } = DamageType.Magical; + + public 纯数值伤害(Skill skill, double 基础数值伤害, double 基础伤害等级成长, DamageType damageType, MagicType magicType = MagicType.None) : base(skill) + { + GamingQueue = skill.GamingQueue; + this.基础数值伤害 = 基础数值伤害; + this.基础伤害等级成长 = 基础伤害等级成长; + DamageType = damageType; + MagicType = magicType; + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + foreach (Character enemy in targets) + { + DamageToEnemy(caster, enemy, DamageType, MagicType, Damage); + } + } + } +} diff --git a/OshimaBot.Content/Effects/SkillEffects/纯数值回复生命值.cs b/OshimaBot.Content/Effects/SkillEffects/纯数值回复生命值.cs new file mode 100644 index 0000000..4a90fdd --- /dev/null +++ b/OshimaBot.Content/Effects/SkillEffects/纯数值回复生命值.cs @@ -0,0 +1,36 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Effects.SkillEffects +{ + public class 纯数值回复生命 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"为{Skill.TargetDescription()}回复 {Heal:0.##} 点生命值。{(CanRespawn ? "如果目标已死亡,将复活目标。" : "")}"; + + private double Heal => Skill.Level > 0 ? 基础回复 + 回复成长 * (Skill.Level - 1) : 基础回复; + private double 基础回复 { get; set; } = 100; + private double 回复成长 { get; set; } = 30; + private bool CanRespawn { get; set; } = false; + + public 纯数值回复生命(Skill skill, double 基础回复, double 回复成长, bool canRespawn = false) : base(skill) + { + GamingQueue = skill.GamingQueue; + this.基础回复 = 基础回复; + this.回复成长 = 回复成长; + CanRespawn = canRespawn; + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + foreach (Character target in targets) + { + HealToTarget(caster, target, Heal, CanRespawn); + } + } + } +} diff --git a/OshimaBot.Content/Effects/SkillEffects/造成封技.cs b/OshimaBot.Content/Effects/SkillEffects/造成封技.cs new file mode 100644 index 0000000..930274d --- /dev/null +++ b/OshimaBot.Content/Effects/SkillEffects/造成封技.cs @@ -0,0 +1,50 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.PassiveEffects; + +namespace OshimaBot.Content.Effects.SkillEffects +{ + public class 造成封技 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"对{Skill.TargetDescription()}造成封技 {封技时间},无法使用技能(魔法、战技和爆发技),并打断当前施法。"; + public override EffectType EffectType => EffectType.Silence; + public override bool ExemptDuration => true; + + private string 封技时间 => _durative && _duration > 0 ? 实际封技时间 + $" {GameplayEquilibriumConstant.InGameTime}" : (!_durative && _durationTurn > 0 ? 实际封技时间 + " 回合" : $"0 {GameplayEquilibriumConstant.InGameTime}"); + private double 实际封技时间 => _durative && _duration > 0 ? _duration + _levelGrowth * (Level - 1) : (!_durative && _durationTurn > 0 ? _durationTurn + _levelGrowth * (Level - 1) : 0); + private readonly bool _durative; + private readonly double _duration; + private readonly int _durationTurn; + private readonly double _levelGrowth; + + public 造成封技(Skill skill, bool durative = false, double duration = 0, int durationTurn = 1, double levelGrowth = 0) : base(skill) + { + GamingQueue = skill.GamingQueue; + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + _levelGrowth = levelGrowth; + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + foreach (Character enemy in targets) + { + 封技 e = new(Skill, caster, _durative, _duration + _levelGrowth * (Level - 1), Convert.ToInt32(_durationTurn + _levelGrowth * (Level - 1))); + if (!CheckExemption(caster, enemy, e)) + { + WriteLine($"[ {caster} ] 对 [ {enemy} ] 造成了封技和施法解除!持续时间:{封技时间}!"); + enemy.Effects.Add(e); + e.OnEffectGained(new HookContext(GamingQueue, enemy)); + GamingQueue?.AddApplyEffects(enemy, e.EffectType); + } + } + } + } +} diff --git a/OshimaBot.Content/Effects/SkillEffects/造成气绝.cs b/OshimaBot.Content/Effects/SkillEffects/造成气绝.cs new file mode 100644 index 0000000..6cfb2e4 --- /dev/null +++ b/OshimaBot.Content/Effects/SkillEffects/造成气绝.cs @@ -0,0 +1,59 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.PassiveEffects; + +namespace OshimaBot.Content.Effects.SkillEffects +{ + public class 造成气绝 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"对目标{(Skill.CanSelectTargetCount > 1 ? $"至多 {Skill.CanSelectTargetCount} 个" : "")}敌人造成气绝 {气绝时间}。气绝期间,目标行动受限且每{GameplayEquilibriumConstant.InGameTime}{DamageString},此生命流失效果不会导致角色死亡。"; + public override DispelledType DispelledType => DispelledType.Strong; + public override EffectType EffectType => EffectType.Bleed; + public override bool ExemptDuration => true; + + private string 气绝时间 => _durative && _duration > 0 ? 实际气绝时间 + $" {GameplayEquilibriumConstant.InGameTime}" : (!_durative && _durationTurn > 0 ? 实际气绝时间 + " 回合" : $"0 {GameplayEquilibriumConstant.InGameTime}"); + private double 实际气绝时间 => _durative && _duration > 0 ? _duration + _levelGrowth * (Level - 1) : (!_durative && _durationTurn > 0 ? _durationTurn + _levelGrowth * (Level - 1) : 0); + private readonly bool _durative; + private readonly double _duration; + private readonly int _durationTurn; + private readonly double _levelGrowth; + private readonly bool _isPercentage; + private readonly double _durationDamage; + private readonly double _durationDamagePercent; + private double Damage => _isPercentage ? _durationDamagePercent : _durationDamage; + private string DamageString => _isPercentage ? $"流失 {Damage * 100:0.##}% 当前生命值" : $"流失 {Damage:0.##} 点生命值"; + + public 造成气绝(Skill skill, bool durative = false, double duration = 0, int durationTurn = 1, double levelGrowth = 0, + bool isPercentage = true, double durationDamage = 100, double durationDamagePercent = 0.02) : base(skill) + { + GamingQueue = skill.GamingQueue; + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + _levelGrowth = levelGrowth; + _isPercentage = isPercentage; + _durationDamage = durationDamage; + _durationDamagePercent = durationDamagePercent; + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + foreach (Character enemy in targets) + { + 气绝 e = new(Skill, enemy, caster, _durative, _duration + _levelGrowth * (Level - 1), Convert.ToInt32(_durationTurn + _levelGrowth * (Level - 1)), _isPercentage, _durationDamage, _durationDamagePercent); + if (!CheckExemption(caster, enemy, e)) + { + WriteLine($"[ {caster} ] 对 [ {enemy} ] 造成了气绝!持续时间:{气绝时间}!"); + enemy.Effects.Add(e); + e.OnEffectGained(new HookContext(GamingQueue, enemy)); + GamingQueue?.AddApplyEffects(enemy, e.EffectType); + } + } + } + } +} diff --git a/OshimaBot.Content/Effects/SkillEffects/造成眩晕.cs b/OshimaBot.Content/Effects/SkillEffects/造成眩晕.cs new file mode 100644 index 0000000..297c7e5 --- /dev/null +++ b/OshimaBot.Content/Effects/SkillEffects/造成眩晕.cs @@ -0,0 +1,52 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.PassiveEffects; + +namespace OshimaBot.Content.Effects.SkillEffects +{ + public class 造成眩晕 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"对{Skill.TargetDescription()}造成眩晕 {眩晕时间}。"; + public override DispelledType DispelledType => DispelledType.Strong; + public override EffectType EffectType => EffectType.Stun; + public override bool ExemptDuration => true; + + private string 眩晕时间 => _durative && _duration > 0 ? 实际眩晕时间 + $" {GameplayEquilibriumConstant.InGameTime}" : (!_durative && _durationTurn > 0 ? 实际眩晕时间 + " 回合" : $"0 {GameplayEquilibriumConstant.InGameTime}"); + private double 实际眩晕时间 => _durative && _duration > 0 ? _duration + _levelGrowth * (Level - 1) : (!_durative && _durationTurn > 0 ? _durationTurn + _levelGrowth * (Level - 1) : 0); + private readonly bool _durative; + private readonly double _duration; + private readonly int _durationTurn; + private readonly double _levelGrowth; + + public 造成眩晕(Skill skill, bool durative = false, double duration = 0, int durationTurn = 1, double levelGrowth = 0) : base(skill) + { + GamingQueue = skill.GamingQueue; + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + _levelGrowth = levelGrowth; + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + foreach (Character enemy in targets) + { + if (enemy.HP <= 0) continue; + 眩晕 e = new(Skill, caster, _durative, _duration + _levelGrowth * (Level - 1), Convert.ToInt32(_durationTurn + _levelGrowth * (Level - 1))); + if (!CheckExemption(caster, enemy, e)) + { + WriteLine($"[ {caster} ] 眩晕了 [ {enemy} ] !持续时间:{眩晕时间}!"); + enemy.Effects.Add(e); + e.OnEffectGained(new HookContext(GamingQueue, enemy)); + GamingQueue?.AddApplyEffects(enemy, e.EffectType); + } + } + } + } +} diff --git a/OshimaBot.Content/Effects/SkillEffects/造成虚弱.cs b/OshimaBot.Content/Effects/SkillEffects/造成虚弱.cs new file mode 100644 index 0000000..00094ac --- /dev/null +++ b/OshimaBot.Content/Effects/SkillEffects/造成虚弱.cs @@ -0,0 +1,76 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.PassiveEffects; + +namespace OshimaBot.Content.Effects.SkillEffects +{ + public class 造成虚弱 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"对{Skill.TargetDescription()}造成虚弱 {虚弱时间},伤害降低 {ActualDamageReductionPercent * 100:0.##}%," + + $"物理护甲降低 {ActualDEFReductionPercent * 100:0.##}%,魔法抗性降低 {ActualMDFReductionPercent * 100:0.##}%,治疗效果降低 {ActualHealingReductionPercent * 100:0.##}%。"; + public override DispelledType DispelledType => DispelledType.Weak; + public override EffectType EffectType => EffectType.Weaken; + public override bool ExemptDuration => true; + + private string 虚弱时间 => _durative && _duration > 0 ? $"{实际虚弱时间:0.##} {GameplayEquilibriumConstant.InGameTime}" : (!_durative && _durationTurn > 0 ? 实际虚弱时间 + " 回合" : $"0 {GameplayEquilibriumConstant.InGameTime}"); + private double 实际虚弱时间 => _durative && _duration > 0 ? _duration + _levelGrowth * (Level - 1) : (!_durative && _durationTurn > 0 ? _durationTurn + _levelGrowth * (Level - 1) : 0); + private readonly bool _durative; + private readonly double _duration; + private readonly int _durationTurn; + private readonly double _levelGrowth; + private readonly double _damageReductionPercent; + private readonly double _DEFReductionPercent; + private readonly double _MDFReductionPercent; + private readonly double _healingReductionPercent; + private readonly double _damageReductionPercentLevelGrowth; + private readonly double _DEFReductionPercentLevelGrowth; + private readonly double _MDFReductionPercentLevelGrowth; + private readonly double _healingReductionPercentLevelGrowth; + private double ActualDamageReductionPercent => Level > 0 ? _damageReductionPercent + _damageReductionPercentLevelGrowth * (Level - 1) : _damageReductionPercent; + private double ActualDEFReductionPercent => Level > 0 ? _DEFReductionPercent + _DEFReductionPercentLevelGrowth * (Level - 1) : _DEFReductionPercent; + private double ActualMDFReductionPercent => Level > 0 ? _MDFReductionPercent + _MDFReductionPercentLevelGrowth * (Level - 1) : _MDFReductionPercent; + private double ActualHealingReductionPercent => Level > 0 ? _healingReductionPercent + _healingReductionPercentLevelGrowth * (Level - 1) : _healingReductionPercent; + + public 造成虚弱(Skill skill, bool durative = false, double duration = 0, int durationTurn = 1, double levelGrowth = 0, + double damageReductionPercent = 0, double DEFReductionPercent = 0, double MDFReductionPercent = 0, double healingReductionPercent = 0, + double damageReductionPercentLevelGrowth = 0, double DEFReductionPercentLevelGrowth = 0, double MDFReductionPercentLevelGrowth = 0, double healingReductionPercentLevelGrowth = 0) : base(skill) + { + GamingQueue = skill.GamingQueue; + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + _levelGrowth = levelGrowth; + _damageReductionPercent = damageReductionPercent; + _DEFReductionPercent = DEFReductionPercent; + _MDFReductionPercent = MDFReductionPercent; + _healingReductionPercent = healingReductionPercent; + _damageReductionPercentLevelGrowth = damageReductionPercentLevelGrowth; + _DEFReductionPercentLevelGrowth = DEFReductionPercentLevelGrowth; + _MDFReductionPercentLevelGrowth = MDFReductionPercentLevelGrowth; + _healingReductionPercentLevelGrowth = healingReductionPercentLevelGrowth; + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + foreach (Character enemy in targets) + { + 虚弱 e = new(Skill, enemy, caster, _durative, _duration + _levelGrowth * (Level - 1), Convert.ToInt32(_durationTurn + _levelGrowth * (Level - 1)), ActualDamageReductionPercent, ActualDEFReductionPercent, ActualMDFReductionPercent, ActualHealingReductionPercent); + if (!CheckExemption(caster, enemy, e)) + { + WriteLine($"[ {caster} ] 对 [ {enemy} ] 造成了虚弱!伤害降低 {ActualDamageReductionPercent * 100:0.##}%," + + $"物理护甲降低 {ActualDEFReductionPercent * 100:0.##}%,魔法抗性降低 {ActualMDFReductionPercent * 100:0.##}%," + + $"治疗效果降低 {ActualHealingReductionPercent * 100:0.##}%!持续时间:{虚弱时间}!"); + enemy.Effects.Add(e); + e.OnEffectGained(new HookContext(GamingQueue, enemy)); + GamingQueue?.AddApplyEffects(enemy, e.EffectType); + } + } + } + } +} diff --git a/OshimaBot.Content/Effects/SkillEffects/降低敌方行动速度.cs b/OshimaBot.Content/Effects/SkillEffects/降低敌方行动速度.cs new file mode 100644 index 0000000..b77a0bc --- /dev/null +++ b/OshimaBot.Content/Effects/SkillEffects/降低敌方行动速度.cs @@ -0,0 +1,64 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Effects.SkillEffects +{ + public class 降低敌方行动速度 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"降低{Skill.TargetDescription()} {Math.Abs(SPD):0.##} 点行动速度 {持续时间}。并延长目标 30% 的行动等待时间(当前硬直时间)。"; + public override EffectType EffectType => EffectType.Slow; + public override bool ExemptDuration => true; + + private double SPD => Level > 0 ? -Math.Abs(基础数值速度 + 基础速度等级成长 * (Level - 1)) : -Math.Abs(基础数值速度); + private double 基础数值速度 { get; set; } = 30; + private double 基础速度等级成长 { get; set; } = 20; + private string 持续时间 => _durative && _duration > 0 ? _duration + $" {GameplayEquilibriumConstant.InGameTime}" : (!_durative && _durationTurn > 0 ? _durationTurn + " 回合" : $"0 {GameplayEquilibriumConstant.InGameTime}"); + private readonly bool _durative; + private readonly double _duration; + private readonly int _durationTurn; + + public 降低敌方行动速度(Skill skill, double 基础数值速度, double 基础速度等级成长, bool durative = true, double duration = 40, int durationTurn = 0) : base(skill) + { + GamingQueue = skill.GamingQueue; + this.基础数值速度 = 基础数值速度; + this.基础速度等级成长 = 基础速度等级成长; + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + foreach (Character target in targets) + { + ExSPD e = new(Skill, new Dictionary() + { + { "exspd", SPD } + }, caster) + { + Name = Name, + Durative = _durative, + Duration = _duration, + DurationTurn = _durationTurn + }; + if (!CheckExemption(caster, target, e)) + { + target.Effects.Add(e); + e.OnEffectGained(new HookContext(GamingQueue, target)); + e.EffectType = EffectType.Slow; + e.IsDebuff = true; + WriteLine($"[ {target} ] 的行动速度降低了 {-SPD:0.##} 点,行动等待时间(当前硬直时间)被延长了 30%!持续时间:{持续时间}!"); + GamingQueue?.AddApplyEffects(target, e.EffectType); + GamingQueue?.ChangeCharacterHardnessTime(target, 0.3, true, false); + } + } + } + } +} diff --git a/OshimaBot.Content/Items/Accessory/万能钥匙.cs b/OshimaBot.Content/Items/Accessory/万能钥匙.cs new file mode 100644 index 0000000..0735465 --- /dev/null +++ b/OshimaBot.Content/Items/Accessory/万能钥匙.cs @@ -0,0 +1,111 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; +using OshimaBot.Content.Skills; + +namespace OshimaBot.Content.Items +{ + /// + /// 装备 · 饰品【万能钥匙】—— 周期性的「全能决策点配额」 + /// 设计意图:`TempActionQuota` 的 **全能档**(`AddTempActionQuota(effect, null, n)`) + /// 是本项目**完全空白**的维度——现有 3 处配额用法全都指定了具体行动类型 + /// (`疾走`/`闪现` 给战技、`咒怨洪流` 给普攻)。全能配额意味着"这一回合任何行动都能多做一次"。 + /// ⚠ 关键:**配额必须与决策点一起给**。实测表明决策点才是硬约束(AI 行动循环持续到 + /// `CurrentDecisionPoints` 耗尽),只给配额而不给 DP 等于空给(`咒怨洪流` 即受此限制) + /// ⇒ 本装备每次都**同时**发放「+1 全能配额」与「+1 决策点」。 + /// 品质决定技能等级(Orange 4 / Red 7 / Gold 10),等级只影响发放间隔(39 / 34.5 / 30 秒)。 + /// + public abstract class 万能钥匙 : Item + { + protected 万能钥匙(Character? character, int 技能等级) : base(ItemType.Accessory) + { + Skills.Passives.Add(new 万能钥匙技能(character, this) { Level = 技能等级 }); + } + + public override string Description => Skills.Passives.Count > 0 ? Skills.Passives.First().Description : ""; + public override string BackgroundStory => "黄铜齿面被磨得发亮。它不保证你打开哪扇门,只保证你总多一次机会去试。"; + } + + public class 万能钥匙1 : 万能钥匙 + { + public override long Id => (long)AccessoryID.万能钥匙1; + public override string Name => "万能钥匙 Lv.4"; + public override QualityType QualityType => QualityType.Orange; + public 万能钥匙1(Character? character = null) : base(character, 4) { } + } + + public class 万能钥匙2 : 万能钥匙 + { + public override long Id => (long)AccessoryID.万能钥匙2; + public override string Name => "万能钥匙 Lv.7"; + public override QualityType QualityType => QualityType.Red; + public 万能钥匙2(Character? character = null) : base(character, 7) { } + } + + public class 万能钥匙3 : 万能钥匙 + { + public override long Id => (long)AccessoryID.万能钥匙3; + public override string Name => "万能钥匙 Lv.10"; + public override QualityType QualityType => QualityType.Gold; + public 万能钥匙3(Character? character = null) : base(character, 10) { } + } + + public class 万能钥匙技能 : Skill + { + public override long Id => (long)ItemPassiveID.万能钥匙; + public override string Name => "万能钥匙"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + + public 万能钥匙技能(Character? character = null, Item? item = null) : base(SkillType.Passive, character) + { + Level = 4; // 最低档兜底;三档装备分别写入 4 / 7 / 10 + Item = item; + Effects.Add(new 万能钥匙特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + public class 万能钥匙特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => + $"每 {间隔:0.##} {GameplayEquilibriumConstant.InGameTime}获得一次「全能决策点配额」与 {决策点补充} 点决策点 —— " + + $"本回合内任何行动(普攻 / 战技 / 魔法 / 爆发技 / 物品)都能多做一次。"; + + private double _剩余间隔 = 0; + + /// 发放间隔(秒):技能等级越高越短(Lv4 = 39 / Lv7 = 34.5 / Lv10 = 30) + private double 间隔 => 45 - Skill.Level * 1.5; + + /// 随配额一起发放的决策点(保证配额能被兑现) + private const int 决策点补充 = 1; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (Skill.Character is null || Skill.Character != character) return; + _剩余间隔 = 间隔; + } + + public override void OnTimeElapsed(TimeLapseContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (Skill.Character is null || Skill.Character != character) return; + if (GamingQueue is null) return; + _剩余间隔 -= ctx.Elapsed; + if (_剩余间隔 > 0) return; + _剩余间隔 = 间隔; + if (!GamingQueue.CharacterDecisionPoints.TryGetValue(character, out DecisionPoints? dp) || dp is null) return; + int before = dp.CurrentDecisionPoints; + dp.CurrentDecisionPoints = Math.Min(before + 决策点补充, dp.MaxDecisionPoints); + dp.AddTempActionQuota(this, null, 1); // type = null ⇒ 全能配额 + WriteLine($"[ {character} ] 的万能钥匙生效:获得 {dp.CurrentDecisionPoints - before} 点决策点与一次全能行动配额!"); + } + } +} diff --git a/OshimaBot.Content/Items/Accessory/共鸣核心.cs b/OshimaBot.Content/Items/Accessory/共鸣核心.cs new file mode 100644 index 0000000..b8f7163 --- /dev/null +++ b/OshimaBot.Content/Items/Accessory/共鸣核心.cs @@ -0,0 +1,180 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.PassiveEffects; +using OshimaBot.Content.Skills; + +namespace OshimaBot.Content.Items +{ + /// + /// 装备 · 饰品【共鸣核心】—— 把队友的出手转成自身能量的「电池」 + /// 设计意图:与【行军医箱】(消耗能量换队友生命)互补,本条是反向的资源流: + /// 队友的每一次有效伤害都会为穿戴者充能。它把"队友愿不愿意持续输出"变成自身的续航条件, + /// 因此不需要任何数值增益,也能让通用的普攻/技能变得对团队有价值。 + /// 触发:穿戴者为每名队友挂【共鸣标记】,标记以宿主身份收到 + /// (宿主为攻击方)后转发给穿戴者;穿戴者回复能量。 + /// 数值:回能量由技能等级决定(Orange 4 级 = 4、Red 7 级 = 8、Gold 10 级 = 12), + /// 等级 < 4 时取兜底 1(正常用不到)。 + /// ⚠ 只对队友(不含穿戴者本人)生效,因此必须身处一支有输出能力的队伍才有收益。 + /// ⚠ 幂等约定:装备会被周期空投随时替换,因此 + /// 必须把挂在他人状态栏上的【共鸣标记】全部撤回。 + /// + public abstract class 共鸣核心 : Item + { + protected 共鸣核心(Character? character, int 技能等级) : base(ItemType.Accessory) + { + Skills.Passives.Add(new 共鸣核心技能(character, this) { Level = 技能等级 }); + } + + public override string Description => Skills.Passives.Count > 0 ? Skills.Passives.First().Description : ""; + + public override string BackgroundStory => "核心内部封着一枚悬停的结晶。每当共鸣的同伴出手,它便泛起一圈微光——那是被传递回来的节拍。"; + } + + public class 共鸣核心1 : 共鸣核心 + { + public override long Id => (long)AccessoryID.共鸣核心1; + public override string Name => "共鸣核心 +4"; + public override QualityType QualityType => QualityType.Orange; + + public 共鸣核心1(Character? character = null) : base(character, 4) { } + } + + public class 共鸣核心2 : 共鸣核心 + { + public override long Id => (long)AccessoryID.共鸣核心2; + public override string Name => "共鸣核心 +8"; + public override QualityType QualityType => QualityType.Red; + + public 共鸣核心2(Character? character = null) : base(character, 7) { } + } + + public class 共鸣核心3 : 共鸣核心 + { + public override long Id => (long)AccessoryID.共鸣核心3; + public override string Name => "共鸣核心 +12"; + public override QualityType QualityType => QualityType.Gold; + + public 共鸣核心3(Character? character = null) : base(character, 10) { } + } + + public class 共鸣核心技能 : Skill + { + public override long Id => (long)ItemPassiveID.共鸣核心; + public override string Name => "共鸣核心"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + + public 共鸣核心技能(Character? character = null, Item? item = null) : base(SkillType.Passive, character) + { + Level = 4; // 最低档兜底;三档装备分别写入 4 / 7 / 10 + Item = item; + Effects.Add(new 共鸣核心特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + /// + /// 【共鸣核心】的控制器:常驻在穿戴者身上,负责维护队友身上的【共鸣标记】并结算回能。 + /// 冷却集中在这里,因此队友的同一轮多段伤害(含 AoE)只会触发一次回能。 + /// + public class 共鸣核心特效 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => + $"共鸣范围内的队友每次造成伤害,你回复 {每次回能:0.##} 点能量" + + $"(每 {冷却时间:0.##} {GameplayEquilibriumConstant.InGameTime}至多一次)。"; + + public override EffectType EffectType => EffectType.Item; + + private double _剩余冷却 = 0; + + /// + /// 每次回能:等级 < 4 时取兜底 1(正常用不到);否则按等级线性增长 + /// (Orange 4 级 = 4、Red 7 级 = 8、Gold 10 级 = 12) + /// + private double 每次回能 => Level < 4 ? 1 : 4 * (Level - 1) / 3.0; + + /// 回能冷却(穿戴者共享,避免 AoE 多段伤害刷爆) + private const double 冷却时间 = 2; + + public 共鸣核心特效(Skill skill) : base(skill) + { + } + + private Character? 穿戴者 => Skill.Character; + + public override void OnEffectGained(HookContext ctx) + { + _剩余冷却 = 0; + // 开局前队列可能尚未就绪,真正的挂载交给 OnGameStart / OnTimeElapsed 兜底 + 发送标记(); + } + + public override void OnGameStart(HookContext ctx) + { + 发送标记(); + } + + public override void OnTimeElapsed(TimeLapseContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (穿戴者 is null || 穿戴者 != character) return; + if (_剩余冷却 > 0) _剩余冷却 = Math.Max(0, _剩余冷却 - ctx.Elapsed); + // 兜底:新入场 / 复活的队友补挂标记(内部去重) + 发送标记(); + } + + public override void OnEffectLost(HookContext ctx) + { + // 卸装 / 换装:必须把挂在他人状态栏上的标记全部撤回,保证幂等 + 撤回标记(); + } + + /// 为每名存活队友补挂【共鸣标记】(按本控制器的技能实例去重) + private void 发送标记() + { + Character? wearer = 穿戴者; + if (GamingQueue is null || wearer is null) return; + foreach (Character ally in GamingQueue.GetTeammates(wearer)) + { + if (ally.HP <= 0) continue; + if (ally.Effects.Any(e => e is 共鸣标记 m && m.Skill == Skill)) continue; + new 共鸣标记(Skill, wearer, this).AddToCharacter(ally); + } + } + + /// 撤回所有由本装备挂出的【共鸣标记】 + private void 撤回标记() + { + Character? wearer = 穿戴者; + if (GamingQueue is null || wearer is null) return; + List all = [.. GamingQueue.AllCharacters.Union(GamingQueue.Queue)]; + foreach (Character character in all) + { + List<共鸣标记> markers = [.. character.Effects.OfType<共鸣标记>().Where(m => m.Skill == Skill)]; + foreach (共鸣标记 marker in markers) + { + marker.RemoveFromCharacter(character); + } + } + } + + /// 由【共鸣标记】转发:队友造成伤害后为穿戴者充能 + public bool TryGainEnergy(Character ally) + { + Character? wearer = 穿戴者; + if (GamingQueue is null || wearer is null) return false; + if (wearer.HP <= 0) return false; + if (_剩余冷却 > 0) return false; + _剩余冷却 = 冷却时间; + wearer.EP += 每次回能; + WriteLine($"[ {wearer} ] 的共鸣核心因 [ {ally} ] 的出手而充能,回复了 {每次回能:0.##} 点能量!(当前 {wearer.EP:0.##})"); + return true; + } + } +} diff --git a/OshimaBot.Content/Items/Accessory/应急装置.cs b/OshimaBot.Content/Items/Accessory/应急装置.cs new file mode 100644 index 0000000..51dfc89 --- /dev/null +++ b/OshimaBot.Content/Items/Accessory/应急装置.cs @@ -0,0 +1,95 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; +using OshimaBot.Content.Skills; + +namespace OshimaBot.Content.Items +{ + /// + /// 装备 · 饰品【应急装置】—— 主动型团队应急模块 + /// 设计意图:此前的辅助装备都是「被动监听」,本条补上「主动按钮」这一形态: + /// 把它挂在身上,就多了一个「全队混合护盾 + 弱驱散」的应急按钮,代价是一次高额能量与较长冷却。 + /// 实现:Skills.Active = new 应急装置技能(character) { Level = f(QualityType) }, + /// 品质决定技能等级(Orange 4 / Red 5 / Gold 6)。战技等级上限即 6,故 Gold 档刚好拉满。 + /// 效果由 与 提供; + /// 技能类型为 SkillType.Skill,由 AddCharacterEquipSlotSkills 纳入回合可选列表并消耗能量。 + /// ⚠ 换装约定:主动技能不给他人挂监听器,因此换装无需清理状态; + /// 属于技能自身,重新抽到即为满冷却状态。 + /// + public abstract class 应急装置 : Item + { + protected 应急装置(Character? character, int 技能等级) : base(ItemType.Accessory) + { + Skills.Active = new 应急装置技能(character, this) + { + Level = 技能等级 + }; + } + + public override string Description => Skills.Active?.Description ?? ""; + + public override string BackgroundStory => "巴掌大的金属匣,侧面的拉环上结着一层薄霜。匣子从不主动说话——它只在有人快要倒下时,嗡的一声展开。"; + } + + public class 应急装置1 : 应急装置 + { + public override long Id => (long)AccessoryID.应急装置1; + public override string Name => "应急装置 Lv.4"; + public override QualityType QualityType => QualityType.Orange; + + public 应急装置1(Character? character = null) : base(character, 4) { } + } + + public class 应急装置2 : 应急装置 + { + public override long Id => (long)AccessoryID.应急装置2; + public override string Name => "应急装置 Lv.5"; + public override QualityType QualityType => QualityType.Red; + + public 应急装置2(Character? character = null) : base(character, 5) { } + } + + public class 应急装置3 : 应急装置 + { + public override long Id => (long)AccessoryID.应急装置3; + public override string Name => "应急装置 Lv.6"; + public override QualityType QualityType => QualityType.Gold; + + public 应急装置3(Character? character = null) : base(character, 6) { } + } + + /// + /// 【应急装置】的主动技能:为全队(含自己)提供混合护盾并弱驱散。 + /// · 消耗能量、较长冷却,是一次「全队级」的救场 + /// · 护盾量随等级提升、冷却也随等级变长,等级由装备品质决定 + /// + public class 应急装置技能 : Skill + { + public override long Id => (long)ItemActiveID.应急装置; + public override string Name => "应急装置"; + public override string Description => string.Join("", Effects.Select(e => e.Description)); + public override double EPCost => Level > 0 ? 能量消耗基础 + 能量消耗等级成长 * (Level - 1) : 能量消耗基础; + + /// 冷却随等级提升:Orange(Lv.4) 72 → Red(Lv.5) 76 → Gold(Lv.6) 80 秒 + public override double CD => Level > 0 ? 冷却基础 + 冷却等级成长 * (Level - 1) : 冷却基础; + public override double HardnessTime { get; set; } = 8; + public override bool CanSelectSelf => true; + public override bool CanSelectEnemy => false; + public override bool CanSelectTeammate => true; + public override bool SelectAllTeammates => true; + + private const double 能量消耗基础 = 70; + private const double 能量消耗等级成长 = 4; + private const double 冷却基础 = 60; + private const double 冷却等级成长 = 4; + private const double 护盾基础 = 80; + private const double 护盾等级成长 = 80; + + public 应急装置技能(Character? character = null, Item? item = null) : base(SkillType.Skill, character) + { + Item = item; + Effects.Add(new 增加混合护盾值(this, 护盾基础, 护盾等级成长)); + Effects.Add(new 弱驱散特效(this)); + } + } +} diff --git a/OshimaBot.Content/Items/Accessory/接力信标.cs b/OshimaBot.Content/Items/Accessory/接力信标.cs new file mode 100644 index 0000000..ec3d069 --- /dev/null +++ b/OshimaBot.Content/Items/Accessory/接力信标.cs @@ -0,0 +1,189 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.PassiveEffects; +using OshimaBot.Content.Skills; + +namespace OshimaBot.Content.Items +{ + /// + /// 装备 · 饰品【接力信标】—— 持续压制团队硬直的「节奏器」 + /// 设计意图:硬直决定出手频率,但模组里几乎没有「跨角色削减硬直」的辅助。 + /// 本装备把队友普攻 / 技能后的硬直整体下调,让团队出手衔接更紧凑(接力); + /// 并把「被空投重新部署」这个节奏本身变成一次全队回能。 + /// 实现:给每名队友挂【信标标记】,标记在硬直钩子里返回比率修正 + /// (不做任何属性增减,天然幂等)。 + /// 数值:由技能等级决定(Orange 4 级 = −8% / 6,Red 7 级 = −11% / 12,Gold 10 级 = −14% / 18); + /// 等级 < 4 时取兜底 −5% 与 1(正常用不到)。 + /// 标尺(手册 §6.4 被动·增益 ≤36%):Gold 档硬直 −14% ✓ + /// ⚠ 幂等约定:装备会被周期空投随时替换,因此 + /// 必须把挂在他人状态栏上的【信标标记】全部撤回, + /// 否则光环会残留在队友身上。 + /// + public abstract class 接力信标 : Item + { + protected 接力信标(Character? character, int 技能等级) : base(ItemType.Accessory) + { + Skills.Passives.Add(new 接力信标技能(character, this) { Level = 技能等级 }); + } + + public override string Description => Skills.Passives.Count > 0 ? Skills.Passives.First().Description : ""; + + public override string BackgroundStory => "一截被磨得发亮的信号杆,顶端绑着褪色的布条。它不发声,只是把每一个人的步点悄悄对齐。"; + } + + public class 接力信标1 : 接力信标 + { + public override long Id => (long)AccessoryID.接力信标1; + public override string Name => "接力信标 -8%"; + public override QualityType QualityType => QualityType.Orange; + + public 接力信标1(Character? character = null) : base(character, 4) { } + } + + public class 接力信标2 : 接力信标 + { + public override long Id => (long)AccessoryID.接力信标2; + public override string Name => "接力信标 -11%"; + public override QualityType QualityType => QualityType.Red; + + public 接力信标2(Character? character = null) : base(character, 7) { } + } + + public class 接力信标3 : 接力信标 + { + public override long Id => (long)AccessoryID.接力信标3; + public override string Name => "接力信标 -14%"; + public override QualityType QualityType => QualityType.Gold; + + public 接力信标3(Character? character = null) : base(character, 10) { } + } + + public class 接力信标技能 : Skill + { + public override long Id => (long)ItemPassiveID.接力信标; + public override string Name => "接力信标"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + + public 接力信标技能(Character? character = null, Item? item = null) : base(SkillType.Passive, character) + { + Level = 4; // 最低档兜底;三档装备分别写入 4 / 7 / 10 + Item = item; + Effects.Add(new 接力信标特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + /// + /// 【接力信标】的控制器:常驻在穿戴者身上,负责维护队友身上的【信标标记】, + /// 并在「部署」时(装备 / 被空投换上)为全队结算一次回能。 + /// + public class 接力信标特效 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => + $"装备期间,队友的普攻与技能硬直减少 {硬直减免 * 100:0.##}%;" + + $"每次被重新部署(装备)时,全体队友回复 {部署回能:0.##} 点能量。"; + + public override EffectType EffectType => EffectType.Item; + + private bool _已部署 = false; + + /// + /// 硬直减免:等级 < 4 时取兜底 5%(正常用不到); + /// 否则 Orange 4 级 = 8%,Red 7 级 = 11%,Gold 10 级 = 14% + /// + private double 硬直减免 => Level < 4 ? 0.05 : (Level + 4) * 0.01; + + /// + /// 部署回能(对每名队友):等级 < 4 时取兜底 1(正常用不到); + /// 否则 Orange 4 级 = 6,Red 7 级 = 12,Gold 10 级 = 18 + /// + private double 部署回能 => Level < 4 ? 1 : 2 * (Level - 1); + + public 接力信标特效(Skill skill) : base(skill) + { + } + + private Character? 穿戴者 => Skill.Character; + + public override void OnEffectGained(HookContext ctx) + { + // 装备 = 部署:挂光环 + 全队回能(队伍未就绪时交给 OnGameStart / OnTimeElapsed 重试) + 发送标记(); + 部署(); + } + + public override void OnGameStart(HookContext ctx) + { + 发送标记(); + 部署(); + } + + public override void OnTimeElapsed(TimeLapseContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (穿戴者 is null || 穿戴者 != character) return; + // 兜底:新入场 / 复活的队友补挂标记;部署若因队伍未就绪而错过,这里补结算 + 发送标记(); + 部署(); + } + + public override void OnEffectLost(HookContext ctx) + { + // 卸装 / 换装:撤回光环标记,保证幂等;同时允许重新装备时再次"部署" + 撤回标记(); + _已部署 = false; + } + + /// 为每名存活队友补挂【信标标记】(按本控制器的技能实例去重) + private void 发送标记() + { + Character? wearer = 穿戴者; + if (GamingQueue is null || wearer is null) return; + foreach (Character ally in GamingQueue.GetTeammates(wearer)) + { + if (ally.HP <= 0) continue; + if (ally.Effects.Any(e => e is 信标标记 m && m.Skill == Skill)) continue; + new 信标标记(Skill, wearer, 硬直减免).AddToCharacter(ally); + } + } + + /// 撤回所有由本装备挂出的【信标标记】 + private void 撤回标记() + { + Character? wearer = 穿戴者; + if (GamingQueue is null || wearer is null) return; + List all = [.. GamingQueue.AllCharacters.Union(GamingQueue.Queue)]; + foreach (Character character in all) + { + List<信标标记> markers = [.. character.Effects.OfType<信标标记>().Where(m => m.Skill == Skill)]; + foreach (信标标记 marker in markers) + { + marker.RemoveFromCharacter(character); + } + } + } + + /// 部署结算:为全队回复能量,每个装备实例只结算一次 + private void 部署() + { + if (_已部署) return; + Character? wearer = 穿戴者; + if (GamingQueue is null || wearer is null) return; + List allies = [.. GamingQueue.GetTeammates(wearer).Where(c => c.HP > 0)]; + if (allies.Count == 0) return; // 队伍未就绪:留给后续钩子重试 + _已部署 = true; + foreach (Character ally in allies) + { + ally.EP += 部署回能; + } + WriteLine($"[ {wearer} ] 部署了接力信标,全体队友回复了 {部署回能:0.##} 点能量!"); + } + } +} diff --git a/OshimaBot.Content/Items/Accessory/攻击之爪.cs b/OshimaBot.Content/Items/Accessory/攻击之爪.cs new file mode 100644 index 0000000..ba0d4cf --- /dev/null +++ b/OshimaBot.Content/Items/Accessory/攻击之爪.cs @@ -0,0 +1,128 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.OpenEffects; +using OshimaBot.Content.Skills; + +namespace OshimaBot.Content.Items +{ + public class 攻击之爪10 : Item + { + public override long Id => (long)AccessoryID.攻击之爪10; + public override string Name => "攻击之爪 +10"; + public override string Description => Skills.Passives.Count > 0 ? Skills.Passives.First().Description : ""; + public override string BackgroundStory => "里面藏着的小尖刃不容小觑。"; + public override QualityType QualityType => QualityType.White; + + public 攻击之爪10(Character? character = null) : base(ItemType.Accessory) + { + Skills.Passives.Add(new 攻击之爪技能(character, this, 10)); + } + } + + public class 攻击之爪25 : Item + { + public override long Id => (long)AccessoryID.攻击之爪25; + public override string Name => "攻击之爪 +25"; + public override string Description => Skills.Passives.Count > 0 ? Skills.Passives.First().Description : ""; + public override string BackgroundStory => "里面藏着的小尖刃不容小觑。"; + public override QualityType QualityType => QualityType.Green; + + public 攻击之爪25(Character? character = null) : base(ItemType.Accessory) + { + Skills.Passives.Add(new 攻击之爪技能(character, this, 25)); + } + } + + public class 攻击之爪40 : Item + { + public override long Id => (long)AccessoryID.攻击之爪40; + public override string Name => "攻击之爪 +40"; + public override string Description => Skills.Passives.Count > 0 ? Skills.Passives.First().Description : ""; + public override string BackgroundStory => "里面藏着的小尖刃不容小觑。"; + public override QualityType QualityType => QualityType.Blue; + + public 攻击之爪40(Character? character = null) : base(ItemType.Accessory) + { + Skills.Passives.Add(new 攻击之爪技能(character, this, 40)); + } + } + + public class 攻击之爪55 : Item + { + public override long Id => (long)AccessoryID.攻击之爪55; + public override string Name => "攻击之爪 +55"; + public override string Description => Skills.Passives.Count > 0 ? Skills.Passives.First().Description : ""; + public override string BackgroundStory => "里面藏着的小尖刃不容小觑。"; + public override QualityType QualityType => QualityType.Purple; + + public 攻击之爪55(Character? character = null) : base(ItemType.Accessory) + { + Skills.Passives.Add(new 攻击之爪技能(character, this, 55)); + } + } + + public class 攻击之爪70 : Item + { + public override long Id => (long)AccessoryID.攻击之爪70; + public override string Name => "攻击之爪 +70"; + public override string Description => Skills.Passives.Count > 0 ? Skills.Passives.First().Description : ""; + public override string BackgroundStory => "里面藏着的小尖刃不容小觑。"; + public override QualityType QualityType => QualityType.Orange; + + public 攻击之爪70(Character? character = null) : base(ItemType.Accessory) + { + Skills.Passives.Add(new 攻击之爪技能(character, this, 70)); + } + } + + public class 攻击之爪85 : Item + { + public override long Id => (long)AccessoryID.攻击之爪85; + public override string Name => "攻击之爪 +85"; + public override string Description => Skills.Passives.Count > 0 ? Skills.Passives.First().Description : ""; + public override string BackgroundStory => "里面藏着的小尖刃不容小觑。"; + public override QualityType QualityType => QualityType.Red; + + public 攻击之爪85(Character? character = null) : base(ItemType.Accessory) + { + Skills.Passives.Add(new 攻击之爪技能(character, this, 85)); + } + } + + public class 攻击之爪100 : Item + { + public override long Id => (long)AccessoryID.攻击之爪100; + public override string Name => "攻击之爪 +100"; + public override string Description => Skills.Passives.Count > 0 ? Skills.Passives.First().Description : ""; + public override string BackgroundStory => "里面藏着的小尖刃不容小觑。"; + public override QualityType QualityType => QualityType.Gold; + + public 攻击之爪100(Character? character = null) : base(ItemType.Accessory) + { + Skills.Passives.Add(new 攻击之爪技能(character, this, 100)); + } + } + + public class 攻击之爪技能 : Skill + { + public override long Id => (long)ItemPassiveID.攻击之爪; + public override string Name => "攻击之爪"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + + public 攻击之爪技能(Character? character = null, Item? item = null, double exATK = 0) : base(SkillType.Passive, character) + { + Level = 1; + Item = item; + Dictionary values = new() + { + { "exatk", exATK } + }; + Effects.Add(new ExATK(this, values)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } +} diff --git a/OshimaBot.Content/Items/Accessory/糖糖一周年纪念饰品.cs b/OshimaBot.Content/Items/Accessory/糖糖一周年纪念饰品.cs new file mode 100644 index 0000000..0d73819 --- /dev/null +++ b/OshimaBot.Content/Items/Accessory/糖糖一周年纪念饰品.cs @@ -0,0 +1,95 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.OpenEffects; +using OshimaBot.Content.Skills; + +namespace OshimaBot.Content.Items +{ + public class 糖糖一周年纪念饰品1 : Item + { + public override long Id => (long)AccessoryID.糖糖一周年纪念饰品1; + public override string Name => "回忆糖纸"; + public override string Description => Skills.Passives.Count > 0 ? Skills.Passives.First().Description : ""; + public override string BackgroundStory => "在魔法视觉下,可见其由无数层半透明糖纸压缩而成,每层糖纸都印着微缩画面。"; + public override string Category => "糖糖一周年限定纪念物品"; + public override QualityType QualityType => QualityType.Gold; + + public 糖糖一周年纪念饰品1(Character? character = null) : base(ItemType.Accessory) + { + Price = 0; + IsSellable = false; + IsTradable = false; + IsLock = true; + Skills.Passives.Add(new 糖糖一周年纪念饰品技能1(character, this)); + } + } + + public class 糖糖一周年纪念饰品技能1 : Skill + { + public override long Id => (long)ItemPassiveID.糖糖一周年纪念饰品1; + public override string Name => "回忆糖纸"; + public override string Description => string.Join("", Effects.Select(e => e.Description)); + + public 糖糖一周年纪念饰品技能1(Character? character = null, Item? item = null) : base(SkillType.Passive, character) + { + Level = 1; + Item = item; + Dictionary values = new() + { + { "exls", 0.25 }, + { "shtr", 0.25 } + }; + Effects.Add(new ExLifesteal(this, values, character)); + Effects.Add(new SkillHardTimeReduce2(this, values, character)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + public class 糖糖一周年纪念饰品2 : Item + { + public override long Id => (long)AccessoryID.糖糖一周年纪念饰品2; + public override string Name => "蜂糖蜜酿"; + public override string Description => Skills.Passives.Count > 0 ? Skills.Passives.First().Description : ""; + public override string BackgroundStory => "一对以秘银细链连接,随着光线折射散发极微弱糖霜光泽的耳坠。左耳为蜂糖,右耳为蜜酿。"; + public override string Category => "糖糖一周年限定纪念物品"; + public override QualityType QualityType => QualityType.Gold; + + public 糖糖一周年纪念饰品2(Character? character = null) : base(ItemType.Accessory) + { + Price = 0; + IsSellable = false; + IsTradable = false; + IsLock = true; + Skills.Passives.Add(new 糖糖一周年纪念饰品技能2(character, this)); + } + } + + public class 糖糖一周年纪念饰品技能2 : Skill + { + public override long Id => (long)ItemPassiveID.糖糖一周年纪念饰品2; + public override string Name => "蜂糖蜜酿"; + public override string Description => string.Join("", Effects.Select(e => e.Description)); + + public 糖糖一周年纪念饰品技能2(Character? character = null, Item? item = null) : base(SkillType.Passive, character) + { + Level = 1; + Item = item; + Dictionary values = new() + { + { "exhp", 1550 }, + { "exmp", 800 } + }; + Effects.Add(new ExMaxHP(this, values, character)); + Effects.Add(new ExMaxMP(this, values, character)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } +} diff --git a/OshimaBot.Content/Items/Accessory/节拍器.cs b/OshimaBot.Content/Items/Accessory/节拍器.cs new file mode 100644 index 0000000..214ae91 --- /dev/null +++ b/OshimaBot.Content/Items/Accessory/节拍器.cs @@ -0,0 +1,112 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; +using OshimaBot.Content.Skills; + +namespace OshimaBot.Content.Items +{ + /// + /// 装备 · 饰品【节拍器】—— 击杀回响,把「战果」转成「节奏」 + /// 设计意图:决策点的常规来源是每回合恢复,本装备把它接到**击杀**上—— + /// 击杀是低频、高价值事件,天然自带限流,不会退化成常驻增益(对比"每回合 +N"那类)。 + /// 触发:(全队列广播)中,自己为击杀者 + /// ⇒ 记入待兑现;到**下一个自身回合开始**时一次性发放(避免在他人的回合里改动自己的决策点)。 + /// 效果:+N 决策点(Orange Lv4 = 2 / Red Lv7 = 2 / Gold Lv10 = 3),**带累积上限**防止连续击杀溢出。 + /// ⚠ 召唤物 / 随从的死亡不计(`DeathContext.HasMaster`)。 + /// + public abstract class 节拍器 : Item + { + protected 节拍器(Character? character, int 技能等级) : base(ItemType.Accessory) + { + Skills.Passives.Add(new 节拍器技能(character, this) { Level = 技能等级 }); + } + + public override string Description => Skills.Passives.Count > 0 ? Skills.Passives.First().Description : ""; + public override string BackgroundStory => "摆在腰侧的小小节拍器,指针只随倒下的人跳动一次。"; + } + + public class 节拍器1 : 节拍器 + { + public override long Id => (long)AccessoryID.节拍器1; + public override string Name => "节拍器 Lv.4"; + public override QualityType QualityType => QualityType.Orange; + public 节拍器1(Character? character = null) : base(character, 4) { } + } + + public class 节拍器2 : 节拍器 + { + public override long Id => (long)AccessoryID.节拍器2; + public override string Name => "节拍器 Lv.7"; + public override QualityType QualityType => QualityType.Red; + public 节拍器2(Character? character = null) : base(character, 7) { } + } + + public class 节拍器3 : 节拍器 + { + public override long Id => (long)AccessoryID.节拍器3; + public override string Name => "节拍器 Lv.10"; + public override QualityType QualityType => QualityType.Gold; + public 节拍器3(Character? character = null) : base(character, 10) { } + } + + public class 节拍器技能 : Skill + { + public override long Id => (long)ItemPassiveID.节拍器; + public override string Name => "节拍器"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + + public 节拍器技能(Character? character = null, Item? item = null) : base(SkillType.Passive, character) + { + Level = 4; // 最低档兜底;三档装备分别写入 4 / 7 / 10 + Item = item; + Effects.Add(new 节拍器特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + public class 节拍器特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => + $"每次击杀为其积累 {单次补充} 点决策点,在下一个自身回合开始时发放(最多累积 {累积上限} 点)。"; + + /// 待兑现的决策点(击杀时累积,自身回合开始时发放) + private int _待兑现 = 0; + + /// 单次击杀补充量(Lv4–7 = 2 / Lv10 = 3) + private int 单次补充 => 1 + Skill.Level / 4; + + /// 累积上限:防止连续击杀一次性灌入过多决策点 + private int 累积上限 => 单次补充 * 2; + + public override void AfterDeathCalculation(DeathContext ctx) + { + if (Skill.Character is null) return; + if (ctx.Killer != Skill.Character) return; + if (ctx.Trigger == Skill.Character) return; + if (ctx.HasMaster) return; // 召唤物 / 随从的死亡不计 + _待兑现 = Math.Min(_待兑现 + 单次补充, 累积上限); + WriteLine($"[ {Skill.Character} ] 的节拍器记下了战果,将在下个自身回合兑现 {_待兑现} 点决策点。"); + } + + public override void OnTurnStart(TurnContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (Skill.Character is null || Skill.Character != character) return; + if (_待兑现 <= 0) return; + if (GamingQueue is null) return; + if (!GamingQueue.CharacterDecisionPoints.TryGetValue(character, out DecisionPoints? dp) || dp is null) return; + int before = dp.CurrentDecisionPoints; + dp.CurrentDecisionPoints = Math.Min(before + _待兑现, dp.MaxDecisionPoints); + int actual = dp.CurrentDecisionPoints - before; + WriteLine($"[ {character} ] 的节拍器兑现了战果:获得 {actual} 点决策点({before} → {dp.CurrentDecisionPoints} / {dp.MaxDecisionPoints})。"); + _待兑现 = 0; + } + } +} diff --git a/OshimaBot.Content/Items/Accessory/行军医箱.cs b/OshimaBot.Content/Items/Accessory/行军医箱.cs new file mode 100644 index 0000000..52d4a20 --- /dev/null +++ b/OshimaBot.Content/Items/Accessory/行军医箱.cs @@ -0,0 +1,236 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; +using OshimaBot.Content.Effects.PassiveEffects; +using OshimaBot.Content.Skills; + +namespace OshimaBot.Content.Items +{ + /// + /// 装备 · 饰品【行军医箱】—— 可携带的团队急救模块 + /// 设计意图:模组中角色的被动 / 爆发技几乎都为自身服务,缺少「跨角色监听」的辅助。 + /// 本装备把「监听队友受击 → 消耗自身能量急救」做成与穿戴者身份解耦的模块: + /// 任意角色穿上它都会临时成为队伍的治疗点,因此它可以随空投在不同角色之间流转。 + /// 触发:穿戴者为每名队友挂【巡诊标记】,标记以宿主身份收到 + /// 后转发给穿戴者;穿戴者消耗能量为其回血。 + /// 标尺(手册 §6.4 被动·回复 ≤2–3%/秒):Gold 档 10% 最大生命值 / 10 秒 ⇒ 约 1%/秒 ✓ + /// ⚠ 幂等约定:装备会被周期空投随时替换,因此 + /// 必须把挂在他人状态栏上的【巡诊标记】全部撤回, + /// 否则会残留成「幽灵治疗」。 + /// ⚠ 主动权约定:是否救援由装备持有者通过询问()决定。 + /// 询问的 DefaultChoice 用条件表达式计算——只有当持有者处于预释放爆发技状态、 + /// 且这次扣能量会让预释放付不起能量时,才默认「否」(门槛取「角色所有爆发技的最高门槛」作保守上界, + /// 见 );其余情况默认「是」。 + /// 「否」会作为 AI 托管 / 无人应答时的行为,也会成为玩家弹窗的默认高亮项。玩家拒绝不消耗冷却。 + /// + public abstract class 行军医箱 : Item + { + protected 行军医箱(Character? character, int 技能等级) : base(ItemType.Accessory) + { + Skills.Passives.Add(new 行军医箱技能(character, this) { Level = 技能等级 }); + } + + public override string Description => Skills.Passives.Count > 0 ? Skills.Passives.First().Description : ""; + + public override string BackgroundStory => "随军多年的旧式医疗箱,扣锁处还缠着一圈早已褪色的绷带。打开时会有温热的光晕沿着箱内的试剂管缓缓流转——只要队伍里还有人站着,它就不算用完。"; + } + + public class 行军医箱1 : 行军医箱 + { + public override long Id => (long)AccessoryID.行军医箱1; + public override string Name => "行军医箱 +4%"; + public override QualityType QualityType => QualityType.Orange; + + public 行军医箱1(Character? character = null) : base(character, 4) { } + } + + public class 行军医箱2 : 行军医箱 + { + public override long Id => (long)AccessoryID.行军医箱2; + public override string Name => "行军医箱 +7%"; + public override QualityType QualityType => QualityType.Red; + + public 行军医箱2(Character? character = null) : base(character, 7) { } + } + + public class 行军医箱3 : 行军医箱 + { + public override long Id => (long)AccessoryID.行军医箱3; + public override string Name => "行军医箱 +10%"; + public override QualityType QualityType => QualityType.Gold; + + public 行军医箱3(Character? character = null) : base(character, 10) { } + } + + public class 行军医箱技能 : Skill + { + public override long Id => (long)ItemPassiveID.行军医箱; + public override string Name => "行军医箱"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + + public 行军医箱技能(Character? character = null, Item? item = null) : base(SkillType.Passive, character) + { + Level = 4; // 最低档兜底;三档装备分别写入 4 / 7 / 10 + Item = item; + Effects.Add(new 行军医箱特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + /// + /// 【行军医箱】的控制器:常驻在穿戴者身上,负责维护队友身上的【巡诊标记】并执行急救。 + /// 冷却 / 能量状态集中在这里,因此多名队友同时受击时只有一次响应(救援成功后共享冷却)。 + /// 是否救援由穿戴者本人通过询问决定;拒绝不消耗冷却。 + /// + public class 行军医箱特效 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => + $"当生命值低于 {触发阈值 * 100:0}% 的队友受到伤害时,可由你决定是否消耗自身 {EP消耗:0.##} 点能量," + + $"为其回复 {回复系数 * 100:0.##}% 最大生命值(成功救援后 {冷却时间:0.##} {GameplayEquilibriumConstant.InGameTime}内不再响应)。"; + + public override EffectType EffectType => EffectType.Item; + + private double _剩余冷却 = 0; + + /// + /// 回复系数:等级 < 4 时取兜底 1%(低于最低档,正常用不到);否则等于技能等级 + /// (Orange 4 级 = 4%,Red 7 级 = 7%,Gold 10 级 = 10%) + /// + private double 回复系数 => Level < 4 ? 0.01 : Level * 0.01; + + /// 目标生命值低于该比例才响应 + private const double 触发阈值 = 0.5; + + /// 响应冷却(穿戴者共享,避免多名队友同时触发) + private const double 冷却时间 = 10; + + /// 每次响应消耗的能量,作为「急救要付出代价」的取舍点 + private const double EP消耗 = 20; + + public 行军医箱特效(Skill skill) : base(skill) + { + } + + private Character? 穿戴者 => Skill.Character; + + public override void OnEffectGained(HookContext ctx) + { + _剩余冷却 = 0; + // 开局前队列可能尚未就绪,真正的挂载交给 OnGameStart / OnTimeElapsed 兜底 + 发送标记(); + } + + public override void OnGameStart(HookContext ctx) + { + 发送标记(); + } + + public override void OnTimeElapsed(TimeLapseContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (穿戴者 is null || 穿戴者 != character) return; + if (_剩余冷却 > 0) _剩余冷却 = Math.Max(0, _剩余冷却 - ctx.Elapsed); + // 兜底:新入场 / 复活的队友补挂标记(内部去重) + 发送标记(); + } + + public override void OnEffectLost(HookContext ctx) + { + // 卸装 / 换装:必须把挂在他人状态栏上的标记全部撤回,保证幂等 + 撤回标记(); + } + + /// 为每名存活队友补挂【巡诊标记】(按本控制器的技能实例去重) + private void 发送标记() + { + Character? wearer = 穿戴者; + if (GamingQueue is null || wearer is null) return; + foreach (Character ally in GamingQueue.GetTeammates(wearer)) + { + if (ally.HP <= 0) continue; + if (ally.Effects.Any(e => e is 巡诊标记 m && m.Skill == Skill)) continue; + new 巡诊标记(Skill, wearer, this).AddToCharacter(ally); + } + } + + /// 撤回所有由本装备挂出的【巡诊标记】 + private void 撤回标记() + { + Character? wearer = 穿戴者; + if (GamingQueue is null || wearer is null) return; + List all = [.. GamingQueue.AllCharacters.Union(GamingQueue.Queue)]; + foreach (Character character in all) + { + List<巡诊标记> markers = [.. character.Effects.OfType<巡诊标记>().Where(m => m.Skill == Skill)]; + foreach (巡诊标记 marker in markers) + { + marker.RemoveFromCharacter(character); + } + } + } + + /// + /// 由【巡诊标记】转发:队友受击且跌破阈值时,向穿戴者发起询问,由其决定是否消耗能量急救。 + /// 询问的 DefaultChoice 用条件表达式计算——穿戴者处于预释放爆发技状态时为「否」, + /// 否则为「是」;它同时决定 AI 托管 / 无人应答时的实际行为,也是玩家弹窗的默认高亮项。 + /// 玩家拒绝不消耗冷却。 + /// + public bool TryEmergencyHeal(Character host) + { + Character? wearer = 穿戴者; + if (GamingQueue is null || wearer is null) return false; + if (wearer.HP <= 0 || host.HP <= 0) return false; + if (_剩余冷却 > 0) return false; + if (host.HP / Math.Max(1, host.MaxHP) >= 触发阈值) return false; + if (wearer.EP < EP消耗) return false; + double heal = host.MaxHP * 回复系数; + if (heal <= 0) return false; + + // 预释放期间:只有当这次扣能量真的会让预释放的爆发技付不起能量时,才默认保守(玩家仍可强行救援) + bool 危及预释放 = wearer.CharacterState == CharacterState.PreCastSuperSkill && !够付预释放门槛(wearer, EP消耗); + + InquiryResponse response = Inquiry(wearer, new InquiryOptions(InquiryType.BinaryChoice, nameof(行军医箱)) + { + Description = $"队友 [ {host} ] 生命值告急,是否消耗 {EP消耗:0.##} 点能量为其回复 {heal:0.##} 点生命值?" + + (危及预释放 ? "(警告:你正处于预释放爆发技状态,扣减能量将使该爆发技因能量不足而无法释放)" : ""), + DefaultChoice = 危及预释放 ? "否" : "是", + CanCancel = false + }); + + // 拒绝不消耗冷却,玩家可以连续拒绝而不被惩罚 + if (response.Choices.Count == 0 || response.Choices[0] != "是") return false; + + _剩余冷却 = 冷却时间; + wearer.EP -= EP消耗; + WriteLine($"[ {wearer} ] 展开了行军医箱,消耗 {EP消耗:0.##} 点能量,为 [ {host} ] 回复 {heal:0.##} 点生命值!"); + HealToTarget(wearer, host, heal); + return true; + } + + /// + /// 扣除 点能量后,是否仍付得起该角色任一爆发技的预释放门槛。 + /// Core 未公开预释放字典(_castingSuperSkills),因此这里对「角色所有爆发技」取最高门槛作为保守上界: + /// 只要上界付得起,无论预释放的是哪一个都不会失败。 + /// · 普通爆发技:门槛 = (即固定的 ) + /// · 型:真实门槛是 。 + /// 它的 RealEPCost 是 max(MinCostEP, 当前EP),跟着当前 EP 走,直接取会显著过估 + /// (例如 EP 150 时上界被算成 150,于是永远拒绝救援)。 + /// + private static bool 够付预释放门槛(Character wearer, double 消耗) + { + double 门槛 = wearer.Skills + .Where(s => s.SkillType == SkillType.SuperSkill) + .Select(s => s.CostAllEP ? s.MinCostEP : s.RealEPCost) + .DefaultIfEmpty(0) + .Max(); + return wearer.EP - 消耗 >= 门槛; + } + } +} diff --git a/OshimaBot.Content/Items/Armor/糖糖一周年纪念防具.cs b/OshimaBot.Content/Items/Armor/糖糖一周年纪念防具.cs new file mode 100644 index 0000000..5f136f3 --- /dev/null +++ b/OshimaBot.Content/Items/Armor/糖糖一周年纪念防具.cs @@ -0,0 +1,55 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.OpenEffects; +using OshimaBot.Content.Skills; + +namespace OshimaBot.Content.Items +{ + public class 糖糖一周年纪念防具 : Item + { + public override long Id => (long)ArmorID.糖糖一周年纪念防具; + public override string Name => "糖之誓约"; + public override string Description => $"{Skills.Passives.FirstOrDefault()?.Description}{(Skills.Active != null ? $"{Skills.Active.Name}:{Skills.Active.Description}" : "")}"; + public override string BackgroundStory => "及膝的米白色复古风衣,在光线下会泛起珍珠母贝般柔和的七彩光泽,如同撒上了一层极细的糖霜。"; + public override string Category => "糖糖一周年限定纪念物品"; + public override QualityType QualityType => QualityType.Gold; + + public 糖糖一周年纪念防具(Character? character = null) : base(ItemType.Armor) + { + Price = 0; + IsSellable = false; + IsTradable = false; + IsLock = true; + Skills.Active = new 神圣祝福复(character) + { + Level = 6 + }; + Skills.Passives.Add(new 糖糖一周年纪念防具技能(character, this)); + } + } + + public class 糖糖一周年纪念防具技能 : Skill + { + public override long Id => (long)ItemPassiveID.糖糖一周年纪念防具; + public override string Name => "糖之誓约"; + public override string Description => string.Join("", Effects.Select(e => e.Description)); + + private readonly double 物理护甲加成 = 180; + + public 糖糖一周年纪念防具技能(Character? character = null, Item? item = null) : base(SkillType.Passive, character) + { + Level = 1; + Item = item; + Dictionary values = new() + { + { "exdef", 物理护甲加成 } + }; + Effects.Add(new ExDEF(this, values, character)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } +} diff --git a/OshimaBot.Content/Items/Collectible/幸运物.cs b/OshimaBot.Content/Items/Collectible/幸运物.cs new file mode 100644 index 0000000..23237d6 --- /dev/null +++ b/OshimaBot.Content/Items/Collectible/幸运物.cs @@ -0,0 +1,349 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; + +namespace OshimaBot.Content.Items +{ + public class 青松() : Item(ItemType.Collectible) + { + public override long Id => (long)CollectibleID.青松; + public override string Name => nameof(青松); + public override string Description => "青松即使在风雪中也保持着生命的坚韧,象征着永不放弃的精神。"; + public override QualityType QualityType => QualityType.White; + } + + public class 流星石() : Item(ItemType.Collectible) + { + public override long Id => (long)CollectibleID.流星石; + public override string Name => nameof(流星石); + public override string Description => "据说,捕捉到流星的人,能实现一个愿望。不妨许下心愿,心诚则灵。"; + public override QualityType QualityType => QualityType.White; + } + + public class 向日葵() : Item(ItemType.Collectible) + { + public override long Id => (long)CollectibleID.向日葵; + public override string Name => nameof(向日葵); + public override string Description => "向日葵永远追随太阳,就像你的好运追随着你的每一步。"; + public override QualityType QualityType => QualityType.White; + } + + public class 金铃花() : Item(ItemType.Collectible) + { + public override long Id => (long)CollectibleID.金铃花; + public override string Name => nameof(金铃花); + public override string Description => "金铃花象征着辉煌与幸运,提醒你要抓住每一个闪光的时刻。"; + public override QualityType QualityType => QualityType.White; + } + + public class 琉璃珠() : Item(ItemType.Collectible) + { + public override long Id => (long)CollectibleID.琉璃珠; + public override string Name => nameof(琉璃珠); + public override string Description => "琉璃珠晶莹剔透,代表着纯净与希望,预示着你的好运将如彩虹般绚丽。"; + public override QualityType QualityType => QualityType.White; + } + + public class 鸣草() : Item(ItemType.Collectible) + { + public override long Id => (long)CollectibleID.鸣草; + public override string Name => nameof(鸣草); + public override string Description => "向往着雷神大人的青睐,只在稻妻列岛上生长。摘下鸣草时酥酥麻麻的触感,据说和幸福的滋味很像。"; + public override QualityType QualityType => QualityType.White; + } + + public class 马尾() : Item(ItemType.Collectible) + { + public override long Id => (long)CollectibleID.马尾; + public override string Name => nameof(马尾); + public override string Description => "马尾随大片荻草生长,但却更为挺拔。与傲然挺立于此世的你一定很是相配。"; + public override QualityType QualityType => QualityType.White; + } + + public class 鬼兜虫() : Item(ItemType.Collectible) + { + public override long Id => (long)CollectibleID.鬼兜虫; + public override string Name => nameof(鬼兜虫); + public override string Description => "鬼兜虫是爱好和平、不愿意争斗的小生物。这份追求平和的心一定能为你带来幸福吧。"; + public override QualityType QualityType => QualityType.White; + } + + public class 烈焰花花蕊() : Item(ItemType.Collectible) + { + public override long Id => (long)CollectibleID.烈焰花花蕊; + public override string Name => nameof(烈焰花花蕊); + public override string Description => "烈焰花的炙热来自于火辣辣的花心。万事顺利是因为心中自有一条明路。"; + public override QualityType QualityType => QualityType.White; + } + + public class 堇瓜() : Item(ItemType.Collectible) + { + public override long Id => (long)CollectibleID.堇瓜; + public override string Name => nameof(堇瓜); + public override string Description => "人们常说表里如一是美德,但堇瓜明艳的外貌下隐藏着的是谦卑而甘甜的内在。"; + public override QualityType QualityType => QualityType.White; + } + + public class 水晶球() : Item(ItemType.Collectible) + { + public override long Id => (long)CollectibleID.水晶球; + public override string Name => nameof(水晶球); + public override string Description => "水晶象征着纯净与洞察力,帮助你看清未来的路。"; + public override QualityType QualityType => QualityType.White; + } + + public class 薰衣草() : Item(ItemType.Collectible) + { + public override long Id => (long)CollectibleID.薰衣草; + public override string Name => nameof(薰衣草); + public override string Description => "薰衣草的香气能安抚心灵,象征着宁静与放松,提醒你要在忙碌中找到内心的平和。"; + public override QualityType QualityType => QualityType.White; + } + + public class 青石() : Item(ItemType.Collectible) + { + public override long Id => (long)CollectibleID.青石; + public override string Name => nameof(青石); + public override string Description => "青石虽不起眼,却象征着坚韧与持久,寓意着你脚踏实地的每一步都会累积成未来的成功。"; + public override QualityType QualityType => QualityType.White; + } + + public class 莲花() : Item(ItemType.Collectible) + { + public override long Id => (long)CollectibleID.莲花; + public override string Name => nameof(莲花); + public override string Description => "莲花在泥中绽放,象征着净化与重生,愿你心中平和坚定。"; + public override QualityType QualityType => QualityType.White; + } + + public class 陶罐() : Item(ItemType.Collectible) + { + public override long Id => (long)CollectibleID.陶罐; + public override string Name => nameof(陶罐); + public override string Description => "陶罐虽不起眼,却有着悠久的历史和稳定的实用性,寓意安稳平和。"; + public override QualityType QualityType => QualityType.White; + } + + public class 海灵芝() : Item(ItemType.Collectible) + { + public override long Id => (long)CollectibleID.海灵芝; + public override string Name => nameof(海灵芝); + public override string Description => "弱小的海灵芝虫经历多年的风风雨雨,才能结成海灵芝。为目标而努力前行的人们,最终也必将拥有胜利的果实。"; + public override QualityType QualityType => QualityType.White; + } + + public class 四叶草() : Item(ItemType.Collectible) + { + public override long Id => (long)CollectibleID.四叶草; + public override string Name => nameof(四叶草); + public override string Description => "四叶草的每一片叶子都代表着好运、健康、爱情和财富。带上一片四叶草,收获一整天的幸运吧。"; + public override QualityType QualityType => QualityType.White; + } + + public class 露珠() : Item(ItemType.Collectible) + { + public override long Id => (long)CollectibleID.露珠; + public override string Name => nameof(露珠); + public override string Description => "露珠是清晨的祝福,虽然短暂,但每一滴都晶莹剔透。"; + public override QualityType QualityType => QualityType.White; + } + + public class 茉莉花() : Item(ItemType.Collectible) + { + public override long Id => (long)CollectibleID.茉莉花; + public override string Name => nameof(茉莉花); + public override string Description => "茉莉花的香气淡雅而持久,给人宁静与舒适的感觉。"; + public override QualityType QualityType => QualityType.White; + } + + public class 绿萝() : Item(ItemType.Collectible) + { + public override long Id => (long)CollectibleID.绿萝; + public override string Name => nameof(绿萝); + public override string Description => "绿萝坚韧耐阴,象征着生命的顽强与希望,提醒你在平静中也能找到力量。"; + public override QualityType QualityType => QualityType.White; + } + + public class 檀木扇() : Item(ItemType.Collectible) + { + public override long Id => (long)CollectibleID.檀木扇; + public override string Name => nameof(檀木扇); + public override string Description => "檀木扇散发着淡雅的香气,象征着沉稳与内敛,让你在宁静中感受力量。"; + public override QualityType QualityType => QualityType.White; + } + + public class 鸟蛋() : Item(ItemType.Collectible) + { + public override long Id => (long)CollectibleID.鸟蛋; + public override string Name => nameof(鸟蛋); + public override string Description => "鸟蛋孕育着无限的可能性,是未来之种。反过来,这个世界对鸟蛋中的生命而言,也充满了令其兴奋的未知事物吧。要温柔对待鸟蛋喔。"; + public override QualityType QualityType => QualityType.White; + } + + public class 竹笋() : Item(ItemType.Collectible) + { + public override long Id => (long)CollectibleID.竹笋; + public override string Name => nameof(竹笋); + public override string Description => "竹笋拥有着无限的潜力,没有人知道一颗竹笋,到底能长成多高的竹子。看着竹笋,会让人不由自主期待起未来吧。"; + public override QualityType QualityType => QualityType.White; + } + + public class 晶核() : Item(ItemType.Collectible) + { + public override long Id => (long)CollectibleID.晶核; + public override string Name => nameof(晶核); + public override string Description => "晶蝶是凝聚天地间的元素,而长成的细小生物。而元素是这个世界许以天地当中的人们的祝福。"; + public override QualityType QualityType => QualityType.White; + } + + public class 手工围巾() : Item(ItemType.Collectible) + { + public override long Id => (long)CollectibleID.手工围巾; + public override string Name => nameof(手工围巾); + public override string Description => "手工围巾的每一针每一线都饱含着爱意,提醒你要珍惜眼前的人。"; + public override QualityType QualityType => QualityType.White; + } + + public class 柳条篮() : Item(ItemType.Collectible) + { + public override long Id => (long)CollectibleID.柳条篮; + public override string Name => nameof(柳条篮); + public override string Description => "柳条篮细密结实,寓意着人与人之间的深厚情感,提醒你珍惜生活中的点滴温情。"; + public override QualityType QualityType => QualityType.White; + } + + public class 风筝() : Item(ItemType.Collectible) + { + public override long Id => (long)CollectibleID.风筝; + public override string Name => nameof(风筝); + public override string Description => "风筝在天空中自由翱翔,提醒你即使在平凡的日子里,也要心怀梦想,勇敢飞翔。"; + public override QualityType QualityType => QualityType.White; + } + + public class 羽毛() : Item(ItemType.Collectible) + { + public override long Id => (long)CollectibleID.羽毛; + public override string Name => nameof(羽毛); + public override string Description => "羽毛虽轻,但象征着自由与轻盈,提醒你在轻松中前行。"; + public override QualityType QualityType => QualityType.White; + } + + public class 发光髓() : Item(ItemType.Collectible) + { + public override long Id => (long)CollectibleID.发光髓; + public override string Name => nameof(发光髓); + public override string Description => "发光髓努力地发出微弱的光芒。虽然比不过其他光源,但看清前路也够用了。"; + public override QualityType QualityType => QualityType.White; + } + + public class 紫罗兰() : Item(ItemType.Collectible) + { + public override long Id => (long)CollectibleID.紫罗兰; + public override string Name => nameof(紫罗兰); + public override string Description => "紫罗兰象征着谦逊和内在的力量,即使在逆境中也能默默绽放。"; + public override QualityType QualityType => QualityType.White; + } + + public class 松果() : Item(ItemType.Collectible) + { + public override long Id => (long)CollectibleID.松果; + public override string Name => nameof(松果); + public override string Description => "并不是所有的松果都能长成高大的松树,成长需要适宜的环境,更需要一点运气。所以不用给自己过多压力,耐心等待彩虹吧。"; + public override QualityType QualityType => QualityType.White; + } + + public class 电气水晶() : Item(ItemType.Collectible) + { + public override long Id => (long)CollectibleID.电气水晶; + public override string Name => nameof(电气水晶); + public override string Description => "电气水晶蕴含着无限的能量。如果能够好好导引这股能量,说不定就能成就什么事业。"; + public override QualityType QualityType => QualityType.White; + } + + public class 薄荷() : Item(ItemType.Collectible) + { + public override long Id => (long)CollectibleID.薄荷; + public override string Name => nameof(薄荷); + public override string Description => "只要有草木生长的空间,就一定有薄荷。这么看来,薄荷是世界上最强韧的生灵。据说连蒙德的雪山上也长着薄荷呢。"; + public override QualityType QualityType => QualityType.White; + } + + public class 竹节() : Item(ItemType.Collectible) + { + public override long Id => (long)CollectibleID.竹节; + public override string Name => nameof(竹节); + public override string Description => "竹节虽然看似脆弱,但却有着极强的韧性,提醒你在困难面前要保持坚毅的心态。"; + public override QualityType QualityType => QualityType.White; + } + + public class 铁砧() : Item(ItemType.Collectible) + { + public override long Id => (long)CollectibleID.铁砧; + public override string Name => nameof(铁砧); + public override string Description => "铁砧坚固无比,象征着在困境中保持坚强的信念,提醒你在风雨中不动摇。"; + public override QualityType QualityType => QualityType.White; + } + + public class 冰雾花() : Item(ItemType.Collectible) + { + public override long Id => (long)CollectibleID.冰雾花; + public override string Name => nameof(冰雾花); + public override string Description => "冰雾花散发着「生人勿进」的寒气。但有时冰冷的气质,也能让人的心情与头脑冷静下来。据此采取正确的判断,明智地行动。"; + public override QualityType QualityType => QualityType.White; + } + + public class 海草() : Item(ItemType.Collectible) + { + public override long Id => (long)CollectibleID.海草; + public override string Name => nameof(海草); + public override string Description => "海草是相当温柔而坚强的植物,即使在苦涩的海水中,也不愿改变自己。即使在逆境中,也不要放弃温柔的心灵。"; + public override QualityType QualityType => QualityType.White; + } + + public class 磐石() : Item(ItemType.Collectible) + { + public override long Id => (long)CollectibleID.磐石; + public override string Name => nameof(磐石); + public override string Description => "磐石虽沉重,但象征着稳定与耐心,今天你需要的正是这份定力。"; + public override QualityType QualityType => QualityType.White; + } + + public class 砂砾() : Item(ItemType.Collectible) + { + public override long Id => (long)CollectibleID.砂砾; + public override string Name => nameof(砂砾); + public override string Description => "砂砾虽微小,却是坚固大地的一部分,提醒你在困难中也要保持坚韧。"; + public override QualityType QualityType => QualityType.White; + } + + public class 铁甲贝壳() : Item(ItemType.Collectible) + { + public override long Id => (long)CollectibleID.铁甲贝壳; + public override string Name => nameof(铁甲贝壳); + public override string Description => "坚硬的外壳保护着脆弱的内心。有时适当的防护,能让你更加安全。"; + public override QualityType QualityType => QualityType.White; + } + + public class 蜥蜴尾巴() : Item(ItemType.Collectible) + { + public override long Id => (long)CollectibleID.蜥蜴尾巴; + public override string Name => nameof(蜥蜴尾巴); + public override string Description => "蜥蜴遇到潜在的危险时,大多数会断尾求生。若是遇到无法整理的情绪,那么该断则断吧。"; + public override QualityType QualityType => QualityType.White; + } + + public class 古老钟摆() : Item(ItemType.Collectible) + { + public override long Id => (long)CollectibleID.古老钟摆; + public override string Name => nameof(古老钟摆); + public override string Description => "尽管钟摆已停,但时间仍在前行。即使眼下步履维艰,也终会走出黑暗。"; + public override QualityType QualityType => QualityType.White; + } + + public class 枯藤() : Item(ItemType.Collectible) + { + public override long Id => (long)CollectibleID.枯藤; + public override string Name => nameof(枯藤); + public override string Description => "枯藤虽已失去生机,但春天的复苏指日可待,提醒你在低谷中也要坚守希望。"; + public override QualityType QualityType => QualityType.White; + } +} diff --git a/OshimaBot.Content/Items/Consumable/回复药.cs b/OshimaBot.Content/Items/Consumable/回复药.cs new file mode 100644 index 0000000..fd9675a --- /dev/null +++ b/OshimaBot.Content/Items/Consumable/回复药.cs @@ -0,0 +1,190 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.ItemEffects; +using OshimaBot.Content.Skills; + +namespace OshimaBot.Content.Items +{ + public class 回复药 + { + public interface HPRecovery + { + public double HP { get; set; } + } + + public static void Init(Item item, double hp, int remainUseTimes = 1, bool isPercentage = false) + { + item.Skills.Active = new 回复药技能(item, hp, isPercentage); + item.RemainUseTimes = remainUseTimes; + item.IsReduceTimesAfterUse = true; + item.IsRemoveAfterUse = true; + } + + public static string UseItem(User user, Item item, Character character) + { + if (item.Skills.Active != null) + { + item.Skills.Active.OnSkillCasted(user, [character]); + string msg = $"对角色 [ {character} ] 使用 [ {item.Name} ] 成功!"; + if (item is HPRecovery hpBook) + { + msg += $"回复了 {hpBook.HP} 点生命值!"; + } + return msg; + } + return "此物品没有主动技能,无法被使用!"; + } + + public static bool OnItemUsed(User user, Item item, int times, Dictionary args) + { + string msg = ""; + bool result = false; + Character[] targets = []; + string key = args.Keys.FirstOrDefault(s => s.Equals("targets", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key != "" && args.TryGetValue(key, out object? value) && value is Character[] temp) + { + if (temp.Length > 0) + { + targets = [temp[0]]; + msg = UseItem(user, item, temp[0]); + result = true; + } + else + { + msg = $"使用物品失败,没有作用目标!"; + } + } + args["msg"] = msg; + if (result) + { + key = args.Keys.FirstOrDefault(s => s.Equals("useCount", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key != "" && args.TryGetValue(key, out value) && value is int count && targets.Length > 0) + { + string truemsg = $"对角色 [ {targets[0]} ] 使用 {count} 个 [ {item.Name} ] 成功!"; + if (item is HPRecovery expBook) + { + truemsg += $"回复了 {expBook.HP * count} 点生命值!"; + } + args["truemsg"] = truemsg; + } + } + else + { + args["truemsg"] = msg; + } + return result; + } + } + + public class 小回复药 : Item, 回复药.HPRecovery + { + public override long Id => (long)ConsumableID.小回复药; + public override string Name => "小回复药"; + public override string Description => Skills.Active?.Description ?? ""; + public override QualityType QualityType => QualityType.White; + public double HP { get; set; } = 600; + + public 小回复药(User? user = null, int remainUseTimes = 1) : base(ItemType.Consumable) + { + User = user; + 回复药.Init(this, HP, remainUseTimes); + } + + protected override bool OnItemUsed(User user, int times, Dictionary args) + { + return 回复药.OnItemUsed(user, this, times, args); + } + } + + public class 中回复药 : Item, 回复药.HPRecovery + { + public override long Id => (long)ConsumableID.中回复药; + public override string Name => "中回复药"; + public override string Description => Skills.Active?.Description ?? ""; + public override QualityType QualityType => QualityType.Green; + public double HP { get; set; } = 1800; + + public 中回复药(User? user = null, int remainUseTimes = 1) : base(ItemType.Consumable) + { + User = user; + 回复药.Init(this, HP, remainUseTimes); + } + + protected override bool OnItemUsed(User user, int times, Dictionary args) + { + return 回复药.OnItemUsed(user, this, times, args); + } + } + + public class 大回复药 : Item, 回复药.HPRecovery + { + public override long Id => (long)ConsumableID.大回复药; + public override string Name => "大回复药"; + public override string Description => Skills.Active?.Description ?? ""; + public override QualityType QualityType => QualityType.Blue; + public double HP { get; set; } = 3000; + + public 大回复药(User? user = null, int remainUseTimes = 1) : base(ItemType.Consumable) + { + User = user; + 回复药.Init(this, HP, remainUseTimes); + } + + protected override bool OnItemUsed(User user, int times, Dictionary args) + { + return 回复药.OnItemUsed(user, this, times, args); + } + } + + public class 全回复药 : Item, 回复药.HPRecovery + { + public override long Id => (long)ConsumableID.全回复药; + public override string Name => "全回复药"; + public override string Description => Skills.Active?.Description ?? ""; + public override QualityType QualityType => QualityType.Purple; + public double HP { get; set; } = 1; + + public 全回复药(User? user = null, int remainUseTimes = 1) : base(ItemType.Consumable) + { + User = user; + 回复药.Init(this, HP, remainUseTimes, true); + } + + protected override bool OnItemUsed(User user, int times, Dictionary args) + { + return 回复药.OnItemUsed(user, this, times, args); + } + } + + public class 回复药技能 : Skill + { + public override long Id => (long)ItemActiveID.回复药; + public override string Name => "回复药"; + public override string Description => string.Join("", Effects.Select(e => e.Description)); + public override bool CanSelectSelf => true; + public override bool CanSelectTeammate => true; + public override bool CanSelectEnemy => false; + public override int CanSelectTargetCount => 1; + + public 回复药技能(Item? item = null, double hp = 0, bool isPercentage = false) : base(SkillType.Item) + { + Level = 1; + Item = item; + SelectTargetPredicates.Add(c => c.HP > 0 && c.HP < c.MaxHP); + if (!isPercentage) + { + Effects.Add(new RecoverHP(this, new() + { + { "hp", hp } + })); + } + else + { + Effects.Add(new RecoverHP2(this, new() + { + { "hp", hp } + })); + } + } + } +} diff --git a/OshimaBot.Content/Items/Consumable/复苏药.cs b/OshimaBot.Content/Items/Consumable/复苏药.cs new file mode 100644 index 0000000..77e8254 --- /dev/null +++ b/OshimaBot.Content/Items/Consumable/复苏药.cs @@ -0,0 +1,190 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.ItemEffects; +using OshimaBot.Content.Effects.SkillEffects; +using OshimaBot.Content.Skills; + +namespace OshimaBot.Content.Items +{ + public class 复苏药 + { + public interface HPRecovery + { + public double HP { get; set; } + } + + public static void Init(Item item, double hp, int remainUseTimes = 1, bool isPercentage = false) + { + item.Skills.Active = new 复苏药技能(item, hp, isPercentage); + item.RemainUseTimes = remainUseTimes; + item.IsReduceTimesAfterUse = true; + item.IsRemoveAfterUse = true; + } + + public static string UseItem(User user, Item item, Character character) + { + if (item.Skills.Active != null) + { + item.Skills.Active.OnSkillCasted(user, [character]); + string msg = $"对角色 [ {character} ] 使用 [ {item.Name} ] 成功!"; + if (item is HPRecovery hpBook) + { + msg += $"回复了 {hpBook.HP} 点生命值!"; + } + return msg; + } + return "此物品没有主动技能,无法被使用!"; + } + + public static bool OnItemUsed(User user, Item item, int times, Dictionary args) + { + string msg = ""; + bool result = false; + Character[] targets = []; + string key = args.Keys.FirstOrDefault(s => s.Equals("targets", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key != "" && args.TryGetValue(key, out object? value) && value is Character[] temp) + { + if (temp.Length > 0) + { + targets = [temp[0]]; + msg = UseItem(user, item, temp[0]); + result = true; + } + else + { + msg = $"使用物品失败,没有作用目标!"; + } + } + args["msg"] = msg; + if (result) + { + key = args.Keys.FirstOrDefault(s => s.Equals("useCount", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key != "" && args.TryGetValue(key, out value) && value is int count && targets.Length > 0) + { + string truemsg = $"对角色 [ {targets[0]} ] 使用 {count} 个 [ {item.Name} ] 成功!"; + if (item is HPRecovery expBook) + { + truemsg += $"回复了 {expBook.HP * count} 点生命值!"; + } + args["truemsg"] = truemsg; + } + } + else + { + args["truemsg"] = msg; + } + return result; + } + } + + public class 复苏药1 : Item, 复苏药.HPRecovery + { + public override long Id => (long)ConsumableID.复苏药1; + public override string Name => "复苏药"; + public override string Description => Skills.Active?.Description ?? ""; + public override QualityType QualityType => QualityType.Green; + public double HP { get; set; } = 500; + + public 复苏药1(User? user = null, int remainUseTimes = 1) : base(ItemType.Consumable) + { + User = user; + 复苏药.Init(this, HP, remainUseTimes); + } + + protected override bool OnItemUsed(User user, int times, Dictionary args) + { + return 复苏药.OnItemUsed(user, this, times, args); + } + } + + public class 复苏药2 : Item, 复苏药.HPRecovery + { + public override long Id => (long)ConsumableID.复苏药2; + public override string Name => "复苏药·改"; + public override string Description => Skills.Active?.Description ?? ""; + public override QualityType QualityType => QualityType.Blue; + public double HP { get; set; } = 2500; + + public 复苏药2(User? user = null, int remainUseTimes = 1) : base(ItemType.Consumable) + { + User = user; + 复苏药.Init(this, HP, remainUseTimes); + } + + protected override bool OnItemUsed(User user, int times, Dictionary args) + { + return 复苏药.OnItemUsed(user, this, times, args); + } + } + + public class 复苏药3 : Item, 复苏药.HPRecovery + { + public override long Id => (long)ConsumableID.复苏药3; + public override string Name => "复苏药·全"; + public override string Description => Skills.Active?.Description ?? ""; + public override QualityType QualityType => QualityType.Purple; + public double HP { get; set; } = 1; + + public 复苏药3(User? user = null, int remainUseTimes = 1) : base(ItemType.Consumable) + { + User = user; + 复苏药.Init(this, HP, remainUseTimes, true); + } + + protected override bool OnItemUsed(User user, int times, Dictionary args) + { + return 复苏药.OnItemUsed(user, this, times, args); + } + } + + public class 复苏药技能 : Skill + { + public override long Id => (long)ItemActiveID.复苏药; + public override string Name => "复苏药"; + public override string Description => string.Join("", Effects.Select(e => e.Description)); + public override bool SelectAllTeammates => _canSelectAllTeammates; + public override bool SelectAllEnemies => _canSelectAllEnemies; + public override bool CanSelectSelf => _canSelectSelf; + public override bool CanSelectTeammate => _canSelectTeammate; + public override bool CanSelectEnemy => _canSelectEnemy; + public override int CanSelectTargetCount => _canSelectCount; + public override bool AllowSelectDead => true; + + private readonly bool _canSelectAllTeammates; + private readonly bool _canSelectAllEnemies; + private readonly bool _canSelectSelf; + private readonly bool _canSelectTeammate; + private readonly bool _canSelectEnemy; + private readonly int _canSelectCount; + + public 复苏药技能(Item? item = null, double hp = 0, bool isPercentage = false, bool canSelectAllTeammates = false, bool canSelectAllEnemies = false, bool canSelectSelf = true, bool canSelectTeammate = true, bool canSelectEnemy = false, int canSelectCount = 1) : base(SkillType.Item) + { + Level = 1; + Item = item; + _canSelectAllTeammates = canSelectAllTeammates; + _canSelectAllEnemies = canSelectAllEnemies; + _canSelectSelf = canSelectSelf; + _canSelectTeammate = canSelectTeammate; + _canSelectEnemy = canSelectEnemy; + _canSelectCount = canSelectCount; + SelectTargetPredicates.Add(c => c.HP >= 0 && c.HP < c.MaxHP); + Effects.Add(new 强驱散特效(this)); + if (!isPercentage) + { + Effects.Add(new RecoverHP(this, new() + { + { "hp", hp }, + { "respawn", true } + })); + } + else + { + Effects.Add(new RecoverHP2(this, new() + { + { "hp", hp }, + { "respawn", true } + })); + } + } + } +} diff --git a/OshimaBot.Content/Items/Consumable/经验书.cs b/OshimaBot.Content/Items/Consumable/经验书.cs new file mode 100644 index 0000000..b056aca --- /dev/null +++ b/OshimaBot.Content/Items/Consumable/经验书.cs @@ -0,0 +1,160 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.ItemEffects; +using OshimaBot.Content.Skills; + +namespace OshimaBot.Content.Items +{ + public class 经验书 + { + public interface EXPBook + { + public double EXP { get; set; } + } + + public static void Init(Item item, double exp, int remainUseTimes = 1) + { + item.Skills.Active = new 经验书技能(item, exp); + item.RemainUseTimes = remainUseTimes; + item.IsInGameItem = false; + item.IsReduceTimesAfterUse = true; + item.IsRemoveAfterUse = true; + } + + public static string UseItem(User user, Item item, Character character) + { + if (item.Skills.Active != null) + { + item.Skills.Active.OnSkillCasted(user, [character]); + string msg = $"对角色 [ {character} ] 使用 [ {item.Name} ] 成功!"; + if (item is EXPBook expBook) + { + msg += $"获得了 {expBook.EXP} 点经验值!"; + } + return msg; + } + return "此物品没有主动技能,无法被使用!"; + } + + public static bool OnItemUsed(User user, Item item, int times, Dictionary args) + { + string msg = ""; + bool result = false; + Character[] targets = []; + string key = args.Keys.FirstOrDefault(s => s.Equals("targets", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key != "" && args.TryGetValue(key, out object? value) && value is Character[] temp) + { + if (temp.Length > 0) + { + targets = [temp[0]]; + msg = UseItem(user, item, temp[0]); + result = true; + } + else + { + msg = $"使用物品失败,没有作用目标!"; + } + } + args["msg"] = msg; + if (result) + { + key = args.Keys.FirstOrDefault(s => s.Equals("useCount", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key != "" && args.TryGetValue(key, out value) && value is int count && targets.Length > 0) + { + string truemsg = $"对角色 [ {targets[0]} ] 使用 {count} 个 [ {item.Name} ] 成功!"; + if (item is EXPBook expBook) + { + truemsg += $"获得了 {expBook.EXP * count} 点经验值!"; + } + args["truemsg"] = truemsg; + } + } + else + { + args["truemsg"] = msg; + } + return result; + } + } + + public class 小经验书 : Item, 经验书.EXPBook + { + public override long Id => (long)ConsumableID.小经验书; + public override string Name => "小经验书"; + public override string Description => Skills.Active?.Description ?? ""; + public override QualityType QualityType => QualityType.White; + public double EXP { get; set; } = 200; + + public 小经验书(User? user = null, int remainUseTimes = 1) : base(ItemType.Consumable) + { + User = user; + 经验书.Init(this, EXP, remainUseTimes); + } + + protected override bool OnItemUsed(User user, int times, Dictionary args) + { + return 经验书.OnItemUsed(user, this, times, args); + } + } + + public class 中经验书 : Item, 经验书.EXPBook + { + public override long Id => (long)ConsumableID.中经验书; + public override string Name => "中经验书"; + public override string Description => Skills.Active?.Description ?? ""; + public override QualityType QualityType => QualityType.Green; + public double EXP { get; set; } = 500; + + public 中经验书(User? user = null, int remainUseTimes = 1) : base(ItemType.Consumable) + { + User = user; + 经验书.Init(this, EXP, remainUseTimes); + } + + protected override bool OnItemUsed(User user, int times, Dictionary args) + { + return 经验书.OnItemUsed(user, this, times, args); + } + } + + public class 大经验书 : Item, 经验书.EXPBook + { + public override long Id => (long)ConsumableID.大经验书; + public override string Name => "大经验书"; + public override string Description => Skills.Active?.Description ?? ""; + public override QualityType QualityType => QualityType.Blue; + public double EXP { get; set; } = 1000; + + public 大经验书(User? user = null, int remainUseTimes = 1) : base(ItemType.Consumable) + { + User = user; + 经验书.Init(this, EXP, remainUseTimes); + } + + protected override bool OnItemUsed(User user, int times, Dictionary args) + { + return 经验书.OnItemUsed(user, this, times, args); + } + } + + public class 经验书技能 : Skill + { + public override long Id => (long)ItemActiveID.经验书; + public override string Name => "经验书"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override bool CanSelectSelf => true; + public override bool CanSelectTeammate => true; + public override bool CanSelectEnemy => false; + public override int CanSelectTargetCount => 1; + + public 经验书技能(Item? item = null, double exp = 0) : base(SkillType.Item) + { + Level = 1; + Item = item; + Effects.Add(new GetEXP(this, new() + { + { "exp", exp } + })); + } + } +} diff --git a/OshimaBot.Content/Items/Consumable/能量饮料.cs b/OshimaBot.Content/Items/Consumable/能量饮料.cs new file mode 100644 index 0000000..97fd3c1 --- /dev/null +++ b/OshimaBot.Content/Items/Consumable/能量饮料.cs @@ -0,0 +1,159 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.ItemEffects; +using OshimaBot.Content.Skills; + +namespace OshimaBot.Content.Items +{ + public class 能量饮料 + { + public interface EPAdd + { + public double EP { get; set; } + } + + public static void Init(Item item, double ep, int remainUseTimes = 1) + { + item.Skills.Active = new 能量饮料技能(item, ep); + item.RemainUseTimes = remainUseTimes; + item.IsReduceTimesAfterUse = true; + item.IsRemoveAfterUse = true; + } + + public static string UseItem(User user, Item item, Character character) + { + if (item.Skills.Active != null) + { + item.Skills.Active.OnSkillCasted(user, [character]); + string msg = $"对角色 [ {character} ] 使用 [ {item.Name} ] 成功!"; + if (item is EPAdd hpBook) + { + msg += $"获得了 {hpBook.EP} 点能量值!"; + } + return msg; + } + return "此物品没有主动技能,无法被使用!"; + } + + public static bool OnItemUsed(User user, Item item, int times, Dictionary args) + { + string msg = ""; + bool result = false; + Character[] targets = []; + string key = args.Keys.FirstOrDefault(s => s.Equals("targets", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key != "" && args.TryGetValue(key, out object? value) && value is Character[] temp) + { + if (temp.Length > 0) + { + targets = [temp[0]]; + msg = UseItem(user, item, temp[0]); + result = true; + } + else + { + msg = $"使用物品失败,没有作用目标!"; + } + } + args["msg"] = msg; + if (result) + { + key = args.Keys.FirstOrDefault(s => s.Equals("useCount", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key != "" && args.TryGetValue(key, out value) && value is int count && targets.Length > 0) + { + string truemsg = $"对角色 [ {targets[0]} ] 使用 {count} 个 [ {item.Name} ] 成功!"; + if (item is EPAdd expBook) + { + truemsg += $"获得了 {expBook.EP * count} 点能量值!"; + } + args["truemsg"] = truemsg; + } + } + else + { + args["truemsg"] = msg; + } + return result; + } + } + + public class 能量饮料1 : Item, 能量饮料.EPAdd + { + public override long Id => (long)ConsumableID.能量饮料1; + public override string Name => "能量饮料"; + public override string Description => Skills.Active?.Description ?? ""; + public override QualityType QualityType => QualityType.Green; + public double EP { get; set; } = 50; + + public 能量饮料1(User? user = null, int remainUseTimes = 1) : base(ItemType.Consumable) + { + User = user; + 能量饮料.Init(this, EP, remainUseTimes); + } + + protected override bool OnItemUsed(User user, int times, Dictionary args) + { + return 能量饮料.OnItemUsed(user, this, times, args); + } + } + + public class 能量饮料2 : Item, 能量饮料.EPAdd + { + public override long Id => (long)ConsumableID.能量饮料2; + public override string Name => "能量饮料 Pro"; + public override string Description => Skills.Active?.Description ?? ""; + public override QualityType QualityType => QualityType.Blue; + public double EP { get; set; } = 100; + + public 能量饮料2(User? user = null, int remainUseTimes = 1) : base(ItemType.Consumable) + { + User = user; + 能量饮料.Init(this, EP, remainUseTimes); + } + + protected override bool OnItemUsed(User user, int times, Dictionary args) + { + return 能量饮料.OnItemUsed(user, this, times, args); + } + } + + public class 能量饮料3 : Item, 能量饮料.EPAdd + { + public override long Id => (long)ConsumableID.能量饮料3; + public override string Name => "能量饮料 Pro Max"; + public override string Description => Skills.Active?.Description ?? ""; + public override QualityType QualityType => QualityType.Purple; + public double EP { get; set; } = 200; + + public 能量饮料3(User? user = null, int remainUseTimes = 1) : base(ItemType.Consumable) + { + User = user; + 能量饮料.Init(this, EP, remainUseTimes); + } + + protected override bool OnItemUsed(User user, int times, Dictionary args) + { + return 能量饮料.OnItemUsed(user, this, times, args); + } + } + + public class 能量饮料技能 : Skill + { + public override long Id => (long)ItemActiveID.能量饮料; + public override string Name => "能量饮料"; + public override string Description => string.Join("", Effects.Select(e => e.Description)); + public override bool CanSelectSelf => true; + public override bool CanSelectTeammate => true; + public override bool CanSelectEnemy => false; + public override int CanSelectTargetCount => 1; + + public 能量饮料技能(Item? item = null, double ep = 0) : base(SkillType.Item) + { + Level = 1; + Item = item; + Effects.Add(new GetEP(this, new() + { + { "ep", ep } + })); + } + } +} diff --git a/OshimaBot.Content/Items/Consumable/魔力填充剂.cs b/OshimaBot.Content/Items/Consumable/魔力填充剂.cs new file mode 100644 index 0000000..0e656ef --- /dev/null +++ b/OshimaBot.Content/Items/Consumable/魔力填充剂.cs @@ -0,0 +1,169 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.ItemEffects; +using OshimaBot.Content.Skills; + +namespace OshimaBot.Content.Items +{ + public class 魔力填充剂 + { + public interface MPRecovery + { + public double MP { get; set; } + } + + public static void Init(Item item, double mp, int remainUseTimes = 1, bool isPercentage = false) + { + item.Skills.Active = new 魔力填充剂技能(item, mp, isPercentage); + item.RemainUseTimes = remainUseTimes; + item.IsReduceTimesAfterUse = true; + item.IsRemoveAfterUse = true; + } + + public static string UseItem(User user, Item item, Character character) + { + if (item.Skills.Active != null) + { + item.Skills.Active.OnSkillCasted(user, [character]); + string msg = $"对角色 [ {character} ] 使用 [ {item.Name} ] 成功!"; + if (item is MPRecovery hpBook) + { + msg += $"回复了 {hpBook.MP} 点魔法值!"; + } + return msg; + } + return "此物品没有主动技能,无法被使用!"; + } + + public static bool OnItemUsed(User user, Item item, int times, Dictionary args) + { + string msg = ""; + bool result = false; + Character[] targets = []; + string key = args.Keys.FirstOrDefault(s => s.Equals("targets", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key != "" && args.TryGetValue(key, out object? value) && value is Character[] temp) + { + if (temp.Length > 0) + { + targets = [temp[0]]; + msg = UseItem(user, item, temp[0]); + result = true; + } + else + { + msg = $"使用物品失败,没有作用目标!"; + } + } + args["msg"] = msg; + if (result) + { + key = args.Keys.FirstOrDefault(s => s.Equals("useCount", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key != "" && args.TryGetValue(key, out value) && value is int count && targets.Length > 0) + { + string truemsg = $"对角色 [ {targets[0]} ] 使用 {count} 个 [ {item.Name} ] 成功!"; + if (item is MPRecovery expBook) + { + truemsg += $"回复了 {expBook.MP * count} 点魔法值!"; + } + args["truemsg"] = truemsg; + } + } + else + { + args["truemsg"] = msg; + } + return result; + } + } + + public class 魔力填充剂1 : Item, 魔力填充剂.MPRecovery + { + public override long Id => (long)ConsumableID.魔力填充剂1; + public override string Name => "魔力填充剂Ⅰ型"; + public override string Description => Skills.Active?.Description ?? ""; + public override QualityType QualityType => QualityType.White; + public double MP { get; set; } = 300; + + public 魔力填充剂1(User? user = null, int remainUseTimes = 1) : base(ItemType.Consumable) + { + User = user; + 魔力填充剂.Init(this, MP, remainUseTimes); + } + + protected override bool OnItemUsed(User user, int times, Dictionary args) + { + return 魔力填充剂.OnItemUsed(user, this, times, args); + } + } + + public class 魔力填充剂2 : Item, 魔力填充剂.MPRecovery + { + public override long Id => (long)ConsumableID.魔力填充剂2; + public override string Name => "魔力填充剂Ⅱ型"; + public override string Description => Skills.Active?.Description ?? ""; + public override QualityType QualityType => QualityType.Green; + public double MP { get; set; } = 700; + + public 魔力填充剂2(User? user = null, int remainUseTimes = 1) : base(ItemType.Consumable) + { + User = user; + 魔力填充剂.Init(this, MP, remainUseTimes); + } + + protected override bool OnItemUsed(User user, int times, Dictionary args) + { + return 魔力填充剂.OnItemUsed(user, this, times, args); + } + } + + public class 魔力填充剂3 : Item, 魔力填充剂.MPRecovery + { + public override long Id => (long)ConsumableID.魔力填充剂3; + public override string Name => "魔力填充剂Ⅲ型"; + public override string Description => Skills.Active?.Description ?? ""; + public override QualityType QualityType => QualityType.Blue; + public double MP { get; set; } = 1500; + + public 魔力填充剂3(User? user = null, int remainUseTimes = 1) : base(ItemType.Consumable) + { + User = user; + 魔力填充剂.Init(this, MP, remainUseTimes); + } + + protected override bool OnItemUsed(User user, int times, Dictionary args) + { + return 魔力填充剂.OnItemUsed(user, this, times, args); + } + } + + public class 魔力填充剂技能 : Skill + { + public override long Id => (long)ItemActiveID.魔力填充剂; + public override string Name => "魔力填充剂"; + public override string Description => string.Join("", Effects.Select(e => e.Description)); + public override bool CanSelectSelf => true; + public override bool CanSelectTeammate => true; + public override bool CanSelectEnemy => false; + public override int CanSelectTargetCount => 1; + + public 魔力填充剂技能(Item? item = null, double mp = 0, bool isPercentage = false) : base(SkillType.Item) + { + Level = 1; + Item = item; + if (!isPercentage) + { + Effects.Add(new RecoverMP(this, new() + { + { "mp", mp } + })); + } + else + { + Effects.Add(new RecoverMP2(this, new() + { + { "mp", mp } + })); + } + } + } +} diff --git a/OshimaBot.Content/Items/GiftBox/礼包.cs b/OshimaBot.Content/Items/GiftBox/礼包.cs new file mode 100644 index 0000000..1ce6df8 --- /dev/null +++ b/OshimaBot.Content/Items/GiftBox/礼包.cs @@ -0,0 +1,363 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Skills; + +namespace OshimaBot.Content.Items +{ + public class 礼包 + { + public interface GiftBox + { + public Dictionary Gifts { get; set; } + } + + public static void Init(Item item, Dictionary gifts, int remainUseTimes = 1) + { + if (item is GiftBox box) + { + box.Gifts = gifts; + } + item.Skills.Active = new 礼包技能(item); + item.RemainUseTimes = remainUseTimes; + item.IsInGameItem = false; + item.IsReduceTimesAfterUse = true; + item.IsRemoveAfterUse = true; + } + + public static bool OnItemUsed(User user, Item item, int times, Dictionary args) + { + string msg = ""; + if (item is GiftBox box) + { + + } + args["msg"] = msg; + return msg.Trim() != ""; + } + } + + public class 年夜饭 : Item, 礼包.GiftBox + { + public override long Id => (long)GiftBoxID.年夜饭; + public override string Name => "年夜饭"; + public override string Description => Skills.Active?.Description ?? ""; + public override QualityType QualityType => QualityType.White; + public Dictionary Gifts { get; set; } = []; + + public 年夜饭(User? user = null, int remainUseTimes = 1) : base(ItemType.GiftBox) + { + User = user; + 礼包.Init(this, new() + { + { General.GameplayEquilibriumConstant.InGameCurrency, 100000 }, + { General.GameplayEquilibriumConstant.InGameMaterial, 2000 }, + { new 技能卷轴().Name, 20 }, + { new 升华之印().Name, 20 }, + { new 流光之印().Name, 10 }, + { new 大经验书().Name, 20 }, + { new 大回复药().Name, 5 }, + { new 魔力填充剂3().Name, 5 }, + { new 能量饮料3().Name, 5 } + }, remainUseTimes); + } + + protected override bool OnItemUsed(User user, int times, Dictionary args) + { + return 礼包.OnItemUsed(user, this, times, args); + } + } + + public class 蛇年大吉 : Item, 礼包.GiftBox + { + public override long Id => (long)GiftBoxID.蛇年大吉; + public override string Name => "蛇年大吉"; + public override string Description => Skills.Active?.Description ?? ""; + public override QualityType QualityType => QualityType.White; + public Dictionary Gifts { get; set; } = []; + + public 蛇年大吉(User? user = null, int remainUseTimes = 1) : base(ItemType.GiftBox) + { + User = user; + 礼包.Init(this, new() + { + { General.GameplayEquilibriumConstant.InGameCurrency, 88888 }, + { General.GameplayEquilibriumConstant.InGameMaterial, 888 }, + { new 技能卷轴().Name, 20 }, + { new 智慧之果().Name, 10 }, + { new 奥术符文().Name, 5 }, + { new 混沌之核().Name, 3 }, + { new 升华之印().Name, 20 }, + { new 流光之印().Name, 10 }, + { new 永恒之印().Name, 3 }, + { new 大经验书().Name, 20 } + }, remainUseTimes); + } + + protected override bool OnItemUsed(User user, int times, Dictionary args) + { + return 礼包.OnItemUsed(user, this, times, args); + } + } + + public class 新春快乐 : Item, 礼包.GiftBox + { + public override long Id => (long)GiftBoxID.新春快乐; + public override string Name => "新春快乐"; + public override string Description => Skills.Active?.Description ?? ""; + public override QualityType QualityType => QualityType.White; + public Dictionary Gifts { get; set; } = []; + + public 新春快乐(User? user = null, int remainUseTimes = 1) : base(ItemType.GiftBox) + { + User = user; + 礼包.Init(this, new() + { + { General.GameplayEquilibriumConstant.InGameCurrency, 100000 }, + { General.GameplayEquilibriumConstant.InGameMaterial, 2000 }, + { new 技能卷轴().Name, 20 }, + { new 升华之印().Name, 20 }, + { new 流光之印().Name, 10 }, + { new 大经验书().Name, 20 }, + { new 大回复药().Name, 5 }, + { new 魔力填充剂3().Name, 5 }, + { new 能量饮料3().Name, 5 } + }, remainUseTimes); + } + + protected override bool OnItemUsed(User user, int times, Dictionary args) + { + return 礼包.OnItemUsed(user, this, times, args); + } + } + + public class 毕业礼包 : Item, 礼包.GiftBox + { + public override long Id => (long)GiftBoxID.毕业礼包; + public override string Name => "毕业礼包"; + public override string Description => Skills.Active?.Description ?? ""; + public override QualityType QualityType => QualityType.Gold; + public Dictionary Gifts { get; set; } = []; + + public 毕业礼包(User? user = null, int remainUseTimes = 1) : base(ItemType.GiftBox) + { + User = user; + 礼包.Init(this, new() + { + { General.GameplayEquilibriumConstant.InGameCurrency, 667000 }, + { General.GameplayEquilibriumConstant.InGameMaterial, 6450 }, + { new 升华之印().Name, 126 }, + { new 流光之印().Name, 62 }, + { new 永恒之印().Name, 45 }, + { new 原初之印().Name, 35 }, + { new 创生之印().Name, 15 }, + { new 技能卷轴().Name, 190 }, + { new 智慧之果().Name, 94 }, + { new 奥术符文().Name, 68 }, + { new 混沌之核().Name, 42 }, + { new 法则精粹().Name, 22 }, + { new 大经验书().Name, 164 } + }, remainUseTimes); + } + } + + public class 魔法卡礼包 : Item, 礼包.GiftBox + { + public override long Id => (long)GiftBoxID.魔法卡礼包; + public override string Name => $"{ItemSet.GetQualityTypeName(QualityType)}魔法卡礼包"; + public override string Description => Skills.Active?.Description ?? ""; + public int Count { get; set; } = 1; + public Dictionary Gifts { get; set; } = []; + private const string GiftName = "与礼包同品质、随机属性、随机魔法技能的魔法卡"; + + public 魔法卡礼包(QualityType type = QualityType.White, int count = 1, User? user = null, int remainUseTimes = 1) : base(ItemType.GiftBox) + { + QualityType = type; + Others.Add("QualityType", (int)type); + Count = count; + Others.Add("Count", count); + User = user; + 礼包.Init(this, new() + { + { GiftName, count } + }, remainUseTimes); + } + + protected override void AfterCopy() + { + if (Others.TryGetValue("QualityType", out object? value) && int.TryParse(value.ToString(), out int qualityType)) + { + QualityType = (QualityType)qualityType; + } + if (Others.TryGetValue("Count", out value) && int.TryParse(value.ToString(), out int count)) + { + Count = count; + Gifts[GiftName] = count; + } + } + } + + public class 探索助力礼包 : Item, 礼包.GiftBox + { + public override long Id => (long)GiftBoxID.探索助力礼包; + public override string Name => "探索助力礼包"; + public override string Description => Skills.Active?.Description ?? ""; + public override QualityType QualityType => QualityType.White; + public Dictionary Gifts { get; set; } = []; + + public 探索助力礼包(User? user = null, int remainUseTimes = 1) : base(ItemType.GiftBox) + { + User = user; + 礼包.Init(this, new() + { + { General.GameplayEquilibriumConstant.InGameCurrency, 20000 }, + { General.GameplayEquilibriumConstant.InGameMaterial, 50 }, + { new 升华之印().Name, 20 }, + { new 技能卷轴().Name, 20 }, + }, remainUseTimes); + } + } + + public class 一周年纪念礼包 : Item, 礼包.GiftBox + { + public override long Id => (long)GiftBoxID.一周年纪念礼包; + public override string Name => "一周年纪念礼包"; + public override string Description => Skills.Active?.Description ?? ""; + public override QualityType QualityType => QualityType.White; + public Dictionary Gifts { get; set; } = []; + + public 一周年纪念礼包(User? user = null, int remainUseTimes = 1) : base(ItemType.GiftBox) + { + Price = 0; + IsSellable = false; + IsTradable = false; + IsLock = true; + User = user; + 礼包.Init(this, new() + { + { General.GameplayEquilibriumConstant.InGameCurrency, 50000 }, + { General.GameplayEquilibriumConstant.InGameMaterial, 100 }, + { new 一周年纪念套装().Name, 1 } + }, remainUseTimes); + } + } + + public class 一周年纪念套装 : Item, 礼包.GiftBox + { + public override long Id => (long)GiftBoxID.一周年纪念套装; + public override string Name => "一周年纪念套装"; + public override string Description => Skills.Active?.Description ?? ""; + public override QualityType QualityType => QualityType.Gold; + public Dictionary Gifts { get; set; } = []; + + public 一周年纪念套装(User? user = null, int remainUseTimes = 1) : base(ItemType.GiftBox) + { + Price = 0; + IsSellable = false; + IsTradable = false; + IsLock = true; + User = user; + 礼包.Init(this, new() + { + { new 糖糖一周年纪念武器().Name, 1 }, + { new 糖糖一周年纪念防具().Name, 1 }, + { new 糖糖一周年纪念鞋子().Name, 1 }, + { new 糖糖一周年纪念饰品1().Name, 1 }, + { new 糖糖一周年纪念饰品2().Name, 1 } + }, remainUseTimes); + } + } + + public class 冬至快乐 : Item, 礼包.GiftBox + { + public override long Id => (long)GiftBoxID.冬至快乐; + public override string Name => "冬至快乐"; + public override string Description => Skills.Active?.Description ?? ""; + public override QualityType QualityType => QualityType.White; + public Dictionary Gifts { get; set; } = []; + + public 冬至快乐(User? user = null, int remainUseTimes = 1) : base(ItemType.GiftBox) + { + User = user; + 礼包.Init(this, new() + { + { General.GameplayEquilibriumConstant.InGameCurrency, 40000 }, + { General.GameplayEquilibriumConstant.InGameMaterial, 500 }, + { new 魔法卡礼包(QualityType.Orange, 5).Name, 5 } + }, remainUseTimes); + } + } + + public class 圣诞礼包 : Item, 礼包.GiftBox + { + public override long Id => (long)GiftBoxID.圣诞礼包; + public override string Name => "圣诞礼包"; + public override string Description => Skills.Active?.Description ?? ""; + public override QualityType QualityType => QualityType.White; + public Dictionary Gifts { get; set; } = []; + + public 圣诞礼包(User? user = null, int remainUseTimes = 1) : base(ItemType.GiftBox) + { + User = user; + 礼包.Init(this, new() + { + { General.GameplayEquilibriumConstant.InGameCurrency, 10000 }, + { General.GameplayEquilibriumConstant.InGameMaterial, 100 }, + { "YukiのCalfSocks-圣诞限定", 1 } + }, remainUseTimes); + } + + protected override bool OnItemUsed(User user, int times, Dictionary args) + { + return 礼包.OnItemUsed(user, this, times, args); + } + } + + public class 元旦快乐 : Item, 礼包.GiftBox + { + public override long Id => (long)GiftBoxID.元旦快乐; + public override string Name => "元旦快乐"; + public override string Description => Skills.Active?.Description ?? ""; + public override QualityType QualityType => QualityType.White; + public Dictionary Gifts { get; set; } = []; + + public 元旦快乐(User? user = null, int remainUseTimes = 1) : base(ItemType.GiftBox) + { + User = user; + 礼包.Init(this, new() + { + { General.GameplayEquilibriumConstant.InGameCurrency, 40000 }, + { General.GameplayEquilibriumConstant.InGameMaterial, 500 }, + { new 魔法卡礼包(QualityType.Orange, 5).Name, 5 }, + { new 魔法卡礼包(QualityType.Red, 2).Name, 2 } + }, remainUseTimes); + } + + protected override bool OnItemUsed(User user, int times, Dictionary args) + { + return 礼包.OnItemUsed(user, this, times, args); + } + } + + public class 礼包技能 : Skill + { + public override long Id => (long)ItemActiveID.礼包; + public override string Name => "礼包"; + public override string Description + { + get + { + if (Item is 礼包.GiftBox box && box.Gifts.Count > 0) + { + return "打开后可立即获得:" + string.Join(",", box.Gifts.Select(kv => $"{kv.Key} * {kv.Value}")); + } + return ""; + } + } + + public 礼包技能(Item? item = null) : base(SkillType.Item) + { + Level = 1; + Item = item; + } + } +} diff --git a/OshimaBot.Content/Items/ItemID.cs b/OshimaBot.Content/Items/ItemID.cs new file mode 100644 index 0000000..dafd205 --- /dev/null +++ b/OshimaBot.Content/Items/ItemID.cs @@ -0,0 +1,153 @@ +namespace OshimaBot.Content.Items +{ + public enum WeaponID : long + { + 糖糖一周年纪念武器 = 11001, + 独奏弓 = 11002 + } + + public enum ArmorID : long + { + 糖糖一周年纪念防具 = 12001 + } + + public enum ShoesID : long + { + 糖糖一周年纪念鞋子 = 13001 + } + + public enum AccessoryID : long + { + 攻击之爪10 = 14001, + 攻击之爪25 = 14002, + 攻击之爪40 = 14003, + 攻击之爪55 = 14004, + 攻击之爪70 = 14005, + 攻击之爪85 = 14006, + 攻击之爪100 = 14007, + 糖糖一周年纪念饰品1 = 14008, + 糖糖一周年纪念饰品2 = 14009, + 行军医箱1 = 14010, + 行军医箱2 = 14011, + 行军医箱3 = 14012, + 共鸣核心1 = 14013, + 共鸣核心2 = 14014, + 共鸣核心3 = 14015, + 接力信标1 = 14016, + 接力信标2 = 14017, + 接力信标3 = 14018, + 应急装置1 = 14019, + 应急装置2 = 14020, + 应急装置3 = 14021, + // —— 节奏维度(2026-09-23 新增)—— + 万能钥匙1 = 14022, + 万能钥匙2 = 14023, + 万能钥匙3 = 14024, + 节拍器1 = 14025, + 节拍器2 = 14026, + 节拍器3 = 14027 + } + + public enum ConsumableID : long + { + 小经验书 = 15001, + 中经验书 = 15002, + 大经验书 = 15003, + 小回复药 = 15004, + 中回复药 = 15005, + 大回复药 = 15006, + 魔力填充剂1 = 15007, + 魔力填充剂2 = 15008, + 魔力填充剂3 = 15009, + 能量饮料1 = 15010, + 能量饮料2 = 15011, + 能量饮料3 = 15012, + 复苏药1 = 15013, + 复苏药2 = 15014, + 复苏药3 = 15015, + 全回复药 = 15016 + } + + public enum CollectibleID + { + 青松 = 17001, + 流星石 = 17002, + 向日葵 = 17003, + 金铃花 = 17004, + 琉璃珠 = 17005, + 鸣草 = 17006, + 马尾 = 17007, + 鬼兜虫 = 17008, + 烈焰花花蕊 = 17009, + 堇瓜 = 17010, + 水晶球 = 17011, + 薰衣草 = 17012, + 青石 = 17013, + 莲花 = 17014, + 陶罐 = 17015, + 海灵芝 = 17016, + 四叶草 = 17017, + 露珠 = 17018, + 茉莉花 = 17019, + 绿萝 = 17020, + 檀木扇 = 17021, + 鸟蛋 = 17022, + 竹笋 = 17023, + 晶核 = 17024, + 手工围巾 = 17025, + 柳条篮 = 17026, + 风筝 = 17027, + 羽毛 = 17028, + 发光髓 = 17029, + 紫罗兰 = 17030, + 松果 = 17031, + 电气水晶 = 17032, + 薄荷 = 17033, + 竹节 = 17034, + 铁砧 = 17035, + 冰雾花 = 17036, + 海草 = 17037, + 磐石 = 17038, + 砂砾 = 17039, + 铁甲贝壳 = 17040, + 蜥蜴尾巴 = 17041, + 古老钟摆 = 17042, + 枯藤 = 17043 + } + + public enum SpecialItemID : long + { + 升华之印 = 18001, + 流光之印 = 18002, + 永恒之印 = 18003, + 技能卷轴 = 18004, + 智慧之果 = 18005, + 奥术符文 = 18006, + 混沌之核 = 18007, + 奖券 = 18008, + 十连奖券 = 18009, + 改名卡 = 18010, + 原初之印 = 18011, + 创生之印 = 18012, + 法则精粹 = 18013, + 大师锻造券 = 18014, + 钻石 = 18998, + 探索许可 = 18999 + } + + public enum GiftBoxID : long + { + 年夜饭 = 20001, + 蛇年大吉 = 20002, + 新春快乐 = 20003, + 毕业礼包 = 20004, + 魔法卡礼包 = 20005, + 探索助力礼包 = 20006, + 一周年纪念礼包 = 20007, + 一周年纪念套装 = 20008, + 冬至快乐 = 20009, + 圣诞礼包 = 20010, + 元旦快乐 = 20011, + 马年大吉 = 20012 + } +} diff --git a/OshimaBot.Content/Items/Shoes/糖糖一周年纪念鞋子.cs b/OshimaBot.Content/Items/Shoes/糖糖一周年纪念鞋子.cs new file mode 100644 index 0000000..a2cc773 --- /dev/null +++ b/OshimaBot.Content/Items/Shoes/糖糖一周年纪念鞋子.cs @@ -0,0 +1,61 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.OpenEffects; +using OshimaBot.Content.Skills; + +namespace OshimaBot.Content.Items +{ + public class 糖糖一周年纪念鞋子 : Item + { + public override long Id => (long)ShoesID.糖糖一周年纪念鞋子; + public override string Name => "蜜步流心"; + public override string Description => $"{Skills.Passives.FirstOrDefault()?.Description}{(Skills.Active != null ? $"{Skills.Active.Name}:{Skills.Active.Description}" : "")}"; + public override string BackgroundStory => "一双棕色及踝短靴,靴面有蜂窝状暗纹,靴底内嵌彩色糖豆,每走一步糖豆轻轻碰撞,发出微不可闻的清脆声响。"; + public override string Category => "糖糖一周年限定纪念物品"; + public override QualityType QualityType => QualityType.Gold; + + public 糖糖一周年纪念鞋子(Character? character = null) : base(ItemType.Shoes) + { + Price = 0; + IsSellable = false; + IsTradable = false; + IsLock = true; + Skills.Active = new 疾风步(character) + { + Level = 5 + }; + Skills.Passives.Add(new 糖糖一周年纪念鞋子技能(character, this)); + } + } + + public class 糖糖一周年纪念鞋子技能 : Skill + { + public override long Id => (long)ItemPassiveID.糖糖一周年纪念鞋子; + public override string Name => "蜜步流心"; + public override string Description => string.Join("", Effects.Select(e => e.Description)); + + private readonly double 行动速度加成 = 180; + private readonly double 移动距离加成 = 4; + private readonly double 加速系数加成 = 0.2; + + public 糖糖一周年纪念鞋子技能(Character? character = null, Item? item = null) : base(SkillType.Passive, character) + { + Level = 1; + Item = item; + Dictionary values = new() + { + { "exspd", 行动速度加成 }, + { "exmov", 移动距离加成 }, + { "exacc", 加速系数加成 } + }; + Effects.Add(new ExSPD(this, values, character)); + Effects.Add(new ExMOV(this, values, character)); + Effects.Add(new AccelerationCoefficient(this, values, character)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } +} diff --git a/OshimaBot.Content/Items/SpecialItem/RegionItem.cs b/OshimaBot.Content/Items/SpecialItem/RegionItem.cs new file mode 100644 index 0000000..21e4036 --- /dev/null +++ b/OshimaBot.Content/Items/SpecialItem/RegionItem.cs @@ -0,0 +1,23 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; + +namespace OshimaBot.Content.Items +{ + public class RegionItem : Item + { + public HashSet> GenerationPredicates { get; } = []; + + public RegionItem(long id, string name, string description, string story = "", QualityType quality = QualityType.White, params IEnumerable> predicates) : base(ItemType.SpecialItem) + { + Id = id; + Name = name; + Description = description; + BackgroundStory = story; + QualityType = quality; + foreach (Func predicate in predicates) + { + GenerationPredicates.Add(predicate); + } + } + } +} diff --git a/OshimaBot.Content/Items/SpecialItem/创生之印.cs b/OshimaBot.Content/Items/SpecialItem/创生之印.cs new file mode 100644 index 0000000..da4bebc --- /dev/null +++ b/OshimaBot.Content/Items/SpecialItem/创生之印.cs @@ -0,0 +1,13 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; + +namespace OshimaBot.Content.Items +{ + public class 创生之印() : Item(ItemType.SpecialItem) + { + public override long Id => (long)SpecialItemID.创生之印; + public override string Name => "创生之印"; + public override string Description => "角色突破等阶必备的终级材料。"; + public override QualityType QualityType => QualityType.Orange; + } +} diff --git a/OshimaBot.Content/Items/SpecialItem/十连奖券.cs b/OshimaBot.Content/Items/SpecialItem/十连奖券.cs new file mode 100644 index 0000000..3420cc0 --- /dev/null +++ b/OshimaBot.Content/Items/SpecialItem/十连奖券.cs @@ -0,0 +1,13 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; + +namespace OshimaBot.Content.Items +{ + public class 十连奖券() : Item(ItemType.SpecialItem) + { + public override long Id => (long)SpecialItemID.十连奖券; + public override string Name => "十连奖券"; + public override string Description => "进行十连抽卡时,优先使用十连奖券替代金币。"; + public override QualityType QualityType => QualityType.Purple; + } +} diff --git a/OshimaBot.Content/Items/SpecialItem/升华之印.cs b/OshimaBot.Content/Items/SpecialItem/升华之印.cs new file mode 100644 index 0000000..f075e2e --- /dev/null +++ b/OshimaBot.Content/Items/SpecialItem/升华之印.cs @@ -0,0 +1,13 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; + +namespace OshimaBot.Content.Items +{ + public class 升华之印() : Item(ItemType.SpecialItem) + { + public override long Id => (long)SpecialItemID.升华之印; + public override string Name => "升华之印"; + public override string Description => "角色突破等阶必备的初级材料。"; + public override QualityType QualityType => QualityType.White; + } +} diff --git a/OshimaBot.Content/Items/SpecialItem/原初之印.cs b/OshimaBot.Content/Items/SpecialItem/原初之印.cs new file mode 100644 index 0000000..9d0c829 --- /dev/null +++ b/OshimaBot.Content/Items/SpecialItem/原初之印.cs @@ -0,0 +1,13 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; + +namespace OshimaBot.Content.Items +{ + public class 原初之印() : Item(ItemType.SpecialItem) + { + public override long Id => (long)SpecialItemID.原初之印; + public override string Name => "原初之印"; + public override string Description => "角色突破等阶必备的特级材料。"; + public override QualityType QualityType => QualityType.Purple; + } +} diff --git a/OshimaBot.Content/Items/SpecialItem/大师锻造券.cs b/OshimaBot.Content/Items/SpecialItem/大师锻造券.cs new file mode 100644 index 0000000..9a7337d --- /dev/null +++ b/OshimaBot.Content/Items/SpecialItem/大师锻造券.cs @@ -0,0 +1,14 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; + +namespace OshimaBot.Content.Items +{ + public class 大师锻造券() : Item(ItemType.SpecialItem) + { + public override long Id => (long)SpecialItemID.大师锻造券; + public override string Name => "大师锻造券"; + public override string Description => "锻造大师为你的锻造护航。当库存存在任意一张大师锻造券时,你可以在锻造时指定锻造的出货地区和品质,当锻造失败或锻造结果的出货地区和品质与你指定的不符时,将消耗一张大师锻造券并返还所有材料。\r\n" + + "使用指令:大师锻造 <目标地区编号> <目标品质序号>\r\n地区编号请通过【世界地图】查询,品质序号为 0~5(对应:普通/优秀/稀有/史诗/传说/神话)。"; + public override QualityType QualityType => QualityType.Orange; + } +} diff --git a/OshimaBot.Content/Items/SpecialItem/奖券.cs b/OshimaBot.Content/Items/SpecialItem/奖券.cs new file mode 100644 index 0000000..213604d --- /dev/null +++ b/OshimaBot.Content/Items/SpecialItem/奖券.cs @@ -0,0 +1,13 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; + +namespace OshimaBot.Content.Items +{ + public class 奖券() : Item(ItemType.SpecialItem) + { + public override long Id => (long)SpecialItemID.奖券; + public override string Name => "奖券"; + public override string Description => "进行抽卡时,优先使用奖券替代金币。"; + public override QualityType QualityType => QualityType.Blue; + } +} diff --git a/OshimaBot.Content/Items/SpecialItem/奥术符文.cs b/OshimaBot.Content/Items/SpecialItem/奥术符文.cs new file mode 100644 index 0000000..4a45d36 --- /dev/null +++ b/OshimaBot.Content/Items/SpecialItem/奥术符文.cs @@ -0,0 +1,13 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; + +namespace OshimaBot.Content.Items +{ + public class 奥术符文() : Item(ItemType.SpecialItem) + { + public override long Id => (long)SpecialItemID.奥术符文; + public override string Name => "奥术符文"; + public override string Description => "升级技能必备的高级材料。"; + public override QualityType QualityType => QualityType.Blue; + } +} diff --git a/OshimaBot.Content/Items/SpecialItem/技能卷轴.cs b/OshimaBot.Content/Items/SpecialItem/技能卷轴.cs new file mode 100644 index 0000000..a6b4836 --- /dev/null +++ b/OshimaBot.Content/Items/SpecialItem/技能卷轴.cs @@ -0,0 +1,13 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; + +namespace OshimaBot.Content.Items +{ + public class 技能卷轴() : Item(ItemType.SpecialItem) + { + public override long Id => (long)SpecialItemID.技能卷轴; + public override string Name => "技能卷轴"; + public override string Description => "升级技能必备的初级材料。"; + public override QualityType QualityType => QualityType.White; + } +} diff --git a/OshimaBot.Content/Items/SpecialItem/探索许可.cs b/OshimaBot.Content/Items/SpecialItem/探索许可.cs new file mode 100644 index 0000000..3a0683b --- /dev/null +++ b/OshimaBot.Content/Items/SpecialItem/探索许可.cs @@ -0,0 +1,13 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; + +namespace OshimaBot.Content.Items +{ + public class 探索许可() : Item(ItemType.SpecialItem) + { + public override long Id => (long)SpecialItemID.探索许可; + public override string Name => "探索许可"; + public override string Description => "铎京探索者协会为每位探索者发放的地区准入证明,拥有此证明可以接取各种各样的探索任务,并且享受铎京探索者协会的救援和协助服务。"; + public override QualityType QualityType => QualityType.White; + } +} diff --git a/OshimaBot.Content/Items/SpecialItem/改名卡.cs b/OshimaBot.Content/Items/SpecialItem/改名卡.cs new file mode 100644 index 0000000..8dae686 --- /dev/null +++ b/OshimaBot.Content/Items/SpecialItem/改名卡.cs @@ -0,0 +1,13 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; + +namespace OshimaBot.Content.Items +{ + public class 改名卡() : Item(ItemType.SpecialItem) + { + public override long Id => (long)SpecialItemID.改名卡; + public override string Name => "改名卡"; + public override string Description => "拥有改名卡时,可以使用【自定义改名】指令,来自定义个性化昵称。新昵称需要经过审核。"; + public override QualityType QualityType => QualityType.Orange; + } +} diff --git a/OshimaBot.Content/Items/SpecialItem/智慧之果.cs b/OshimaBot.Content/Items/SpecialItem/智慧之果.cs new file mode 100644 index 0000000..91b975b --- /dev/null +++ b/OshimaBot.Content/Items/SpecialItem/智慧之果.cs @@ -0,0 +1,13 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; + +namespace OshimaBot.Content.Items +{ + public class 智慧之果() : Item(ItemType.SpecialItem) + { + public override long Id => (long)SpecialItemID.智慧之果; + public override string Name => "智慧之果"; + public override string Description => "升级技能必备的中级材料。"; + public override QualityType QualityType => QualityType.Green; + } +} diff --git a/OshimaBot.Content/Items/SpecialItem/永恒之印.cs b/OshimaBot.Content/Items/SpecialItem/永恒之印.cs new file mode 100644 index 0000000..94d290f --- /dev/null +++ b/OshimaBot.Content/Items/SpecialItem/永恒之印.cs @@ -0,0 +1,13 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; + +namespace OshimaBot.Content.Items +{ + public class 永恒之印() : Item(ItemType.SpecialItem) + { + public override long Id => (long)SpecialItemID.永恒之印; + public override string Name => "永恒之印"; + public override string Description => "角色突破等阶必备的高级材料。"; + public override QualityType QualityType => QualityType.Blue; + } +} diff --git a/OshimaBot.Content/Items/SpecialItem/法则精粹.cs b/OshimaBot.Content/Items/SpecialItem/法则精粹.cs new file mode 100644 index 0000000..7755ebe --- /dev/null +++ b/OshimaBot.Content/Items/SpecialItem/法则精粹.cs @@ -0,0 +1,13 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; + +namespace OshimaBot.Content.Items +{ + public class 法则精粹() : Item(ItemType.SpecialItem) + { + public override long Id => (long)SpecialItemID.法则精粹; + public override string Name => "法则精粹"; + public override string Description => "升级技能必备的终级材料。"; + public override QualityType QualityType => QualityType.Orange; + } +} diff --git a/OshimaBot.Content/Items/SpecialItem/流光之印.cs b/OshimaBot.Content/Items/SpecialItem/流光之印.cs new file mode 100644 index 0000000..39a5e7e --- /dev/null +++ b/OshimaBot.Content/Items/SpecialItem/流光之印.cs @@ -0,0 +1,13 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; + +namespace OshimaBot.Content.Items +{ + public class 流光之印() : Item(ItemType.SpecialItem) + { + public override long Id => (long)SpecialItemID.流光之印; + public override string Name => "流光之印"; + public override string Description => "角色突破等阶必备的中级材料。"; + public override QualityType QualityType => QualityType.Green; + } +} diff --git a/OshimaBot.Content/Items/SpecialItem/混沌之核.cs b/OshimaBot.Content/Items/SpecialItem/混沌之核.cs new file mode 100644 index 0000000..510c26b --- /dev/null +++ b/OshimaBot.Content/Items/SpecialItem/混沌之核.cs @@ -0,0 +1,13 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; + +namespace OshimaBot.Content.Items +{ + public class 混沌之核() : Item(ItemType.SpecialItem) + { + public override long Id => (long)SpecialItemID.混沌之核; + public override string Name => "混沌之核"; + public override string Description => "升级技能必备的特级材料。"; + public override QualityType QualityType => QualityType.Purple; + } +} diff --git a/OshimaBot.Content/Items/SpecialItem/钻石.cs b/OshimaBot.Content/Items/SpecialItem/钻石.cs new file mode 100644 index 0000000..f949d47 --- /dev/null +++ b/OshimaBot.Content/Items/SpecialItem/钻石.cs @@ -0,0 +1,13 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; + +namespace OshimaBot.Content.Items +{ + public class 钻石() : Item(ItemType.SpecialItem) + { + public override long Id => (long)SpecialItemID.钻石; + public override string Name => "钻石"; + public override string Description => "钻石是筽祀牻大陆通用的稀有矿物,是第二流通货币。钻石可以以稳定的 1:200 兑换率兑换大陆第一流通货币金币。"; + public override QualityType QualityType => QualityType.White; + } +} diff --git a/OshimaBot.Content/Items/Weapon/独奏弓.cs b/OshimaBot.Content/Items/Weapon/独奏弓.cs new file mode 100644 index 0000000..6b3ebbe --- /dev/null +++ b/OshimaBot.Content/Items/Weapon/独奏弓.cs @@ -0,0 +1,48 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Items +{ + [Obsolete("测试物品请勿使用")] + public class 独奏弓 : Item + { + public override long Id => (long)WeaponID.独奏弓; + public override string Name => "独奏弓"; + public override string Description => Skills.Passives.Count > 0 ? Skills.Passives.First().Description : ""; + + public 独奏弓(Character? character = null) : base(ItemType.Weapon) + { + WeaponType = WeaponType.Bow; + Skills.Passives.Add(new 独奏弓技能(character, this)); + } + } + + public class 独奏弓技能 : Skill + { + public override long Id => (long)WeaponID.独奏弓; + public override string Name => "独奏弓"; + public override string Description => string.Join("\r\n", Effects.Select(e => e.Description)); + + private readonly double 攻击力加成 = 80; + private readonly double 硬直时间减少 = 2; + + public 独奏弓技能(Character? character, Item item) : base(SkillType.Passive, character) + { + Level = 1; + Item = item; + Dictionary values = new() + { + { "exatk", 攻击力加成 }, + { "hatr", 硬直时间减少 } + }; + Effects.Add(new ExATK(this, values, character)); + Effects.Add(new NormalAttackHardTimeReduce(this, values, character)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } +} diff --git a/OshimaBot.Content/Items/Weapon/糖糖一周年纪念武器.cs b/OshimaBot.Content/Items/Weapon/糖糖一周年纪念武器.cs new file mode 100644 index 0000000..4bdbe59 --- /dev/null +++ b/OshimaBot.Content/Items/Weapon/糖糖一周年纪念武器.cs @@ -0,0 +1,56 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.OpenEffects; +using OshimaBot.Content.Skills; + +namespace OshimaBot.Content.Items +{ + public class 糖糖一周年纪念武器 : Item + { + public override long Id => (long)WeaponID.糖糖一周年纪念武器; + public override string Name => "粉糖雾蝶"; + public override string Description => $"{Skills.Passives.First().Description}{Skills.Passives.Last().Name}:{Skills.Passives.Last().Description}"; + public override string BackgroundStory => "可长达1.5米的权杖,通体呈半透明的琥珀金色,内部可见如星河般缓缓流动的魔法糖浆。"; + public override string Category => "糖糖一周年限定纪念物品"; + public override QualityType QualityType => QualityType.Gold; + + public 糖糖一周年纪念武器(Character? character = null) : base(ItemType.Weapon) + { + Price = 0; + IsSellable = false; + IsTradable = false; + IsLock = true; + WeaponType = WeaponType.Staff; + Skills.Passives.Add(new 糖糖一周年纪念武器技能(character, this)); + Skills.Passives.Add(new 致命节奏(character) + { + Level = 1 + }); + } + } + + public class 糖糖一周年纪念武器技能 : Skill + { + public override long Id => (long)ItemPassiveID.糖糖一周年纪念武器; + public override string Name => "粉糖雾蝶"; + public override string Description => string.Join("", Effects.Select(e => e.Description)); + + private readonly double 攻击力加成 = 0.46; + + public 糖糖一周年纪念武器技能(Character? character = null, Item? item = null) : base(SkillType.Passive, character) + { + Level = 1; + Item = item; + Dictionary values = new() + { + { "exatk", 攻击力加成 } + }; + Effects.Add(new ExATK2(this, values, character)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } +} diff --git a/OshimaBot.Content/OshimaBot.Content.csproj b/OshimaBot.Content/OshimaBot.Content.csproj new file mode 100644 index 0000000..dc5aa8c --- /dev/null +++ b/OshimaBot.Content/OshimaBot.Content.csproj @@ -0,0 +1,18 @@ + + + + net10.0 + enable + enable + OshimaBot.Content + + + + + + + + + + + diff --git a/OshimaBot.Content/Others/RandomNames.cs b/OshimaBot.Content/Others/RandomNames.cs new file mode 100644 index 0000000..bc34353 --- /dev/null +++ b/OshimaBot.Content/Others/RandomNames.cs @@ -0,0 +1,172 @@ +using System.Text; + +namespace Milimoe.FunGameTesting.Others +{ + /// + /// 随机中文名生成工具(从 FunGameService 抽出,供模组自包含使用,避免依赖测试项目) + /// + public static class RandomNames + { + public static string[] GreekAlphabet { get; } = ["α", "β", "γ", "δ", "ε", "ζ", "η", "θ", "ι", "κ", "λ", "μ", "ν", "ξ", "ο", "π", "ρ", "σ", "τ", "υ", "φ", "χ", "ψ", "ω"]; + + public static string[] CommonSurnames { get; } = [ + "顾", "沈", "陆", "楚", "白", "苏", "叶", "萧", "莫", "司马", "欧阳", + "上官", "慕容", "尉迟", "司徒", "轩辕", "端木", "南宫", "长孙", "百里", + "东方", "西门", "独孤", "公孙", "令狐", "宇文", "夏侯", "赫连", "皇甫", + "北堂", "安陵", "东篱", "花容", "夜", "柳", "云", "凌", "寒", "龙", + "凤", "蓝", "冷", "华", "蓝夜", "叶南", "墨", "君", "月", "子车", + "澹台", "钟离", "公羊", "闾丘", "仲孙", "司空", "羊舌", "亓官", "公冶", + "濮阳", "独月", "南风", "凤栖", "南门", "姬", "闻人", "花怜", "若", + "紫", "卿", "微", "清", "易", "月华", "霜", "兰", "岑", "语", "雪", + "夜阑", "梦", "洛", "江", "黎", "夜北", "唐", "水", "韩", "庄", + "夜雪", "夜凌", "君临", "青冥", "漠然", "林", "青", "岑", "容", + "墨", "柏", "安", "晏", "尉", "南", "轩", "竹", "晨", "桓", "晖", + "瑾", "溪", "汐", "沐", "玉", "汀", "归", "羽", "颜", "辰", "琦", + "芷", "尹", "施", "原", "孟", "尧", "荀", "单", "简", "植", "傅", + "司", "钟", "方", "谢", + "赵", "钱", "孙", "李", "周", "吴", "郑", "王", "冯", "陈", "卫", "蒋", "沈", "韩", + "杨", "朱", "秦", "许", "何", "吕", "张", "孔", "曹", "严", "华", "金", "魏", "陶", + "姜", "谢", "罗", "徐", "林", "范", "方", "唐", "柳", "宋", "元", "萧", "程", "陆", + "顾", "楚", "白", "苏", "叶", "萧", "莫", "凌", "寒", "龙", "凤", "蓝", "冷", "华", + "唐", "韩", "庄", "青", "安", "晏", "尹", "施", "孟", "荀", "傅", "钟", "方", "谢", + "司马", "欧阳", "上官", "慕容", "尉迟", "司徒", "轩辕", "端木", "南宫", "长孙", + "百里", "东方", "西门", "独孤", "公孙", "令狐", "宇文", "夏侯", "赫连", "皇甫", + "墨", "君", "月", "紫", "卿", "微", "清", "易", "霜", "兰", "语", "雪", "璃", + "镜", "弦", "珏", "瑾", "璇", "绯", "霁", "溟", "澈", "归", "羽", "辰", "芷", + "风", "花", "江", "河", "湖", "海", "山", "川", "松", "竹", "梅", "菊", "枫", + "梧", "泉", "溪", "岚", "雾", "露", "霓", "霰", "星", "辰", + "沧", "溟", "无", "绝", "孤", "隐", "斩", "破", "惊", "鸿", "御", "玄", "冥", + "烬", "夙", "离", + "东篱", "南笙", "西楼", "北冥", "九歌", "长离", "扶摇", "青丘", "凌霄", "重光", + "子车", "亓官", "巫马", "拓跋", "叱干", "斛律", "沮渠", "秃发", "万俟", "仆固" + ]; + + public static string CommonChineseCharacters { get; } = + "云星宝灵梦龙花雨风叶山川月石羽水竹金" + + "玉海火雷光天地凤虎虹珠华霞鹏雪银沙松桃兰青霜鸿康骏波泉河湖江泽洋林枫" + + "梅桂樱桐晴韵凌若悠碧涛渊壁剑影霖玄承珍雅耀瑞鹤烟燕霏翼翔璃绮纱绫绣锦" + + "瑜琼瑾璇璧琳琪瑶瑛芝杏茜荷莉莹菡莲诗瑰翠椒槐榆槿柱梧曜曙晶暖智煌熙霓" + + "熠嘉琴曼菁蓉菲淑妙惠秋涵映巧慧茹荣菱曦容芬玲澜清湘澄泓润珺晨翠涟洁悠" + + "霏淑绮润东南西北云山川风月溪雪雨雷天云海霜柏芳春秋夏冬温景寒和竹阳溪" + + "溪飞风峰阳一乙二十丁厂七卜八人入儿匕几九刁了刀力乃又三干于亏工土士才" + + "下寸大丈与万上小口山巾千乞川亿个夕久么勺凡丸及广亡门丫义之尸己已巳弓" + + "子卫也女刃飞习叉马乡丰王开井天夫元无云专丐扎艺木五支厅不犬太区历歹友" + + "尤匹车巨牙屯戈比互切瓦止少曰日中贝冈内水见午牛手气毛壬升夭长仁什片仆" + + "化仇币仍仅斤爪反介父从仑今凶分乏公仓月氏勿欠风丹匀乌勾凤六文亢方火为" + + "斗忆计订户认冗讥心尺引丑巴孔队办以允予邓劝双书幻玉刊未末示击打巧正扑" + + "卉扒功扔去甘世艾古节本术可丙左厉石右布夯戊龙平灭轧东卡北占凸卢业旧帅" + + "归旦目且叶甲申叮电号田由只叭史央兄叽叼叫叩叨另叹冉皿凹囚四生矢失乍禾" + + "丘付仗代仙们仪白仔他斥瓜乎丛令用甩印尔乐句匆册卯犯外处冬鸟务包饥主市" + + "立冯玄闪兰半汁汇头汉宁穴它讨写让礼训议必讯记永司尼民弗弘出辽奶奴召加" + + "皮边孕发圣对台矛纠母幼丝邦式迂刑戎动扛寺吉扣考托老巩圾执扩扫地场扬耳" + + "芋共芒亚芝朽朴机权过臣吏再协西压厌戌在百有存而页匠夸夺灰达列死成夹夷" + + "轨邪尧划迈毕至此贞师尘尖劣光当早吁吐吓虫曲团吕同吊吃因吸吗吆屿屹岁帆" + + "回岂则刚网肉年朱先丢廷舌竹迁乔迄伟传乒乓休伍伏优臼伐延仲件任伤价伦份" + + "华仰仿伙伪自伊血向似后行舟全会杀合兆企众爷伞创肌肋朵杂危旬旨旭负匈名" + + "各多争色壮冲妆冰庄庆亦刘齐交衣次产决亥充妄闭问闯羊并关米灯州汗污江汛" + + "池汝汤忙兴宇守宅字安讲讳军讶许讹论讼农讽设访诀寻那迅尽导异弛孙阵阳收" + + "阶阴防奸如妇妃好她妈戏羽观欢买红驮纤驯约级纪驰纫巡寿弄麦玖玛形进戒吞" + + "远违韧运扶抚坛技坏抠扰扼拒找批址扯走抄贡汞坝攻赤折抓扳抡扮抢孝坎均抑" + + "抛投坟坑抗坊抖护壳志块扭声把报拟却抒劫芙芜苇芽花芹芥芬苍芳严芦芯劳克" + + "芭苏杆杠杜材村杖杏杉巫极李杨求甫匣更束吾豆两酉丽医辰励否还尬歼来连轩" + + "步卤坚肖旱盯呈时吴助县里呆吱吠呕园旷围呀吨足邮男困吵串员呐听吟吩呛吻" + + "吹呜吭吧邑吼囤别吮岖岗帐财针钉牡告我乱利秃秀私每兵估体何佐佑但伸佃作" + + "伯伶佣低你住位伴身皂伺佛囱近彻役返余希坐谷妥含邻岔肝肛肚肘肠龟甸免狂" + + "犹狈角删条彤卵灸岛刨迎饭饮系言冻状亩况床库庇疗吝应这冷庐序辛弃冶忘闰" + + "闲间闷判兑灶灿灼弟汪沐沛汰沥沙汽沃沦汹泛沧没沟沪沈沉沁怀忧忱快完宋宏" + + "牢究穷灾良证启评补初社祀识诈诉罕诊词译君灵即层屁尿尾迟局改张忌际陆阿" + + "陈阻附坠妓妙妖姊妨妒努忍劲矣鸡纬驱纯纱纲纳驳纵纷纸纹纺驴纽奉玩环武青" + + "责现玫表规抹卦坷坯拓拢拔坪拣坦担坤押抽拐拖者拍顶拆拎拥抵拘势抱拄垃拉" + + "拦幸拌拧拂拙招坡披拨择抬拇拗其取茉苦昔苛若茂苹苗英苟苑苞范直茁茄茎苔" + + "茅枉林枝杯枢柜枚析板松枪枫构杭杰述枕丧或画卧事刺枣雨卖郁矾矿码厕奈奔" + + "奇奋态欧殴垄妻轰顷转斩轮软到非叔歧肯齿些卓虎虏肾贤尚旺具味果昆国哎咕" + + "昌呵畅明易咙昂迪典固忠呻咒咋咐呼鸣咏呢咄咖岸岩帖罗帜帕岭凯败账贩贬购" + + "贮图钓制知迭氛垂牧物乖刮秆和季委秉佳侍岳供使例侠侥版侄侦侣侧凭侨佩货" + + "侈依卑的迫质欣征往爬彼径所舍金刹命肴斧爸采觅受乳贪念贫忿肤肺肢肿胀朋" + + "股肮肪肥服胁周昏鱼兔狐忽狗狞备饰饱饲变京享庞店夜庙府底疟疙疚剂卒郊庚" + + "废净盲放刻育氓闸闹郑券卷单炬炒炊炕炎炉沫浅法泄沽河沾泪沮油泊沿泡注泣" + + "泞泻泌泳泥沸沼波泼泽治怔怯怖性怕怜怪怡学宝宗定宠宜审宙官空帘宛实试郎" + + "诗肩房诚衬衫视祈话诞诡询该详建肃录隶帚屉居届刷屈弧弥弦承孟陋陌孤陕降" + + "函限妹姑姐姓妮始姆迢驾叁参艰线练组绅细驶织驹终驻绊驼绍绎经贯契贰奏春" + + "帮玷珍玲珊玻毒型拭挂封持拷拱项垮挎城挟挠政赴赵挡拽哉挺括垢拴拾挑垛指" + + "垫挣挤拼挖按挥挪拯某甚荆茸革茬荐巷带草茧茵茶荒茫荡荣荤荧故胡荫荔南药" + + "标栈柑枯柄栋相查柏栅柳柱柿栏柠树勃要柬咸威歪研砖厘厚砌砂泵砚砍面耐耍" + + "牵鸥残殃轴轻鸦皆韭背战点虐临览竖省削尝昧盹是盼眨哇哄哑显冒映星昨咧昭" + + "畏趴胃贵界虹虾蚁思蚂虽品咽骂勋哗咱响哈哆咬咳咪哪哟炭峡罚贱贴贻骨幽钙" + + "钝钞钟钢钠钥钦钧钩钮卸缸拜看矩毡氢怎牲选适秒香种秋科重复竿段便俩贷顺" + + "修俏保促俄俐侮俭俗俘信皇泉鬼侵禹侯追俊盾待徊衍律很须叙剑逃食盆胚胧胆" + + "胜胞胖脉胎勉狭狮独狰狡狱狠贸怨急饵饶蚀饺饼峦弯将奖哀亭亮度迹庭疮疯疫" + + "疤咨姿亲音帝施闺闻闽阀阁差养美姜叛送类迷籽娄前首逆兹总炼炸烁炮炫烂剃" + + "洼洁洪洒柒浇浊洞测洗活派洽染洛浏济洋洲浑浓津恃恒恢恍恬恤恰恼恨举觉宣" + + "宦室宫宪突穿窃客诫冠诬语扁袄祖神祝祠误诱诲说诵垦退既屋昼屏屎费陡逊眉" + + "孩陨除险院娃姥姨姻娇姚娜怒架贺盈勇怠癸蚤柔垒绑绒结绕骄绘给绚骆络绝绞" + + "骇统耕耘耗耙艳泰秦珠班素匿蚕顽盏匪捞栽捕埂捂振载赶起盐捎捍捏埋捉捆捐" + + "损袁捌都哲逝捡挫换挽挚热恐捣壶捅埃挨耻耿耽聂恭莽莱莲莫莉荷获晋恶莹莺" + + "真框梆桂桔栖档桐株桥桦栓桃格桩校核样根索哥速逗栗贾酌配翅辱唇夏砸砰砾" + + "础破原套逐烈殊殉顾轿较顿毙致柴桌虑监紧党逞晒眠晓哮唠鸭晃哺晌剔晕蚌畔" + + "蚣蚊蚪蚓哨哩圃哭哦恩鸯唤唁哼唧啊唉唆罢峭峨峰圆峻贼贿赂赃钱钳钻钾铁铃" + + "铅缺氧氨特牺造乘敌秤租积秧秩称秘透笔笑笋债借值倚俺倾倒倘俱倡候赁俯倍" + + "倦健臭射躬息倔徒徐殷舰舱般航途拿耸爹舀爱豺豹颁颂翁胰脆脂胸胳脏脐胶脑" + + "脓逛狸狼卿逢鸵留鸳皱饿馁凌凄恋桨浆衰衷高郭席准座症病疾斋疹疼疲脊效离" + + "紊唐瓷资凉站剖竞部旁旅畜阅羞羔瓶拳粉料益兼烤烘烦烧烛烟烙递涛浙涝浦酒" + + "涉消涡浩海涂浴浮涣涤流润涧涕浪浸涨烫涩涌悖悟悄悍悔悯悦害宽家宵宴宾窍" + + "窄容宰案请朗诸诺读扇诽袜袖袍被祥课冥谁调冤谅谆谈谊剥恳展剧屑弱陵祟陶" + + "陷陪娱娟恕娥娘通能难预桑绢绣验继骏球琐理琉琅捧堵措描域捺掩捷排焉掉捶" + + "赦堆推埠掀授捻教掏掐掠掂培接掷控探据掘掺职基聆勘聊娶著菱勒黄菲萌萝菌" + + "萎菜萄菊菩萍菠萤营乾萧萨菇械彬梦婪梗梧梢梅检梳梯桶梭救曹副票酝酗厢戚" + + "硅硕奢盔爽聋袭盛匾雪辅辆颅虚彪雀堂常眶匙晨睁眯眼悬野啪啦曼晦晚啄啡距" + + "趾啃跃略蚯蛀蛇唬累鄂唱患啰唾唯啤啥啸崖崎崭逻崔帷崩崇崛婴圈铐铛铝铜铭" + + "铲银矫甜秸梨犁秽移笨笼笛笙符第敏做袋悠偿偶偎偷您售停偏躯兜假衅徘徙得" + + "衔盘舶船舵斜盒鸽敛悉欲彩领脚脖脯豚脸脱象够逸猜猪猎猫凰猖猛祭馅馆凑减" + + "毫烹庶麻庵痊痒痕廊康庸鹿盗章竟商族旋望率阎阐着羚盖眷粘粗粒断剪兽焊焕" + + "清添鸿淋涯淹渠渐淑淌混淮淆渊淫渔淘淳液淤淡淀深涮涵婆梁渗情惜惭悼惧惕" + + "惟惊惦悴惋惨惯寇寅寄寂宿窒窑密谋谍谎谐袱祷祸谓谚谜逮敢尉屠弹隋堕随蛋" + + "隅隆隐婚婶婉颇颈绩绪续骑绰绳维绵绷绸综绽绿缀巢琴琳琢琼斑替揍款堪塔搭" + + "堰揩越趁趋超揽堤提博揭喜彭揣插揪搜煮援搀裁搁搓搂搅壹握搔揉斯期欺联葫" + + "散惹葬募葛董葡敬葱蒋蒂落韩朝辜葵棒棱棋椰植森焚椅椒棵棍椎棉"; + + /// + /// 生成随机中文名。 必须由调用方下传(本局种子派生), + /// 否则使用进程级随机会让整局模拟无法复现 + /// + public static string GenerateRandomChineseName(Random random) + { + // 随机生成名字长度,2到5个字 + int nameLength = random.Next(2, 6); + StringBuilder name = new(); + + for (int i = 0; i < nameLength; i++) + { + // 从常用汉字集中随机选择一个汉字 + char chineseCharacter = CommonChineseCharacters[random.Next(CommonChineseCharacters.Length)]; + name.Append(chineseCharacter); + } + + return name.ToString(); + } + + /// + /// 生成随机中文用户名。 必须由调用方下传(本局种子派生) + /// + public static string GenerateRandomChineseUserName(Random random) + { + StringBuilder name = new(); + + // 随机姓 + string lastname = CommonSurnames[random.Next(CommonSurnames.Length)]; + name.Append(lastname); + + // 随机生成名字长度,2到5个字 + int nameLength = random.Next(1, 2); + + for (int i = 0; i < nameLength; i++) + { + // 从常用汉字集中随机选择一个汉字 + char chineseCharacter = CommonChineseCharacters[random.Next(CommonChineseCharacters.Length)]; + name.Append(chineseCharacter); + } + + return name.ToString(); + } + } +} diff --git a/OshimaBot.Content/Others/RoundRewardPool.cs b/OshimaBot.Content/Others/RoundRewardPool.cs new file mode 100644 index 0000000..6a33aa8 --- /dev/null +++ b/OshimaBot.Content/Others/RoundRewardPool.cs @@ -0,0 +1,125 @@ +using OshimaBot.Content.Effects.OpenEffects; + +namespace Milimoe.FunGameTesting.Others +{ + /// + /// 回合奖励特效池(模组公共区域) + /// · 由 WebAPI 的 FunGameService.GetRoundRewards 迁入模组层:模组自身(技能 / 被动 / 状态特效)现在可直接引用本池 + /// · 必须由调用方下传(通常是本局队列的随机源),否则奖励数值每局不同,整局模拟无法复现 + /// + public static class RoundRewardPool + { + /// + /// 构造回合奖励特效池:Id → 构造参数 + /// 注意:每次调用都会重新掷点,请只调用一次并把返回值存下来(Keys 与取值必须来自同一份实例) + /// + /// 本局随机源 + public static Dictionary> Create(Random random) => new() + { + { + EffectID.ExATK, + new() + { + { "exatk", random.Next(40, 80) } + } + }, + { + EffectID.ExCritRate, + new() + { + { "excr", Math.Clamp(random.NextDouble(), 0.25, 0.5) } + } + }, + { + EffectID.ExCritDMG, + new() + { + { "excrd", Math.Clamp(random.NextDouble(), 0.5, 1) } + } + }, + { + EffectID.ExATK2, + new() + { + { "exatk", Math.Clamp(random.NextDouble(), 0.15, 0.3) } + } + }, + { + EffectID.ExMaxMP2, + new() + { + { "exmp", 5 } + } + }, + { + EffectID.AccelerationCoefficient, + new() + { + { "exacc", 1 } + } + }, + { + EffectID.IgnoreEvade, + new() + { + { "p", 1 } + } + }, + { + EffectID.RecoverHP, + new() + { + { "hp", random.Next(160, 640) } + } + }, + { + EffectID.RecoverMP, + new() + { + { "mp", random.Next(140, 490) } + } + }, + { + EffectID.RecoverHP2, + new() + { + { "hp", Math.Clamp(random.NextDouble(), 0.04, 0.08) } + } + }, + { + EffectID.RecoverMP2, + new() + { + { "mp", Math.Clamp(random.NextDouble(), 0.09, 0.18) } + } + }, + { + EffectID.GetEP, + new() + { + { "ep", random.Next(20, 40) } + } + } + }; + + /// + /// 该特效是否属于「主动奖励」:主动奖励在发放时立即释放,被动奖励则挂载为状态特效 + /// + /// 特效数字标识符 + public static bool IsActive(EffectID id) => (long)id > (long)EffectID.Active_Start; + + /// + /// 把特效池的键集合转换为 所需的 effects 映射 + /// + /// 特效数字标识符集合 + public static Dictionary BuildEffectMap(IEnumerable effectIds) + { + Dictionary effects = []; + foreach (EffectID id in effectIds) + { + effects[(long)id] = IsActive(id); + } + return effects; + } + } +} diff --git a/OshimaBot.Content/Skills/CHAOS/全军出击.cs b/OshimaBot.Content/Skills/CHAOS/全军出击.cs new file mode 100644 index 0000000..015418b --- /dev/null +++ b/OshimaBot.Content/Skills/CHAOS/全军出击.cs @@ -0,0 +1,143 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; + +namespace OshimaBot.Content.Skills +{ + public class 全军出击 : Skill + { + public override long Id => (long)SuperSkillID.全军出击; + public override string Name => "全军出击"; + public override string Description => Effects.Count > 0 ? ((全军出击特效)Effects.First()).GeneralDescription : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double EPCost => 100; + public override double CD => 100; + public override double HardnessTime { get; set; } = 5; + public override bool CanSelectSelf => true; + public override bool CanSelectEnemy => false; + + public 全军出击(Character? character = null) : base(SkillType.SuperSkill, character) + { + Effects.Add(new 全军出击特效(this)); + } + } + + public class 全军出击特效 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description { get; set; } = ""; + public override DispelledType DispelledType => DispelledType.CannotBeDispelled; + public string GeneralDescription => $"将雇佣兵数量立即补全至 {雇佣兵团特效.最大数量} 名,每名雇佣兵的生命值回复至满并提升 {攻击力提升 * 100:0.##}% 攻击力。在 {持续时间} {GameplayEquilibriumConstant.InGameTime}内,场上的每名雇佣兵额外为{Skill.SkillOwner()}提供 {攻击力 * 100:0.##}% 攻击力和 {行动速度:0.##} 点行动速度、{加速系数 * 100:0.##}% 加速系数、{冷却缩减 * 100:0.##}% 冷却缩减。"; + public override bool Durative => true; + public override double Duration => 持续时间; + + public double 持续时间 => 20 + 2 * (Skill.Level - 1); + public const double 攻击力 = 0.04; + public const double 冷却缩减 = 0.03; + public const double 加速系数 = 0.03; + public const double 行动速度 = 30; + public const double 攻击力提升 = 0.4; + private double 实际攻击力提升 = 0; + private double 实际行动速度提升 = 0; + private double 实际加速系数提升 = 0; + private double 实际冷却缩减提升 = 0; + + public 全军出击特效(Skill skill) : base(skill) + { + Description = GeneralDescription; + } + + public override void OnTimeElapsed(TimeLapseContext ctx) + { + if (ctx.Trigger is not Character character) return; + double elapsed = ctx.Elapsed; + 刷新技能效果(character); + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + Skill.IsInEffect = false; + 刷新技能效果(character); + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + Skill.IsInEffect = true; + RemainDuration = Duration; + if (!caster.Effects.Contains(this)) + { + caster.Effects.Add(this); + OnEffectGained(new HookContext(GamingQueue, caster)); + } + if (caster.Effects.FirstOrDefault(e => e is 雇佣兵团特效 && e.Skill.Character == Skill.Character) is 雇佣兵团特效 e) + { + e.Skill.CurrentCD = 0; + e.Skill.Enable = true; + int count = e.雇佣兵团.Count; + if (count < 雇佣兵团特效.最大数量) + { + do + { + count = e.新增雇佣兵(caster); + } + while (count < 雇佣兵团特效.最大数量); + } + foreach (雇佣兵 gyb in e.雇佣兵团) + { + gyb.Recovery(); + gyb.ExATKPercentage += 0.05; + } + } + 刷新技能效果(caster); + } + + public void 刷新技能效果(Character character) + { + if (实际攻击力提升 != 0) + { + character.ExATKPercentage -= 实际攻击力提升; + 实际攻击力提升 = 0; + } + if (实际行动速度提升 != 0) + { + character.ExSPD -= 实际行动速度提升; + 实际行动速度提升 = 0; + } + if (实际加速系数提升 != 0) + { + character.ExAccelerationCoefficient -= 实际加速系数提升; + 实际加速系数提升 = 0; + } + if (实际冷却缩减提升 != 0) + { + character.ExCDR -= 实际冷却缩减提升; + 实际冷却缩减提升 = 0; + } + if (!Skill.IsInEffect) + { + return; + } + if (character.Effects.FirstOrDefault(e => e is 雇佣兵团特效 && e.Skill.Character == Skill.Character) is 雇佣兵团特效 e) + { + int count = e.雇佣兵团.Count; + 实际攻击力提升 = 攻击力 * count; + 实际行动速度提升 = 行动速度 * count; + 实际加速系数提升 = 加速系数 * count; + 实际冷却缩减提升 = 冷却缩减 * count; + character.ExATKPercentage += 实际攻击力提升; + character.ExSPD += 实际行动速度提升; + character.ExAccelerationCoefficient += 实际加速系数提升; + character.ExCDR += 实际冷却缩减提升; + Description = $"{GeneralDescription}(当前雇佣兵数量:{count},攻击力提升:{实际攻击力提升 * 100:0.##}% [ {character.BaseATK * 实际攻击力提升:0.##} ] 点,行动速度提升:{实际行动速度提升:0.##} 点,加速系数提升:{实际加速系数提升 * 100:0.##}%,冷却缩减提升:{实际冷却缩减提升 * 100:0.##}%)"; + } + } + } +} diff --git a/OshimaBot.Content/Skills/CHAOS/雇佣兵团.cs b/OshimaBot.Content/Skills/CHAOS/雇佣兵团.cs new file mode 100644 index 0000000..9fb4f75 --- /dev/null +++ b/OshimaBot.Content/Skills/CHAOS/雇佣兵团.cs @@ -0,0 +1,205 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; +using Milimoe.FunGameTesting.Others; + +namespace OshimaBot.Content.Skills +{ + public class 雇佣兵团 : Skill + { + public override long Id => (long)PassiveID.雇佣兵团; + public override string Name => "雇佣兵团"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + + public 雇佣兵团(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 雇佣兵团特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + public class 雇佣兵团特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"{Skill.SkillOwner()}在场上时,会召唤数名雇佣兵协助战斗,初始数量为 {最小数量} 名,雇佣兵具有独立的回合,生命值为{Skill.SkillOwner()}的 {生命值比例 * 100:0.##}% [ {Skill.Character?.MaxHP * 生命值比例:0.##} ],攻击力为{Skill.SkillOwner()}的 {攻击力比例 * 100:0.##}% 基础攻击力 [ {Skill.Character?.BaseATK * 攻击力比例:0.##} ]," + + $"完整继承其他能力值(暴击率、闪避率等),雇佣兵每{GameplayEquilibriumConstant.InGameTime}流失 {生命流失 * 100:0.##}% 当前生命值。当{Skill.SkillOwner()}参与击杀时,便会临时产生一名额外的雇佣兵。场上最多可以存在 {最大数量} 名雇佣兵,达到数量后不再产生新的雇佣兵;当不足 {最小数量} 名雇佣兵时,{补充间隔} {GameplayEquilibriumConstant.InGameTime}后会重新补充一名雇佣兵。" + + (雇佣兵团.Count < 最小数量 && Skill.CurrentCD > 0 ? $"(下次补充:{Skill.CurrentCD:0.##} {GameplayEquilibriumConstant.InGameTime}后)" : ""); + + public List<雇佣兵> 雇佣兵团 { get; } = []; + public const int 最小数量 = 1; + public const int 最大数量 = 5; + public const int 补充间隔 = 30; + public const double 生命值比例 = 0.1; + public const double 攻击力比例 = 0.6; + public const double 生命流失 = 0.09; + + private bool 激活 = false; + + public override void OnGameStart(HookContext ctx) + { + if (!激活) + { + 激活 = true; + if (Skill.Character != null) + { + 保底补充(Skill.Character); + } + } + } + + public override void AfterDeathCalculation(DeathContext ctx) + { + if (ctx.Trigger is not Character death) return; + bool hasMaster = ctx.HasMaster; + Character? killer = ctx.Killer; + Dictionary continuousKilling = ctx.ContinuousKilling; + Dictionary earnedMoney = ctx.EarnedMoney; + Character[] assists = ctx.Assists; + if (death is 雇佣兵 gyb) + { + WriteLine($"[ {killer} ] 杀死了 [ {death} ]!"); + 雇佣兵团.Remove(gyb); + if (GamingQueue is FunGame.Core.Model.Queue.GamingQueue queue) + { + if (queue.Map != null) queue.RemoveCharacterFromMap(gyb); + else queue.RemoveCharacterFromQueue(gyb); + } + if (雇佣兵团.Count < 最小数量 && Skill.CurrentCD == 0) + { + Skill.CurrentCD = 补充间隔; + Skill.Enable = false; + } + } + + if (death == Skill.Character) + { + OnEffectLost(new HookContext(GamingQueue, death)); + } + + if (Skill.Character != null && death != Skill.Character && (killer == Skill.Character || assists.Contains(Skill.Character)) && 雇佣兵团.Count < 最大数量) + { + 新增雇佣兵(Skill.Character); + } + } + + public override void OnTimeElapsed(TimeLapseContext ctx) + { + if (ctx.Trigger is not Character character) return; + double elapsed = ctx.Elapsed; + if (character == Skill.Character) + { + 保底补充(character); + } + foreach (雇佣兵 gyb in 雇佣兵团) + { + if (gyb.HP > 0) + { + double lost = gyb.HP * 生命流失 * elapsed; + gyb.HP -= lost; + if (gyb.HP <= 0) + { + gyb.HP = 1; + } + } + } + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (GamingQueue != null) + { + if (GamingQueue is FunGame.Core.Model.Queue.GamingQueue queue) + { + if (queue.Map != null) queue.RemoveCharacterFromMap(雇佣兵团); + else queue.RemoveCharacterFromQueue(雇佣兵团); + } + 雇佣兵团.Clear(); + WriteLine($"[ {character} ] 的雇佣兵团已消散!"); + } + } + + public void 保底补充(Character character) + { + if (!激活) return; + int count = 雇佣兵团.Count; + if (count < 最小数量 && Skill.Enable) + { + do + { + count = 新增雇佣兵(character); + } + while (count < 最小数量); + } + if (GamingQueue != null) + { + foreach (雇佣兵 gyb in 雇佣兵团.Where(g => !GamingQueue.Queue.Contains(g))) + { + if (gyb.HP <= 0) gyb.HP = 1; + 添加到地图(character, gyb); + } + } + } + + public int 新增雇佣兵(Character character) + { + 雇佣兵 gyb = new(character, RandomNames.GenerateRandomChineseName(Random)) + { + Level = 1, + InitialHP = character.MaxHP * 生命值比例, + InitialATK = character.BaseATK * 攻击力比例, + ExCritRate = character.CritRate - GameplayEquilibriumConstant.CritRate, + ExCritDMG = character.CritDMG - GameplayEquilibriumConstant.CritDMG, + ExEvadeRate = character.EvadeRate - GameplayEquilibriumConstant.EvadeRate, + InitialSPD = character.SPD, + InitialDEF = character.DEF, + InitialHR = character.HR, + InitialMR = character.MR, + Lifesteal = character.Lifesteal, + ExPDR = character.ExPDR, + PhysicalPenetration = character.PhysicalPenetration, + MagicalPenetration = character.MagicalPenetration, + ExMOV = character.MOV, + ExATR = character.ATR - 1 + }; + gyb.MDF.AddAllValue(character.MDF.Avg); + gyb.Recovery(); + 雇佣兵团.Add(gyb); + + 添加到地图(character, gyb); + WriteLine($"[ {character} ] 召唤了{gyb}!"); + + return 雇佣兵团.Count; + } + + public void 添加到地图(Character character, 雇佣兵 gyb) + { + // 添加到地图/队列 + if (GamingQueue != null) + { + if (GamingQueue.Map is GameMap map) + { + Grid? current = map.GetCharacterCurrentGrid(character); + if (current != null) + { + List nearbyGrids = map.GetGridsByRange(current, 5, false); + Grid? target = nearbyGrids.OrderBy(g => GameMap.CalculateManhattanDistance(g, current)).FirstOrDefault(); + if (target != null) + { + map.SetCharacterCurrentGrid(gyb, target); + } + } + } + GamingQueue.Queue.Add(gyb); + GamingQueue.ChangeCharacterHardnessTime(gyb, 5, false, false); + } + } + } +} diff --git a/OshimaBot.Content/Skills/ColdBlue/极寒渴望.cs b/OshimaBot.Content/Skills/ColdBlue/极寒渴望.cs new file mode 100644 index 0000000..df2f45b --- /dev/null +++ b/OshimaBot.Content/Skills/ColdBlue/极寒渴望.cs @@ -0,0 +1,73 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; + +namespace OshimaBot.Content.Skills +{ + public class 极寒渴望 : Skill + { + public override long Id => (long)SuperSkillID.极寒渴望; + public override string Name => "极寒渴望"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double EPCost => 100; + public override double CD => 55; + public override double HardnessTime { get; set; } = 7; + public override bool CanSelectSelf => true; + public override bool CanSelectEnemy => false; + + public 极寒渴望(Character? character = null) : 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} {GameplayEquilibriumConstant.InGameTime}内,增强 [ 累积之压 ] 的最大生命值伤害 {最大生命值伤害 * 100:0.##}%,并获得 {吸血 * 100:0.##}% 吸血。"; + public override bool Durative => true; + public override double Duration => 25; + public override DispelledType DispelledType => DispelledType.CannotBeDispelled; + + private static double 吸血 => 0.2; + private double 最大生命值伤害 => 0.015 * Level; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + character.Lifesteal += 吸血; + if (character.Effects.Where(e => e is 累积之压特效 && e.Skill.Character == character).FirstOrDefault() is 累积之压特效 e) + { + e.系数 += 最大生命值伤害; + } + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + character.Lifesteal -= 吸血; + if (character.Effects.Where(e => e is 累积之压特效 && e.Skill.Character == character).FirstOrDefault() is 累积之压特效 e) + { + e.系数 -= 最大生命值伤害; + } + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + RemainDuration = Duration; + if (!caster.Effects.Contains(this)) + { + caster.Effects.Add(this); + OnEffectGained(new HookContext(GamingQueue, caster)); + } + GamingQueue?.AddApplyEffects(caster, EffectType.DamageBoost, EffectType.Lifesteal); + } + } +} diff --git a/OshimaBot.Content/Skills/ColdBlue/累积之压.cs b/OshimaBot.Content/Skills/ColdBlue/累积之压.cs new file mode 100644 index 0000000..1c59d68 --- /dev/null +++ b/OshimaBot.Content/Skills/ColdBlue/累积之压.cs @@ -0,0 +1,96 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.EffectResult; +using OshimaBot.Content.Effects.PassiveEffects; + +namespace OshimaBot.Content.Skills +{ + public class 累积之压 : Skill + { + public override long Id => (long)PassiveID.累积之压; + public override string Name => "累积之压"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + + public 累积之压(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 累积之压特效(this)); + ExemptionDescription = SkillSet.GetExemptionDescription(EffectType.Cripple); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + public class 累积之压特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"造成伤害时会标记目标,攻击具有标记的敌人将对其造成战斗不能 1 回合,并回收标记,额外对该角色造成 {系数 * 100:0.##}% 最大生命值的物理伤害。"; + public override string DispelDescription => "被驱散性:战斗不能需强驱散,标记可弱驱散"; + + public double 系数 { get; set; } = 0.12; + private bool 是否是嵌套伤害 = false; + + public override BeforeCriticalCheckResult BeforeCriticalCheck(DamageContext ctx) + { + if (ctx.Trigger is not Character actor || ctx.Enemy is not Character enemy) return default; + bool isNormalAttack = ctx.IsNormalAttack; + if (actor == Skill.Character) + { + // 嵌套伤害不进行暴击检定 + return new BeforeCriticalCheckResult { SkipCriticalCheck = 是否是嵌套伤害 }; + } + return default; + } + + public override void AfterDamageCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return; + double damage = ctx.Damage; + double actualDamage = ctx.ActualDamage; + bool isNormalAttack = ctx.IsNormalAttack; + DamageType damageType = ctx.DamageType; + MagicType magicType = ctx.MagicType; + DamageResult damageResult = ctx.DamageResult; + if (character == Skill.Character && actualDamage > 0 && (damageResult == DamageResult.Normal || damageResult == DamageResult.Critical) && !是否是嵌套伤害 && enemy.HP > 0) + { + // 叠标记 + IEnumerable effects = enemy.Effects.Where(e => e is 累积之压标记 && e.Source == character); + if (effects.FirstOrDefault() is 累积之压标记 e) + { + // 移除标记 + enemy.Effects.Remove(e); + double 额外伤害 = 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(new HookContext(GamingQueue, enemy)); + } + 是否是嵌套伤害 = true; + DamageToEnemy(character, enemy, DamageType.Physical, magicType, 额外伤害); + } + else + { + enemy.Effects.Add(new 累积之压标记(Skill, character)); + } + } + + if (character == Skill.Character && 是否是嵌套伤害) + { + 是否是嵌套伤害 = false; + } + } + } +} diff --git a/OshimaBot.Content/Skills/MagicalGirl/少女绮想.cs b/OshimaBot.Content/Skills/MagicalGirl/少女绮想.cs new file mode 100644 index 0000000..b6ffcd3 --- /dev/null +++ b/OshimaBot.Content/Skills/MagicalGirl/少女绮想.cs @@ -0,0 +1,89 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.EffectResult; + +namespace OshimaBot.Content.Skills +{ + public class 少女绮想 : Skill + { + public override long Id => (long)PassiveID.少女绮想; + public override string Name => "少女绮想"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + + public 少女绮想(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 少女绮想特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + public class 少女绮想特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"{Skill.SkillOwner()}进入祈祷的心境。每经过 {时间流逝} {GameplayEquilibriumConstant.InGameTime},提升 {伤害提升 * 100:0.##}% 所有伤害,无上限。受到伤害时清零;造成伤害后,累计提升减少总量的 30%。(下一次提升在:{下一次提升:0.##} {GameplayEquilibriumConstant.InGameTime}后{(累计伤害 > 0 ? $",当前总提升:{累计伤害 * 100:0.##}%" : "")})"; + + private readonly double 时间流逝 = 7; + private readonly double 伤害提升 = 0.21; + private double 累计伤害 = 0; + private double 下一次提升 = 7; + + public override AlterActualDamageResult AlterActualDamageAfterCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return default; + double damage = ctx.Damage; + bool isNormalAttack = ctx.IsNormalAttack; + DamageType damageType = ctx.DamageType; + MagicType magicType = ctx.MagicType; + DamageResult damageResult = ctx.DamageResult; + Dictionary totalDamageBonus = ctx.TotalDamageBonus; + if ((damageResult == DamageResult.Normal || damageResult == DamageResult.Critical) && character == Skill.Character) + { + double 实际伤害提升 = damage * 累计伤害; + if (实际伤害提升 > 0) WriteLine($"[ {character} ] 的伤害提升了 {累计伤害 * 100:0.##}% [ {实际伤害提升:0.##} ] 点!"); + 累计伤害 *= 0.7; + return new AlterActualDamageResult { DamageDelta = 实际伤害提升 }; + + } + return default; + + } + + public override void AfterDamageCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return; + double damage = ctx.Damage; + double actualDamage = ctx.ActualDamage; + bool isNormalAttack = ctx.IsNormalAttack; + DamageType damageType = ctx.DamageType; + MagicType magicType = ctx.MagicType; + DamageResult damageResult = ctx.DamageResult; + if ((damageResult == DamageResult.Normal || damageResult == DamageResult.Critical) && enemy == Skill.Character && actualDamage > 0 && !enemy.Effects.Where(e => e is 绝对领域特效 && e.Skill.Character == character).Any()) + { + 累计伤害 = 0; + } + } + + public override void OnTimeElapsed(TimeLapseContext ctx) + { + if (ctx.Trigger is not Character character) return; + double eapsed = ctx.Elapsed; + if (GamingQueue != null) + { + 下一次提升 -= eapsed; + if (下一次提升 <= 0) + { + 累计伤害 += 伤害提升; + 下一次提升 += 时间流逝; + WriteLine($"[ {character} ] 的 [ {Name} ] 效果增加了,当前总提升:{累计伤害 * 100:0.##}%。"); + } + } + } + } +} diff --git a/OshimaBot.Content/Skills/MagicalGirl/绝对领域.cs b/OshimaBot.Content/Skills/MagicalGirl/绝对领域.cs new file mode 100644 index 0000000..499f1ef --- /dev/null +++ b/OshimaBot.Content/Skills/MagicalGirl/绝对领域.cs @@ -0,0 +1,111 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.EffectResult; +using FunGame.Core.Model.Framework; + +namespace OshimaBot.Content.Skills +{ + public class 绝对领域 : Skill + { + public override long Id => (long)SuperSkillID.绝对领域; + public override string Name => "绝对领域"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double EPCost => Math.Max(100, Character?.EP ?? 100); + public override double CD => 60; + public override double HardnessTime { get; set; } = 5; + public override bool CanSelectSelf => true; + public override bool CanSelectEnemy => false; + + public 绝对领域(Character? character = null) : 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 => $"{Skill.SkillOwner()}展开绝对领域。在 {Duration:0.##} {GameplayEquilibriumConstant.InGameTime}内,敏捷提升 {系数 * 100:0.##}% [ {敏捷提升:0.##} ],无法受到任何伤害,但不免疫负面效果。此技能会消耗至少 100 点能量,每额外消耗 10 能量,持续时间提升 1 {GameplayEquilibriumConstant.InGameTime}。"; + public override bool Durative => true; + public override double Duration => 释放时的能量值 >= 100 ? 13 + (释放时的能量值 - 100) * 0.1 : 14; + public override DispelledType DispelledType => DispelledType.CannotBeDispelled; + + private double 系数 => 0.2 + 0.015 * (Level - 1); + private double 敏捷提升 => 系数 * Skill.Character?.BaseAGI ?? 0; + private double 实际敏捷提升 = 0; + private double 释放时的能量值 = 0; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + 实际敏捷提升 = 敏捷提升; + character.ExAGI += 实际敏捷提升; + WriteLine($"[ {character} ] 的敏捷提升了 {系数 * 100:0.##}% [ {实际敏捷提升:0.##} ] !"); + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + character.ExAGI -= 实际敏捷提升; + } + + public override AlterActualDamageResult AlterActualDamageAfterCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return default; + double damage = ctx.Damage; + bool isNormalAttack = ctx.IsNormalAttack; + DamageType damageType = ctx.DamageType; + MagicType magicType = ctx.MagicType; + DamageResult damageResult = ctx.DamageResult; + Dictionary totalDamageBonus = ctx.TotalDamageBonus; + if (enemy == Skill.Character && (damageResult == DamageResult.Normal || damageResult == DamageResult.Critical)) + { + WriteLine($"[ {enemy} ] 发动了绝对领域,巧妙的化解了此伤害!"); + return new AlterActualDamageResult { IsEvaded = true }; + } + return default; + } + + public override BeforeApplyTrueDamageResult BeforeApplyTrueDamage(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return default; + double damage = ctx.Damage; + bool isNormalAttack = ctx.IsNormalAttack; + DamageResult damageResult = ctx.DamageResult; + if (enemy == Skill.Character && (damageResult == DamageResult.Normal || damageResult == DamageResult.Critical)) + { + WriteLine($"[ {enemy} ] 发动了绝对领域,巧妙的化解了此伤害!"); + return new BeforeApplyTrueDamageResult { NullifyDamage = true }; + } + return default; + } + + public override void OnSkillCasting(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + 释放时的能量值 = caster.EP; + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + RemainDuration = Duration; + if (!caster.Effects.Contains(this)) + { + 实际敏捷提升 = 0; + caster.Effects.Add(this); + OnEffectGained(new HookContext(GamingQueue, caster)); + } + GamingQueue?.AddApplyEffects(caster, EffectType.Invulnerable); + } + } +} diff --git a/OshimaBot.Content/Skills/Mayor/零式崩解.cs b/OshimaBot.Content/Skills/Mayor/零式崩解.cs new file mode 100644 index 0000000..d9b5940 --- /dev/null +++ b/OshimaBot.Content/Skills/Mayor/零式崩解.cs @@ -0,0 +1,43 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Skills +{ + public class 零式崩解 : Skill + { + public override long Id => (long)PassiveID.零式崩解; + public override string Name => "零式崩解"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + + public 零式崩解(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 零式崩解特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + public class 零式崩解特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"{Skill.SkillOwner()}的零式剑法能够轻松命中敌人弱点。{Skill.SkillOwner()}的暴击伤害提升 70%。"; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + character.ExCritDMG += 0.7; + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + character.ExCritDMG -= 0.7; + } + } +} diff --git a/OshimaBot.Content/Skills/Mayor/零式灭杀.cs b/OshimaBot.Content/Skills/Mayor/零式灭杀.cs new file mode 100644 index 0000000..f93aab1 --- /dev/null +++ b/OshimaBot.Content/Skills/Mayor/零式灭杀.cs @@ -0,0 +1,81 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; + +namespace OshimaBot.Content.Skills +{ + public class 零式灭杀 : Skill + { + public override long Id => (long)SuperSkillID.零式灭杀; + public override string Name => "零式灭杀"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double EPCost => 100; + public override double CD => 60 - 1.5 * (Level - 1); + public override double HardnessTime { get; set; } = 8; + public override bool CanSelectSelf => true; + public override bool CanSelectEnemy => false; + + public 零式灭杀(Character? character = null) : 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 => $"{Skill.SkillOwner()}展现零式剑法精准而凶残的奥义。30 {GameplayEquilibriumConstant.InGameTime}内暴击率提升 {暴击率提升 * 100:0.##}%,暴击伤害提升 {暴击伤害提升 * 100:0.##}%,物理穿透提升 {物理穿透提升 * 100:0.##}%。"; + public override bool Durative => true; + public override double Duration => 30; + public override DispelledType DispelledType => DispelledType.CannotBeDispelled; + + private double 暴击率提升 => 0.2 + 0.03 * (Level - 1); + private double 暴击伤害提升 => 0.8 + 0.04 * (Level - 1); + private double 物理穿透提升 => 0.3; + private double 实际暴击率提升 = 0; + private double 实际暴击伤害提升 = 0; + private double 实际物理穿透提升 = 0; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + 实际暴击率提升 = 暴击率提升; + 实际暴击伤害提升 = 暴击伤害提升; + 实际物理穿透提升 = 物理穿透提升; + character.ExCritRate += 实际暴击率提升; + character.ExCritDMG += 实际暴击伤害提升; + character.PhysicalPenetration += 实际物理穿透提升; + WriteLine($"[ {character} ] 的暴击率提升了 [ {实际暴击率提升 * 100:0.##}% ],暴击伤害提升了 [ {实际暴击伤害提升 * 100:0.##}% ],物理穿透提升了 [ {实际物理穿透提升 * 100:0.##}% ] !!"); + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + character.ExCritRate -= 实际暴击率提升; + character.ExCritDMG -= 实际暴击伤害提升; + character.PhysicalPenetration -= 实际物理穿透提升; + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + RemainDuration = Duration; + if (!caster.Effects.Contains(this)) + { + 实际暴击率提升 = 0; + 实际暴击伤害提升 = 0; + 实际物理穿透提升 = 0; + caster.Effects.Add(this); + OnEffectGained(new HookContext(GamingQueue, caster)); + } + GamingQueue?.AddApplyEffects(caster, EffectType.CritBoost, EffectType.PenetrationBoost); + } + } +} diff --git a/OshimaBot.Content/Skills/NanGanyu/三相灵枢.cs b/OshimaBot.Content/Skills/NanGanyu/三相灵枢.cs new file mode 100644 index 0000000..d89b257 --- /dev/null +++ b/OshimaBot.Content/Skills/NanGanyu/三相灵枢.cs @@ -0,0 +1,90 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; + +namespace OshimaBot.Content.Skills +{ + public class 三相灵枢 : Skill + { + public override long Id => (long)SuperSkillID.三相灵枢; + public override string Name => "三相灵枢"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double EPCost => 100; + public override double CD => 80 - 4 * (Level - 1); + public override double HardnessTime { get; set; } = 0; + public override bool CanSelectSelf => true; + public override bool CanSelectEnemy => false; + + public 三相灵枢(Character? character = null) : 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 => $"{Skill.SkillOwner()}操纵三相之力,使 [ 灵能反射 ] 支持普通攻击,且当前释放魔法次数归零,最大硬直消除次数提高到 {灵能反射次数} 次;在魔法命中和普通攻击命中时能够回复所回复能量值的 {魔法值倍数:0.#} 倍魔法值,持续 {技能持续次数} 次(灵能反射每消除次数达到最大时算一次)。" + + $"(剩余:{剩余持续次数} 次)"; + public override DispelledType DispelledType => DispelledType.CannotBeDispelled; + + public int 剩余持续次数 { get; set; } = 0; + private readonly int 灵能反射次数 = 3; + private double 魔法值倍数 + { + get + { + return Skill.Level * 0.5; + } + } + private int 技能持续次数 + { + get + { + return Skill.Level > 3 ? 2 : 1; + } + } + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + IEnumerable effects = character.Effects.Where(e => e is 灵能反射特效); + if (effects.Any() && effects.First() is 灵能反射特效 e && e.Skill.Character == Skill.Character) + { + e.是否支持普攻 = true; + e.触发硬直次数 = 3; + e.释放次数 = 0; + } + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + IEnumerable effects = character.Effects.Where(e => e is 灵能反射特效); + if (effects.Any() && effects.First() is 灵能反射特效 e && e.Skill.Character == Skill.Character) + { + e.是否支持普攻 = false; + e.触发硬直次数 = 2; + } + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + 剩余持续次数 = 技能持续次数; + if (!caster.Effects.Contains(this)) + { + caster.Effects.Add(this); + OnEffectGained(new HookContext(GamingQueue, caster)); + } + GamingQueue?.AddApplyEffects(caster, EffectType.MPRegen, EffectType.Haste); + } + } +} diff --git a/OshimaBot.Content/Skills/NanGanyu/灵能反射.cs b/OshimaBot.Content/Skills/NanGanyu/灵能反射.cs new file mode 100644 index 0000000..eab57f3 --- /dev/null +++ b/OshimaBot.Content/Skills/NanGanyu/灵能反射.cs @@ -0,0 +1,127 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.EffectResult; +using FunGame.Core.Model.Framework; + +namespace OshimaBot.Content.Skills +{ + public class 灵能反射 : Skill + { + public override long Id => (long)PassiveID.灵能反射; + public override string Name => "灵能反射"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + + public 灵能反射(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 灵能反射特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + public class 灵能反射特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"每释放 {触发硬直次数:0.##} 次魔法才会触发硬直时间,且魔法伤害命中时基于 8% 智力 [ {获得额外能量值:0.##} ] 获得额外能量值,并减少所有技能 2 {GameplayEquilibriumConstant.InGameTime}冷却时间。"; + + public bool 是否支持普攻 { get; set; } = false; + public int 触发硬直次数 { get; set; } = 2; + public int 释放次数 { get; set; } = 0; + public double 获得额外能量值 => 0.08 * Skill.Character?.INT ?? 0; + + public override void AfterDamageCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return; + double damage = ctx.Damage; + double actualDamage = ctx.ActualDamage; + bool isNormalAttack = ctx.IsNormalAttack; + DamageType damageType = ctx.DamageType; + MagicType magicType = ctx.MagicType; + DamageResult damageResult = ctx.DamageResult; + if (character == Skill.Character && (是否支持普攻 && isNormalAttack || damageType == DamageType.Magical) && (damageResult == DamageResult.Normal || damageResult == DamageResult.Critical) && character.EP < 200) + { + double 实际获得能量值 = 获得额外能量值; + character.EP += 实际获得能量值; + foreach (Skill scd in character.Skills) + { + scd.CurrentCD -= 2; + if (scd.CurrentCD <= 0) + { + scd.CurrentCD = 0; + scd.Enable = true; + } + } + WriteLine($"[ {character} ] 发动了灵能反射!额外获得了 {实际获得能量值:0.##} 能量,并消除了 2 {GameplayEquilibriumConstant.InGameTime}冷却时间!"); + IEnumerable effects = character.Effects.Where(e => e is 三相灵枢特效); + if (effects.Any() && effects.First() is 三相灵枢特效 e && e.Skill.Character == Skill.Character) + { + double 获得的魔法值 = 实际获得能量值 * 3; + character.MP += 获得的魔法值; + WriteLine($"[ {character} ] 发动了三相灵枢!回复了 {获得的魔法值:0.##} 魔法值!"); + } + } + } + + public override AlterHardnessTimeResult AlterHardnessTimeAfterNormalAttack(HardnessContext ctx) + { + if (ctx.Trigger is not Character character) return default; + if (是否支持普攻) + { + return new AlterHardnessTimeResult { ClearHardnessTime = ClearHardnessTime(character) }; + } + return default; + } + + public override AlterHardnessTimeResult AlterHardnessTimeAfterCastSkill(HardnessContext ctx) + { + if (ctx.Trigger is not Character character) return default; + if (ctx.Skill is Skill skill && skill.SkillType == SkillType.Magic) + { + return new AlterHardnessTimeResult { ClearHardnessTime = ClearHardnessTime(character) }; + } + return default; + } + + /// + /// 触发灵能反射副作用;返回是否清零硬直时间(框架据此将硬直置 0 并解除插队保护) + /// + private bool ClearHardnessTime(Character character) + { + 释放次数++; + if (释放次数 < 触发硬直次数) + { + WriteLine($"[ {character} ] 发动了灵能反射,消除了硬直时间!!"); + if (GamingQueue != null && GamingQueue.CharacterDecisionPoints.TryGetValue(character, out DecisionPoints? dp) && dp != null) + { + dp.ActionsTaken = 1; + dp.ActionsHardnessTime.Clear(); + } + return true; + } + 释放次数 = 0; + IEnumerable effects = character.Effects.Where(e => e is 三相灵枢特效); + if (effects.Any() && effects.First() is 三相灵枢特效 e && e.Skill.Character == Skill.Character) + { + WriteLine($"[ {character} ] 发动了灵能反射,消除了硬直时间!!"); + if (GamingQueue != null && GamingQueue.CharacterDecisionPoints.TryGetValue(character, out DecisionPoints? dp) && dp != null) + { + dp.ActionsTaken = 1; + dp.ActionsHardnessTime.Clear(); + } + e.剩余持续次数--; + if (e.剩余持续次数 == 0) + { + character.Effects.Remove(e); + e.OnEffectLost(new HookContext(GamingQueue, character)); + } + return true; + } + return false; + } + } +} diff --git a/OshimaBot.Content/Skills/Neptune/海王星的野望.cs b/OshimaBot.Content/Skills/Neptune/海王星的野望.cs new file mode 100644 index 0000000..f50ea2e --- /dev/null +++ b/OshimaBot.Content/Skills/Neptune/海王星的野望.cs @@ -0,0 +1,163 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; +using OshimaBot.Content.Effects.PassiveEffects; + +namespace OshimaBot.Content.Skills +{ + public class 海王星的野望 : Skill + { + public override long Id => (long)SuperSkillID.海王星的野望; + public override string Name => "海王星的野望"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double EPCost => 100; + public override double CD => 75; + public override double HardnessTime { get; set; } = 10; + public override bool CanSelectSelf => false; + public override bool CanSelectEnemy => true; + public override bool CanSelectTeammate => false; + public override int CanSelectTargetCount => 3; + public override int CanSelectTargetRange => 3; + + public 海王星的野望(Character? character = null) : base(SkillType.SuperSkill, character) + { + IsNonDirectional = true; + 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 => $"标记{Skill.TargetDescription()},持续 {持续时间:0.##} {GameplayEquilibriumConstant.InGameTime}。立即对标记目标造成 {直接伤害:0.##} 点{CharacterSet.GetDamageTypeName(DamageType.Magical, MagicType)}。" + + $"在持续时间内{爆炸伤害描述}在此期间,{Skill.SkillOwner()}的力量提升 60% [ {力量提升:0.##} ],并且 [ {nameof(深海之戟)} ] 改变为相同机制,可以叠加触发。无视免疫。"; + public override bool Durative => true; + public override double Duration => 持续时间; + public override DispelledType DispelledType => DispelledType.CannotBeDispelled; + public override MagicType MagicType => Skill.Character?.MagicType ?? MagicType.None; + public override ImmuneType IgnoreImmune => ImmuneType.All; + + public string 爆炸伤害描述 => $"对受到标记的目标造成伤害时将产生爆炸,爆炸将产生 {分裂伤害系数 * 100:0.##}% 分裂伤害。分裂伤害为全图索敌,会优先分裂至三个在持续时间内对{Skill.SkillOwner()}造成伤害最多的敌人,若没有符合条件的敌人或敌人数量不足,则将分裂至被标记的敌人,或至多三个随机的敌人。"; + public double 直接伤害 => 180 + 75 * (Skill.Level - 1); + public double 持续时间 => 25 + 2 * (Skill.Level - 1); + public double 分裂伤害系数 => 0.25 + 0.02 * (Skill.Level - 1); + public double 力量提升 => 0.6 * (Skill.Character?.BaseSTR ?? 0); + public Dictionary 敌人伤害统计 { get; set; } = []; + + private double 实际力量提升 = 0; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + 实际力量提升 = 力量提升; + character.ExSTR += 实际力量提升; + if (character.Effects.Where(e => e is 深海之戟特效 && e.Skill.Character == character).FirstOrDefault() is 深海之戟特效 e) + { + e.野望 = this; + } + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + character.ExSTR -= 实际力量提升; + if (character.Effects.Where(e => e is 深海之戟特效 && e.Skill.Character == character).FirstOrDefault() is 深海之戟特效 e) + { + e.野望 = null; + } + } + + public override void AfterDamageCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return; + double damage = ctx.Damage; + double actualDamage = ctx.ActualDamage; + bool isNormalAttack = ctx.IsNormalAttack; + DamageType damageType = ctx.DamageType; + MagicType magicType = ctx.MagicType; + DamageResult damageResult = ctx.DamageResult; + if (enemy == Skill.Character) + { + if (!敌人伤害统计.TryAdd(character, actualDamage)) + { + 敌人伤害统计[character] += actualDamage; + } + } + + if (character == Skill.Character && (damageResult == DamageResult.Normal || damageResult == DamageResult.Critical) && enemy.Effects.FirstOrDefault(e => e is 海王星的野望标记 && e.Source == Skill.Character) is 海王星的野望标记 e) + { + 分裂伤害(character, enemy, actualDamage, damageType, magicType); + } + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + 实际力量提升 = 0; + RemainDuration = Duration; + if (!caster.Effects.Contains(this)) + { + caster.Effects.Add(this); + OnEffectGained(new HookContext(GamingQueue, caster)); + } + foreach (Character target in targets) + { + DamageToEnemy(caster, target, DamageType.Magical, MagicType, 直接伤害); + } + // 造成伤害之后再一起上标记,否则会立即触发标记特效 + foreach (Character target in targets) + { + Effect e = new 海王星的野望标记(Skill, caster) + { + Durative = true, + Duration = 持续时间, + RemainDuration = Duration + }; + target.Effects.Add(e); + e.OnEffectGained(new HookContext(GamingQueue, target)); + AddEffectTypeToCharacter(target, [e.EffectType]); + } + RecordCharacterApplyEffects(caster, EffectType.DamageBoost); + } + + public void 分裂伤害(Character character, Character enemy, double damage, DamageType damageType, MagicType magicType) + { + List targets = []; + targets.AddRange(敌人伤害统计.Where(w => w.Key != character && w.Key != enemy && w.Key.HP > 0).OrderByDescending(o => o.Value).Select(s => s.Key).Take(3)); + if (targets.Count < 3) + { + int count = 3 - targets.Count; + // 获取所有敌人 + List allEnemys = []; + if (GamingQueue != null) + { + allEnemys = [.. GamingQueue.GetEnemies(character).Where(c => c != character && c != enemy && !targets.Contains(c) && c.HP > 0)]; + targets.AddRange(allEnemys.Where(c => c.Effects.Any(e => e is 海王星的野望标记 && e.Source == character)).Take(count)); + if (targets.Count < 3) + { + count = 3 - targets.Count; + targets.AddRange(allEnemys.OrderBy(o => Random.Next()).Take(count)); + } + } + } + damage *= 分裂伤害系数; + foreach (Character target in targets) + { + DamageToEnemy(character, target, damageType, magicType, damage, new(character) + { + CalculateCritical = false, + CalculateReduction = true, + TriggerEffects = false, + IgnoreImmune = true + }); + } + } + } +} diff --git a/OshimaBot.Content/Skills/Neptune/深海之戟.cs b/OshimaBot.Content/Skills/Neptune/深海之戟.cs new file mode 100644 index 0000000..43ed881 --- /dev/null +++ b/OshimaBot.Content/Skills/Neptune/深海之戟.cs @@ -0,0 +1,102 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; +using OshimaBot.Content.Effects.PassiveEffects; + +namespace OshimaBot.Content.Skills +{ + public class 深海之戟 : Skill + { + public override long Id => (long)PassiveID.深海之戟; + public override string Name => "深海之戟"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string ExemptionDescription => Effects.Count > 0 ? Effects.First().ExemptionDescription : ""; + public override int CanSelectTargetRange => 5; + + public 深海之戟(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 深海之戟特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + public class 深海之戟特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description + { + get + { + string str = $"分裂伤害:{分裂百分比 * 100:0.##}%。无视免疫。"; + if (野望 != null) + { + return $"技能机制受 [ {nameof(海王星的野望)} ] 影响而改变:{野望.爆炸伤害描述}未攻击标记目标时,按原机制,在普通攻击暴击时分裂。"; + } + else if (GamingQueue?.Map != null) + { + return $"普通攻击暴击时会自动产生分裂伤害至其附近半径为 {Skill.CanSelectTargetRange} 格的菱形区域内的敌人,但最多只会对两个敌人造成分裂伤害。{str}"; + } + else + { + return $"普通攻击暴击时会自动产生分裂伤害至其他两个随机的敌人。{str}"; + } + } + } + public override ImmuneType IgnoreImmune => ImmuneType.All; + + public double 分裂百分比 { get; set; } = 0.25; + public 海王星的野望特效? 野望 { get; set; } = null; + + public override void AfterDamageCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return; + double damage = ctx.Damage; + double actualDamage = ctx.ActualDamage; + bool isNormalAttack = ctx.IsNormalAttack; + DamageType damageType = ctx.DamageType; + MagicType magicType = ctx.MagicType; + DamageResult damageResult = ctx.DamageResult; + if (character == Skill.Character && 野望 != null && (damageResult == DamageResult.Normal || damageResult == DamageResult.Critical) && enemy.Effects.FirstOrDefault(e => e is 海王星的野望标记 && e.Source == Skill.Character) is 海王星的野望标记 e) + { + 野望.分裂伤害(character, enemy, actualDamage, damageType, magicType); + } + else if (character == Skill.Character && isNormalAttack && damageResult == DamageResult.Critical && GamingQueue != null) + { + List allEnemys = [.. GamingQueue.GetEnemies(character).Where(c => c != character && c != enemy && c.HP > 0)]; + List targets = []; + if (GamingQueue?.Map is GameMap map) + { + List grids = []; + Grid? enemyGrid = map.GetCharacterCurrentGrid(enemy); + if (enemyGrid != null) + { + grids.AddRange(map.GetGridsByRange(enemyGrid, Skill.CanSelectTargetRange, true)); + grids = [.. grids.Where(g => g.Characters.Count > 0).OrderBy(g => GameMap.CalculateManhattanDistance(enemyGrid, g)).Take(2)]; + } + targets = Skill.SelectTargetsByRange(character, allEnemys, [], [], grids, false); + } + else + { + targets.AddRange(allEnemys.OrderBy(o => Random.Next()).Take(2)); + } + double 分裂伤害 = actualDamage * 分裂百分比; + foreach (Character target in targets) + { + DamageToEnemy(character, target, damageType, magicType, 分裂伤害, new(character) + { + CalculateCritical = false, + CalculateReduction = true, + TriggerEffects = false, + IgnoreImmune = true + }); + } + } + } + } +} diff --git a/OshimaBot.Content/Skills/NiuNan/双生流转.cs b/OshimaBot.Content/Skills/NiuNan/双生流转.cs new file mode 100644 index 0000000..effc8c1 --- /dev/null +++ b/OshimaBot.Content/Skills/NiuNan/双生流转.cs @@ -0,0 +1,139 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.EffectResult; + +namespace OshimaBot.Content.Skills +{ + public class 双生流转 : Skill + { + public override long Id => (long)PassiveID.双生流转; + public override string Name => "双生流转"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + + public 双生流转(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 双生流转特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + 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% 时,进入智力模式,核心属性转为智力,还原所有基础智力。力量模式下,造成伤害必定暴击;智力模式下,获得 15% 暴击率、15% 闪避率和 15% 魔法抗性。" + + (Skill.Character != null ? "(当前模式:" + CharacterSet.GetPrimaryAttributeName(Skill.Character.PrimaryAttribute) + ")" : ""); + + private double 交换的基础智力 = 0; + private readonly double 实际增加暴击率 = 0.15; + private readonly double 实际增加闪避率 = 0.15; + private readonly double 实际增加魔法抗性 = 0.15; + private bool 已经加过 = false; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + ResetEffect(character, true); + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + ResetEffect(character, false); + } + + private void ResetEffect(Character character, bool isAdd) + { + if (isAdd) + { + if (!已经加过) + { + 已经加过 = true; + character.ExEvadeRate += 实际增加闪避率; + character.ExCritRate += 实际增加暴击率; + character.MDF[character.MagicType] += 实际增加魔法抗性; + } + } + else + { + if (已经加过) + { + 已经加过 = false; + character.ExEvadeRate -= 实际增加闪避率; + character.ExCritRate -= 实际增加暴击率; + character.MDF[character.MagicType] -= 实际增加魔法抗性; + } + } + } + + public override BeforeCriticalCheckResult BeforeCriticalCheck(DamageContext ctx) + { + if (ctx.Trigger is not Character actor || ctx.Enemy is not Character enemy) return default; + bool isNormalAttack = ctx.IsNormalAttack; + if (actor == Skill.Character) + { + // 力量模式下必定暴击:提供极高的暴击检定加值 + return new BeforeCriticalCheckResult { ThrowingBonusDelta = 200 }; + } + return default; + } + + public override void OnTimeElapsed(TimeLapseContext ctx) + { + if (ctx.Trigger is not Character character) return; + double elapsed = ctx.Elapsed; + Changed(character); + } + + public override void OnAttributeChanged(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + Changed(character); + } + + private void Changed(Character character) + { + 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.BaseINT; + c.ExINT -= 交换的基础智力; + c.ExSTR += 交换的基础智力; + c.Recovery(pastHP, pastMP, pastMaxHP, pastMaxMP); + ResetEffect(character, false); + } + } + 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.ExSTR -= 交换的基础智力; + c.ExINT += 交换的基础智力; + 交换的基础智力 = 0; + c.Recovery(pastHP, pastMP, pastMaxHP, pastMaxMP); + ResetEffect(character, true); + } + } + } + } + } +} diff --git a/OshimaBot.Content/Skills/NiuNan/变幻之心.cs b/OshimaBot.Content/Skills/NiuNan/变幻之心.cs new file mode 100644 index 0000000..8b2e450 --- /dev/null +++ b/OshimaBot.Content/Skills/NiuNan/变幻之心.cs @@ -0,0 +1,191 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; + +namespace OshimaBot.Content.Skills +{ + public class 变幻之心 : Skill + { + public override long Id => (long)SuperSkillID.变幻之心; + public override string Name => "变幻之心"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double EPCost => 100; + public override double CD => 20; + public override double HardnessTime { get; set; } = 3; + public override bool CanSelectSelf => true; + public override bool CanSelectEnemy => false; + + public 变幻之心(Character? character = null) : 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:0.##}% 生命值,同时下 {吸血次数} 次对敌人造成伤害时获得 30% 生命偷取;" + + $"智力模式下,下 {魔法加成次数} 次魔法伤害提升 {伤害提升 * 100:0.##}%。此技能效果不叠加,重复释放时将重置次数;若是模式切换后重复释放,将回收先前的效果。{当前次数描述}"; + public override DispelledType DispelledType => DispelledType.CannotBeDispelled; + + private string 当前次数描述 + { + get + { + string str = ""; + if (当前吸血次数 > 0 || 当前魔法加成次数 > 0) + { + str = 当前吸血次数 > 0 ? "吸血次数" : (当前魔法加成次数 > 0 ? "魔法加成次数" : ""); + if (str != "") + { + str = $"剩余{str}:"; + } + if (当前吸血次数 > 0) + { + str += $"{当前吸血次数} 次。"; + } + else if (当前魔法加成次数 > 0) + { + str += $"{当前魔法加成次数} 次。"; + } + } + return str; + } + } + private int 吸血次数 + { + get + { + return Level switch + { + 1 => 2, + 2 => 2, + 3 => 3, + 4 => 3, + 5 => 4, + 6 => 3, + _ => 2 + }; + } + } + private int 魔法加成次数 + { + get + { + return Level switch + { + 1 => 1, + 2 => 1, + 3 => 2, + 4 => 2, + 5 => 3, + 6 => 3, + _ => 1 + }; + } + } + private double 生命值回复 => 0.25 + 0.03 * (Level - 1); + private double 伤害提升 => 0.6 + 0.4 * (Level - 1); + private int 当前吸血次数 = 0; + private int 当前魔法加成次数 = 0; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (character.PrimaryAttribute == PrimaryAttribute.STR) + { + 当前吸血次数 = 吸血次数; + } + else if (character.PrimaryAttribute == PrimaryAttribute.INT) + { + 当前魔法加成次数 = 魔法加成次数; + } + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + 当前吸血次数 = 0; + 当前魔法加成次数 = 0; + } + + public override double AlterExpectedDamageBeforeCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return 0; + double damage = ctx.Damage; + bool isNormalAttack = ctx.IsNormalAttack; + DamageType damageType = ctx.DamageType; + MagicType magicType = ctx.MagicType; + Dictionary totalDamageBonus = ctx.TotalDamageBonus; + if (character == Skill.Character && damageType == DamageType.Magical && 当前魔法加成次数 > 0) + { + 当前魔法加成次数--; + double 实际伤害提升百分比 = 伤害提升; + double 实际伤害提升 = damage * 实际伤害提升百分比; + WriteLine($"[ {character} ] 发动了变幻之心!伤害提升了 {实际伤害提升:0.##} 点!变幻之心加成剩余:{当前魔法加成次数} 次。"); + if (当前魔法加成次数 == 0) + { + character.Effects.Remove(this); + OnEffectLost(new HookContext(GamingQueue, character)); + } + return 实际伤害提升; + } + return 0; + } + + public override void AfterDamageCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return; + double damage = ctx.Damage; + double actualDamage = ctx.ActualDamage; + bool isNormalAttack = ctx.IsNormalAttack; + DamageType damageType = ctx.DamageType; + MagicType magicType = ctx.MagicType; + DamageResult damageResult = ctx.DamageResult; + if (character == Skill.Character && 当前吸血次数 > 0 && (damageResult == DamageResult.Normal || damageResult == DamageResult.Critical) && damage > 0) + { + 当前吸血次数--; + double 实际吸血 = damage * 0.3; + character.HP += 实际吸血; + WriteLine($"[ {character} ] 发动了变幻之心!回复了 {实际吸血:0.##} 点生命值!变幻之心加成剩余:{当前吸血次数} 次。"); + if (当前吸血次数 == 0) + { + character.Effects.Remove(this); + OnEffectLost(new HookContext(GamingQueue, character)); + } + } + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + IEnumerable effects = caster.Effects.Where(e => e is 双生流转特效 && e.Skill.Character == Skill.Character); + if (effects.Any()) + { + if (caster.Effects.Contains(this)) + { + caster.Effects.Remove(this); + OnEffectLost(new HookContext(GamingQueue, caster)); + } + caster.Effects.Add(this); + OnEffectGained(new HookContext(GamingQueue, caster)); + if (caster.PrimaryAttribute == PrimaryAttribute.STR) + { + double 回复的生命 = 生命值回复 * caster.MaxHP; + HealToTarget(caster, caster, 回复的生命); + GamingQueue?.AddApplyEffects(caster, EffectType.Lifesteal); + } + else if (caster.PrimaryAttribute == PrimaryAttribute.INT) + { + GamingQueue?.AddApplyEffects(caster, EffectType.DamageBoost); + } + } + } + } +} diff --git a/OshimaBot.Content/Skills/Oshima/META马.cs b/OshimaBot.Content/Skills/Oshima/META马.cs new file mode 100644 index 0000000..4f2dd51 --- /dev/null +++ b/OshimaBot.Content/Skills/Oshima/META马.cs @@ -0,0 +1,69 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.EffectResult; + +namespace OshimaBot.Content.Skills +{ + public class META马 : Skill + { + public override long Id => (long)PassiveID.META马; + public override string Name => "META马"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + + public META马(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new META马特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + 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:0.##} ] 能量值。"; + + public static double EP => 7; + + public override AlterEPResult AlterEPAfterGetDamage(DamageContext ctx) + { + if (ctx.Trigger is not Character character) return default; + double baseEP = ctx.BaseEP * 1.5; + if (Skill.Character != null) WriteLine($"[ {Skill.Character} ] 发动了META马专属被动!本次获得了 {baseEP:0.##} 能量!"); + return new AlterEPResult { BaseEP = baseEP }; + } + + public override void OnTurnStart(TurnContext ctx) + { + if (ctx.Trigger is not Character character) return; + List enemys = ctx.Enemys; + List teammates = ctx.Teammates; + List skills = ctx.Skills; + List items = ctx.Items; + if (character.EP < 200) + { + character.EP += EP; + WriteLine($"[ {character} ] 发动了META马专属被动!本次获得了 {EP:0.##} 能量!"); + } + } + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + character.InitialSTR += 5; + character.STRGrowth += 0.5; + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + character.InitialSTR -= 5; + character.STRGrowth -= 0.5; + } + } +} diff --git a/OshimaBot.Content/Skills/Oshima/熵灭极诣.cs b/OshimaBot.Content/Skills/Oshima/熵灭极诣.cs new file mode 100644 index 0000000..f45c58f --- /dev/null +++ b/OshimaBot.Content/Skills/Oshima/熵灭极诣.cs @@ -0,0 +1,88 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; + +namespace OshimaBot.Content.Skills +{ + public class 熵灭极诣 : Skill + { + public override long Id => (long)SuperSkillID.熵灭极诣; + public override string Name => "熵灭·极诣"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double EPCost => 100; + public override double CD => 55; + public override double HardnessTime { get; set; } = 0; + public override bool CanSelectSelf => true; + public override bool CanSelectEnemy => false; + + public 熵灭极诣(Character? character = null) : 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 => $"{Skill.SkillOwner()}释放「熵灭」的力量,获得 135% 力量 [ {攻击力加成:0.##} ] 的攻击力加成,但每次普通攻击命中时都会损失自身 6% 当前生命值 [ {当前生命值:0.##} ],持续 {Duration:0.##} {GameplayEquilibriumConstant.InGameTime}。"; + public override bool Durative => true; + public override double Duration => 10 + 2 * (Level - 1); + public override DispelledType DispelledType => DispelledType.CannotBeDispelled; + + private double 攻击力加成 => Skill.Character?.STR * 1.35 ?? 0; + private double 当前生命值 => Skill.Character?.HP * 0.06 ?? 0; + private double 实际攻击力加成 = 0; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + 实际攻击力加成 = 攻击力加成; + character.ExATK2 += 实际攻击力加成; + WriteLine($"[ {character} ] 的攻击力增加了 [ {实际攻击力加成:0.##} ] !"); + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + // 恢复到原始攻击力 + character.ExATK2 -= 实际攻击力加成; + } + + public override void AfterDamageCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return; + double damage = ctx.Damage; + double actualDamage = ctx.ActualDamage; + bool isNormalAttack = ctx.IsNormalAttack; + DamageType damageType = ctx.DamageType; + MagicType magicType = ctx.MagicType; + DamageResult damageResult = ctx.DamageResult; + if (character == Skill.Character && isNormalAttack && (damageResult == DamageResult.Normal || damageResult == DamageResult.Critical)) + { + double 生命值减少 = 当前生命值; + character.HP -= 生命值减少; + WriteLine($"[ {character} ] 由于自身力量过于强大而被反噬,损失了 [ {生命值减少:0.##} ] 点生命值!"); + } + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + RemainDuration = Duration; + if (!caster.Effects.Contains(this)) + { + 实际攻击力加成 = 0; + caster.Effects.Add(this); + OnEffectGained(new HookContext(GamingQueue, caster)); + } + GamingQueue?.AddApplyEffects(caster, EffectType.DamageBoost); + } + } +} diff --git a/OshimaBot.Content/Skills/QWQAQW/宿命时律.cs b/OshimaBot.Content/Skills/QWQAQW/宿命时律.cs new file mode 100644 index 0000000..4c0152d --- /dev/null +++ b/OshimaBot.Content/Skills/QWQAQW/宿命时律.cs @@ -0,0 +1,101 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.EffectResult; +using FunGame.Core.Model.Framework; + +namespace OshimaBot.Content.Skills +{ + public class 宿命时律 : Skill + { + public override long Id => (long)SuperSkillID.宿命时律; + public override string Name => "宿命时律"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double EPCost => 100; + public override double CD => 60 - 4 * (Level - 1); + public override double HardnessTime { get; set; } = 10; + public override bool CanSelectSelf => true; + public override bool CanSelectEnemy => false; + + public 宿命时律(Character? character = null) : 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:0.##} {GameplayEquilibriumConstant.InGameTime}内,提升自身 25% 物理伤害减免和魔法抗性,普通攻击转为魔法伤害,且硬直时间减少 30%,并基于 {智力系数 * 100:0.##}% 智力 [ {智力加成:0.##} ] 强化普通攻击伤害。"; + public override bool Durative => true; + public override double Duration => 40; + public override DispelledType DispelledType => DispelledType.CannotBeDispelled; + + private double 智力系数 => 1.4 + 0.4 * (Level - 1); + private double 智力加成 => 智力系数 * Skill.Character?.INT ?? 0; + private double 物理伤害减免 => 0.25; + private double 魔法抗性 => 0.25; + private double 实际物理伤害减免 = 0; + private double 实际魔法抗性 = 0; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + character.NormalAttack.SetMagicType(new(this, true, MagicType.None, 999), GamingQueue); + 实际物理伤害减免 = 物理伤害减免; + 实际魔法抗性 = 魔法抗性; + character.ExPDR += 实际物理伤害减免; + character.MDF[character.MagicType] += 实际魔法抗性; + WriteLine($"[ {character} ] 提升了 {实际物理伤害减免 * 100:0.##}% 物理伤害减免,{实际魔法抗性 * 100:0.##}% 魔法抗性!!"); + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + character.NormalAttack.UnsetMagicType(this, GamingQueue); + character.ExPDR -= 实际物理伤害减免; + character.MDF[character.MagicType] -= 实际魔法抗性; + 实际物理伤害减免 = 0; + 实际魔法抗性 = 0; + } + + public override double AlterExpectedDamageBeforeCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return 0; + double damage = ctx.Damage; + bool isNormalAttack = ctx.IsNormalAttack; + DamageType damageType = ctx.DamageType; + MagicType magicType = ctx.MagicType; + Dictionary totalDamageBonus = ctx.TotalDamageBonus; + if (character == Skill.Character && isNormalAttack) + { + WriteLine($"[ {character} ] 发动了宿命时律!伤害提升了 {智力加成:0.##} 点!"); + return 智力加成; + } + return 0; + } + + public override AlterHardnessTimeResult AlterHardnessTimeAfterNormalAttack(HardnessContext ctx) + { + if (ctx.Trigger is not Character character) return default; + return new AlterHardnessTimeResult { Factor = -0.7 }; + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + RemainDuration = Duration; + if (!caster.Effects.Contains(this)) + { + caster.Effects.Add(this); + OnEffectGained(new HookContext(GamingQueue, caster)); + } + GamingQueue?.AddApplyEffects(caster, EffectType.DamageBoost, EffectType.Haste, EffectType.DefenseBoost); + } + } +} diff --git a/OshimaBot.Content/Skills/QWQAQW/破釜沉舟.cs b/OshimaBot.Content/Skills/QWQAQW/破釜沉舟.cs new file mode 100644 index 0000000..f14269e --- /dev/null +++ b/OshimaBot.Content/Skills/QWQAQW/破釜沉舟.cs @@ -0,0 +1,154 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.EffectResult; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Skills +{ + public class 破釜沉舟 : Skill + { + public override long Id => (long)PassiveID.破釜沉舟; + public override string Name => "破釜沉舟"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + + public 破釜沉舟(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 破釜沉舟特效(this)); + Effects.Add(new ExMaxHP2(this, new() + { + { "exhp", -0.2 } + }) + { + ParentEffect = Effects.First(), + ForceHideInStatusBar = true + }); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + public class 破釜沉舟特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"{Skill.SkillOwner()}已经看透了生命的真谛。{Skill.SkillOwner()}的最大生命值减少 20%,并获得破釜沉舟特效。破釜沉舟:生命值高于 40% 时,受到额外的 [ {高于40额外伤害下限}~{高于40额外伤害上限}% ] 伤害,获得 [ 累计所受伤害的 {高于40的加成下限}~{高于40的加成上限}% ] 伤害加成;生命值低于等于 40% 时,不会受到额外的伤害,并且获得 [ 累计受到的伤害 {低于40的加成下限}~{低于40的加成上限}% ] 的伤害加成。" + + $"在没有累计任何受到伤害的时候,将获得 {常规伤害加成 * 100:0.##}% 伤害加成和 {常规生命偷取 * 100:0.##}% 生命偷取。通过累计受到伤害发动破釜沉舟时,目标的闪避检定获得 30% 的减值,并立即清除累计受到的伤害。" + (累计受到的伤害 > 0 ? $"(当前累计受到伤害:{累计受到的伤害:0.##})" : ""); + + private bool 已通过累计受到伤害发动破釜沉舟 = false; + private double 累计受到的伤害 = 0; + private double 这次的伤害加成 = 0; + private double 受到伤害之前的HP = 0; + private double 这次受到的额外伤害 = 0; + private readonly double 常规伤害加成 = 0.35; + private readonly double 常规生命偷取 = 0.15; + private readonly int 高于40额外伤害上限 = 40; + private readonly int 高于40额外伤害下限 = 20; + private readonly int 高于40的加成上限 = 90; + private readonly int 高于40的加成下限 = 60; + private readonly int 低于40的加成上限 = 120; + private readonly int 低于40的加成下限 = 100; + + private double 伤害加成(double damage) + { + double 系数 = 常规伤害加成; + Character? character = Skill.Character; + if (character != null && 累计受到的伤害 != 0) + { + if (character.HP > character.MaxHP * 0.4) + { + 系数 = (Random.Next(高于40的加成下限, 高于40的加成上限) + 0.0) / 100; + } + else + { + 系数 = (Random.Next(低于40的加成下限, 低于40的加成上限) + 0.0) / 100; + } + return 系数 * 累计受到的伤害; + } + return 系数 * damage; + } + + public override double AlterExpectedDamageBeforeCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return 0; + double damage = ctx.Damage; + bool isNormalAttack = ctx.IsNormalAttack; + DamageType damageType = ctx.DamageType; + MagicType magicType = ctx.MagicType; + Dictionary totalDamageBonus = ctx.TotalDamageBonus; + if (character == Skill.Character) + { + 已通过累计受到伤害发动破釜沉舟 = 累计受到的伤害 != 0; + 这次的伤害加成 = 伤害加成(damage); + WriteLine($"[ {character} ] 发动了破釜沉舟,获得了 {这次的伤害加成:0.##} 点伤害加成!"); + return 这次的伤害加成; + } + + if (enemy == Skill.Character) + { + 受到伤害之前的HP = enemy.HP; + if (enemy.HP > enemy.MaxHP * 0.4) + { + // 额外受到伤害 + double 系数 = (Random.Next(高于40额外伤害下限, 高于40额外伤害上限) + 0.0) / 100; + 这次受到的额外伤害 = damage * 系数; + WriteLine($"[ {enemy} ] 的破釜沉舟触发,将额外受到 {这次受到的额外伤害:0.##} 点伤害!"); + } + else 这次受到的额外伤害 = 0; + return 这次受到的额外伤害; + } + + return 0; + } + + public override void AfterDamageCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return; + double damage = ctx.Damage; + double actualDamage = ctx.ActualDamage; + bool isNormalAttack = ctx.IsNormalAttack; + DamageType damageType = ctx.DamageType; + MagicType magicType = ctx.MagicType; + DamageResult damageResult = ctx.DamageResult; + if (enemy == Skill.Character && (damageResult == DamageResult.Normal || damageResult == DamageResult.Critical)) + { + 累计受到的伤害 += actualDamage; + if (enemy.HP < 0 && 受到伤害之前的HP - actualDamage + 这次受到的额外伤害 > 0) + { + enemy.HP = 10; + WriteLine($"[ {enemy} ] 的破釜沉舟触发,保护了自己不进入死亡!!"); + } + } + + if (character == Skill.Character && 已通过累计受到伤害发动破釜沉舟) + { + 已通过累计受到伤害发动破釜沉舟 = false; + 累计受到的伤害 = 0; + double ls = actualDamage * 常规生命偷取; + HealToTarget(character, character, ls, triggerEffects: false); + WriteLine($"[ {character} ] 发动了破釜沉舟,回复了 {ls:0.##} 点生命值!"); + } + } + + public override BeforeEvadeCheckResult BeforeEvadeCheck(DamageContext ctx) + { + if (ctx.Trigger is not Character actor) return default; + if (已通过累计受到伤害发动破釜沉舟 && actor == Skill.Character) + { + // 发动后本次攻击更易被闪避 + return new BeforeEvadeCheckResult { ThrowingBonusDelta = -0.3 }; + } + return default; + } + + public override void OnTurnEnd(TurnContext ctx) + { + if (ctx.Trigger is not Character character) return; + 已通过累计受到伤害发动破釜沉舟 = false; + } + } +} diff --git a/OshimaBot.Content/Skills/QingXiang/暗香疏影.cs b/OshimaBot.Content/Skills/QingXiang/暗香疏影.cs new file mode 100644 index 0000000..a85b8cf --- /dev/null +++ b/OshimaBot.Content/Skills/QingXiang/暗香疏影.cs @@ -0,0 +1,63 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Skills +{ + public class 暗香疏影 : Skill + { + public override long Id => (long)PassiveID.暗香疏影; + public override string Name => "暗香疏影"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + + public 暗香疏影(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 暗香疏影特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + public class 暗香疏影特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"每次造成伤害都会随机减少对方 [ 7~15 ] 点能量值,对能量值低于一半的角色额外造成 30% 伤害。对于暗香疏影而言,能量值大于 100 且小于 150 时,视为低于一半。"; + + private bool 是否是嵌套伤害 = false; + + public override void AfterDamageCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return; + double damage = ctx.Damage; + double actualDamage = ctx.ActualDamage; + bool isNormalAttack = ctx.IsNormalAttack; + DamageType damageType = ctx.DamageType; + MagicType magicType = ctx.MagicType; + DamageResult damageResult = ctx.DamageResult; + if (character == Skill.Character && (damageResult == DamageResult.Normal || damageResult == DamageResult.Critical) && !是否是嵌套伤害 && enemy.HP > 0) + { + // 减少能量 + double EP = Random.Next(7, 15); + enemy.EP -= EP; + WriteLine($"[ {character} ] 发动了暗香疏影![ {enemy} ] 的能量值被减少了 {EP:0.##} 点!现有能量:{enemy.EP:0.##}。"); + // 额外伤害 + if (enemy.EP >= 0 && enemy.EP < 50 || enemy.EP >= 100 && enemy.EP < 150) + { + double 额外伤害 = damage * 0.3; + WriteLine($"[ {character} ] 发动了暗香疏影!将造成额外伤害!"); + 是否是嵌套伤害 = true; + DamageToEnemy(character, enemy, damageType, magicType, 额外伤害); + } + } + + if (character == Skill.Character && 是否是嵌套伤害) + { + 是否是嵌套伤害 = false; + } + } + } +} diff --git a/OshimaBot.Content/Skills/QingXiang/残香凋零.cs b/OshimaBot.Content/Skills/QingXiang/残香凋零.cs new file mode 100644 index 0000000..ab12da2 --- /dev/null +++ b/OshimaBot.Content/Skills/QingXiang/残香凋零.cs @@ -0,0 +1,60 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; + +namespace OshimaBot.Content.Skills +{ + public class 残香凋零 : Skill + { + public override long Id => (long)SuperSkillID.残香凋零; + public override string Name => "残香凋零"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override double EPCost => 100; + public override double CD => 100 - 4 * (Level - 1); + public override double HardnessTime { get; set; } = 12; + public override bool CanSelectSelf => false; + public override bool CanSelectEnemy => true; + + public 残香凋零(Character? character = null) : base(SkillType.SuperSkill, character) + { + CastAnywhere = true; + Effects.Add(new 残香凋零特效(this)); + } + + public override void OnTurnStart(Character character, List enemys, List teammates, List skills, List items) + { + if (Character == character) + { + CanSelectTargetCount = enemys.Count; + if (CanSelectTargetCount > 6) CanSelectTargetCount = 6; + } + } + } + + public class 残香凋零特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"{Skill.SkillOwner()}释放能够动荡能量流的深渊之死气。对至多 6 个角色造成 " + + $"{能量系数 * 100:0.##}% 其现有能量值 + {智力系数 * 100:0.##}% 智力 [ {智力伤害:0.##} ] 的魔法伤害。"; + + private double 智力系数 => 0.2 * Level; + private double 智力伤害 => 智力系数 * Skill.Character?.INT ?? 0; + private double 能量系数 => 1 * Level; + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + foreach (Character c in targets) + { + double ep = c.EP; + DamageToEnemy(caster, c, DamageType.Magical, MagicType, ep * 能量系数 + 智力伤害); + } + } + } +} diff --git a/OshimaBot.Content/Skills/QuDuoduo/弱者猎手.cs b/OshimaBot.Content/Skills/QuDuoduo/弱者猎手.cs new file mode 100644 index 0000000..0f457d9 --- /dev/null +++ b/OshimaBot.Content/Skills/QuDuoduo/弱者猎手.cs @@ -0,0 +1,82 @@ +using FunGame.Core.Entity; +using FunGame.Core.Interface.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Skills +{ + public class 弱者猎手 : Skill + { + public override long Id => (long)PassiveID.弱者猎手; + public override string Name => "弱者猎手"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + + public 弱者猎手(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 弱者猎手特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + public class 弱者猎手特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"在 AI 控制下,任何目标都将则优先选择血量更低的角色。行动开始时,弱者猎手会盯上一名角色,然后标记所有生命值百分比低于自己的角色。在此回合内攻击被盯上或者被标记的角色,将造成 140% 伤害。"; + + public HashSet 猎手标记 { get; set; } = []; + + public override double AlterExpectedDamageBeforeCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return 0; + double damage = ctx.Damage; + bool isNormalAttack = ctx.IsNormalAttack; + DamageType damageType = ctx.DamageType; + MagicType magicType = ctx.MagicType; + Dictionary totalDamageBonus = ctx.TotalDamageBonus; + if (character == Skill.Character && 猎手标记.Contains(enemy)) + { + double 额外伤害 = damage * 0.4; + return 额外伤害; + } + return 0; + } + + public override void AlterSelectListBeforeSelection(SelectionContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Skill is not ISkill skill) return; + List allEnemys = ctx.AllEnemys; + List allTeammates = ctx.AllTeammates; + List enemys = ctx.Enemys; + List teammates = ctx.Teammates; + 猎手标记.Clear(); + AddHalfOfMe([.. enemys.Where(e => e.HP > 0).OrderBy(e => e.HP / e.MaxHP)]); + if (猎手标记.Count > 0) + { + WriteLine($"[ {character} ] 的弱者猎手标记了以下角色:[ {string.Join(" ] / [ ", 猎手标记)} ] !"); + if (IsCharacterInAIControlling(character)) + { + enemys.Clear(); + int count = skill.RealCanSelectTargetCount(enemys, teammates); + enemys.AddRange(猎手标记.Take(count)); + WriteLine($"[ {character} ] 发动了弱者猎手![ {string.Join(" ] / [ ", enemys)} ] 被盯上了!"); + } + } + } + + private void AddHalfOfMe(params IEnumerable enemys) + { + foreach (Character enemy in enemys) + { + if (Skill.Character != null && enemy.HP > 0 && (enemy.HP / enemy.MaxHP) < (Skill.Character.HP / Skill.Character.MaxHP)) + { + 猎手标记.Add(enemy); + } + } + } + } +} diff --git a/OshimaBot.Content/Skills/QuDuoduo/饕餮盛宴.cs b/OshimaBot.Content/Skills/QuDuoduo/饕餮盛宴.cs new file mode 100644 index 0000000..c406985 --- /dev/null +++ b/OshimaBot.Content/Skills/QuDuoduo/饕餮盛宴.cs @@ -0,0 +1,68 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; + +namespace OshimaBot.Content.Skills +{ + public class 饕餮盛宴 : Skill + { + public override long Id => (long)SuperSkillID.饕餮盛宴; + public override string Name => "饕餮盛宴"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double EPCost => 100; + public override double CD => 45 + 1 * (Level - 1); + public override double HardnessTime { get; set; } = 7; + public override bool CanSelectSelf => true; + public override bool CanSelectEnemy => false; + + public 饕餮盛宴(Character? character = null) : 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 => $"获得 {吸血系数 * 100:0.##}% 吸血,持续 {Duration:0.##} {GameplayEquilibriumConstant.InGameTime}。"; + public override bool Durative => true; + public override double Duration => 30; + public override DispelledType DispelledType => DispelledType.CannotBeDispelled; + + private double 吸血系数 => 0.2 + 0.05 * (Level - 1); + + public override void AfterDamageCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return; + double damage = ctx.Damage; + double actualDamage = ctx.ActualDamage; + bool isNormalAttack = ctx.IsNormalAttack; + DamageType damageType = ctx.DamageType; + MagicType magicType = ctx.MagicType; + DamageResult damageResult = ctx.DamageResult; + if (character == Skill.Character && (damageResult == DamageResult.Normal || damageResult == DamageResult.Critical) && character.HP < character.MaxHP) + { + double 实际吸血 = 吸血系数 * damage; + HealToTarget(character, character, 实际吸血); + } + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + RemainDuration = Duration; + if (!caster.Effects.Contains(this)) + { + caster.Effects.Add(this); + OnEffectGained(new HookContext(GamingQueue, caster)); + } + GamingQueue?.AddApplyEffects(caster, EffectType.Lifesteal); + } + } +} diff --git a/OshimaBot.Content/Skills/Ryuko/不息之流.cs b/OshimaBot.Content/Skills/Ryuko/不息之流.cs new file mode 100644 index 0000000..307bb37 --- /dev/null +++ b/OshimaBot.Content/Skills/Ryuko/不息之流.cs @@ -0,0 +1,45 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Skills +{ + public class 不息之流 : Skill + { + public override long Id => (long)PassiveID.不息之流; + public override string Name => "不息之流"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + + public 不息之流(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 不息之流特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + public class 不息之流特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"{Skill.SkillOwner()}处于正常态和吟唱态时,每秒回复 {回复系数 * 100:0.##}% 最大生命值 [ {Skill.Character?.MaxHP * 回复系数:0.##} ] 并获得 {能量获取:0.##} 点能量。"; + + public double 回复系数 { get; set; } = 0.01; + public double 能量获取 { get; set; } = 1; + + public override void OnTimeElapsed(TimeLapseContext ctx) + { + if (ctx.Trigger is not Character character) return; + double elapsed = ctx.Elapsed; + if (character.CharacterState == CharacterState.Actionable || character.CharacterState == CharacterState.Casting || character.CharacterState == CharacterState.PreCastSuperSkill) + { + character.HP += (Skill.Character?.MaxHP ?? 0) * 回复系数 * elapsed; + character.EP += 能量获取 * elapsed; + } + } + } +} diff --git a/OshimaBot.Content/Skills/Ryuko/宿命之潮.cs b/OshimaBot.Content/Skills/Ryuko/宿命之潮.cs new file mode 100644 index 0000000..846d04b --- /dev/null +++ b/OshimaBot.Content/Skills/Ryuko/宿命之潮.cs @@ -0,0 +1,223 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.EffectResult; +using FunGame.Core.Model.Framework; +using OshimaBot.Content.Effects.PassiveEffects; + +namespace OshimaBot.Content.Skills +{ + public class 宿命之潮 : Skill + { + public override long Id => (long)SuperSkillID.宿命之潮; + public override string Name => "宿命之潮"; + public override string Description => Effects.Count > 0 ? ((宿命之潮特效)Effects.First()).通用描述 : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override string ExemptionDescription => Effects.Count > 0 ? Effects.First().ExemptionDescription : ""; + public override double EPCost => 100; + public override double CD => 80; + public override double HardnessTime { get; set; } = 2; + public override bool CanSelectSelf => true; + public override bool CanSelectEnemy => false; + + public 宿命之潮(Character? character = null) : base(SkillType.SuperSkill, character) + { + Effects.Add(new 宿命之潮特效(this)); + } + } + + public class 宿命之潮特效 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description { get; set; } = ""; + public override bool Durative => true; + public override DispelledType DispelledType => DispelledType.CannotBeDispelled; + public override string DispelDescription => $"被驱散性:所有回复/禁止回复不可驱散,攻击力加成不可驱散,嘲讽需强驱散"; + public override PrimaryAttribute ExemptionType => PrimaryAttribute.AGI; + public override bool ExemptDuration => false; + + public string 通用描述 => $"{Skill.SkillOwner()}可以选择获得哪一种力量:\r\n{熵核描述}\r\n{守护描述}"; + private string 熵核描述 => $"【熵核】加速生命回复,每{GameplayEquilibriumConstant.InGameTime}额外回复 {熵核额外回复 * 100:0.##}% 当前生命值 [ {Skill.Character?.HP * 熵核额外回复:0.##} ],攻击力提升 {熵核攻击力提升 * 100:0.##}% [ {Skill.Character?.BaseATK * 熵核攻击力提升:0.##} ],但是受到的伤害提升 {熵核受到伤害提升 * 100:0.##}%。" + + $"对敌人造成伤害会使其在 {熵核影响敌人时间:0.##} {GameplayEquilibriumConstant.InGameTime}内无法获得自然的生命和魔法回复的禁止治疗效果,施加该状态时,只有目标的敏捷高于{Skill.SkillOwner()}的角色才能进行豁免检定。持续 {熵核持续时间:0.##} {GameplayEquilibriumConstant.InGameTime}。"; + private static double 熵核额外回复 => 0.02; + private double 熵核攻击力提升 => 0.2 + 0.1 * (Skill.Level - 1); + private double 熵核受到伤害提升 => 0.15 + 0.05 * (Skill.Level - 1); + private static double 熵核影响敌人时间 => 10; + private double 熵核持续时间 => 15 + 2 * (Skill.Level - 1); + private string 守护描述 => $"【守护】极致地加速生命回复,每{GameplayEquilibriumConstant.InGameTime}额外回复 {守护额外回复 * 100:0.##}% 当前生命值 [ {Skill.Character?.HP * 守护额外回复:0.##} ],为全体友方角色提供每{GameplayEquilibriumConstant.InGameTime}额外 {守护友方回复 * 100:0.##}% 当前生命值的生命回复,并嘲讽全体敌方角色,被嘲讽的角色仅能将{Skill.SkillOwner()}作为攻击目标。" + + $"施加嘲讽状态时,只有目标的敏捷高于{Skill.SkillOwner()}的角色才能进行豁免检定。持续 {守护持续时间:0.##} {GameplayEquilibriumConstant.InGameTime}。"; + private double 守护额外回复 => 0.01 + 0.003 * (Skill.Level - 1); + private double 守护友方回复 => 0.01 + 0.002 * (Skill.Level - 1); + private double 守护持续时间 => 15 + 1 * (Skill.Level - 1); + private bool 选择熵核 { get; set; } = false; + + private double 实际攻击力提升 = 0; + private bool 实际选择熵核 = false; + + public 宿命之潮特效(Skill skill) : base(skill) + { + Description = 通用描述; + } + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (实际选择熵核) + { + 实际攻击力提升 = 熵核攻击力提升; + character.ExATKPercentage += 实际攻击力提升; + WriteLine($"[ {character} ] 的攻击力提升了 {实际攻击力提升 * 100:0.##}% [ {character.BaseATK * 实际攻击力提升:0.##} ] !"); + } + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (实际选择熵核) + { + character.ExATKPercentage -= 实际攻击力提升; + } + } + + public override AlterActualDamageResult AlterActualDamageAfterCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return default; + double damage = ctx.Damage; + bool isNormalAttack = ctx.IsNormalAttack; + DamageType damageType = ctx.DamageType; + MagicType magicType = ctx.MagicType; + DamageResult damageResult = ctx.DamageResult; + Dictionary totalDamageBonus = ctx.TotalDamageBonus; + if (实际选择熵核 && enemy == Skill.Character && (damageResult == DamageResult.Normal || damageResult == DamageResult.Critical)) + { + double bouns = -(damage * 熵核受到伤害提升); + WriteLine($"[ {enemy} ] 触发了宿命之潮,额外受到 {Math.Abs(bouns):0.##} 伤害!"); + return new AlterActualDamageResult { DamageDelta = bouns }; + + } + return default; + + } + + public override void AfterDamageCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return; + double damage = ctx.Damage; + double actualDamage = ctx.ActualDamage; + bool isNormalAttack = ctx.IsNormalAttack; + DamageType damageType = ctx.DamageType; + MagicType magicType = ctx.MagicType; + DamageResult damageResult = ctx.DamageResult; + if (实际选择熵核 && character == Skill.Character && (damageResult == DamageResult.Normal || damageResult == DamageResult.Critical) && !CheckSkilledImmune(character, enemy, Skill)) + { + 禁止治疗 e = new(Skill, character, false, true, true, true, 熵核影响敌人时间, 0) + { + ExemptionType = PrimaryAttribute.AGI, + ExemptDuration = false, + DispelledType = DispelledType + }; + if (enemy.AGI <= character.AGI || (enemy.AGI > character.AGI && !CheckExemption(character, enemy, e))) + { + WriteLine($"[ {character} ] 对 [ {enemy} ] 施加了禁止治疗{e.禁止类型}!!持续时间:{熵核影响敌人时间:0.##} {GameplayEquilibriumConstant.InGameTime}!"); + enemy.Effects.Add(e); + e.OnEffectGained(new HookContext(GamingQueue, enemy)); + GamingQueue?.AddApplyEffects(enemy, e.EffectType); + } + } + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + if (caster.Effects.Contains(this)) + { + OnEffectLost(new HookContext(GamingQueue, caster)); + caster.Effects.Remove(this); + } + caster.Effects.Add(this); + 实际攻击力提升 = 0; + InquiryResponse response = Inquiry(caster, new(InquiryType.Choice, nameof(宿命之潮)) + { + Description = "作出抉择", + Choices = new() + { + { "熵核", 熵核描述 }, + { "守护", 守护描述 } + }, + DefaultChoice = Random.Next() % 2 == 0 ? "熵核" : "守护", + CanCancel = false + }); + if (response.Choices.Count > 0) + { + 选择熵核 = response.Choices[0] == "熵核"; + } + 实际选择熵核 = 选择熵核; + Duration = 实际选择熵核 ? 熵核持续时间 : 守护持续时间; + RemainDuration = Duration; + OnEffectGained(new HookContext(GamingQueue, caster)); + if (实际选择熵核) + { + Description = $"作出抉择:{熵核描述}"; + Effect effect = new 持续回复(Skill, caster, caster, true, Duration, 0, true, 0, 熵核额外回复) + { + DispelledType = DispelledType + }; + WriteLine($"[ {caster} ] 获得了持续生命回复!持续时间:{Duration:0.##} {GameplayEquilibriumConstant.InGameTime}!"); + caster.Effects.Add(effect); + effect.OnEffectGained(new HookContext(GamingQueue, caster)); + GamingQueue?.AddApplyEffects(caster, effect.EffectType); + } + else + { + Description = $"作出抉择:{守护描述}"; + Effect effect = new 持续回复(Skill, caster, caster, true, Duration, 0, true, 0, 守护额外回复) + { + DispelledType = DispelledType + }; + WriteLine($"[ {caster} ] 获得了持续生命回复!持续时间:{Duration:0.##} {GameplayEquilibriumConstant.InGameTime}!"); + caster.Effects.Add(effect); + effect.OnEffectGained(new HookContext(GamingQueue, caster)); + GamingQueue?.AddApplyEffects(caster, effect.EffectType); + List allEnemys = []; + List allTeammates = []; + if (GamingQueue != null) + { + allEnemys = [.. GamingQueue.GetEnemies(caster).Where(c => c != caster && GamingQueue.Queue.Contains(c))]; + allTeammates = [.. GamingQueue.GetTeammates(caster).Where(c => c != caster && GamingQueue.Queue.Contains(c))]; + } + foreach (Character enemy in allEnemys) + { + Effect e = new 愤怒(Skill, caster, caster, true, Duration, 0) + { + ExemptionType = PrimaryAttribute.AGI, + DispelledType = DispelledType.Strong + }; + if (enemy.AGI <= caster.AGI || (enemy.AGI > caster.AGI && !CheckExemption(caster, enemy, e))) + { + WriteLine($"[ {caster} ] 嘲讽了 [ {enemy} ],[ {enemy} ] 愤怒了!!持续时间:{Duration:0.##} {GameplayEquilibriumConstant.InGameTime}!"); + enemy.Effects.Add(e); + e.OnEffectGained(new HookContext(GamingQueue, enemy)); + GamingQueue?.AddApplyEffects(enemy, e.EffectType); + } + } + foreach (Character teammate in allTeammates) + { + Effect e = new 持续回复(Skill, caster, caster, true, Duration, 0, true, 0, 守护友方回复) + { + DispelledType = DispelledType + }; + WriteLine($"[ {caster} ] 对 [ {teammate} ] 施加了持续生命回复!持续时间:{Duration:0.##} {GameplayEquilibriumConstant.InGameTime}!"); + teammate.Effects.Add(e); + e.OnEffectGained(new HookContext(GamingQueue, teammate)); + GamingQueue?.AddApplyEffects(teammate, e.EffectType); + } + } + GamingQueue?.AddApplyEffects(caster, EffectType.Focusing, EffectType.HealOverTime); + } + } +} diff --git a/OshimaBot.Content/Skills/ShiYu/开宫.cs b/OshimaBot.Content/Skills/ShiYu/开宫.cs new file mode 100644 index 0000000..6cfec24 --- /dev/null +++ b/OshimaBot.Content/Skills/ShiYu/开宫.cs @@ -0,0 +1,101 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.PassiveEffects; + +namespace OshimaBot.Content.Skills +{ + public class 开宫 : Skill + { + public override long Id => (long)PassiveID.开宫; + public override string Name => "开宫"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + + public 开宫(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 开宫特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + public class 开宫特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"{Skill.SkillOwner()}在游戏开始时进入 [ {nameof(长期监视)} ] 状态,时刻监视着场上的一举一动。当场上有角色死亡时,如果该角色死于技能,则{Skill.SkillOwner()}复制该技能获得使用权,持续 3 回合;如果该角色死于普通攻击,则{Skill.SkillOwner()}的普通攻击将转为魔法伤害并且无视闪避,持续 3 回合。" + + $"接着,{Skill.SkillOwner()}给予击杀者 [ {nameof(时雨标记)} ]。{Skill.SkillOwner()}在造成魔法伤害时,会基于伤害值的 15% 治疗持有标记的友方角色;{Skill.SkillOwner()}与所有持有标记的友方角色对持有标记的敌方角色的伤害加成提升 25%,并且使持有标记的敌方角色在持续时间内的回合开始阶段,有 65% 概率陷入混乱。" + + $"混乱:进入行动受限状态,失控并随机行动,且所有指令均会在所有角色中随机选取目标。时雨标记持续 3 回合。"; + + private bool 激活 = false; + + public override void OnGameStart(HookContext ctx) + { + if (!激活) + { + 激活 = true; + 发送他们标记(); + } + } + + public override void OnTimeElapsed(TimeLapseContext ctx) + { + if (ctx.Trigger is not Character character) return; + double elapsed = ctx.Elapsed; + if (激活) + { + 发送他们标记(); + } + } + + public override void AfterDamageCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return; + double damage = ctx.Damage; + double actualDamage = ctx.ActualDamage; + bool isNormalAttack = ctx.IsNormalAttack; + DamageType damageType = ctx.DamageType; + MagicType magicType = ctx.MagicType; + DamageResult damageResult = ctx.DamageResult; + if (character != Skill.Character || GamingQueue is null || damageType != DamageType.Magical || (damageResult != DamageResult.Normal && damageResult != DamageResult.Critical)) + { + return; + } + Character[] characters = [.. GamingQueue.GetTeammates(character).Where(c => c.Effects.Any(e => e is 时雨标记 && e.Source == character))]; + if (characters.Length > 0) + { + WriteLine($"[ {character} ] 发动了开宫!"); + double heal = actualDamage * 0.15; + foreach (Character target in characters) + { + HealToTarget(character, target, heal); + } + } + } + + public void 发送他们标记() + { + if (GamingQueue is null || Skill.Character is null) + { + return; + } + foreach (Character character in GamingQueue.Queue) + { + if (character == Skill.Character) + { + continue; + } + if (!character.Effects.Any(e => e is 长期监视 && e.Source == Skill.Character)) + { + Effect e = new 长期监视(Skill, Skill.Character, character); + character.Effects.Add(e); + e.OnEffectGained(new HookContext(GamingQueue, character)); + } + } + } + } +} diff --git a/OshimaBot.Content/Skills/ShiYu/放监.cs b/OshimaBot.Content/Skills/ShiYu/放监.cs new file mode 100644 index 0000000..bc640f4 --- /dev/null +++ b/OshimaBot.Content/Skills/ShiYu/放监.cs @@ -0,0 +1,134 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.EffectResult; +using FunGame.Core.Model.Framework; +using OshimaBot.Content.Effects.PassiveEffects; + +namespace OshimaBot.Content.Skills +{ + public class 放监 : Skill + { + public override long Id => (long)SuperSkillID.放监; + public override string Name => "放监"; + public override string Description => Effects.Count > 0 ? ((放监特效)Effects.First()).通用描述 : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double EPCost => 100; + public override double CD => 65; + public override double HardnessTime { get; set; } = 14; + public override bool CanSelectSelf => true; + public override bool CanSelectEnemy => false; + public 放监被动 Passive { get; set; } + + public 放监(Character? character = null) : base(SkillType.SuperSkill, character) + { + Effects.Add(new 放监特效(this)); + Passive = new 放监被动(this); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return [Passive]; + } + } + + public class 放监被动(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"{Skill.SkillOwner()}阻止任何来自持有 [ 宫监手标记 ] 的角色所发起的指向性技能攻击。"; + public override bool DurativeWithoutDuration => true; + public override DispelledType DispelledType => DispelledType.CannotBeDispelled; + + public override BeforeSkillCastedOnStatusResult BeforeSkillCastedOnStatus(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster || ctx.Skill is not Skill skill) return default; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + if (Skill.Character != null && caster.Effects.FirstOrDefault(e => e is 宫监手标记 && e.Source == Source) is 宫监手标记 effect) + { + WriteLine($"[ {Skill.Character} ] 高声呼喊:“宫监手,放监!”"); + 复制技能 e = new(Skill, Skill.Character, skill) + { + Durative = false, + DurationTurn = 4, + RemainDurationTurn = 4 + }; + e.CopiedSkill.Values[nameof(时雨标记)] = 1; + e.CopiedSkill.CurrentCD = 0; + e.CopiedSkill.FreeCostEP = true; + e.CopiedSkill.FreeCostMP = true; + e.CopiedSkill.Enable = true; + e.CopiedSkill.IsInEffect = false; + e.OnEffectGained(new HookContext(GamingQueue, Skill.Character)); + Skill.Character.Effects.Add(e); + WriteLine($"[ {Skill.Character} ] 复制了 [ {caster} ] 的技能:{skill.Name}!!"); + effect.指向性技能任务完成(caster); + // 返回 RemoveFromTargets 让框架移除该目标(阻止技能对持有放监的角色释放) + return new BeforeSkillCastedOnStatusResult { RemoveFromTargets = true }; + } + return default; + } + } + + public class 放监特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => 通用描述; + public override DispelledType DispelledType => DispelledType.CannotBeDispelled; + + public string 通用描述 => $"使场上现有的时雨标记变得不可驱散,并且刷新为持续 3 回合。并给予持有时雨标记的敌方角色 [ 宫监手标记 ],宫监手标记不可驱散,持续 3 回合。{任务要求}"; + public string 任务要求 => $"持有宫监手标记的角色,必须完成以下两个任务以消除标记,否则将在标记消失时,每个未完成的任务给予角色基于{Skill.SkillOwner()} {核心属性系数 * 100:0.##}% 核心属性 + {攻击力系数 * 100:0.##}% 攻击力 [ {Skill.Character?.PrimaryAttributeValue * 核心属性系数 + Skill.Character?.ATK * 攻击力系数:0.##} ] 的真实伤害:\r\n" + + $"1. 使用 [ 普通攻击 ] 攻击一次队友,此伤害必定暴击且无视闪避;\r\n2. 对{Skill.SkillOwner()}释放一个指向性技能,{Skill.SkillOwner()}将此技能效果无效化并且复制该技能获得使用权持续 4 回合。\r\n注意:在宫监手标记被消除前,对{Skill.SkillOwner()}释放指向性技能始终会触发无效化和复制效果。杀死{Skill.SkillOwner()}可以终止所有放监任务。"; + public double 核心属性系数 => 0.7 * Skill.Level; + public double 攻击力系数 => 0.2 + 0.10 * (Skill.Level - 1); + + public void 造成伤害(Character character, int count) + { + if (Skill.Character != null) + { + WriteLine($"[ {character} ] 未完成「放监」任务!"); + for (int i = 0; i < count; i++) + { + double damage = Skill.Character.PrimaryAttributeValue * 核心属性系数 + Skill.Character.ATK * 攻击力系数; + DamageToEnemy(Skill.Character, character, DamageType.True, MagicType, damage); + } + } + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + if (GamingQueue != null) + { + List enemies = GamingQueue.GetEnemies(caster); + foreach (Character character in GamingQueue.Queue) + { + if (character.Effects.FirstOrDefault(e => e is 时雨标记 && e.Source == caster) is 时雨标记 e) + { + e.DispelledType = DispelledType.CannotBeDispelled; + e.RemainDurationTurn = 3; + if (enemies.Contains(character)) + { + Effect e2 = new 宫监手标记(Skill, caster, character, this) + { + Durative = false, + DurationTurn = 3, + RemainDurationTurn = 3 + }; + character.Effects.Add(e2); + e2.OnEffectGained(new HookContext(GamingQueue, character)); + } + } + } + GamingQueue.AddApplyEffects(caster, EffectType.Focusing); + } + } + } +} diff --git a/OshimaBot.Content/Skills/SkillID.cs b/OshimaBot.Content/Skills/SkillID.cs new file mode 100644 index 0000000..e264204 --- /dev/null +++ b/OshimaBot.Content/Skills/SkillID.cs @@ -0,0 +1,487 @@ +// 注: +// 爆发技增益效果通常不可驱散。 +// 未注明友方·的增益技能均为自身,反之,可选取友方或者自身。特殊情况:友方不含自身等。 +// 被动技能不可驱散,未说明作用对象时均为自身。 +// 省略了作用目标的负面技能均为作用于敌方。(特殊地,减少硬直是增益) +// 技能名称来源:《英雄传说 空之轨迹》/《英雄联盟》/《DOTA2》 +namespace OshimaBot.Content.Skills +{ + /** + * 冰霜攻击 = 单体伤害 + * 火之矢 = 单体伤害 + * 水之矢 = 单体伤害 + * 石之锤 = 单体伤害 + * 风之轮 = 单体伤害 + * 心灵之霞 = 单体伤害 + * 次元上升 = 单体伤害+眩晕(时间型),需强驱散 + * 暗物质 = 单体伤害 + * + * 回复术 = 我方·单体回复(数值) + * 治愈术 = 我方·单体弱驱散+回复(百分比) + * 复苏术 = 我方·单体强驱散+回复(百分比)+复苏 + * 圣灵术 = 我方·全体强驱散+回复(数值)+复苏 + * 时间加速 = 我方·单体速度提升(时间型) + * 时间减速 = 单体速度减少(时间型) + * 反魔法领域 = 多目标封技(技能受限,时间型)+施法解除,可弱驱散 + * 沉默十字 = 多目标封技(技能受限,回合型)+施法解除,可弱驱散 + * 虚弱领域 = 全体虚弱(伤害降低+护甲魔抗降低+重伤,时间型),可弱驱散 + * 混沌烙印 = 单体气绝(行动受限+持续伤害,时间型),需强驱散 + * 凝胶稠絮 = 单体虚弱(伤害降低+护甲魔抗降低+重伤,回合型),可弱驱散 + * + * 大地之墙 = 我方·多目标物理护盾+持续性弱驱散(时间型) + * 盖亚之盾 = 我方·全体物理+魔法护盾值 + * 风之守护 = 我方·暴击率+闪避提升(回合型) + * 结晶防护 = 我方·护甲+魔抗提升(回合型) + * 强音之力 = 我方·攻击提升(回合型) + * 神圣祝福 = 我方·攻击+护甲+魔抗提升(回合型) + * 根源屏障 = 我方·技能免疫+魔法免疫(回合型) + * + * 灾难冲击波 = 多目标伤害+魔抗降低(回合型),可弱驱散 + * 银色荆棘 = 多目标伤害,概率混乱(行动受限,如同AI控制行动,回合型),需强驱散 + * 等离子之波 = 多目标伤害,概率封技(技能受限,回合型)+施法解除,可弱驱散 + * 地狱之门 = 多目标伤害,概率气绝(行动受限+持续伤害,时间型),需强驱散 + * 钻石星尘 = 多目标伤害,概率冻结(完全行动不能+魔法易伤,回合型),需强驱散 + * 死亡咆哮 = 多目标伤害,概率战斗不能(时间型),需强驱散 + * 鬼魅之痛 = 多目标伤害,概率眩晕(时间型),需强驱散 + * 导力停止 = 全体封技(技能受限)+施法解除+魔抗降低,时间型,可弱驱散 + * + * 冰狱冥嚎 = 多目标伤害(冰霜攻击·复) + * 火山咆哮 = 多目标伤害(火之矢·复) + * 水蓝轰炸 = 多目标伤害(水之矢·复) + * 岩石之息 = 多目标伤害(石之锤·复) + * 弧形日珥 = 多目标伤害(风之轮·复) + * 苍白地狱 = 多目标伤害(心灵之霞·复) + * 破碎虚空 = 多目标伤害(暗物质·复) + * 弧光消耗 = 多目标吸取魔法值和能量值 + * + * 回复术·改 = 我方·单体回复(百分比) + * 回复术·复 = 我方·多目标回复(百分比) + * 治愈术·复 = 我方·多目标弱驱散+回复(数值) + * 风之守护·复 = 我方·多目标暴击率+闪避提升(回合型) + * 强音之力·复 = 我方·多目标攻击提升(回合型) + * 结晶防护·复 = 我方·多目标护甲+魔抗提升(回合型) + * 神圣祝福·复 = 我方·多目标攻击+护甲+魔抗提升(回合型) + * 时间加速·改 = 我方·单体速度+加速系数提升(回合型) + * 时间减速·改 = 单体速度+加速系数减少(回合型) + * 时间加速·复 = 我方·多目标速度+加速系数提升(回合型) + * 时间减速·复 = 多目标速度+加速系数减少(回合型) + * 十二宫星环 = 我方·多目标附加【强运】状态;强运状态下每回合结束随机生成 2~3 份绑定自身的回合奖励 + */ + public enum MagicID : long + { + 冰霜攻击 = 1001, + 火之矢 = 1002, + 水之矢 = 1003, + 石之锤 = 1004, + 风之轮 = 1005, + 心灵之霞 = 1006, + 次元上升 = 1007, + 暗物质 = 1008, + + 回复术 = 1009, + 治愈术 = 1010, + 复苏术 = 1011, + 圣灵术 = 1012, + 时间加速 = 1013, + 时间减速 = 1014, + 反魔法领域 = 1015, + 沉默十字 = 1016, + 虚弱领域 = 1017, + 混沌烙印 = 1018, + 凝胶稠絮 = 1019, + + 大地之墙 = 1020, + 盖亚之盾 = 1021, + 风之守护 = 1022, + 结晶防护 = 1023, + 强音之力 = 1024, + 神圣祝福 = 1025, + 根源屏障 = 1026, + + 灾难冲击波 = 1027, + 银色荆棘 = 1028, + 等离子之波 = 1029, + 地狱之门 = 1030, + 钻石星尘 = 1031, + 死亡咆哮 = 1032, + 鬼魅之痛 = 1033, + 导力停止 = 1034, + + 冰狱冥嚎 = 1035, + 火山咆哮 = 1036, + 水蓝轰炸 = 1037, + 岩石之息 = 1038, + 弧形日珥 = 1039, + 苍白地狱 = 1040, + 破碎虚空 = 1041, + 弧光消耗 = 1042, + + 回复术改 = 1043, + 回复术复 = 1044, + 治愈术复 = 1045, + 风之守护复 = 1046, + 强音之力复 = 1047, + 结晶防护复 = 1048, + 神圣祝福复 = 1049, + 时间加速改 = 1050, + 时间减速改 = 1051, + 时间加速复 = 1052, + 时间减速复 = 1053, + 十二宫星环 = 1054, + // —— 节奏维度(2026-09-23):首个剥夺「决策点」的魔法 —— + 时间剥夺 = 1055 + } + + /** + * 疾风步 = 自身·速度/暴击提升(时间型)+不可选中+破隐一击 + * 助威 = 我方·多目标攻击力提升(回合型) + * 挑拨 = 多目标愤怒(嘲讽,回合型),需强驱散 + * 绞丝棍 = 单体伤害 + * 金刚击 = 单体伤害+施法解除 + * 旋风轮 = 多目标伤害 + * 双连击 = 单体2次普通攻击 + * 绝影 = 单体伤害+迟滞(硬直时间延长),可弱驱散 + * 胧 = 单体攻击,概率战斗不能(攻击受限+施法不能),需强驱散 + * 魔眼 = 单体迟滞(硬直时间延长)、概率混乱(行动受限,如同AI控制行动,回合型),需强驱散 + * 风之鞭 = 多目标伤害 + * 拘束之鞭 = 单体伤害+施法解除 + * 天堂之吻 = 我方·硬直时间提前(时间型) + * 狐媚暗随 = 单体伤害 + * 快速狙击 = 随机单体目标伤害 + * 精准射击 = 单体伤害+施法解除 + * 欢乐激发 = 我方·多目标回复 + * 乱心安魂曲 = 多目标伤害 + * 斗魂 = 攻击力降低+物理护甲降低,可弱驱散 + * 岚 = 多目标伤害+施法解除 + * 公牛之怒 = 自身·扣除生命值+回复能量 + * 火焰碎击 = 单体伤害+战斗不能(时间型)+施法解除,需强驱散 + * 螺旋之刃 = 单体迟滞(硬直时间延长),可弱驱散 + * 霸王疾风 = 单体伤害 + * 回复弹 = 我方·单体弱驱散+回复 + * 导力装甲 = 自身·封技+攻击力提升+护甲魔抗提升+硬直时间提前 + * 回复原状 = 自身·解除导力装甲 + * 强打 = 单体伤害,概率气绝(行动受限+持续伤害,时间型),需强驱散 + * 龙神功 = 自身·攻击力提升+护甲魔抗提升(回合型) + * 养命功 = 自身·持续性弱驱散+回复(回合型) + * 月华掌 = 单体伤害,概率混乱(行动受限,如同AI控制行动,回合型),需强驱散 + * 雷神脚 = 多目标伤害 + * 弓刃交错 = 单体伤害+迟滞(硬直时间延长),可弱驱散 + * 神圣祈祷 = 我方·持续性强驱散+回复(时间型) + * 牺牲之箭 = 我方不含自身·能量回复 + * 石化之矢 = 单体伤害+石化(完全行动不能,时间型),需强驱散 + * 死亡制裁 = 多目标伤害 + * 剑风闪 = 多目标伤害 + * 落叶 = 单体伤害+迟滞(硬直时间延长),可弱驱散 + * 风花阵 = 自身·攻击力提升+护甲降低 + * 陀螺舞 = 多目标愤怒(嘲讽,回合型),需强驱散 + * 光破斩 = 多目标伤害 + * 跳跃点射 = 单体伤害+护甲降低+施法解除,需强驱散 + * 鲨鱼锚击 = 单体伤害+缴械(攻击受限,回合型),可弱驱散 + * 光鬼斩 = 单体伤害,概率气绝(行动受限+持续伤害,时间型),需强驱散 + * 雷索吸缚 = 单体愤怒(嘲讽,回合型)、概率气绝(行动受限+持续伤害,时间型),需强驱散 + * 狂刃剑舞 = 敌方·单体攻击,概率混乱(行动受限,如同AI控制行动,回合型),需强驱散 + * 无相飞刀 = 单体封技+施法解除,可弱驱散 + * 破邪显正 = 多目标伤害 + * 镜花水月 = 自身·完全免疫,回合型 + * 号令 = 我方不含自身·攻击力提升 + * 千剑之雨 = 多目标伤害 + * 无尽剑制 = 全体伤害 + * 灾难一掷 = 单体伤害,概率战斗不能 + * 血腥旋转 = 多目标伤害,概率战斗不能 + * 疾走 = 提升移动距离 + * 闪现 = 传送到指定位置 + * 抢夺命运 = 夺取敌方未来行动回合的回合奖励,无奖励可夺时改为造成魔法伤害 + * 命运剥夺 = 摧毁敌方未来行动回合的全部回合奖励,并造成魔法伤害 + * 命运馈赠 = 为友方绑定一份未来行动回合的回合奖励 + * 命运之赐 = 回合奖励内容:回复生命值并获得攻击力提升 + */ + public enum SkillID : long + { + 疾风步 = 2001, + 助威 = 2002, + 挑拨 = 2003, + 绞丝棍 = 2004, + 金刚击 = 2005, + 旋风轮 = 2006, + 双连击 = 2007, + 绝影 = 2008, + 胧 = 2009, + 魔眼 = 2010, + 风之鞭 = 2011, + 拘束之鞭 = 2012, + 天堂之吻 = 2013, + 狐媚暗随 = 2014, + 快速狙击 = 2015, + 精准射击 = 2016, + 欢乐激发 = 2017, + 乱心安魂曲 = 2018, + 斗魂 = 2019, + 岚 = 2020, + 公牛之怒 = 2021, + 火焰碎击 = 2022, + 螺旋之刃 = 2023, + 霸王疾风 = 2024, + 回复弹 = 2025, + 导力装甲 = 2026, + 回复原状 = 2027, + 强打 = 2028, + 龙神功 = 2029, + 养命功 = 2030, + 月华掌 = 2031, + 雷神脚 = 2032, + 弓刃交错 = 2033, + 神圣祈祷 = 2034, + 牺牲之箭 = 2035, + 石化之矢 = 2036, + 死亡制裁 = 2037, + 剑风闪 = 2038, + 落叶 = 2039, + 风花阵 = 2040, + 陀螺舞 = 2041, + 光破斩 = 2042, + 跳跃点射 = 2043, + 鲨鱼锚击 = 2044, + 光鬼斩 = 2045, + 雷索吸缚 = 2046, + 狂刃剑舞 = 2047, + 无相飞刀 = 2048, + 破邪显正 = 2049, + 镜花水月 = 2050, + 号令 = 2051, + 千剑之雨 = 2052, + 无尽剑制 = 2053, + 灾难一掷 = 2054, + 血腥旋转 = 2055, + 疾走 = 2056, + 闪现 = 2057, + 转换战斗天赋 = 2058, + 抢夺命运 = 2059, + 命运剥夺 = 2060, + 命运馈赠 = 2061, + 命运之赐 = 2062, + 断罪斩 = 2099, + // —— 决策点维度(2026-09-23 新增):本项目首个作用于「决策点」的技能/装备 —— + 战术部署 = 2098, + // —— 节奏维度(2026-09-23)—— + 过载 = 2097 + } + + /** + * 熵灭极诣 = 攻击力提升+普攻自残 + * 千羽瞬华 = 攻击力+物理穿透+闪避率提升,减少普攻硬直,强化普攻,减少心灵之弦CD + * 咒怨洪流 = 普攻转为魔法伤害,可以普攻多个目标,护甲+魔抗提升,减少蚀魂震击CD + * 三相灵枢 = 强化灵能反射,并在触发灵能反射时回复能量 + * 变幻之心 = 根据双生流转的模式触发回血+吸血或者魔法伤害加成 + * 零式灭杀 = 提升暴击率和暴击伤害、物理穿透 + * 绝对领域 = 免疫所有伤害,时间型;起步消耗100能量,每10能量额外时间 + * 残香凋零 = 多目标魔法伤害,伤害量基于敌人能量值 + * 宿命时律 = 护甲+魔抗提升,普攻转为魔法伤害,减少普攻硬直,强化普攻 + * 极寒渴望 = 获得吸血,强化累积之压 + * 身心一境 = 力量+敏捷提升 + * 饕餮盛宴 = 获得吸血 + * 樱花无双击 = 单体伤害+生命偷取 + * 漆黑之牙 = 全体伤害,此技能击杀敌人时,永久提升该技能伤害 + * 女王之怒 = 单体伤害+虚弱(伤害降低+护甲魔抗降低+重伤,回合型),可弱驱散 + * 裁决塔罗 = 多目标伤害+以下状态之一:冻结(完全行动不能+魔法易伤)/混乱(行动受限,如同AI控制行动,回合型)/战斗不能(攻击受限+施法不能),需强驱散 + * 光明之环 = 我方·全体强驱散+复苏,复苏的回复量为20%;起步消耗100能量,每10能量额外增加护甲魔抗 + * 圣星光旋 = 全体伤害,概率眩晕(时间型),需强驱散 + * 炎龙倒海 = 全体伤害,减少行动速度,推迟当前硬直 + * 卫星激光 = 多目标伤害,随后一定时间内造成持续真实伤害 + * 泰山玄武靠 = 多目标伤害,概率气绝(行动受限+持续伤害,时间型),需强驱散 + * 星杯领域 = 我方·完全免疫,回合型;起步消耗100能量,每100能量额外回合 + * 魔枪洛亚 = 全体伤害,施法解除+魔抗降低,可弱驱散 + * 八叶灭杀 = 单体伤害,随后基于目标已损失生命值再次造成额外伤害 + * 樱花残月 = 单体伤害,随后提升自身行动速度、加速系数、减少硬直 + * 圣洁祝福 = 我方不含自身·单体强驱散+回复+能量回复 + * 天堂阻灭 = 单体巨额伤害 + * 歼灭 = 全体伤害,概率战斗不能 + * 归元环 = 伤害必定暴击,强化八卦阵 + * 放监 = 强化开宫,要求持有开宫标记的角色完成任务,否则造成巨额伤害 + * 海王星的野望 = 力量提升,对目标造成伤害,在此期间对目标造成伤害后,溅射到其他敌人,强化深海之戟 + * 全军出击 = 补全雇佣兵数量,根据雇佣兵数量额外提升冷却缩减、加速系数、行动系数,雇佣兵伤害提升 + * 宿命之潮 = 二选一:加速生命回复,攻击力提升,受到伤害提升,造成伤害后额外造成100%重伤;极致加速生命回复,提供友方生命回复,嘲讽所有敌人 + * 神之因果 = 改变全局法则,回合型 + */ + public enum SuperSkillID : long + { + 熵灭极诣 = 3001, + 千羽瞬华 = 3002, + 咒怨洪流 = 3003, + 三相灵枢 = 3004, + 变幻之心 = 3005, + 零式灭杀 = 3006, + 绝对领域 = 3007, + 残香凋零 = 3008, + 宿命时律 = 3009, + 极寒渴望 = 3010, + 身心一境 = 3011, + 饕餮盛宴 = 3012, + 樱花无双击 = 3013, + 漆黑之牙 = 3014, + 女王之怒 = 3015, + 裁决塔罗 = 3016, + 光明之环 = 3017, + 圣星光旋 = 3018, + 炎龙倒海 = 3019, + 卫星激光 = 3020, + 泰山玄武靠 = 3021, + 星杯领域 = 3022, + 魔枪洛亚 = 3023, + 八叶灭杀 = 3024, + 樱花残月 = 3025, + 圣洁祝福 = 3026, + 天堂阻灭 = 3027, + 歼灭 = 3028, + 归元环 = 3029, + 放监 = 3030, + 海王星的野望 = 3031, + 全军出击 = 3032, + 宿命之潮 = 3033, + 神之因果 = 3034, + // —— 节奏维度(2026-09-23 新增)—— + 催战鼓 = 3035, + } + + /** + * META马 = 提升初始力量和力量成长,每回合开始和受击时获得额外能量 + * 心灵之弦 = 减少普攻硬直,普攻时额外普攻一次,第二次伤害减半 + * 蚀魂震击 = 造成魔法伤害时眩晕目标,对处于控制态的敌人造成额外伤害 + * 灵能反射 = 一定次数内释放魔法不会进入硬直,魔法命中后获得额外能量并减少所有技能CD + * 双生流转 = 根据当前生命值比例将基础智力转为额外力量或还原,力量模式造成伤害必定暴击,智力模式获得暴击+闪避+魔抗提升 + * 零式崩解 = 暴击伤害提升 + * 少女绮想 = 每经过一段时间,获得伤害加成,造成伤害后减少加成总量的一部分,受到伤害会清零 + * 暗香疏影 = 对一半以下能量的敌人造成额外伤害并削减他们的能量 + * 破釜沉舟 = 减少一部分最大生命值换取伤害加成;获得基于累计受到伤害的百分比伤害加成,技能发动后清零 + * 累积之压 = 造成伤害时标记目标,攻击带有目标的角色造成最大生命值伤害和眩晕 + * 银隼之赐 = 基于敏捷强化普攻 + * 弱者猎手 = 每个回合都会标记血量最少和血量百分比低于自身的敌人;对受到标记的目标造成额外伤害 + * 征服者 = 普攻或技能命中叠加层数,叠满后下次攻击造成额外真实伤害并提供额外核心属性 + * 致命节奏 = 普攻造成伤害后大幅提升行动速度,行动系数超过阈值后,获得额外攻击力 + * 迅捷步法 = 造成伤害回复生命值并提升行动系数和加速系数 + * 强攻 = 3次连续普攻同一目标时造成额外伤害并使其进入“易损”状态,后续承受伤害提升 + * 电刑 = 一定时间内用3个独立普攻/技能命中同一目标时,造成额外伤害 + * 黑暗收割 = 对一半以下生命值的目标造成伤害时,收集其灵魂永久提升伤害 + * 丛刃 = 造成伤害将在短时间内大幅减少硬直时间 + * 贪欲猎手 = 造成伤害时回复生命值 + * 召唤艾黎 = 普通攻击或技能命中时造成伤害或提供护盾 + * 相位猛冲 = 一定时间用3个独立普攻/技能命中敌人后,获得行动速度和加速系数加成 + * 奥术彗星 = 技能命中时造成额外伤害 + * 风暴聚集 = 每过一段时间获得永久额外核心属性 + * 不灭之握 = 普攻造成额外最大生命值伤害并回复生命值,并永久提升生命值(有累计上限) + * 余震 = 对目标造成控制态时,获得双抗加成,随后溅射魔法伤害至随机几个目标 + * 守护者 = 承受超过一定量伤害时提供护盾、行动速度和加速系数 + * 骸骨镀层 = 承受敌方技能伤害后,一定时间内减少其后续3次普攻/技能的伤害 + * 冰川增幅 = 普攻或技能减敌人的行动速度,减速期间友军对其伤害提升 + * 先攻 = 先手攻击英雄时,造成额外真实伤害并获得金币。一段时间内相互未攻击,将重置先手判定 + * 饼干配送 = 每过一段时间获得免费饼干,回复生命值和魔法值 + * 折射 = 受到伤害时,减少受到的伤害,并反弹一部分伤害给攻击者 + * 恩赐解脱 = 攻击敌人时,有一定概率提升暴击伤害 + * 静电场 = 技能命中时,造成额外真实伤害 + * 竭心光环 = 造成伤害后,对敌人施加持续百分比真实伤害,并无视其生命回复 + * 海妖外壳 = 每过一段时间生成护盾,护盾破碎时强驱散自身(净化有内部冷却) + * 自然蔽护 = 一定时间内未受到伤害,将提升行动速度和治疗加成 + * 勇气之霎 = 受到伤害时,概率触发获得吸血和攻击力提升 + * 深海重击 = 每3次普攻造成眩晕和额外伤害 + * 反击螺旋 = 受到伤害时概率对来源者和随机两个敌人造成真实伤害 + * 刀光谍影 = 造成伤害后,概率进入不可选中状态,持续一段时间或再次攻击敌人 + * 幽冥剧毒 = 普攻附带持续伤害,基于目标已损失生命值 + * 八卦阵 = 造成时概率提升双倍伤害;受到伤害时概率减少一半伤害 + * 开宫 = 角色死亡时偷取技能,或使自己的普攻转为魔法伤害并无视闪避;标记击杀者,被标记者获得互动效果 + * 深海之戟 = 普攻暴击时溅射伤害到随机的两个敌人身上 + * 雇佣兵团 = 召唤雇佣兵,提供额外伤害和承受伤害,雇佣兵会自发攻击随机敌人或者具有仇恨的敌人 + * 不息之流 = 常态下回复百分比最大生命值,回复能量 + * 概念之骰 = 随机增益效果叠加 + * 掠夺者 = 成功夺取他人回合奖励时永久叠加攻击力,自身奖励被夺走时获得短暂攻击力与行动速度 + * 生命链接 = 造成伤害后,为生命值百分比最低的队友回复生命值(不超过本次伤害),有内部冷却 + * 共鸣护盾 = 行动结束后,为生命值偏低且护盾不足的队友提供混合护盾,有内部冷却 + * 战地巡诊 = 周期性地为生命值最低的队友回复生命值;若其处于重伤则额外对其弱驱散 + * 同袍之誓 = 队友阵亡时,全体存活队友获得攻击力、行动系数与加速系数提升并回复生命值,同名刷新不叠加 + * 援护号令 = 自身回合开始时(号令就绪)为全体队友提升行动系数,同名刷新不叠加 + */ + public enum PassiveID : long + { + META马 = 4001, + 心灵之弦 = 4002, + 蚀魂震击 = 4003, + 灵能反射 = 4004, + 双生流转 = 4005, + 零式崩解 = 4006, + 少女绮想 = 4007, + 暗香疏影 = 4008, + 破釜沉舟 = 4009, + 累积之压 = 4010, + 银隼之赐 = 4011, + 弱者猎手 = 4012, + 征服者 = 4013, + 致命节奏 = 4014, + 迅捷步法 = 4015, + 强攻 = 4016, + 电刑 = 4017, + 黑暗收割 = 4018, + 丛刃 = 4019, + 贪欲猎手 = 4020, + 召唤艾黎 = 4021, + 相位猛冲 = 4022, + 奥术彗星 = 4023, + 风暴聚集 = 4024, + 不灭之握 = 4025, + 余震 = 4026, + 守护者 = 4027, + 骸骨镀层 = 4028, + 冰川增幅 = 4029, + 先攻 = 4030, + 饼干配送 = 4031, + 折射 = 4032, + 恩赐解脱 = 4033, + 静电场 = 4034, + 竭心光环 = 4035, + 海妖外壳 = 4036, + 自然蔽护 = 4037, + 勇气之霎 = 4038, + 深海重击 = 4039, + 反击螺旋 = 4040, + 刀光谍影 = 4041, + 幽冥剧毒 = 4042, + 八卦阵 = 4043, + 开宫 = 4044, + 深海之戟 = 4045, + 雇佣兵团 = 4046, + 不息之流 = 4047, + 概念之骰 = 4048, + 掠夺者 = 4049, + 生命链接 = 4050, + 共鸣护盾 = 4051, + 战地巡诊 = 4052, + 同袍之誓 = 4053, + 援护号令 = 4054, + // —— 节奏维度(2026-09-23 新增)—— + 战术余裕 = 4055 + } + + public enum ItemPassiveID : long + { + 攻击之爪 = 5001, + 糖糖一周年纪念武器 = 5002, + 糖糖一周年纪念防具 = 5003, + 糖糖一周年纪念鞋子 = 5004, + 糖糖一周年纪念饰品1 = 5005, + 糖糖一周年纪念饰品2 = 5006, + 行军医箱 = 5007, + 共鸣核心 = 5008, + 接力信标 = 5009, + // —— 节奏维度(2026-09-23)—— + 万能钥匙 = 5010, + 节拍器 = 5011 + } + + public enum ItemActiveID : long + { + 经验书 = 6001, + 回复药 = 6002, + 魔力填充剂 = 6003, + 能量饮料 = 6004, + 礼包 = 6005, + 复苏药 = 6006, + 应急装置 = 6007 + } +} diff --git a/OshimaBot.Content/Skills/TheGodK/概念之骰.cs b/OshimaBot.Content/Skills/TheGodK/概念之骰.cs new file mode 100644 index 0000000..ba1de26 --- /dev/null +++ b/OshimaBot.Content/Skills/TheGodK/概念之骰.cs @@ -0,0 +1,231 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.EffectResult; + +namespace OshimaBot.Content.Skills +{ + public class 概念之骰 : Skill + { + public override long Id => (long)PassiveID.概念之骰; + public override string Name => "概念之骰"; + public override string Description => Effects.Count > 0 ? ((概念之骰特效)Effects.First()).GeneralDescription : ""; + public int 力层数 { get; set; } = 0; + public int 暴层数 { get; set; } = 0; + public int 噬层数 { get; set; } = 0; + public int 御层数 { get; set; } = 0; + + public 概念之骰(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 概念之骰特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + + public override void OnCharacterRespawn(Skill newSkill) + { + if (newSkill is 概念之骰 skill) + { + skill.力层数 = 力层数; + skill.暴层数 = 暴层数; + skill.噬层数 = 噬层数; + skill.御层数 = 御层数; + } + } + } + + public class 概念之骰特效 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description { get; set; } = ""; + public string GeneralDescription => $"{Skill.SkillOwner()}的助攻窗口期永远不会过期。{Skill.SkillOwner()}每次参与击杀时都会进行一次概念投掷,获得一层永久持续的增益效果,且每个概念都最多可以叠加 {最多层数} 层。每次概念投掷可取得以下任意一项概念增益:\r\n" + + $"「力」:攻击力提升 {攻击力提升 * 100:0.##}% [ {Skill.Character?.BaseATK * 攻击力提升:0.##} ]。\r\n「暴」:暴击率提升 {暴击率提升 * 100:0.##}%,暴击伤害提升 {暴击伤害提升 * 100:0.##}%。\r\n「噬」:生命偷取提升 {生命偷取提升 * 100:0.##}%。\r\n「御」:受到的伤害减少 {攻击力提升 * 100:0.##}%。\r\n" + + $"取得第一层「噬」后,同时获得「恒」效果:当总生命偷取超过 {生命偷取阈值 * 100:0.##}% 后,超出部分每 {生命偷取每单位 * 100:0.##}% 转化为 {生命偷取转化 * 100:0.##}% 攻击力。"; + + public static int 最多层数 => 8; + public static double 攻击力提升 => 0.06; + public static double 暴击率提升 => 0.03; + public static double 暴击伤害提升 => 0.06; + public static double 生命偷取提升 => 0.04; + public static double 受到伤害减少 => 0.05; + public static double 生命偷取阈值 => 0.3; + public static double 生命偷取每单位 => 0.01; + public static double 生命偷取转化 => 0.005; + + private double 实际攻击力提升 = 0; + private double 实际暴击率提升 = 0; + private double 实际暴击伤害提升 = 0; + private double 实际生命偷取提升 = 0; + private double 实际受到伤害减少 = 0; + private double 实际生命偷取转化 = 0; + + public 概念之骰特效(Skill skill) : base(skill) + { + Description = GeneralDescription; + } + + public override AlterActualDamageResult AlterActualDamageAfterCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return default; + double damage = ctx.Damage; + bool isNormalAttack = ctx.IsNormalAttack; + DamageType damageType = ctx.DamageType; + MagicType magicType = ctx.MagicType; + DamageResult damageResult = ctx.DamageResult; + Dictionary totalDamageBonus = ctx.TotalDamageBonus; + if (enemy == Skill.Character && 实际受到伤害减少 > 0 && (damageResult == DamageResult.Normal || damageResult == DamageResult.Critical)) + { + double reduce = damage * 实际受到伤害减少; + WriteLine($"[ {Skill.Character} ] 发动了概念之骰!伤害减少了 {reduce:0.##} 点!"); + return new AlterActualDamageResult { DamageDelta = -reduce }; + + } + return default; + + } + + public override void AfterDeathCalculation(DeathContext ctx) + { + if (ctx.Trigger is not Character death) return; + bool hasMaster = ctx.HasMaster; + Character? killer = ctx.Killer; + Dictionary continuousKilling = ctx.ContinuousKilling; + Dictionary earnedMoney = ctx.EarnedMoney; + Character[] assists = ctx.Assists; + if (Skill.Character != null && death != Skill.Character && !hasMaster && (killer == Skill.Character || assists.Contains(Skill.Character)) && Skill is 概念之骰 skill) + { + WriteLine($"[ {Skill.Character} ] 进行概念投掷:“此乃,神之概念。”"); + bool result = false; + do + { + switch (Random.Next(4)) + { + case 0: + if (skill.力层数 < 最多层数) + { + skill.力层数++; + WriteLine($"[ {Skill.Character} ] 获得了「力」概念效果,当前「力」层数:{skill.力层数}。"); + result = true; + } + break; + case 1: + if (skill.暴层数 < 最多层数) + { + skill.暴层数++; + WriteLine($"[ {Skill.Character} ] 获得了「暴」概念效果,当前「暴」层数:{skill.暴层数}。"); + result = true; + } + break; + case 2: + if (skill.噬层数 < 最多层数) + { + skill.噬层数++; + WriteLine($"[ {Skill.Character} ] 获得了「噬」概念效果,当前「噬」层数:{skill.噬层数}。"); + result = true; + } + break; + case 3: + if (skill.御层数 < 最多层数) + { + skill.御层数++; + WriteLine($"[ {Skill.Character} ] 获得了「御」概念效果,当前「御」层数:{skill.御层数}。"); + result = true; + } + break; + } + if (skill.力层数 + skill.暴层数 + skill.噬层数 + skill.御层数 >= 最多层数 * 4) + { + WriteLine($"[ {Skill.Character} ] 已经完成了「概念之骰」的全部概念收集!!"); + result = true; + } + } + while (!result); + if (result) + { + 刷新技能效果(Skill.Character); + } + } + } + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + 刷新技能效果(character); + } + + public override void OnTimeElapsed(TimeLapseContext ctx) + { + if (ctx.Trigger is not Character character) return; + double elapsed = ctx.Elapsed; + 刷新技能效果(character); + if (GamingQueue != null && GamingQueue.AssistDetails.TryGetValue(character, out AssistDetail? ad) && ad != null) + { + foreach (Character enemy in ad.DamageLastTime.Keys) + { + ad.DamageLastTime[enemy] = GamingQueue.TotalTime; + } + foreach (Character teammate in ad.NotDamageAssistLastTime.Keys) + { + ad.NotDamageAssistLastTime[teammate] = GamingQueue.TotalTime; + } + } + } + + public void 刷新技能效果(Character character) + { + if (实际攻击力提升 != 0) + { + character.ExATKPercentage -= 实际攻击力提升; + 实际攻击力提升 = 0; + } + if (实际暴击率提升 != 0) + { + character.ExCritRate -= 实际暴击率提升; + 实际暴击率提升 = 0; + } + if (实际暴击伤害提升 != 0) + { + character.ExCritDMG -= 实际暴击伤害提升; + 实际暴击伤害提升 = 0; + } + if (实际生命偷取提升 != 0) + { + character.Lifesteal -= 实际生命偷取提升; + 实际生命偷取提升 = 0; + } + if (实际受到伤害减少 != 0) + { + 实际受到伤害减少 = 0; + } + if (实际生命偷取转化 != 0) + { + character.ExATKPercentage -= 实际生命偷取转化; + 实际生命偷取转化 = 0; + } + if (Skill is 概念之骰 skill) + { + 实际攻击力提升 = 攻击力提升 * skill.力层数; + 实际暴击率提升 = 暴击率提升 * skill.暴层数; + 实际暴击伤害提升 = 暴击伤害提升 * skill.暴层数; + 实际生命偷取提升 = 生命偷取提升 * skill.噬层数; + 实际受到伤害减少 = 受到伤害减少 * skill.御层数; + character.ExATKPercentage += 实际攻击力提升; + character.ExCritRate += 实际暴击率提升; + character.ExCritDMG += 实际暴击伤害提升; + character.Lifesteal += 实际生命偷取提升; + if (skill.噬层数 > 0 && character.Lifesteal > 生命偷取阈值) + { + double 超出部分 = character.Lifesteal - 生命偷取阈值; + 实际生命偷取转化 = 超出部分 / 生命偷取每单位 * 生命偷取转化; + } + character.ExATKPercentage += 实际生命偷取转化; + Description = $"{Skill.SkillOwner()}的助攻窗口期永远不会过期。{Skill.SkillOwner()}每次参与击杀时都会进行一次概念投掷,获得一层永久持续的增益效果,且每个概念都最多可以叠加 {最多层数} 层。(当前层数:「力」× {skill.力层数}、「暴」× {skill.暴层数}、「噬」× {skill.噬层数}、「御」× {skill.御层数},攻击力提升:{(实际攻击力提升 + 实际生命偷取转化) * 100:0.##}% [ {character.BaseATK * (实际攻击力提升 + 实际生命偷取转化):0.##} ] 点,暴击率提升:{实际暴击率提升 * 100:0.##}%,暴击伤害提升:{实际暴击伤害提升 * 100:0.##}%,生命偷取提升:{实际生命偷取提升 * 100:0.##}%,受到伤害减少:{实际受到伤害减少 * 100:0.##}%)"; + } + } + } +} diff --git a/OshimaBot.Content/Skills/TheGodK/神之因果.cs b/OshimaBot.Content/Skills/TheGodK/神之因果.cs new file mode 100644 index 0000000..5b71d72 --- /dev/null +++ b/OshimaBot.Content/Skills/TheGodK/神之因果.cs @@ -0,0 +1,124 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.EffectResult; +using FunGame.Core.Model.Framework; + +namespace OshimaBot.Content.Skills +{ + public class 神之因果 : Skill + { + public override long Id => (long)SuperSkillID.神之因果; + public override string Name => "神之因果"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double EPCost => 100; + public override bool CostAllEP => true; + public override double CD => 90; + public override double HardnessTime { get; set; } = 1; + public override bool CanSelectSelf => true; + public override bool CanSelectEnemy => false; + + public 神之因果(Character? character = null) : 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 => $"{Skill.SkillOwner()}短暂显现其「神」之本质,开启持续 4 回合的「神之领域」:在持续时间内,{Skill.SkillOwner()}对任意敌方目标造成的伤害,都将记录为「因果伤害值」。" + + $"在持续时间结束后,所有敌方角色都会受到 [ 基于总因果伤害值的 {系数 * 100:0.##}% 除以当前在场敌方角色数量 ] 的真实伤害。在持续时间内,{Skill.SkillOwner()}可以对任何负面效果进行豁免。" + + (因果伤害值 > 0 ? $"(当前累计因果:{因果伤害值:0.##} 点)" : ""); + public override DispelledType DispelledType => DispelledType.CannotBeDispelled; + public override bool Durative => false; + public override int DurationTurn => 4; + + public double 因果伤害值 { get; set; } = 0; + public double 系数 => 1 + 0.2 * (Skill.Level - 1); + + public override OnExemptionCheckResult OnExemptionCheck(ImmuneContext ctx) + { + if (ctx.Trigger is not Character character) return default; + if (character == Skill.Character) + { + return new OnExemptionCheckResult { ThrowingBonusDelta = 300 }; + } + return default; + } + + public override void AfterDamageCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return; + double damage = ctx.Damage; + double actualDamage = ctx.ActualDamage; + bool isNormalAttack = ctx.IsNormalAttack; + DamageType damageType = ctx.DamageType; + MagicType magicType = ctx.MagicType; + DamageResult damageResult = ctx.DamageResult; + if (character == Skill.Character && (damageResult == DamageResult.Normal || damageResult == DamageResult.Critical)) + { + 因果伤害值 += actualDamage; + } + } + + public override void AfterDeathCalculation(DeathContext ctx) + { + if (ctx.Trigger is not Character death) return; + bool hasMaster = ctx.HasMaster; + Character? killer = ctx.Killer; + Dictionary continuousKilling = ctx.ContinuousKilling; + Dictionary earnedMoney = ctx.EarnedMoney; + Character[] assists = ctx.Assists; + if (death == Skill.Character) + { + 因果伤害值 = 0; + } + } + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + 因果伤害值 = 0; + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (GamingQueue != null && 因果伤害值 > 0) + { + WriteLine($"[ {character} ] 发动了神之因果!万象因果,命运既定!!!"); + List enemies = [.. GamingQueue.GetEnemies(character).Where(GamingQueue.Queue.Contains)]; + double damage = 因果伤害值 * 系数 / enemies.Count; + foreach (Character enemy in enemies) + { + DamageToEnemy(character, enemy, DamageType.True, MagicType, damage, new(character) + { + CalculateShield = false, + IgnoreImmune = true, + TriggerEffects = false + }); + } + 因果伤害值 = 0; + } + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + RemainDurationTurn = DurationTurn; + if (!caster.Effects.Contains(this)) + { + caster.Effects.Add(this); + OnEffectGained(new HookContext(GamingQueue, caster)); + } + GamingQueue?.AddApplyEffects(caster, EffectType.Focusing); + } + } +} diff --git a/OshimaBot.Content/Skills/XReouni/八卦阵.cs b/OshimaBot.Content/Skills/XReouni/八卦阵.cs new file mode 100644 index 0000000..1c6d3ff --- /dev/null +++ b/OshimaBot.Content/Skills/XReouni/八卦阵.cs @@ -0,0 +1,133 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Skills +{ + public class 八卦阵 : Skill + { + public override long Id => (long)PassiveID.八卦阵; + public override string Name => "八卦阵"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + + public 八卦阵(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 八卦阵特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + public class 八卦阵特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"每次造成伤害或受到伤害时,进行投掷检定,结果为偶数时,造成的伤害提升 {伤害提升 * 100:0.##}%,受到伤害减少 {伤害减少 * 100:0.##}%;结果为奇数时,该回合提升 {奇数平衡性提升 * 100:0.##}% 暴击率和闪避率、{奇数平衡性提升 * 100:0.##}% 魔法抗性,并将下一次伤害提升 {奇数伤害提升 * 100:0.##}% 或减免 {奇数伤害减少 * 100:0.##}% 下一次受到伤害,若下一次投掷结果为偶数,将叠加该效果。"; + + public bool 归元 { get; set; } = false; + public bool 回合投掷出奇数 { get; set; } = false; + public bool 奇数效果 { get; set; } = false; + public double 伤害提升 { get; set; } = 0.6; + public double 伤害减少 { get; set; } = 0.3; + public double 奇数平衡性提升 { get; set; } = 0.1; + public double 奇数伤害提升 { get; set; } = 0.3; + public double 奇数伤害减少 { get; set; } = 0.15; + + public override double AlterExpectedDamageBeforeCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return 0; + double damage = ctx.Damage; + bool isNormalAttack = ctx.IsNormalAttack; + DamageType damageType = ctx.DamageType; + MagicType magicType = ctx.MagicType; + Dictionary totalDamageBonus = ctx.TotalDamageBonus; + double bonus = 0; + if (character != Skill.Character && enemy != Skill.Character) + { + return bonus; + } + if (奇数效果) + { + 奇数效果 = false; + if (character == Skill.Character) + { + bonus = damage * 奇数伤害提升; + WriteLine($"[ {Skill.Character} ] 发动了八卦阵!伤害提升了 {Math.Abs(bonus):0.##} 点!"); + } + else if (enemy == Skill.Character) + { + bonus = -(damage * 奇数伤害减少); + WriteLine($"[ {Skill.Character} ] 发动了八卦阵!伤害减少了 {Math.Abs(bonus):0.##} 点!"); + } + } + bool result = 归元 || (!归元 && Random.Next(10) % 2 == 0); + WriteLine($"[ {Skill.Character} ] 的八卦阵投掷结果为:{(result ? "偶数" : "奇数")}。"); + if (damage > 0 && result) + { + if (character == Skill.Character) + { + double bonus2 = damage * 伤害提升; + bonus += bonus2; + WriteLine($"[ {Skill.Character} ] 发动了八卦阵!伤害提升了 {Math.Abs(bonus2):0.##} 点!"); + } + else if (enemy == Skill.Character) + { + double bonus2 = damage * 伤害减少; + bonus -= bonus2; + WriteLine($"[ {Skill.Character} ] 发动了八卦阵!伤害减少了 {Math.Abs(bonus2):0.##} 点!"); + } + if (归元) + { + WriteLine($"[ {Skill.Character} ] 发动了归元环!冷却时间减少了 {归元环特效.冷却时间减少 * 100:0.##}%!"); + foreach (Skill s in Skill.Character.Skills) + { + s.CurrentCD -= s.CD * 归元环特效.冷却时间减少; + if (s.CurrentCD <= 0) + { + s.CurrentCD = 0; + s.Enable = true; + } + } + } + } + else + { + if (!回合投掷出奇数) + { + 回合投掷出奇数 = true; + Effect e = new DynamicsEffect(Skill, new() + { + { "excr", 奇数平衡性提升 }, + { "exer", 奇数平衡性提升 }, + { "mdftype", (int)MagicType.None }, + { "mdfvalue", 奇数平衡性提升 } + }, Skill.Character) + { + Name = "八卦阵·奇数", + Durative = false, + DurationTurn = 1, + RemainDurationTurn = 1 + }; + Skill.Character.Effects.Add(e); + e.OnEffectGained(new HookContext(GamingQueue, Skill.Character)); + WriteLine($"[ {Skill.Character} ] 发动了八卦阵!该回合提升 {奇数平衡性提升 * 100:0.##}% 暴击率和闪避率、{奇数平衡性提升 * 100:0.##}% 魔法抗性!"); + } + if (!奇数效果) + { + 奇数效果 = true; + } + } + return bonus; + } + + public override void OnTurnEnd(TurnContext ctx) + { + if (ctx.Trigger is not Character character) return; + 回合投掷出奇数 = false; + } + } +} diff --git a/OshimaBot.Content/Skills/XReouni/归元环.cs b/OshimaBot.Content/Skills/XReouni/归元环.cs new file mode 100644 index 0000000..751ebd2 --- /dev/null +++ b/OshimaBot.Content/Skills/XReouni/归元环.cs @@ -0,0 +1,83 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.EffectResult; +using FunGame.Core.Model.Framework; + +namespace OshimaBot.Content.Skills +{ + public class 归元环 : Skill + { + public override long Id => (long)SuperSkillID.归元环; + public override string Name => "归元环"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double EPCost => 100; + public override double CD => 60; + public override double HardnessTime { get; set; } = 8; + public override bool CanSelectSelf => true; + public override bool CanSelectEnemy => false; + + public 归元环(Character? character = null) : 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:0.##} {GameplayEquilibriumConstant.InGameTime}内,造成伤害必定暴击;使 [ 八卦阵 ] 不需要检定,直接产生偶数效果;并且每次触发偶数效果时,减少所有主动技能 {冷却时间减少 * 100:0.##}% 冷却时间。"; + public override bool Durative => true; + public override double Duration => 30; + public override DispelledType DispelledType => DispelledType.CannotBeDispelled; + + public const double 冷却时间减少 = 0.1; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (character.Effects.Where(e => e is 八卦阵特效 && e.Skill.Character == character).FirstOrDefault() is 八卦阵特效 e) + { + e.归元 = true; + } + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (character.Effects.Where(e => e is 八卦阵特效 && e.Skill.Character == character).FirstOrDefault() is 八卦阵特效 e) + { + e.归元 = false; + } + } + + public override BeforeCriticalCheckResult BeforeCriticalCheck(DamageContext ctx) + { + if (ctx.Trigger is not Character actor || ctx.Enemy is not Character enemy) return default; + bool isNormalAttack = ctx.IsNormalAttack; + if (actor == Skill.Character) + { + // 归元期间必定暴击:提供极高的暴击检定加值 + return new BeforeCriticalCheckResult { ThrowingBonusDelta = 200 }; + } + return default; + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + RemainDuration = Duration; + if (!caster.Effects.Contains(this)) + { + caster.Effects.Add(this); + OnEffectGained(new HookContext(GamingQueue, caster)); + } + RecordCharacterApplyEffects(caster, EffectType.CritBoost, EffectType.DamageBoost, EffectType.DefenseBoost); + } + } +} diff --git a/OshimaBot.Content/Skills/XinYin/千羽瞬华.cs b/OshimaBot.Content/Skills/XinYin/千羽瞬华.cs new file mode 100644 index 0000000..5bbadd5 --- /dev/null +++ b/OshimaBot.Content/Skills/XinYin/千羽瞬华.cs @@ -0,0 +1,120 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.EffectResult; +using FunGame.Core.Model.Framework; + +namespace OshimaBot.Content.Skills +{ + public class 千羽瞬华 : Skill + { + public override long Id => (long)SuperSkillID.千羽瞬华; + public override string Name => "千羽瞬华"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double EPCost => 100; + public override double CD => 60; + public override double HardnessTime { get; set; } = 10; + public override bool CanSelectSelf => true; + public override bool CanSelectEnemy => false; + + public 千羽瞬华(Character? character = null) : 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 => $"{Skill.SkillOwner()}将世间事物的弱点完全暴露在「千羽」的绚烂之下。{Duration:0.##} {GameplayEquilibriumConstant.InGameTime}内,增加{Skill.SkillOwner()} {攻击力提升系数 * 100:0.##}% 攻击力 [ {攻击力提升:0.##} ]、{物理穿透提升 * 100:0.##}% 物理穿透和 {闪避率提升 * 100:0.##}% 闪避率(不可叠加),普通攻击硬直时间额外减少 20%,基于 {系数 * 100:0.##}% 敏捷 [ {伤害加成:0.##} ] 强化普通攻击的伤害。在持续时间内,[ 心灵之弦 ] 的冷却时间降低至 3 {GameplayEquilibriumConstant.InGameTime}。"; + public override bool Durative => true; + public override double Duration => 30; + public override DispelledType DispelledType => DispelledType.CannotBeDispelled; + + private double 系数 => 1.2 * (1 + 0.5 * (Skill.Level - 1)); + private double 伤害加成 => 系数 * Skill.Character?.AGI ?? 0; + private double 攻击力提升系数 => Skill.Level > 0 ? 0.15 + 0.03 * (Skill.Level - 1) : 0.15; + private double 攻击力提升 => 攻击力提升系数 * Skill.Character?.BaseATK ?? 0; + private double 物理穿透提升 => Skill.Level > 0 ? 0.1 + 0.03 * (Skill.Level - 1) : 0.1; + private double 闪避率提升 => Skill.Level > 0 ? 0.1 + 0.02 * (Skill.Level - 1) : 0.1; + + private double 实际的攻击力提升 = 0; + private double 实际的物理穿透提升 = 0; + private double 实际的闪避率提升 = 0; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + 实际的攻击力提升 = 攻击力提升; + 实际的物理穿透提升 = 物理穿透提升; + 实际的闪避率提升 = 闪避率提升; + character.ExATK2 += 实际的攻击力提升; + character.PhysicalPenetration += 实际的物理穿透提升; + character.ExEvadeRate += 实际的闪避率提升; + if (character.Effects.FirstOrDefault(e => e is 心灵之弦特效 && e.Skill.Character == character) is 心灵之弦特效 e) + { + e.基础冷却时间 = 3; + if (e.冷却时间 > e.基础冷却时间) e.冷却时间 = e.基础冷却时间; + } + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + character.ExATK2 -= 实际的攻击力提升; + character.PhysicalPenetration -= 实际的物理穿透提升; + character.ExEvadeRate -= 实际的闪避率提升; + if (character.Effects.FirstOrDefault(e => e is 心灵之弦特效 && e.Skill.Character == character) is 心灵之弦特效 e) + { + e.基础冷却时间 = 10; + } + } + + public override AlterActionTypeResult AlterActionTypeBeforeAction(DecisionContext ctx) + { + return new AlterActionTypeResult { PNormalAttack = ctx.PNormalAttack + 0.1 }; + } + + public override double AlterExpectedDamageBeforeCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return 0; + double damage = ctx.Damage; + bool isNormalAttack = ctx.IsNormalAttack; + DamageType damageType = ctx.DamageType; + MagicType magicType = ctx.MagicType; + Dictionary totalDamageBonus = ctx.TotalDamageBonus; + if (character == Skill.Character && isNormalAttack) + { + return 伤害加成; + } + return 0; + } + + public override AlterHardnessTimeResult AlterHardnessTimeAfterNormalAttack(HardnessContext ctx) + { + if (ctx.Trigger is not Character character) return default; + return new AlterHardnessTimeResult { Factor = -0.2 }; + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + 实际的攻击力提升 = 0; + 实际的物理穿透提升 = 0; + 实际的闪避率提升 = 0; + RemainDuration = Duration; + if (!caster.Effects.Contains(this)) + { + caster.Effects.Add(this); + OnEffectGained(new HookContext(GamingQueue, caster)); + } + GamingQueue?.AddApplyEffects(caster, EffectType.DamageBoost, EffectType.PenetrationBoost); + } + } +} diff --git a/OshimaBot.Content/Skills/XinYin/心灵之弦.cs b/OshimaBot.Content/Skills/XinYin/心灵之弦.cs new file mode 100644 index 0000000..40d2fe6 --- /dev/null +++ b/OshimaBot.Content/Skills/XinYin/心灵之弦.cs @@ -0,0 +1,97 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.EffectResult; + +namespace OshimaBot.Content.Skills +{ + public class 心灵之弦 : Skill + { + public override long Id => (long)PassiveID.心灵之弦; + public override string Name => "心灵之弦"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + + public 心灵之弦(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 心灵之弦特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + 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%。每次使用普通攻击时,额外再发动一次普通攻击,伤害特效可叠加,但伤害折减一半,冷却 {基础冷却时间:0.##} {GameplayEquilibriumConstant.InGameTime}。额外普通攻击立即发动,不占用决策点配额。" + + (冷却时间 > 0 ? $"(正在冷却:剩余 {冷却时间:0.##} {GameplayEquilibriumConstant.InGameTime})" : ""); + + public double 冷却时间 { get; set; } = 0; + public double 基础冷却时间 { get; set; } = 10; + private bool 是否是嵌套普通攻击 = false; + + public override AlterActualDamageResult AlterActualDamageAfterCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return default; + double damage = ctx.Damage; + bool isNormalAttack = ctx.IsNormalAttack; + DamageType damageType = ctx.DamageType; + MagicType magicType = ctx.MagicType; + DamageResult damageResult = ctx.DamageResult; + Dictionary totalDamageBonus = ctx.TotalDamageBonus; + if (character == Skill.Character && 是否是嵌套普通攻击 && isNormalAttack && damage > 0) + { + return new AlterActualDamageResult { DamageDelta = -(damage / 2) }; + + } + return default; + + } + + public override void AfterDamageCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return; + double damage = ctx.Damage; + double actualDamage = ctx.ActualDamage; + bool isNormalAttack = ctx.IsNormalAttack; + DamageType damageType = ctx.DamageType; + MagicType magicType = ctx.MagicType; + DamageResult damageResult = ctx.DamageResult; + if (character == Skill.Character && isNormalAttack && 冷却时间 == 0 && !是否是嵌套普通攻击 && GamingQueue != null && enemy.HP > 0) + { + WriteLine($"[ {character} ] 发动了心灵之弦!额外进行一次普通攻击!"); + 冷却时间 = 基础冷却时间; + 是否是嵌套普通攻击 = true; + character.NormalAttack.Attack(GamingQueue, character, null, enemy); + } + + if (character == Skill.Character && 是否是嵌套普通攻击) + { + 是否是嵌套普通攻击 = false; + } + } + + public override void OnTimeElapsed(TimeLapseContext ctx) + { + if (ctx.Trigger is not Character character) return; + double elapsed = ctx.Elapsed; + if (冷却时间 > 0) + { + 冷却时间 -= elapsed; + if (冷却时间 <= 0) + { + 冷却时间 = 0; + } + } + } + + public override AlterHardnessTimeResult AlterHardnessTimeAfterNormalAttack(HardnessContext ctx) + { + if (ctx.Trigger is not Character character) return default; + return new AlterHardnessTimeResult { Factor = -0.2 }; + } + } +} diff --git a/OshimaBot.Content/Skills/Yang/咒怨洪流.cs b/OshimaBot.Content/Skills/Yang/咒怨洪流.cs new file mode 100644 index 0000000..5e36b7c --- /dev/null +++ b/OshimaBot.Content/Skills/Yang/咒怨洪流.cs @@ -0,0 +1,139 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Interface.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.EffectResult; +using FunGame.Core.Model.Framework; + +namespace OshimaBot.Content.Skills +{ + public class 咒怨洪流 : Skill + { + public override long Id => (long)SuperSkillID.咒怨洪流; + public override string Name => "咒怨洪流"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double EPCost => 100; + public override double CD => 65; + public override double HardnessTime { get; set; } = 3; + public override bool CanSelectSelf => true; + public override bool CanSelectEnemy => false; + + public 咒怨洪流(Character? character = null) : 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 => $"{Skill.SkillOwner()}将「熵核」的污染之力附着在武器之上。{Duration:0.##} {GameplayEquilibriumConstant.InGameTime}内,增加自身所有伤害的 {减伤比例 * 100:0.##}% 伤害减免;[ 蚀魂震击 ] 的冷却时间降低至 5 {GameplayEquilibriumConstant.InGameTime},并将普通攻击转为魔法伤害;在一个回合里首次使用普通攻击后,附赠 {额外攻击次数} 次普通攻击决策点配额,但后续普通攻击必须选取不重复的目标。"; + public override bool Durative => true; + public override double Duration => 30; + public override DispelledType DispelledType => DispelledType.CannotBeDispelled; + + private double 减伤比例 => 0.15 + 0.02 * (Level - 1); + private double 实际比例 = 0; + private readonly List 本回合已攻击的目标 = []; + private bool 本回合可附赠动作 = true; + private readonly int 额外攻击次数 = 2; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + 实际比例 = 减伤比例; + character.NormalAttack.SetMagicType(new(this, true, MagicType.None, 999), GamingQueue); + if (character.Effects.Where(e => e is 蚀魂震击特效 && e.Skill.Character == character).FirstOrDefault() is 蚀魂震击特效 e) + { + e.基础冷却时间 = 5; + if (e.冷却时间 > e.基础冷却时间) e.冷却时间 = e.基础冷却时间; + } + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + 实际比例 = 0; + character.NormalAttack.UnsetMagicType(this, GamingQueue); + if (character.Effects.Where(e => e is 蚀魂震击特效 && e.Skill.Character == character).FirstOrDefault() is 蚀魂震击特效 e) + { + e.基础冷却时间 = 10; + } + } + + public override void OnTurnStart(TurnContext ctx) + { + if (ctx.Trigger is not Character character) return; + List enemys = ctx.Enemys; + List teammates = ctx.Teammates; + List skills = ctx.Skills; + List items = ctx.Items; + 本回合已攻击的目标.Clear(); + 本回合可附赠动作 = true; + } + + public override void AfterCharacterNormalAttack(NormalAttackContext ctx) + { + if (ctx.Trigger is not Character character) return; + NormalAttack? normalAttack = ctx.NormalAttack; + List targets = ctx.Targets; + 本回合已攻击的目标.AddRange(targets); + if (本回合可附赠动作 && GamingQueue != null && GamingQueue.CharacterDecisionPoints.TryGetValue(character, out DecisionPoints? dp) && dp != null) + { + 本回合可附赠动作 = false; + dp.AddTempActionQuota(this, CharacterActionType.NormalAttack, 额外攻击次数); + WriteLine($"[ {character} ] 发动了{nameof(咒怨洪流)}!本回合可额外发动 {额外攻击次数} 次普通攻击!"); + } + } + + public override void AlterSelectListBeforeSelection(SelectionContext ctx) + { + if (ctx.Trigger is not Character character) return; + ISkill? skill = ctx.Skill; + List allEnemys = ctx.AllEnemys; + List allTeammates = ctx.AllTeammates; + List enemys = ctx.Enemys; + List teammates = ctx.Teammates; + if (skill is NormalAttack && !本回合可附赠动作) + { + enemys.RemoveAll(本回合已攻击的目标.Contains); + } + } + + public override AlterActualDamageResult AlterActualDamageAfterCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return default; + double damage = ctx.Damage; + bool isNormalAttack = ctx.IsNormalAttack; + DamageType damageType = ctx.DamageType; + MagicType magicType = ctx.MagicType; + DamageResult damageResult = ctx.DamageResult; + Dictionary totalDamageBonus = ctx.TotalDamageBonus; + if (enemy == Skill.Character) + { + return new AlterActualDamageResult { DamageDelta = -(damage * 实际比例) }; + + } + return default; + + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + RemainDuration = Duration; + if (!caster.Effects.Contains(this)) + { + caster.Effects.Add(this); + OnEffectGained(new HookContext(GamingQueue, caster)); + } + GamingQueue?.AddApplyEffects(caster, EffectType.DefenseBoost); + } + } +} diff --git a/OshimaBot.Content/Skills/Yang/蚀魂震击.cs b/OshimaBot.Content/Skills/Yang/蚀魂震击.cs new file mode 100644 index 0000000..e8e5608 --- /dev/null +++ b/OshimaBot.Content/Skills/Yang/蚀魂震击.cs @@ -0,0 +1,100 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.PassiveEffects; + +namespace OshimaBot.Content.Skills +{ + public class 蚀魂震击 : Skill + { + public override long Id => (long)PassiveID.蚀魂震击; + public override string Name => "蚀魂震击"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + + public 蚀魂震击(Character? character = null) : base(SkillType.Passive, character) + { + ExemptionDescription = SkillSet.GetExemptionDescription(EffectType.Stun); + Effects.Add(new 蚀魂震击特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + public class 蚀魂震击特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"对处于完全行动不能、行动受限、战斗不能、技能受限、攻击受限状态的敌人额外造成 {系数 * 100:0.##}% 力量 [ {伤害加成:0.##} ] 点伤害;造成魔法伤害时使敌人眩晕 1 回合,冷却 {基础冷却时间:0.##} {GameplayEquilibriumConstant.InGameTime}。" + + (冷却时间 > 0 ? $"(正在冷却:剩余 {冷却时间:0.##} {GameplayEquilibriumConstant.InGameTime})" : ""); + public override string DispelDescription => "被驱散性:眩晕需强驱散"; + public double 冷却时间 { get; set; } = 0; + public double 基础冷却时间 { get; set; } = 10; + private static double 系数 => 4; + private double 伤害加成 => 系数 * Skill.Character?.STR ?? 0; + + public override double AlterExpectedDamageBeforeCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return 0; + double damage = ctx.Damage; + bool isNormalAttack = ctx.IsNormalAttack; + DamageType damageType = ctx.DamageType; + MagicType magicType = ctx.MagicType; + Dictionary totalDamageBonus = ctx.TotalDamageBonus; + if (character == Skill.Character && ( + enemy.CharacterState == CharacterState.NotActionable || + enemy.CharacterState == CharacterState.ActionRestricted || + enemy.CharacterState == CharacterState.BattleRestricted || + enemy.CharacterState == CharacterState.SkillRestricted || + enemy.CharacterState == CharacterState.AttackRestricted)) + { + return 伤害加成; + } + return 0; + } + + public override void AfterDamageCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return; + double damage = ctx.Damage; + double actualDamage = ctx.ActualDamage; + bool isNormalAttack = ctx.IsNormalAttack; + DamageType damageType = ctx.DamageType; + MagicType magicType = ctx.MagicType; + DamageResult damageResult = ctx.DamageResult; + if (character == Skill.Character && damageType == DamageType.Magical && actualDamage > 0 && 冷却时间 == 0 && (damageResult == DamageResult.Normal || damageResult == DamageResult.Critical)) + { + 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(new HookContext(GamingQueue, enemy)); + } + WriteLine($"[ {character} ] 的魔法伤害触发了蚀魂震击,[ {enemy} ] 被眩晕了!"); + 冷却时间 = 基础冷却时间; + } + } + + public override void OnTimeElapsed(TimeLapseContext ctx) + { + if (ctx.Trigger is not Character character) return; + double elapsed = ctx.Elapsed; + if (冷却时间 > 0) + { + 冷却时间 -= elapsed; + if (冷却时间 <= 0) + { + 冷却时间 = 0; + } + } + } + } +} diff --git a/OshimaBot.Content/Skills/dddovo/身心一境.cs b/OshimaBot.Content/Skills/dddovo/身心一境.cs new file mode 100644 index 0000000..81ef56f --- /dev/null +++ b/OshimaBot.Content/Skills/dddovo/身心一境.cs @@ -0,0 +1,89 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; + +namespace OshimaBot.Content.Skills +{ + public class 身心一境 : Skill + { + public override long Id => (long)SuperSkillID.身心一境; + public override string Name => "身心一境"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double EPCost => 100; + public override double CD => 55 - (1 * (Level - 1)); + public override double HardnessTime { get; set; } = 9; + public override bool CanSelectSelf => true; + public override bool CanSelectEnemy => false; + + public 身心一境(Character? character = null) : 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 => $"敏捷提高 20% [ {敏捷提升:0.##} ] 点。若当前总力量低于敏捷,则获得额外力量提升,使得总力量等于敏捷的 {平衡系数 * 100:0.##}%{(Skill.Character != null ? $" [ {Skill.Character.AGI * 平衡系数:0.##} ]" : "")},持续 {Duration:0.##} {GameplayEquilibriumConstant.InGameTime}。"; + public override bool Durative => true; + public override double Duration => 30; + public override DispelledType DispelledType => DispelledType.CannotBeDispelled; + + private double 敏捷提升 => (0.2 * Skill.Character?.BaseAGI) ?? 0.2; + private double 平衡系数 => 0.5 + 0.1 * (Skill.Level - 1); + private double 本次提升的敏捷 = 0; + private double 本次提升的力量 = 0; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + double pastHP = character.HP; + double pastMaxHP = character.MaxHP; + double pastMP = character.MP; + double pastMaxMP = character.MaxMP; + 本次提升的敏捷 = character.BaseAGI * 0.2; + character.ExAGI += 本次提升的敏捷; + 本次提升的力量 = 0; + double 平衡敏捷 = character.AGI * 平衡系数; + if (character.STR < 平衡敏捷) + { + 本次提升的力量 = 平衡敏捷 - character.STR; + character.ExSTR += 本次提升的力量; + } + character.Recovery(pastHP, pastMP, pastMaxHP, pastMaxMP); + WriteLine($"[ {character} ] 敏捷提升了 {本次提升的敏捷:0.##} 点,力量提升了 {本次提升的力量:0.##} 点!"); + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + 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(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + RemainDuration = Duration; + if (!caster.Effects.Contains(this)) + { + 本次提升的敏捷 = 0; + 本次提升的力量 = 0; + caster.Effects.Add(this); + OnEffectGained(new HookContext(GamingQueue, caster)); + } + GamingQueue?.AddApplyEffects(caster, EffectType.DamageBoost, EffectType.Lifesteal); + } + } +} diff --git a/OshimaBot.Content/Skills/dddovo/银隼之赐.cs b/OshimaBot.Content/Skills/dddovo/银隼之赐.cs new file mode 100644 index 0000000..1fc8799 --- /dev/null +++ b/OshimaBot.Content/Skills/dddovo/银隼之赐.cs @@ -0,0 +1,63 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Skills +{ + public class 银隼之赐 : Skill + { + public override long Id => (long)PassiveID.银隼之赐; + public override string Name => "银隼之赐"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override double CD => 5; + + public 银隼之赐(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 银隼之赐特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + public class 银隼之赐特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"{Skill.SkillOwner()}的「银隼」正如其名,优雅而致命。普通攻击命中后,附带基于 {敏捷系数 * 100:0.##}% 敏捷 [ {敏捷伤害:0.##} ] 点魔法伤害,可叠加普攻特效。每 {Skill.CD:0.##} {GameplayEquilibriumConstant.InGameTime}仅能触发一次。"; + + private double 敏捷伤害 => 敏捷系数 * Skill.Character?.AGI ?? 0; + + private readonly double 敏捷系数 = 2; + private bool 是否是嵌套伤害 = false; + + public override void AfterDamageCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return; + double damage = ctx.Damage; + double actualDamage = ctx.ActualDamage; + bool isNormalAttack = ctx.IsNormalAttack; + DamageType damageType = ctx.DamageType; + MagicType magicType = ctx.MagicType; + DamageResult damageResult = ctx.DamageResult; + if (Skill.CurrentCD == 0 && character == Skill.Character && isNormalAttack && (damageResult == DamageResult.Normal || damageResult == DamageResult.Critical) && !是否是嵌套伤害 && enemy.HP > 0) + { + Skill.CurrentCD = Skill.CD; + WriteLine($"[ {character} ] 发动了银隼之赐!将造成额外伤害!"); + 是否是嵌套伤害 = true; + DamageToEnemy(character, enemy, DamageType.Magical, magicType, 敏捷伤害, new(character) + { + TriggerEffects = false + }); + } + + if (character == Skill.Character && 是否是嵌套伤害) + { + 是否是嵌套伤害 = false; + } + } + } +} diff --git a/OshimaBot.Content/Skills/战技/乱心安魂曲.cs b/OshimaBot.Content/Skills/战技/乱心安魂曲.cs new file mode 100644 index 0000000..5170e3f --- /dev/null +++ b/OshimaBot.Content/Skills/战技/乱心安魂曲.cs @@ -0,0 +1,23 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 乱心安魂曲 : Skill + { + public override long Id => (long)SkillID.乱心安魂曲; + public override string Name => "乱心安魂曲"; + public override string Description => Effects.Count > 0 ? string.Join("", Effects.Select(e => e.Description)) : ""; + public override double EPCost => 75; + public override double CD => 28; + public override double HardnessTime { get; set; } = 9; + public override int CanSelectTargetCount => 4; + + public 乱心安魂曲(Character? character = null) : base(SkillType.Skill, character) + { + CastRange = 5; + Effects.Add(new 基于攻击力的伤害_带基础伤害(this, 50, 45, 0.075, 0.04, DamageType.Physical)); + } + } +} diff --git a/OshimaBot.Content/Skills/战技/光破斩.cs b/OshimaBot.Content/Skills/战技/光破斩.cs new file mode 100644 index 0000000..ad0440c --- /dev/null +++ b/OshimaBot.Content/Skills/战技/光破斩.cs @@ -0,0 +1,23 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 光破斩 : Skill + { + public override long Id => (long)SkillID.光破斩; + public override string Name => "光破斩"; + public override string Description => Effects.Count > 0 ? string.Join("", Effects.Select(e => e.Description)) : ""; + public override double EPCost => 65; + public override double CD => 24; + public override double HardnessTime { get; set; } = 8; + public override int CanSelectTargetCount => 3; + + public 光破斩(Character? character = null) : base(SkillType.Skill, character) + { + CastRange = 5; + Effects.Add(new 基于攻击力的伤害_带基础伤害(this, 60, 55, 0.09, 0.045, DamageType.Physical)); + } + } +} diff --git a/OshimaBot.Content/Skills/战技/光鬼斩.cs b/OshimaBot.Content/Skills/战技/光鬼斩.cs new file mode 100644 index 0000000..76ade31 --- /dev/null +++ b/OshimaBot.Content/Skills/战技/光鬼斩.cs @@ -0,0 +1,25 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 光鬼斩 : Skill + { + public override long Id => (long)SkillID.光鬼斩; + public override string Name => "光鬼斩"; + public override string Description => Effects.Count > 0 ? string.Join("", Effects.Select(e => e.Description)) : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First(e => e is 施加概率负面).DispelDescription : ""; + public override string ExemptionDescription => Effects.Count > 0 ? Effects.First(e => e is 施加概率负面).ExemptionDescription : ""; + public override double EPCost => 70; + public override double CD => 28; + public override double HardnessTime { get; set; } = 9; + + public 光鬼斩(Character? character = null) : base(SkillType.Skill, character) + { + CastRange = 4; + Effects.Add(new 基于攻击力的伤害_带基础伤害(this, 75, 60, 0.1, 0.05, DamageType.Physical)); + Effects.Add(new 施加概率负面(this, EffectType.Bleed, true, 5, 0, 1, 0.45, 0.03, false, 12.0, 0.0, 6.0)); + } + } +} diff --git a/OshimaBot.Content/Skills/战技/公牛之怒.cs b/OshimaBot.Content/Skills/战技/公牛之怒.cs new file mode 100644 index 0000000..8a9ddf8 --- /dev/null +++ b/OshimaBot.Content/Skills/战技/公牛之怒.cs @@ -0,0 +1,49 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Skills +{ + public class 公牛之怒 : Skill + { + public override long Id => (long)SkillID.公牛之怒; + public override string Name => "公牛之怒"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override double EPCost => 30; + public override double CD => 45; + public override double HardnessTime { get; set; } = 4; + public override bool CanSelectSelf => true; + public override bool CanSelectEnemy => false; + public override bool CanSelectTeammate => false; + + public 公牛之怒(Character? character = null) : base(SkillType.Skill, 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 => $"扣除自身 {生命扣除比例 * 100:0.##}% 最大生命值 [ {Skill.Character?.MaxHP * 生命扣除比例:0.##} ],并回复 {能量回复:0.##} 点能量值。"; + + private double 生命扣除比例 => 0.12; + private double 能量回复 => Skill.Level > 0 ? 50 + 15 * (Skill.Level - 1) : 50; + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + double cost = caster.MaxHP * 生命扣除比例; + double actual = Math.Min(cost, Math.Max(0, caster.HP - 1)); + if (actual > 0) + { + caster.HP -= actual; + WriteLine($"[ {caster} ] 燃烧了 {actual:0.##} 点生命值,发动了公牛之怒!"); + } + double ep = 能量回复; + caster.EP = Math.Min(caster.EP + ep, 200); + WriteLine($"[ {caster} ] 回复了 {ep:0.##} 点能量值!"); + } + } +} diff --git a/OshimaBot.Content/Skills/战技/养命功.cs b/OshimaBot.Content/Skills/战技/养命功.cs new file mode 100644 index 0000000..cfa8823 --- /dev/null +++ b/OshimaBot.Content/Skills/战技/养命功.cs @@ -0,0 +1,25 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 养命功 : Skill + { + public override long Id => (long)SkillID.养命功; + public override string Name => "养命功"; + public override string Description => string.Join("", Effects.Select(e => e.Description)); + public override string DispelDescription => Effects.Count > 0 ? Effects.First(e => e is 施加持续性弱驱散).DispelDescription : ""; + public override double EPCost => 40; + public override double CD => 35; + public override double HardnessTime { get; set; } = 10; + public override bool CanSelectSelf => true; + public override bool CanSelectEnemy => false; + public override bool CanSelectTeammate => false; + + public 养命功(Character? character = null) : base(SkillType.Skill, character) + { + Effects.Add(new 施加持续性弱驱散(this, durationTurn: 3)); + } + } +} diff --git a/OshimaBot.Content/Skills/战技/剑风闪.cs b/OshimaBot.Content/Skills/战技/剑风闪.cs new file mode 100644 index 0000000..754868f --- /dev/null +++ b/OshimaBot.Content/Skills/战技/剑风闪.cs @@ -0,0 +1,23 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 剑风闪 : Skill + { + public override long Id => (long)SkillID.剑风闪; + public override string Name => "剑风闪"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double EPCost => 70; + public override double CD => 28; + public override double HardnessTime { get; set; } = 10; + public override int CanSelectTargetRange => 2; + + public 剑风闪(Character? character = null) : base(SkillType.Skill, character) + { + Effects.Add(new 基于攻击力的伤害_带基础伤害(this, 55, 50, 0.1, 0.035, DamageType.Physical)); + } + } +} diff --git a/OshimaBot.Content/Skills/战技/助威.cs b/OshimaBot.Content/Skills/战技/助威.cs new file mode 100644 index 0000000..a7ce9a4 --- /dev/null +++ b/OshimaBot.Content/Skills/战技/助威.cs @@ -0,0 +1,89 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Skills +{ + public class 助威 : Skill + { + public override long Id => (long)SkillID.助威; + public override string Name => "助威"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double EPCost => 60; + public override double CD => 35; + public override double HardnessTime { get; set; } = 7; + public override bool CanSelectSelf => true; + public override bool CanSelectTeammate => true; + public override bool CanSelectEnemy => false; + public override int CanSelectTargetCount => 3; + + public 助威(Character? character = null) : base(SkillType.Skill, character) + { + CastRange = 5; + Effects.Add(new 助威特效(this)); + } + } + + public class 助威特效 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"提升目标{(Skill.CanSelectTargetCount > 1 ? $"至多 {Skill.CanSelectTargetCount} 个" : "")}友方角色 {ATK * 100:0.##}% 攻击力,持续 {持续时间}。"; + public override EffectType EffectType => EffectType.DamageBoost; + public override DispelledType DispelledType => DispelledType.Weak; + + private string 持续时间 => _durative && _duration > 0 ? 实际持续时间 + $" {GameplayEquilibriumConstant.InGameTime}" : (!_durative && _durationTurn > 0 ? 实际持续时间 + " 回合" : $"0 {GameplayEquilibriumConstant.InGameTime}"); + private double 实际持续时间 => _durative && _duration > 0 ? (_duration + _levelGrowth * (Level - 1) * MagicEfficacy) : (!_durative && _durationTurn > 0 ? ((int)Math.Round(_durationTurn + _levelGrowth * (Level - 1) * MagicEfficacy, 0, MidpointRounding.ToPositiveInfinity)) : 0); + + private readonly bool _durative = false; + private readonly double _duration = 0; + private readonly int _durationTurn = 3; + private readonly double _levelGrowth = 0; + + private double ATK => Level > 0 ? 0.07 + 0.03 * (Level - 1) : 0.03; + + public 助威特效(Skill skill) : base(skill) + { + GamingQueue = skill.GamingQueue; + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + foreach (Character target in targets) + { + WriteLine($"[ {target} ] 的攻击力提升了 {ATK * 100:0.##}% [ {target.BaseATK * ATK:0.##} ] 点!持续时间:{持续时间}!"); + ExATK2 e = new(Skill, new() + { + { "exatk", ATK } + }, caster) + { + Name = Name + }; + target.Effects.Add(e); + if (_durative && _duration > 0) + { + e.Durative = true; + e.Duration = 实际持续时间; + e.RemainDuration = 实际持续时间; + } + else if (!_durative && _durationTurn > 0) + { + e.Durative = false; + e.DurationTurn = (int)实际持续时间; + e.RemainDurationTurn = (int)实际持续时间; + } + e.EffectType = EffectType; + e.Source = caster; + e.OnEffectGained(new HookContext(GamingQueue, target)); + GamingQueue?.AddApplyEffects(target, EffectType); + } + } + } +} diff --git a/OshimaBot.Content/Skills/战技/千剑之雨.cs b/OshimaBot.Content/Skills/战技/千剑之雨.cs new file mode 100644 index 0000000..3e24b22 --- /dev/null +++ b/OshimaBot.Content/Skills/战技/千剑之雨.cs @@ -0,0 +1,23 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 千剑之雨 : Skill + { + public override long Id => (long)SkillID.千剑之雨; + public override string Name => "千剑之雨"; + public override string Description => Effects.Count > 0 ? string.Join("", Effects.Select(e => e.Description)) : ""; + public override double EPCost => 80; + public override double CD => 32; + public override double HardnessTime { get; set; } = 10; + public override int CanSelectTargetCount => 5; + + public 千剑之雨(Character? character = null) : base(SkillType.Skill, character) + { + CastRange = 6; + Effects.Add(new 基于攻击力的伤害_带基础伤害(this, 45, 40, 0.07, 0.035, DamageType.Physical)); + } + } +} diff --git a/OshimaBot.Content/Skills/战技/双连击.cs b/OshimaBot.Content/Skills/战技/双连击.cs new file mode 100644 index 0000000..efe4c61 --- /dev/null +++ b/OshimaBot.Content/Skills/战技/双连击.cs @@ -0,0 +1,61 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; + +namespace OshimaBot.Content.Skills +{ + public class 双连击 : Skill + { + public override long Id => (long)SkillID.双连击; + public override string Name => "双连击"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double EPCost => 60; + public override double CD => 30; + public override double HardnessTime { get; set; } = 10; + public override bool CanSelectSelf => Character?.NormalAttack.CanSelectSelf ?? false; + public override bool CanSelectTeammate => Character?.NormalAttack.CanSelectTeammate ?? false; + public override bool CanSelectEnemy => Character?.NormalAttack.CanSelectEnemy ?? true; + public override int CanSelectTargetCount => Character?.NormalAttack.CanSelectTargetCount ?? 1; + + public 双连击(Character? character = null) : base(SkillType.Skill, character) + { + Effects.Add(new 双连击特效(this)); + } + } + + public class 双连击特效 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"基于普通攻击的目标选择器对目标发起 2 次普通攻击。双连击会占用 1 次普通攻击的决策点配额,当配额不足时,仅能发起 1 次普通攻击。伤害特效可叠加;不受 [ 攻击受限 ] 状态的限制。"; + + public 双连击特效(Skill skill) : base(skill) + { + GamingQueue = skill.GamingQueue; + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + if (GamingQueue != null) + { + bool checkQuota = true; + if (GamingQueue.CharacterDecisionPoints.TryGetValue(caster, out DecisionPoints? dp) && dp != null) + { + checkQuota = dp.CheckActionTypeQuota(CharacterActionType.NormalAttack); + dp.AddActionType(CharacterActionType.NormalAttack, null, false); + } + caster.NormalAttack.Attack(GamingQueue, caster, null, targets); + if (checkQuota) + { + caster.NormalAttack.Attack(GamingQueue, caster, null, targets); + } + } + } + } +} diff --git a/OshimaBot.Content/Skills/战技/号令.cs b/OshimaBot.Content/Skills/战技/号令.cs new file mode 100644 index 0000000..3afaadd --- /dev/null +++ b/OshimaBot.Content/Skills/战技/号令.cs @@ -0,0 +1,63 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Skills +{ + public class 号令 : Skill + { + public override long Id => (long)SkillID.号令; + public override string Name => "号令"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double EPCost => 50; + public override double CD => 45; + public override double HardnessTime { get; set; } = 8; + public override bool CanSelectSelf => false; + public override bool CanSelectTeammate => true; + public override bool CanSelectEnemy => false; + public override int CanSelectTargetCount => 3; + + public 号令(Character? character = null) : base(SkillType.Skill, character) + { + CastRange = 6; + 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 => $"提升除自身外至多 {Skill.CanSelectTargetCount} 个友方角色 {ATK * 100:0.##}% 攻击力,持续 {持续回合} 回合。"; + public override string DispelDescription => "被驱散性:可弱驱散"; + public override EffectType EffectType => EffectType.DamageBoost; + public override DispelledType DispelledType => DispelledType.Weak; + + private double ATK => Level > 0 ? 0.12 + 0.05 * (Level - 1) : 0.12; + private int 持续回合 => 2; + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + foreach (Character target in ctx.Targets) + { + if (target == caster || target.HP <= 0) continue; + WriteLine($"[ {caster} ] 发号施令,[ {target} ] 的攻击力提升了 {ATK * 100:0.##}% [ {target.BaseATK * ATK:0.##} ] 点!"); + ExATK2 e = new(Skill, new() { { "exatk", ATK } }, caster) + { + Name = Name, + Durative = false, + Duration = 0, + DurationTurn = 持续回合, + EffectType = EffectType.DamageBoost, + DispelledType = DispelledType.Weak + }; + target.Effects.Add(e); + e.OnEffectGained(new HookContext(GamingQueue, target)); + GamingQueue?.AddApplyEffects(target, EffectType.DamageBoost); + } + } + } +} diff --git a/OshimaBot.Content/Skills/战技/命运之赐.cs b/OshimaBot.Content/Skills/战技/命运之赐.cs new file mode 100644 index 0000000..f30d77b --- /dev/null +++ b/OshimaBot.Content/Skills/战技/命运之赐.cs @@ -0,0 +1,59 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Skills +{ + /// + /// 命运之赐:由 绑定到友方未来行动回合的【回合奖励】内容 + /// · 作为主动奖励被发放时,由队列立即释放( 的 BindAndRelease) + /// · 效果:回复自身最大生命值,并获得一段时间的攻击力提升 + /// + public class 命运之赐 : Skill + { + public override long Id => (long)SkillID.命运之赐; + public override string Name => "命运之赐"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + + public 命运之赐(Character? character = null) : base(SkillType.Skill, 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 => + $"立即回复自身 {回复比例 * 100:0.##}% 最大生命值,并获得 {攻击提升 * 100:0.##}% 攻击力,持续 {持续回合} 回合。"; + public override string DispelDescription => "被驱散性:不可驱散"; + public override DispelledType DispelledType => DispelledType.CannotBeDispelled; + + private double 回复比例 => 0.15; + private double 攻击提升 => 0.15; + private int 持续回合 => 2; + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character owner) return; + + double heal = owner.MaxHP * 回复比例; + HealToTarget(owner, owner, heal); + + ExATK2 攻击加成 = new(Skill, new() { { "exatk", 攻击提升 } }, owner) + { + Name = Name, + Durative = false, + DurationTurn = 持续回合, + EffectType = EffectType.DamageBoost + }; + 攻击加成.AddToCharacter(owner); + GamingQueue?.AddApplyEffects(owner, EffectType.DamageBoost); + + WriteLine($"[ {owner} ] 获得了命运之赐:回复了 {heal:0.##} 点生命值,攻击力提升 {攻击提升 * 100:0.##}% ,持续 {持续回合} 回合!"); + } + } +} diff --git a/OshimaBot.Content/Skills/战技/命运剥夺.cs b/OshimaBot.Content/Skills/战技/命运剥夺.cs new file mode 100644 index 0000000..ab1271e --- /dev/null +++ b/OshimaBot.Content/Skills/战技/命运剥夺.cs @@ -0,0 +1,78 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Skills +{ + /// + /// 命运剥夺:应用【回合奖励】系统的「一次性移除」能力 + /// · 摧毁目标未来第 1 个行动回合的全部回合奖励() + /// · 无论是否剥夺到奖励,都会造成魔法伤害,属于稳定的输出 + 反制手段 + /// + public class 命运剥夺 : Skill + { + public override long Id => (long)SkillID.命运剥夺; + public override string Name => "命运剥夺"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double EPCost => 55; + public override double CD => 40; + public override double HardnessTime { get; set; } = 7; + public override bool CanSelectSelf => false; + public override bool CanSelectEnemy => true; + public override bool CanSelectTeammate => false; + public override int CanSelectTargetCount => 1; + + public 命运剥夺(Character? character = null) : base(SkillType.Skill, character) + { + CastRange = 6; + 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 => + $"摧毁{Skill.TargetDescription()}未来第 1 个行动回合的全部回合奖励,并对其造成 " + + $"{伤害系数 * 100:0.##}% 攻击力 [ {Skill.Character?.BaseATK * 伤害系数:0.##} ] 点魔法伤害。"; + public override string DispelDescription => "被驱散性:不可驱散"; + public override DispelledType DispelledType => DispelledType.CannotBeDispelled; + + /// + /// 摧毁奖励时的稳定魔法伤害系数(基于攻击力,无基础伤害) + /// · 平衡调整(2026-09-22):L6 由 200% 降至 125%,对齐战技单体上限「≤1.2×普攻」。 + /// 实测:原 1.47×普攻(超上限 23%),目标 ≤1.20×普攻。 + /// + // 调整(二轮):L6 125% → 110%(留 ±5% 测量噪声余量) + private double 伤害系数 => Level > 0 ? 0.9 + 0.04 * (Level - 1) : 0.9; + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + foreach (Character target in ctx.Targets) + { + if (target.HP <= 0) continue; + + if (GamingQueue is not null + && GamingQueue.RemoveRoundRewards(target, 1, out List removed) + && removed.Count > 0) + { + WriteLine($"[ {caster} ] 剥夺了 [ {target} ] 下个行动回合的回合奖励!"); + foreach (Skill reward in removed) + { + WriteLine($" └ 已摧毁 [ {reward.Name} ]"); + } + } + else + { + WriteLine($"[ {caster} ] 未能在 [ {target} ] 身上找到可剥夺的回合奖励。"); + } + + DamageToEnemy(caster, target, DamageType.Magical, MagicType.None, caster.ATK * 伤害系数); + } + } + } +} diff --git a/OshimaBot.Content/Skills/战技/命运馈赠.cs b/OshimaBot.Content/Skills/战技/命运馈赠.cs new file mode 100644 index 0000000..0288760 --- /dev/null +++ b/OshimaBot.Content/Skills/战技/命运馈赠.cs @@ -0,0 +1,64 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Skills +{ + /// + /// 命运馈赠:应用【回合奖励】系统的「绑定角色的回合奖励」能力 + /// · 为一名友方绑定一份其未来第 1 个行动回合的奖励() + /// · 奖励内容由模块自定义(),在目标行动回合开始时自动发放 + /// · 仅在启用「角色绑定的回合奖励」时生效 + /// + public class 命运馈赠 : Skill + { + public override long Id => (long)SkillID.命运馈赠; + public override string Name => "命运馈赠"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double EPCost => 45; + public override double CD => 30; + public override double HardnessTime { get; set; } = 5; + public override bool CanSelectSelf => true; + public override bool CanSelectEnemy => false; + public override bool CanSelectTeammate => true; + public override int CanSelectTargetCount => 1; + + public 命运馈赠(Character? character = null) : base(SkillType.Skill, character) + { + CastRange = 6; + 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 => + $"为{Skill.TargetDescription()}绑定一份其未来第 1 个行动回合的回合奖励 [ {nameof(命运之赐)} ]:该奖励会在其行动回合开始时自动发放。"; + public override string DispelDescription => "被驱散性:不可驱散"; + public override DispelledType DispelledType => DispelledType.CannotBeDispelled; + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + foreach (Character target in ctx.Targets) + { + if (target.HP <= 0) continue; + + // 每次赠予都构造新实例:AddRoundReward 以实例引用去重,重复使用同一实例会被拒绝 + 命运之赐 reward = new(target); + if (GamingQueue is not null && GamingQueue.AddRoundReward(target, 1, reward)) + { + WriteLine($"[ {caster} ] 为 [ {target} ] 的下一行动回合绑定了一份命运的馈赠!"); + } + else + { + WriteLine($"[ {caster} ] 对 [ {target} ] 的命运馈赠未能生效(未启用角色绑定的回合奖励)。"); + } + } + } + } +} diff --git a/OshimaBot.Content/Skills/战技/回复原状.cs b/OshimaBot.Content/Skills/战技/回复原状.cs new file mode 100644 index 0000000..8b98308 --- /dev/null +++ b/OshimaBot.Content/Skills/战技/回复原状.cs @@ -0,0 +1,47 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Skills +{ + public class 回复原状 : Skill + { + public override long Id => (long)SkillID.回复原状; + public override string Name => "回复原状"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override double EPCost => 15; + public override double CD => 20; + public override double HardnessTime { get; set; } = 3; + public override bool CanSelectSelf => true; + public override bool CanSelectEnemy => false; + public override bool CanSelectTeammate => false; + + public 回复原状(Character? character = null) : base(SkillType.Skill, 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 => "解除自身的导力装甲状态,并恢复到通常的战斗姿态。"; + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + // 增益与封技的移除、导力装甲可用性的恢复、本技能的移除,统一交给导力装甲特效处理,避免效果被重复移除导致属性重复结算 + List<导力装甲特效> armored = [.. caster.Effects.OfType<导力装甲特效>()]; + if (armored.Count == 0) + { + WriteLine($"[ {caster} ] 当前并未处于导力装甲状态。"); + return; + } + foreach (导力装甲特效 e in armored) + { + e.解除装甲(caster); + } + } + } +} diff --git a/OshimaBot.Content/Skills/战技/回复弹.cs b/OshimaBot.Content/Skills/战技/回复弹.cs new file mode 100644 index 0000000..4402e2e --- /dev/null +++ b/OshimaBot.Content/Skills/战技/回复弹.cs @@ -0,0 +1,28 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 回复弹 : Skill + { + public override long Id => (long)SkillID.回复弹; + public override string Name => "回复弹"; + public override string Description => string.Join("", Effects.Select(e => e.Description)); + public override string DispelDescription => Effects.Count > 0 ? Effects.First(e => e is 弱驱散特效).DispelDescription : ""; + public override double EPCost => 50; + public override double CD => 45; + public override double HardnessTime { get; set; } = 9; + public override bool CanSelectSelf => true; + public override bool CanSelectTeammate => true; + public override bool CanSelectEnemy => false; + public override int CanSelectTargetCount => 1; + + public 回复弹(Character? character = null) : base(SkillType.Skill, character) + { + CastRange = 4; + Effects.Add(new 纯数值回复生命(this, 200, 150)); + Effects.Add(new 弱驱散特效(this)); + } + } +} diff --git a/OshimaBot.Content/Skills/战技/天堂之吻.cs b/OshimaBot.Content/Skills/战技/天堂之吻.cs new file mode 100644 index 0000000..2320713 --- /dev/null +++ b/OshimaBot.Content/Skills/战技/天堂之吻.cs @@ -0,0 +1,27 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 天堂之吻 : Skill + { + public override long Id => (long)SkillID.天堂之吻; + public override string Name => "天堂之吻"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double EPCost => 75; + public override double CD => 40; + public override double HardnessTime { get; set; } = 10; + public override bool CanSelectSelf => true; + public override bool CanSelectTeammate => true; + public override bool CanSelectEnemy => false; + public override int CanSelectTargetCount => 2; + + public 天堂之吻(Character? character = null) : base(SkillType.Skill, character) + { + CastRange = 5; + Effects.Add(new 提升友方行动速度(this, 90, 30, duration: 20)); + } + } +} diff --git a/OshimaBot.Content/Skills/战技/导力装甲.cs b/OshimaBot.Content/Skills/战技/导力装甲.cs new file mode 100644 index 0000000..397ef33 --- /dev/null +++ b/OshimaBot.Content/Skills/战技/导力装甲.cs @@ -0,0 +1,176 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.PassiveEffects; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 导力装甲 : Skill + { + public override long Id => (long)SkillID.导力装甲; + public override string Name => "导力装甲"; + public override string Description => Effects.Count > 0 ? ((导力装甲特效)Effects.First()).通用描述 : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double EPCost => 80; + public override double CD => 60; + public override double HardnessTime { get; set; } = 6; + public override bool CanSelectSelf => true; + public override bool CanSelectEnemy => false; + public override bool CanSelectTeammate => false; + + public 导力装甲(Character? character = null) : base(SkillType.Skill, character) + { + Effects.Add(new 导力装甲特效(this)); + } + } + + public class 导力装甲特效 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string DispelDescription => "被驱散性:不可驱散"; + public override DispelledType DispelledType => DispelledType.CannotBeDispelled; + public override EffectType EffectType => EffectType.DefenseBoost; + + // 必须声明持续回合,否则队列不会递减 RemainDurationTurn,装甲状态将永不自然到期 + public override bool Durative => false; + public override int DurationTurn => 持续回合; + + /// + /// 状态栏描述,随装甲状态动态切换:生效中为 ,未启动/已解除为 + /// + public override string Description { get; set; } = ""; + + /// + /// 技能卡描述,固定为释放前景文案 + /// + public string 通用描述 => $"启动导力装甲:提升自身 {攻击提升 * 100:0.##}% 攻击力、{护甲提升 * 100:0.##}% 物理护甲和{魔抗提升 * 100:0.##}% 魔法抗性,并立即缩短自身 35% 的行动等待时间,持续 {持续回合} 回合。装甲期间自身的行动硬直大幅缩短。"; + + /// + /// 装甲生效期间的状态栏描述 + /// + public string 装甲状态描述 => $"该角色处于导力装甲状态:提升自身 {攻击提升 * 100:0.##}% 攻击力、{护甲提升 * 100:0.##}% 物理护甲和{魔抗提升 * 100:0.##}% 魔法抗性,持续 {持续回合} 回合,行动硬直大幅缩短。"; + + private double 攻击提升 => Level > 0 ? 0.35 + 0.05 * (Level - 1) : 0.35; + private double 护甲提升 => Level > 0 ? 0.35 + 0.05 * (Level - 1) : 0.35; + private double 魔抗提升 => Level > 0 ? 0.35 + 0.05 * (Level - 1) : 0.35; + private int 持续回合 => 4; + + /// + /// 属性加成由本特效自行结算,不使用 ExATK2 / ExDEF2 / ExMDF 等外部效果: + /// 那些效果的 OnEffectLost 是直接扣减常量、非幂等,一旦被重复触发就会把属性多扣一份。 + /// 这里记录实际生效的数值并配合标志位,保证重复触发时增减都只结算一次。 + /// + private bool 加成已应用 = false; + private double 已应用攻击提升 = 0; + private double 已应用护甲提升 = 0; + private double 已应用魔抗提升 = 0; + + public 导力装甲特效(Skill skill) : base(skill) + { + Description = 通用描述; + } + + /// + /// 应用属性加成,重复调用只生效一次 + /// + private void 应用加成(Character caster) + { + if (加成已应用) return; + 已应用攻击提升 = 攻击提升; + 已应用护甲提升 = 护甲提升; + 已应用魔抗提升 = 魔抗提升; + caster.ExATKPercentage += 已应用攻击提升; + caster.ExDEFPercentage += 已应用护甲提升; + caster.MDF[MagicType.None] += 已应用魔抗提升; + 加成已应用 = true; + } + + /// + /// 还原属性加成,重复调用只生效一次 + /// + private void 还原加成(Character caster) + { + if (!加成已应用) return; + caster.ExATKPercentage -= 已应用攻击提升; + caster.ExDEFPercentage -= 已应用护甲提升; + caster.MDF[MagicType.None] -= 已应用魔抗提升; + 已应用攻击提升 = 0; + 已应用护甲提升 = 0; + 已应用魔抗提升 = 0; + 加成已应用 = false; + } + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character caster) return; + if (!caster.Skills.Any(s => s is 回复原状)) + { + caster.Skills.Add(new 回复原状(caster) + { + Level = Skill.Level, + Source = SkillSource.Reward + }); + } + foreach (Skill dlzj in caster.Skills.Where(s => s is 导力装甲)) + { + dlzj.Enable = false; + dlzj.IsInEffect = true; + } + // 封技是标准的控制状态效果,仍交给框架效果处理 + 造成封技 e = new(Skill, durationTurn: 持续回合) + { + DurativeWithoutDuration = true, + DispelledType = DispelledType.CannotBeDispelled + }; + e.Activate(caster, [caster]); + WriteLine($"[ {caster} ] 启动了导力装甲!"); + 应用加成(caster); + GamingQueue?.AddApplyEffects(caster, EffectType.DamageBoost, EffectType.DefenseBoost); + GamingQueue?.ChangeCharacterHardnessTime(caster, -0.35, true, false); + Description = 装甲状态描述; + } + + /// + /// 提前解除装甲:移除封技状态,属性还原与技能状态恢复由 统一处理 + /// + public void 解除装甲(Character caster) + { + List armored = [.. caster.Effects.Where(e => e != this && e is 封技 fj && fj.Skill is 导力装甲 && fj.Source == caster)]; + foreach (Effect e in armored) + { + e.RemoveFromCharacter(caster); + } + RemoveFromCharacter(caster); + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character caster) return; + 还原加成(caster); + foreach (Skill dlzj in caster.Skills.Where(s => s is 导力装甲)) + { + if (dlzj.CurrentCD == 0) + { + dlzj.Enable = true; + } + dlzj.IsInEffect = false; + } + // 注意:此处不能移除导力装甲技能本体,否则角色将永久失去该技能 + caster.Skills.RemoveWhere(s => s is 回复原状); + Description = 通用描述; + WriteLine($"[ {caster} ] 解除了导力装甲,恢复了通常的战斗姿态!"); + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + RemainDurationTurn = 持续回合; + if (!caster.Effects.Contains(this)) + { + AddToCharacter(caster); + } + } + } +} diff --git a/OshimaBot.Content/Skills/战技/岚.cs b/OshimaBot.Content/Skills/战技/岚.cs new file mode 100644 index 0000000..745cb88 --- /dev/null +++ b/OshimaBot.Content/Skills/战技/岚.cs @@ -0,0 +1,24 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 岚 : Skill + { + public override long Id => (long)SkillID.岚; + public override string Name => "岚"; + public override string Description => Effects.Count > 0 ? string.Join("", Effects.Select(e => e.Description)) : ""; + public override double EPCost => 80; + public override double CD => 30; + public override double HardnessTime { get; set; } = 9; + public override int CanSelectTargetCount => 4; + + public 岚(Character? character = null) : base(SkillType.Skill, character) + { + CastRange = 5; + Effects.Add(new 基于攻击力的伤害_带基础伤害(this, 45, 45, 0.07, 0.035, DamageType.Physical)); + Effects.Add(new 打断施法(this)); + } + } +} diff --git a/OshimaBot.Content/Skills/战技/弓刃交错.cs b/OshimaBot.Content/Skills/战技/弓刃交错.cs new file mode 100644 index 0000000..c869034 --- /dev/null +++ b/OshimaBot.Content/Skills/战技/弓刃交错.cs @@ -0,0 +1,25 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 弓刃交错 : Skill + { + public override long Id => (long)SkillID.弓刃交错; + public override string Name => "弓刃交错"; + public override string Description => Effects.Count > 0 ? string.Join("", Effects.Select(e => e.Description)) : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First(e => e is 施加概率负面).DispelDescription : ""; + public override string ExemptionDescription => Effects.Count > 0 ? Effects.First(e => e is 施加概率负面).ExemptionDescription : ""; + public override double EPCost => 65; + public override double CD => 22; + public override double HardnessTime { get; set; } = 8; + + public 弓刃交错(Character? character = null) : base(SkillType.Skill, character) + { + CastRange = 5; + Effects.Add(new 基于攻击力的伤害_带基础伤害(this, 60, 55, 0.09, 0.04, DamageType.Physical)); + Effects.Add(new 施加概率负面(this, EffectType.Delay, true, 8, 0, 1.5, 0.8, 0.03, 0.3)); + } + } +} diff --git a/OshimaBot.Content/Skills/战技/强打.cs b/OshimaBot.Content/Skills/战技/强打.cs new file mode 100644 index 0000000..9ed21d7 --- /dev/null +++ b/OshimaBot.Content/Skills/战技/强打.cs @@ -0,0 +1,25 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 强打 : Skill + { + public override long Id => (long)SkillID.强打; + public override string Name => "强打"; + public override string Description => Effects.Count > 0 ? string.Join("", Effects.Select(e => e.Description)) : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First(e => e is 施加概率负面).DispelDescription : ""; + public override string ExemptionDescription => Effects.Count > 0 ? Effects.First(e => e is 施加概率负面).ExemptionDescription : ""; + public override double EPCost => 65; + public override double CD => 26; + public override double HardnessTime { get; set; } = 9; + + public 强打(Character? character = null) : base(SkillType.Skill, character) + { + CastRange = 4; + Effects.Add(new 基于攻击力的伤害_带基础伤害(this, 70, 60, 0.095, 0.05, DamageType.Physical)); + Effects.Add(new 施加概率负面(this, EffectType.Bleed, true, 5, 0, 1, 0.4, 0.03, false, 10.0, 0.0, 5.0)); + } + } +} diff --git a/OshimaBot.Content/Skills/战技/快速狙击.cs b/OshimaBot.Content/Skills/战技/快速狙击.cs new file mode 100644 index 0000000..2e05769 --- /dev/null +++ b/OshimaBot.Content/Skills/战技/快速狙击.cs @@ -0,0 +1,55 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Skills +{ + public class 快速狙击 : Skill + { + public override long Id => (long)SkillID.快速狙击; + public override string Name => "快速狙击"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override double EPCost => 60; + public override double CD => 18; + // 平衡调整(2026-09-22):硬直 6 → 7(战技区间 7–10) + public override double HardnessTime { get; set; } = 7; + + public 快速狙击(Character? character = null) : base(SkillType.Skill, character) + { + CastRange = 9; + 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 => $"随机对{Skill.TargetDescription()}造成 {BaseDamage:0.##} + {ATKCoefficient * 100:0.##}% 攻击力 [ {Damage:0.##} ] 点物理伤害。"; + + // 调整:L6 基础值 410→375,实测 1.26×普攻 压至 ≤1.20 + // 调整:L6 基础值 410→325(留噪声余量,目标 ≤1.13×普攻) + private double BaseDamage => Skill.Level > 0 ? 85 + 48 * (Skill.Level - 1) : 85; + private double ATKCoefficient => Skill.Level > 0 ? 0.12 + 0.06 * (Skill.Level - 1) : 0.12; + private double Damage => BaseDamage + ATKCoefficient * (Skill.Character?.ATK ?? 0); + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List enemies = []; + if (GamingQueue != null) + { + enemies.AddRange(GamingQueue.GetEnemies(caster).Where(c => c.HP > 0)); + } + if (enemies.Count == 0) + { + enemies.AddRange(ctx.Targets.Where(c => c.HP > 0)); + } + if (enemies.Count == 0) return; + Character target = enemies[Random.Next(enemies.Count)]; + WriteLine($"[ {caster} ] 使用[快速狙击],命中了随机的 [ {target} ]!"); + DamageToEnemy(caster, target, DamageType.Physical, MagicType.None, Damage); + } + } +} diff --git a/OshimaBot.Content/Skills/战技/战术部署.cs b/OshimaBot.Content/Skills/战技/战术部署.cs new file mode 100644 index 0000000..2106faf --- /dev/null +++ b/OshimaBot.Content/Skills/战技/战术部署.cs @@ -0,0 +1,84 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; + +namespace OshimaBot.Content.Skills +{ + /// + /// 战技 · 辅助型【战术部署】—— 把「节奏」转移给队友 + /// 设计意图:本项目此前的技能只作用于「生命 / 能量 / 属性 / 位置」, + /// 从未触碰**决策点**这一层。而实测(2759 回合)显示每回合行动数中位仅 **1.00**, + /// 且 AI 的行动循环会持续到 `CurrentDecisionPoints` 耗尽 + /// (`GamingQueue.cs:1201`)⇒ **决策点才是硬约束**,配额只是软约束。 + /// 因此"给人多做事"的正确做法是**给决策点**,而非给配额。 + /// 效果:目标 +2 决策点;若目标不是自己,额外给自己 +1 决策点(保证施法者不完全亏)。 + /// 标尺:战技(支援类)EP 40–80 / CD 55–60 → 取 EP 60 / CD 45(本技能无伤害, + /// 不占"控制点预算";决策点补充按 §5.1 的团队折算,单次团队净 +3 点 ≈ 3 次普攻)。 + /// ⚠ 决策点补充**必须封顶到 `MaxDecisionPoints`**:超出部分会在下一回合恢复时 + /// 被 `Math.Min(Current + pointsToAdd, Max)` 截掉,属于无效溢出。 + /// + public class 战术部署 : Skill + { + public override long Id => (long)SkillID.战术部署; + public override string Name => "战术部署"; + public override string Description => string.Join("", Effects.Select(e => e.Description)); + public override double EPCost => 60; + public override double CD => 45; + public override double HardnessTime { get; set; } = 8; + public override bool CanSelectSelf => true; + public override bool CanSelectTeammate => true; + public override bool CanSelectEnemy => false; + public override int CanSelectTargetCount => 1; + + public 战术部署(Character? character = null) : base(SkillType.Skill, 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 => + $"为{Skill.TargetDescription()}补充 {队友补充量} 点决策点;若目标不是自己,施法者额外获得 {自身补充量} 点决策点。"; + + /// 给目标补充的决策点(≈ 让目标多做 1–2 件事) + private const int 队友补充量 = 2; + + /// 给施法者自己的补偿(仅当目标不是自己时生效,避免"自己给自己"重复计算) + private const int 自身补充量 = 1; + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + foreach (Character target in ctx.Targets) + { + if (target.HP <= 0) continue; + 补充决策点(caster, target, 队友补充量); + if (target != caster) + { + 补充决策点(caster, caster, 自身补充量); + } + } + } + + /// + /// 为角色补充决策点。 + /// ⚠ 必须封顶到 —— 超出的部分会在 + /// 下一回合恢复时被截掉(`GamingQueue.cs:4243/4249` 的 `Math.Min`),属于无效溢出。 + /// + private void 补充决策点(Character caster, Character target, int amount) + { + if (GamingQueue is null) return; + if (!GamingQueue.CharacterDecisionPoints.TryGetValue(target, out DecisionPoints? dp) || dp is null) return; + int before = dp.CurrentDecisionPoints; + dp.CurrentDecisionPoints = Math.Min(before + amount, dp.MaxDecisionPoints); + int actual = dp.CurrentDecisionPoints - before; + string tail = actual < amount ? $"(上限 {dp.MaxDecisionPoints},溢出 {amount - actual} 点未生效)" : ""; + WriteLine($"[ {caster} ] 实施了战术部署:[ {target} ] 获得 {actual} 点决策点({before} → {dp.CurrentDecisionPoints} / {dp.MaxDecisionPoints}){tail}"); + } + } +} diff --git a/OshimaBot.Content/Skills/战技/抢夺命运.cs b/OshimaBot.Content/Skills/战技/抢夺命运.cs new file mode 100644 index 0000000..45cddb7 --- /dev/null +++ b/OshimaBot.Content/Skills/战技/抢夺命运.cs @@ -0,0 +1,80 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Skills +{ + /// + /// 抢夺命运:应用【回合奖励】系统的「角色可相互抢夺」能力 + /// · 夺取目标未来第 1 个行动回合的全部回合奖励,并入自身未来第 1 个行动回合 + /// · 调用 ,被夺取项会连同归属一起改写为夺取者 + /// · 目标身上没有可夺取的奖励时,改为对其造成魔法伤害,保证技能不空放 + /// · 仅在启用「角色绑定的回合奖励」(InitRoundRewards(..., bindToCharacter: true, ...))时才能夺取 + /// + public class 抢夺命运 : Skill + { + public override long Id => (long)SkillID.抢夺命运; + public override string Name => "抢夺命运"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double EPCost => 50; + public override double CD => 35; + public override double HardnessTime { get; set; } = 6; + public override bool CanSelectSelf => false; + public override bool CanSelectEnemy => true; + public override bool CanSelectTeammate => false; + public override int CanSelectTargetCount => 1; + + public 抢夺命运(Character? character = null) : base(SkillType.Skill, character) + { + CastRange = 6; + 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 => + $"夺取{Skill.TargetDescription()}未来第 1 个行动回合的全部回合奖励,并入自身未来第 1 个行动回合;" + + $"若目标没有可夺取的回合奖励,则对其造成 {伤害系数 * 100:0.##}% 攻击力 [ {Skill.Character?.BaseATK * 伤害系数:0.##} ] 点魔法伤害。"; + public override string DispelDescription => "被驱散性:不可驱散"; + public override DispelledType DispelledType => DispelledType.CannotBeDispelled; + + /// + /// 夺取失败时的补偿伤害系数(基于攻击力,无基础伤害) + /// · 平衡调整(2026-09-22):L6 由 245% 降至 125%,对齐战技单体上限「≤1.2×普攻」。 + /// 实测:原 1.47×普攻(超上限 23%),目标 ≤1.20×普攻。 + /// + // 调整(二轮):L6 125% → 110%(留 ±5% 测量噪声余量) + private double 伤害系数 => Level > 0 ? 0.9 + 0.04 * (Level - 1) : 0.9; + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + foreach (Character target in ctx.Targets) + { + if (target.HP <= 0) continue; + + List stolenItems = []; + if (GamingQueue is not null + && GamingQueue.StealRoundReward(target, 1, caster, 1, out stolenItems) + && stolenItems.Count > 0) + { + WriteLine($"[ {caster} ] 夺取了 [ {target} ] 下个行动回合的回合奖励!"); + foreach (Skill reward in stolenItems) + { + WriteLine($" └ 已将 [ {reward.Name} ] 转入 [ {caster} ] 的未来回合奖励"); + } + } + else + { + WriteLine($"[ {caster} ] 未能在 [ {target} ] 身上夺取到回合奖励,转而发动攻击!"); + DamageToEnemy(caster, target, DamageType.Magical, MagicType.None, caster.ATK * 伤害系数); + } + } + } + } +} diff --git a/OshimaBot.Content/Skills/战技/拘束之鞭.cs b/OshimaBot.Content/Skills/战技/拘束之鞭.cs new file mode 100644 index 0000000..bd032a6 --- /dev/null +++ b/OshimaBot.Content/Skills/战技/拘束之鞭.cs @@ -0,0 +1,25 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 拘束之鞭 : Skill + { + public override long Id => (long)SkillID.拘束之鞭; + public override string Name => "拘束之鞭"; + public override string Description => string.Join("", Effects.Select(e => e.Description)); + public override string DispelDescription => Effects.Count > 0 ? Effects.First(e => e is 打断施法).DispelDescription : ""; + public override string ExemptionDescription => Effects.Count > 0 ? Effects.First(e => e is 打断施法).ExemptionDescription : ""; + public override double EPCost => 60; + public override double CD => 22; + public override double HardnessTime { get; set; } = 7; + + public 拘束之鞭(Character? character = null) : base(SkillType.Skill, character) + { + CastRange = 6; + Effects.Add(new 基于攻击力的伤害_带基础伤害(this, 60, 50, 0.09, 0.04, DamageType.Physical)); + Effects.Add(new 打断施法(this)); + } + } +} diff --git a/OshimaBot.Content/Skills/战技/挑拨.cs b/OshimaBot.Content/Skills/战技/挑拨.cs new file mode 100644 index 0000000..371553e --- /dev/null +++ b/OshimaBot.Content/Skills/战技/挑拨.cs @@ -0,0 +1,83 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; +using OshimaBot.Content.Effects.PassiveEffects; + +namespace OshimaBot.Content.Skills +{ + public class 挑拨 : Skill + { + public override long Id => (long)SkillID.挑拨; + public override string Name => "挑拨"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double EPCost => 65; + public override double CD => 40; + public override double HardnessTime { get; set; } = 10; + public override bool CanSelectSelf => false; + public override bool CanSelectTeammate => false; + public override bool CanSelectEnemy => true; + public override int CanSelectTargetCount => 3; + + public 挑拨(Character? character = null) : base(SkillType.Skill, character) + { + CastRange = 4; + Effects.Add(new 挑拨特效(this)); + } + } + + public class 挑拨特效 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"对目标{(Skill.CanSelectTargetCount > 1 ? $"至多 {Skill.CanSelectTargetCount} 个" : "")}敌方角色施加愤怒状态。愤怒:行动受限且失控,行动回合中无法自主行动,仅能对施法者发起普通攻击。持续 {持续时间}。"; + public override EffectType EffectType => EffectType.Taunt; + public override DispelledType DispelledType => DispelledType.Strong; + public override bool ExemptDuration => true; + + private string 持续时间 => _durative && _duration > 0 ? 实际持续时间 + $" {GameplayEquilibriumConstant.InGameTime}" : (!_durative && _durationTurn > 0 ? 实际持续时间 + " 回合" : $"0 {GameplayEquilibriumConstant.InGameTime}"); + private double 实际持续时间 => _durative && _duration > 0 ? (_duration + _levelGrowth * (Level - 1) * MagicEfficacy) : (!_durative && _durationTurn > 0 ? ((int)Math.Round(_durationTurn + _levelGrowth * (Level - 1) * MagicEfficacy, 0, MidpointRounding.ToPositiveInfinity)) : 0); + + private readonly bool _durative = false; + private readonly double _duration = 0; + private readonly int _durationTurn = 2; + private readonly double _levelGrowth = 0; + + public 挑拨特效(Skill skill) : base(skill) + { + GamingQueue = skill.GamingQueue; + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + foreach (Character target in targets) + { + 愤怒 e = new(Skill, caster, caster); + if (!CheckExemption(caster, target, e)) + { + WriteLine($"[ {caster} ] 嘲讽了 [ {target} ] ,[ {target} ] 愤怒了!!持续时间:{持续时间}!"); + if (_durative && _duration > 0) + { + e.Durative = true; + e.Duration = 实际持续时间; + e.RemainDuration = 实际持续时间; + } + else if (!_durative && _durationTurn > 0) + { + e.Durative = false; + e.DurationTurn = (int)实际持续时间; + e.RemainDurationTurn = (int)实际持续时间; + } + target.Effects.Add(e); + e.OnEffectGained(new HookContext(GamingQueue, target)); + GamingQueue?.AddApplyEffects(target, e.EffectType); + } + } + } + } +} diff --git a/OshimaBot.Content/Skills/战技/斗魂.cs b/OshimaBot.Content/Skills/战技/斗魂.cs new file mode 100644 index 0000000..b3b66c7 --- /dev/null +++ b/OshimaBot.Content/Skills/战技/斗魂.cs @@ -0,0 +1,76 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Skills +{ + public class 斗魂 : Skill + { + public override long Id => (long)SkillID.斗魂; + public override string Name => "斗魂"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override string ExemptionDescription => Effects.Count > 0 ? Effects.First().ExemptionDescription : ""; + public override double EPCost => 45; + public override double CD => 30; + public override double HardnessTime { get; set; } = 8; + + public 斗魂(Character? character = null) : base(SkillType.Skill, character) + { + CastRange = 4; + 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 => $"使{Skill.TargetDescription()}的攻击力降低 {ATKDown * 100:0.##}%、物理护甲降低 {DEFDown * 100:0.##}%,持续 2 回合。"; + public override string DispelDescription => "被驱散性:可弱驱散"; + public override EffectType EffectType => EffectType.Weaken; + public override DispelledType DispelledType => DispelledType.Weak; + public override bool IsDebuff => true; + + private double ATKDown => Level > 0 ? 0.15 + 0.05 * (Level - 1) : 0.15; + private double DEFDown => Level > 0 ? 0.25 + 0.05 * (Level - 1) : 0.25; + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + foreach (Character target in ctx.Targets) + { + if (target.HP <= 0) continue; + WriteLine($"[ {target} ] 的攻击力和物理护甲降低了!"); + ExATK2 atk = new(Skill, new() { { "exatk", -ATKDown } }, caster) + { + Name = Name, + Durative = false, + Duration = 0, + DurationTurn = 2, + IsDebuff = true, + EffectType = EffectType.Weaken, + DispelledType = DispelledType.Weak + }; + target.Effects.Add(atk); + atk.OnEffectGained(new HookContext(GamingQueue, target)); + GamingQueue?.AddApplyEffects(target, EffectType.Weaken); + ExDEF2 def = new(Skill, new() { { "exdef", -DEFDown } }, caster) + { + Name = Name, + Durative = false, + Duration = 0, + DurationTurn = 2, + IsDebuff = true, + EffectType = EffectType.Weaken, + DispelledType = DispelledType.Weak + }; + target.Effects.Add(def); + def.OnEffectGained(new HookContext(GamingQueue, target)); + GamingQueue?.AddApplyEffects(target, EffectType.Weaken); + } + } + } +} diff --git a/OshimaBot.Content/Skills/战技/断罪斩.cs b/OshimaBot.Content/Skills/战技/断罪斩.cs new file mode 100644 index 0000000..f335478 --- /dev/null +++ b/OshimaBot.Content/Skills/战技/断罪斩.cs @@ -0,0 +1,39 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + /// + /// 【技能制作示范】断罪斩 —— 单目标物理战技 + /// 制作一个技能只需三步: + /// ① 在 分配一个 Id; + /// ② 继承 ,按需 override Id/Name/消耗/冷却/硬直等数值属性; + /// ③ 在构造里把效果(Effect 子类)加入 ,技能的效果与描述即生效。 + /// 数值公式沿用 Oshima 惯例:随 成长(Level 为 0 时视为未学习,用基础值)。 + /// 【战技规范】消耗使用 (能量); + /// 不要 override ——吟唱是魔法专属, 注释明确标注「[ 魔法 ]」, + /// 战技设置咏唱会违背 GamingQueue 的行动结算流程;魔法才使用 MPCost + CastTime + MagicBottleneck。 + /// + public class 断罪斩 : Skill + { + public override long Id => (long)SkillID.断罪斩; + public override string Name => "断罪斩"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + // 战技使用能量(EP)作为消耗;咏唱(CastTime)与魔法消耗(MPCost)属于魔法,战技不使用 + public override double EPCost => 50; + public override double CD => 25; + public override double HardnessTime { get; set; } = 8; + + /// + /// 继承此构造:传入角色后即可 AddSkillToCharacter 加入战斗 + /// + /// + public 断罪斩(Character? character = null) : base(SkillType.Skill, character) + { + // 复用现成的「基于攻击力的伤害」效果(带基础伤害 + 攻击力系数,物理伤害型) + // 攻击力系数对齐同批战技:0.075 + 0.055×(L-1)(L6 = 35%) + Effects.Add(new 基于攻击力的伤害_带基础伤害(this, 120, 60, 0.075, 0.055, DamageType.Physical)); + } + } +} diff --git a/OshimaBot.Content/Skills/战技/旋风轮.cs b/OshimaBot.Content/Skills/战技/旋风轮.cs new file mode 100644 index 0000000..b6207ef --- /dev/null +++ b/OshimaBot.Content/Skills/战技/旋风轮.cs @@ -0,0 +1,24 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 旋风轮 : Skill + { + public override long Id => (long)SkillID.旋风轮; + public override string Name => "旋风轮"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double EPCost => 80; + public override double CD => 25; + public override double HardnessTime { get; set; } = 8; + public override int CanSelectTargetCount => 5; + + public 旋风轮(Character? character = null) : base(SkillType.Skill, character) + { + CastRange = 6; + Effects.Add(new 基于攻击力的伤害_带基础伤害(this, 40, 55, 0.1, 0.03, DamageType.Physical)); + } + } +} diff --git a/OshimaBot.Content/Skills/战技/无尽剑制.cs b/OshimaBot.Content/Skills/战技/无尽剑制.cs new file mode 100644 index 0000000..2eb0bd9 --- /dev/null +++ b/OshimaBot.Content/Skills/战技/无尽剑制.cs @@ -0,0 +1,23 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 无尽剑制 : Skill + { + public override long Id => (long)SkillID.无尽剑制; + public override string Name => "无尽剑制"; + public override string Description => Effects.Count > 0 ? string.Join("", Effects.Select(e => e.Description)) : ""; + public override double EPCost => 90; + public override double CD => 40; + // 调整:硬直 12 → 10(战技区间 7–10) + public override double HardnessTime { get; set; } = 10; + public override bool SelectAllEnemies => true; + + public 无尽剑制(Character? character = null) : base(SkillType.Skill, character) + { + Effects.Add(new 基于攻击力的伤害_带基础伤害(this, 55, 50, 0.08, 0.04, DamageType.Physical)); + } + } +} diff --git a/OshimaBot.Content/Skills/战技/无相飞刀.cs b/OshimaBot.Content/Skills/战技/无相飞刀.cs new file mode 100644 index 0000000..13d5196 --- /dev/null +++ b/OshimaBot.Content/Skills/战技/无相飞刀.cs @@ -0,0 +1,24 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 无相飞刀 : Skill + { + public override long Id => (long)SkillID.无相飞刀; + public override string Name => "无相飞刀"; + public override string Description => Effects.Count > 0 ? string.Join("", Effects.Select(e => e.Description)) : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First(e => e is 施加概率负面).DispelDescription : ""; + public override string ExemptionDescription => Effects.Count > 0 ? Effects.First(e => e is 施加概率负面).ExemptionDescription : ""; + public override double EPCost => 45; + public override double CD => 30; + public override double HardnessTime { get; set; } = 6; + + public 无相飞刀(Character? character = null) : base(SkillType.Skill, character) + { + CastRange = 5; + Effects.Add(new 施加概率负面(this, EffectType.Silence, false, 0, 2, 0, 1, 0)); + } + } +} diff --git a/OshimaBot.Content/Skills/战技/月华掌.cs b/OshimaBot.Content/Skills/战技/月华掌.cs new file mode 100644 index 0000000..178f3e1 --- /dev/null +++ b/OshimaBot.Content/Skills/战技/月华掌.cs @@ -0,0 +1,25 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 月华掌 : Skill + { + public override long Id => (long)SkillID.月华掌; + public override string Name => "月华掌"; + public override string Description => Effects.Count > 0 ? string.Join("", Effects.Select(e => e.Description)) : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First(e => e is 施加概率负面).DispelDescription : ""; + public override string ExemptionDescription => Effects.Count > 0 ? Effects.First(e => e is 施加概率负面).ExemptionDescription : ""; + public override double EPCost => 70; + public override double CD => 26; + public override double HardnessTime { get; set; } = 9; + + public 月华掌(Character? character = null) : base(SkillType.Skill, character) + { + CastRange = 4; + Effects.Add(new 基于攻击力的伤害_带基础伤害(this, 60, 50, 0.09, 0.045, DamageType.Physical)); + Effects.Add(new 施加概率负面(this, EffectType.Confusion, false, 0, 2, 0, 0.3, 0.03)); + } + } +} diff --git a/OshimaBot.Content/Skills/战技/欢乐激发.cs b/OshimaBot.Content/Skills/战技/欢乐激发.cs new file mode 100644 index 0000000..dee0e85 --- /dev/null +++ b/OshimaBot.Content/Skills/战技/欢乐激发.cs @@ -0,0 +1,26 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 欢乐激发 : Skill + { + public override long Id => (long)SkillID.欢乐激发; + public override string Name => "欢乐激发"; + public override string Description => Effects.Count > 0 ? string.Join("", Effects.Select(e => e.Description)) : ""; + public override double EPCost => 70; + public override double CD => 55; + public override double HardnessTime { get; set; } = 9; + public override bool CanSelectSelf => true; + public override bool CanSelectTeammate => true; + public override bool CanSelectEnemy => false; + public override int CanSelectTargetCount => 4; + + public 欢乐激发(Character? character = null) : base(SkillType.Skill, character) + { + CastRange = 5; + Effects.Add(new 纯数值回复生命(this, 170, 130)); + } + } +} diff --git a/OshimaBot.Content/Skills/战技/死亡制裁.cs b/OshimaBot.Content/Skills/战技/死亡制裁.cs new file mode 100644 index 0000000..6a5e1cf --- /dev/null +++ b/OshimaBot.Content/Skills/战技/死亡制裁.cs @@ -0,0 +1,23 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 死亡制裁 : Skill + { + public override long Id => (long)SkillID.死亡制裁; + public override string Name => "死亡制裁"; + public override string Description => Effects.Count > 0 ? string.Join("", Effects.Select(e => e.Description)) : ""; + public override double EPCost => 80; + public override double CD => 30; + public override double HardnessTime { get; set; } = 10; + public override int CanSelectTargetCount => 4; + + public 死亡制裁(Character? character = null) : base(SkillType.Skill, character) + { + CastRange = 5; + Effects.Add(new 基于攻击力的伤害_带基础伤害(this, 50, 50, 0.08, 0.04, DamageType.Physical)); + } + } +} diff --git a/OshimaBot.Content/Skills/战技/火焰碎击.cs b/OshimaBot.Content/Skills/战技/火焰碎击.cs new file mode 100644 index 0000000..3d411bf --- /dev/null +++ b/OshimaBot.Content/Skills/战技/火焰碎击.cs @@ -0,0 +1,26 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 火焰碎击 : Skill + { + public override long Id => (long)SkillID.火焰碎击; + public override string Name => "火焰碎击"; + public override string Description => Effects.Count > 0 ? string.Join("", Effects.Select(e => e.Description)) : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First(e => e is 施加概率负面).DispelDescription : ""; + public override string ExemptionDescription => Effects.Count > 0 ? Effects.First(e => e is 施加概率负面).ExemptionDescription : ""; + public override double EPCost => 75; + public override double CD => 30; + public override double HardnessTime { get; set; } = 10; + + public 火焰碎击(Character? character = null) : base(SkillType.Skill, character) + { + CastRange = 4; + Effects.Add(new 基于攻击力的伤害_带基础伤害(this, 80, 60, 0.1, 0.05, DamageType.Physical)); + Effects.Add(new 施加概率负面(this, EffectType.Bleed, true, 6, 0, 1.5, 1, 0, false, 12.0, 0.0, 6.0)); + Effects.Add(new 打断施法(this)); + } + } +} diff --git a/OshimaBot.Content/Skills/战技/灾难一掷.cs b/OshimaBot.Content/Skills/战技/灾难一掷.cs new file mode 100644 index 0000000..a11e194 --- /dev/null +++ b/OshimaBot.Content/Skills/战技/灾难一掷.cs @@ -0,0 +1,27 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 灾难一掷 : Skill + { + public override long Id => (long)SkillID.灾难一掷; + public override string Name => "灾难一掷"; + public override string Description => Effects.Count > 0 ? string.Join("", Effects.Select(e => e.Description)) : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First(e => e is 施加概率负面).DispelDescription : ""; + public override string ExemptionDescription => Effects.Count > 0 ? Effects.First(e => e is 施加概率负面).ExemptionDescription : ""; + public override double EPCost => 70; + public override double CD => 28; + public override double HardnessTime { get; set; } = 9; + + public 灾难一掷(Character? character = null) : base(SkillType.Skill, character) + { + CastRange = 6; + // 调整:L6 基础值 405→350(留噪声余量,目标 ≤1.13×普攻) + Effects.Add(new 基于攻击力的伤害_带基础伤害(this, 80, 54, 0.11, 0.055, DamageType.Physical)); + // 调整:战斗不能概率 L6 50% → 40%(强控上限 40%) + Effects.Add(new 施加概率负面(this, EffectType.Cripple, false, 0, 1, 0, 0.30, 0.02)); + } + } +} diff --git a/OshimaBot.Content/Skills/战技/牺牲之箭.cs b/OshimaBot.Content/Skills/战技/牺牲之箭.cs new file mode 100644 index 0000000..f02d76f --- /dev/null +++ b/OshimaBot.Content/Skills/战技/牺牲之箭.cs @@ -0,0 +1,47 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Skills +{ + public class 牺牲之箭 : Skill + { + public override long Id => (long)SkillID.牺牲之箭; + public override string Name => "牺牲之箭"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override double EPCost => 40; + public override double CD => 45; + public override double HardnessTime { get; set; } = 8; + public override bool CanSelectSelf => false; + public override bool CanSelectTeammate => true; + public override bool CanSelectEnemy => false; + public override int CanSelectTargetCount => 3; + + public 牺牲之箭(Character? character = null) : base(SkillType.Skill, character) + { + CastRange = 6; + 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 => $"为除自身外至多 {Skill.CanSelectTargetCount} 个友方角色回复 {能量回复:0.##} 点能量值。"; + + private double 能量回复 => Skill.Level > 0 ? 40 + 20 * (Skill.Level - 1) : 40; + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + foreach (Character target in ctx.Targets) + { + if (target == caster || target.HP <= 0) continue; + double ep = 能量回复; + target.EP = Math.Min(target.EP + ep, 200); + WriteLine($"[ {caster} ] 向 [ {target} ] 射出了牺牲之箭,回复了 {ep:0.##} 点能量值!"); + } + } + } +} diff --git a/OshimaBot.Content/Skills/战技/狂刃剑舞.cs b/OshimaBot.Content/Skills/战技/狂刃剑舞.cs new file mode 100644 index 0000000..44920b1 --- /dev/null +++ b/OshimaBot.Content/Skills/战技/狂刃剑舞.cs @@ -0,0 +1,25 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 狂刃剑舞 : Skill + { + public override long Id => (long)SkillID.狂刃剑舞; + public override string Name => "狂刃剑舞"; + public override string Description => Effects.Count > 0 ? string.Join("", Effects.Select(e => e.Description)) : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First(e => e is 施加概率负面).DispelDescription : ""; + public override string ExemptionDescription => Effects.Count > 0 ? Effects.First(e => e is 施加概率负面).ExemptionDescription : ""; + public override double EPCost => 70; + public override double CD => 28; + public override double HardnessTime { get; set; } = 9; + + public 狂刃剑舞(Character? character = null) : base(SkillType.Skill, character) + { + CastRange = 4; + Effects.Add(new 基于攻击力的伤害_带基础伤害(this, 70, 60, 0.1, 0.05, DamageType.Physical)); + Effects.Add(new 施加概率负面(this, EffectType.Confusion, false, 0, 2, 0, 0.35, 0.03)); + } + } +} diff --git a/OshimaBot.Content/Skills/战技/狐媚暗随.cs b/OshimaBot.Content/Skills/战技/狐媚暗随.cs new file mode 100644 index 0000000..a426733 --- /dev/null +++ b/OshimaBot.Content/Skills/战技/狐媚暗随.cs @@ -0,0 +1,22 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 狐媚暗随 : Skill + { + public override long Id => (long)SkillID.狐媚暗随; + public override string Name => "狐媚暗随"; + public override string Description => Effects.Count > 0 ? string.Join("", Effects.Select(e => e.Description)) : ""; + public override double EPCost => 55; + public override double CD => 22; + public override double HardnessTime { get; set; } = 7; + + public 狐媚暗随(Character? character = null) : base(SkillType.Skill, character) + { + CastRange = 4; + Effects.Add(new 基于攻击力的伤害_带基础伤害(this, 75, 65, 0.1, 0.05, DamageType.Physical)); + } + } +} diff --git a/OshimaBot.Content/Skills/战技/疾走.cs b/OshimaBot.Content/Skills/战技/疾走.cs new file mode 100644 index 0000000..c7832d8 --- /dev/null +++ b/OshimaBot.Content/Skills/战技/疾走.cs @@ -0,0 +1,88 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; + +namespace OshimaBot.Content.Skills +{ + public class 疾走 : Skill + { + public override long Id => (long)SkillID.疾走; + public override string Name => "疾走"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double EPCost => 25; + // 调整:CD 15 → 18(战技区间 18–45) + public override double CD => 18; + public override double HardnessTime { get; set; } = 3; + public override bool CanSelectSelf => true; + public override bool CanSelectEnemy => false; + + public 疾走(Character? character = null) : base(SkillType.Skill, 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 => $"本回合内大幅提升移动距离,并附赠一次战技的决策点配额。移动距离提升:{移动距离提升} 格。"; + public override string DispelDescription => ""; + public override EffectType EffectType => EffectType.Haste; + public override bool Durative => false; + public override double Duration => 0; + public override int DurationTurn => 1; + + private int 移动距离提升 + { + get + { + return Skill.Level switch + { + 2 or 3 => 2, + 4 or 5 => 3, + 6 => 4, + _ => 1, + }; + } + } + private int 本次提升 = 0; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + Skill.IsInEffect = true; + 本次提升 = 移动距离提升; + character.ExMOV += 本次提升; + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + Skill.IsInEffect = false; + character.ExMOV -= 本次提升; + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + 本次提升 = 0; + if (!caster.Effects.Contains(this)) + { + GamingQueue?.AddApplyEffects(caster, EffectType); + RemainDurationTurn = DurationTurn; + caster.Effects.Add(this); + OnEffectGained(new HookContext(GamingQueue, caster)); + } + if (GamingQueue != null && GamingQueue.CharacterDecisionPoints.TryGetValue(caster, out DecisionPoints? dp) && dp != null) + { + dp.AddTempActionQuota(this, CharacterActionType.CastSkill); + } + } + } +} diff --git a/OshimaBot.Content/Skills/战技/疾风步.cs b/OshimaBot.Content/Skills/战技/疾风步.cs new file mode 100644 index 0000000..e79fedc --- /dev/null +++ b/OshimaBot.Content/Skills/战技/疾风步.cs @@ -0,0 +1,108 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.EffectResult; +using FunGame.Core.Model.Framework; + +namespace OshimaBot.Content.Skills +{ + public class 疾风步 : Skill + { + public override long Id => (long)SkillID.疾风步; + public override string Name => "疾风步"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double EPCost => 60; + public override double CD => 45; + public override double HardnessTime { get; set; } = 5; + public override bool CanSelectSelf => true; + public override bool CanSelectEnemy => false; + + public 疾风步(Character? character = null) : base(SkillType.Skill, 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 => $"进入不可选中状态,获得 100 行动速度,提高 8% 暴击率,持续 {Duration:0.##} {GameplayEquilibriumConstant.InGameTime}。不可选中:无法成为任何目标且免疫场地伤害。破隐一击:在持续时间内,首次造成伤害会附加 {系数 * 100:0.##}% 敏捷 [ {伤害加成:0.##} ] 的强化伤害,并解除不可选中状态。"; + public override string DispelDescription => "被驱散性:不可选中状态生效期间,此技能不可驱散,否则可弱驱散"; + public override EffectType EffectType => EffectType.Unselectable; + public override bool Durative => true; + public override double Duration => 12 + (1 * (Level - 1)); + + private double 系数 => 0.5 + 0.5 * (Skill.Level - 1); + private double 伤害加成 => 系数 * Skill.Character?.AGI ?? 0; + private bool 首次伤害 { get; set; } = true; + private bool 破隐一击 { get; set; } = false; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + DispelledType = DispelledType.CannotBeDispelled; + Skill.IsInEffect = true; + AddEffectTypeToCharacter(character, [EffectType]); + character.ExSPD += 100; + character.ExCritRate += 0.08; + GamingQueue?.InterruptCasting(character); + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + Skill.IsInEffect = false; + if (!破隐一击) + { + // 在没有打出破隐一击的情况下,恢复角色状态 + RemoveEffectTypesFromCharacter(character); + DispelledType = DispelledType.Weak; + } + character.ExSPD -= 100; + character.ExCritRate -= 0.08; + } + + public override AlterActualDamageResult AlterActualDamageAfterCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return default; + double damage = ctx.Damage; + bool isNormalAttack = ctx.IsNormalAttack; + DamageType damageType = ctx.DamageType; + MagicType magicType = ctx.MagicType; + DamageResult damageResult = ctx.DamageResult; + Dictionary totalDamageBonus = ctx.TotalDamageBonus; + if (character == Skill.Character && (damageResult == DamageResult.Normal || damageResult == DamageResult.Critical) && 首次伤害) + { + 首次伤害 = false; + 破隐一击 = true; + RemoveEffectTypesFromCharacter(character); + double d = 伤害加成; + WriteLine($"[ {character} ] 触发了疾风步破隐一击,获得了 [ {d:0.##} ] 点伤害加成!"); + DispelledType = DispelledType.Weak; + return new AlterActualDamageResult { DamageDelta = d }; + + } + return default; + + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + if (!caster.Effects.Contains(this)) + { + GamingQueue?.AddApplyEffects(caster, EffectType); + 首次伤害 = true; + 破隐一击 = false; + RemainDuration = Duration; + caster.Effects.Add(this); + OnEffectGained(new HookContext(GamingQueue, caster)); + } + } + } +} diff --git a/OshimaBot.Content/Skills/战技/石化之矢.cs b/OshimaBot.Content/Skills/战技/石化之矢.cs new file mode 100644 index 0000000..a2a8a84 --- /dev/null +++ b/OshimaBot.Content/Skills/战技/石化之矢.cs @@ -0,0 +1,25 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 石化之矢 : Skill + { + public override long Id => (long)SkillID.石化之矢; + public override string Name => "石化之矢"; + public override string Description => Effects.Count > 0 ? string.Join("", Effects.Select(e => e.Description)) : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First(e => e is 施加概率负面).DispelDescription : ""; + public override string ExemptionDescription => Effects.Count > 0 ? Effects.First(e => e is 施加概率负面).ExemptionDescription : ""; + public override double EPCost => 80; + public override double CD => 35; + public override double HardnessTime { get; set; } = 10; + + public 石化之矢(Character? character = null) : base(SkillType.Skill, character) + { + CastRange = 6; + Effects.Add(new 基于攻击力的伤害_带基础伤害(this, 50, 45, 0.075, 0.04, DamageType.Physical)); + Effects.Add(new 施加概率负面(this, EffectType.Petrify, true, 4, 0, 1, 1, 0)); + } + } +} diff --git a/OshimaBot.Content/Skills/战技/破邪显正.cs b/OshimaBot.Content/Skills/战技/破邪显正.cs new file mode 100644 index 0000000..aa53658 --- /dev/null +++ b/OshimaBot.Content/Skills/战技/破邪显正.cs @@ -0,0 +1,23 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 破邪显正 : Skill + { + public override long Id => (long)SkillID.破邪显正; + public override string Name => "破邪显正"; + public override string Description => Effects.Count > 0 ? string.Join("", Effects.Select(e => e.Description)) : ""; + public override double EPCost => 70; + public override double CD => 26; + public override double HardnessTime { get; set; } = 9; + public override int CanSelectTargetCount => 5; + + public 破邪显正(Character? character = null) : base(SkillType.Skill, character) + { + CastRange = 6; + Effects.Add(new 基于攻击力的伤害_带基础伤害(this, 40, 40, 0.065, 0.03, DamageType.Physical)); + } + } +} diff --git a/OshimaBot.Content/Skills/战技/神圣祈祷.cs b/OshimaBot.Content/Skills/战技/神圣祈祷.cs new file mode 100644 index 0000000..a7d3c25 --- /dev/null +++ b/OshimaBot.Content/Skills/战技/神圣祈祷.cs @@ -0,0 +1,27 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 神圣祈祷 : Skill + { + public override long Id => (long)SkillID.神圣祈祷; + public override string Name => "神圣祈祷"; + public override string Description => Effects.Count > 0 ? string.Join("", Effects.Select(e => e.Description)) : ""; + public override double EPCost => 70; + public override double CD => 60; + public override double HardnessTime { get; set; } = 8; + public override bool CanSelectSelf => true; + public override bool CanSelectTeammate => true; + public override bool CanSelectEnemy => false; + public override int CanSelectTargetCount => 2; + + public 神圣祈祷(Character? character = null) : base(SkillType.Skill, character) + { + CastRange = 5; + Effects.Add(new 施加持续性强驱散(this, durative: true, duration: 12, levelGrowth: 3)); + Effects.Add(new 施加概率增益(this, EffectType.HealOverTime, true, 12, 0, 3, 1, 0, false, 10.0, 0.0, 8.0)); + } + } +} diff --git a/OshimaBot.Content/Skills/战技/精准射击.cs b/OshimaBot.Content/Skills/战技/精准射击.cs new file mode 100644 index 0000000..cc72e84 --- /dev/null +++ b/OshimaBot.Content/Skills/战技/精准射击.cs @@ -0,0 +1,23 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 精准射击 : Skill + { + public override long Id => (long)SkillID.精准射击; + public override string Name => "精准射击"; + public override string Description => Effects.Count > 0 ? string.Join("", Effects.Select(e => e.Description)) : ""; + public override double EPCost => 65; + public override double CD => 24; + public override double HardnessTime { get; set; } = 8; + + public 精准射击(Character? character = null) : base(SkillType.Skill, character) + { + CastRange = 6; + Effects.Add(new 基于攻击力的伤害_带基础伤害(this, 70, 55, 0.095, 0.045, DamageType.Physical)); + Effects.Add(new 打断施法(this)); + } + } +} diff --git a/OshimaBot.Content/Skills/战技/绝影.cs b/OshimaBot.Content/Skills/战技/绝影.cs new file mode 100644 index 0000000..d9bee05 --- /dev/null +++ b/OshimaBot.Content/Skills/战技/绝影.cs @@ -0,0 +1,28 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 绝影 : Skill + { + public override long Id => (long)SkillID.绝影; + public override string Name => "绝影"; + public override string Description => string.Join("", Effects.Select(e => e.Description)); + public override string DispelDescription => Effects.Count > 0 ? Effects.First(e => e is 施加概率负面).DispelDescription : ""; + public override string ExemptionDescription => Effects.Count > 0 ? Effects.First(e => e is 施加概率负面).ExemptionDescription : ""; + public override double EPCost => 60; + public override double CD => 18; + public override double HardnessTime { get; set; } = 7; + public override int CanSelectTargetRange => 1; + public override SkillRangeType SkillRangeType => SkillRangeType.LinePass; + + public 绝影(Character? character = null) : base(SkillType.Skill, character) + { + IsNonDirectional = true; + CastRange = 6; + Effects.Add(new 基于攻击力的伤害_带基础伤害(this, 70, 55, 0.095, 0.045, DamageType.Physical)); + Effects.Add(new 施加概率负面(this, EffectType.Delay, true, 15, 0, 0, 1, 0, 0.3)); + } + } +} diff --git a/OshimaBot.Content/Skills/战技/绞丝棍.cs b/OshimaBot.Content/Skills/战技/绞丝棍.cs new file mode 100644 index 0000000..289450b --- /dev/null +++ b/OshimaBot.Content/Skills/战技/绞丝棍.cs @@ -0,0 +1,24 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 绞丝棍 : Skill + { + public override long Id => (long)SkillID.绞丝棍; + public override string Name => "绞丝棍"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double EPCost => 45; + // 平衡调整(2026-09-22):CD 12 → 20(战技区间 18–45) + public override double CD => 20; + public override double HardnessTime { get; set; } = 7; + + public 绞丝棍(Character? character = null) : base(SkillType.Skill, character) + { + // 调整:L6 基础值 425→385、系数 35%→32%,实测 1.28×普攻 压至 ≤1.20 + Effects.Add(new 基于攻击力的伤害_带基础伤害(this, 70, 63, 0.07, 0.05, DamageType.Physical)); + } + } +} diff --git a/OshimaBot.Content/Skills/战技/胧.cs b/OshimaBot.Content/Skills/战技/胧.cs new file mode 100644 index 0000000..2078896 --- /dev/null +++ b/OshimaBot.Content/Skills/战技/胧.cs @@ -0,0 +1,25 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 胧 : Skill + { + public override long Id => (long)SkillID.胧; + public override string Name => "胧"; + public override string Description => string.Join("", Effects.Select(e => e.Description)); + public override string DispelDescription => Effects.Count > 0 ? Effects.First(e => e is 施加概率负面).DispelDescription : ""; + public override string ExemptionDescription => Effects.Count > 0 ? Effects.First(e => e is 施加概率负面).ExemptionDescription : ""; + public override double EPCost => 60; + public override double CD => 20; + public override double HardnessTime { get; set; } = 9; + + public 胧(Character? character = null) : base(SkillType.Skill, character) + { + CastRange = 4; + Effects.Add(new 基于攻击力的伤害_带基础伤害(this, 60, 45, 0.065, 0.035, DamageType.Physical)); + Effects.Add(new 施加概率负面(this, EffectType.Cripple, false, 0, 1, 0, 0.2, 0.03)); + } + } +} diff --git a/OshimaBot.Content/Skills/战技/落叶.cs b/OshimaBot.Content/Skills/战技/落叶.cs new file mode 100644 index 0000000..fa1c884 --- /dev/null +++ b/OshimaBot.Content/Skills/战技/落叶.cs @@ -0,0 +1,25 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 落叶 : Skill + { + public override long Id => (long)SkillID.落叶; + public override string Name => "落叶"; + public override string Description => Effects.Count > 0 ? string.Join("", Effects.Select(e => e.Description)) : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First(e => e is 施加概率负面).DispelDescription : ""; + public override string ExemptionDescription => Effects.Count > 0 ? Effects.First(e => e is 施加概率负面).ExemptionDescription : ""; + public override double EPCost => 55; + public override double CD => 20; + public override double HardnessTime { get; set; } = 7; + + public 落叶(Character? character = null) : base(SkillType.Skill, character) + { + CastRange = 4; + Effects.Add(new 基于攻击力的伤害_带基础伤害(this, 50, 45, 0.08, 0.04, DamageType.Physical)); + Effects.Add(new 施加概率负面(this, EffectType.Delay, true, 10, 0, 1.5, 0.85, 0.03, 0.3)); + } + } +} diff --git a/OshimaBot.Content/Skills/战技/螺旋之刃.cs b/OshimaBot.Content/Skills/战技/螺旋之刃.cs new file mode 100644 index 0000000..db891d9 --- /dev/null +++ b/OshimaBot.Content/Skills/战技/螺旋之刃.cs @@ -0,0 +1,83 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.PassiveEffects; + +namespace OshimaBot.Content.Skills +{ + public class 螺旋之刃 : Skill + { + public override long Id => (long)SkillID.螺旋之刃; + public override string Name => "螺旋之刃"; + public override string Description => Effects.Count > 0 ? string.Join("", Effects.Select(e => e.Description)) : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First(e => e is 螺旋之刃迟滞特效).DispelDescription : ""; + public override string ExemptionDescription => Effects.Count > 0 ? Effects.First(e => e is 螺旋之刃迟滞特效).ExemptionDescription : ""; + public override double EPCost => 40; + public override double CD => 25; + public override double HardnessTime { get; set; } = 6; + + public 螺旋之刃(Character? character = null) : base(SkillType.Skill, character) + { + CastRange = 4; + 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 => + $"必定使{Skill.TargetDescription()}的普通攻击和技能的硬直时间、当前行动等待时间延长 {基础迟滞 * 100:0.##}%;" + + $"{额外概率 * 100:0.##}% 概率额外再延长 {额外迟滞 * 100:0.##}%(合计最高 {(基础迟滞 + 额外迟滞) * 100:0.##}%)。持续时间:{持续时间:0.##} {GameplayEquilibriumConstant.InGameTime}。"; + public override string DispelDescription => "被驱散性:需弱驱散"; + public override string ExemptionDescription => $"迟滞{SkillSet.GetExemptionDescription(EffectType.Slow)}"; + public override EffectType EffectType => EffectType.Slow; + public override DispelledType DispelledType => DispelledType.Weak; + public override bool IsDebuff => true; + public override bool ExemptDuration => true; + + /// + /// 必定命中的迟滞比例:10% + 2%/级(Lv1 10% → Lv6 20%) + /// + private double 基础迟滞 => Level > 0 ? 0.1 + 0.02 * (Level - 1) : 0.1; + + /// + /// 额外迟滞的触发概率:20% + 5%/级(Lv1 20% → Lv6 45%) + /// + private double 额外概率 => Level > 0 ? 0.2 + 0.05 * (Level - 1) : 0.2; + + /// + /// 额外迟滞的固定比例:20%(Lv6 合计最高 40%) + /// + private double 额外迟滞 => 0.2; + + private double 持续时间 => Level > 0 ? 12 + 2 * (Level - 1) : 12; + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + foreach (Character target in ctx.Targets) + { + if (target.HP <= 0) continue; + + double percent = 基础迟滞; + bool extra = Random.NextDouble() < 额外概率; + if (extra) percent += 额外迟滞; + + 迟滞 e = new(Skill, caster, true, 持续时间, 0, percent); + if (CheckExemption(caster, target, e)) continue; + + WriteLine($"[ {caster} ] 对 [ {target} ] 造成了迟滞!普通攻击和技能的硬直时间、当前行动等待时间延长了 {percent * 100:0.##}%!" + + (extra ? $"(额外触发 {额外迟滞 * 100:0.##}%)" : "") + + $"持续时间:{持续时间:0.##} {GameplayEquilibriumConstant.InGameTime}!"); + + target.Effects.Add(e); + e.OnEffectGained(new HookContext(GamingQueue, target)); + GamingQueue?.AddApplyEffects(target, e.EffectType); + e.ApplyChange(target); + } + } + } +} diff --git a/OshimaBot.Content/Skills/战技/血腥旋转.cs b/OshimaBot.Content/Skills/战技/血腥旋转.cs new file mode 100644 index 0000000..e665e3f --- /dev/null +++ b/OshimaBot.Content/Skills/战技/血腥旋转.cs @@ -0,0 +1,26 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 血腥旋转 : Skill + { + public override long Id => (long)SkillID.血腥旋转; + public override string Name => "血腥旋转"; + public override string Description => Effects.Count > 0 ? string.Join("", Effects.Select(e => e.Description)) : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First(e => e is 施加概率负面).DispelDescription : ""; + public override string ExemptionDescription => Effects.Count > 0 ? Effects.First(e => e is 施加概率负面).ExemptionDescription : ""; + public override double EPCost => 75; + public override double CD => 28; + public override double HardnessTime { get; set; } = 9; + public override int CanSelectTargetCount => 3; + + public 血腥旋转(Character? character = null) : base(SkillType.Skill, character) + { + CastRange = 4; + Effects.Add(new 基于攻击力的伤害_带基础伤害(this, 50, 45, 0.08, 0.04, DamageType.Physical)); + Effects.Add(new 施加概率负面(this, EffectType.Cripple, false, 0, 1, 0, 0.3, 0.03)); + } + } +} diff --git a/OshimaBot.Content/Skills/战技/跳跃点射.cs b/OshimaBot.Content/Skills/战技/跳跃点射.cs new file mode 100644 index 0000000..57141af --- /dev/null +++ b/OshimaBot.Content/Skills/战技/跳跃点射.cs @@ -0,0 +1,66 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.OpenEffects; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 跳跃点射 : Skill + { + public override long Id => (long)SkillID.跳跃点射; + public override string Name => "跳跃点射"; + public override string Description => Effects.Count > 0 ? string.Join("", Effects.Select(e => e.Description)) : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First(e => e is 跳跃点射破甲特效).DispelDescription : ""; + public override string ExemptionDescription => Effects.Count > 0 ? Effects.First(e => e is 跳跃点射破甲特效).ExemptionDescription : ""; + public override double EPCost => 70; + public override double CD => 26; + public override double HardnessTime { get; set; } = 9; + + public 跳跃点射(Character? character = null) : base(SkillType.Skill, character) + { + CastRange = 6; + Effects.Add(new 基于攻击力的伤害_带基础伤害(this, 65, 55, 0.095, 0.045, DamageType.Physical)); + Effects.Add(new 跳跃点射破甲特效(this)); + 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 => $"使{Skill.TargetDescription()}的物理护甲降低 {破甲比例 * 100:0.##}%,持续 2 回合。"; + public override string DispelDescription => "被驱散性:需强驱散"; + public override string ExemptionDescription => $"物理护甲降低{SkillSet.GetExemptionDescription(EffectType.Weaken)}"; + public override EffectType EffectType => EffectType.Weaken; + public override DispelledType DispelledType => DispelledType.Strong; + public override bool IsDebuff => true; + + private double 破甲比例 => Level > 0 ? 0.7 + 0.1 * (Level - 1) : 0.7; + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + foreach (Character target in ctx.Targets) + { + if (target.HP <= 0) continue; + WriteLine($"[ {target} ] 的物理护甲降低了 {破甲比例 * 100:0.##}%!"); + ExDEF2 def = new(Skill, new() { { "exdef", -破甲比例 } }, caster) + { + Name = Name, + Durative = false, + Duration = 0, + DurationTurn = 2, + IsDebuff = true, + EffectType = EffectType.Weaken, + DispelledType = DispelledType.Strong + }; + target.Effects.Add(def); + def.OnEffectGained(new HookContext(GamingQueue, target)); + GamingQueue?.AddApplyEffects(target, EffectType.Weaken); + } + } + } +} diff --git a/OshimaBot.Content/Skills/战技/转换战斗天赋.cs b/OshimaBot.Content/Skills/战技/转换战斗天赋.cs new file mode 100644 index 0000000..12c4fc2 --- /dev/null +++ b/OshimaBot.Content/Skills/战技/转换战斗天赋.cs @@ -0,0 +1,38 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.PrefabricatedEntity; + +namespace OshimaBot.Content.Skills +{ + /// + /// 【转换战斗天赋】战技:战斗内切换到另一已学战斗天赋 + /// 继承核心库预制基类 ,本类只提供编号与表现参数; + /// 技能类型(战技)与决策点 / 配额行为沿用核心库既有逻辑,不做改动 + /// + public class 转换战斗天赋 : SwitchCombatTalentSkill + { + public override long Id => (long)SkillID.转换战斗天赋; + public override string Name => "转换战斗天赋"; + public override string Description => "战斗内切换到另一已学的战斗天赋,取消当前生效的天赋;目标定位未指定时自动切到当前未激活的第一个已学天赋。"; + public override double EPCost => 0; + public override double CD => 3; + public override double HardnessTime { get; set; } = 2; + + /// + /// 创建【转换战斗天赋】战技实例 + /// + /// 所属角色(装配时由挂载流程赋值) + /// 目标定位;null 时由内核自动选择当前未激活的已学天赋 + public 转换战斗天赋(Character? character = null, RoleType? targetRoleType = null) : base(character) + { + TargetRoleType = targetRoleType; + CanSelectSelf = true; + CanSelectEnemy = false; + CanSelectTeammate = false; + CanSelectTargetRange = 0; + IsNonDirectional = true; + SelectIncludeCharacterGrid = false; + AllowSelectNoCharacterGrid = true; + } + } +} diff --git a/OshimaBot.Content/Skills/战技/过载.cs b/OshimaBot.Content/Skills/战技/过载.cs new file mode 100644 index 0000000..431205d --- /dev/null +++ b/OshimaBot.Content/Skills/战技/过载.cs @@ -0,0 +1,64 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; + +namespace OshimaBot.Content.Skills +{ + /// + /// 战技 · 节奏型【过载】—— 用生命换决策点 + /// 设计意图:本项目首次把「续航」换算成「节奏」。决策点的常规来源只有每回合恢复 + /// (`max(1, Max/2)`),本技能给出一条**主动透支**的获取途径:立刻用当前生命换一次行动机会。 + /// 效果:消耗自身当前生命的 {生命消耗比例}(**保底至少剩 1 点生命,不会自杀**),自身 +3 决策点。 + /// 标尺(战技):EP 40–80 → 50|CD 18–45 → 45|硬直 7–10 → 8;无伤害、无控制,不占控制点预算。 + /// 强度依据:+3 决策点按 DP→行动转换率(约 1:5)折算 ≈ +0.6 次行动 —— 代价是 15% 当前生命。 + /// + public class 过载 : Skill + { + public override long Id => (long)SkillID.过载; + public override string Name => "过载"; + public override string Description => string.Join("", Effects.Select(e => e.Description)); + public override double EPCost => 50; + public override double CD => 45; + public override double HardnessTime { get; set; } = 8; + public override bool CanSelectSelf => true; + public override bool CanSelectTeammate => false; + public override bool CanSelectEnemy => false; + public override int CanSelectTargetCount => 1; + + public 过载(Character? character = null) : base(SkillType.Skill, 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 => $"消耗自身当前生命值的 {生命消耗比例 * 100:0.##}%(至少保留 1 点生命),立即获得 {补充量} 点决策点。"; + + private const double 生命消耗比例 = 0.15; + private const int 补充量 = 3; + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + if (GamingQueue is null) return; + // 保底:本次消耗不会把施法者打死(最多扣到剩 1 点) + double cost = Math.Min(caster.HP * 生命消耗比例, Math.Max(0, caster.HP - 1)); + if (cost > 0) caster.HP -= cost; + if (!GamingQueue.CharacterDecisionPoints.TryGetValue(caster, out DecisionPoints? dp) || dp is null) + { + WriteLine($"[ {caster} ] 发动过载,消耗了 {cost:0.##} 点生命,但决策点未就绪。"); + return; + } + int before = dp.CurrentDecisionPoints; + dp.CurrentDecisionPoints = Math.Min(before + 补充量, dp.MaxDecisionPoints); + int actual = dp.CurrentDecisionPoints - before; + string tail = actual < 补充量 ? $"(决策点接近上限,溢出 {补充量 - actual} 点未生效)" : ""; + WriteLine($"[ {caster} ] 发动过载,消耗 {cost:0.##} 点生命换取 {actual} 点决策点({before} → {dp.CurrentDecisionPoints} / {dp.MaxDecisionPoints}){tail}"); + } + } +} diff --git a/OshimaBot.Content/Skills/战技/金刚击.cs b/OshimaBot.Content/Skills/战技/金刚击.cs new file mode 100644 index 0000000..cecd410 --- /dev/null +++ b/OshimaBot.Content/Skills/战技/金刚击.cs @@ -0,0 +1,24 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 金刚击 : Skill + { + public override long Id => (long)SkillID.金刚击; + public override string Name => "金刚击"; + public override string Description => string.Join("", Effects.Select(e => e.Description)); + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override string ExemptionDescription => Effects.Count > 0 ? Effects.First(e => e is 打断施法).ExemptionDescription : ""; + public override double EPCost => 60; + public override double CD => 20; + public override double HardnessTime { get; set; } = 8; + + public 金刚击(Character? character = null) : base(SkillType.Skill, character) + { + Effects.Add(new 基于攻击力的伤害_带基础伤害(this, 65, 65, 0.09, 0.04, DamageType.Physical)); + Effects.Add(new 打断施法(this)); + } + } +} diff --git a/OshimaBot.Content/Skills/战技/镜花水月.cs b/OshimaBot.Content/Skills/战技/镜花水月.cs new file mode 100644 index 0000000..be28c62 --- /dev/null +++ b/OshimaBot.Content/Skills/战技/镜花水月.cs @@ -0,0 +1,25 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 镜花水月 : Skill + { + public override long Id => (long)SkillID.镜花水月; + public override string Name => "镜花水月"; + public override string Description => string.Join("", Effects.Select(e => e.Description)); + public override string DispelDescription => Effects.Count > 0 ? Effects.First(e => e is 施加免疫).DispelDescription : ""; + public override double EPCost => 70; + public override double CD => 40; + public override double HardnessTime { get; set; } = 10; + public override bool CanSelectSelf => true; + public override bool CanSelectEnemy => false; + public override bool CanSelectTeammate => false; + + public 镜花水月(Character? character = null) : base(SkillType.Skill, character) + { + Effects.Add(new 施加免疫(this, ImmuneType.All, false, 0, 2)); + } + } +} diff --git a/OshimaBot.Content/Skills/战技/闪现.cs b/OshimaBot.Content/Skills/战技/闪现.cs new file mode 100644 index 0000000..f4ff126 --- /dev/null +++ b/OshimaBot.Content/Skills/战技/闪现.cs @@ -0,0 +1,55 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; + +namespace OshimaBot.Content.Skills +{ + public class 闪现 : Skill + { + public override long Id => (long)SkillID.闪现; + public override string Name => "闪现"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double EPCost => 25; + public override double CD => 35 - 1.5 * Level; + public override double HardnessTime { get; set; } = 3; + public override bool CanSelectSelf => true; + public override bool CanSelectEnemy => false; + public override bool CanSelectTeammate => false; + public override int CanSelectTargetRange => 0; + public override bool SelectIncludeCharacterGrid => false; + public override bool AllowSelectNoCharacterGrid => true; + + public 闪现(Character? character = null) : base(SkillType.Skill, character) + { + IsNonDirectional = true; + CastRange = 9; + 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 => $"立即将角色传送到范围内的任意一个没有被角色占据的指定地点,并附赠一次战技的决策点配额。"; + public override string DispelDescription => ""; + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + if (GamingQueue?.Map is GameMap map && grids.Count > 0) + { + map.CharacterMove(caster, map.GetCharacterCurrentGrid(caster), grids[0]); + } + if (GamingQueue != null && GamingQueue.CharacterDecisionPoints.TryGetValue(caster, out DecisionPoints? dp) && dp != null) + { + dp.AddTempActionQuota(this, CharacterActionType.CastSkill); + } + } + } +} diff --git a/OshimaBot.Content/Skills/战技/陀螺舞.cs b/OshimaBot.Content/Skills/战技/陀螺舞.cs new file mode 100644 index 0000000..ecf397e --- /dev/null +++ b/OshimaBot.Content/Skills/战技/陀螺舞.cs @@ -0,0 +1,27 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 陀螺舞 : Skill + { + public override long Id => (long)SkillID.陀螺舞; + public override string Name => "陀螺舞"; + public override string Description => Effects.Count > 0 ? string.Join("", Effects.Select(e => e.Description)) : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First(e => e is 施加概率负面).DispelDescription : ""; + public override string ExemptionDescription => Effects.Count > 0 ? Effects.First(e => e is 施加概率负面).ExemptionDescription : ""; + public override double EPCost => 60; + public override double CD => 45; + public override double HardnessTime { get; set; } = 10; + public override bool CanSelectSelf => false; + public override bool CanSelectTeammate => false; + public override int CanSelectTargetCount => 3; + + public 陀螺舞(Character? character = null) : base(SkillType.Skill, character) + { + CastRange = 4; + Effects.Add(new 施加概率负面(this, EffectType.Taunt, false, 0, 2, 0, 1, 0)); + } + } +} diff --git a/OshimaBot.Content/Skills/战技/雷神脚.cs b/OshimaBot.Content/Skills/战技/雷神脚.cs new file mode 100644 index 0000000..06a8e3d --- /dev/null +++ b/OshimaBot.Content/Skills/战技/雷神脚.cs @@ -0,0 +1,23 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 雷神脚 : Skill + { + public override long Id => (long)SkillID.雷神脚; + public override string Name => "雷神脚"; + public override string Description => Effects.Count > 0 ? string.Join("", Effects.Select(e => e.Description)) : ""; + public override double EPCost => 75; + public override double CD => 28; + public override double HardnessTime { get; set; } = 9; + public override int CanSelectTargetCount => 4; + + public 雷神脚(Character? character = null) : base(SkillType.Skill, character) + { + CastRange = 5; + Effects.Add(new 基于攻击力的伤害_带基础伤害(this, 55, 50, 0.085, 0.04, DamageType.Physical)); + } + } +} diff --git a/OshimaBot.Content/Skills/战技/雷索吸缚.cs b/OshimaBot.Content/Skills/战技/雷索吸缚.cs new file mode 100644 index 0000000..a11773f --- /dev/null +++ b/OshimaBot.Content/Skills/战技/雷索吸缚.cs @@ -0,0 +1,25 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 雷索吸缚 : Skill + { + public override long Id => (long)SkillID.雷索吸缚; + public override string Name => "雷索吸缚"; + public override string Description => Effects.Count > 0 ? string.Join("", Effects.Select(e => e.Description)) : ""; + public override string DispelDescription => "被驱散性:愤怒需强驱散,气绝需强驱散"; + public override double EPCost => 55; + public override double CD => 28; + public override double HardnessTime { get; set; } = 9; + + public 雷索吸缚(Character? character = null) : base(SkillType.Skill, character) + { + ExemptionDescription = $"愤怒{SkillSet.GetExemptionDescription(EffectType.Taunt)}\r\n气绝{SkillSet.GetExemptionDescription(EffectType.Bleed)}"; + CastRange = 4; + Effects.Add(new 施加概率负面(this, EffectType.Taunt, false, 0, 2, 0, 1, 0)); + Effects.Add(new 施加概率负面(this, EffectType.Bleed, true, 6, 0, 1.5, 0.3, 0.03, false, 10.0, 0.0, 6.0)); + } + } +} diff --git a/OshimaBot.Content/Skills/战技/霸王疾风.cs b/OshimaBot.Content/Skills/战技/霸王疾风.cs new file mode 100644 index 0000000..90aec07 --- /dev/null +++ b/OshimaBot.Content/Skills/战技/霸王疾风.cs @@ -0,0 +1,23 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 霸王疾风 : Skill + { + public override long Id => (long)SkillID.霸王疾风; + public override string Name => "霸王疾风"; + public override string Description => Effects.Count > 0 ? string.Join("", Effects.Select(e => e.Description)) : ""; + public override double EPCost => 60; + public override double CD => 22; + public override double HardnessTime { get; set; } = 8; + + public 霸王疾风(Character? character = null) : base(SkillType.Skill, character) + { + CastRange = 4; + // 调整:L6 基础值 435→385(同时解除「基础值顶格 + 系数顶格」的双顶格) + Effects.Add(new 基于攻击力的伤害_带基础伤害(this, 85, 60, 0.12, 0.06, DamageType.Physical)); + } + } +} diff --git a/OshimaBot.Content/Skills/战技/风之鞭.cs b/OshimaBot.Content/Skills/战技/风之鞭.cs new file mode 100644 index 0000000..c58f0e2 --- /dev/null +++ b/OshimaBot.Content/Skills/战技/风之鞭.cs @@ -0,0 +1,24 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 风之鞭 : Skill + { + public override long Id => (long)SkillID.风之鞭; + public override string Name => "风之鞭"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double EPCost => 80; + public override double CD => 25; + public override double HardnessTime { get; set; } = 8; + public override int CanSelectTargetCount => 5; + + public 风之鞭(Character? character = null) : base(SkillType.Skill, character) + { + CastRange = 6; + Effects.Add(new 基于攻击力的伤害_带基础伤害(this, 45, 50, 0.09, 0.03, DamageType.Physical)); + } + } +} diff --git a/OshimaBot.Content/Skills/战技/风花阵.cs b/OshimaBot.Content/Skills/战技/风花阵.cs new file mode 100644 index 0000000..d7a45d4 --- /dev/null +++ b/OshimaBot.Content/Skills/战技/风花阵.cs @@ -0,0 +1,71 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Skills +{ + public class 风花阵 : Skill + { + public override long Id => (long)SkillID.风花阵; + public override string Name => "风花阵"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double EPCost => 55; + public override double CD => 45; + public override double HardnessTime { get; set; } = 7; + public override bool CanSelectSelf => true; + public override bool CanSelectEnemy => false; + public override bool CanSelectTeammate => false; + + public 风花阵(Character? character = null) : base(SkillType.Skill, 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 => $"进入风花阵:提升自身 {攻击提升 * 100:0.##}% 攻击力,但物理护甲降低 {护甲降低 * 100:0.##}%,持续 {持续回合} 回合。"; + public override string DispelDescription => "被驱散性:可弱驱散"; + public override EffectType EffectType => EffectType.DamageBoost; + public override DispelledType DispelledType => DispelledType.Weak; + + private double 攻击提升 => Level > 0 ? 0.45 + 0.08 * (Level - 1) : 0.45; + private double 护甲降低 => Level > 0 ? 0.3 + 0.05 * (Level - 1) : 0.3; + private int 持续回合 => 3; + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + WriteLine($"[ {caster} ] 摆出了风花阵,攻击力提升但物理护甲降低了!"); + ExATK2 atk = new(Skill, new() { { "exatk", 攻击提升 } }, caster) + { + Name = Name, + Durative = false, + Duration = 0, + DurationTurn = 持续回合, + EffectType = EffectType.DamageBoost, + DispelledType = DispelledType.Weak + }; + caster.Effects.Add(atk); + atk.OnEffectGained(new HookContext(GamingQueue, caster)); + GamingQueue?.AddApplyEffects(caster, EffectType.DamageBoost); + ExDEF2 def = new(Skill, new() { { "exdef", -护甲降低 } }, caster) + { + Name = Name, + Durative = false, + Duration = 0, + DurationTurn = 持续回合, + IsDebuff = true, + EffectType = EffectType.Weaken, + DispelledType = DispelledType.Weak + }; + caster.Effects.Add(def); + def.OnEffectGained(new HookContext(GamingQueue, caster)); + GamingQueue?.AddApplyEffects(caster, EffectType.Weaken); + } + } +} diff --git a/OshimaBot.Content/Skills/战技/魔眼.cs b/OshimaBot.Content/Skills/战技/魔眼.cs new file mode 100644 index 0000000..c3e28d9 --- /dev/null +++ b/OshimaBot.Content/Skills/战技/魔眼.cs @@ -0,0 +1,25 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 魔眼 : Skill + { + public override long Id => (long)SkillID.魔眼; + public override string Name => "魔眼"; + public override string Description => string.Join("", Effects.Select(e => e.Description)); + public override string DispelDescription => "被驱散性:迟滞可弱驱散,混乱需强驱散"; + public override double EPCost => 65; + public override double CD => 24; + public override double HardnessTime { get; set; } = 8; + + public 魔眼(Character? character = null) : base(SkillType.Skill, character) + { + ExemptionDescription = $"迟滞{SkillSet.GetExemptionDescription(EffectType.Delay)}\r\n混乱{SkillSet.GetExemptionDescription(EffectType.Confusion)}"; + CastRange = 4; + Effects.Add(new 施加概率负面(this, EffectType.Delay, false, 0, 3, 0, 1, 0, 0.5)); + Effects.Add(new 施加概率负面(this, EffectType.Confusion, false, 0, 2, 0, 0.2, 0.03)); + } + } +} diff --git a/OshimaBot.Content/Skills/战技/鲨鱼锚击.cs b/OshimaBot.Content/Skills/战技/鲨鱼锚击.cs new file mode 100644 index 0000000..4f87141 --- /dev/null +++ b/OshimaBot.Content/Skills/战技/鲨鱼锚击.cs @@ -0,0 +1,25 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 鲨鱼锚击 : Skill + { + public override long Id => (long)SkillID.鲨鱼锚击; + public override string Name => "鲨鱼锚击"; + public override string Description => string.Join("", Effects.Select(e => e.Description)); + public override string DispelDescription => Effects.Count > 0 ? Effects.First(e => e is 施加概率负面).DispelDescription : ""; + public override string ExemptionDescription => Effects.Count > 0 ? Effects.First(e => e is 施加概率负面).ExemptionDescription : ""; + public override double EPCost => 55; + public override double CD => 20; + public override double HardnessTime { get; set; } = 8; + + public 鲨鱼锚击(Character? character = null) : base(SkillType.Skill, character) + { + CastRange = 4; + Effects.Add(new 基于攻击力的伤害_带基础伤害(this, 50, 40, 0.055, 0.04, DamageType.Physical)); + Effects.Add(new 施加概率负面(this, EffectType.Disarm, false, 0, 1, 0, 1, 0)); + } + } +} diff --git a/OshimaBot.Content/Skills/战技/龙神功.cs b/OshimaBot.Content/Skills/战技/龙神功.cs new file mode 100644 index 0000000..54517b9 --- /dev/null +++ b/OshimaBot.Content/Skills/战技/龙神功.cs @@ -0,0 +1,83 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Skills +{ + public class 龙神功 : Skill + { + public override long Id => (long)SkillID.龙神功; + public override string Name => "龙神功"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double EPCost => 50; + public override double CD => 40; + public override double HardnessTime { get; set; } = 8; + public override bool CanSelectSelf => true; + public override bool CanSelectEnemy => false; + public override bool CanSelectTeammate => false; + + public 龙神功(Character? character = null) : base(SkillType.Skill, 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 => $"提升自身 {攻击提升 * 100:0.##}% 攻击力、{护甲提升 * 100:0.##}% 物理护甲和{魔抗提升 * 100:0.##}% 魔法抗性,持续 {持续回合} 回合。"; + public override string DispelDescription => "被驱散性:可弱驱散"; + public override EffectType EffectType => EffectType.DamageBoost; + public override DispelledType DispelledType => DispelledType.Weak; + + private double 攻击提升 => Level > 0 ? 0.25 + 0.05 * (Level - 1) : 0.25; + private double 护甲提升 => Level > 0 ? 0.25 + 0.05 * (Level - 1) : 0.25; + private double 魔抗提升 => Level > 0 ? 0.25 + 0.05 * (Level - 1) : 0.25; + private int 持续回合 => 3; + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + WriteLine($"[ {caster} ] 运转龙神功,攻击力、物理护甲和魔法抗性大幅提升了!"); + ExATK2 atk = new(Skill, new() { { "exatk", 攻击提升 } }, caster) + { + Name = Name, + Durative = false, + Duration = 0, + DurationTurn = 持续回合, + EffectType = EffectType.DamageBoost, + DispelledType = DispelledType.Weak + }; + caster.Effects.Add(atk); + atk.OnEffectGained(new HookContext(GamingQueue, caster)); + GamingQueue?.AddApplyEffects(caster, EffectType.DamageBoost); + ExDEF2 def = new(Skill, new() { { "exdef", 护甲提升 } }, caster) + { + Name = Name, + Durative = false, + Duration = 0, + DurationTurn = 持续回合, + EffectType = EffectType.DefenseBoost, + DispelledType = DispelledType.Weak + }; + caster.Effects.Add(def); + def.OnEffectGained(new HookContext(GamingQueue, caster)); + GamingQueue?.AddApplyEffects(caster, EffectType.DefenseBoost); + ExMDF mdf = new(Skill, new() { { "mdftype", 0 }, { "mdfvalue", 魔抗提升 } }, caster) + { + Name = Name, + Durative = false, + Duration = 0, + DurationTurn = 持续回合, + EffectType = EffectType.DefenseBoost, + DispelledType = DispelledType.Weak + }; + caster.Effects.Add(mdf); + mdf.OnEffectGained(new HookContext(GamingQueue, caster)); + GamingQueue?.AddApplyEffects(caster, EffectType.DefenseBoost); + } + } +} diff --git a/OshimaBot.Content/Skills/爆发技/催战鼓.cs b/OshimaBot.Content/Skills/爆发技/催战鼓.cs new file mode 100644 index 0000000..e8d5c1d --- /dev/null +++ b/OshimaBot.Content/Skills/爆发技/催战鼓.cs @@ -0,0 +1,69 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; +using FunGame.Core.Model.PrefabricatedEntity; + +namespace OshimaBot.Content.Skills +{ + /// + /// 爆发技 · 节奏型【催战鼓】—— 全队额外行动机会 + /// 设计意图:`疾走`/`闪现` 给的配额只是**对战技自身消耗的返还**(用一次战技换回一次战技机会, + /// 净收益近乎 0);`咒怨洪流` 才是真给配额,但**要求决策点足够**才有用。 + /// 本技能补上那个缺口:**同时给「配额」和「决策点」**,所以配额一定能兑现成行动。 + /// 效果:全队各 +N 决策点 + 各获得一次额外**战技**配额 + /// 标尺:爆发技 EP 100(满能量 `CostAllEP`)/ CD ≥60 → 取 75(团队级节奏技,留冷却)/ + /// 硬直 8–13 → 取 10;纯辅助无伤害,不占控制点预算。 + /// ⚠ 补充决策点**必须封顶到 `MaxDecisionPoints`**,否则超出部分会在下一回合恢复时被截掉。 + /// + public class 催战鼓 : SoulboundSkill + { + public override long Id => (long)SuperSkillID.催战鼓; + public override string Name => "催战鼓"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double CD => 75; + public override double HardnessTime { get; set; } = 10; + public override bool CanSelectEnemy => false; + public override bool CanSelectTeammate => true; + public override bool CanSelectSelf => true; + public override bool SelectAllTeammates => true; + + public 催战鼓(Character? character = null) : base(character) + { + Effects.Add(new 催战鼓特效(this)); + } + } + + public class 催战鼓特效(SoulboundSkill skill) : SoulboundEffect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => + $"为全队补充 {决策点补充} 点决策点,并让全队各获得一次额外的战技决策点配额" + + (Improvement > 0 ? $"(灵魂绑定额外效果:决策点补充提升 {Improvement * 100:0.##}%)" : "") + "。"; + + /// 决策点补充(Lv1–2 = 1 / Lv3–5 = 2 / Lv6 = 3) + private int 决策点补充 => 1 + Skill.Level / 3; + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + if (GamingQueue is null) return; + double scale = Improvement > 0 ? 1 + Improvement : 1; + int amount = Math.Max(1, (int)Math.Round(决策点补充 * scale)); + foreach (Character target in ctx.Targets) + { + if (target.HP <= 0) continue; + if (!GamingQueue.CharacterDecisionPoints.TryGetValue(target, out DecisionPoints? dp) || dp is null) continue; + int before = dp.CurrentDecisionPoints; + // ① 补决策点:否则"给了配额也没决策点去做"(本技能区别于疾走/闪现的关键) + dp.CurrentDecisionPoints = Math.Min(before + amount, dp.MaxDecisionPoints); + // ② 真给配额:全队各一次额外战技 + dp.AddTempActionQuota(this, CharacterActionType.CastSkill, 1); + WriteLine($"[ {caster} ] 发动了催战鼓![ {target} ] 获得 {amount} 点决策点({before} → {dp.CurrentDecisionPoints} / {dp.MaxDecisionPoints})与一次额外战技配额!"); + } + } + } +} diff --git a/OshimaBot.Content/Skills/爆发技/光明之环.cs b/OshimaBot.Content/Skills/爆发技/光明之环.cs new file mode 100644 index 0000000..4e363e4 --- /dev/null +++ b/OshimaBot.Content/Skills/爆发技/光明之环.cs @@ -0,0 +1,87 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.PrefabricatedEntity; +using OshimaBot.Content.Effects.OpenEffects; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 光明之环 : SoulboundSkill + { + public override long Id => (long)SuperSkillID.光明之环; + public override string Name => "光明之环"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double CD => 100; + public override double HardnessTime { get; set; } = 0; + public override bool CanSelectEnemy => false; + public override bool CanSelectTeammate => true; + public override bool CanSelectSelf => true; + public override bool SelectAllTeammates => true; + public override bool AllowSelectDead => true; + + public 光明之环(Character? character = null) : base(character) + { + Effects.Add(new 光明之环特效(this)); + } + } + + public class 光明之环特效(SoulboundSkill skill) : SoulboundEffect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"对{Skill.TargetDescription()}施加强驱散,并基于{(Skill.Character != null ? CharacterSet.GetPrimaryAttributeName(Skill.Character.PrimaryAttribute) : "核心属性")}的 {PACoefficient * 100:0.##}% 治疗或复苏{Skill.TargetDescription()},回复 {Heal:0.##} 点生命值。" + + (Improvement > 0 ? $"灵魂绑定额外效果:增加目标 {Improvement / 2 * 100:0.##}% 物理伤害减免和魔法抗性,持续 2 回合。" : "") + $"复苏:如果目标已死亡,则复活目标。复苏只能至多回复至其最大生命值的 20%。"; + + public double PACoefficient => 1.35 + 0.65 * (Skill.Level - 1); + public double Heal => (Skill.Character?.PrimaryAttributeValue ?? 0) * PACoefficient; + + public override void OnSkillCasted(SkillCastContext ctx) + { + Character? caster = ctx.Trigger; + if (caster is null) + { + return; + } + + List deads = [.. ctx.Targets.Where(c => c.HP == 0)]; + List alives = [.. ctx.Targets.Where(c => c.HP > 0)]; + Effect e = new 强驱散特效(Skill); + e.Activate(caster, alives, ctx.Grids, ctx.Others); + foreach (Character target in alives) + { + HealToTarget(caster, target, Heal); + } + foreach (Character target in deads) + { + HealToTarget(caster, target, Math.Min(Heal, target.MaxHP * 0.2), true, false); + } + if (Improvement > 0) + { + double dr = Improvement / 2; + foreach (Character target in ctx.Targets) + { + e = new DynamicsEffect(Skill, new() + { + ["expdr"] = dr, + ["mdftype"] = 0, + ["mdfvalue"] = dr + }, ctx.Trigger) + { + Durative = false, + Duration = 0, + DurationTurn = 2, + RemainDurationTurn = 2, + IsDebuff = false + }; + target.Effects.Add(e); + e.OnEffectGained(new HookContext(GamingQueue, target)); + RecordCharacterApplyEffects(target, EffectType.DefenseBoost); + WriteLine($"[ {target} ] 提升了 {dr * 100:0.##}% 物理伤害减免和魔法抗性!"); + } + } + } + } +} \ No newline at end of file diff --git a/OshimaBot.Content/Skills/爆发技/八叶灭杀.cs b/OshimaBot.Content/Skills/爆发技/八叶灭杀.cs new file mode 100644 index 0000000..65c9f97 --- /dev/null +++ b/OshimaBot.Content/Skills/爆发技/八叶灭杀.cs @@ -0,0 +1,60 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; +using FunGame.Core.Model.PrefabricatedEntity; + +namespace OshimaBot.Content.Skills +{ + public class 八叶灭杀 : SoulboundSkill + { + public override long Id => (long)SuperSkillID.八叶灭杀; + public override string Name => "八叶灭杀"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double CD => 60; + public override double HardnessTime { get; set; } = 9; + + public 八叶灭杀(Character? character = null) : base(character) + { + Effects.Add(new 八叶灭杀特效(this)); + } + } + + public class 八叶灭杀特效(SoulboundSkill skill) : SoulboundEffect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"基于{Skill.SkillOwner()}的 {ATKCoefficient * 100:0.##}% 攻击力 [ {Damage:0.##} ] 对{Skill.TargetDescription()}造成{CharacterSet.GetDamageTypeName(DamageType.Physical)}" + + (Improvement > 0 ? $",灵魂绑定伤害加成: {Improvement * 100:0.##}% [ {ImprovementDamage:0.##} ] 点,总伤害 {Damage + ImprovementDamage:0.##} 点;" : ";") + + $"造成伤害后,基于目标已损失生命值的 {LostHPCoefficient * 100:0.##}% 再次造成{CharacterSet.GetDamageTypeName(DamageType.True)}额外伤害。"; + + // 平衡调整(2026-09-22):L6 总量由「100% 攻击力 + 12% 已损失生命真伤」降至「85% 攻击力 + 8% 已损失生命真伤」, + // 对齐爆发技上限「≤0.90–1.50×攻击力」(≈1.11×普攻)。实测原 1.13×普攻(超上限 2%)。 + public double ATKCoefficient => 0.5 + 0.07 * (Skill.Level - 1); + public double Damage => (Skill.Character?.ATK ?? 0) * ATKCoefficient; + public double ImprovementDamage => Improvement > 0 ? Damage * Improvement : 0; + // 重标:已损失生命值真伤系数 45% → 12%(L6)→ 本次再降至 8% + public double LostHPCoefficient => 0.03 + 0.01 * (Skill.Level - 1); + public double ExtraTrueDamage(Character target) => Math.Max(0, target.MaxHP - target.HP) * LostHPCoefficient * (Improvement > 0 ? 1 + Improvement : 1); + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + foreach (Character target in targets) + { + DamageCalculationOptions options = new(caster); + DamageToEnemy(caster, target, DamageType.Physical, MagicType.None, Damage + ImprovementDamage, options); + if (target.HP <= 0) continue; + double extra = ExtraTrueDamage(target); + if (extra > 0) + { + WriteLine($"[ {caster} ] 发动了八叶灭杀!基于 [ {target} ] 已损失的生命值再次造成 {extra:0.##} 点{CharacterSet.GetDamageTypeName(DamageType.True)}额外伤害!"); + DamageToEnemy(caster, target, DamageType.True, MagicType.None, extra, new(caster) { TriggerEffects = false }); + } + } + } + } +} diff --git a/OshimaBot.Content/Skills/爆发技/卫星激光.cs b/OshimaBot.Content/Skills/爆发技/卫星激光.cs new file mode 100644 index 0000000..963b1e7 --- /dev/null +++ b/OshimaBot.Content/Skills/爆发技/卫星激光.cs @@ -0,0 +1,162 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; +using FunGame.Core.Model.PrefabricatedEntity; + +namespace OshimaBot.Content.Skills +{ + public class 卫星激光 : SoulboundSkill + { + public override long Id => (long)SuperSkillID.卫星激光; + public override string Name => "卫星激光"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double CD => 65; + public override double HardnessTime { get; set; } = 10; + public override int CanSelectTargetCount + { + get + { + return Level switch + { + 1 or 2 => 1, + 3 or 4 => 2, + _ => 3 + }; + } + } + + public 卫星激光(Character? character = null) : base(character) + { + Effects.Add(new 卫星激光特效(this)); + } + } + + public class 卫星激光特效(SoulboundSkill skill) : SoulboundEffect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"基于{Skill.SkillOwner()}的 {ATKCoefficient * 100:0.##}% 攻击力 [ {Damage:0.##} ] 对{Skill.TargetDescription()}造成{CharacterSet.GetDamageTypeName(DamageType.Magical)}" + + (Improvement > 0 ? $",灵魂绑定伤害加成: {Improvement * 100:0.##}% [ {ImprovementDamage:0.##} ] 点,总伤害 {Damage + ImprovementDamage:0.##} 点;" : ";") + + $"造成伤害后,目标每{GameplayEquilibriumConstant.InGameTime}受到 {持续伤害:0.##} 点{CharacterSet.GetDamageTypeName(DamageType.True)},持续 {持续时间:0.##} {GameplayEquilibriumConstant.InGameTime}。"; + + public double ATKCoefficient => 0.5 + 0.12 * (Skill.Level - 1); + public double Damage => (Skill.Character?.ATK ?? 0) * ATKCoefficient; + public double ImprovementDamage => Improvement > 0 ? Damage * Improvement : 0; + public double 持续伤害 => 20 + 8 * (Skill.Level - 1); + public double 持续时间 => 8 + 2 * (Skill.Level - 1); + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + foreach (Character target in targets) + { + DamageCalculationOptions options = new(caster); + if (DamageToEnemy(caster, target, DamageType.Magical, MagicType.None, Damage + ImprovementDamage, options).ActualDamage > 0) + { + Effect e = new 施加卫星灼烧(Skill, 持续时间, 持续伤害); + if (!CheckExemption(caster, target, e)) + { + e.Activate(caster, [target], grids, others); + } + } + } + } + } + + public class 施加卫星灼烧 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"对{Skill.TargetDescription()}施加灼烧:每{GameplayEquilibriumConstant.InGameTime}受到 {伤害:0.##} 点{CharacterSet.GetDamageTypeName(DamageType.True)},持续 {持续时间:0.##} {GameplayEquilibriumConstant.InGameTime}。"; + public override EffectType EffectType => EffectType.Burn; + public override DispelledType DispelledType => DispelledType.Weak; + public override bool ExemptDuration => true; + + private readonly double _duration; + private readonly double 伤害; + private double 持续时间 => _duration; + + public 施加卫星灼烧(Skill skill, double duration, double damage) : base(skill) + { + GamingQueue = skill.GamingQueue; + _duration = duration; + 伤害 = damage; + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + foreach (Character target in targets) + { + if (target.HP <= 0) continue; + 卫星灼烧 e = new(Skill, target, caster, _duration, 伤害); + if (!CheckExemption(caster, target, e)) + { + WriteLine($"[ {caster} ] 对 [ {target} ] 施加了卫星灼烧!每{GameplayEquilibriumConstant.InGameTime}受到 {伤害:0.##} 点{CharacterSet.GetDamageTypeName(DamageType.True)},持续 {_duration:0.##} {GameplayEquilibriumConstant.InGameTime}!"); + e.AddToCharacter(target); + GamingQueue?.AddApplyEffects(target, e.EffectType); + } + } + } + } + + public class 卫星灼烧 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name + "·灼烧"; + public override string Description => $"此角色正受到卫星灼烧,每{GameplayEquilibriumConstant.InGameTime}受到 {伤害:0.##} 点{CharacterSet.GetDamageTypeName(DamageType.True)}。来自:[ {Source} ] 的 [ {Skill.Name} ]"; + public override EffectType EffectType => EffectType.Burn; + public override DispelledType DispelledType => DispelledType.Weak; + public override bool IsDebuff => true; + public override bool ExemptDuration => true; + public override Character Source => _sourceCharacter; + public override bool Durative => true; + public override double Duration => _duration; + + private readonly Character _targetCharacter; + private readonly Character _sourceCharacter; + private readonly double _duration; + private readonly double 伤害; + + public 卫星灼烧(Skill skill, Character targetCharacter, Character sourceCharacter, double duration, double damage) : base(skill) + { + GamingQueue = skill.GamingQueue; + _targetCharacter = targetCharacter; + _sourceCharacter = sourceCharacter; + _duration = duration; + 伤害 = damage; + } + + public override void OnTimeElapsed(TimeLapseContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (character == _targetCharacter && character.HP > 0) + { + DamageToEnemy(Source, character, DamageType.True, MagicType.None, 伤害 * ctx.Elapsed, null); + } + } + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (RemainDuration == 0) + { + RemainDuration = Duration; + } + AddEffectTypeToCharacter(character, [EffectType.Burn]); + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + RemoveEffectTypesFromCharacter(character); + } + } +} diff --git a/OshimaBot.Content/Skills/爆发技/圣星光旋.cs b/OshimaBot.Content/Skills/爆发技/圣星光旋.cs new file mode 100644 index 0000000..9cf6f0b --- /dev/null +++ b/OshimaBot.Content/Skills/爆发技/圣星光旋.cs @@ -0,0 +1,66 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; +using FunGame.Core.Model.PrefabricatedEntity; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 圣星光旋 : SoulboundSkill + { + public override long Id => (long)SuperSkillID.圣星光旋; + public override string Name => "圣星光旋"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double CD => 100; + // 调整:硬直 16 → 13(爆发技区间 8–13) + public override double HardnessTime { get; set; } = 13; + public override bool SelectAllEnemies => true; + + public 圣星光旋(Character? character = null) : base(character) + { + Effects.Add(new 圣星光旋特效(this)); + } + } + + public class 圣星光旋特效(SoulboundSkill skill) : SoulboundEffect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"对{Skill.TargetDescription()}造成 {PACoefficient * 100:0.##}% " + + $"{(Skill.Character != null ? CharacterSet.GetPrimaryAttributeName(Skill.Character.PrimaryAttribute) : "核心属性")} [ {PADamage:0.##} ] + {GeneralDamage:0.##} 点{CharacterSet.GetDamageTypeName(DamageType.True)}。" + + (Improvement > 0 ? $"灵魂绑定伤害加成: {Improvement * 100:0.##}% [ {ImprovementDamage:0.##} ] 点," : "") + $"总伤害 {Damage + ImprovementDamage:0.##} 点。" + + $"随后,有 25% 概率对受到伤害的目标造成眩晕 1 回合。眩晕:进入完全行动不能状态。"; + + // 加强:实测仅 0.62×普攻,低于爆发技下限 0.67 —— L6 核心属性 45%→50%、真伤 180→210 + public double PACoefficient => 0.25 + 0.05 * (Skill.Level - 1); + public double PADamage => (Skill.Character?.PrimaryAttributeValue ?? 0) * PACoefficient; + public double GeneralDamage => 35 * Skill.Level; + public double Damage => GeneralDamage + PADamage; + public double ImprovementDamage => Improvement > 0 ? Damage * Improvement : 0; + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + List valid = []; + foreach (Character target in targets) + { + DamageCalculationOptions options = new(caster); + if (DamageToEnemy(caster, target, DamageType.True, MagicType.None, Damage + ImprovementDamage, options).ActualDamage > 0) + { + if (Random.NextDouble() < 0.25) + { + valid.Add(target); + } + } + } + Effect e = new 造成眩晕(Skill); + e.Activate(caster, valid, grids, others); + } + } +} diff --git a/OshimaBot.Content/Skills/爆发技/圣洁祝福.cs b/OshimaBot.Content/Skills/爆发技/圣洁祝福.cs new file mode 100644 index 0000000..6c86fd6 --- /dev/null +++ b/OshimaBot.Content/Skills/爆发技/圣洁祝福.cs @@ -0,0 +1,65 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; +using FunGame.Core.Model.PrefabricatedEntity; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 圣洁祝福 : SoulboundSkill + { + public override long Id => (long)SuperSkillID.圣洁祝福; + public override string Name => "圣洁祝福"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + // 调整:CD 55 → 60(爆发技下限 60) + public override double CD => 60; + // 调整:硬直 4 → 8(爆发技区间 8–13) + public override double HardnessTime { get; set; } = 8; + public override bool CanSelectEnemy => false; + public override bool CanSelectTeammate => true; + public override bool CanSelectSelf => false; + + public 圣洁祝福(Character? character = null) : base(character) + { + Effects.Add(new 圣洁祝福特效(this)); + } + } + + public class 圣洁祝福特效(SoulboundSkill skill) : SoulboundEffect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"对{Skill.TargetDescription()}施加强驱散,并基于{(Skill.Character != null ? CharacterSet.GetPrimaryAttributeName(Skill.Character.PrimaryAttribute) : "核心属性")}的 {PACoefficient * 100:0.##}% 治疗目标,回复 {Heal:0.##} 点生命值,并回复 {EnergyRecovery:0.##} 点能量值。" + + (Improvement > 0 ? $"灵魂绑定额外效果:治疗和能量回复提升 {Improvement * 100:0.##}%。" : ""); + + public double PACoefficient => 0.9 + 0.45 * (Skill.Level - 1); + public double Heal => (Skill.Character?.PrimaryAttributeValue ?? 0) * PACoefficient; + public double EnergyRecovery => 15 + 10 * (Skill.Level - 1); + public double ActualHeal => Heal * (Improvement > 0 ? 1 + Improvement : 1); + public double ActualEnergyRecovery => EnergyRecovery * (Improvement > 0 ? 1 + Improvement : 1); + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + foreach (Character target in targets) + { + if (target.HP <= 0) continue; + Effect 驱散 = new 强驱散特效(Skill); + 驱散.Activate(caster, [target], grids, others); + HealToTarget(caster, target, ActualHeal); + double recovery = ActualEnergyRecovery; + if (recovery > 0) + { + target.EP += recovery; + WriteLine($"[ {caster} ] 为 [ {target} ] 施加了圣洁祝福!回复了 {ActualHeal:0.##} 点生命值和 {recovery:0.##} 点能量值!"); + } + } + } + } +} diff --git a/OshimaBot.Content/Skills/爆发技/天堂阻灭.cs b/OshimaBot.Content/Skills/爆发技/天堂阻灭.cs new file mode 100644 index 0000000..27949b9 --- /dev/null +++ b/OshimaBot.Content/Skills/爆发技/天堂阻灭.cs @@ -0,0 +1,53 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; +using FunGame.Core.Model.PrefabricatedEntity; + +namespace OshimaBot.Content.Skills +{ + public class 天堂阻灭 : SoulboundSkill + { + public override long Id => (long)SuperSkillID.天堂阻灭; + public override string Name => "天堂阻灭"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double CD => 120; + public override double HardnessTime { get; set; } = 16; + + public 天堂阻灭(Character? character = null) : base(character) + { + Effects.Add(new 天堂阻灭特效(this)); + } + } + + public class 天堂阻灭特效(SoulboundSkill skill) : SoulboundEffect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"对{Skill.TargetDescription()}造成 " + + $"{(Skill.Character != null ? CharacterSet.GetPrimaryAttributeName(Skill.Character.PrimaryAttribute) : "核心属性")} {PACoefficient * 100:0.##}% [ {PADamage:0.##} ] + {GeneralDamage:0.##} 点{CharacterSet.GetDamageTypeName(DamageType.True)}。" + + (Improvement > 0 ? $"灵魂绑定伤害加成: {Improvement * 100:0.##}% [ {ImprovementDamage:0.##} ] 点," : "") + $"总伤害 {Damage + ImprovementDamage:0.##} 点。天堂阻灭无视护甲与魔抗,造成巨额伤害。"; + + // 平衡调整(2026-09-22):L6 总量由「200% 核心属性 + 600 真伤」降至「150% 核心属性 + 270 真伤」, + // 对齐爆发技上限「≤0.90–1.50×攻击力」(≈1.11×普攻)。实测原 1.21×普攻(超上限 9%)。 + // 注:该技能为真伤(无视护甲/魔抗),不享受其它技能所受的减伤,故留出余量而非贴线。 + public double PACoefficient => 0.75 + 0.15 * (Skill.Level - 1); + public double PADamage => (Skill.Character?.PrimaryAttributeValue ?? 0) * PACoefficient; + public double GeneralDamage => 45 * Skill.Level; + public double Damage => GeneralDamage + PADamage; + public double ImprovementDamage => Improvement > 0 ? Damage * Improvement : 0; + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + foreach (Character target in targets) + { + DamageCalculationOptions options = new(caster); + DamageToEnemy(caster, target, DamageType.True, MagicType.None, Damage + ImprovementDamage, options); + } + } + } +} diff --git a/OshimaBot.Content/Skills/爆发技/女王之怒.cs b/OshimaBot.Content/Skills/爆发技/女王之怒.cs new file mode 100644 index 0000000..aaf7169 --- /dev/null +++ b/OshimaBot.Content/Skills/爆发技/女王之怒.cs @@ -0,0 +1,147 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; +using FunGame.Core.Model.PrefabricatedEntity; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 女王之怒 : SoulboundSkill + { + public override long Id => (long)SuperSkillID.女王之怒; + public override string Name => "女王之怒"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double CD => 70; + public override double HardnessTime { get; set; } = 11; + + public 女王之怒(Character? character = null) : base(character) + { + Effects.Add(new 女王之怒特效(this)); + } + } + + public class 女王之怒特效(SoulboundSkill skill) : SoulboundEffect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"基于{Skill.SkillOwner()}的 {ATKCoefficient * 100:0.##}% 攻击力 [ {Damage:0.##} ] 对{Skill.TargetDescription()}造成{CharacterSet.GetDamageTypeName(DamageType.Physical)}" + + (Improvement > 0 ? $",灵魂绑定伤害加成: {Improvement * 100:0.##}% [ {ImprovementDamage:0.##} ] 点,总伤害 {Damage + ImprovementDamage:0.##} 点;" : ";") + + $"造成伤害后,对目标施加 {虚弱时间}虚弱。虚弱:伤害降低 {DamageReductionPercent * 100:0.##}%,物理护甲降低 {DEFReductionPercent * 100:0.##}%," + + $"魔法抗性降低 {MDFReductionPercent * 100:0.##}%,治疗效果降低 {HealingReductionPercent * 100:0.##}%"; + + public double ATKCoefficient => 0.4 + 0.22 * (Skill.Level - 1); + public double Damage => (Skill.Character?.ATK ?? 0) * ATKCoefficient; + public double ImprovementDamage => Improvement > 0 ? Damage * Improvement : 0; + public override bool Durative => false; + public override int DurationTurn + { + get + { + return Skill.Level switch + { + 4 or 5 or 6 => 3, + _ => 2 + }; + } + } + public double DurationLevelGrowth + { + get + { + return Skill.Level switch + { + _ => 0 + }; + } + } + public double DamageReductionPercent + { + get + { + return Skill.Level switch + { + 1 => 0.10, + 2 => 0.14, + 3 => 0.18, + 4 => 0.22, + 5 => 0.26, + 6 => 0.3, + _ => 0 + }; + } + } + public double DEFReductionPercent + { + get + { + return Skill.Level switch + { + 1 => 0.3, + 2 => 0.35, + 3 => 0.4, + 4 => 0.45, + 5 => 0.50, + 6 => 0.55, + _ => 0 + }; + } + } + public double MDFReductionPercent + { + get + { + return Skill.Level switch + { + 1 => 0.08, + 2 => 0.11, + 3 => 0.14, + 4 => 0.17, + 5 => 0.20, + 6 => 0.23, + _ => 0 + }; + } + } + public double HealingReductionPercent + { + get + { + return Skill.Level switch + { + 1 => 0.12, + 2 => 0.16, + 3 => 0.20, + 4 => 0.24, + 5 => 0.28, + 6 => 0.32, + _ => 0 + }; + } + } + + private string 虚弱时间 => Durative && Duration > 0 ? $"{实际虚弱时间:0.##} {GameplayEquilibriumConstant.InGameTime}" : (!Durative && DurationTurn > 0 ? 实际虚弱时间 + " 回合" : $"0 {GameplayEquilibriumConstant.InGameTime}"); + private double 实际虚弱时间 => Durative && Duration > 0 ? Duration + DurationLevelGrowth * (Level - 1) : (!Durative && DurationTurn > 0 ? DurationTurn + DurationLevelGrowth * (Level - 1) : 0); + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + List valid = []; + foreach (Character target in targets) + { + DamageCalculationOptions options = new(caster); + if (DamageToEnemy(caster, target, DamageType.Physical, MagicType.None, Damage + ImprovementDamage, options).ActualDamage > 0) + { + valid.Add(target); + } + } + 造成虚弱 e = new(Skill, Durative, Duration, DurationTurn, DurationLevelGrowth, DamageReductionPercent, DEFReductionPercent, MDFReductionPercent, HealingReductionPercent); + e.Activate(caster, valid, grids, others); + } + } +} diff --git a/OshimaBot.Content/Skills/爆发技/星杯领域.cs b/OshimaBot.Content/Skills/爆发技/星杯领域.cs new file mode 100644 index 0000000..fa67b2c --- /dev/null +++ b/OshimaBot.Content/Skills/爆发技/星杯领域.cs @@ -0,0 +1,56 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.PrefabricatedEntity; +using OshimaBot.Content.Effects.PassiveEffects; + +namespace OshimaBot.Content.Skills +{ + public class 星杯领域 : SoulboundSkill + { + public override long Id => (long)SuperSkillID.星杯领域; + public override string Name => "星杯领域"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double CD => 100; + public override double HardnessTime { get; set; } = 0; + public override bool CanSelectEnemy => false; + public override bool CanSelectTeammate => true; + public override bool CanSelectSelf => true; + public override bool SelectAllTeammates => true; + public override bool AllowSelectDead => false; + + public 星杯领域(Character? character = null) : base(character) + { + Effects.Add(new 星杯领域特效(this)); + } + } + + public class 星杯领域特效(SoulboundSkill skill) : SoulboundEffect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"对{Skill.TargetDescription()}施加完全免疫 {持续回合:0.##} 回合:期间无法被选中为普通攻击和技能的目标(自释放技能除外),并免疫物理伤害和魔法伤害。" + + $"星杯领域起步消耗 100 能量,每额外消耗 100 能量延长 1 回合。"; + + public int 持续回合 => 1; + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + double cost = ctx.EPCost > 0 ? ctx.EPCost : caster.EP; + int extraTurns = Math.Max(0, (int)((cost - 100) / 100)); + int turns = 1 + extraTurns; + foreach (Character target in targets) + { + if (target.HP <= 0) continue; + 完全免疫 e = new(Skill, caster, false, 0, turns); + WriteLine($"[ {caster} ] 发动了星杯领域![ {target} ] 获得了完全免疫,持续 {turns} 回合!"); + e.AddToCharacter(target); + RecordCharacterApplyEffects(target, EffectType.DefenseBoost); + } + } + } +} diff --git a/OshimaBot.Content/Skills/爆发技/樱花无双击.cs b/OshimaBot.Content/Skills/爆发技/樱花无双击.cs new file mode 100644 index 0000000..fd651d3 --- /dev/null +++ b/OshimaBot.Content/Skills/爆发技/樱花无双击.cs @@ -0,0 +1,53 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; +using FunGame.Core.Model.PrefabricatedEntity; + +namespace OshimaBot.Content.Skills +{ + public class 樱花无双击 : SoulboundSkill + { + public override long Id => (long)SuperSkillID.樱花无双击; + public override string Name => "樱花无双击"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double CD => 60; + public override double HardnessTime { get; set; } = 8; + + public 樱花无双击(Character? character = null) : base(character) + { + Effects.Add(new 樱花无双击特效(this)); + } + } + + public class 樱花无双击特效(SoulboundSkill skill) : SoulboundEffect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"基于{Skill.SkillOwner()}的 {ATKCoefficient * 100:0.##}% 攻击力 [ {Damage:0.##} ] 对{Skill.TargetDescription()}造成{CharacterSet.GetDamageTypeName(DamageType.Physical)}" + + (Improvement > 0 ? $",灵魂绑定伤害加成: {Improvement * 100:0.##}% [ {ImprovementDamage:0.##} ] 点,总伤害 {Damage + ImprovementDamage:0.##} 点;" : ";") + + $"造成伤害后,基于伤害值的 {HealCoefficient * 100:0.##}% 回复自身 [ {Heal(Damage):0.##} ] 点生命值。"; + + public double ATKCoefficient => 0.6 + 0.15 * (Skill.Level - 1); + public double Damage => (Skill.Character?.ATK ?? 0) * ATKCoefficient; + public double ImprovementDamage => Improvement > 0 ? Damage * Improvement : 0; + public double HealCoefficient => 0.1 + 0.05 * (Skill.Level - 1); + public double Heal(double damage) => damage * HealCoefficient; + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + foreach (Character target in targets) + { + DamageCalculationOptions options = new(caster); + DamageRecord record = DamageToEnemy(caster, target, DamageType.Physical, MagicType.None, Damage + ImprovementDamage, options); + HealToTarget(caster, caster, Heal(record.ActualDamage)); + } + } + } +} diff --git a/OshimaBot.Content/Skills/爆发技/樱花残月.cs b/OshimaBot.Content/Skills/爆发技/樱花残月.cs new file mode 100644 index 0000000..2f5e9ca --- /dev/null +++ b/OshimaBot.Content/Skills/爆发技/樱花残月.cs @@ -0,0 +1,75 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; +using FunGame.Core.Model.PrefabricatedEntity; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Skills +{ + public class 樱花残月 : SoulboundSkill + { + public override long Id => (long)SuperSkillID.樱花残月; + public override string Name => "樱花残月"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double CD => 60; + public override double HardnessTime { get; set; } = 8; + + public 樱花残月(Character? character = null) : base(character) + { + Effects.Add(new 樱花残月特效(this)); + } + } + + public class 樱花残月特效(SoulboundSkill skill) : SoulboundEffect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"基于{Skill.SkillOwner()}的 {ATKCoefficient * 100:0.##}% 攻击力 [ {Damage:0.##} ] 对{Skill.TargetDescription()}造成{CharacterSet.GetDamageTypeName(DamageType.Physical)}" + + (Improvement > 0 ? $",灵魂绑定伤害加成: {Improvement * 100:0.##}% [ {ImprovementDamage:0.##} ] 点,总伤害 {Damage + ImprovementDamage:0.##} 点;" : ";") + + $"造成伤害后,自身行动速度提升 {ActualActionSpeedPercent * 100:0.##}%、加速系数提升 {AccelerationPercent * 100:0.##}%,且普通攻击和所有技能的硬直时间减少 {硬直减少:0.##} {GameplayEquilibriumConstant.InGameTime},持续 {持续时间:0.##} {GameplayEquilibriumConstant.InGameTime}。"; + + public double ATKCoefficient => 0.6 + 0.12 * (Skill.Level - 1); + public double Damage => (Skill.Character?.ATK ?? 0) * ATKCoefficient; + public double ImprovementDamage => Improvement > 0 ? Damage * Improvement : 0; + public double 持续时间 => 10 + 2 * (Skill.Level - 1); + public double 硬直减少 => 1.5 + 0.5 * (Skill.Level - 1); + public double ActionSpeedPercent => 0.12 + 0.02 * (Skill.Level - 1); + public double ActualActionSpeedPercent => ActionSpeedPercent; + public double AccelerationPercent => 0.1 + 0.02 * (Skill.Level - 1); + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + foreach (Character target in targets) + { + DamageCalculationOptions options = new(caster); + DamageToEnemy(caster, target, DamageType.Physical, MagicType.None, Damage + ImprovementDamage, options); + } + // 刷新自身残月之姿 buff(不叠加) + List olds = caster.Effects.Where(e => e is DynamicsEffect && e.Name == nameof(樱花残月) + "·残月之姿").ToList(); + foreach (Effect e in olds) + { + e.RemoveFromCharacter(caster); + } + Effect buff = new DynamicsEffect(Skill, new Dictionary() + { + { "exspd", caster.SPD * ActionSpeedPercent }, + { "exacc", AccelerationPercent }, + { "shtr", 硬直减少 }, + { "nahtr", 硬直减少 } + }, caster) + { + Name = nameof(樱花残月) + "·残月之姿", + Durative = true, + Duration = 持续时间 + }; + buff.AddToCharacter(caster); + WriteLine($"[ {caster} ] 发动了樱花残月!自身行动速度与加速系数提升,硬直时间减少,持续 {持续时间:0.##} {GameplayEquilibriumConstant.InGameTime}!"); + RecordCharacterApplyEffects(caster, EffectType.Haste); + } + } +} diff --git a/OshimaBot.Content/Skills/爆发技/歼灭.cs b/OshimaBot.Content/Skills/爆发技/歼灭.cs new file mode 100644 index 0000000..4538aae --- /dev/null +++ b/OshimaBot.Content/Skills/爆发技/歼灭.cs @@ -0,0 +1,62 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; +using FunGame.Core.Model.PrefabricatedEntity; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 歼灭 : SoulboundSkill + { + public override long Id => (long)SuperSkillID.歼灭; + public override string Name => "歼灭"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double CD => 90; + public override double HardnessTime { get; set; } = 13; + public override bool SelectAllEnemies => true; + + public 歼灭(Character? character = null) : base(character) + { + Effects.Add(new 歼灭特效(this)); + } + } + + public class 歼灭特效(SoulboundSkill skill) : SoulboundEffect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"基于{Skill.SkillOwner()}的 {ATKCoefficient * 100:0.##}% 攻击力 [ {Damage:0.##} ] 对{Skill.TargetDescription()}造成{CharacterSet.GetDamageTypeName(DamageType.Physical)}" + + (Improvement > 0 ? $",灵魂绑定伤害加成: {Improvement * 100:0.##}% [ {ImprovementDamage:0.##} ] 点,总伤害 {Damage + ImprovementDamage:0.##} 点;" : ";") + + $"造成伤害后,有 {ActualProbability * 100:0.##}% 概率使目标进入战斗不能 {持续时间} 回合。战斗不能:无法普通攻击和使用技能(魔法、战技和爆发技)。"; + + public double ATKCoefficient => 0.55 + 0.12 * (Skill.Level - 1); + public double Damage => (Skill.Character?.ATK ?? 0) * ATKCoefficient; + public double ImprovementDamage => Improvement > 0 ? Damage * Improvement : 0; + // 重标:全敌强控持续限定 1 回合(原 L5+ 为 2 回合) + public int 持续时间 => 1; + public double 概率 => 0.15 + 0.03 * (Skill.Level - 1); + public double ActualProbability => Math.Min(0.4, 概率); + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + List valid = []; + foreach (Character target in targets) + { + DamageCalculationOptions options = new(caster); + if (DamageToEnemy(caster, target, DamageType.Physical, MagicType.None, Damage + ImprovementDamage, options).ActualDamage > 0) + { + valid.Add(target); + } + } + Effect e = new 施加概率负面(Skill, EffectType.Cripple, false, 0, 持续时间, 0, ActualProbability, 0); + e.Activate(caster, valid, grids, others); + } + } +} diff --git a/OshimaBot.Content/Skills/爆发技/泰山玄武靠.cs b/OshimaBot.Content/Skills/爆发技/泰山玄武靠.cs new file mode 100644 index 0000000..3d2bf75 --- /dev/null +++ b/OshimaBot.Content/Skills/爆发技/泰山玄武靠.cs @@ -0,0 +1,76 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; +using FunGame.Core.Model.PrefabricatedEntity; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 泰山玄武靠 : SoulboundSkill + { + public override long Id => (long)SuperSkillID.泰山玄武靠; + public override string Name => "泰山玄武靠"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double CD => 70; + public override double HardnessTime { get; set; } = 9; + public override int CanSelectTargetCount + { + get + { + return Level switch + { + 1 or 2 => 1, + 3 or 4 => 2, + _ => 3 + }; + } + } + + public 泰山玄武靠(Character? character = null) : base(character) + { + Effects.Add(new 泰山玄武靠特效(this)); + } + } + + public class 泰山玄武靠特效(SoulboundSkill skill) : SoulboundEffect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"基于{Skill.SkillOwner()}的 {ATKCoefficient * 100:0.##}% 攻击力 [ {Damage:0.##} ] 对{Skill.TargetDescription()}造成{CharacterSet.GetDamageTypeName(DamageType.Physical)}" + + (Improvement > 0 ? $",灵魂绑定伤害加成: {Improvement * 100:0.##}% [ {ImprovementDamage:0.##} ] 点,总伤害 {Damage + ImprovementDamage:0.##} 点;" : ";") + + $"造成伤害后,有 {ActualProbability * 100:0.##}% 概率使目标进入气绝 {持续时间:0.##} {GameplayEquilibriumConstant.InGameTime}。气绝:行动受限,且每{GameplayEquilibriumConstant.InGameTime}流失 {气绝流失 * 100:0.##}% 当前生命值(不会致死),需强驱散。"; + + public double ATKCoefficient => 0.45 + 0.12 * (Skill.Level - 1); + public double Damage => (Skill.Character?.ATK ?? 0) * ATKCoefficient; + public double ImprovementDamage => Improvement > 0 ? Damage * Improvement : 0; + // 重标:气绝持续 15 → 10 秒(L6) + public double 持续时间 => 5 + 1 * (Skill.Level - 1); + public double 概率 => 0.2 + 0.05 * (Skill.Level - 1); + // 重标:强控概率上限 50% → 40% + public double ActualProbability => Math.Min(0.4, 概率); + // 重标:当前生命流失 4.5% → 3%(L6) + public double 气绝流失 => 0.015 + 0.003 * (Skill.Level - 1); + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + List valid = []; + foreach (Character target in targets) + { + DamageCalculationOptions options = new(caster); + if (DamageToEnemy(caster, target, DamageType.Physical, MagicType.None, Damage + ImprovementDamage, options).ActualDamage > 0) + { + valid.Add(target); + } + } + Effect e = new 施加概率负面(Skill, EffectType.Bleed, true, 持续时间, 0, 0, ActualProbability, 0, true, 0, 气绝流失); + e.Activate(caster, valid, grids, others); + } + } +} diff --git a/OshimaBot.Content/Skills/爆发技/漆黑之牙.cs b/OshimaBot.Content/Skills/爆发技/漆黑之牙.cs new file mode 100644 index 0000000..3b21799 --- /dev/null +++ b/OshimaBot.Content/Skills/爆发技/漆黑之牙.cs @@ -0,0 +1,68 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; +using FunGame.Core.Model.PrefabricatedEntity; + +namespace OshimaBot.Content.Skills +{ + public class 漆黑之牙 : SoulboundSkill + { + public override long Id => (long)SuperSkillID.漆黑之牙; + public override string Name => "漆黑之牙"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double CD => 80; + public override double HardnessTime { get; set; } = 13; + public override bool SelectAllEnemies => true; + public int SkillKills { get; set; } = 0; + + public 漆黑之牙(Character? character = null) : base(character) + { + Effects.Add(new 漆黑之牙特效(this)); + } + + public override void OnCharacterRespawn(Skill newSkill) + { + if (newSkill is 漆黑之牙 s) + { + s.SkillKills = SkillKills; + } + } + } + + public class 漆黑之牙特效(SoulboundSkill skill) : SoulboundEffect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"基于{Skill.SkillOwner()}的 {ATKCoefficient * 100:0.##}% 攻击力 [ {Damage:0.##} ] 对{Skill.TargetDescription()}造成{CharacterSet.GetDamageTypeName(DamageType.Physical)}。" + + $"每当此技能造成一名敌人死亡,永久提升 4% 伤害,当前提升:{SkillKillsCoefficient * 100:0.##}% [ {SkillKillsDamage:0.##} ] 点;" + + (Improvement > 0 ? $"灵魂绑定伤害加成: {Improvement * 100:0.##}% [ {ImprovementDamage:0.##} ] 点;" : "") + + $"总伤害 {Damage + SkillKillsDamage + ImprovementDamage:0.##} 点。"; + + public 漆黑之牙? CSkill => Skill is 漆黑之牙 s ? s : null; + public double ATKCoefficient => 0.4 + 0.1 * (Skill.Level - 1); + public double Damage => (Skill.Character?.ATK ?? 0) * ATKCoefficient; + public double ImprovementDamage => Improvement > 0 ? Damage * Improvement : 0; + public double SkillKillsCoefficient => CSkill is null ? 0 : CSkill.SkillKills * 0.04; + public double SkillKillsDamage => SkillKillsCoefficient > 0 ? Damage * SkillKillsCoefficient : 0; + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + foreach (Character target in targets) + { + DamageCalculationOptions options = new(caster); + DamageToEnemy(caster, target, DamageType.Physical, MagicType.None, Damage + SkillKillsDamage + ImprovementDamage, options); + if (target.HP <= 0 && CSkill != null) + { + CSkill.SkillKills++; + } + } + } + } +} diff --git a/OshimaBot.Content/Skills/爆发技/炎龙倒海.cs b/OshimaBot.Content/Skills/爆发技/炎龙倒海.cs new file mode 100644 index 0000000..a28f822 --- /dev/null +++ b/OshimaBot.Content/Skills/爆发技/炎龙倒海.cs @@ -0,0 +1,130 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; +using FunGame.Core.Model.PrefabricatedEntity; + +namespace OshimaBot.Content.Skills +{ + public class 炎龙倒海 : SoulboundSkill + { + public override long Id => (long)SuperSkillID.炎龙倒海; + public override string Name => "炎龙倒海"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double CD => 75; + public override double HardnessTime { get; set; } = 12; + public override bool SelectAllEnemies => true; + + public 炎龙倒海(Character? character = null) : base(character) + { + Effects.Add(new 炎龙倒海特效(this)); + } + } + + public class 炎龙倒海特效(SoulboundSkill skill) : SoulboundEffect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"基于{Skill.SkillOwner()}的 {ATKCoefficient * 100:0.##}% 攻击力 [ {Damage:0.##} ] 对{Skill.TargetDescription()}造成{CharacterSet.GetDamageTypeName(DamageType.Magical)}" + + (Improvement > 0 ? $",灵魂绑定伤害加成: {Improvement * 100:0.##}% [ {ImprovementDamage:0.##} ] 点,总伤害 {Damage + ImprovementDamage:0.##} 点;" : ";") + + $"造成伤害后,施加灼焰迟滞 {持续时间:0.##} {GameplayEquilibriumConstant.InGameTime}:行动速度降低 {ActionSpeedReductionPercent * 100:0.##}%,且当前行动被推迟 {HardnessDelayPercent * 100:0.##}%。"; + + public double ATKCoefficient => 0.45 + 0.1 * (Skill.Level - 1); + public double Damage => (Skill.Character?.ATK ?? 0) * ATKCoefficient; + public double ImprovementDamage => Improvement > 0 ? Damage * Improvement : 0; + public double 持续时间 => 8 + 2 * (Skill.Level - 1); + // 重标:降速满级 ≤25%(原 20%→35%) + public double ActionSpeedReductionPercent => 0.15 + 0.02 * (Skill.Level - 1); + // 重标:行动推迟满级 ≤20%(原 25%→45%) + public double HardnessDelayPercent => 0.1 + 0.02 * (Skill.Level - 1); + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + foreach (Character target in targets) + { + DamageCalculationOptions options = new(caster); + if (DamageToEnemy(caster, target, DamageType.Magical, MagicType.None, Damage + ImprovementDamage, options).ActualDamage > 0) + { + // 重标:移除降加速系数与削能量,仅保留降速 + 行动推迟 + 灼焰迟滞 e = new(Skill, target, caster, 持续时间, ActionSpeedReductionPercent); + if (!CheckExemption(caster, target, e)) + { + GamingQueue?.ChangeCharacterHardnessTime(target, HardnessDelayPercent, true, false); + WriteLine($"[ {caster} ] 对 [ {target} ] 施加了灼焰迟滞 {持续时间:0.##} {GameplayEquilibriumConstant.InGameTime},并推迟了其当前行动!"); + e.AddToCharacter(target); + GamingQueue?.AddApplyEffects(target, e.EffectType); + } + } + } + } + } + + public class 灼焰迟滞 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name + "·灼焰迟滞"; + public override string Description => $"此角色处于灼焰迟滞状态,行动速度降低 {_actionSpeedReductionPercent * 100:0.##}%。来自:[ {Source} ] 的 [ {Skill.Name} ]"; + public override EffectType EffectType => EffectType.Slow; + public override DispelledType DispelledType => DispelledType.Weak; + public override bool IsDebuff => true; + public override bool ExemptDuration => true; + public override Character Source => _sourceCharacter; + public override bool Durative => _durative; + public override double Duration => _duration; + public override int DurationTurn => _durationTurn; + + private readonly Character _targetCharacter; + private readonly Character _sourceCharacter; + private readonly bool _durative; + private readonly double _duration; + private readonly int _durationTurn; + private readonly double _actionSpeedReductionPercent; + private double _spdValue = 0; + + public 灼焰迟滞(Skill skill, Character targetCharacter, Character sourceCharacter, double duration = 0, double actionSpeedReductionPercent = 0, int durationTurn = 0) : base(skill) + { + GamingQueue = skill.GamingQueue; + _targetCharacter = targetCharacter; + _sourceCharacter = sourceCharacter; + _durative = duration > 0; + _duration = duration; + _durationTurn = durationTurn; + _actionSpeedReductionPercent = actionSpeedReductionPercent; + } + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (_durative && RemainDuration == 0) + { + RemainDuration = Duration; + } + else if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + if (character == _targetCharacter) + { + _spdValue = character.SPD * _actionSpeedReductionPercent; + character.ExSPD -= _spdValue; + } + AddEffectTypeToCharacter(character, [EffectType.Slow]); + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (character == _targetCharacter) + { + character.ExSPD += _spdValue; + } + RemoveEffectTypesFromCharacter(character); + } + } +} diff --git a/OshimaBot.Content/Skills/爆发技/裁决塔罗.cs b/OshimaBot.Content/Skills/爆发技/裁决塔罗.cs new file mode 100644 index 0000000..375992d --- /dev/null +++ b/OshimaBot.Content/Skills/爆发技/裁决塔罗.cs @@ -0,0 +1,101 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; +using FunGame.Core.Model.PrefabricatedEntity; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 裁决塔罗 : SoulboundSkill + { + public override long Id => (long)SuperSkillID.裁决塔罗; + public override string Name => "裁决塔罗"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double CD => 75; + public override double HardnessTime { get; set; } = 9; + public override int CanSelectTargetCount + { + get + { + return Level switch + { + 1 or 2 => 1, + 3 or 4 => 2, + _ => 3 + }; + } + } + + public 裁决塔罗(Character? character = null) : base(character) + { + Effects.Add(new 裁决塔罗特效(this)); + } + } + + public class 裁决塔罗特效(SoulboundSkill skill) : SoulboundEffect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"基于{Skill.SkillOwner()}的 {ATKCoefficient * 100:0.##}% 攻击力 [ {Damage:0.##} ] 对{Skill.TargetDescription()}造成{CharacterSet.GetDamageTypeName(DamageType.Magical)}" + + (Improvement > 0 ? $",灵魂绑定伤害加成: {Improvement * 100:0.##}% [ {ImprovementDamage:0.##} ] 点,总伤害 {Damage + ImprovementDamage:0.##} 点;" : ";") + + $"造成伤害后,对目标随机施加以下几种状态:\r\n1、冻结:造成 {DurationTurn} 回合完全行动不能和 30% 魔法伤害易伤;\r\n" + + $"2、混乱:进入行动受限状态,失控并随机行动,且所有指令均会在所有角色中随机选取目标,持续 {DurationTurn} 回合;\r\n" + + $"3、战斗不能:在 {Duration:0.##} {GameplayEquilibriumConstant.InGameTime}内无法普通攻击和使用技能(魔法、战技和爆发技)。"; + + public double ATKCoefficient => 0.38 + 0.12 * (Skill.Level - 1); + public double Damage => (Skill.Character?.ATK ?? 0) * ATKCoefficient; + public double ImprovementDamage => Improvement > 0 ? Damage * Improvement : 0; + public override double Duration + { + get + { + return Skill.Level switch + { + 4 or 5 or 6 => 14, + _ => 7 + }; + } + } + public override int DurationTurn + { + get + { + return Skill.Level switch + { + 4 or 5 or 6 => 3, + _ => 2 + }; + } + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + foreach (Character target in targets) + { + DamageCalculationOptions options = new(caster); + if (DamageToEnemy(caster, target, DamageType.Magical, MagicType.None, Damage + ImprovementDamage, options).ActualDamage > 0) + { + Effect e = Random.Next(3) switch + { + 0 => new 施加概率负面(Skill, EffectType.Freeze, false, 0, DurationTurn, 0, 1, 0), + 1 => new 施加概率负面(Skill, EffectType.Confusion, false, 0, DurationTurn, 0, 1, 0), + _ => new 施加概率负面(Skill, EffectType.Cripple, true, Duration, 0, 0, 1, 0), + }; + if (e.EffectType == EffectType.Freeze) + { + e.Activate(caster, [target], grids, others); + e = new 施加概率负面(Skill, EffectType.Vulnerable, false, 0, DurationTurn, 0, 1, 0, DamageType.Magical, 0.3); + } + e.Activate(caster, [target], grids, others); + } + } + } + } +} diff --git a/OshimaBot.Content/Skills/爆发技/魔枪洛亚.cs b/OshimaBot.Content/Skills/爆发技/魔枪洛亚.cs new file mode 100644 index 0000000..890a9e4 --- /dev/null +++ b/OshimaBot.Content/Skills/爆发技/魔枪洛亚.cs @@ -0,0 +1,119 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; +using FunGame.Core.Model.PrefabricatedEntity; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 魔枪洛亚 : SoulboundSkill + { + public override long Id => (long)SuperSkillID.魔枪洛亚; + public override string Name => "魔枪洛亚"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double CD => 70; + public override double HardnessTime { get; set; } = 11; + public override bool SelectAllEnemies => true; + + public 魔枪洛亚(Character? character = null) : base(character) + { + Effects.Add(new 魔枪洛亚特效(this)); + } + } + + public class 魔枪洛亚特效(SoulboundSkill skill) : SoulboundEffect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"基于{Skill.SkillOwner()}的 {ATKCoefficient * 100:0.##}% 攻击力 [ {Damage:0.##} ] 对{Skill.TargetDescription()}造成{CharacterSet.GetDamageTypeName(DamageType.Magical)}" + + (Improvement > 0 ? $",灵魂绑定伤害加成: {Improvement * 100:0.##}% [ {ImprovementDamage:0.##} ] 点,总伤害 {Damage + ImprovementDamage:0.##} 点;" : ";") + + $"造成伤害后,解除目标的施法,并施加魔抗削弱 {持续时间:0.##} 回合:全属性魔法抗性降低 {MDFReductionPercent * 100:0.##}%,可弱驱散。"; + + public double ATKCoefficient => 0.42 + 0.1 * (Skill.Level - 1); + public double Damage => (Skill.Character?.ATK ?? 0) * ATKCoefficient; + public double ImprovementDamage => Improvement > 0 ? Damage * Improvement : 0; + public int 持续时间 => Skill.Level >= 4 ? 3 : 2; + public double MDFReductionPercent => 0.15 + 0.03 * (Skill.Level - 1); + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + foreach (Character target in targets) + { + DamageCalculationOptions options = new(caster); + if (DamageToEnemy(caster, target, DamageType.Magical, MagicType.None, Damage + ImprovementDamage, options).ActualDamage > 0) + { + Effect 打断 = new 打断施法(Skill); + 打断.Activate(caster, [target], grids, others); + 魔抗削弱 e = new(Skill, target, caster, 持续时间, MDFReductionPercent); + if (!CheckExemption(caster, target, e)) + { + WriteLine($"[ {caster} ] 对 [ {target} ] 施加了魔抗削弱,全属性魔法抗性降低 {MDFReductionPercent * 100:0.##}%,持续 {持续时间} 回合!"); + e.AddToCharacter(target); + GamingQueue?.AddApplyEffects(target, e.EffectType); + } + } + } + } + } + + public class 魔抗削弱 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name + "·魔抗削弱"; + public override string Description => $"此角色的全属性魔法抗性降低 {_mdfReductionPercent * 100:0.##}%。来自:[ {Source} ] 的 [ {Skill.Name} ]"; + public override EffectType EffectType => EffectType.MagicResistBreak; + public override DispelledType DispelledType => DispelledType.Weak; + public override bool IsDebuff => true; + public override bool ExemptDuration => true; + public override Character Source => _sourceCharacter; + public override bool Durative => false; + public override double Duration => 0; + public override int DurationTurn => _durationTurn; + + private readonly Character _targetCharacter; + private readonly Character _sourceCharacter; + private readonly int _durationTurn; + private readonly double _mdfReductionPercent; + private readonly Dictionary _deltas = []; + + public 魔抗削弱(Skill skill, Character targetCharacter, Character sourceCharacter, int durationTurn, double mdfReductionPercent) : base(skill) + { + GamingQueue = skill.GamingQueue; + _targetCharacter = targetCharacter; + _sourceCharacter = sourceCharacter; + _durationTurn = durationTurn; + _mdfReductionPercent = mdfReductionPercent; + } + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (RemainDurationTurn == 0) + { + RemainDurationTurn = DurationTurn; + } + if (character == _targetCharacter) + { + character.MDF.AddAllValue(-_mdfReductionPercent); + } + AddEffectTypeToCharacter(character, [EffectType.MagicResistBreak]); + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (character == _targetCharacter) + { + character.MDF.AddAllValue(_mdfReductionPercent); + } + RemoveEffectTypesFromCharacter(character); + } + } +} diff --git a/OshimaBot.Content/Skills/被动/不灭之握.cs b/OshimaBot.Content/Skills/被动/不灭之握.cs new file mode 100644 index 0000000..7317cbb --- /dev/null +++ b/OshimaBot.Content/Skills/被动/不灭之握.cs @@ -0,0 +1,129 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Skills +{ + public class 不灭之握 : Skill + { + public override long Id => (long)PassiveID.不灭之握; + public override string Name => "不灭之握"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + + /// + /// 永久提升的最大生命值累计值。[ 永久成长数据存放在技能本体上 ]:死亡/复活时角色会被重建, + /// 依赖 把累计值迁移给新技能实例,特效重挂后全量施加。 + /// + public double 永久提升累计 { get; set; } = 0; + + public 不灭之握(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 不灭之握特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + + public override void OnCharacterRespawn(Skill newSkill) + { + if (newSkill is 不灭之握 s) + { + s.永久提升累计 = 永久提升累计; + } + } + } + + public class 不灭之握特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"每 {冷却时间:0.##} {GameplayEquilibriumConstant.InGameTime},下一次普通攻击将额外造成自身最大生命值 {伤害系数 * 100:0.##}% [ {Skill.Character?.MaxHP * 伤害系数:0.##} ] 的伤害,并回复自身 {回复系数 * 100:0.##}% [ {Skill.Character?.MaxHP * 回复系数:0.##} ] 最大生命值,同时永久提升 {永久生命提升:0.##} 点最大生命值(累计上限 {永久提升上限:0.##} 点,为基础生命值的 10%)。" + + (CSkill?.永久提升累计 > 0 ? $"(当前已累计提升 {CSkill.永久提升累计:0.##} 点最大生命值)" : ""); + + public 不灭之握? CSkill => Skill as 不灭之握; + + private double 已应用 = 0; + private double 剩余冷却 = 0; + + private double 冷却时间 => Skill.Character != null ? 8 - Skill.Character.Level * 0.03 : 8; + private double 伤害系数 => Skill.Character != null ? 0.04 + Skill.Character.Level * 0.0006 : 0.04; + private double 回复系数 => Skill.Character != null ? 0.02 + Skill.Character.Level * 0.0003 : 0.02; + private double 永久生命提升 => Skill.Character != null ? 8 + Skill.Character.Level * 0.3 : 8; + + /// + /// 重标:永久提升的硬上限 = 基础生命值(BaseHP) 的 10%(原为无上限永久成长) + /// + private double 永久提升上限 => Skill.Character != null ? Skill.Character.BaseHP * 0.1 : 0; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (Skill.Character == null || Skill.Character != character) return; + // 复活/重挂时:把技能本体上继承到的累计值整体施加一次 + 刷新(character); + } + + public override void AfterDamageCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return; + if (Skill.Character == null || Skill.Character != character) return; + if (!ctx.IsNormalAttack) return; + if (ctx.DamageResult != DamageResult.Normal && ctx.DamageResult != DamageResult.Critical) return; + if (剩余冷却 > 0) return; + 剩余冷却 = 冷却时间; + double 额外伤害 = character.MaxHP * 伤害系数; + double 回复量 = character.MaxHP * 回复系数; + double 永久提升 = 永久生命提升; + if (CSkill != null) + { + // 重标:受「基础生命值 10%」硬上限约束,超出后不再累积 + double 剩余额度 = Math.Max(0, 永久提升上限 - CSkill.永久提升累计); + 永久提升 = Math.Min(永久提升, 剩余额度); + CSkill.永久提升累计 += 永久提升; + } + 刷新(character); + WriteLine($"[ {character} ] 发动了不灭之握!额外造成 {额外伤害:0.##} 点伤害,回复 {回复量:0.##} 点生命值,并永久提升了 {永久提升:0.##} 点最大生命值(累计 {CSkill?.永久提升累计:0.##} 点)!"); + HealToTarget(character, character, 回复量); + DamageToEnemy(character, enemy, ctx.DamageType, ctx.MagicType, 额外伤害, new(character) + { + TriggerEffects = false + }); + } + + public override void OnTimeElapsed(TimeLapseContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (Skill.Character == null || Skill.Character != character) return; + if (剩余冷却 > 0) + { + 剩余冷却 -= ctx.Elapsed; + } + // 自愈式幂等刷新:复活等场景下若 OnEffectGained 未重放,首个时间流逝即补挂全量累计 + 刷新(character); + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (已应用 <= 0) return; + // 只回收本实例已施加的加成;累计值保留在技能本体上,交由复活迁移/重挂后重新施加 + character.ExHP2 -= 已应用; + 已应用 = 0; + } + + /// + /// 以技能本体的累计值为准做幂等刷新:差值增量施加,避免重复叠加或漏加。 + /// + private void 刷新(Character character) + { + double target = CSkill?.永久提升累计 ?? 0; + double delta = target - 已应用; + if (Math.Abs(delta) < 1e-9) return; + character.ExHP2 += delta; + 已应用 = target; + } + } +} diff --git a/OshimaBot.Content/Skills/被动/丛刃.cs b/OshimaBot.Content/Skills/被动/丛刃.cs new file mode 100644 index 0000000..8a85ee6 --- /dev/null +++ b/OshimaBot.Content/Skills/被动/丛刃.cs @@ -0,0 +1,93 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Skills +{ + public class 丛刃 : Skill + { + public override long Id => (long)PassiveID.丛刃; + public override string Name => "丛刃"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + + public 丛刃(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 丛刃特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + public class 丛刃特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"每次造成伤害后,在 {持续时间:0.##} {GameplayEquilibriumConstant.InGameTime}内大幅减少自身的普通攻击与技能硬直时间(每层减少 {每层硬直减少 * 100:0.##}%,最多 {最多层数} 层)。"; + + private int 层数 = 0; + private double 剩余持续时间 = 0; + + private double 每层硬直减少 => Skill.Character != null ? 0.12 + Skill.Character.Level * 0.001 : 0.12; + private double 持续时间 => Skill.Character != null ? 5 + Skill.Character.Level * 0.05 : 5; + private int 最多层数 => 3; + + public override void AfterDamageCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return; + if (Skill.Character == null || Skill.Character != character) return; + if (ctx.DamageResult != DamageResult.Normal && ctx.DamageResult != DamageResult.Critical) return; + 层数 = Math.Min(最多层数, 层数 + 1); + 剩余持续时间 = 持续时间; + ApplyBuff(character); + } + + public override void OnTimeElapsed(TimeLapseContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (剩余持续时间 > 0) + { + 剩余持续时间 -= ctx.Elapsed; + if (剩余持续时间 <= 0) + { + 层数 = 0; + ClearBuff(character); + } + } + } + + private void ApplyBuff(Character character) + { + ClearBuff(character); + if (层数 <= 0) return; + double reduce = 每层硬直减少 * 层数; + WriteLine($"[ {character} ] 发动了丛刃!{reduce * 100:0.##}% 硬直减免生效,持续 {剩余持续时间:0.##} {GameplayEquilibriumConstant.InGameTime}!"); + Effect e = new DynamicsEffect(Skill, new Dictionary() + { + { "nahtr2", reduce }, + { "shtr2", reduce } + }, character) + { + Name = nameof(丛刃) + "·硬直减免", + Durative = true, + Duration = 剩余持续时间 + }; + character.Effects.Add(e); + e.OnEffectGained(new HookContext(GamingQueue, character)); + } + + private void ClearBuff(Character character) + { + List olds = character.Effects.Where(e => e is DynamicsEffect && e.Name == nameof(丛刃) + "·硬直减免").ToList(); + foreach (Effect e in olds) + { + character.Effects.Remove(e); + e.OnEffectLost(new HookContext(GamingQueue, character)); + } + } + } +} diff --git a/OshimaBot.Content/Skills/被动/余震.cs b/OshimaBot.Content/Skills/被动/余震.cs new file mode 100644 index 0000000..054e605 --- /dev/null +++ b/OshimaBot.Content/Skills/被动/余震.cs @@ -0,0 +1,103 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.OpenEffects; +using OshimaBot.Content.Effects.PassiveEffects; + +namespace OshimaBot.Content.Skills +{ + public class 余震 : Skill + { + public override long Id => (long)PassiveID.余震; + public override string Name => "余震"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + + public 余震(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 余震特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + public class 余震特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"对处于控制状态的目标造成伤害时,获得 {双抗提升 * 100:0.##}% 物理护甲与魔法抗性加成,持续 {强化持续时间:0.##} {GameplayEquilibriumConstant.InGameTime},并溅射 {溅射伤害:0.##} 点魔法伤害至随机敌人({溅射目标数} 个,不含目标自身)。触发后进入 {冷却时间:0.##} {GameplayEquilibriumConstant.InGameTime}冷却。"; + + private double 剩余冷却 = 0; + + // 平衡调整(2026-09-22):CD Lv60 9.6s → 12s(Admin:余震 CD 偏短) + private double 冷却时间 => Skill.Character != null ? 18 - Skill.Character.Level * 0.1 : 18; + private double 强化持续时间 => Skill.Character != null ? 5 + Skill.Character.Level * 0.1 : 5; + private double 双抗提升 => Skill.Character != null ? 0.15 + Skill.Character.Level * 0.002 : 0.15; + // 平衡调整(2026-09-22):Lv60 溅射 559.65 → 427.72(−24%)(Admin:余震数值稍高) + private double 溅射伤害 => Skill.Character != null ? 80 + Skill.Character.Level * 5 + Skill.Character.PrimaryAttributeValue * 0.4 : 80; + private int 溅射目标数 => 2; + + public override void AfterDamageCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return; + if (Skill.Character == null || Skill.Character != character) return; + if (ctx.DamageResult != DamageResult.Normal && ctx.DamageResult != DamageResult.Critical) return; + if (剩余冷却 > 0) return; + if (!IsControl(enemy)) return; + 剩余冷却 = 冷却时间; + WriteLine($"[ {character} ] 发动了余震!目标 [ {enemy} ] 处于控制状态,自身获得双抗加成!"); + Effect e = new DynamicsEffect(Skill, new Dictionary() + { + { "exdef2", 双抗提升 }, + { "mdftype", 0 }, + { "mdfvalue", 双抗提升 } + }, character) + { + Name = nameof(余震) + "·双抗", + Durative = true, + Duration = 强化持续时间 + }; + character.Effects.Add(e); + e.OnEffectGained(new HookContext(GamingQueue, character)); + + foreach (Character target in RandomTargets(character, enemy, 溅射目标数)) + { + WriteLine($"[ {character} ] 的余震溅射到了 [ {target} ],造成 {溅射伤害:0.##} 点魔法伤害!"); + DamageToEnemy(character, target, DamageType.Magical, MagicType.None, 溅射伤害, new(character) + { + TriggerEffects = false + }); + } + } + + public override void OnTimeElapsed(TimeLapseContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (剩余冷却 > 0) + { + 剩余冷却 -= ctx.Elapsed; + } + } + + private static bool IsControl(Character character) + { + if (character.CharacterState is CharacterState.NotActionable or CharacterState.ActionRestricted + or CharacterState.BattleRestricted or CharacterState.SkillRestricted or CharacterState.AttackRestricted) + { + return true; + } + return character.Effects.Any(e => e is 眩晕 or 气绝 or 冻结 or 石化 or 混乱 or 战斗不能 or 缴械 or 封技 or 完全行动不能); + } + + private IEnumerable RandomTargets(Character self, Character exclude, int count) + { + return GamingQueue?.AllCharacters + .Where(c => c != self && c != exclude && c.HP > 0) + .OrderBy(_ => Random.Next()) + .Take(count) ?? []; + } + } +} diff --git a/OshimaBot.Content/Skills/被动/先攻.cs b/OshimaBot.Content/Skills/被动/先攻.cs new file mode 100644 index 0000000..89579dd --- /dev/null +++ b/OshimaBot.Content/Skills/被动/先攻.cs @@ -0,0 +1,75 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Skills +{ + public class 先攻 : Skill + { + public override long Id => (long)PassiveID.先攻; + public override string Name => "先攻"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + + public 先攻(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 先攻特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + public class 先攻特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"对长时间未交手的敌人抢先出手时(双方超过 {重置窗口:0.##} {GameplayEquilibriumConstant.InGameTime}互不攻击视为重置先手),首次造成伤害获得 {先攻伤害:0.##} 点额外真实伤害和 {能量获取:0.##} 点能量。"; + + private readonly Dictionary 我方攻击时间 = []; + private readonly Dictionary 敌方攻击我方时间 = []; + + private double 重置窗口 => Skill.Character != null ? 8 + Skill.Character.Level * 0.1 : 8; + private double 先攻伤害 => Skill.Character != null ? 45 + Skill.Character.Level * 4.5 : 45; + private double 能量获取 => Skill.Character != null ? 6 + Skill.Character.Level * 0.2 : 6; + + public override void AfterDamageCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return; + if (Skill.Character == null || character == enemy || GamingQueue == null) return; + double now = GamingQueue.TotalTime; + if (Skill.Character == character) + { + // 出伤侧:先手判定 + if (ctx.DamageResult != DamageResult.Normal && ctx.DamageResult != DamageResult.Critical) return; + if (IsFirstStrike(enemy, now)) + { + WriteLine($"[ {character} ] 发动了先攻!抢先出手造成 {先攻伤害:0.##} 点额外真实伤害并回复能量!"); + DamageToEnemy(character, enemy, DamageType.True, MagicType.None, 先攻伤害, new(character) + { + TriggerEffects = false + }); + if (character.EP < 200) + { + character.EP = Math.Min(character.EP + 能量获取, 200); + } + } + 我方攻击时间[enemy] = now; + } + else if (Skill.Character == enemy) + { + // 受击侧:记录敌方攻击我方的时间 + 敌方攻击我方时间[character] = now; + } + } + + private bool IsFirstStrike(Character enemy, double now) + { + 敌方攻击我方时间.TryGetValue(enemy, out double 敌攻我); + 我方攻击时间.TryGetValue(enemy, out double 我攻敌); + return now - Math.Max(敌攻我, 我攻敌) >= 重置窗口; + } + } +} diff --git a/OshimaBot.Content/Skills/被动/共鸣护盾.cs b/OshimaBot.Content/Skills/被动/共鸣护盾.cs new file mode 100644 index 0000000..8fdfa84 --- /dev/null +++ b/OshimaBot.Content/Skills/被动/共鸣护盾.cs @@ -0,0 +1,105 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Skills +{ + /// + /// 通用被动 · 辅助型【共鸣护盾】—— 行动后为队友补护盾 + /// 设计意图:五类辅助原型中的「阵地防护」。自身行动结束后观察队友,为最危险的那个补护盾。 + /// 触发:自身完成一次行动后(,本人为行动者;该钩子是全队列广播) + /// 效果:为生命值最低且「血量低 + 身上没护盾」的队友施加混合护盾,内部冷却 + /// 标尺(手册 §6.4 被动·护盾 ≤20–25% MaxHP、再生间隔 ≥25 秒):护盾 15% 最大生命值、冷却 40 秒 ✓ + /// ⚠ 平衡修订(2026-09-23,Admin 指出「相当于常驻,稍廉价」): + /// **护盾不会随时间衰减**(`Shield.Mix` 是纯数值池,只被伤害消耗),原「25 秒无条件补 15% MaxHP」 + /// 单实例一局可堆到 525% MaxHP,比整改样板 `海妖外壳`(35 秒 / 375%)还多 40%。 + /// 故冷却 25 → 40 秒,并加「目标已有护盾就不补」守卫 —— 让节奏由**被打掉多少**决定。 + /// + public class 共鸣护盾 : Skill + { + public override long Id => (long)PassiveID.共鸣护盾; + public override string Name => "共鸣护盾"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + + public 共鸣护盾(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 共鸣护盾特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + public class 共鸣护盾特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => + $"自身行动结束后,若存在生命值低于 {触发阈值 * 100:0.##}% 的队友,且其当前护盾不足最大生命值的 {护盾残留阈值 * 100:0.##}%," + + $"则为其中生命值最低者提供 {护盾系数 * 100:0.##}% 最大生命值的混合护盾;" + + $"每 {冷却时间:0.##} {GameplayEquilibriumConstant.InGameTime}至多一次。"; + + private double 剩余冷却 = 0; + + /// 目标生命值低于该比例才算「需要掩护」 + private double 触发阈值 => 0.7; + + /// 护盾量(Lv60 = 15% 最大生命值) + private double 护盾系数 => Skill.Character != null ? 0.12 + Skill.Character.Level * 0.0005 : 0.12; + + /// + /// 目标当前护盾达到该比例就**不再补**(防堆积)。 + /// ⚠ 实测结论(2026-09-23,极值 A/B):把该阈值临时改成 5.0(永远拦下)后, + /// 3 局同种子的给盾次数 100 → 103 次,**没有区别** —— 在「拉满 + 定态」这种持续挨打的 + /// 高压环境里队友护盾总会被打掉,这道守卫**基本不触发**;本次实际降幅全部来自冷却 25 → 40 秒。 + /// 保留理由:`Shield.Mix` **没有任何时间衰减**(`Shield.cs` 搜不到 Elapsed/Decay), + /// 低压力场景(对手输出不足 / 队里还有别的治疗源)下,固定冷却补盾确实会无限堆积。 + /// 这道守卫是**上界保障**:单目标护盾不超过「15% MaxHP + 一次未耗尽的残留」。 + /// + private double 护盾残留阈值 => 0.10; + + private double 冷却时间 => 40; + + public override void OnCharacterActionTaken(ActionContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (Skill.Character == null || Skill.Character != character) return; + if (剩余冷却 > 0) return; + Character? target = 最低生命队友(character); + if (target == null) return; + double shield = target.MaxHP * 护盾系数; + if (shield <= 0) return; + 剩余冷却 = 冷却时间; + WriteLine($"[ {character} ] 发动了共鸣护盾![ {target} ] 获得了 {shield:0.##} 点混合护盾!"); + target.Shield.Mix += shield; + GamingQueue?.AddApplyEffects(target, EffectType.Shield); + } + + public override void OnTimeElapsed(TimeLapseContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (Skill.Character == null || Skill.Character != character) return; + if (剩余冷却 > 0) 剩余冷却 = Math.Max(0, 剩余冷却 - ctx.Elapsed); + } + + /// + /// 生命值百分比最低、且同时满足「血量低于阈值」「当前护盾不足」的存活队友(不含自己)。 + /// 任一条不满足都返回 null,且**不消耗冷却** —— 条件一满足即可立刻响应。 + /// + private Character? 最低生命队友(Character self) + { + if (GamingQueue == null) return null; + Character? target = GamingQueue.GetTeammates(self) + .Where(c => c.HP > 0 && c != self) + .OrderBy(c => c.HP / Math.Max(1, c.MaxHP)) + .FirstOrDefault(); + if (target == null) return null; + if (target.HP / Math.Max(1, target.MaxHP) >= 触发阈值) return null; + if (target.Shield.TotalMix >= target.MaxHP * 护盾残留阈值) return null; + return target; + } + } +} diff --git a/OshimaBot.Content/Skills/被动/冰川增幅.cs b/OshimaBot.Content/Skills/被动/冰川增幅.cs new file mode 100644 index 0000000..4c8b601 --- /dev/null +++ b/OshimaBot.Content/Skills/被动/冰川增幅.cs @@ -0,0 +1,78 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Skills +{ + public class 冰川增幅 : Skill + { + public override long Id => (long)PassiveID.冰川增幅; + public override string Name => "冰川增幅"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + + public 冰川增幅(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 冰川增幅特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + public class 冰川增幅特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"普通攻击或技能命中敌人时,减少其 {行动速度减少:0.##} 点行动速度、{行动系数减少 * 100:0.##}% 行动系数与 {行动系数减少 * 100:0.##}% 加速系数,持续 {减速持续时间:0.##} {GameplayEquilibriumConstant.InGameTime};减速期间,{Skill.SkillOwner()}对其造成的伤害提升 {伤害提升 * 100:0.##}%。"; + + private double 行动速度减少 => Skill.Character != null ? 30 + Skill.Character.Level * 1.5 : 30; + private double 行动系数减少 => Skill.Character != null ? 0.15 + Skill.Character.Level * 0.002 : 0.15; + private double 减速持续时间 => Skill.Character != null ? 4 + Skill.Character.Level * 0.05 : 4; + private double 伤害提升 => Skill.Character != null ? 0.08 + Skill.Character.Level * 0.001 : 0.08; + + public override void AfterDamageCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return; + if (Skill.Character == null || Skill.Character != character) return; + if (ctx.DamageResult != DamageResult.Normal && ctx.DamageResult != DamageResult.Critical) return; + // 刷新减速(先移除旧减速,再上新的) + List olds = enemy.Effects.Where(e => e is DynamicsEffect && e.Name == nameof(冰川增幅) + "·减速").ToList(); + foreach (Effect e in olds) + { + enemy.Effects.Remove(e); + e.OnEffectLost(new HookContext(GamingQueue, enemy)); + } + WriteLine($"[ {character} ] 发动了冰川增幅![ {enemy} ] 的行动速度降低了!"); + Effect debuff = new DynamicsEffect(Skill, new Dictionary() + { + { "exspd", -行动速度减少 }, + { "exac", -行动系数减少 }, + { "exacc", -行动系数减少 } + }, character) + { + Name = nameof(冰川增幅) + "·减速", + Durative = true, + Duration = 减速持续时间 + }; + enemy.Effects.Add(debuff); + debuff.OnEffectGained(new HookContext(GamingQueue, enemy)); + debuff.IsDebuff = true; + } + + public override double AlterExpectedDamageBeforeCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return 0; + if (Skill.Character == null || Skill.Character != character) return 0; + if (enemy.Effects.Any(e => e is DynamicsEffect && e.Name == nameof(冰川增幅) + "·减速" && e.Source == character)) + { + return ctx.Damage * 伤害提升; + } + return 0; + } + } +} diff --git a/OshimaBot.Content/Skills/被动/刀光谍影.cs b/OshimaBot.Content/Skills/被动/刀光谍影.cs new file mode 100644 index 0000000..62a4324 --- /dev/null +++ b/OshimaBot.Content/Skills/被动/刀光谍影.cs @@ -0,0 +1,51 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.PassiveEffects; + +namespace OshimaBot.Content.Skills +{ + public class 刀光谍影 : Skill + { + public override long Id => (long)PassiveID.刀光谍影; + public override string Name => "刀光谍影"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + + public 刀光谍影(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 刀光谍影特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + public class 刀光谍影特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"造成伤害后,有 {触发概率 * 100:0.##}% 概率进入不可选中状态(免疫物理与魔法伤害、无法被普通攻击和技能选中),持续 {持续时间:0.##} {GameplayEquilibriumConstant.InGameTime}。"; + + private double 触发概率 => Skill.Character != null ? 0.2 + Skill.Character.Level * 0.002 : 0.2; + private double 持续时间 => Skill.Character != null ? 2 + Skill.Character.Level * 0.05 : 2; + + public override void AfterDamageCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return; + if (Skill.Character == null || Skill.Character != character) return; + if (ctx.DamageResult != DamageResult.Normal && ctx.DamageResult != DamageResult.Critical) return; + if (Random.NextDouble() > 触发概率) return; + if (character.Effects.Any(e => e is 完全免疫 && ReferenceEquals(e.Skill, Skill))) return; + WriteLine($"[ {character} ] 发动了刀光谍影,进入了不可选中状态!"); + Effect e = new 完全免疫(Skill, character, true, 持续时间, 0) + { + RemainDuration = 持续时间 + }; + character.Effects.Add(e); + e.OnEffectGained(new HookContext(GamingQueue, character)); + } + } +} diff --git a/OshimaBot.Content/Skills/被动/勇气之霎.cs b/OshimaBot.Content/Skills/被动/勇气之霎.cs new file mode 100644 index 0000000..b35c4c5 --- /dev/null +++ b/OshimaBot.Content/Skills/被动/勇气之霎.cs @@ -0,0 +1,64 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Skills +{ + public class 勇气之霎 : Skill + { + public override long Id => (long)PassiveID.勇气之霎; + public override string Name => "勇气之霎"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + + public 勇气之霎(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 勇气之霎特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + public class 勇气之霎特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"受到伤害时,有 {触发概率 * 100:0.##}% 概率在刹那之间获得勇气:提升 {生命偷取 * 100:0.##}% 生命偷取和 {攻击力提升 * 100:0.##}% 攻击力,持续 {持续时间:0.##} {GameplayEquilibriumConstant.InGameTime}。"; + + private double 触发概率 => Skill.Character != null ? 0.3 + Skill.Character.Level * 0.002 : 0.3; + private double 生命偷取 => Skill.Character != null ? 0.2 + Skill.Character.Level * 0.002 : 0.2; + private double 攻击力提升 => Skill.Character != null ? 0.2 + Skill.Character.Level * 0.002 : 0.2; + private double 持续时间 => Skill.Character != null ? 4 + Skill.Character.Level * 0.05 : 4; + + public override void AfterDamageCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character attacker || ctx.Enemy is not Character character) return; + if (Skill.Character == null || Skill.Character != character) return; + if (attacker == character) return; + if (ctx.ActualDamage <= 0) return; + if (Random.NextDouble() > 触发概率) return; + // 刷新勇气 buff(不叠加) + List olds = character.Effects.Where(e => e is DynamicsEffect && e.Name == nameof(勇气之霎) + "·勇气").ToList(); + foreach (Effect e in olds) + { + e.RemoveFromCharacter(character); + } + WriteLine($"[ {character} ] 勇气之霎触发!获得了生命偷取与攻击力提升!"); + Effect buff = new DynamicsEffect(Skill, new Dictionary() + { + { "exls", 生命偷取 }, + { "exatk2", 攻击力提升 } + }, character) + { + Name = nameof(勇气之霎) + "·勇气", + Durative = true, + Duration = 持续时间 + }; + buff.AddToCharacter(character); + } + } +} diff --git a/OshimaBot.Content/Skills/被动/反击螺旋.cs b/OshimaBot.Content/Skills/被动/反击螺旋.cs new file mode 100644 index 0000000..f12f717 --- /dev/null +++ b/OshimaBot.Content/Skills/被动/反击螺旋.cs @@ -0,0 +1,59 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Skills +{ + public class 反击螺旋 : Skill + { + public override long Id => (long)PassiveID.反击螺旋; + public override string Name => "反击螺旋"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + + public 反击螺旋(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 反击螺旋特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + public class 反击螺旋特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"受到伤害时,有 {触发概率 * 100:0.##}% 概率发动反击螺旋,对攻击者造成 {反击伤害:0.##} 点真实伤害,并对 {额外目标数} 个随机敌人同样造成 {反击伤害:0.##} 点真实伤害。"; + + private double 触发概率 => Skill.Character != null ? 0.3 + Skill.Character.Level * 0.002 : 0.3; + private double 反击伤害 => Skill.Character != null ? 50 + Skill.Character.Level * 5 + Skill.Character.ATK * 0.3 : 50; + private int 额外目标数 => 2; + + public override void AfterDamageCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character attacker || ctx.Enemy is not Character character) return; + if (Skill.Character == null || Skill.Character != character) return; + if (attacker == character) return; + if (ctx.ActualDamage <= 0) return; + if (Random.NextDouble() > 触发概率) return; + WriteLine($"[ {character} ] 发动了反击螺旋!"); + DamageToEnemy(character, attacker, DamageType.True, MagicType.None, 反击伤害, new(character) + { + TriggerEffects = false + }); + foreach (Character target in GamingQueue?.AllCharacters + .Where(c => c != character && c != attacker && c.HP > 0) + .OrderBy(_ => Random.Next()) + .Take(额外目标数) ?? []) + { + DamageToEnemy(character, target, DamageType.True, MagicType.None, 反击伤害, new(character) + { + TriggerEffects = false + }); + } + } + } +} diff --git a/OshimaBot.Content/Skills/被动/召唤艾黎.cs b/OshimaBot.Content/Skills/被动/召唤艾黎.cs new file mode 100644 index 0000000..c878be2 --- /dev/null +++ b/OshimaBot.Content/Skills/被动/召唤艾黎.cs @@ -0,0 +1,77 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Skills +{ + public class 召唤艾黎 : Skill + { + public override long Id => (long)PassiveID.召唤艾黎; + public override string Name => "召唤艾黎"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + + public 召唤艾黎(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 召唤艾黎特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + public class 召唤艾黎特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"普通攻击或技能命中敌人时,召唤艾黎飞向目标造成 {艾黎伤害:0.##} 点魔法伤害;当{Skill.SkillOwner()}生命值低于 {护盾生命阈值 * 100:0.##}% 且受到伤害时,艾黎会为{Skill.SkillOwner()}生成 {护盾值:0.##} 点混合护盾(每 {护盾冷却:0.##} {GameplayEquilibriumConstant.InGameTime}至多一次)。"; + + private double 剩余护盾冷却 = 0; + + private double 艾黎伤害 => Skill.Character != null ? 45 + Skill.Character.Level * 4 + Skill.Character.PrimaryAttributeValue * 0.35 : 45; + private double 护盾生命阈值 => 0.5; + private double 护盾值 => Skill.Character != null ? 60 + Skill.Character.Level * 9 : 60; + // 平衡调整(2026-09-22):护盾再生间隔 Lv60 6.2s → 25s(标尺 ≥25s;样板:海妖外壳 35s) + private double 护盾冷却 => Skill.Character != null ? 31 - Skill.Character.Level * 0.1 : 31; + + public override void AfterDamageCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return; + if (Skill.Character == null) return; + if (Skill.Character == character && enemy.HP > 0) + { + // 出伤侧:艾黎飞向敌人造成额外魔法伤害 + if (ctx.DamageResult != DamageResult.Normal && ctx.DamageResult != DamageResult.Critical) return; + WriteLine($"[ {character} ] 发动了召唤艾黎!艾黎飞向 [ {enemy} ] 造成了 {艾黎伤害:0.##} 点魔法伤害!"); + DamageToEnemy(character, enemy, DamageType.Magical, ctx.MagicType, 艾黎伤害, new(character) + { + TriggerEffects = false + }); + } + else if (Skill.Character == enemy) + { + // 受击侧:低血量时艾黎提供护盾 + if (character == enemy) return; + if (剩余护盾冷却 > 0) return; + if (enemy.HP / enemy.MaxHP >= 护盾生命阈值) return; + 剩余护盾冷却 = 护盾冷却; + WriteLine($"[ {enemy} ] 受到了攻击,艾黎为其生成 {护盾值:0.##} 点混合护盾!"); + enemy.Shield.Mix += 护盾值; + GamingQueue?.AddApplyEffects(enemy, EffectType.Shield); + } + } + + public override void OnTimeElapsed(TimeLapseContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (剩余护盾冷却 > 0) + { + 剩余护盾冷却 -= ctx.Elapsed; + if (剩余护盾冷却 < 0) 剩余护盾冷却 = 0; + } + } + } +} diff --git a/OshimaBot.Content/Skills/被动/同袍之誓.cs b/OshimaBot.Content/Skills/被动/同袍之誓.cs new file mode 100644 index 0000000..18c42d8 --- /dev/null +++ b/OshimaBot.Content/Skills/被动/同袍之誓.cs @@ -0,0 +1,79 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Skills +{ + /// + /// 通用被动 · 辅助型【同袍之誓】—— 队友阵亡触发的团队增益 + /// 设计意图:五类辅助原型中的「牺牲回响」。队友倒下时全队化悲愤为力量。 + /// 触发:(全队列广播 —— 这是辅助被动能观察到「队友出事」的少数钩子之一) + /// 效果:全体存活队友获得攻击力 / 行动系数 / 加速系数提升并回复少量生命;同名刷新,不叠加 + /// 标尺(手册 §6.4 被动·减益/承伤、增益 ≤36%):单项 10%,三项均为增益类而非永久成长 ✓ + /// + public class 同袍之誓 : Skill + { + public override long Id => (long)PassiveID.同袍之誓; + public override string Name => "同袍之誓"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + + public 同袍之誓(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 同袍之誓特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + public class 同袍之誓特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => + $"每当一名队友阵亡,全体存活队友获得 {攻击提升 * 100:0.##}% 攻击力、{行动系数提升 * 100:0.##}% 行动系数与加速系数," + + $"并回复 {回复系数 * 100:0.##}% 最大生命值,持续 {持续时间:0.##} {GameplayEquilibriumConstant.InGameTime}(同名刷新,不叠加)。"; + + private double 攻击提升 => Skill.Character != null ? 0.06 + Skill.Character.Level * 0.0007 : 0.06; + private double 行动系数提升 => Skill.Character != null ? 0.06 + Skill.Character.Level * 0.0007 : 0.06; + private double 回复系数 => 0.05; + private const double 持续时间 = 20; + + public override void AfterDeathCalculation(DeathContext ctx) + { + if (ctx.Trigger is not Character died) return; + if (Skill.Character == null) return; + Character self = Skill.Character; + if (died == self) return; + // 召唤物/随从不计 + if (ctx.HasMaster) return; + if (GamingQueue == null) return; + if (!GamingQueue.IsTeammate(self, died)) return; + WriteLine($"[ {self} ] 的同袍之誓因 [ {died} ] 的阵亡而燃起!全体存活队友获得增益!"); + foreach (Character ally in GamingQueue.GetTeammates(self).Where(c => c.HP > 0 && c != self)) + { + // 同名刷新:先移除旧实例再套用,避免叠加 + List olds = [.. ally.Effects.Where(e => e is DynamicsEffect && e.Name == nameof(同袍之誓) + "·誓约")]; + foreach (Effect old in olds) old.RemoveFromCharacter(ally); + Effect buff = new DynamicsEffect(Skill, new Dictionary() + { + { "exatk2", 攻击提升 }, + { "exac", 行动系数提升 }, + { "exacc", 行动系数提升 } + }, self) + { + Name = nameof(同袍之誓) + "·誓约", + Durative = true, + Duration = 持续时间 + }; + buff.AddToCharacter(ally); + double heal = ally.MaxHP * 回复系数; + HealToTarget(self, ally, heal); + } + } + } +} diff --git a/OshimaBot.Content/Skills/被动/奥术彗星.cs b/OshimaBot.Content/Skills/被动/奥术彗星.cs new file mode 100644 index 0000000..304dcd3 --- /dev/null +++ b/OshimaBot.Content/Skills/被动/奥术彗星.cs @@ -0,0 +1,63 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Skills +{ + public class 奥术彗星 : Skill + { + public override long Id => (long)PassiveID.奥术彗星; + public override string Name => "奥术彗星"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + + public 奥术彗星(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 奥术彗星特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + public class 奥术彗星特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"技能命中敌人时,召唤奥术彗星造成 {彗星伤害:0.##} 点魔法伤害。彗星每 {冷却时间:0.##} {GameplayEquilibriumConstant.InGameTime}只能发动一次。"; + + private double 剩余冷却 = 0; + + private double 冷却时间 => Skill.Character != null ? Math.Max(3, 8 - Skill.Character.Level * 0.05) : 8; + // 平衡调整(2026-09-22):Lv60 501.58 → 359.65(−28%)。 + // 锚:与「已测试基线」征服者的每局总贡献对齐(征服者 23.7k/局,奥术彗星原 31.7k/局 = 1.34×)。 + // 注:不采用「加 CD」——实测技能命中 63 次/局、平均间隔 12.4s,CD 5s 完全不拦,加 CD 到 12.4s 前无效。 + private double 彗星伤害 => Skill.Character != null ? 60 + Skill.Character.Level * 4 + Skill.Character.PrimaryAttributeValue * 0.5 : 60; + + public override void AfterDamageCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return; + if (Skill.Character == null || Skill.Character != character) return; + if (ctx.IsNormalAttack) return; + if (ctx.DamageResult != DamageResult.Normal && ctx.DamageResult != DamageResult.Critical) return; + if (剩余冷却 > 0) return; + 剩余冷却 = 冷却时间; + WriteLine($"[ {character} ] 发动了奥术彗星!对 [ {enemy} ] 造成了 {彗星伤害:0.##} 点魔法伤害!"); + DamageToEnemy(character, enemy, DamageType.Magical, ctx.MagicType, 彗星伤害, new(character) + { + TriggerEffects = false + }); + } + + public override void OnTimeElapsed(TimeLapseContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (剩余冷却 > 0) + { + 剩余冷却 -= ctx.Elapsed; + } + } + } +} diff --git a/OshimaBot.Content/Skills/被动/守护者.cs b/OshimaBot.Content/Skills/被动/守护者.cs new file mode 100644 index 0000000..8740b06 --- /dev/null +++ b/OshimaBot.Content/Skills/被动/守护者.cs @@ -0,0 +1,95 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Skills +{ + public class 守护者 : Skill + { + public override long Id => (long)PassiveID.守护者; + public override string Name => "守护者"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + + public 守护者(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 守护者特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + public class 守护者特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"在 {观察窗口:0.##} {GameplayEquilibriumConstant.InGameTime}内累计受到超过最大生命值 {触发阈值 * 100:0.##}% 的伤害时,立即获得 {护盾系数 * 100:0.##}% 最大生命值 [ {Skill.Character?.MaxHP * 护盾系数:0.##} ] 的混合护盾和行动加速,持续 {强化持续时间:0.##} {GameplayEquilibriumConstant.InGameTime}。触发后进入 {冷却时间:0.##} {GameplayEquilibriumConstant.InGameTime}冷却。"; + + private double 累计伤害 = 0; + private double 剩余窗口 = 0; + private double 剩余冷却 = 0; + + private double 观察窗口 => 2.5; + private double 触发阈值 => Skill.Character != null ? 0.08 + Skill.Character.Level * 0.001 : 0.08; + private double 护盾系数 => Skill.Character != null ? 0.12 + Skill.Character.Level * 0.002 : 0.12; + private double 强化持续时间 => Skill.Character != null ? 4 + Skill.Character.Level * 0.1 : 4; + private double 行动速度提升 => Skill.Character != null ? 0.2 + Skill.Character.Level * 0.003 : 0.2; + // 平衡调整(2026-09-22):护盾冷却 Lv60 11s → 25s(标尺 ≥25s) + private double 冷却时间 => Skill.Character != null ? 37 - Skill.Character.Level * 0.2 : 37; + + public override void AfterDamageCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character attacker || ctx.Enemy is not Character character) return; + if (Skill.Character == null || Skill.Character != character) return; + if (attacker == character) return; + if (ctx.ActualDamage <= 0) return; + if (剩余冷却 > 0) return; + // 受击窗口内累计 + 剩余窗口 = 观察窗口; + 累计伤害 += ctx.ActualDamage; + if (累计伤害 >= character.MaxHP * 触发阈值) + { + 累计伤害 = 0; + 剩余窗口 = 0; + 剩余冷却 = 冷却时间; + double shield = character.MaxHP * 护盾系数; + WriteLine($"[ {character} ] 发动了守护者!获得 {shield:0.##} 点混合护盾和行动加速!"); + character.Shield.Mix += shield; + GamingQueue?.AddApplyEffects(character, EffectType.Shield); + Effect e = new DynamicsEffect(Skill, new Dictionary() + { + { "exac", 行动速度提升 }, + { "exacc", 行动速度提升 } + }, character) + { + Name = nameof(守护者) + "·守护", + Durative = true, + Duration = 强化持续时间 + }; + character.Effects.Add(e); + e.OnEffectGained(new HookContext(GamingQueue, character)); + } + } + + public override void OnTimeElapsed(TimeLapseContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (剩余窗口 > 0) + { + 剩余窗口 -= ctx.Elapsed; + if (剩余窗口 <= 0) + { + 累计伤害 = 0; + } + } + if (剩余冷却 > 0) + { + 剩余冷却 -= ctx.Elapsed; + } + } + } +} diff --git a/OshimaBot.Content/Skills/被动/幽冥剧毒.cs b/OshimaBot.Content/Skills/被动/幽冥剧毒.cs new file mode 100644 index 0000000..fa9e77c --- /dev/null +++ b/OshimaBot.Content/Skills/被动/幽冥剧毒.cs @@ -0,0 +1,63 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.PassiveEffects; + +namespace OshimaBot.Content.Skills +{ + public class 幽冥剧毒 : Skill + { + public override long Id => (long)PassiveID.幽冥剧毒; + public override string Name => "幽冥剧毒"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + + public 幽冥剧毒(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 幽冥剧毒特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + public class 幽冥剧毒特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"普通攻击命中后,为目标附加幽冥剧毒:每{GameplayEquilibriumConstant.InGameTime}造成目标已损失生命值 {剧毒比例 * 100:0.##}% 的魔法伤害,持续 {持续时间:0.##} {GameplayEquilibriumConstant.InGameTime}。"; + + private double 持续时间 => Skill.Character != null ? 3 + Skill.Character.Level * 0.05 : 3; + // 平衡调整(2026-09-22):已损失生命真伤 Lv60 7%/秒×6s=42% → 2%/秒×6s=12%(对标八叶灭杀整改后 12%) + private double 剧毒比例 => Skill.Character != null ? 0.005 + Skill.Character.Level * 0.00025 : 0.005; + + public override void AfterDamageCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return; + if (Skill.Character == null || Skill.Character != character) return; + if (!ctx.IsNormalAttack) return; + if (ctx.DamageResult != DamageResult.Normal && ctx.DamageResult != DamageResult.Critical) return; + if (enemy.HP <= 0) return; + // 已有剧毒则刷新持续时间 + if (enemy.Effects.Any(e => e is 持续伤害 && ReferenceEquals(e.Skill, Skill))) + { + foreach (Effect e in enemy.Effects.Where(e => e is 持续伤害 && ReferenceEquals(e.Skill, Skill)).ToList()) + { + e.RemainDuration = 持续时间; + } + return; + } + // 已损失生命值:以挂上瞬间的差值作为固定毒伤数值 + double missing = enemy.MaxHP - enemy.HP; + WriteLine($"[ {character} ] 对 [ {enemy} ] 附加了幽冥剧毒!(基于 {missing:0.##} 点已损失生命值)"); + Effect dot = new 持续伤害(Skill, enemy, character, true, 持续时间, 0, false, missing * 剧毒比例, 0, DamageType.Magical) + { + RemainDuration = 持续时间 + }; + enemy.Effects.Add(dot); + dot.OnEffectGained(new HookContext(GamingQueue, enemy)); + } + } +} diff --git a/OshimaBot.Content/Skills/被动/强攻.cs b/OshimaBot.Content/Skills/被动/强攻.cs new file mode 100644 index 0000000..e2e97d0 --- /dev/null +++ b/OshimaBot.Content/Skills/被动/强攻.cs @@ -0,0 +1,82 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.EffectResult; +using OshimaBot.Content.Effects.PassiveEffects; + +namespace OshimaBot.Content.Skills +{ + public class 强攻 : Skill + { + public override long Id => (long)PassiveID.强攻; + public override string Name => "强攻"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + + public 强攻(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 强攻特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + public class 强攻特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"连续 3 次普通攻击同一目标时,造成额外的 {额外伤害系数 * 100:0.##}% 伤害并使其进入易损状态,后续承受伤害提升 {易损伤害提升百分比 * 100:0.##}%,持续 {易损持续时间:0.##} {GameplayEquilibriumConstant.InGameTime}。"; + + private double 易损伤害提升百分比 => Skill.Character != null ? 0.15 + Skill.Character.Level * 0.004 : 0.15; + private double 额外伤害系数 => Skill.Character != null ? 0.06 + Skill.Character.Level * 0.005 : 0.06; + private double 易损持续时间 => Skill.Character != null ? 15 + Skill.Character.Level * 0.1 : 15; + + private int 目标连续攻击次数 = 0; + private Character? 当前目标 = null; + + public override AlterActualDamageResult AlterActualDamageAfterCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return default; + double damage = ctx.Damage; + bool isNormalAttack = ctx.IsNormalAttack; + DamageType damageType = ctx.DamageType; + MagicType magicType = ctx.MagicType; + DamageResult damageResult = ctx.DamageResult; + Dictionary totalDamageBonus = ctx.TotalDamageBonus; + if (Skill.Character != null && Skill.Character == character && isNormalAttack && (damageResult == DamageResult.Normal || damageResult == DamageResult.Critical)) + { + if (当前目标 != enemy) + { + 目标连续攻击次数 = 0; + 当前目标 = enemy; + } + + 目标连续攻击次数++; + + if (目标连续攻击次数 == 3) + { + double 额外伤害 = damage * 额外伤害系数; + WriteLine($"[ {character} ] 发动了强攻!将额外造成 {额外伤害:0.##} 点伤害!"); + 目标连续攻击次数 = 0; + WriteLine($"[ {character} ] 对 [ {enemy} ] 施加了易损状态![ {enemy} ] 的承受伤害提升 {易损伤害提升百分比 * 100:0.##}%!"); + 施加易损状态(character, enemy); + return new AlterActualDamageResult { DamageDelta = 额外伤害 }; + + } + } + return default; + + } + + private void 施加易损状态(Character character, Character target) + { + Effect e = new 易损(Skill, target, character, true, 易损持续时间, 0, 易损伤害提升百分比); + target.Effects.Add(e); + e.OnEffectGained(new HookContext(GamingQueue, target)); + RecordCharacterApplyEffects(target, EffectType.Vulnerable); + } + } +} diff --git a/OshimaBot.Content/Skills/被动/征服者.cs b/OshimaBot.Content/Skills/被动/征服者.cs new file mode 100644 index 0000000..4f06265 --- /dev/null +++ b/OshimaBot.Content/Skills/被动/征服者.cs @@ -0,0 +1,132 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Skills +{ + public class 征服者 : Skill + { + public override long Id => (long)PassiveID.征服者; + public override string Name => "征服者"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + + public 征服者(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 征服者特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + public class 征服者特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"每次普通攻击和技能造成伤害时,叠加 1 层征服者层数,每层提供 {真实伤害:0.##} 点真实伤害和 {额外核心属性:0.##} 点额外核心属性。" + + $"限制:每个回合只能触发一次征服者叠加层数和一次真实伤害的效果。当叠满 4 层时,为下一次造成伤害提供额外的 {满层伤害:0.##} 点真实伤害,随后重置已叠层数。" + + $"{(层数 > 0 ? $"(当前 {层数} 层,共 {真实伤害 * 层数:0.##} 点真实伤害和 {累计增加:0.##} 点核心属性)" : "")}"; + + public int 层数 { get; set; } = 0; + private double 真实伤害 => Skill.Character != null ? 35 + Skill.Character.Level * 1.35 : 0; + private double 额外核心属性 => Skill.Character != null ? 2 + Skill.Character.Level * 0.1 : 0; + private double 满层伤害 => Skill.Character != null ? 140 + Skill.Character.Level * 5.8 : 0; + private bool 是否是叠加伤害 = false; + private bool 是否是满层伤害 = false; + private bool 允许叠层 = true; + private PrimaryAttribute 核心属性 = PrimaryAttribute.None; + private double 累计增加 = 0; + + public override void AfterDamageCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return; + double damage = ctx.Damage; + double actualDamage = ctx.ActualDamage; + bool isNormalAttack = ctx.IsNormalAttack; + DamageType damageType = ctx.DamageType; + MagicType magicType = ctx.MagicType; + DamageResult damageResult = ctx.DamageResult; + if (Skill.Character != null && Skill.Character == character && (damageResult == DamageResult.Normal || damageResult == DamageResult.Critical)) + { + if (!是否是满层伤害 && 层数 == 4 && enemy.HP > 0) + { + 是否是满层伤害 = true; + 是否是叠加伤害 = true; + WriteLine($"[ {character} ] 发动了征服者的满层效果!"); + DamageToEnemy(character, enemy, DamageType.True, magicType, 满层伤害, new(character) + { + TriggerEffects = false + }); + ClearExPrimaryAttribute(character); + 层数 = 0; + 允许叠层 = false; + } + if (!是否是满层伤害 && !是否是叠加伤害 && 层数 < 4) + { + if (允许叠层) + { + 允许叠层 = false; + ClearExPrimaryAttribute(character); + 层数++; + 核心属性 = character.PrimaryAttribute; + 累计增加 = 额外核心属性 * 层数; + switch (核心属性) + { + case PrimaryAttribute.AGI: + character.ExAGI += 累计增加; + break; + case PrimaryAttribute.INT: + character.ExINT += 累计增加; + break; + default: + character.ExSTR += 累计增加; + break; + } + WriteLine($"[ {character} ] 的征服者层数:{层数},获得了 {累计增加:0.##} 点核心属性({CharacterSet.GetPrimaryAttributeName(核心属性)})加成。"); + if (层数 > 0 && enemy.HP > 0) + { + 是否是叠加伤害 = true; + WriteLine($"[ {character} ] 发动了征服者!"); + DamageToEnemy(character, enemy, DamageType.True, magicType, 真实伤害 * 层数, new(character) + { + TriggerEffects = false + }); + } + } + } + } + } + + public override void OnTurnEnd(TurnContext ctx) + { + if (ctx.Trigger is not Character character) return; + 是否是叠加伤害 = false; + 是否是满层伤害 = false; + 允许叠层 = true; + } + + private void ClearExPrimaryAttribute(Character character) + { + if (核心属性 != PrimaryAttribute.None) + { + switch (核心属性) + { + case PrimaryAttribute.AGI: + character.ExAGI -= 累计增加; + break; + case PrimaryAttribute.INT: + character.ExINT -= 累计增加; + break; + default: + character.ExSTR -= 累计增加; + break; + } + 核心属性 = PrimaryAttribute.None; + 累计增加 = 0; + } + } + } +} diff --git a/OshimaBot.Content/Skills/被动/恩赐解脱.cs b/OshimaBot.Content/Skills/被动/恩赐解脱.cs new file mode 100644 index 0000000..8201c13 --- /dev/null +++ b/OshimaBot.Content/Skills/被动/恩赐解脱.cs @@ -0,0 +1,49 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.EffectResult; + +namespace OshimaBot.Content.Skills +{ + public class 恩赐解脱 : Skill + { + public override long Id => (long)PassiveID.恩赐解脱; + public override string Name => "恩赐解脱"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + + public 恩赐解脱(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 恩赐解脱特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + public class 恩赐解脱特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"在普通攻击暴击时,有 {触发概率 * 100:0.##}% 概率将伤害提升 {暴击伤害提升 * 100:0.##}%。"; + + private double 触发概率 => 0.15; + private double 暴击伤害提升 => Skill.Character != null ? 0.2 + (Skill.Character.Level - 1) * 0.05 : 0.2; + + public override AlterActualDamageResult AlterActualDamageAfterCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Trigger != Skill.Character) return default; + if (!ctx.IsNormalAttack || ctx.DamageResult != DamageResult.Critical) return default; + if (Random.NextDouble() > 触发概率) return default; + double damage = ctx.Damage; + double exDamage = damage * 暴击伤害提升; + WriteLine($"[ {character} ] 发动了恩赐解脱!伤害提升了 {暴击伤害提升 * 100:0.##}%,额外造成 {exDamage:0.##} 点伤害!"); + return new() + { + DamageDelta = exDamage + }; + } + } +} diff --git a/OshimaBot.Content/Skills/被动/战地巡诊.cs b/OshimaBot.Content/Skills/被动/战地巡诊.cs new file mode 100644 index 0000000..c127262 --- /dev/null +++ b/OshimaBot.Content/Skills/被动/战地巡诊.cs @@ -0,0 +1,102 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Skills +{ + /// + /// 通用被动 · 辅助型【战地巡诊】—— 周期治疗 + 净化 + /// 设计意图:五类辅助原型中的「战场医疗」。不依赖任何事件,纯周期巡视,最稳定的一种辅助。 + /// 触发:时间流逝(),每 40 秒巡视一次 + /// 效果:为生命值最低的队友回复生命值;若其处于重伤(低于阈值)则额外弱驱散其减益 + /// 标尺(手册 §6.4 被动·回复 ≤2–3%/秒):8.4% 最大生命值 / 40 秒 ⇒ 约 0.21%/秒 ✓ + /// + public class 战地巡诊 : Skill + { + public override long Id => (long)PassiveID.战地巡诊; + public override string Name => "战地巡诊"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + + public 战地巡诊(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 战地巡诊特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + public class 战地巡诊特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + /// + /// 声明弱驱散能力: 在 == None 时会直接返回 + /// + public override DispelType DispelType => DispelType.Weak; + public override string Description => + $"每 {巡诊间隔:0.##} {GameplayEquilibriumConstant.InGameTime}为生命值最低的队友回复 {回复系数 * 100:0.##}% 最大生命值;" + + $"若该队友生命值低于 {重伤阈值 * 100:0.##}%,额外对其执行一次弱驱散(清除减益)。"; + + private double 剩余间隔 = 0; + + private double 回复系数 => Skill.Character != null ? 0.06 + Skill.Character.Level * 0.0004 : 0.06; + private double 重伤阈值 => 0.35; + /// + /// 巡诊间隔:30 → 40 秒(2026-09-23 平衡修订,Admin 指出 30 秒一次「稍廉价」)。 + /// 8.4% 最大生命值 / 40 秒 ⇒ 约 0.21%/秒,比 2–3%/秒 的上限低一个数量级。 + /// + private const double 巡诊间隔 = 40; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (Skill.Character == null || Skill.Character != character) return; + 剩余间隔 = 巡诊间隔; + } + + public override void OnTimeElapsed(TimeLapseContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (Skill.Character == null || Skill.Character != character) return; + 剩余间隔 -= ctx.Elapsed; + if (剩余间隔 > 0) return; + Character? target = 最低生命队友(character); + if (target == null) + { + 剩余间隔 = 巡诊间隔; + return; + } + 剩余间隔 = 巡诊间隔; + double heal = target.MaxHP * 回复系数; + WriteLine($"[ {character} ] 展开了战地巡诊,为 [ {target} ] 回复 {heal:0.##} 点生命值!"); + HealToTarget(character, target, heal); + if (target.HP / Math.Max(1, target.MaxHP) < 重伤阈值) + { + WriteLine($"[ {character} ] 的战地巡诊对重伤的 [ {target} ] 执行了弱驱散!"); + Dispel(character, target, false); + } + } + + /// + /// 生命值百分比最低的存活队友;若其生命值已接近满值(≥)则视为无需治疗,返回 null + /// + private Character? 最低生命队友(Character self) + { + if (GamingQueue == null) return null; + Character? target = GamingQueue.GetTeammates(self) + .Where(c => c.HP > 0 && c != self) + .OrderBy(c => c.HP / Math.Max(1, c.MaxHP)) + .FirstOrDefault(); + if (target == null) return null; + if (target.HP / Math.Max(1, target.MaxHP) >= 有效治疗阈值) return null; + return target; + } + + /// 有效治疗阈值:队友生命值低于该比例才展开巡诊,避免满血空放 + private const double 有效治疗阈值 = 0.95; + } +} diff --git a/OshimaBot.Content/Skills/被动/战术余裕.cs b/OshimaBot.Content/Skills/被动/战术余裕.cs new file mode 100644 index 0000000..2429788 --- /dev/null +++ b/OshimaBot.Content/Skills/被动/战术余裕.cs @@ -0,0 +1,69 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; + +namespace OshimaBot.Content.Skills +{ + /// + /// 通用被动 · 节奏型【战术余裕】—— 自动补充决策点 + /// 设计意图:本项目首个作用于**决策点**的被动。此前所有"多做事"的设计都走「配额」 + /// (`疾走`/`闪现` 是对战技本身消耗的**返还**,`咒怨洪流` 才是真给配额但**需要决策点足够**)。 + /// 而实测表明 **DP 是硬约束、配额是软约束**(AI 行动循环持续到 `CurrentDecisionPoints` 耗尽, + /// 见 `GamingQueue.cs:1201`)⇒ **给配额而不给 DP 等于空给**。 + /// 本被动直接补 DP,且**不依赖 AI 主动选择**(自动触发),因此是"给 DP"最可靠的载体。 + /// 触发:自身回合开始,每 个自身回合补一次 + /// 效果:+2 决策点(封顶到 `MaxDecisionPoints`) + /// 数值依据:稳态每回合恢复 `max(1, Max/2)` = 3 点 ⇒ 本被动折算 2/3 ≈ **+22% 决策点供给**。 + /// 注意它**不是**「每回合 +1」—— `RecoverDecisionPointsPerRound` 是死配置 + /// (恢复逻辑硬编码 `max(1, Max/2)`,从不读该字段),故只能经 `OnTurnStart` 自行补充。 + /// + public class 战术余裕 : Skill + { + public override long Id => (long)PassiveID.战术余裕; + public override string Name => "战术余裕"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + + public 战术余裕(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 战术余裕特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + public class 战术余裕特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => + $"每经过 {触发周期} 个自身回合,补充 {补充量} 点决策点(不超过决策点上限)。"; + + private int _累计回合 = 0; + + /// 触发周期(自身回合数) + private const int 触发周期 = 3; + + /// 每次补充量(≈ 半次战技 / 两次普攻) + private const int 补充量 = 2; + + public override void OnTurnStart(TurnContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (Skill.Character is null || Skill.Character != character) return; + if (++_累计回合 < 触发周期) return; + _累计回合 = 0; + if (GamingQueue is null) return; + if (!GamingQueue.CharacterDecisionPoints.TryGetValue(character, out DecisionPoints? dp) || dp is null) return; + int before = dp.CurrentDecisionPoints; + dp.CurrentDecisionPoints = Math.Min(before + 补充量, dp.MaxDecisionPoints); + int actual = dp.CurrentDecisionPoints - before; + string tail = actual < 补充量 ? $"(决策点已接近上限,溢出 {补充量 - actual} 点未生效)" : ""; + WriteLine($"[ {character} ] 凭借战术余裕补充了 {actual} 点决策点({before} → {dp.CurrentDecisionPoints} / {dp.MaxDecisionPoints}){tail}"); + } + } +} diff --git a/OshimaBot.Content/Skills/被动/折射.cs b/OshimaBot.Content/Skills/被动/折射.cs new file mode 100644 index 0000000..3c84498 --- /dev/null +++ b/OshimaBot.Content/Skills/被动/折射.cs @@ -0,0 +1,60 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.EffectResult; + +namespace OshimaBot.Content.Skills +{ + public class 折射 : Skill + { + public override long Id => (long)PassiveID.折射; + public override string Name => "折射"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + + public 折射(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 折射特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + public class 折射特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"受到伤害时,减少 {减伤比例 * 100:0.##}% 的伤害,并将此次实际伤害的 {反弹比例 * 100:0.##}% 反弹给攻击者(真实伤害)。"; + + private double 减伤比例 => Skill.Character != null ? 0.12 + Skill.Character.Level * 0.001 : 0.12; + private double 反弹比例 => Skill.Character != null ? 0.2 + Skill.Character.Level * 0.002 : 0.2; + + public override AlterActualDamageResult AlterActualDamageAfterCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character attacker || ctx.Enemy is not Character character) return default; + if (Skill.Character == null || Skill.Character != character) return default; + if (attacker == character) return default; + if (ctx.DamageResult != DamageResult.Normal && ctx.DamageResult != DamageResult.Critical) return default; + double reduce = ctx.Damage * 减伤比例; + return new AlterActualDamageResult { DamageDelta = -reduce }; + } + + public override void AfterDamageCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character attacker || ctx.Enemy is not Character character) return; + if (Skill.Character == null || Skill.Character != character) return; + if (attacker == character) return; + if (ctx.ActualDamage <= 0) return; + double bounce = ctx.ActualDamage * 反弹比例; + if (bounce <= 0) return; + WriteLine($"[ {character} ] 发动了折射!将 {bounce:0.##} 点伤害反弹给了 [ {attacker} ]!"); + DamageToEnemy(character, attacker, DamageType.True, MagicType.None, bounce, new(character) + { + TriggerEffects = false + }); + } + } +} diff --git a/OshimaBot.Content/Skills/被动/掠夺者.cs b/OshimaBot.Content/Skills/被动/掠夺者.cs new file mode 100644 index 0000000..9725872 --- /dev/null +++ b/OshimaBot.Content/Skills/被动/掠夺者.cs @@ -0,0 +1,91 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Skills +{ + /// + /// 掠夺者:围绕【回合奖励】系统打造的被动 + /// · 成功夺取他人回合奖励时,永久叠加攻击力(对应 的夺取者视角) + /// · 自身回合奖励被他人夺走时,获得短暂攻击力与行动速度加成(原持有者视角) + /// · 同一份 会同时流经原持有者与夺取者的特效,故两种视角都可在本被动中处理 + /// + public class 掠夺者 : Skill + { + public override long Id => (long)PassiveID.掠夺者; + public override string Name => "掠夺者"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + + public 掠夺者(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 掠夺者特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + public class 掠夺者特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => + $"每当自身成功夺取他人的回合奖励时,永久获得 {单层攻击加成 * 100:0.##}% 攻击力(最多 {最大层数} 层,当前 {掠夺层数} 层);" + + $"当自身的回合奖励被他人夺走时,获得 {复仇攻击加成 * 100:0.##}% 攻击力与 {复仇速度加成:0.##} 点行动速度,持续 {复仇持续回合} 回合。"; + public override DispelledType DispelledType => DispelledType.CannotBeDispelled; + + private const double 单层攻击加成 = 0.06; + private const int 最大层数 = 5; + private const double 复仇攻击加成 = 0.1; + private const double 复仇速度加成 = 45; + private const int 复仇持续回合 = 2; + + public int 掠夺层数 { get; private set; } = 0; + + public override void OnRoundRewardStolen(RoundRewardContext ctx) + { + if (Skill.Character is not Character self || ctx.Skills.Count == 0) return; + + // 夺取者视角:自己成功夺取了别人的奖励 + if (ctx.Thief == self && ctx.From is not null && ctx.From != self) + { + if (掠夺层数 >= 最大层数) + { + WriteLine($"[ {self} ] 的掠夺者层数已达上限({最大层数} 层)。"); + return; + } + 掠夺层数++; + self.ExATKPercentage += 单层攻击加成; + GamingQueue?.AddApplyEffects(self, EffectType.DamageBoost); + WriteLine($"[ {self} ] 发动掠夺者,永久获得 {单层攻击加成 * 100:0.##}% 攻击力({掠夺层数}/{最大层数} 层)!"); + } + // 原持有者视角:自己的奖励被别人抢走了 + else if (ctx.From == self && ctx.Thief is not null && ctx.Thief != self) + { + ExATK2 攻击加成 = new(Skill, new() { { "exatk", 复仇攻击加成 } }, self) + { + Name = Name, + Durative = false, + DurationTurn = 复仇持续回合, + EffectType = EffectType.DamageBoost + }; + 攻击加成.AddToCharacter(self); + + ExSPD 速度加成 = new(Skill, new() { { "exspd", 复仇速度加成 } }, self) + { + Name = Name, + Durative = false, + DurationTurn = 复仇持续回合 + }; + 速度加成.AddToCharacter(self); + + GamingQueue?.AddApplyEffects(self, EffectType.DamageBoost); + WriteLine($"[ {self} ] 的回合奖励被 [ {ctx.Thief} ] 夺走,获得复仇:攻击力 +{复仇攻击加成 * 100:0.##}%、行动速度 +{复仇速度加成:0.##},持续 {复仇持续回合} 回合!"); + } + } + } +} diff --git a/OshimaBot.Content/Skills/被动/援护号令.cs b/OshimaBot.Content/Skills/被动/援护号令.cs new file mode 100644 index 0000000..f1aadb2 --- /dev/null +++ b/OshimaBot.Content/Skills/被动/援护号令.cs @@ -0,0 +1,96 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Skills +{ + /// + /// 通用被动 · 辅助型【援护号令】—— 自身回合开始时的团队机动增益 + /// 设计意图:五类辅助原型中的「指挥号令」。自身每次行动前把机动性分给队友。 + /// 触发:自身回合开始(),且号令已就绪(内部冷却) + /// 效果:为全体队友(不含自己)提升**行动系数**,持续到队友下一次出手 + /// 标尺(手册 §6.4 被动·增益 ≤36%):行动系数 +12%(Lv60)✓ + /// ⚠ 平衡修订(2026-09-23,Admin 指出): + /// + /// **不再给行动速度**:`ActionCoefficient = SPD / SPDUpperLimit + ExActionCoefficient`(`SPDUpperLimit = 1500`), + /// +12 速度只等于 +0.8% 行动系数,被 +8% 淹没 10 倍 —— 二者本就是同一个指标,重复且无意义。 + /// **持续时间必须远短于内部冷却**:角色约 7.6 秒行动一次,原「30 秒 buff + 每次刷新」必然常驻 ⇒ + /// 改为「12 秒持续 / 35 秒冷却」,覆盖率约 1/3,语义回到"一次号令 = 一波冲锋"。 + /// + /// + public class 援护号令 : Skill + { + public override long Id => (long)PassiveID.援护号令; + public override string Name => "援护号令"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + + public 援护号令(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 援护号令特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + public class 援护号令特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => + $"自身回合开始时,若号令已就绪,全体队友(不含自己)提升 {行动系数提升 * 100:0.##}% 行动系数," + + $"持续 {持续时间:0.##} {GameplayEquilibriumConstant.InGameTime};" + + $"号令每 {冷却时间:0.##} {GameplayEquilibriumConstant.InGameTime}至多下达一次(同名刷新,不叠加)。"; + + private double 剩余冷却 = 0; + + /// 行动系数提升(Lv60 = 12%)。只加 `exac`,不再叠加 `exspd` —— 见类注释。 + private double 行动系数提升 => Skill.Character != null ? 0.06 + Skill.Character.Level * 0.001 : 0.06; + + /// 持续 12 秒 ≈ 覆盖队友一次出手(队友行动间隔 7–10 秒),不足以常驻 + private const double 持续时间 = 12; + + /// 冷却 35 秒 ≫ 持续 12 秒 ⇒ 覆盖率约 1/3,杜绝「每次自身回合都刷新」的常驻化 + private const double 冷却时间 = 35; + + public override void OnTurnStart(TurnContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (Skill.Character == null || Skill.Character != character) return; + if (GamingQueue == null) return; + if (剩余冷却 > 0) return; + List allies = [.. GamingQueue.GetTeammates(character).Where(c => c.HP > 0 && c != character)]; + if (allies.Count == 0) return; + 剩余冷却 = 冷却时间; + WriteLine($"[ {character} ] 下达了援护号令,队友的行动系数提升了!"); + foreach (Character ally in allies) + { + // 同名刷新:先移除旧实例再套用,避免叠加 + List olds = [.. ally.Effects.Where(e => e is DynamicsEffect && e.Name == nameof(援护号令) + "·号令")]; + foreach (Effect old in olds) old.RemoveFromCharacter(ally); + Effect buff = new DynamicsEffect(Skill, new Dictionary() + { + { "exac", 行动系数提升 } + }, character) + { + Name = nameof(援护号令) + "·号令", + Durative = true, + Duration = 持续时间 + }; + buff.AddToCharacter(ally); + GamingQueue.AddApplyEffects(ally, EffectType.Haste); + } + } + + public override void OnTimeElapsed(TimeLapseContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (Skill.Character == null || Skill.Character != character) return; + if (剩余冷却 > 0) 剩余冷却 = Math.Max(0, 剩余冷却 - ctx.Elapsed); + } + } +} diff --git a/OshimaBot.Content/Skills/被动/海妖外壳.cs b/OshimaBot.Content/Skills/被动/海妖外壳.cs new file mode 100644 index 0000000..e16eeb6 --- /dev/null +++ b/OshimaBot.Content/Skills/被动/海妖外壳.cs @@ -0,0 +1,94 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.EffectResult; + +namespace OshimaBot.Content.Skills +{ + public class 海妖外壳 : Skill + { + public override long Id => (long)PassiveID.海妖外壳; + public override string Name => "海妖外壳"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + + public 海妖外壳(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 海妖外壳特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + public class 海妖外壳特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + /// + /// 强驱散:护盾破碎时对自身执行强驱散(参照 的规范写法, + /// 由框架按 与 BlockDispel 钩子处理,不手动移除特效) + /// + public override DispelType DispelType => DispelType.Strong; + public override string Description => $"每 {再生间隔:0.##}{GameplayEquilibriumConstant.InGameTime}生成一次 {护盾值:0.##} 点混合护盾(自身护盾破碎后才再生);" + + $"护盾破碎时,立即强驱散自身身上的减益效果(净化冷却 {净化冷却:0.##} {GameplayEquilibriumConstant.InGameTime})。"; + + private double 剩余再生 = 0; + private bool 有壳 = false; + private double 剩余净化冷却 = 0; + + /// + /// 重标:破碎净化的内部冷却(20–30 秒区间,取 25) + /// + private const double 净化冷却 = 25; + + // 重标:再生间隔固定 35 秒(原 12-0.1×Level,L58 = 6.2 秒,不足一个行动回合;参考饼干配送 38 秒) + private double 再生间隔 => 35; + // 重标:护盾量 = 15% 最大生命值(原固定数值 120+12×Level,跨等级与跨角色占比失衡) + private double 护盾值 => Skill.Character != null ? Skill.Character.MaxHP * 护盾百分比 : 0; + private const double 护盾百分比 = 0.15; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (Skill.Character == null || Skill.Character != character) return; + 剩余再生 = 再生间隔; + } + + public override void OnTimeElapsed(TimeLapseContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (Skill.Character == null || Skill.Character != character) return; + 剩余再生 -= ctx.Elapsed; + 剩余净化冷却 = Math.Max(0, 剩余净化冷却 - ctx.Elapsed); + if (剩余再生 <= 0 && !有壳) + { + 有壳 = true; + 剩余再生 = 再生间隔; + WriteLine($"[ {character} ] 的海妖外壳生成了一层 {护盾值:0.##} 点混合护盾!"); + character.Shield.Mix += 护盾值; + GamingQueue?.AddApplyEffects(character, EffectType.Shield); + } + } + + public override OnShieldBrokenResult OnShieldBroken(ShieldContext ctx) + { + if (ctx.Trigger is not Character character) return default; + if (Skill.Character == null || Skill.Character != character) return default; + if (!有壳) return default; + 有壳 = false; + if (剩余净化冷却 > 0) + { + WriteLine($"[ {character} ] 的海妖外壳破碎了!净化效果冷却中,剩余 {剩余净化冷却:0.##} {GameplayEquilibriumConstant.InGameTime}。"); + return default; + } + // 强驱散:交给框架处理(isEnemy=false → 清除自身减益),自动尊重 DispelledType 与 BlockDispel 钩子(受内部冷却限制) + Dispel(character, character, false); + 剩余净化冷却 = 净化冷却; + WriteLine($"[ {character} ] 的海妖外壳破碎了,减益效果被清除!净化进入冷却 {净化冷却:0.##} {GameplayEquilibriumConstant.InGameTime}。"); + return default; + } + } +} diff --git a/OshimaBot.Content/Skills/被动/深海重击.cs b/OshimaBot.Content/Skills/被动/深海重击.cs new file mode 100644 index 0000000..2037fe7 --- /dev/null +++ b/OshimaBot.Content/Skills/被动/深海重击.cs @@ -0,0 +1,60 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.PassiveEffects; + +namespace OshimaBot.Content.Skills +{ + public class 深海重击 : Skill + { + public override long Id => (long)PassiveID.深海重击; + public override string Name => "深海重击"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + + public 深海重击(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 深海重击特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + public class 深海重击特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"每 {攻击次数} 次普通攻击后的下一次普通攻击造成眩晕 {眩晕时间:0.##} {GameplayEquilibriumConstant.InGameTime}并附带 {额外伤害:0.##} 点额外伤害。"; + + private int 当前计数 = 0; + + private int 攻击次数 => 3; + private double 眩晕时间 => Skill.Character != null ? 1.5 + Skill.Character.Level * 0.05 : 1.5; + private double 额外伤害 => Skill.Character != null ? 60 + Skill.Character.Level * 6 + Skill.Character.ATK * 0.5 : 60; + + public override void AfterDamageCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return; + if (Skill.Character == null || Skill.Character != character) return; + if (!ctx.IsNormalAttack) return; + if (ctx.DamageResult != DamageResult.Normal && ctx.DamageResult != DamageResult.Critical) return; + 当前计数++; + if (当前计数 < 攻击次数) return; + 当前计数 = 0; + WriteLine($"[ {character} ] 发动了深海重击![ {enemy} ] 被眩晕并受到额外伤害!"); + DamageToEnemy(character, enemy, ctx.DamageType, ctx.MagicType, 额外伤害, new(character) + { + TriggerEffects = false + }); + Effect stun = new 眩晕(Skill, character, true, 眩晕时间, 0) + { + RemainDuration = 眩晕时间 + }; + enemy.Effects.Add(stun); + stun.OnEffectGained(new HookContext(GamingQueue, enemy)); + } + } +} diff --git a/OshimaBot.Content/Skills/被动/生命链接.cs b/OshimaBot.Content/Skills/被动/生命链接.cs new file mode 100644 index 0000000..8a50cf8 --- /dev/null +++ b/OshimaBot.Content/Skills/被动/生命链接.cs @@ -0,0 +1,88 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Skills +{ + /// + /// 通用被动 · 辅助型【生命链接】—— 传导型治疗 + /// 设计意图:填补「通用被动全是给自己加成、缺少给予他人的治疗/增益」的空缺。 + /// 这是五类辅助原型中的「输出转续航」:自身打得越狠,队友回得越多。 + /// 触发:自身造成伤害后(,本人为攻击方) + /// 效果:为生命值百分比最低的队友回复生命值,内部冷却。 + /// 标尺(手册 §6.4 被动·回复 ≤2–3%/秒):回复系数 6.4%(Lv60)× 冷却 8 秒 ⇒ 约 0.8%/秒。 + /// + public class 生命链接 : Skill + { + public override long Id => (long)PassiveID.生命链接; + public override string Name => "生命链接"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + + public 生命链接(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 生命链接特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + public class 生命链接特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => + $"自身造成伤害后,为生命值百分比最低的队友回复 {回复系数 * 100:0.##}% 最大生命值(不超过本次伤害的 100%)," + + $"每 {冷却时间:0.##} {GameplayEquilibriumConstant.InGameTime}至多一次。"; + + private double 剩余冷却 = 0; + + private double 回复系数 => Skill.Character != null ? 0.06 + Skill.Character.Level * 0.0004 : 0.06; + private double 冷却时间 => 8; + + public override void AfterDamageCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (ctx.Enemy is not Character) return; + if (Skill.Character == null || Skill.Character != character) return; + if (ctx.DamageResult != DamageResult.Normal && ctx.DamageResult != DamageResult.Critical) return; + if (ctx.ActualDamage <= 0) return; + if (剩余冷却 > 0) return; + Character? target = 最低生命队友(character); + if (target == null) return; + double heal = Math.Min(target.MaxHP * 回复系数, ctx.ActualDamage); + if (heal <= 0) return; + 剩余冷却 = 冷却时间; + WriteLine($"[ {character} ] 发动了生命链接!将生命涌向 [ {target} ],回复 {heal:0.##} 点生命值!"); + HealToTarget(character, target, heal); + } + + public override void OnTimeElapsed(TimeLapseContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (Skill.Character == null || Skill.Character != character) return; + if (剩余冷却 > 0) 剩余冷却 = Math.Max(0, 剩余冷却 - ctx.Elapsed); + } + + /// + /// 生命值百分比最低的存活队友;若其生命值已接近满值(≥)则视为无需治疗,返回 null(不消耗冷却) + /// + private Character? 最低生命队友(Character self) + { + if (GamingQueue == null) return null; + Character? target = GamingQueue.GetTeammates(self) + .Where(c => c.HP > 0 && c != self) + .OrderBy(c => c.HP / Math.Max(1, c.MaxHP)) + .FirstOrDefault(); + if (target == null) return null; + if (target.HP / Math.Max(1, target.MaxHP) >= 有效治疗阈值) return null; + return target; + } + + /// 有效治疗阈值:队友生命值低于该比例才消耗冷却,避免满血空放 + private const double 有效治疗阈值 = 0.95; + } +} diff --git a/OshimaBot.Content/Skills/被动/电刑.cs b/OshimaBot.Content/Skills/被动/电刑.cs new file mode 100644 index 0000000..73a36d2 --- /dev/null +++ b/OshimaBot.Content/Skills/被动/电刑.cs @@ -0,0 +1,73 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.EffectResult; +using OshimaBot.Content.Effects.PassiveEffects; + +namespace OshimaBot.Content.Skills +{ + public class 电刑 : Skill + { + public override long Id => (long)PassiveID.电刑; + public override string Name => "电刑"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + + public 电刑(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 电刑特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + 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 {GameplayEquilibriumConstant.InGameTime}并叠加 1 层数,当目标身上的电刑标记达到 3 层时,此次伤害提升 {伤害百分比 * 100:0.##}%。"; + private double 伤害百分比 => Skill.Character != null ? 0.2 + Skill.Character.Level * 0.004 : 0; + + public override AlterActualDamageResult AlterActualDamageAfterCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return default; + double damage = ctx.Damage; + bool isNormalAttack = ctx.IsNormalAttack; + DamageType damageType = ctx.DamageType; + MagicType magicType = ctx.MagicType; + DamageResult damageResult = ctx.DamageResult; + Dictionary totalDamageBonus = ctx.TotalDamageBonus; + if (Skill.Character != null && Skill.Character == character && (damageResult == DamageResult.Normal || damageResult == DamageResult.Critical)) + { + if (enemy.Effects.Where(e => e is 电刑标记 && e.Source == character).FirstOrDefault() is 电刑标记 e) + { + e.层数++; + if (e.层数 >= 3) + { + double 额外伤害 = damage * 伤害百分比; + WriteLine($"[ {character} ] 发动了电刑的 3 层效果,伤害提升了 {伤害百分比 * 100:0.##}%!额外造成 {额外伤害:0.##} 点{CharacterSet.GetDamageTypeName(damageType)}!"); + e.RemainDuration = 0; + enemy.Effects.Remove(e); + return new AlterActualDamageResult { DamageDelta = 额外伤害 }; + + } + } + else + { + e = new 电刑标记(Skill, character) + { + Durative = true, + Duration = 25, + RemainDuration = 25 + }; + enemy.Effects.Add(e); + } + } + return default; + + } + } +} diff --git a/OshimaBot.Content/Skills/被动/相位猛冲.cs b/OshimaBot.Content/Skills/被动/相位猛冲.cs new file mode 100644 index 0000000..737d63c --- /dev/null +++ b/OshimaBot.Content/Skills/被动/相位猛冲.cs @@ -0,0 +1,89 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Skills +{ + public class 相位猛冲 : Skill + { + public override long Id => (long)PassiveID.相位猛冲; + public override string Name => "相位猛冲"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + + public 相位猛冲(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 相位猛冲特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + public class 相位猛冲特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"在 {窗口时间:0.##} {GameplayEquilibriumConstant.InGameTime}内用 {需要命中次数} 个独立的普通攻击或技能命中敌人后,获得 {行动系数提升 * 100:0.##}% 行动系数和 {加速系数提升 * 100:0.##}% 加速系数,持续 {强化持续时间:0.##} {GameplayEquilibriumConstant.InGameTime}。触发后进入 {冷却时间:0.##} {GameplayEquilibriumConstant.InGameTime}冷却。"; + + private int 命中次数 = 0; + private double 剩余窗口 = 0; + private double 剩余冷却 = 0; + + private int 需要命中次数 => 3; + private double 窗口时间 => Skill.Character != null ? 5 + Skill.Character.Level * 0.1 : 5; + private double 冷却时间 => Skill.Character != null ? 10 - Skill.Character.Level * 0.05 : 10; + private double 强化持续时间 => Skill.Character != null ? 6 + Skill.Character.Level * 0.1 : 6; + private double 行动系数提升 => Skill.Character != null ? 0.25 + Skill.Character.Level * 0.004 : 0.25; + private double 加速系数提升 => Skill.Character != null ? 0.25 + Skill.Character.Level * 0.004 : 0.25; + + public override void AfterDamageCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return; + if (Skill.Character == null || Skill.Character != character) return; + if (ctx.DamageResult != DamageResult.Normal && ctx.DamageResult != DamageResult.Critical) return; + if (剩余冷却 > 0) return; + 剩余窗口 = 窗口时间; + 命中次数++; + if (命中次数 >= 需要命中次数) + { + 命中次数 = 0; + 剩余窗口 = 0; + 剩余冷却 = 冷却时间; + WriteLine($"[ {character} ] 发动了相位猛冲!获得了 {行动系数提升 * 100:0.##}% 行动系数和 {加速系数提升 * 100:0.##}% 加速系数!"); + Effect e = new DynamicsEffect(Skill, new Dictionary() + { + { "exac", 行动系数提升 }, + { "exacc", 加速系数提升 } + }, character) + { + Name = nameof(相位猛冲) + "·急速", + Durative = true, + Duration = 强化持续时间 + }; + character.Effects.Add(e); + e.OnEffectGained(new HookContext(GamingQueue, character)); + } + } + + public override void OnTimeElapsed(TimeLapseContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (剩余窗口 > 0) + { + 剩余窗口 -= ctx.Elapsed; + if (剩余窗口 <= 0) + { + 命中次数 = 0; + } + } + if (剩余冷却 > 0) + { + 剩余冷却 -= ctx.Elapsed; + } + } + } +} diff --git a/OshimaBot.Content/Skills/被动/竭心光环.cs b/OshimaBot.Content/Skills/被动/竭心光环.cs new file mode 100644 index 0000000..649c98a --- /dev/null +++ b/OshimaBot.Content/Skills/被动/竭心光环.cs @@ -0,0 +1,70 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.PassiveEffects; + +namespace OshimaBot.Content.Skills +{ + public class 竭心光环 : Skill + { + public override long Id => (long)PassiveID.竭心光环; + public override string Name => "竭心光环"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + + public 竭心光环(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 竭心光环特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + public class 竭心光环特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"造成伤害后,令目标进入竭心状态:每{GameplayEquilibriumConstant.InGameTime}受到当前生命值 {灼烧比例 * 100:0.##}% 的真实伤害,持续 {持续时间:0.##} {GameplayEquilibriumConstant.InGameTime},并禁止其一切生命回复。"; + + private double 持续时间 => Skill.Character != null ? 4 + Skill.Character.Level * 0.05 : 4; + // 平衡调整(2026-09-22):生命流失 Lv60 3.2%/秒 → 3%/秒(对标泰山玄武靠 3% 基线) + private double 灼烧比例 => Skill.Character != null ? 0.015 + Skill.Character.Level * 0.00025 : 0.015; + + public override void AfterDamageCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return; + if (Skill.Character == null || Skill.Character != character) return; + if (ctx.DamageResult != DamageResult.Normal && ctx.DamageResult != DamageResult.Critical) return; + if (enemy.HP <= 0) return; + // 已有竭心光环效果则刷新,不叠加 + if (enemy.Effects.Any(e => e is 持续伤害 && ReferenceEquals(e.Skill, Skill))) + { + foreach (Effect e in enemy.Effects.Where(e => e is 持续伤害 && ReferenceEquals(e.Skill, Skill)).ToList()) + { + e.RemainDuration = 持续时间; + } + return; + } + WriteLine($"[ {character} ] 对 [ {enemy} ] 施加了竭心光环!"); + Effect dot = new 持续伤害(Skill, enemy, character, true, 持续时间, 0, true, 100, 灼烧比例, DamageType.True) + { + RemainDuration = 持续时间 + }; + enemy.Effects.Add(dot); + dot.OnEffectGained(new HookContext(GamingQueue, enemy)); + + if (!enemy.Effects.Any(e => e is 禁止治疗 && ReferenceEquals(e.Skill, Skill))) + { + Effect block = new 禁止治疗(Skill, character, false, false, false, true, 持续时间, 0) + { + RemainDuration = 持续时间 + }; + enemy.Effects.Add(block); + block.OnEffectGained(new HookContext(GamingQueue, enemy)); + } + } + } +} diff --git a/OshimaBot.Content/Skills/被动/自然蔽护.cs b/OshimaBot.Content/Skills/被动/自然蔽护.cs new file mode 100644 index 0000000..2dd8e73 --- /dev/null +++ b/OshimaBot.Content/Skills/被动/自然蔽护.cs @@ -0,0 +1,89 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.EffectResult; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Skills +{ + public class 自然蔽护 : Skill + { + public override long Id => (long)PassiveID.自然蔽护; + public override string Name => "自然蔽护"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + + public 自然蔽护(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 自然蔽护特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + public class 自然蔽护特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"连续 {启动时间:0.##} {GameplayEquilibriumConstant.InGameTime}未受到伤害时进入自然蔽护:提升 {行动系数提升 * 100:0.##}% 行动系数、{加速系数提升 * 100:0.##}% 加速系数,并令受到的治疗效果提升 {治疗加成 * 100:0.##}%;受到伤害后效果解除。"; + + private double 未受击时间 = 0; + + private double 启动时间 => Skill.Character != null ? 6 - Skill.Character.Level * 0.05 : 6; + private double 行动系数提升 => Skill.Character != null ? 0.15 + Skill.Character.Level * 0.002 : 0.15; + private double 加速系数提升 => Skill.Character != null ? 0.15 + Skill.Character.Level * 0.002 : 0.15; + private double 治疗加成 => Skill.Character != null ? 0.12 + Skill.Character.Level * 0.001 : 0.12; + private bool BuffActive => Skill.Character != null && Skill.Character.Effects.Any(e => e is DynamicsEffect && e.Name == nameof(自然蔽护) + "·遮蔽"); + + public override void OnTimeElapsed(TimeLapseContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (Skill.Character == null || Skill.Character != character) return; + 未受击时间 += ctx.Elapsed; + if (未受击时间 >= 启动时间 && !BuffActive) + { + WriteLine($"[ {character} ] 进入了自然蔽护状态!"); + Effect e = new DynamicsEffect(Skill, new Dictionary() + { + { "exac", 行动系数提升 }, + { "exacc", 加速系数提升 } + }, character) + { + Name = nameof(自然蔽护) + "·遮蔽", + DurativeWithoutDuration = true + }; + character.Effects.Add(e); + e.OnEffectGained(new HookContext(GamingQueue, character)); + } + } + + public override void AfterDamageCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character attacker || ctx.Enemy is not Character character) return; + if (Skill.Character == null || Skill.Character != character) return; + if (attacker == character || ctx.ActualDamage <= 0) return; + if (!BuffActive) return; + List olds = character.Effects.Where(e => e is DynamicsEffect && e.Name == nameof(自然蔽护) + "·遮蔽").ToList(); + foreach (Effect e in olds) + { + character.Effects.Remove(e); + e.OnEffectLost(new HookContext(GamingQueue, character)); + } + 未受击时间 = 0; + WriteLine($"[ {character} ] 受到了伤害,自然蔽护被解除。"); + } + + public override AlterHealValueResult AlterHealValueBeforeHealToTarget(HealContext ctx) + { + if (ctx.Trigger is not Character healer) return default; + Character? target = ctx.Target; + if (target == null || target != Skill.Character) return default; + if (!BuffActive) return default; + double bonus = ctx.Heal * 治疗加成; + return new AlterHealValueResult { HealDelta = bonus }; + } + } +} diff --git a/OshimaBot.Content/Skills/被动/致命节奏.cs b/OshimaBot.Content/Skills/被动/致命节奏.cs new file mode 100644 index 0000000..6f2d9da --- /dev/null +++ b/OshimaBot.Content/Skills/被动/致命节奏.cs @@ -0,0 +1,91 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Skills +{ + public class 致命节奏 : Skill + { + public override long Id => (long)PassiveID.致命节奏; + public override string Name => "致命节奏"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + + public 致命节奏(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 致命节奏特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + public class 致命节奏特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"每次普通攻击造成伤害后,提升 {行动速度提升:0.##} 点行动速度,持续 {行动速度持续时间:0.##} {GameplayEquilibriumConstant.InGameTime}。" + + $"当行动系数达到 {行动系数阈值:0.##}% 时,获得 {额外攻击力:0.##} 点额外攻击力,持续 {额外攻击力持续时间:0.##} {GameplayEquilibriumConstant.InGameTime}。" + + $"获得额外攻击力后,致命节奏进入冷却时间 {冷却时间} {GameplayEquilibriumConstant.InGameTime}。"; + + private double 行动系数阈值 => Skill.Character != null ? 25 + Skill.Character.Level * 0.6 : 25; + private double 行动速度持续时间 => Skill.Character != null ? 18 - Skill.Character.Level * 0.1 : 18; + private double 行动速度提升 => Skill.Character != null ? 40 + Skill.Character.Level * 1.1 : 40; + private double 额外攻击力持续时间 => Skill.Character != null ? 12 + Skill.Character.Level * 0.15 : 12; + private double 额外攻击力 => Skill.Character != null ? 6 + Skill.Character.Level * 1.7 : 6; + private double 冷却时间 => Skill.Character != null ? 24 + Skill.Character.Level * 0.1 : 24; + private bool 冷却中 => Skill.CurrentCD > 0; + + public override void AfterDamageCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return; + double damage = ctx.Damage; + double actualDamage = ctx.ActualDamage; + bool isNormalAttack = ctx.IsNormalAttack; + DamageType damageType = ctx.DamageType; + MagicType magicType = ctx.MagicType; + DamageResult damageResult = ctx.DamageResult; + if (Skill.Character != null && Skill.Character == character && !冷却中 && isNormalAttack && (damageResult == DamageResult.Normal || damageResult == DamageResult.Critical)) + { + WriteLine($"[ {character} ] 发动了致命节奏,提升了 {行动速度提升:0.##} 点行动速度!"); + Effect e1 = new ExSPD(Skill, new Dictionary() + { + { "exspd", 行动速度提升 } + }, character) + { + Name = Name + "·行动速度", + Durative = true, + Duration = 行动速度持续时间 + }; + character.Effects.Add(e1); + e1.OnEffectGained(new HookContext(GamingQueue, character)); + e1.IsDebuff = false; + RecordCharacterApplyEffects(character, EffectType.Haste); + + // 检查是否达到阈值 + if (character.ActionCoefficient * 100 >= 行动系数阈值 && !冷却中) + { + Skill.Enable = false; + Skill.CurrentCD = 冷却时间; + WriteLine($"[ {character} ] 发动了致命节奏,获得了 {额外攻击力:0.##} 点额外攻击力!"); + Effect e2 = new ExATK(Skill, new Dictionary() + { + { "exatk", 额外攻击力 } + }, character) + { + Name = Name + "·额外攻击力", + Durative = true, + Duration = 额外攻击力持续时间 + }; + character.Effects.Add(e2); + e2.OnEffectGained(new HookContext(GamingQueue, character)); + e2.IsDebuff = false; + RecordCharacterApplyEffects(character, EffectType.DamageBoost); + } + } + } + } +} \ No newline at end of file diff --git a/OshimaBot.Content/Skills/被动/贪欲猎手.cs b/OshimaBot.Content/Skills/被动/贪欲猎手.cs new file mode 100644 index 0000000..941ef80 --- /dev/null +++ b/OshimaBot.Content/Skills/被动/贪欲猎手.cs @@ -0,0 +1,48 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Skills +{ + public class 贪欲猎手 : Skill + { + public override long Id => (long)PassiveID.贪欲猎手; + public override string Name => "贪欲猎手"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + + public 贪欲猎手(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 贪欲猎手特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + public class 贪欲猎手特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"造成伤害后,基于造成伤害值的 {生命回复系数 * 100:0.##}% 回复生命值。"; + + private double 生命回复系数 => Skill.Character != null ? 0.04 + Skill.Character.Level / 10 * 0.01 : 0.04; + + public override void AfterDamageCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return; + double damage = ctx.Damage; + double actualDamage = ctx.ActualDamage; + bool isNormalAttack = ctx.IsNormalAttack; + DamageType damageType = ctx.DamageType; + MagicType magicType = ctx.MagicType; + DamageResult damageResult = ctx.DamageResult; + if (Skill.Character != null && Skill.Character == character && isNormalAttack && (damageResult == DamageResult.Normal || damageResult == DamageResult.Critical)) + { + HealToTarget(character, character, 生命回复系数 * actualDamage); + } + } + } +} \ No newline at end of file diff --git a/OshimaBot.Content/Skills/被动/迅捷步法.cs b/OshimaBot.Content/Skills/被动/迅捷步法.cs new file mode 100644 index 0000000..5dcbecf --- /dev/null +++ b/OshimaBot.Content/Skills/被动/迅捷步法.cs @@ -0,0 +1,72 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Skills +{ + public class 迅捷步法 : Skill + { + public override long Id => (long)PassiveID.迅捷步法; + public override string Name => "迅捷步法"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + + public 迅捷步法(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 迅捷步法特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + public class 迅捷步法特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"每次造成伤害后,立即回复 {生命回复:0.##} 点生命值,随后在 {持续时间:0.##} {GameplayEquilibriumConstant.InGameTime}内,提升 {行动系数提升 * 100:0.##}% 行动系数和 {加速系数提升 * 100:0.##}% 加速系数、1 格移动距离,该效果最多可叠 3 层。"; + + private double 行动系数提升 => Skill.Character != null ? 0.02 + Skill.Character.Level / 10 * 0.005 : 0.02; + private double 加速系数提升 => Skill.Character != null ? 0.02 + Skill.Character.Level / 10 * 0.005 : 0.02; + // 平衡调整(2026-09-22):Lv60 回复 380 → 320(Admin:砍 60) + private double 生命回复 => Skill.Character != null ? 20 + Skill.Character.Level * 5 : 20; + private double 持续时间 => Skill.Character != null ? 10 + Skill.Character.Level * 0.1 : 10; + + public override void AfterDamageCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return; + double damage = ctx.Damage; + double actualDamage = ctx.ActualDamage; + bool isNormalAttack = ctx.IsNormalAttack; + DamageType damageType = ctx.DamageType; + MagicType magicType = ctx.MagicType; + DamageResult damageResult = ctx.DamageResult; + if (Skill.Character != null && Skill.Character == character && isNormalAttack && (damageResult == DamageResult.Normal || damageResult == DamageResult.Critical)) + { + HealToTarget(character, character, 生命回复); + if (character.Effects.Count(e => e.Name == nameof(迅捷步法特效)) < 3) + { + WriteLine($"[ {character} ] 发动了迅捷步法,提升了 {行动系数提升 * 100:0.##}% 行动系数和 {加速系数提升 * 100:0.##}% 加速系数、1 格移动距离!"); + Effect e = new DynamicsEffect(Skill, new Dictionary() + { + { "exac", 行动系数提升 }, + { "exacc", 加速系数提升 }, + { "exmov", 1 } + }, character) + { + Name = nameof(迅捷步法特效), + Durative = true, + Duration = 持续时间 + }; + character.Effects.Add(e); + e.OnEffectGained(new HookContext(GamingQueue, character)); + e.IsDebuff = false; + RecordCharacterApplyEffects(character, EffectType.Haste); + } + } + } + } +} \ No newline at end of file diff --git a/OshimaBot.Content/Skills/被动/静电场.cs b/OshimaBot.Content/Skills/被动/静电场.cs new file mode 100644 index 0000000..1e4a254 --- /dev/null +++ b/OshimaBot.Content/Skills/被动/静电场.cs @@ -0,0 +1,60 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Skills +{ + public class 静电场 : Skill + { + public override long Id => (long)PassiveID.静电场; + public override string Name => "静电场"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + + public 静电场(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 静电场特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + public class 静电场特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"技能命中敌人时,引发静电场造成 {静电伤害:0.##} 点额外真实伤害。静电场每 {冷却时间:0.##} {GameplayEquilibriumConstant.InGameTime}只能发动一次。"; + + private double 剩余冷却 = 0; + + private double 冷却时间 => Skill.Character != null ? 6 - Skill.Character.Level * 0.02 : 6; + private double 静电伤害 => Skill.Character != null ? 40 + Skill.Character.Level * 4 + Skill.Character.ATK * 0.1 : 40; + + public override void AfterDamageCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return; + if (Skill.Character == null || Skill.Character != character) return; + if (ctx.IsNormalAttack) return; + if (ctx.DamageResult != DamageResult.Normal && ctx.DamageResult != DamageResult.Critical) return; + if (剩余冷却 > 0) return; + 剩余冷却 = 冷却时间; + WriteLine($"[ {character} ] 发动了静电场!对 [ {enemy} ] 造成了 {静电伤害:0.##} 点真实伤害!"); + DamageToEnemy(character, enemy, DamageType.True, MagicType.None, 静电伤害, new(character) + { + TriggerEffects = false + }); + } + + public override void OnTimeElapsed(TimeLapseContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (剩余冷却 > 0) + { + 剩余冷却 -= ctx.Elapsed; + } + } + } +} diff --git a/OshimaBot.Content/Skills/被动/风暴聚集.cs b/OshimaBot.Content/Skills/被动/风暴聚集.cs new file mode 100644 index 0000000..07d08d4 --- /dev/null +++ b/OshimaBot.Content/Skills/被动/风暴聚集.cs @@ -0,0 +1,122 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Skills +{ + public class 风暴聚集 : Skill + { + public override long Id => (long)PassiveID.风暴聚集; + public override string Name => "风暴聚集"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + + /// + /// 已累计提升的核心属性值。[ 永久成长数据存放在技能本体上 ]:死亡/复活时角色会被重建, + /// 依赖 把累计值迁移给新技能实例,特效重挂后全量施加。 + /// + public double 累计提升 { get; set; } = 0; + + public 风暴聚集(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 风暴聚集特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + + public override void OnCharacterRespawn(Skill newSkill) + { + if (newSkill is 风暴聚集 s) + { + s.累计提升 = 累计提升; + } + } + } + + public class 风暴聚集特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"每经过 {间隔时间:0.##} {GameplayEquilibriumConstant.InGameTime},永久提升 {每次提升:0.##} 点{CharacterSet.GetPrimaryAttributeName(Skill.Character?.PrimaryAttribute ?? PrimaryAttribute.STR)}(核心属性),无上限。" + + (CSkill?.累计提升 > 0 ? $"(当前已累计提升 {CSkill.累计提升:0.##} 点核心属性)" : ""); + + public 风暴聚集? CSkill => Skill as 风暴聚集; + + private double 已应用 = 0; + private double 距离下次提升 = 0; + + private double 间隔时间 => Skill.Character != null ? 60 - Skill.Character.Level * 0.15 : 60; + private double 每次提升 => Skill.Character != null ? 1 + Skill.Character.Level * 0.08 : 1; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (Skill.Character == null || Skill.Character != character) return; + 距离下次提升 = 间隔时间; + // 复活/重挂时:把技能本体上继承到的累计值整体施加一次 + 刷新(character); + } + + public override void OnTimeElapsed(TimeLapseContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (Skill.Character == null || Skill.Character != character) return; + 距离下次提升 -= ctx.Elapsed; + if (距离下次提升 <= 0) + { + 距离下次提升 += 间隔时间; + if (CSkill != null) CSkill.累计提升 += 每次提升; + 刷新(character); + WriteLine($"[ {character} ] 发动了风暴聚集!核心属性永久提升了 {每次提升:0.##} 点(当前共 {CSkill?.累计提升:0.##} 点)。"); + } + // 自愈式幂等刷新:复活等场景下若 OnEffectGained 未重放,首个时间流逝即补挂全量累计 + 刷新(character); + } + + public override void OnEffectLost(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (已应用 <= 0) return; + // 只回收本实例已施加的加成;累计值保留在技能本体上,交由复活迁移/重挂后重新施加 + switch (character.PrimaryAttribute) + { + case PrimaryAttribute.AGI: + character.ExAGI -= 已应用; + break; + case PrimaryAttribute.INT: + character.ExINT -= 已应用; + break; + default: + character.ExSTR -= 已应用; + break; + } + 已应用 = 0; + } + + /// + /// 以技能本体的累计值为准做幂等刷新:差值增量施加,避免重复叠加或漏加。 + /// + private void 刷新(Character character) + { + double target = CSkill?.累计提升 ?? 0; + double delta = target - 已应用; + if (Math.Abs(delta) < 1e-9) return; + switch (character.PrimaryAttribute) + { + case PrimaryAttribute.AGI: + character.ExAGI += delta; + break; + case PrimaryAttribute.INT: + character.ExINT += delta; + break; + default: + character.ExSTR += delta; + break; + } + 已应用 = target; + } + } +} diff --git a/OshimaBot.Content/Skills/被动/饼干配送.cs b/OshimaBot.Content/Skills/被动/饼干配送.cs new file mode 100644 index 0000000..2680fb2 --- /dev/null +++ b/OshimaBot.Content/Skills/被动/饼干配送.cs @@ -0,0 +1,59 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Skills +{ + public class 饼干配送 : Skill + { + public override long Id => (long)PassiveID.饼干配送; + public override string Name => "饼干配送"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + + public 饼干配送(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 饼干配送特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + public class 饼干配送特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"每经过 {配送间隔:0.##} {GameplayEquilibriumConstant.InGameTime}获得一块免费饼干,立即回复 {生命回复 * 100:0.##}% [ {Skill.Character?.MaxHP * 生命回复:0.##} ] 最大生命值、{魔法回复 * 100:0.##}% [ {Skill.Character?.MaxMP * 魔法回复:0.##} ] 最大魔法值。"; + + private double 剩余时间 = 0; + + private double 配送间隔 => Skill.Character != null ? 50 - Skill.Character.Level * 0.2 : 45; + private double 生命回复 => Skill.Character != null ? 0.06 + Skill.Character.Level * 0.001 : 0.06; + private double 魔法回复 => Skill.Character != null ? 0.1 + Skill.Character.Level * 0.001 : 0.1; + + public override void OnEffectGained(HookContext ctx) + { + if (ctx.Trigger is not Character character) return; + 剩余时间 = 配送间隔; + } + + public override void OnTimeElapsed(TimeLapseContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (Skill.Character == null || Skill.Character != character) return; + 剩余时间 -= ctx.Elapsed; + if (剩余时间 <= 0) + { + 剩余时间 += 配送间隔; + double hp = character.MaxHP * 生命回复; + double mp = character.MaxMP * 魔法回复; + WriteLine($"[ {character} ] 收到了饼干配送!回复了 {hp:0.##} 点生命值和 {mp:0.##} 点魔法值!"); + HealToTarget(character, character, hp); + character.MP = Math.Min(character.MP + mp, character.MaxMP); + } + } + } +} diff --git a/OshimaBot.Content/Skills/被动/骸骨镀层.cs b/OshimaBot.Content/Skills/被动/骸骨镀层.cs new file mode 100644 index 0000000..1313b17 --- /dev/null +++ b/OshimaBot.Content/Skills/被动/骸骨镀层.cs @@ -0,0 +1,88 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.EffectResult; + +namespace OshimaBot.Content.Skills +{ + public class 骸骨镀层 : Skill + { + public override long Id => (long)PassiveID.骸骨镀层; + public override string Name => "骸骨镀层"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + + public 骸骨镀层(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 骸骨镀层特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + } + + public class 骸骨镀层特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"承受敌方技能伤害后,在 {保护窗口:0.##} {GameplayEquilibriumConstant.InGameTime}内,后续 {减伤次数} 次普通攻击或技能造成的伤害减少 {减伤比例 * 100:0.##}%。"; + + private int 剩余次数 = 0; + private double 剩余窗口 = 0; + + private double 保护窗口 => Skill.Character != null ? 4 + Skill.Character.Level * 0.05 : 4; + private int 减伤次数 => 3; + private double 减伤比例 => Skill.Character != null ? 0.25 + Skill.Character.Level * 0.001 : 0.25; + + public override void AfterDamageCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character attacker || ctx.Enemy is not Character character) return; + if (Skill.Character == null || Skill.Character != character) return; + if (attacker == character) return; + if (ctx.ActualDamage <= 0) return; + if (ctx.IsNormalAttack) + { + // 后续普攻/技能伤害减少:属于保护层 + if (剩余次数 > 0 && 剩余窗口 > 0) + { + 剩余次数--; + if (剩余次数 <= 0) 剩余窗口 = 0; + } + } + else + { + // 敌方技能伤害:激活骸骨镀层 + 剩余次数 = 减伤次数; + 剩余窗口 = 保护窗口; + WriteLine($"[ {character} ] 激活了骸骨镀层!接下来的 {减伤次数} 次攻击伤害减少 {减伤比例 * 100:0.##}%。"); + } + } + + public override AlterActualDamageResult AlterActualDamageAfterCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character attacker || ctx.Enemy is not Character character) return default; + if (Skill.Character == null || Skill.Character != character) return default; + if (attacker == character) return default; + if (剩余次数 <= 0 || 剩余窗口 <= 0) return default; + if (ctx.DamageResult != DamageResult.Normal && ctx.DamageResult != DamageResult.Critical) return default; + double reduce = ctx.Damage * 减伤比例; + WriteLine($"[ {character} ] 的骸骨镀层减少了 {reduce:0.##} 点伤害!"); + return new AlterActualDamageResult { DamageDelta = -reduce }; + } + + public override void OnTimeElapsed(TimeLapseContext ctx) + { + if (ctx.Trigger is not Character character) return; + if (剩余窗口 > 0) + { + 剩余窗口 -= ctx.Elapsed; + if (剩余窗口 <= 0) + { + 剩余次数 = 0; + } + } + } + } +} diff --git a/OshimaBot.Content/Skills/被动/黑暗收割.cs b/OshimaBot.Content/Skills/被动/黑暗收割.cs new file mode 100644 index 0000000..ca52f88 --- /dev/null +++ b/OshimaBot.Content/Skills/被动/黑暗收割.cs @@ -0,0 +1,106 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; + +namespace OshimaBot.Content.Skills +{ + public class 黑暗收割 : Skill + { + public override long Id => (long)PassiveID.黑暗收割; + public override string Name => "黑暗收割"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + + public int 当前灵魂数量 { get; set; } = 0; + + public 黑暗收割(Character? character = null) : base(SkillType.Passive, character) + { + Effects.Add(new 黑暗收割特效(this)); + } + + public override IEnumerable AddPassiveEffectToCharacter() + { + return Effects; + } + + public override void OnCharacterRespawn(Skill newSkill) + { + if (newSkill is 黑暗收割 s) + { + s.当前灵魂数量 = 当前灵魂数量; + } + } + } + + public class 黑暗收割特效(Skill skill) : Effect(skill) + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"{Skill.SkillOwner()}对一半以下生命值的目标造成伤害时,将收集其灵魂以永久提升自身伤害,每个灵魂提供 {额外伤害提升 * 100:0.##}% 伤害加成。最多收集 {最多灵魂数量} 个灵魂。" + + $"若{Skill.SkillOwner()}死亡,灵魂将损失一半。(当前灵魂数量:{CSkill?.当前灵魂数量} 个;伤害提升:{CSkill?.当前灵魂数量 * 额外伤害提升 * 100:0.##}%)"; + + public 黑暗收割? CSkill => Skill is 黑暗收割 s ? s : null; + private static double 额外伤害提升 => 0.02; + private int 最多灵魂数量 => Skill.Character != null ? 10 + Skill.Character.Level / 10 * 5 : 10; + private bool 触发标记 { get; set; } = false; + + public override double AlterExpectedDamageBeforeCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return 0; + double damage = ctx.Damage; + bool isNormalAttack = ctx.IsNormalAttack; + DamageType damageType = ctx.DamageType; + MagicType magicType = ctx.MagicType; + Dictionary totalDamageBonus = ctx.TotalDamageBonus; + if (Skill is 黑暗收割 skill && character == Skill.Character && (enemy.HP / enemy.MaxHP) < 0.5) + { + 触发标记 = true; + return damage * skill.当前灵魂数量 * 额外伤害提升; + } + return 0; + } + + public override void AfterDamageCalculation(DamageContext ctx) + { + if (ctx.Trigger is not Character character || ctx.Enemy is not Character enemy) return; + double damage = ctx.Damage; + double actualDamage = ctx.ActualDamage; + bool isNormalAttack = ctx.IsNormalAttack; + DamageType damageType = ctx.DamageType; + MagicType magicType = ctx.MagicType; + DamageResult damageResult = ctx.DamageResult; + if (触发标记 && character == Skill.Character && (damageResult == DamageResult.Normal || damageResult == DamageResult.Critical) && Skill is 黑暗收割 skill && skill.当前灵魂数量 < 最多灵魂数量) + { + 触发标记 = false; + skill.当前灵魂数量++; + WriteLine($"[ {character} ] 通过黑暗收割收集了一个灵魂!当前灵魂数:{skill.当前灵魂数量}"); + } + } + + public override void AfterDeathCalculation(DeathContext ctx) + { + if (ctx.Trigger is not Character death) return; + bool hasMaster = ctx.HasMaster; + Character? killer = ctx.Killer; + Dictionary continuousKilling = ctx.ContinuousKilling; + Dictionary earnedMoney = ctx.EarnedMoney; + Character[] assists = ctx.Assists; + if (death == Skill.Character && Skill is 黑暗收割 skill && skill.当前灵魂数量 > 0) + { + int lost = skill.当前灵魂数量 / 2; + if (lost > 0) + { + skill.当前灵魂数量 -= lost; + WriteLine($"[ {death} ] 因死亡损失了 [ {lost} ] 个灵魂!"); + } + } + } + + public override void OnTurnEnd(TurnContext ctx) + { + if (ctx.Trigger is not Character character) return; + 触发标记 = false; + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/冰狱冥嚎.cs b/OshimaBot.Content/Skills/魔法/冰狱冥嚎.cs new file mode 100644 index 0000000..a618aff --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/冰狱冥嚎.cs @@ -0,0 +1,24 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 冰狱冥嚎 : Skill + { + public override long Id => (long)MagicID.冰狱冥嚎; + public override string Name => "冰狱冥嚎"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override double MPCost => Level > 0 ? 55 + (55 * (Level - 1)) : 55; + public override double CD => 32; + public override double CastTime => 10; + public override double HardnessTime { get; set; } = 5; + public override int CanSelectTargetCount => 3; + public override double MagicBottleneck => 20 + 22 * (Level - 1); + + public 冰狱冥嚎(Character? character = null) : base(SkillType.Magic, character) + { + Effects.Add(new 基于属性的伤害(this, PrimaryAttribute.INT, 30, 35, 0.2, 0.2)); + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/冰霜攻击.cs b/OshimaBot.Content/Skills/魔法/冰霜攻击.cs new file mode 100644 index 0000000..1aeffbb --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/冰霜攻击.cs @@ -0,0 +1,23 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 冰霜攻击 : Skill + { + public override long Id => (long)MagicID.冰霜攻击; + public override string Name => "冰霜攻击"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override double MPCost => Level > 0 ? 50 + (50 * (Level - 1)) : 50; + public override double CD => 25; + public override double CastTime => 5; + public override double HardnessTime { get; set; } = 3; + public override double MagicBottleneck => 20 + 22 * (Level - 1); + + public 冰霜攻击(Character? character = null) : base(SkillType.Magic, character) + { + Effects.Add(new 基于属性的伤害(this, PrimaryAttribute.INT, 90, 60, 0.35, 0.4)); + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/凝胶稠絮.cs b/OshimaBot.Content/Skills/魔法/凝胶稠絮.cs new file mode 100644 index 0000000..1370632 --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/凝胶稠絮.cs @@ -0,0 +1,28 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 凝胶稠絮 : Skill + { + public override long Id => (long)MagicID.凝胶稠絮; + public override string Name => "凝胶稠絮"; + public override string Description => Effects.Count > 0 ? string.Join("\r\n", Effects.Select(e => e.Description)) : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First(e => e is 造成虚弱).DispelDescription : ""; + public override string ExemptionDescription => Effects.Count > 0 ? Effects.First(e => e is 造成虚弱).ExemptionDescription : ""; + public override double MPCost => Level > 0 ? 75 + (75 * (Level - 1)) : 75; + // 调整:L8 CD 19.5 → 20.5(魔法下限 20) + public override double CD => Level > 0 ? 31 - (1.5 * (Level - 1)) : 31; + public override double CastTime => 11; + public override double HardnessTime { get; set; } = 4; + public override int CanSelectTargetCount => 1; + public override double MagicBottleneck => 15 + 16 * (Level - 1); + + public 凝胶稠絮(Character? character = null) : base(SkillType.Magic, character) + { + Effects.Add(new 造成虚弱(this, false, 0, 3, 0, 0.08, 0.5, 0.05, 0.1, + 0.025, 0.1, 0.015, 0.03)); + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/十二宫星环.cs b/OshimaBot.Content/Skills/魔法/十二宫星环.cs new file mode 100644 index 0000000..460e4f5 --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/十二宫星环.cs @@ -0,0 +1,105 @@ +using FunGame.Core.Entity; +using OshimaBot.Content.Effects; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using OshimaBot.Content.Effects.PassiveEffects; + +namespace OshimaBot.Content.Skills +{ + /// + /// 十二宫星环:为目标友方附加【强运】被动状态 + /// · 作用角色数随等级提升:1 / 2 / 3 / 4 + /// · 强运持续回合数随等级提升:2 / 3 / 4 / 4 + /// · 强运状态下,角色每个回合结束时随机生成 2~3 份绑定自身的回合奖励 + /// + public class 十二宫星环 : Skill + { + public override long Id => (long)MagicID.十二宫星环; + public override string Name => "十二宫星环"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override double MPCost => Level > 0 ? 70 + 75 * (Level - 1) : 70; + public override double CD => Level > 0 ? 50 - (1 * (Level - 1)) : 50; + public override double CastTime => Level > 0 ? 4 + (0.5 * (Level - 1)) : 4; + public override double HardnessTime { get; set; } = 5; + public override bool CanSelectSelf => true; + public override bool CanSelectEnemy => false; + public override bool CanSelectTeammate => true; + public override int CanSelectTargetCount + { + get + { + return Level switch + { + 2 => 2, + 3 => 3, + >= 4 => 4, + _ => 1 + }; + } + } + + /// + /// 魔法瓶颈(2026-09-23 修订):此前设为 0(= 放弃该参数,效能恒 100%), + /// 原因是本技能只施加【强运】状态、不吃效能乘算。 + /// 现改为**把效能当命中率系数**使用(见特效的命中检定)⇒ 需要给出瓶颈才能算出效能: + /// 效能 = `clamp(1 + (施法者INT − 瓶颈) / 瓶颈, 0.01, 2.0)`,命中率 = 效能 × 0.5。 + /// 取手册的「L8 主流值 103」⇒ 施法者 INT = 103 时命中 50%、INT ≥ 206 时必中。 + /// + public override double MagicBottleneck => 103; + + public 十二宫星环(Character? character = null) : base(SkillType.Magic, 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 => + $"为{(Skill.CanSelectTargetCount > 1 ? $"至多 {Skill.CanSelectTargetCount} 个" : "")}友方角色附加【强运】状态,持续 {持续回合} 回合;" + + $"强运状态下,角色每个回合结束时随机生成 {强运.最小生成数量}~{强运.最大生成数量} 份绑定自身的回合奖励。"; + public override DispelledType DispelledType => DispelledType.CannotBeDispelled; + + /// 持续回合:2 / 3 / 4 / 4(随等级提升,最高 4) + private int 持续回合 => Math.Min(4, Math.Max(2, 2 + (Skill.Level - 1))); + + /// + /// 命中率:统一走 (2026-09-23 统一口径)。 + /// 纯机制魔法没有自身概率 ⇒ 取默认基础概率 0.5、成长 0 + /// ⇒ 效能 200% 必中 / 100% 命中 50% / →0% →0%。 + /// + private double 命中率 => EfficacyHit.命中率(Skill); + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + foreach (Character target in ctx.Targets) + { + if (target.HP <= 0) continue; + if (!命中检定(caster, target)) continue; + + 强运 e = new(Skill, target, caster, false, 0, 持续回合); + target.Effects.Add(e); + e.OnEffectGained(new HookContext(GamingQueue, target)); + WriteLine($"[ {target} ] 被十二宫星环笼罩,获得【强运】状态!持续 {持续回合} 回合!"); + } + } + + /// 命中检定:统一走 (效能够高时必中且不消耗随机数)。 + private bool 命中检定(Character caster, Character target) + { + double rate = 命中率; + string info = EfficacyHit.文本(Skill, rate); + if (!EfficacyHit.检定(rate, Random)) + { + WriteLine($"[ {caster} ] 的十二宫星环未能笼罩 [ {target} ],被抵抗了!({info})"); + return false; + } + WriteLine($"[ {caster} ] 的十二宫星环命中了 [ {target} ]({info})。"); + return true; + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/反魔法领域.cs b/OshimaBot.Content/Skills/魔法/反魔法领域.cs new file mode 100644 index 0000000..5dd9725 --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/反魔法领域.cs @@ -0,0 +1,61 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 反魔法领域 : Skill + { + public override long Id => (long)MagicID.反魔法领域; + public override string Name => "反魔法领域"; + public override string Description => Effects.Count > 0 ? string.Join("\r\n", Effects.Select(e => e.Description)) : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override string ExemptionDescription => Effects.Count > 0 ? Effects.First().ExemptionDescription : ""; + public override double MPCost + { + get + { + return Level switch + { + 8 => 魔法消耗基础 + 7 * 魔法消耗等级成长, + 7 => 魔法消耗基础 + 5 * 魔法消耗等级成长, + 6 => 魔法消耗基础 + 5 * 魔法消耗等级成长, + 5 => 魔法消耗基础 + 4 * 魔法消耗等级成长, + 4 => 魔法消耗基础 + 3 * 魔法消耗等级成长, + 3 => 魔法消耗基础 + 2 * 魔法消耗等级成长, + _ => 魔法消耗基础 + }; + } + } + public override double CD => Level > 0 ? 55 - (2 * (Level - 1)) : 55; + public override double CastTime => Level > 0 ? 5 + (0.5 * (Level - 1)) : 5; + public override double HardnessTime { get; set; } = 5; + public override int CanSelectTargetCount + { + get + { + return Level switch + { + 8 => 6, + 7 => 5, + 6 => 4, + 5 => 4, + 4 => 3, + 3 => 2, + _ => 1 + }; + } + } + private double 魔法消耗基础 { get; set; } = 85; + private double 魔法消耗等级成长 { get; set; } = 80; + public override SkillRangeType SkillRangeType => SkillRangeType.Circle; + public override int CanSelectTargetRange => 3; + public override double MagicBottleneck => 13 + 14 * (Level - 1); + + public 反魔法领域(Character? character = null) : base(SkillType.Magic, character) + { + IsNonDirectional = true; + Effects.Add(new 造成封技(this, true, 15, 0, 1)); + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/回复术.cs b/OshimaBot.Content/Skills/魔法/回复术.cs new file mode 100644 index 0000000..cd6e897 --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/回复术.cs @@ -0,0 +1,28 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 回复术 : Skill + { + public override long Id => (long)MagicID.回复术; + public override string Name => "回复术"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override double MPCost => Level > 0 ? 75 + (75 * (Level - 1)) : 75; + public override double CD => 28; + public override double CastTime => 3; + public override double HardnessTime { get; set; } = 5; + public override bool CanSelectSelf => true; + public override bool CanSelectEnemy => false; + public override bool CanSelectTeammate => true; + public override int CanSelectTargetCount => 1; + public override double MagicBottleneck => 11 + 12 * (Level - 1); + + public 回复术(Character? character = null) : base(SkillType.Magic, character) + { + SelectTargetPredicates.Add(c => c.HP > 0 && c.HP < c.MaxHP); + Effects.Add(new 纯数值回复生命(this, 540, 430)); + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/回复术复.cs b/OshimaBot.Content/Skills/魔法/回复术复.cs new file mode 100644 index 0000000..ce78779 --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/回复术复.cs @@ -0,0 +1,43 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 回复术复 : Skill + { + public override long Id => (long)MagicID.回复术复; + public override string Name => "回复术·复"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override double MPCost => Level > 0 ? 95 + (105 * (Level - 1)) : 95; + public override double CD => 34; + public override double CastTime => 6; + public override double HardnessTime { get; set; } = 7; + public override bool CanSelectSelf => true; + public override bool CanSelectEnemy => false; + public override bool CanSelectTeammate => true; + public override int CanSelectTargetCount + { + get + { + return Level switch + { + 3 => 3, + 4 => 3, + 5 => 4, + 6 => 4, + 7 => 5, + 8 => 5, + _ => 2 + }; + } + } + public override double MagicBottleneck => 13 + 14 * (Level - 1); + + public 回复术复(Character? character = null) : base(SkillType.Magic, character) + { + SelectTargetPredicates.Add(c => c.HP > 0 && c.HP < c.MaxHP); + Effects.Add(new 百分比回复生命值(this, 0.24, 0.03)); + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/回复术改.cs b/OshimaBot.Content/Skills/魔法/回复术改.cs new file mode 100644 index 0000000..28c2b13 --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/回复术改.cs @@ -0,0 +1,28 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 回复术改 : Skill + { + public override long Id => (long)MagicID.回复术改; + public override string Name => "回复术·改"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override double MPCost => Level > 0 ? 80 + (80 * (Level - 1)) : 80; + public override double CD => 40; + public override double CastTime => 3; + public override double HardnessTime { get; set; } = 7; + public override bool CanSelectSelf => true; + public override bool CanSelectEnemy => false; + public override bool CanSelectTeammate => true; + public override int CanSelectTargetCount => 1; + public override double MagicBottleneck => 14 + 15 * (Level - 1); + + public 回复术改(Character? character = null) : base(SkillType.Magic, character) + { + SelectTargetPredicates.Add(c => c.HP > 0 && c.HP < c.MaxHP); + Effects.Add(new 百分比回复生命值(this, 0.36, 0.04)); + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/圣灵术.cs b/OshimaBot.Content/Skills/魔法/圣灵术.cs new file mode 100644 index 0000000..86950ea --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/圣灵术.cs @@ -0,0 +1,31 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 圣灵术 : Skill + { + public override long Id => (long)MagicID.圣灵术; + public override string Name => "圣灵术"; + public override string Description => string.Join("", Effects.Select(e => e.Description)); + public override string DispelDescription => Effects.FirstOrDefault(e => e is 弱驱散特效)?.DispelDescription ?? ""; + public override double MPCost => Level > 0 ? 110 + (95 * (Level - 1)) : 110; + public override double CD => Level > 0 ? 65 - (2 * (Level - 1)) : 65; + public override double CastTime => 3; + public override double HardnessTime { get; set; } = 7; + public override bool CanSelectSelf => true; + public override bool CanSelectEnemy => false; + public override bool CanSelectTeammate => true; + public override bool SelectAllTeammates => true; + public override bool AllowSelectDead => true; + public override double MagicBottleneck => 15 + 16 * (Level - 1); + + public 圣灵术(Character? character = null) : base(SkillType.Magic, character) + { + SelectTargetPredicates.Add(c => c.HP >= 0 && c.HP < c.MaxHP); + Effects.Add(new 强驱散特效(this)); + Effects.Add(new 纯数值回复生命(this, 380, 270, true)); + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/地狱之门.cs b/OshimaBot.Content/Skills/魔法/地狱之门.cs new file mode 100644 index 0000000..ec56817 --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/地狱之门.cs @@ -0,0 +1,44 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 地狱之门 : Skill + { + public override long Id => (long)MagicID.地狱之门; + public override string Name => "地狱之门"; + public override string Description => string.Join("", Effects.Select(e => e.Description)); + public override string DispelDescription => Effects.Count > 0 ? Effects.First(e => e is 施加概率负面).DispelDescription : ""; + public override string ExemptionDescription => Effects.Count > 0 ? Effects.First(e => e is 施加概率负面).ExemptionDescription : ""; + public override double MPCost => Level > 0 ? 75 + (60 * (Level - 1)) : 75; + public override double CD => Level > 0 ? 30 + (0.8 * (Level - 1)) : 30; + public override double CastTime => 3; + public override double HardnessTime { get; set; } = 8; + public override int CanSelectTargetCount + { + get + { + return Level switch + { + 4 => 2, + 5 => 2, + 6 => 3, + 7 => 3, + 8 => 4, + _ => 1 + }; + } + } + public override SkillRangeType SkillRangeType => SkillRangeType.Sector; + public override int CanSelectTargetRange => 4; + public override double MagicBottleneck => 15 + 20 * (Level - 1); + + public 地狱之门(Character? character = null) : base(SkillType.Magic, character) + { + IsNonDirectional = true; + Effects.Add(new 纯数值伤害(this, 75, 15, DamageType.Magical)); + Effects.Add(new 施加概率负面(this, EffectType.Bleed, true, 3, 0, 0.5, 0.2, 0.03, false, 85.0)); + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/复苏术.cs b/OshimaBot.Content/Skills/魔法/复苏术.cs new file mode 100644 index 0000000..ebb42f2 --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/复苏术.cs @@ -0,0 +1,31 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 复苏术 : Skill + { + public override long Id => (long)MagicID.复苏术; + public override string Name => "复苏术"; + public override string Description => string.Join("", Effects.Select(e => e.Description)); + public override string DispelDescription => Effects.FirstOrDefault(e => e is 弱驱散特效)?.DispelDescription ?? ""; + public override double MPCost => Level > 0 ? 95 + (85 * (Level - 1)) : 95; + public override double CD => 48; + public override double CastTime => 6; + public override double HardnessTime { get; set; } = 8; + public override bool CanSelectSelf => true; + public override bool CanSelectEnemy => false; + public override bool CanSelectTeammate => true; + public override int CanSelectTargetCount => 1; + public override bool AllowSelectDead => true; + public override double MagicBottleneck => 14 + 15 * (Level - 1); + + public 复苏术(Character? character = null) : base(SkillType.Magic, character) + { + SelectTargetPredicates.Add(c => c.HP >= 0 && c.HP < c.MaxHP); + Effects.Add(new 强驱散特效(this)); + Effects.Add(new 百分比回复生命值(this, 0.21, 0.02, true)); + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/大地之墙.cs b/OshimaBot.Content/Skills/魔法/大地之墙.cs new file mode 100644 index 0000000..6fdfe63 --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/大地之墙.cs @@ -0,0 +1,140 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; +using OshimaBot.Content.Effects.PassiveEffects; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 大地之墙 : Skill + { + public override long Id => (long)MagicID.大地之墙; + public override string Name => "大地之墙"; + public override string Description => string.Join("", Effects.Select(e => e.Description)); + public override string DispelDescription => "驱散性:持续性弱驱散\r\n被驱散性:护盾不可驱散,持续性弱驱散在护盾值用尽前需强驱散,否则可弱驱散"; + public override double MPCost + { + get + { + return Level switch + { + 8 => 魔法消耗基础 + 6 * 魔法消耗等级成长, + 7 => 魔法消耗基础 + 4 * 魔法消耗等级成长, + 6 => 魔法消耗基础 + 4 * 魔法消耗等级成长, + 5 => 魔法消耗基础 + 3 * 魔法消耗等级成长, + 4 => 魔法消耗基础 + 3 * 魔法消耗等级成长, + 3 => 魔法消耗基础 + 2.5 * 魔法消耗等级成长, + _ => 魔法消耗基础 + }; + } + } + public override double CD => Level > 0 ? 48 - (2 * (Level - 1)) : 48; + public override double CastTime + { + get + { + return Level switch + { + 8 => 7, + 7 => 7, + 6 => 8, + 5 => 8, + 4 => 9, + 3 => 10, + 2 => 11, + _ => 12 + }; + } + } + public override double HardnessTime { get; set; } = 8; + private double 魔法消耗基础 { get; set; } = 90; + private double 魔法消耗等级成长 { get; set; } = 90; + public override bool CanSelectSelf => true; + public override bool CanSelectEnemy => false; + public override bool CanSelectTeammate => true; + public override int CanSelectTargetCount + { + get + { + return Level switch + { + 8 => 4, + 7 => 3, + 6 => 3, + 5 => 2, + 4 => 2, + 3 => 2, + _ => 1 + }; + } + } + public override SkillRangeType SkillRangeType => SkillRangeType.Circle; + public override int CanSelectTargetRange => 3; + public override double MagicBottleneck => 12 + 13 * (Level - 1); + + public 大地之墙(Character? character = null) : base(SkillType.Magic, character) + { + IsNonDirectional = true; + Effect effect = new 大地之墙特效(this); + Effect shield = new 增加物理护盾_特效持续型(this, 120, 160, true, 20) + { + DispelledType = DispelledType.CannotBeDispelled, + ParentEffect = effect + }; + Effects.Add(shield); + Effect dispel = new 施加持续性弱驱散(this, durative: true, duration: 12) + { + DispelledType = DispelledType.Strong, + ParentEffect = effect + }; + Effects.Add(dispel); + Effects.Add(effect); + } + } + + 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 ForceHideInStatusBar => true; + + private List _targets = []; + + public override void OnTimeElapsed(TimeLapseContext ctx) + { + if (ctx.Trigger is not Character character) return; + double elapsed = ctx.Elapsed; + if (!character.Effects.Any(e => e is 物理护盾 && e.ParentEffect == this)) + { + if (character.Effects.FirstOrDefault(e => e is 施加持续性弱驱散 && e.ParentEffect == this) is 施加持续性弱驱散 e) + { + e.DispelledType = DispelledType.Weak; + } + else + { + character.Effects.Remove(this); + } + } + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + _targets = targets; + foreach (Character target in targets) + { + target.Effects.Add(this); + } + } + + public string Observer() + { + return $"正在监控目标角色 [ {string.Join(" ] / [ ", _targets)} ] 的对象:{string.Join(",", _targets.SelectMany(c => c.Effects.Where(e => e.ParentEffect == this).Distinct().Select(e => e.Name)))}"; + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/导力停止.cs b/OshimaBot.Content/Skills/魔法/导力停止.cs new file mode 100644 index 0000000..2e2ec13 --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/导力停止.cs @@ -0,0 +1,27 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 导力停止 : Skill + { + public override long Id => (long)MagicID.导力停止; + public override string Name => "导力停止"; + public override string Description => string.Join("", Effects.Select(e => e.Description)); + public override string DispelDescription => Effects.Count > 0 ? Effects.First(e => e is 施加概率负面).DispelDescription : ""; + public override string ExemptionDescription => Effects.Count > 0 ? Effects.First(e => e is 施加概率负面).ExemptionDescription : ""; + public override double MPCost => Level > 0 ? 120 + (80 * (Level - 1)) : 120; + public override double CD => Level > 0 ? 60 - (1.5 * (Level - 1)) : 60; + public override double CastTime => Level > 0 ? 3 + (0.5 * (Level - 1)) : 3; + public override double HardnessTime { get; set; } = 8; + public override bool SelectAllEnemies => true; + public override double MagicBottleneck => 28 + 24 * (Level - 1); + + public 导力停止(Character? character = null) : base(SkillType.Magic, character) + { + Effects.Add(new 纯数值伤害(this, 45, 20, DamageType.Magical)); + Effects.Add(new 施加概率负面(this, EffectType.Silence, true, 8, 0, 1.2, 0.2, 0.03)); + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/岩石之息.cs b/OshimaBot.Content/Skills/魔法/岩石之息.cs new file mode 100644 index 0000000..66e69f7 --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/岩石之息.cs @@ -0,0 +1,27 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 岩石之息 : Skill + { + public override long Id => (long)MagicID.岩石之息; + public override string Name => "岩石之息"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override double MPCost => Level > 0 ? 40 + (35 * (Level - 1)) : 40; + public override double CD => 32; + public override double CastTime => 9; + public override double HardnessTime { get; set; } = 5; + public override int CanSelectTargetCount => 3; + public override SkillRangeType SkillRangeType => SkillRangeType.LinePass; + public override int CanSelectTargetRange => 2; + public override double MagicBottleneck => 12 + 13 * (Level - 1); + + public 岩石之息(Character? character = null) : base(SkillType.Magic, character) + { + IsNonDirectional = true; + Effects.Add(new 基于属性的伤害(this, PrimaryAttribute.STR, 30, 10, 0.30, 0.2)); + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/弧光消耗.cs b/OshimaBot.Content/Skills/魔法/弧光消耗.cs new file mode 100644 index 0000000..509bac4 --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/弧光消耗.cs @@ -0,0 +1,28 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 弧光消耗 : Skill + { + public override long Id => (long)MagicID.弧光消耗; + public override string Name => "弧光消耗"; + public override string Description => string.Join("", Effects.Select(e => e.Description)); + public override double MPCost => Level > 0 ? 35 + (30 * (Level - 1)) : 35; + public override double CD => 35; + public override double CastTime => 4; + public override double HardnessTime { get; set; } = 5; + public override int CanSelectTargetCount => 3; + public override SkillRangeType SkillRangeType => SkillRangeType.Circle; + public override int CanSelectTargetRange => 3; + public override double MagicBottleneck => 12 + 13 * (Level - 1); + + public 弧光消耗(Character? character = null) : base(SkillType.Magic, character) + { + IsNonDirectional = true; + Effects.Add(new 吸取魔法值(this, 35, 30, false, 0.7)); + Effects.Add(new 吸取能量值(this, 4, 3, false, 0.3)); + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/弧形日珥.cs b/OshimaBot.Content/Skills/魔法/弧形日珥.cs new file mode 100644 index 0000000..5799f55 --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/弧形日珥.cs @@ -0,0 +1,24 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 弧形日珥 : Skill + { + public override long Id => (long)MagicID.弧形日珥; + public override string Name => "弧形日珥"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override double MPCost => Level > 0 ? 55 + (55 * (Level - 1)) : 55; + public override double CD => 35; + public override double CastTime => 8; + public override double HardnessTime { get; set; } = 6; + public override int CanSelectTargetCount => 3; + public override double MagicBottleneck => 12 + 13 * (Level - 1); + + public 弧形日珥(Character? character = null) : base(SkillType.Magic, character) + { + Effects.Add(new 基于属性的伤害(this, PrimaryAttribute.AGI, 45, 25, 0.2, 0.12)); + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/强音之力.cs b/OshimaBot.Content/Skills/魔法/强音之力.cs new file mode 100644 index 0000000..81724cb --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/强音之力.cs @@ -0,0 +1,93 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Skills +{ + public class 强音之力 : Skill + { + public override long Id => (long)MagicID.强音之力; + public override string Name => "强音之力"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override double MPCost => Level > 0 ? 65 + (70 * (Level - 1)) : 65; + public override double CD => Level > 0 ? 40 - (1 * (Level - 1)) : 40; + public override double CastTime => Level > 0 ? 6 + (0.5 * (Level - 1)) : 6; + public override double HardnessTime { get; set; } = 3; + public override bool CanSelectSelf => true; + public override bool CanSelectEnemy => false; + public override bool CanSelectTeammate => true; + public override int CanSelectTargetCount => 1; + public override double MagicBottleneck => 12 + 13 * (Level - 1); + + public 强音之力(Character? character = null) : base(SkillType.Magic, character) + { + Effects.Add(new 强音之力特效(this, false, 0, 4)); + } + } + + public class 强音之力特效 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"提升目标{(Skill.CanSelectTargetCount > 1 ? $"至多 {Skill.CanSelectTargetCount} 个" : "")}友方角色 {ExATK * 100:0.##}% 攻击力,持续 {持续时间}。"; + public override EffectType EffectType => EffectType.DamageBoost; + public override DispelledType DispelledType => DispelledType.Weak; + + private string 持续时间 => _durative && _duration > 0 ? 实际持续时间 + $" {GameplayEquilibriumConstant.InGameTime}" : (!_durative && _durationTurn > 0 ? 实际持续时间 + " 回合" : $"0 {GameplayEquilibriumConstant.InGameTime}"); + private double 实际持续时间 => _durative && _duration > 0 ? (_duration + _levelGrowth * (Level - 1) * MagicEfficacy) : (!_durative && _durationTurn > 0 ? ((int)Math.Round(_durationTurn + _levelGrowth * (Level - 1) * MagicEfficacy, 0, MidpointRounding.ToPositiveInfinity)) : 0); + + private readonly bool _durative; + private readonly double _duration; + private readonly int _durationTurn; + private readonly double _levelGrowth; + + private double ExATK => Level > 0 ? 0.06 + 0.06 * (Level - 1) : 0.06; + + public 强音之力特效(Skill skill, bool durative = false, double duration = 0, int durationTurn = 1, double levelGrowth = 0) : base(skill) + { + GamingQueue = skill.GamingQueue; + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + _levelGrowth = levelGrowth; + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + foreach (Character target in targets) + { + WriteLine($"[ {target} ] 的攻击力提升了 {ExATK * 100:0.##}%!持续时间:{持续时间}!"); + ExATK2 e = new(Skill, new() + { + { "exatk", ExATK } + }, caster) + { + Name = Name + }; + target.Effects.Add(e); + if (_durative && _duration > 0) + { + e.Durative = true; + e.Duration = 实际持续时间; + e.RemainDuration = 实际持续时间; + } + else if (!_durative && _durationTurn > 0) + { + e.Durative = false; + e.DurationTurn = (int)实际持续时间; + e.RemainDurationTurn = (int)实际持续时间; + } + e.EffectType = EffectType.DamageBoost; + e.Source = caster; + e.OnEffectGained(new HookContext(GamingQueue, target)); + GamingQueue?.AddApplyEffects(target, EffectType.DamageBoost); + } + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/强音之力复.cs b/OshimaBot.Content/Skills/魔法/强音之力复.cs new file mode 100644 index 0000000..b26bc52 --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/强音之力复.cs @@ -0,0 +1,108 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Skills +{ + public class 强音之力复 : Skill + { + public override long Id => (long)MagicID.强音之力复; + public override string Name => "强音之力·复"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override double MPCost => Level > 0 ? 85 + (85 * (Level - 1)) : 85; + public override double CD => Level > 0 ? 45 - (0.5 * (Level - 1)) : 45; + public override double CastTime => Level > 0 ? 3 + (0.5 * (Level - 1)) : 3; + public override double HardnessTime { get; set; } = 6; + public override bool CanSelectSelf => true; + public override bool CanSelectEnemy => false; + public override bool CanSelectTeammate => true; + public override int CanSelectTargetCount + { + get + { + return Level switch + { + 3 => 3, + 4 => 3, + 5 => 3, + 6 => 4, + 7 => 4, + 8 => 4, + _ => 2 + }; + } + } + public override double MagicBottleneck => 14 + 15 * (Level - 1); + + public 强音之力复(Character? character = null) : base(SkillType.Magic, character) + { + Effects.Add(new 强音之力复特效(this, false, 0, 3)); + } + } + + public class 强音之力复特效 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"提升目标{(Skill.CanSelectTargetCount > 1 ? $"至多 {Skill.CanSelectTargetCount} 个" : "")}友方角色 {ExATK * 100:0.##}% 攻击力,持续 {持续时间}。"; + public override EffectType EffectType => EffectType.DamageBoost; + public override DispelledType DispelledType => DispelledType.Weak; + + private string 持续时间 => _durative && _duration > 0 ? 实际持续时间 + $" {GameplayEquilibriumConstant.InGameTime}" : (!_durative && _durationTurn > 0 ? 实际持续时间 + " 回合" : $"0 {GameplayEquilibriumConstant.InGameTime}"); + private double 实际持续时间 => _durative && _duration > 0 ? (_duration + _levelGrowth * (Level - 1) * MagicEfficacy) : (!_durative && _durationTurn > 0 ? ((int)Math.Round(_durationTurn + _levelGrowth * (Level - 1) * MagicEfficacy, 0, MidpointRounding.ToPositiveInfinity)) : 0); + + private readonly bool _durative; + private readonly double _duration; + private readonly int _durationTurn; + private readonly double _levelGrowth; + + private double ExATK => Level > 0 ? 0.045 + 0.045 * (Level - 1) : 0.045; + + public 强音之力复特效(Skill skill, bool durative = false, double duration = 0, int durationTurn = 1, double levelGrowth = 0) : base(skill) + { + GamingQueue = skill.GamingQueue; + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + _levelGrowth = levelGrowth; + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + foreach (Character target in targets) + { + WriteLine($"[ {target} ] 的攻击力提升了 {ExATK * 100:0.##}%!持续时间:{持续时间}!"); + ExATK2 e = new(Skill, new() + { + { "exatk", ExATK } + }, caster) + { + Name = Name + }; + target.Effects.Add(e); + if (_durative && _duration > 0) + { + e.Durative = true; + e.Duration = 实际持续时间; + e.RemainDuration = 实际持续时间; + } + else if (!_durative && _durationTurn > 0) + { + e.Durative = false; + e.DurationTurn = (int)实际持续时间; + e.RemainDurationTurn = (int)实际持续时间; + } + e.EffectType = EffectType.DamageBoost; + e.Source = caster; + e.OnEffectGained(new HookContext(GamingQueue, target)); + GamingQueue?.AddApplyEffects(target, EffectType.DamageBoost); + } + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/心灵之霞.cs b/OshimaBot.Content/Skills/魔法/心灵之霞.cs new file mode 100644 index 0000000..71b8202 --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/心灵之霞.cs @@ -0,0 +1,23 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 心灵之霞 : Skill + { + public override long Id => (long)MagicID.心灵之霞; + public override string Name => "心灵之霞"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override double MPCost => Level > 0 ? 35 + (50 * (Level - 1)) : 35; + public override double CD => 30; + public override double CastTime => 6; + public override double HardnessTime { get; set; } = 3; + public override double MagicBottleneck => 25 + 22 * (Level - 1); + + public 心灵之霞(Character? character = null) : base(SkillType.Magic, character) + { + Effects.Add(new 基于属性的伤害(this, PrimaryAttribute.INT, 80, 55, 0.5, 0.6)); + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/时间减速.cs b/OshimaBot.Content/Skills/魔法/时间减速.cs new file mode 100644 index 0000000..a09870b --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/时间减速.cs @@ -0,0 +1,24 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 时间减速 : Skill + { + public override long Id => (long)MagicID.时间减速; + public override string Name => "时间减速"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string ExemptionDescription => Effects.Count > 0 ? Effects.First().ExemptionDescription : ""; + public override double MPCost => Level > 0 ? 65 + (75 * (Level - 1)) : 65; + public override double CD => Level > 0 ? 28 - (1 * (Level - 1)) : 28; + public override double CastTime => Level > 0 ? 2 + (2 * (Level - 1)) : 2; + public override double HardnessTime { get; set; } = 5; + public override double MagicBottleneck => 12 + 13 * (Level - 1); + + public 时间减速(Character? character = null) : base(SkillType.Magic, character) + { + Effects.Add(new 降低敌方行动速度(this, 65, 35)); + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/时间减速复.cs b/OshimaBot.Content/Skills/魔法/时间减速复.cs new file mode 100644 index 0000000..3b5ba5f --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/时间减速复.cs @@ -0,0 +1,130 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Skills +{ + public class 时间减速复 : Skill + { + public override long Id => (long)MagicID.时间减速复; + public override string Name => "时间减速·复"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string ExemptionDescription => Effects.Count > 0 ? Effects.First().ExemptionDescription : ""; + public override double MPCost => Level > 0 ? 85 + (95 * (Level - 1)) : 85; + public override double CD => Level > 0 ? 32 - (1 * (Level - 1)) : 32; + public override double CastTime => Level > 0 ? 4 + (1 * (Level - 1)) : 4; + public override double HardnessTime { get; set; } = 6; + public override int CanSelectTargetCount + { + get + { + return Level switch + { + 3 => 3, + 4 => 3, + 5 => 3, + 6 => 4, + 7 => 4, + 8 => 4, + _ => 2 + }; + } + } + public override double MagicBottleneck => 14 + 14 * (Level - 1); + + public 时间减速复(Character? character = null) : base(SkillType.Magic, character) + { + Effects.Add(new 时间减速复特效(this, false, 0, 3, 0, 40, 30, 0.08, 0.01)); + } + } + + public class 时间减速复特效 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"{(!IsDebuff ? "增加" : "减少")}{Skill.TargetDescription()} {Math.Abs(ExSPD):0.##} 点行动速度,并{(!IsDebuff ? "缩短" : "延长")}目标 30% 的行动等待时间(当前硬直时间);" + + $"{(!IsDebuff ? "增加" : "减少")}{Skill.TargetDescription()} {Math.Abs(ExACC) * 100:0.##}% 加速系数。持续 {持续时间}。"; + public override EffectType EffectType => EffectType.Slow; + public override DispelledType DispelledType => DispelledType.Weak; + public override bool ExemptDuration => true; + public override bool IsDebuff => true; + + private string 持续时间 => _durative && _duration > 0 ? 实际持续时间 + $" {GameplayEquilibriumConstant.InGameTime}" : (!_durative && _durationTurn > 0 ? 实际持续时间 + " 回合" : $"0 {GameplayEquilibriumConstant.InGameTime}"); + private double 实际持续时间 => _durative && _duration > 0 ? (_duration + _levelGrowth * (Level - 1) * MagicEfficacy) : (!_durative && _durationTurn > 0 ? ((int)Math.Round(_durationTurn + _levelGrowth * (Level - 1) * MagicEfficacy, 0, MidpointRounding.ToPositiveInfinity)) : 0); + + private readonly bool _durative; + private readonly double _duration; + private readonly int _durationTurn; + private readonly double _levelGrowth; + private readonly double _baseSpd; + private readonly double _baseAcc; + private readonly double _spdLevelGrowth; + private readonly double _accLevelGrowth; + + private double ExSPD => Level > 0 ? _baseSpd + _spdLevelGrowth * (Level - 1) : _baseSpd; + private double ExACC => Level > 0 ? _baseAcc + _accLevelGrowth * (Level - 1) : _baseAcc; + + public 时间减速复特效(Skill skill, bool durative = false, double duration = 0, int durationTurn = 1, double levelGrowth = 0, double baseSpd = 0, double spdLevelGrowth = 0, double baseAcc = 0, double accLevelGrowth = 0) : base(skill) + { + GamingQueue = skill.GamingQueue; + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + _levelGrowth = levelGrowth; + _baseSpd = baseSpd; + _spdLevelGrowth = spdLevelGrowth; + _baseAcc = baseAcc; + _accLevelGrowth = accLevelGrowth; + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + foreach (Character target in targets) + { + Effect e1 = new ExSPD(Skill, new Dictionary() + { + { "exspd", -ExSPD } + }, caster) + { + Name = Name + "·行动速度降低", + Durative = _durative, + Duration = 实际持续时间, + DurationTurn = (int)实际持续时间 + }; + if (!CheckExemption(caster, target, e1)) + { + WriteLine($"[ {target} ] 的行动速度降低了 {ExSPD:0.##} 点,行动等待时间(当前硬直时间)被延长了 30%!持续时间:{持续时间}!"); + target.Effects.Add(e1); + e1.OnEffectGained(new HookContext(GamingQueue, target)); + e1.IsDebuff = true; + GamingQueue?.ChangeCharacterHardnessTime(target, 0.3, true, false); + } + Effect e2 = new AccelerationCoefficient(Skill, new() + { + { "exacc", -ExACC } + }, caster) + { + Name = Name + "·加速系数降低", + Durative = _durative, + Duration = 实际持续时间, + DurationTurn = (int)实际持续时间 + }; + if (!CheckExemption(caster, target, e2)) + { + WriteLine($"[ {target} ] 的加速系数降低了 {ExACC * 100:0.##}%!持续时间:{持续时间}!"); + target.Effects.Add(e2); + e2.OnEffectGained(new HookContext(GamingQueue, target)); + e2.IsDebuff = true; + GamingQueue?.AddApplyEffects(target, EffectType.Slow); + } + } + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/时间减速改.cs b/OshimaBot.Content/Skills/魔法/时间减速改.cs new file mode 100644 index 0000000..c7a2dd0 --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/时间减速改.cs @@ -0,0 +1,114 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Skills +{ + public class 时间减速改 : Skill + { + public override long Id => (long)MagicID.时间减速改; + public override string Name => "时间减速·改"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string ExemptionDescription => Effects.Count > 0 ? Effects.First().ExemptionDescription : ""; + public override double MPCost => Level > 0 ? 75 + (85 * (Level - 1)) : 75; + public override double CD => Level > 0 ? 38 - (1 * (Level - 1)) : 38; + public override double CastTime => Level > 0 ? 4 + (0.5 * (Level - 1)) : 4; + public override double HardnessTime { get; set; } = 4; + public override double MagicBottleneck => 15 + 15 * (Level - 1); + + public 时间减速改(Character? character = null) : base(SkillType.Magic, character) + { + Effects.Add(new 时间减速改特效(this, false, 0, 4, 0, 50, 40, 0.1, 0.02)); + } + } + + public class 时间减速改特效 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"{(!IsDebuff ? "增加" : "减少")}{Skill.TargetDescription()} {Math.Abs(ExSPD):0.##} 点行动速度,并{(!IsDebuff ? "缩短" : "延长")}目标 30% 的行动等待时间(当前硬直时间);" + + $"{(!IsDebuff ? "增加" : "减少")}{Skill.TargetDescription()} {Math.Abs(ExACC) * 100:0.##}% 加速系数。持续 {持续时间}。"; + public override EffectType EffectType => EffectType.Slow; + public override DispelledType DispelledType => DispelledType.Weak; + public override bool ExemptDuration => true; + public override bool IsDebuff => true; + + private string 持续时间 => _durative && _duration > 0 ? 实际持续时间 + $" {GameplayEquilibriumConstant.InGameTime}" : (!_durative && _durationTurn > 0 ? 实际持续时间 + " 回合" : $"0 {GameplayEquilibriumConstant.InGameTime}"); + private double 实际持续时间 => _durative && _duration > 0 ? (_duration + _levelGrowth * (Level - 1) * MagicEfficacy) : (!_durative && _durationTurn > 0 ? ((int)Math.Round(_durationTurn + _levelGrowth * (Level - 1) * MagicEfficacy, 0, MidpointRounding.ToPositiveInfinity)) : 0); + + private readonly bool _durative; + private readonly double _duration; + private readonly int _durationTurn; + private readonly double _levelGrowth; + private readonly double _baseSpd; + private readonly double _baseAcc; + private readonly double _spdLevelGrowth; + private readonly double _accLevelGrowth; + + private double ExSPD => Level > 0 ? _baseSpd + _spdLevelGrowth * (Level - 1) : _baseSpd; + private double ExACC => Level > 0 ? _baseAcc + _accLevelGrowth * (Level - 1) : _baseAcc; + + public 时间减速改特效(Skill skill, bool durative = false, double duration = 0, int durationTurn = 1, double levelGrowth = 0, double baseSpd = 0, double spdLevelGrowth = 0, double baseAcc = 0, double accLevelGrowth = 0) : base(skill) + { + GamingQueue = skill.GamingQueue; + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + _levelGrowth = levelGrowth; + _baseSpd = baseSpd; + _spdLevelGrowth = spdLevelGrowth; + _baseAcc = baseAcc; + _accLevelGrowth = accLevelGrowth; + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + foreach (Character target in targets) + { + Effect e1 = new ExSPD(Skill, new Dictionary() + { + { "exspd", -ExSPD } + }, caster) + { + Name = Name + "·行动速度降低", + Durative = _durative, + Duration = 实际持续时间, + DurationTurn = (int)实际持续时间 + }; + if (!CheckExemption(caster, target, e1)) + { + WriteLine($"[ {target} ] 的行动速度降低了 {ExSPD:0.##} 点,行动等待时间(当前硬直时间)被延长了 30%!持续时间:{持续时间}!"); + target.Effects.Add(e1); + e1.OnEffectGained(new HookContext(GamingQueue, target)); + e1.IsDebuff = true; + GamingQueue?.ChangeCharacterHardnessTime(target, 0.3, true, false); + } + Effect e2 = new AccelerationCoefficient(Skill, new() + { + { "exacc", -ExACC } + }, caster) + { + Name = Name + "·加速系数降低", + Durative = _durative, + Duration = 实际持续时间, + DurationTurn = (int)实际持续时间 + }; + if (!CheckExemption(caster, target, e2)) + { + WriteLine($"[ {target} ] 的加速系数降低了 {ExACC * 100:0.##}%!持续时间:{持续时间}!"); + target.Effects.Add(e2); + e2.OnEffectGained(new HookContext(GamingQueue, target)); + e2.IsDebuff = true; + GamingQueue?.AddApplyEffects(target, EffectType.Slow); + } + } + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/时间剥夺.cs b/OshimaBot.Content/Skills/魔法/时间剥夺.cs new file mode 100644 index 0000000..cc30432 --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/时间剥夺.cs @@ -0,0 +1,87 @@ +using FunGame.Core.Entity; +using OshimaBot.Content.Effects; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; + +namespace OshimaBot.Content.Skills +{ + /// + /// 魔法 · 控制型【时间剥夺】—— 直接剥夺对手的决策点 + /// 设计意图:本项目首次把「控制」从**状态层面**下移到**资源层面**。 + /// 实测表明决策点是硬约束(AI 行动循环持续到 `CurrentDecisionPoints` 耗尽, + /// `GamingQueue.cs:1201`)且每回合被用光(上回合结束仅剩 ~7%) + /// ⇒ **把对手的决策点削到 0,等于直接终止他本回合的行动**,且不吃"控制状态"的免疫/驱散。 + /// 标尺(魔法):MP L8 240–900 → 365|CD 20–65 → L8 = 41|吟唱 2–12 → 3|硬直 3–8 → 5; + /// `MagicBottleneck` 必填 → 103。剥夺量 L1–3=1 / L4–7=2 / L8=3。 + /// ⚠ 归属:这是**新型控制手段**,手册标尺原本没有对应条目,本实现按 + /// 「每次剥夺 2 点 ≈ 目标少做 1 件事、弱于封技 1 回合」定价,并留 41 秒冷却。 + /// + public class 时间剥夺 : Skill + { + public override long Id => (long)MagicID.时间剥夺; + public override string Name => "时间剥夺"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override double MPCost => Level > 0 ? 105 + 95 * (Level - 1) : 105; + public override double CD => Level > 0 ? 45 + 2 * (Level - 1) : 45; + public override double CastTime => Level > 0 ? 3 + 1 * (Level - 1) : 3; + public override double HardnessTime { get; set; } = 5; + public override bool CanSelectEnemy => true; + public override bool CanSelectTeammate => false; + public override bool CanSelectSelf => false; + public override int CanSelectTargetCount => 1; + public override double MagicBottleneck => 103; + + public 时间剥夺(Character? character = null) : base(SkillType.Magic, 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 => $"剥夺目标 {剥夺量} 点决策点(不会使其低于 0)。"; + + /// 剥夺量:L1–3 = 1 / L4–7 = 2 / L8 = 3 + private int 剥夺量 => 1 + Skill.Level / 4; + + /// + /// 命中率:统一走 (2026-09-23 统一口径)。 + /// 纯机制魔法没有自身概率 ⇒ 取默认基础概率 0.5、成长 0 + /// ⇒ 效能 200% 必中 / 100% 命中 50% / →0% →0%。 + /// + private double 命中率 => EfficacyHit.命中率(Skill); + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + if (GamingQueue is null) return; + foreach (Character target in ctx.Targets) + { + if (target.HP <= 0) continue; + if (!命中检定(caster, target)) continue; + if (!GamingQueue.CharacterDecisionPoints.TryGetValue(target, out DecisionPoints? dp) || dp is null) continue; + int before = dp.CurrentDecisionPoints; + dp.CurrentDecisionPoints = Math.Max(0, before - 剥夺量); + int actual = before - dp.CurrentDecisionPoints; + WriteLine($"[ {caster} ] 对 [ {target} ] 施放了时间剥夺:[ {target} ] 失去 {actual} 点决策点({before} → {dp.CurrentDecisionPoints} / {dp.MaxDecisionPoints}){(dp.CurrentDecisionPoints == 0 ? ",本回合已无法行动!" : "")}"); + } + } + + /// 命中检定:统一走 (效能够高时必中且不消耗随机数)。 + private bool 命中检定(Character caster, Character target) + { + double rate = 命中率; + string info = EfficacyHit.文本(Skill, rate); + if (!EfficacyHit.检定(rate, Random)) + { + WriteLine($"[ {caster} ] 的时间剥夺被 [ {target} ] 抵抗了!({info})"); + return false; + } + WriteLine($"[ {caster} ] 的时间剥夺命中了 [ {target} ]({info})。"); + return true; + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/时间加速.cs b/OshimaBot.Content/Skills/魔法/时间加速.cs new file mode 100644 index 0000000..998276e --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/时间加速.cs @@ -0,0 +1,28 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 时间加速 : Skill + { + public override long Id => (long)MagicID.时间加速; + public override string Name => "时间加速"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override double MPCost => Level > 0 ? 70 + (80 * (Level - 1)) : 70; + // 调整:L8 CD 18 → 20(魔法下限 20) + public override double CD => Level > 0 ? 27 - (1 * (Level - 1)) : 27; + public override double CastTime => Level > 0 ? 2 + (1 * (Level - 1)) : 2; + public override double HardnessTime { get; set; } = 4; + public override bool CanSelectSelf => true; + public override bool CanSelectEnemy => false; + public override bool CanSelectTeammate => true; + public override int CanSelectTargetCount => 1; + public override double MagicBottleneck => 12 + 13 * (Level - 1); + + public 时间加速(Character? character = null) : base(SkillType.Magic, character) + { + Effects.Add(new 提升友方行动速度(this, 65, 30)); + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/时间加速复.cs b/OshimaBot.Content/Skills/魔法/时间加速复.cs new file mode 100644 index 0000000..d6d90b2 --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/时间加速复.cs @@ -0,0 +1,125 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Skills +{ + public class 时间加速复 : Skill + { + public override long Id => (long)MagicID.时间加速复; + public override string Name => "时间加速·复"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override double MPCost => Level > 0 ? 90 + (95 * (Level - 1)) : 90; + public override double CD => Level > 0 ? 55 - (0.8 * (Level - 1)) : 55; + public override double CastTime => Level > 0 ? 4 + (1 * (Level - 1)) : 4; + public override double HardnessTime { get; set; } = 7; + public override bool CanSelectSelf => true; + public override bool CanSelectTeammate => true; + public override bool CanSelectEnemy => false; + public override int CanSelectTargetCount + { + get + { + return Level switch + { + 3 => 3, + 4 => 3, + 5 => 3, + 6 => 4, + 7 => 4, + 8 => 4, + _ => 2 + }; + } + } + public override double MagicBottleneck => 14 + 14 * (Level - 1); + + public 时间加速复(Character? character = null) : base(SkillType.Magic, character) + { + Effects.Add(new 时间加速复特效(this, false, 0, 3, 0, 40, 20, 0.08, 0.01)); + } + } + + public class 时间加速复特效 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"{(!IsDebuff ? "增加" : "减少")}{Skill.TargetDescription()} {Math.Abs(ExSPD):0.##} 点行动速度,并{(!IsDebuff ? "缩短" : "延长")}目标 30% 的行动等待时间(当前硬直时间);" + + $"{(!IsDebuff ? "增加" : "减少")}{Skill.TargetDescription()} {Math.Abs(ExACC) * 100:0.##}% 加速系数。持续 {持续时间}。"; + public override EffectType EffectType => EffectType.Haste; + public override DispelledType DispelledType => DispelledType.Weak; + public override bool IsDebuff => false; + + private string 持续时间 => _durative && _duration > 0 ? 实际持续时间 + $" {GameplayEquilibriumConstant.InGameTime}" : (!_durative && _durationTurn > 0 ? 实际持续时间 + " 回合" : $"0 {GameplayEquilibriumConstant.InGameTime}"); + private double 实际持续时间 => _durative && _duration > 0 ? (_duration + _levelGrowth * (Level - 1) * MagicEfficacy) : (!_durative && _durationTurn > 0 ? ((int)Math.Round(_durationTurn + _levelGrowth * (Level - 1) * MagicEfficacy, 0, MidpointRounding.ToPositiveInfinity)) : 0); + + private readonly bool _durative; + private readonly double _duration; + private readonly int _durationTurn; + private readonly double _levelGrowth; + private readonly double _baseSpd; + private readonly double _baseAcc; + private readonly double _spdLevelGrowth; + private readonly double _accLevelGrowth; + + private double ExSPD => Level > 0 ? _baseSpd + _spdLevelGrowth * (Level - 1) : _baseSpd; + private double ExACC => Level > 0 ? _baseAcc + _accLevelGrowth * (Level - 1) : _baseAcc; + + public 时间加速复特效(Skill skill, bool durative = false, double duration = 0, int durationTurn = 1, double levelGrowth = 0, double baseSpd = 0, double spdLevelGrowth = 0, double baseAcc = 0, double accLevelGrowth = 0) : base(skill) + { + GamingQueue = skill.GamingQueue; + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + _levelGrowth = levelGrowth; + _baseSpd = baseSpd; + _spdLevelGrowth = spdLevelGrowth; + _baseAcc = baseAcc; + _accLevelGrowth = accLevelGrowth; + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + foreach (Character target in targets) + { + WriteLine($"[ {target} ] 的行动速度提升了 {ExSPD:0.##} 点,行动等待时间(当前硬直时间)被缩短了 30%!持续时间:{持续时间}!"); + WriteLine($"[ {target} ] 的加速系数提升了 {ExACC * 100:0.##}%!持续时间:{持续时间}!"); + Effect e1 = new ExSPD(Skill, new Dictionary() + { + { "exspd", ExSPD } + }, caster) + { + Name = Name + "·行动速度提升", + Durative = _durative, + Duration = 实际持续时间, + DurationTurn = (int)实际持续时间 + }; + target.Effects.Add(e1); + e1.OnEffectGained(new HookContext(GamingQueue, target)); + e1.IsDebuff = false; + GamingQueue?.ChangeCharacterHardnessTime(target, -0.3, true, false); + Effect e2 = new AccelerationCoefficient(Skill, new() + { + { "exacc", ExACC } + }, caster) + { + Name = Name + "·加速系数提升", + Durative = _durative, + Duration = 实际持续时间, + DurationTurn = (int)实际持续时间 + }; + target.Effects.Add(e2); + e2.OnEffectGained(new HookContext(GamingQueue, target)); + e2.IsDebuff = false; + RecordCharacterApplyEffects(target, EffectType.Haste); + } + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/时间加速改.cs b/OshimaBot.Content/Skills/魔法/时间加速改.cs new file mode 100644 index 0000000..75fc7dc --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/时间加速改.cs @@ -0,0 +1,110 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Skills +{ + public class 时间加速改 : Skill + { + public override long Id => (long)MagicID.时间加速改; + public override string Name => "时间加速·改"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override double MPCost => Level > 0 ? 120 + (115 * (Level - 1)) : 120; + public override double CD => Level > 0 ? 45 - (0.5 * (Level - 1)) : 45; + public override double CastTime => 3; + // 调整:硬直 9 → 8(魔法区间 3–8) + public override double HardnessTime { get; set; } = 8; + public override bool CanSelectSelf => true; + public override bool CanSelectTeammate => true; + public override bool CanSelectEnemy => false; + public override double MagicBottleneck => 15 + 15 * (Level - 1); + + public 时间加速改(Character? character = null) : base(SkillType.Magic, character) + { + Effects.Add(new 时间加速改特效(this, false, 0, 4, 0, 45, 25, 0.1, 0.02)); + } + } + + public class 时间加速改特效 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"{(!IsDebuff ? "增加" : "减少")}{Skill.TargetDescription()} {Math.Abs(ExSPD):0.##} 点行动速度,并{(!IsDebuff ? "缩短" : "延长")}目标 30% 的行动等待时间(当前硬直时间);" + + $"{(!IsDebuff ? "增加" : "减少")}{Skill.TargetDescription()} {Math.Abs(ExACC) * 100:0.##}% 加速系数。持续 {持续时间}。"; + public override EffectType EffectType => EffectType.Haste; + public override DispelledType DispelledType => DispelledType.Weak; + public override bool IsDebuff => false; + + private string 持续时间 => _durative && _duration > 0 ? 实际持续时间 + $" {GameplayEquilibriumConstant.InGameTime}" : (!_durative && _durationTurn > 0 ? 实际持续时间 + " 回合" : $"0 {GameplayEquilibriumConstant.InGameTime}"); + private double 实际持续时间 => _durative && _duration > 0 ? (_duration + _levelGrowth * (Level - 1) * MagicEfficacy) : (!_durative && _durationTurn > 0 ? ((int)Math.Round(_durationTurn + _levelGrowth * (Level - 1) * MagicEfficacy, 0, MidpointRounding.ToPositiveInfinity)) : 0); + + private readonly bool _durative; + private readonly double _duration; + private readonly int _durationTurn; + private readonly double _levelGrowth; + private readonly double _baseSpd; + private readonly double _baseAcc; + private readonly double _spdLevelGrowth; + private readonly double _accLevelGrowth; + + private double ExSPD => Level > 0 ? _baseSpd + _spdLevelGrowth * (Level - 1) : _baseSpd; + private double ExACC => Level > 0 ? _baseAcc + _accLevelGrowth * (Level - 1) : _baseAcc; + + public 时间加速改特效(Skill skill, bool durative = false, double duration = 0, int durationTurn = 1, double levelGrowth = 0, double baseSpd = 0, double spdLevelGrowth = 0, double baseAcc = 0, double accLevelGrowth = 0) : base(skill) + { + GamingQueue = skill.GamingQueue; + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + _levelGrowth = levelGrowth; + _baseSpd = baseSpd; + _spdLevelGrowth = spdLevelGrowth; + _baseAcc = baseAcc; + _accLevelGrowth = accLevelGrowth; + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + foreach (Character target in targets) + { + WriteLine($"[ {target} ] 的行动速度提升了 {ExSPD:0.##} 点,行动等待时间(当前硬直时间)被缩短了 30%!持续时间:{持续时间}!"); + WriteLine($"[ {target} ] 的加速系数提升了 {ExACC * 100:0.##}%!持续时间:{持续时间}!"); + Effect e1 = new ExSPD(Skill, new Dictionary() + { + { "exspd", ExSPD } + }, caster) + { + Name = Name + "·行动速度提升", + Durative = _durative, + Duration = 实际持续时间, + DurationTurn = (int)实际持续时间 + }; + target.Effects.Add(e1); + e1.OnEffectGained(new HookContext(GamingQueue, target)); + e1.IsDebuff = false; + GamingQueue?.ChangeCharacterHardnessTime(target, -0.3, true, false); + Effect e2 = new AccelerationCoefficient(Skill, new() + { + { "exacc", ExACC } + }, caster) + { + Name = Name + "·加速系数提升", + Durative = _durative, + Duration = 实际持续时间, + DurationTurn = (int)实际持续时间 + }; + target.Effects.Add(e2); + e2.OnEffectGained(new HookContext(GamingQueue, target)); + e2.IsDebuff = false; + RecordCharacterApplyEffects(target, EffectType.Haste); + } + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/暗物质.cs b/OshimaBot.Content/Skills/魔法/暗物质.cs new file mode 100644 index 0000000..46c03d8 --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/暗物质.cs @@ -0,0 +1,23 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 暗物质 : Skill + { + public override long Id => (long)MagicID.暗物质; + public override string Name => "暗物质"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override double MPCost => Level > 0 ? 70 + (80 * (Level - 1)) : 70; + public override double CD => 40; + public override double CastTime => 10; + public override double HardnessTime { get; set; } = 4; + public override double MagicBottleneck => 16 + 17 * (Level - 1); + + public 暗物质(Character? character = null) : base(SkillType.Magic, character) + { + Effects.Add(new 基于攻击力的伤害_无基础伤害(this, 1.3, 0.28)); + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/根源屏障.cs b/OshimaBot.Content/Skills/魔法/根源屏障.cs new file mode 100644 index 0000000..cb9f190 --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/根源屏障.cs @@ -0,0 +1,74 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 根源屏障 : Skill + { + public override long Id => (long)MagicID.根源屏障; + public override string Name => "根源屏障"; + public override string Description => string.Join("", Effects.Select(e => e.Description)); + public override string DispelDescription => "被驱散性:可弱驱散"; + public override double MPCost => Level > 0 ? 200 + (75 * (Level - 1)) : 200; + public override double CD => Level > 0 ? 50 - (3 * (Level - 1)) : 50; + public override double CastTime => Level > 0 ? 12 - (0.5 * (Level - 1)) : 12; + public override double HardnessTime { get; set; } = 8; + public override bool CanSelectSelf => true; + public override bool CanSelectEnemy => false; + public override bool CanSelectTeammate => true; + public override int CanSelectTargetCount => 1; + public override double MagicBottleneck => 11 + 12 * (Level - 1); + + public 根源屏障(Character? character = null) : base(SkillType.Magic, character) + { + Effects.Add(new 根源屏障特效(this)); + } + } + + public class 根源屏障特效 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"为{Skill.TargetDescription()}提供{CharacterSet.GetImmuneTypeName(ImmuneType.Magical)},持续 {持续时间}。" + (Skill.Level > 4 ? $"为{Skill.TargetDescription()}提供{CharacterSet.GetImmuneTypeName(ImmuneType.Skilled)},持续 1 回合。" : ""); + public override EffectType EffectType => EffectType.MagicalImmune; + public override DispelledType DispelledType => DispelledType.Weak; + + private string 持续时间 => $"{实际持续时间} 回合"; + private int 实际持续时间 + { + get + { + return Level switch + { + 3 or 4 or 5 => 3, + 6 or 7 or 8 => 4, + _ => 2 + }; + } + } + + public 根源屏障特效(Skill skill) : base(skill) + { + GamingQueue = skill.GamingQueue; + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + Effect effect = new 施加免疫(Skill, ImmuneType.Magical, false, 0, 实际持续时间); + effect.OnSkillCasted(ctx); + if (Level > 4) + { + effect = new 施加免疫(Skill, ImmuneType.Skilled, false, 0, 2); + effect.OnSkillCasted(ctx); + } + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/次元上升.cs b/OshimaBot.Content/Skills/魔法/次元上升.cs new file mode 100644 index 0000000..370a2b5 --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/次元上升.cs @@ -0,0 +1,26 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 次元上升 : Skill + { + public override long Id => (long)MagicID.次元上升; + public override string Name => "次元上升"; + public override string Description => Effects.Count > 0 ? string.Join("\r\n", Effects.Select(e => e.Description)) : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First(e => e is 造成眩晕).DispelDescription : ""; + public override string ExemptionDescription => Effects.Count > 0 ? Effects.First(e => e is 造成眩晕).ExemptionDescription : ""; + public override double MPCost => Level > 0 ? 70 + (75 * (Level - 1)) : 70; + public override double CD => Level > 0 ? 35 - (1.5 * (Level - 1)) : 35; + public override double CastTime => 12; + public override double HardnessTime { get; set; } = 5; + public override double MagicBottleneck => 15 + 21 * (Level - 1); + + public 次元上升(Character? character = null) : base(SkillType.Magic, character) + { + Effects.Add(new 基于攻击力的伤害_带基础伤害(this, 35, 25, 0.3, 0.25)); + Effects.Add(new 造成眩晕(this, true, 10, 0)); + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/死亡咆哮.cs b/OshimaBot.Content/Skills/魔法/死亡咆哮.cs new file mode 100644 index 0000000..45faa27 --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/死亡咆哮.cs @@ -0,0 +1,41 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 死亡咆哮 : Skill + { + public override long Id => (long)MagicID.死亡咆哮; + public override string Name => "死亡咆哮"; + public override string Description => string.Join("", Effects.Select(e => e.Description)); + public override string DispelDescription => Effects.Count > 0 ? Effects.First(e => e is 施加概率负面).DispelDescription : ""; + public override string ExemptionDescription => Effects.Count > 0 ? Effects.First(e => e is 施加概率负面).ExemptionDescription : ""; + public override double MPCost => Level > 0 ? 70 + (75 * (Level - 1)) : 70; + public override double CD => Level > 0 ? 55 + (1 * (Level - 1)) : 55; + public override double CastTime => 3; + public override double HardnessTime { get; set; } = 8; + public override int CanSelectTargetCount + { + get + { + return Level switch + { + 4 => 2, + 5 => 2, + 6 => 2, + 7 => 3, + 8 => 3, + _ => 1 + }; + } + } + public override double MagicBottleneck => 20 + 24 * (Level - 1); + + public 死亡咆哮(Character? character = null) : base(SkillType.Magic, character) + { + Effects.Add(new 纯数值伤害(this, 70, 30, DamageType.Magical)); + Effects.Add(new 施加概率负面(this, EffectType.Cripple, true, 3, 0, 1, 0.2, 0.03)); + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/水之矢.cs b/OshimaBot.Content/Skills/魔法/水之矢.cs new file mode 100644 index 0000000..f3c1040 --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/水之矢.cs @@ -0,0 +1,23 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 水之矢 : Skill + { + public override long Id => (long)MagicID.水之矢; + public override string Name => "水之矢"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override double MPCost => Level > 0 ? 30 + (40 * (Level - 1)) : 30; + public override double CD => 20; + public override double CastTime => 6; + public override double HardnessTime { get; set; } = 3; + public override double MagicBottleneck => 16 + 17 * (Level - 1); + + public 水之矢(Character? character = null) : base(SkillType.Magic, character) + { + Effects.Add(new 基于核心属性的伤害(this, 65, 45, 0.35, 0.45)); + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/水蓝轰炸.cs b/OshimaBot.Content/Skills/魔法/水蓝轰炸.cs new file mode 100644 index 0000000..dc4ad4f --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/水蓝轰炸.cs @@ -0,0 +1,27 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 水蓝轰炸 : Skill + { + public override long Id => (long)MagicID.水蓝轰炸; + public override string Name => "水蓝轰炸"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override double MPCost => Level > 0 ? 45 + (50 * (Level - 1)) : 45; + public override double CD => 30; + public override double CastTime => 8; + public override double HardnessTime { get; set; } = 4; + public override int CanSelectTargetCount => 3; + public override SkillRangeType SkillRangeType => SkillRangeType.Circle; + public override int CanSelectTargetRange => 3; + public override double MagicBottleneck => 16 + 17 * (Level - 1); + + public 水蓝轰炸(Character? character = null) : base(SkillType.Magic, character) + { + IsNonDirectional = true; + Effects.Add(new 基于核心属性的伤害(this, 15, 35, 0.15, 0.2)); + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/沉默十字.cs b/OshimaBot.Content/Skills/魔法/沉默十字.cs new file mode 100644 index 0000000..86d5bbe --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/沉默十字.cs @@ -0,0 +1,56 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 沉默十字 : Skill + { + public override long Id => (long)MagicID.沉默十字; + public override string Name => "沉默十字"; + public override string Description => Effects.Count > 0 ? string.Join("\r\n", Effects.Select(e => e.Description)) : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override string ExemptionDescription => Effects.Count > 0 ? Effects.First().ExemptionDescription : ""; + public override double MPCost + { + get + { + return Level switch + { + 8 => 魔法消耗基础 + 5 * 魔法消耗等级成长, + 7 => 魔法消耗基础 + 4 * 魔法消耗等级成长, + 6 => 魔法消耗基础 + 4 * 魔法消耗等级成长, + 5 => 魔法消耗基础 + 3 * 魔法消耗等级成长, + 4 => 魔法消耗基础 + 3 * 魔法消耗等级成长, + 3 => 魔法消耗基础 + 2 * 魔法消耗等级成长, + _ => 魔法消耗基础 + }; + } + } + public override double CD => Level > 0 ? 55 - (3 * (Level - 1)) : 55; + public override double CastTime => Level > 0 ? 10 - (0.5 * (Level - 1)) : 10; + public override double HardnessTime { get; set; } = 6; + public override int CanSelectTargetCount + { + get + { + return Level switch + { + 8 => 3, + 7 => 2, + 6 => 2, + 5 => 2, + _ => 1 + }; + } + } + public override double MagicBottleneck => 12 + 13 * (Level - 1); + private double 魔法消耗基础 { get; set; } = 65; + private double 魔法消耗等级成长 { get; set; } = 65; + + public 沉默十字(Character? character = null) : base(SkillType.Magic, character) + { + Effects.Add(new 造成封技(this, false, 0, 2)); + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/治愈术.cs b/OshimaBot.Content/Skills/魔法/治愈术.cs new file mode 100644 index 0000000..518aa60 --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/治愈术.cs @@ -0,0 +1,29 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 治愈术 : Skill + { + public override long Id => (long)MagicID.治愈术; + public override string Name => "治愈术"; + public override string Description => string.Join("", Effects.Select(e => e.Description)); + public override double MPCost => Level > 0 ? 80 + (85 * (Level - 1)) : 80; + public override double CD => Level > 0 ? 35 - (1 * (Level - 1)) : 35; + public override double CastTime => Level > 0 ? 3 + (0.25 * (Level - 1)) : 3; + public override double HardnessTime { get; set; } = 6; + public override bool CanSelectSelf => true; + public override bool CanSelectEnemy => false; + public override bool CanSelectTeammate => true; + public override int CanSelectTargetCount => 1; + public override double MagicBottleneck => 12 + 13 * (Level - 1); + + public 治愈术(Character? character = null) : base(SkillType.Magic, character) + { + SelectTargetPredicates.Add(c => c.HP > 0 && c.HP < c.MaxHP); + Effects.Add(new 弱驱散特效(this)); + Effects.Add(new 百分比回复生命值(this, 0.28, 0.03)); + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/治愈术复.cs b/OshimaBot.Content/Skills/魔法/治愈术复.cs new file mode 100644 index 0000000..570dc8d --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/治愈术复.cs @@ -0,0 +1,47 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 治愈术复 : Skill + { + public override long Id => (long)MagicID.治愈术复; + public override string Name => "治愈术·复"; + public override string Description => string.Join("", Effects.Select(e => e.Description)); + public override double MPCost => Level > 0 ? 85 + (90 * (Level - 1)) : 85; + public override double CD => Level > 0 ? 42 - (1 * (Level - 1)) : 42; + public override double CastTime => Level > 0 ? 3 + (0.25 * (Level - 1)) : 3; + public override double HardnessTime { get; set; } = 7; + public override bool CanSelectSelf => true; + public override bool CanSelectEnemy => false; + public override bool CanSelectTeammate => true; + public override int CanSelectTargetCount + { + get + { + return Level switch + { + 3 => 3, + 4 => 3, + 5 => 3, + 6 => 4, + 7 => 4, + 8 => 4, + _ => 2 + }; + } + } + public override SkillRangeType SkillRangeType => SkillRangeType.Circle; + public override int CanSelectTargetRange => 3; + public override double MagicBottleneck => 14 + 14 * (Level - 1); + + public 治愈术复(Character? character = null) : base(SkillType.Magic, character) + { + IsNonDirectional = true; + SelectTargetPredicates.Add(c => c.HP > 0 && c.HP < c.MaxHP); + Effects.Add(new 弱驱散特效(this)); + Effects.Add(new 纯数值回复生命(this, 420, 340)); + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/混沌烙印.cs b/OshimaBot.Content/Skills/魔法/混沌烙印.cs new file mode 100644 index 0000000..46fc030 --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/混沌烙印.cs @@ -0,0 +1,26 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 混沌烙印 : Skill + { + public override long Id => (long)MagicID.混沌烙印; + public override string Name => "混沌烙印"; + public override string Description => Effects.Count > 0 ? string.Join("\r\n", Effects.Select(e => e.Description)) : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First(e => e is 造成气绝).DispelDescription : ""; + public override string ExemptionDescription => Effects.Count > 0 ? Effects.First(e => e is 造成气绝).ExemptionDescription : ""; + public override double MPCost => Level > 0 ? 65 + (70 * (Level - 1)) : 65; + public override double CD => Level > 0 ? 50 - (1.5 * (Level - 1)) : 50; + public override double CastTime => 4; + public override double HardnessTime { get; set; } = 5; + public override int CanSelectTargetCount => 1; + public override double MagicBottleneck => 15 + 15 * (Level - 1); + + public 混沌烙印(Character? character = null) : base(SkillType.Magic, character) + { + Effects.Add(new 造成气绝(this, true, 4, 0, 0.5, true, 0, 0.05)); + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/火之矢.cs b/OshimaBot.Content/Skills/魔法/火之矢.cs new file mode 100644 index 0000000..0558405 --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/火之矢.cs @@ -0,0 +1,23 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 火之矢 : Skill + { + public override long Id => (long)MagicID.火之矢; + public override string Name => "火之矢"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override double MPCost => Level > 0 ? 30 + (40 * (Level - 1)) : 30; + public override double CD => 20; + public override double CastTime => 6; + public override double HardnessTime { get; set; } = 3; + public override double MagicBottleneck => 16 + 17 * (Level - 1); + + public 火之矢(Character? character = null) : base(SkillType.Magic, character) + { + Effects.Add(new 基于核心属性的伤害(this, 45, 65, 0.45, 0.35)); + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/火山咆哮.cs b/OshimaBot.Content/Skills/魔法/火山咆哮.cs new file mode 100644 index 0000000..0741001 --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/火山咆哮.cs @@ -0,0 +1,27 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 火山咆哮 : Skill + { + public override long Id => (long)MagicID.火山咆哮; + public override string Name => "火山咆哮"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override double MPCost => Level > 0 ? 45 + (50 * (Level - 1)) : 45; + public override double CD => 30; + public override double CastTime => 8; + public override double HardnessTime { get; set; } = 4; + public override int CanSelectTargetCount => 3; + public override SkillRangeType SkillRangeType => SkillRangeType.Circle; + public override int CanSelectTargetRange => 3; + public override double MagicBottleneck => 16 + 17 * (Level - 1); + + public 火山咆哮(Character? character = null) : base(SkillType.Magic, character) + { + IsNonDirectional = true; + Effects.Add(new 基于核心属性的伤害(this, 35, 15, 0.2, 0.15)); + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/灾难冲击波.cs b/OshimaBot.Content/Skills/魔法/灾难冲击波.cs new file mode 100644 index 0000000..f53b29f --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/灾难冲击波.cs @@ -0,0 +1,113 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; +using OshimaBot.Content.Effects.OpenEffects; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 灾难冲击波 : Skill + { + public override long Id => (long)MagicID.灾难冲击波; + public override string Name => "灾难冲击波"; + public override string Description => string.Join("\r\n", Effects.Select(e => e.Description)); + public override string DispelDescription => Effects.Count > 0 ? Effects.First(e => e is 灾难冲击波特效).DispelDescription : ""; + public override string ExemptionDescription => Effects.Count > 0 ? Effects.First(e => e is 灾难冲击波特效).ExemptionDescription : ""; + public override double MPCost => Level > 0 ? 95 + (75 * (Level - 1)) : 95; + public override double CD => Level > 0 ? 35 - (1.5 * (Level - 1)) : 35; + public override double CastTime => Level > 0 ? 6 + (0.5 * (Level - 1)) : 6; + public override double HardnessTime { get; set; } = 5; + public override int CanSelectTargetCount + { + get + { + return Level switch + { + 3 => 2, + 4 => 2, + 5 => 3, + 6 => 3, + 7 => 4, + 8 => 4, + _ => 1 + }; + } + } + public override double MagicBottleneck => 15 + 20 * (Level - 1); + + public 灾难冲击波(Character? character = null) : base(SkillType.Magic, character) + { + Effects.Add(new 基于攻击力的伤害_带基础伤害(this, 50, 15, 0.1, 0.04)); + Effects.Add(new 灾难冲击波特效(this, false, 0, 4, 0, 0.1, 0.025)); + } + } + + public class 灾难冲击波特效 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"对{Skill.TargetDescription()}造成魔法抗性降低 {ActualMDFReductionPercent * 100:0.##}%,持续 {持续时间}。"; + public override EffectType EffectType => EffectType.MagicResistBreak; + public override DispelledType DispelledType => DispelledType.Weak; + public override bool ExemptDuration => true; + + private string 持续时间 => _durative && _duration > 0 ? 实际持续时间 + $" {GameplayEquilibriumConstant.InGameTime}" : (!_durative && _durationTurn > 0 ? 实际持续时间 + " 回合" : $"0 {GameplayEquilibriumConstant.InGameTime}"); + private double 实际持续时间 => _durative && _duration > 0 ? (_duration + _levelGrowth * (Level - 1) * MagicEfficacy) : (!_durative && _durationTurn > 0 ? ((int)Math.Round(_durationTurn + _levelGrowth * (Level - 1) * MagicEfficacy, 0, MidpointRounding.ToPositiveInfinity)) : 0); + private readonly bool _durative; + private readonly double _duration; + private readonly int _durationTurn; + private readonly double _levelGrowth; + private readonly double _MDFReductionPercent; + private readonly double _MDFReductionPercentLevelGrowth; + private double ActualMDFReductionPercent => Level > 0 ? _MDFReductionPercent + _MDFReductionPercentLevelGrowth * (Level - 1) : _MDFReductionPercent; + + public 灾难冲击波特效(Skill skill, bool durative = false, double duration = 0, int durationTurn = 1, double levelGrowth = 0, double MDFReductionPercent = 0, double MDFReductionPercentLevelGrowth = 0) : base(skill) + { + GamingQueue = skill.GamingQueue; + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + _levelGrowth = levelGrowth; + _MDFReductionPercent = MDFReductionPercent; + _MDFReductionPercentLevelGrowth = MDFReductionPercentLevelGrowth; + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + foreach (Character target in targets) + { + ExMDF e = new(Skill, new(){ + { "mdftype", 0 }, + { "mdfvalue", -ActualMDFReductionPercent } + }, caster); + if (!CheckExemption(caster, target, e)) + { + WriteLine($"[ {target} ] 的魔法抗性降低了 {ActualMDFReductionPercent * 100:0.##}%!持续时间:{持续时间}!"); + target.Effects.Add(e); + if (_durative && _duration > 0) + { + e.Durative = true; + e.Duration = 实际持续时间; + e.RemainDuration = 实际持续时间; + } + else if (!_durative && _durationTurn > 0) + { + e.Durative = false; + e.DurationTurn = (int)实际持续时间; + e.RemainDurationTurn = (int)实际持续时间; + } + e.EffectType = EffectType.MagicResistBreak; + e.Source = caster; + e.OnEffectGained(new HookContext(GamingQueue, target)); + GamingQueue?.AddApplyEffects(target, e.EffectType); + } + } + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/盖亚之盾.cs b/OshimaBot.Content/Skills/魔法/盖亚之盾.cs new file mode 100644 index 0000000..f3a4e36 --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/盖亚之盾.cs @@ -0,0 +1,29 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 盖亚之盾 : Skill + { + public override long Id => (long)MagicID.盖亚之盾; + public override string Name => "盖亚之盾"; + public override string Description => string.Join("", Effects.Select(e => e.Description)); + public override double MPCost => Level > 0 ? 魔法消耗基础 + (魔法消耗等级成长 * (Level - 1)) : 魔法消耗基础; + public override double CD => Level > 0 ? 50 - (3 * (Level - 1)) : 50; + public override double CastTime => 12; + public override double HardnessTime { get; set; } = 4; + private double 魔法消耗基础 { get; set; } = 100; + private double 魔法消耗等级成长 { get; set; } = 100; + public override bool CanSelectSelf => true; + public override bool CanSelectEnemy => false; + public override bool CanSelectTeammate => true; + public override bool SelectAllTeammates => true; + public override double MagicBottleneck => 14 + 15 * (Level - 1); + + public 盖亚之盾(Character? character = null) : base(SkillType.Magic, character) + { + Effects.Add(new 增加混合护盾值(this, 160, 120)); + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/石之锤.cs b/OshimaBot.Content/Skills/魔法/石之锤.cs new file mode 100644 index 0000000..cc44e6f --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/石之锤.cs @@ -0,0 +1,23 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 石之锤 : Skill + { + public override long Id => (long)MagicID.石之锤; + public override string Name => "石之锤"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override double MPCost => Level > 0 ? 35 + (30 * (Level - 1)) : 35; + public override double CD => 22; + public override double CastTime => 6; + public override double HardnessTime { get; set; } = 4; + public override double MagicBottleneck => 12 + 13 * (Level - 1); + + public 石之锤(Character? character = null) : base(SkillType.Magic, character) + { + Effects.Add(new 基于属性的伤害(this, PrimaryAttribute.STR, 100, 50, 0.55, 0.4)); + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/破碎虚空.cs b/OshimaBot.Content/Skills/魔法/破碎虚空.cs new file mode 100644 index 0000000..83bb620 --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/破碎虚空.cs @@ -0,0 +1,24 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 破碎虚空 : Skill + { + public override long Id => (long)MagicID.破碎虚空; + public override string Name => "破碎虚空"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override double MPCost => Level > 0 ? 80 + (80 * (Level - 1)) : 80; + public override double CD => 30; + public override double CastTime => 10; + public override double HardnessTime { get; set; } = 6; + public override int CanSelectTargetCount => 3; + public override double MagicBottleneck => 16 + 17 * (Level - 1); + + public 破碎虚空(Character? character = null) : base(SkillType.Magic, character) + { + Effects.Add(new 基于攻击力的伤害_无基础伤害(this, 0.60, 0.1)); + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/神圣祝福.cs b/OshimaBot.Content/Skills/魔法/神圣祝福.cs new file mode 100644 index 0000000..f194f3a --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/神圣祝福.cs @@ -0,0 +1,142 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Skills +{ + public class 神圣祝福 : Skill + { + public override long Id => (long)MagicID.神圣祝福; + public override string Name => "神圣祝福"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override double MPCost => Level > 0 ? 95 + (100 * (Level - 1)) : 95; + public override double CD => Level > 0 ? 40 - (1.5 * (Level - 1)) : 40; + public override double CastTime => Level > 0 ? 5 + (1 * (Level - 1)) : 5; + public override double HardnessTime { get; set; } = 3; + public override bool CanSelectSelf => true; + public override bool CanSelectEnemy => false; + public override bool CanSelectTeammate => true; + public override int CanSelectTargetCount => 1; + public override double MagicBottleneck => 12 + 13 * (Level - 1); + + public 神圣祝福(Character? character = null) : base(SkillType.Magic, character) + { + Effects.Add(new 神圣祝福特效(this, false, 0, 4)); + } + } + + public class 神圣祝福特效 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"提升目标{(Skill.CanSelectTargetCount > 1 ? $"至多 {Skill.CanSelectTargetCount} 个" : "")}友方角色 {ExATK * 100:0.##}% 攻击力、{ExDEF * 100:0.##}% 物理护甲和 {ExMDF * 100:0.##}% 魔法抗性,持续 {持续时间}。"; + public override EffectType EffectType => EffectType.DefenseBoost; + public override DispelledType DispelledType => DispelledType.Weak; + + private string 持续时间 => _durative && _duration > 0 ? 实际持续时间 + $" {GameplayEquilibriumConstant.InGameTime}" : (!_durative && _durationTurn > 0 ? 实际持续时间 + " 回合" : $"0 {GameplayEquilibriumConstant.InGameTime}"); + private double 实际持续时间 => _durative && _duration > 0 ? (_duration + _levelGrowth * (Level - 1) * MagicEfficacy) : (!_durative && _durationTurn > 0 ? ((int)Math.Round(_durationTurn + _levelGrowth * (Level - 1) * MagicEfficacy, 0, MidpointRounding.ToPositiveInfinity)) : 0); + + private readonly bool _durative; + private readonly double _duration; + private readonly int _durationTurn; + private readonly double _levelGrowth; + + private double ExATK => Level > 0 ? 0.05 + 0.05 * (Level - 1) : 0.05; + private double ExDEF => Level > 0 ? 0.15 + 0.2 * (Level - 1) : 0.15; + private double ExMDF => Level > 0 ? 0.01 + 0.015 * (Level - 1) : 0.01; + + public 神圣祝福特效(Skill skill, bool durative = false, double duration = 0, int durationTurn = 1, double levelGrowth = 0) : base(skill) + { + GamingQueue = skill.GamingQueue; + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + _levelGrowth = levelGrowth; + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + foreach (Character target in targets) + { + WriteLine($"[ {target} ] 的攻击力提升了 {ExATK * 100:0.##}%,物理护甲提升了 {ExDEF * 100:0.##}%,魔法抗性提升了 {ExMDF * 100:0.##}%!持续时间:{持续时间}!"); + ExATK2 e = new(Skill, new() + { + { "exatk", ExATK } + }, caster) + { + Name = Name + "·攻击力提升" + }; + target.Effects.Add(e); + if (_durative && _duration > 0) + { + e.Durative = true; + e.Duration = 实际持续时间; + e.RemainDuration = 实际持续时间; + } + else if (!_durative && _durationTurn > 0) + { + e.Durative = false; + e.DurationTurn = (int)实际持续时间; + e.RemainDurationTurn = (int)实际持续时间; + } + e.EffectType = EffectType.DamageBoost; + e.Source = caster; + e.OnEffectGained(new HookContext(GamingQueue, target)); + ExDEF2 e2 = new(Skill, new() + { + { "exdef", ExDEF } + }, caster) + { + Name = Name + "·物理护甲提升" + }; + target.Effects.Add(e2); + if (_durative && _duration > 0) + { + e2.Durative = true; + e2.Duration = 实际持续时间; + e2.RemainDuration = 实际持续时间; + } + else if (!_durative && _durationTurn > 0) + { + e2.Durative = false; + e2.DurationTurn = (int)实际持续时间; + e2.RemainDurationTurn = (int)实际持续时间; + } + e2.EffectType = EffectType.DefenseBoost; + e2.Source = caster; + e2.OnEffectGained(new HookContext(GamingQueue, target)); + ExMDF e3 = new(Skill, new() + { + { "mdftype", 0 }, + { "mdfvalue", ExMDF } + }, caster) + { + Name = Name + "·魔法抗性提升" + }; + target.Effects.Add(e3); + if (_durative && _duration > 0) + { + e3.Durative = true; + e3.Duration = 实际持续时间; + e3.RemainDuration = 实际持续时间; + } + else if (!_durative && _durationTurn > 0) + { + e3.Durative = false; + e3.DurationTurn = (int)实际持续时间; + e3.RemainDurationTurn = (int)实际持续时间; + } + e3.EffectType = EffectType.DefenseBoost; + e3.Source = caster; + e3.OnEffectGained(new HookContext(GamingQueue, target)); + GamingQueue?.AddApplyEffects(target, EffectType.DamageBoost, EffectType.DefenseBoost); + } + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/神圣祝福复.cs b/OshimaBot.Content/Skills/魔法/神圣祝福复.cs new file mode 100644 index 0000000..b8d2eea --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/神圣祝福复.cs @@ -0,0 +1,157 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Skills +{ + public class 神圣祝福复 : Skill + { + public override long Id => (long)MagicID.神圣祝福复; + public override string Name => "神圣祝福·复"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override double MPCost => Level > 0 ? 110 + (110 * (Level - 1)) : 110; + public override double CD => Level > 0 ? 50 - (1.5 * (Level - 1)) : 50; + public override double CastTime => Level > 0 ? 3 + (1 * (Level - 1)) : 3; + public override double HardnessTime { get; set; } = 7; + public override bool CanSelectSelf => true; + public override bool CanSelectEnemy => false; + public override bool CanSelectTeammate => true; + public override int CanSelectTargetCount + { + get + { + return Level switch + { + 3 => 3, + 4 => 3, + 5 => 3, + 6 => 4, + 7 => 4, + 8 => 4, + _ => 2 + }; + } + } + public override double MagicBottleneck => 14 + 15 * (Level - 1); + + public 神圣祝福复(Character? character = null) : base(SkillType.Magic, character) + { + Effects.Add(new 神圣祝福复特效(this, false, 0, 3)); + } + } + + public class 神圣祝福复特效 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"提升目标{(Skill.CanSelectTargetCount > 1 ? $"至多 {Skill.CanSelectTargetCount} 个" : "")}友方角色 {ExATK * 100:0.##}% 攻击力、{ExDEF * 100:0.##}% 物理护甲和 {ExMDF * 100:0.##}% 魔法抗性,持续 {持续时间}。"; + public override EffectType EffectType => EffectType.DefenseBoost; + public override DispelledType DispelledType => DispelledType.Weak; + + private string 持续时间 => _durative && _duration > 0 ? 实际持续时间 + $" {GameplayEquilibriumConstant.InGameTime}" : (!_durative && _durationTurn > 0 ? 实际持续时间 + " 回合" : $"0 {GameplayEquilibriumConstant.InGameTime}"); + private double 实际持续时间 => _durative && _duration > 0 ? (_duration + _levelGrowth * (Level - 1) * MagicEfficacy) : (!_durative && _durationTurn > 0 ? ((int)Math.Round(_durationTurn + _levelGrowth * (Level - 1) * MagicEfficacy, 0, MidpointRounding.ToPositiveInfinity)) : 0); + + private readonly bool _durative; + private readonly double _duration; + private readonly int _durationTurn; + private readonly double _levelGrowth; + + private double ExATK => Level > 0 ? 0.04 + 0.035 * (Level - 1) : 0.04; + private double ExDEF => Level > 0 ? 0.12 + 0.15 * (Level - 1) : 0.12; + private double ExMDF => Level > 0 ? 0.008 + 0.012 * (Level - 1) : 0.008; + + public 神圣祝福复特效(Skill skill, bool durative = false, double duration = 0, int durationTurn = 1, double levelGrowth = 0) : base(skill) + { + GamingQueue = skill.GamingQueue; + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + _levelGrowth = levelGrowth; + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + foreach (Character target in targets) + { + WriteLine($"[ {target} ] 的攻击力提升了 {ExATK * 100:0.##}%,物理护甲提升了 {ExDEF * 100:0.##}%,魔法抗性提升了 {ExMDF * 100:0.##}%!持续时间:{持续时间}!"); + ExATK2 e = new(Skill, new() + { + { "exatk", ExATK } + }, caster) + { + Name = Name + "·攻击力提升" + }; + target.Effects.Add(e); + if (_durative && _duration > 0) + { + e.Durative = true; + e.Duration = 实际持续时间; + e.RemainDuration = 实际持续时间; + } + else if (!_durative && _durationTurn > 0) + { + e.Durative = false; + e.DurationTurn = (int)实际持续时间; + e.RemainDurationTurn = (int)实际持续时间; + } + e.EffectType = EffectType.DamageBoost; + e.Source = caster; + e.OnEffectGained(new HookContext(GamingQueue, target)); + ExDEF2 e2 = new(Skill, new() + { + { "exdef", ExDEF } + }, caster) + { + Name = Name + "·物理护甲提升" + }; + target.Effects.Add(e2); + if (_durative && _duration > 0) + { + e2.Durative = true; + e2.Duration = 实际持续时间; + e2.RemainDuration = 实际持续时间; + } + else if (!_durative && _durationTurn > 0) + { + e2.Durative = false; + e2.DurationTurn = (int)实际持续时间; + e2.RemainDurationTurn = (int)实际持续时间; + } + e2.EffectType = EffectType.DefenseBoost; + e2.Source = caster; + e2.OnEffectGained(new HookContext(GamingQueue, target)); + ExMDF e3 = new(Skill, new() + { + { "mdftype", 0 }, + { "mdfvalue", ExMDF } + }, caster) + { + Name = Name + "·魔法抗性提升" + }; + target.Effects.Add(e3); + if (_durative && _duration > 0) + { + e3.Durative = true; + e3.Duration = 实际持续时间; + e3.RemainDuration = 实际持续时间; + } + else if (!_durative && _durationTurn > 0) + { + e3.Durative = false; + e3.DurationTurn = (int)实际持续时间; + e3.RemainDurationTurn = (int)实际持续时间; + } + e3.EffectType = EffectType.DefenseBoost; + e3.Source = caster; + e3.OnEffectGained(new HookContext(GamingQueue, target)); + GamingQueue?.AddApplyEffects(target, EffectType.DamageBoost, EffectType.DefenseBoost); + } + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/等离子之波.cs b/OshimaBot.Content/Skills/魔法/等离子之波.cs new file mode 100644 index 0000000..7bfc1e6 --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/等离子之波.cs @@ -0,0 +1,41 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 等离子之波 : Skill + { + public override long Id => (long)MagicID.等离子之波; + public override string Name => "等离子之波"; + public override string Description => string.Join("", Effects.Select(e => e.Description)); + public override string DispelDescription => Effects.Count > 0 ? Effects.First(e => e is 施加概率负面).DispelDescription : ""; + public override string ExemptionDescription => Effects.Count > 0 ? Effects.First(e => e is 施加概率负面).ExemptionDescription : ""; + public override double MPCost => Level > 0 ? 70 + (75 * (Level - 1)) : 70; + public override double CD => Level > 0 ? 20 + (1.5 * (Level - 1)) : 20; + public override double CastTime => 6; + public override double HardnessTime { get; set; } = 6; + public override int CanSelectTargetCount + { + get + { + return Level switch + { + 4 => 2, + 5 => 2, + 6 => 3, + 7 => 3, + 8 => 4, + _ => 1 + }; + } + } + public override double MagicBottleneck => 20 + 22 * (Level - 1); + + public 等离子之波(Character? character = null) : base(SkillType.Magic, character) + { + Effects.Add(new 纯数值伤害(this, 60, 20, DamageType.Magical)); + Effects.Add(new 施加概率负面(this, EffectType.Silence, false, 0, 2, 0, 0.2, 0.03)); + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/结晶防护.cs b/OshimaBot.Content/Skills/魔法/结晶防护.cs new file mode 100644 index 0000000..428ecdd --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/结晶防护.cs @@ -0,0 +1,112 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Skills +{ + public class 结晶防护 : Skill + { + public override long Id => (long)MagicID.结晶防护; + public override string Name => "结晶防护"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override double MPCost => Level > 0 ? 75 + (80 * (Level - 1)) : 75; + public override double CD => Level > 0 ? 27 - (1 * (Level - 1)) : 27; + public override double CastTime => Level > 0 ? 3 + (1.5 * (Level - 1)) : 3; + public override double HardnessTime { get; set; } = 3; + public override bool CanSelectSelf => true; + public override bool CanSelectEnemy => false; + public override bool CanSelectTeammate => true; + public override int CanSelectTargetCount => 1; + public override double MagicBottleneck => 12 + 13 * (Level - 1); + + public 结晶防护(Character? character = null) : base(SkillType.Magic, character) + { + Effects.Add(new 结晶防护特效(this, false, 0, 4)); + } + } + + public class 结晶防护特效 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"提升目标{(Skill.CanSelectTargetCount > 1 ? $"至多 {Skill.CanSelectTargetCount} 个" : "")}友方角色 {ExDEF * 100:0.##}% 物理护甲和 {ExMDF * 100:0.##}% 魔法抗性,持续 {持续时间}。"; + public override EffectType EffectType => EffectType.DefenseBoost; + public override DispelledType DispelledType => DispelledType.Weak; + + private string 持续时间 => _durative && _duration > 0 ? 实际持续时间 + $" {GameplayEquilibriumConstant.InGameTime}" : (!_durative && _durationTurn > 0 ? 实际持续时间 + " 回合" : $"0 {GameplayEquilibriumConstant.InGameTime}"); + private double 实际持续时间 => _durative && _duration > 0 ? (_duration + _levelGrowth * (Level - 1) * MagicEfficacy) : (!_durative && _durationTurn > 0 ? ((int)Math.Round(_durationTurn + _levelGrowth * (Level - 1) * MagicEfficacy, 0, MidpointRounding.ToPositiveInfinity)) : 0); + + private readonly bool _durative; + private readonly double _duration; + private readonly int _durationTurn; + private readonly double _levelGrowth; + + private double ExDEF => Level > 0 ? 0.2 + 0.2 * (Level - 1) : 0.2; + private double ExMDF => Level > 0 ? 0.03 + 0.03 * (Level - 1) : 0.03; + + public 结晶防护特效(Skill skill, bool durative = false, double duration = 0, int durationTurn = 1, double levelGrowth = 0) : base(skill) + { + GamingQueue = skill.GamingQueue; + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + _levelGrowth = levelGrowth; + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + foreach (Character target in targets) + { + WriteLine($"[ {target} ] 的物理护甲提升了 {ExDEF * 100:0.##}%,魔法抗性提升了 {ExMDF * 100:0.##}%!持续时间:{持续时间}!"); + ExDEF2 e = new(Skill, new() + { + { "exdef", ExDEF } + }, caster); + target.Effects.Add(e); + if (_durative && _duration > 0) + { + e.Durative = true; + e.Duration = 实际持续时间; + e.RemainDuration = 实际持续时间; + } + else if (!_durative && _durationTurn > 0) + { + e.Durative = false; + e.DurationTurn = (int)实际持续时间; + e.RemainDurationTurn = (int)实际持续时间; + } + e.EffectType = EffectType.DefenseBoost; + e.Source = caster; + e.OnEffectGained(new HookContext(GamingQueue, target)); + ExMDF e2 = new(Skill, new() + { + { "mdftype", 0 }, + { "mdfvalue", ExMDF } + }, caster); + target.Effects.Add(e2); + if (_durative && _duration > 0) + { + e2.Durative = true; + e2.Duration = 实际持续时间; + e2.RemainDuration = 实际持续时间; + } + else if (!_durative && _durationTurn > 0) + { + e2.Durative = false; + e2.DurationTurn = (int)实际持续时间; + e2.RemainDurationTurn = (int)实际持续时间; + } + e2.EffectType = EffectType.DefenseBoost; + e2.Source = caster; + e2.OnEffectGained(new HookContext(GamingQueue, target)); + GamingQueue?.AddApplyEffects(target, EffectType.DefenseBoost); + } + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/结晶防护复.cs b/OshimaBot.Content/Skills/魔法/结晶防护复.cs new file mode 100644 index 0000000..593f8ed --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/结晶防护复.cs @@ -0,0 +1,127 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Skills +{ + public class 结晶防护复 : Skill + { + public override long Id => (long)MagicID.结晶防护复; + public override string Name => "结晶防护·复"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override double MPCost => Level > 0 ? 90 + (95 * (Level - 1)) : 90; + public override double CD => Level > 0 ? 35 - (0.5 * (Level - 1)) : 35; + public override double CastTime => Level > 0 ? 4 + (1 * (Level - 1)) : 4; + public override double HardnessTime { get; set; } = 5; + public override bool CanSelectSelf => true; + public override bool CanSelectEnemy => false; + public override bool CanSelectTeammate => true; + public override int CanSelectTargetCount + { + get + { + return Level switch + { + 3 => 3, + 4 => 3, + 5 => 3, + 6 => 4, + 7 => 4, + 8 => 4, + _ => 2 + }; + } + } + public override double MagicBottleneck => 14 + 15 * (Level - 1); + + public 结晶防护复(Character? character = null) : base(SkillType.Magic, character) + { + Effects.Add(new 结晶防护复特效(this, false, 0, 3)); + } + } + + public class 结晶防护复特效 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"提升目标{(Skill.CanSelectTargetCount > 1 ? $"至多 {Skill.CanSelectTargetCount} 个" : "")}友方角色 {ExDEF * 100:0.##}% 物理护甲和 {ExMDF * 100:0.##}% 魔法抗性,持续 {持续时间}。"; + public override EffectType EffectType => EffectType.DefenseBoost; + public override DispelledType DispelledType => DispelledType.Weak; + + private string 持续时间 => _durative && _duration > 0 ? 实际持续时间 + $" {GameplayEquilibriumConstant.InGameTime}" : (!_durative && _durationTurn > 0 ? 实际持续时间 + " 回合" : $"0 {GameplayEquilibriumConstant.InGameTime}"); + private double 实际持续时间 => _durative && _duration > 0 ? (_duration + _levelGrowth * (Level - 1) * MagicEfficacy) : (!_durative && _durationTurn > 0 ? ((int)Math.Round(_durationTurn + _levelGrowth * (Level - 1) * MagicEfficacy, 0, MidpointRounding.ToPositiveInfinity)) : 0); + + private readonly bool _durative; + private readonly double _duration; + private readonly int _durationTurn; + private readonly double _levelGrowth; + + private double ExDEF => Level > 0 ? 0.15 + 0.15 * (Level - 1) : 0.15; + private double ExMDF => Level > 0 ? 0.02 + 0.02 * (Level - 1) : 0.02; + + public 结晶防护复特效(Skill skill, bool durative = false, double duration = 0, int durationTurn = 1, double levelGrowth = 0) : base(skill) + { + GamingQueue = skill.GamingQueue; + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + _levelGrowth = levelGrowth; + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + foreach (Character target in targets) + { + WriteLine($"[ {target} ] 的物理护甲提升了 {ExDEF * 100:0.##}%,魔法抗性提升了 {ExMDF * 100:0.##}%!持续时间:{持续时间}!"); + ExDEF2 e = new(Skill, new() + { + { "exdef", ExDEF } + }, caster); + target.Effects.Add(e); + if (_durative && _duration > 0) + { + e.Durative = true; + e.Duration = 实际持续时间; + e.RemainDuration = 实际持续时间; + } + else if (!_durative && _durationTurn > 0) + { + e.Durative = false; + e.DurationTurn = (int)实际持续时间; + e.RemainDurationTurn = (int)实际持续时间; + } + e.EffectType = EffectType.DefenseBoost; + e.Source = caster; + e.OnEffectGained(new HookContext(GamingQueue, target)); + ExMDF e2 = new(Skill, new() + { + { "mdftype", 0 }, + { "mdfvalue", ExMDF } + }, caster); + target.Effects.Add(e2); + if (_durative && _duration > 0) + { + e2.Durative = true; + e2.Duration = 实际持续时间; + e2.RemainDuration = 实际持续时间; + } + else if (!_durative && _durationTurn > 0) + { + e2.Durative = false; + e2.DurationTurn = (int)实际持续时间; + e2.RemainDurationTurn = (int)实际持续时间; + } + e2.EffectType = EffectType.DefenseBoost; + e2.Source = caster; + e2.OnEffectGained(new HookContext(GamingQueue, target)); + GamingQueue?.AddApplyEffects(target, EffectType.DefenseBoost); + } + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/苍白地狱.cs b/OshimaBot.Content/Skills/魔法/苍白地狱.cs new file mode 100644 index 0000000..ae0ef02 --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/苍白地狱.cs @@ -0,0 +1,24 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 苍白地狱 : Skill + { + public override long Id => (long)MagicID.苍白地狱; + public override string Name => "苍白地狱"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override double MPCost => Level > 0 ? 45 + (55 * (Level - 1)) : 45; + public override double CD => 35; + public override double CastTime => 9; + public override double HardnessTime { get; set; } = 3; + public override int CanSelectTargetCount => 3; + public override double MagicBottleneck => 15 + 22 * (Level - 1); + + public 苍白地狱(Character? character = null) : base(SkillType.Magic, character) + { + Effects.Add(new 基于属性的伤害(this, PrimaryAttribute.INT, 30, 25, 0.25, 0.2)); + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/虚弱领域.cs b/OshimaBot.Content/Skills/魔法/虚弱领域.cs new file mode 100644 index 0000000..eaf1067 --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/虚弱领域.cs @@ -0,0 +1,27 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 虚弱领域 : Skill + { + public override long Id => (long)MagicID.虚弱领域; + public override string Name => "虚弱领域"; + public override string Description => Effects.Count > 0 ? string.Join("\r\n", Effects.Select(e => e.Description)) : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First(e => e is 造成虚弱).DispelDescription : ""; + public override string ExemptionDescription => Effects.Count > 0 ? Effects.First(e => e is 造成虚弱).ExemptionDescription : ""; + public override double MPCost => Level > 0 ? 85 + (90 * (Level - 1)) : 85; + // 调整:L8 CD 16 → 20(魔法下限 20,同时缓解「持续 > CD」) + public override double CD => Level > 0 ? 34 - (2 * (Level - 1)) : 34; + public override double CastTime => 8; + public override double HardnessTime { get; set; } = 3; + public override bool SelectAllEnemies => true; + public override double MagicBottleneck => 15 + 15 * (Level - 1); + + public 虚弱领域(Character? character = null) : base(SkillType.Magic, character) + { + Effects.Add(new 造成虚弱(this, true, 7, 0, 2, 0.1, 1, 0.1, 0.25, 0.001)); + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/钻石星尘.cs b/OshimaBot.Content/Skills/魔法/钻石星尘.cs new file mode 100644 index 0000000..9033986 --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/钻石星尘.cs @@ -0,0 +1,42 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 钻石星尘 : Skill + { + public override long Id => (long)MagicID.钻石星尘; + public override string Name => "钻石星尘"; + public override string Description => string.Join("", Effects.Select(e => e.Description)); + public override string DispelDescription => "被驱散性:冻结需强驱散,易伤可弱驱散"; + public override double MPCost => Level > 0 ? 80 + (75 * (Level - 1)) : 80; + public override double CD => Level > 0 ? 35 + (2 * (Level - 1)) : 35; + public override double CastTime => 9; + public override double HardnessTime { get; set; } = 6; + public override int CanSelectTargetCount + { + get + { + return Level switch + { + 4 or 5 or 6 => 2, + 7 or 8 => 3, + _ => 1 + }; + } + } + public override SkillRangeType SkillRangeType => SkillRangeType.Circle; + public override int CanSelectTargetRange => 2; + public override double MagicBottleneck => 35 + 24 * (Level - 1); + + public 钻石星尘(Character? character = null) : base(SkillType.Magic, character) + { + IsNonDirectional = true; + ExemptionDescription = $"冻结{SkillSet.GetExemptionDescription(EffectType.Freeze)}\r\n易伤{SkillSet.GetExemptionDescription(EffectType.Vulnerable)}"; + Effects.Add(new 纯数值伤害(this, 60, 30, DamageType.Magical)); + Effects.Add(new 施加概率负面(this, EffectType.Freeze, false, 0, 1, 0, 0.2, 0.03)); + Effects.Add(new 施加概率负面(this, EffectType.Vulnerable, false, 0, 3, 0, 0.2, 0.03, DamageType.Magical, 0.3)); + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/银色荆棘.cs b/OshimaBot.Content/Skills/魔法/银色荆棘.cs new file mode 100644 index 0000000..8081d31 --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/银色荆棘.cs @@ -0,0 +1,115 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using OshimaBot.Content.Effects; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; +using OshimaBot.Content.Effects.PassiveEffects; + +namespace OshimaBot.Content.Skills +{ + public class 银色荆棘 : Skill + { + public override long Id => (long)MagicID.银色荆棘; + public override string Name => "银色荆棘"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override string DispelDescription => Effects.Count > 0 ? Effects.First().DispelDescription : ""; + public override string ExemptionDescription => Effects.Count > 0 ? Effects.First().ExemptionDescription : ""; + public override double MPCost => Level > 0 ? 100 + (80 * (Level - 1)) : 100; + public override double CD => Level > 0 ? 55 - (1.5 * (Level - 1)) : 55; + public override double CastTime => 12; + public override double HardnessTime { get; set; } = 5; + public override int CanSelectTargetCount + { + get + { + return Level switch + { + 4 => 2, + 5 => 2, + 6 => 2, + 7 => 3, + 8 => 3, + _ => 1 + }; + } + } + public override double MagicBottleneck => 20 + 24 * (Level - 1); + + public 银色荆棘(Character? character = null) : base(SkillType.Magic, character) + { + Effects.Add(new 银色荆棘特效(this, false, 0, 2, 0, 0.2, 0.03)); + } + } + + public class 银色荆棘特效 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"对{Skill.TargetDescription()}造成 {Damage:0.##} 点{CharacterSet.GetDamageTypeName(DamageType.Magical, MagicType)}。" + + $"随后 {ActualConfusionProbability * 100:0.##}% 概率对目标施加混乱状态,持续 {持续时间}。混乱:进入行动受限状态,失控并随机行动,且所有指令均会在所有角色中随机选取目标。"; + public override DispelledType DispelledType => DispelledType.Strong; + public override EffectType EffectType => EffectType.Confusion; + public override bool ExemptDuration => true; + + private string 持续时间 => _durative && _duration > 0 ? 实际持续时间 + $" {GameplayEquilibriumConstant.InGameTime}" : (!_durative && _durationTurn > 0 ? 实际持续时间 + " 回合" : $"0 {GameplayEquilibriumConstant.InGameTime}"); + private double 实际持续时间 => _durative && _duration > 0 ? (_duration + _levelGrowth * (Level - 1) * MagicEfficacy) : (!_durative && _durationTurn > 0 ? ((int)Math.Round(_durationTurn + _levelGrowth * (Level - 1) * MagicEfficacy, 0, MidpointRounding.ToPositiveInfinity)) : 0); + private double Damage => Skill.Level > 0 ? 基础数值伤害 + 基础伤害等级成长 * (Skill.Level - 1) : 基础数值伤害; + private double 基础数值伤害 { get; set; } = 50; + private double 基础伤害等级成长 { get; set; } = 40; + /// 实际混乱概率:统一走 (效能乘整体,2026-09-23 统一口径)。 + private double ActualConfusionProbability => EfficacyHit.命中率(_confusionProbability, _confusionProbabilityLevelGrowth, Level, MagicEfficacy); + private readonly bool _durative; + private readonly double _duration; + private readonly int _durationTurn; + private readonly double _levelGrowth; + private readonly double _confusionProbability; + private readonly double _confusionProbabilityLevelGrowth; + + public 银色荆棘特效(Skill skill, bool durative = false, double duration = 0, int durationTurn = 1, double levelGrowth = 0, double confusionProbability = 0, double confusionProbabilityLevelGrowth = 0) : base(skill) + { + GamingQueue = skill.GamingQueue; + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + _levelGrowth = levelGrowth; + _confusionProbability = confusionProbability; + _confusionProbabilityLevelGrowth = confusionProbabilityLevelGrowth; + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + foreach (Character target in targets) + { + DamageToEnemy(caster, target, DamageType.Magical, MagicType, Damage); + if (target.HP > 0 && Random.NextDouble() < ActualConfusionProbability) + { + 混乱 e = new(Skill, caster); + if (!CheckExemption(caster, target, e)) + { + WriteLine($"[ {target} ] 陷入了混乱!!持续时间:{持续时间}!"); + if (_durative && _duration > 0) + { + e.Durative = true; + e.Duration = 实际持续时间; + e.RemainDuration = 实际持续时间; + } + else if (!_durative && _durationTurn > 0) + { + e.Durative = false; + e.DurationTurn = (int)实际持续时间; + e.RemainDurationTurn = (int)实际持续时间; + } + target.Effects.Add(e); + e.OnEffectGained(new HookContext(GamingQueue, target)); + GamingQueue?.AddApplyEffects(target, e.EffectType); + } + } + } + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/风之守护.cs b/OshimaBot.Content/Skills/魔法/风之守护.cs new file mode 100644 index 0000000..6e98c61 --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/风之守护.cs @@ -0,0 +1,117 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Skills +{ + public class 风之守护 : Skill + { + public override long Id => (long)MagicID.风之守护; + public override string Name => "风之守护"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override double MPCost => Level > 0 ? 75 + (80 * (Level - 1)) : 75; + public override double CD => Level > 0 ? 30 - (0.5 * (Level - 1)) : 30; + public override double CastTime => Level > 0 ? 4 + (1 * (Level - 1)) : 4; + public override double HardnessTime { get; set; } = 3; + public override bool CanSelectSelf => true; + public override bool CanSelectEnemy => false; + public override bool CanSelectTeammate => true; + public override int CanSelectTargetCount => 1; + public override double MagicBottleneck => 13 + 14 * (Level - 1); + + public 风之守护(Character? character = null) : base(SkillType.Magic, character) + { + Effects.Add(new 风之守护特效(this, false, 0, 4)); + } + } + + public class 风之守护特效 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"提升目标{(Skill.CanSelectTargetCount > 1 ? $"至多 {Skill.CanSelectTargetCount} 个" : "")}友方角色 {CritRate * 100:0.##}% 暴击率和 {EvadeRate * 100:0.##}% 闪避率,持续 {持续时间}。"; + public override EffectType EffectType => EffectType.CritBoost; + public override DispelledType DispelledType => DispelledType.Weak; + + private string 持续时间 => _durative && _duration > 0 ? 实际持续时间 + $" {GameplayEquilibriumConstant.InGameTime}" : (!_durative && _durationTurn > 0 ? 实际持续时间 + " 回合" : $"0 {GameplayEquilibriumConstant.InGameTime}"); + private double 实际持续时间 => _durative && _duration > 0 ? (_duration + _levelGrowth * (Level - 1) * MagicEfficacy) : (!_durative && _durationTurn > 0 ? ((int)Math.Round(_durationTurn + _levelGrowth * (Level - 1) * MagicEfficacy, 0, MidpointRounding.ToPositiveInfinity)) : 0); + + private readonly bool _durative; + private readonly double _duration; + private readonly int _durationTurn; + private readonly double _levelGrowth; + + private double CritRate => Level > 0 ? 0.03 + 0.03 * (Level - 1) : 0.03; + private double EvadeRate => Level > 0 ? 0.02 + 0.02 * (Level - 1) : 0.02; + + public 风之守护特效(Skill skill, bool durative = false, double duration = 0, int durationTurn = 1, double levelGrowth = 0) : base(skill) + { + GamingQueue = skill.GamingQueue; + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + _levelGrowth = levelGrowth; + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + foreach (Character target in targets) + { + WriteLine($"[ {target} ] 的暴击率提升了 {CritRate * 100:0.##}%,闪避率提升了 {EvadeRate * 100:0.##}%!持续时间:{持续时间}!"); + ExCritRate e = new(Skill, new() + { + { "excr", CritRate } + }, caster) + { + Name = Name + "·暴击率加成" + }; + target.Effects.Add(e); + if (_durative && _duration > 0) + { + e.Durative = true; + e.Duration = 实际持续时间; + e.RemainDuration = 实际持续时间; + } + else if (!_durative && _durationTurn > 0) + { + e.Durative = false; + e.DurationTurn = (int)实际持续时间; + e.RemainDurationTurn = (int)实际持续时间; + } + e.EffectType = EffectType.CritBoost; + e.Source = caster; + e.OnEffectGained(new HookContext(GamingQueue, target)); + ExEvadeRate e2 = new(Skill, new() + { + { "exer", EvadeRate } + }, caster) + { + Name = Name + "·闪避率加成" + }; + target.Effects.Add(e2); + if (_durative && _duration > 0) + { + e2.Durative = true; + e2.Duration = 实际持续时间; + e2.RemainDuration = 实际持续时间; + } + else if (!_durative && _durationTurn > 0) + { + e2.Durative = false; + e2.DurationTurn = (int)实际持续时间; + e2.RemainDurationTurn = (int)实际持续时间; + } + e2.EffectType = EffectType.EvadeBoost; + e2.Source = caster; + e2.OnEffectGained(new HookContext(GamingQueue, target)); + GamingQueue?.AddApplyEffects(target, EffectType.CritBoost, EffectType.EvadeBoost); + } + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/风之守护复.cs b/OshimaBot.Content/Skills/魔法/风之守护复.cs new file mode 100644 index 0000000..4a7a7dd --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/风之守护复.cs @@ -0,0 +1,132 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; +using OshimaBot.Content.Effects.OpenEffects; + +namespace OshimaBot.Content.Skills +{ + public class 风之守护复 : Skill + { + public override long Id => (long)MagicID.风之守护复; + public override string Name => "风之守护·复"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override double MPCost => Level > 0 ? 85 + (90 * (Level - 1)) : 85; + public override double CD => Level > 0 ? 35 - (0.5 * (Level - 1)) : 35; + public override double CastTime => Level > 0 ? 4 + (0.5 * (Level - 1)) : 4; + public override double HardnessTime { get; set; } = 6; + public override bool CanSelectSelf => true; + public override bool CanSelectEnemy => false; + public override bool CanSelectTeammate => true; + public override int CanSelectTargetCount + { + get + { + return Level switch + { + 3 => 3, + 4 => 3, + 5 => 3, + 6 => 4, + 7 => 4, + 8 => 4, + _ => 2 + }; + } + } + public override double MagicBottleneck => 15 + 16 * (Level - 1); + + public 风之守护复(Character? character = null) : base(SkillType.Magic, character) + { + Effects.Add(new 风之守护复特效(this, false, 0, 3)); + } + } + + public class 风之守护复特效 : Effect + { + public override long Id => Skill.Id; + public override string Name => Skill.Name; + public override string Description => $"提升目标{(Skill.CanSelectTargetCount > 1 ? $"至多 {Skill.CanSelectTargetCount} 个" : "")}友方角色 {CritRate * 100:0.##}% 暴击率和 {EvadeRate * 100:0.##}% 闪避率,持续 {持续时间}。"; + public override EffectType EffectType => EffectType.CritBoost; + public override DispelledType DispelledType => DispelledType.Weak; + + private string 持续时间 => _durative && _duration > 0 ? 实际持续时间 + $" {GameplayEquilibriumConstant.InGameTime}" : (!_durative && _durationTurn > 0 ? 实际持续时间 + " 回合" : $"0 {GameplayEquilibriumConstant.InGameTime}"); + private double 实际持续时间 => _durative && _duration > 0 ? (_duration + _levelGrowth * (Level - 1) * MagicEfficacy) : (!_durative && _durationTurn > 0 ? ((int)Math.Round(_durationTurn + _levelGrowth * (Level - 1) * MagicEfficacy, 0, MidpointRounding.ToPositiveInfinity)) : 0); + + private readonly bool _durative; + private readonly double _duration; + private readonly int _durationTurn; + private readonly double _levelGrowth; + + private double CritRate => Level > 0 ? 0.02 + 0.02 * (Level - 1) : 0.02; + private double EvadeRate => Level > 0 ? 0.015 + 0.012 * (Level - 1) : 0.015; + + public 风之守护复特效(Skill skill, bool durative = false, double duration = 0, int durationTurn = 1, double levelGrowth = 0) : base(skill) + { + GamingQueue = skill.GamingQueue; + _durative = durative; + _duration = duration; + _durationTurn = durationTurn; + _levelGrowth = levelGrowth; + } + + public override void OnSkillCasted(SkillCastContext ctx) + { + if (ctx.Trigger is not Character caster) return; + List targets = ctx.Targets; + List grids = ctx.Grids; + Dictionary others = ctx.Others; + foreach (Character target in targets) + { + WriteLine($"[ {target} ] 的暴击率提升了 {CritRate * 100:0.##}%,闪避率提升了 {EvadeRate * 100:0.##}%!持续时间:{持续时间}!"); + ExCritRate e = new(Skill, new() + { + { "excr", CritRate } + }, caster) + { + Name = Name + "·暴击率加成" + }; + target.Effects.Add(e); + if (_durative && _duration > 0) + { + e.Durative = true; + e.Duration = 实际持续时间; + e.RemainDuration = 实际持续时间; + } + else if (!_durative && _durationTurn > 0) + { + e.Durative = false; + e.DurationTurn = (int)实际持续时间; + e.RemainDurationTurn = (int)实际持续时间; + } + e.EffectType = EffectType.CritBoost; + e.Source = caster; + e.OnEffectGained(new HookContext(GamingQueue, target)); + ExEvadeRate e2 = new(Skill, new() + { + { "exer", EvadeRate } + }, caster) + { + Name = Name + "·闪避率加成" + }; + target.Effects.Add(e2); + if (_durative && _duration > 0) + { + e2.Durative = true; + e2.Duration = 实际持续时间; + e2.RemainDuration = 实际持续时间; + } + else if (!_durative && _durationTurn > 0) + { + e2.Durative = false; + e2.DurationTurn = (int)实际持续时间; + e2.RemainDurationTurn = (int)实际持续时间; + } + e2.EffectType = EffectType.EvadeBoost; + e2.Source = caster; + e2.OnEffectGained(new HookContext(GamingQueue, target)); + GamingQueue?.AddApplyEffects(target, EffectType.CritBoost, EffectType.EvadeBoost); + } + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/风之轮.cs b/OshimaBot.Content/Skills/魔法/风之轮.cs new file mode 100644 index 0000000..92cdb11 --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/风之轮.cs @@ -0,0 +1,23 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 风之轮 : Skill + { + public override long Id => (long)MagicID.风之轮; + public override string Name => "风之轮"; + public override string Description => Effects.Count > 0 ? Effects.First().Description : ""; + public override double MPCost => Level > 0 ? 50 + (60 * (Level - 1)) : 50; + public override double CD => 30; + public override double CastTime => 10; + public override double HardnessTime { get; set; } = 4; + public override double MagicBottleneck => 12 + 13 * (Level - 1); + + public 风之轮(Character? character = null) : base(SkillType.Magic, character) + { + Effects.Add(new 基于属性的伤害(this, PrimaryAttribute.AGI, 120, 80, 0.4, 0.4)); + } + } +} diff --git a/OshimaBot.Content/Skills/魔法/鬼魅之痛.cs b/OshimaBot.Content/Skills/魔法/鬼魅之痛.cs new file mode 100644 index 0000000..37c74fd --- /dev/null +++ b/OshimaBot.Content/Skills/魔法/鬼魅之痛.cs @@ -0,0 +1,41 @@ +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.SkillEffects; + +namespace OshimaBot.Content.Skills +{ + public class 鬼魅之痛 : Skill + { + public override long Id => (long)MagicID.鬼魅之痛; + public override string Name => "鬼魅之痛"; + public override string Description => string.Join("", Effects.Select(e => e.Description)); + public override string DispelDescription => Effects.Count > 0 ? Effects.First(e => e is 施加概率负面).DispelDescription : ""; + public override string ExemptionDescription => Effects.Count > 0 ? Effects.First(e => e is 施加概率负面).ExemptionDescription : ""; + public override double MPCost => Level > 0 ? 70 + (75 * (Level - 1)) : 70; + public override double CD => Level > 0 ? 38 + (1 * (Level - 1)) : 38; + public override double CastTime => 9; + public override double HardnessTime { get; set; } = 7; + public override int CanSelectTargetCount + { + get + { + return Level switch + { + 4 => 2, + 5 => 2, + 6 => 2, + 7 => 3, + 8 => 3, + _ => 1 + }; + } + } + public override double MagicBottleneck => 20 + 24 * (Level - 1); + + public 鬼魅之痛(Character? character = null) : base(SkillType.Magic, character) + { + Effects.Add(new 纯数值伤害(this, 65, 35, DamageType.Magical)); + Effects.Add(new 施加概率负面(this, EffectType.Stun, true, 6, 0, 0.7, 0.2, 0.03)); + } + } +} diff --git a/OshimaBot.Content/Units/RegionCharacter.cs b/OshimaBot.Content/Units/RegionCharacter.cs new file mode 100644 index 0000000..adc6631 --- /dev/null +++ b/OshimaBot.Content/Units/RegionCharacter.cs @@ -0,0 +1,56 @@ +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; + +namespace OshimaBot.Content.Units +{ + public class RegionCharacter : Character + { + public HashSet> GenerationPredicates { get; } = []; + + public RegionCharacter(long id, string name, params IEnumerable> predicates) + { + Id = id; + Name = name; + NickName = name; + PrimaryAttribute = (PrimaryAttribute)Random.Next(1, 4); + InitialATK = Random.Next(55, 101); + InitialHP = Random.Next(80, 201); + InitialMP = Random.Next(50, 131); + + int value = 61; + int valueGrowth = 61; + for (int i = 0; i < 3; i++) + { + if (value == 0) break; + int attribute = i < 2 ? Random.Next(value) : (value - 1); + int growth = i < 2 ? Random.Next(0, valueGrowth) : (valueGrowth - 1); + switch (i) + { + case 1: + InitialAGI = attribute; + AGIGrowth = Calculation.Round(Convert.ToDouble(growth) / 10, 2); + break; + case 2: + InitialINT = attribute; + INTGrowth = Calculation.Round(Convert.ToDouble(growth) / 10, 2); + break; + case 0: + default: + InitialSTR = attribute; + STRGrowth = Calculation.Round(Convert.ToDouble(growth) / 10, 2); + break; + } + value -= attribute; + valueGrowth -= growth; + } + InitialSPD = Random.Next(220, 451); + InitialHR = Random.Next(3, 9); + InitialMR = Random.Next(3, 9); + foreach (Func predicate in predicates) + { + GenerationPredicates.Add(predicate); + } + } + } +} diff --git a/OshimaBot.Content/Units/RegionUnit.cs b/OshimaBot.Content/Units/RegionUnit.cs new file mode 100644 index 0000000..e295bd8 --- /dev/null +++ b/OshimaBot.Content/Units/RegionUnit.cs @@ -0,0 +1,26 @@ +using FunGame.Core.Entity; + +namespace OshimaBot.Content.Units +{ + public class RegionUnit : Unit + { + public override bool IsUnit => false; // 不走单位判断 + public HashSet> GenerationPredicates { get; } = []; + + public RegionUnit(long id, string name, params IEnumerable> predicates) + { + Id = id; + Name = name; + InitialATK = Random.Next(25, 51); + InitialHP = Random.Next(35, 91); + InitialMP = Random.Next(20, 61); + InitialSPD = Random.Next(155, 320); + InitialHR = Random.Next(1, 6); + InitialMR = Random.Next(1, 6); + foreach (Func predicate in predicates) + { + GenerationPredicates.Add(predicate); + } + } + } +} diff --git a/OshimaBot.Content/Units/雇佣兵.cs b/OshimaBot.Content/Units/雇佣兵.cs new file mode 100644 index 0000000..9a13bf1 --- /dev/null +++ b/OshimaBot.Content/Units/雇佣兵.cs @@ -0,0 +1,22 @@ +using FunGame.Core.Entity; + +namespace OshimaBot.Content +{ + public class 雇佣兵 : Unit + { + public override string Name => "雇佣兵"; + + public override string ToString() + { + return NickName; + } + + public 雇佣兵(Character master, string name) : base() + { + NickName = $"雇佣兵{name}({master})"; + Master = master; + ExATR = master.ExATR - master.ATR; + ExMOV = master.ExMOV - master.MOV; + } + } +} diff --git a/OshimaBot.Content/modules/oshima-studios/oshima.fungame.items.json b/OshimaBot.Content/modules/oshima-studios/oshima.fungame.items.json new file mode 100644 index 0000000..a77ace5 --- /dev/null +++ b/OshimaBot.Content/modules/oshima-studios/oshima.fungame.items.json @@ -0,0 +1,4307 @@ +{ + "花剑": { + "Id": 11540, + "Name": "花剑", + "Description": "增加角色 20 点攻击力。", + "BackgroundStory": "初学者必备武器。", + "ItemType": 1, + "WeaponType": 1, + "QualityType": 0, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7000, + "Name": "花剑", + "SkillType": 3, + "Effects": [ + { + "Id": 8001, + "exatk": 20 + } + ] + } + ] + } + }, + "木杖": { + "Id": 11541, + "Name": "木杖", + "Description": "增加角色 20 点攻击力。", + "BackgroundStory": "魔法使的起点。", + "ItemType": 1, + "WeaponType": 8, + "QualityType": 0, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7001, + "Name": "木杖", + "SkillType": 3, + "Effects": [ + { + "Id": 8001, + "exatk": 20 + } + ] + } + ] + } + }, + "真理": { + "Id": 11542, + "Name": "真理", + "Description": "增加角色 20 点攻击力。", + "BackgroundStory": "口径即是正义。", + "ItemType": 1, + "WeaponType": 4, + "QualityType": 0, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7002, + "Name": "真理", + "SkillType": 3, + "Effects": [ + { + "Id": 8001, + "exatk": 20 + } + ] + } + ] + } + }, + "黯星之刃": { + "Id": 11543, + "Name": "黯星之刃", + "Description": "增加角色 40 点攻击力。", + "BackgroundStory": "从银辉城悖论引擎泄露的能量中淬炼而成,剑身隐隐闪烁着星屑般的光芒,仿佛能吞噬微弱的现实裂缝。", + "ItemType": 1, + "WeaponType": 1, + "QualityType": 1, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7003, + "Name": "黯星之刃", + "SkillType": 3, + "Effects": [ + { + "Id": 8001, + "exatk": 40 + } + ] + } + ] + }, + "Others": { + "region": 1 + } + }, + "熔岩裂刃": { + "Id": 11544, + "Name": "熔岩裂刃", + "Description": "增加角色 40 点攻击力。", + "BackgroundStory": "深渊火钻的余烬锻造此剑,挥舞时剑身如岩浆般滚烫,灼烧空气。", + "ItemType": 1, + "WeaponType": 2, + "QualityType": 1, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7004, + "Name": "熔岩裂刃", + "SkillType": 3, + "Effects": [ + { + "Id": 8001, + "exatk": 40 + } + ] + } + ] + }, + "Others": { + "region": 3 + } + }, + "银月弓": { + "Id": 11545, + "Name": "银月弓", + "Description": "增加角色 40 点攻击力。", + "BackgroundStory": "荧光精灵以液态月光浸润弓弦,箭矢划破夜空时如流星坠落。", + "ItemType": 1, + "WeaponType": 3, + "QualityType": 1, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7005, + "Name": "银月弓", + "SkillType": 3, + "Effects": [ + { + "Id": 8001, + "exatk": 40 + } + ] + } + ] + }, + "Others": { + "region": 2 + } + }, + "罚罪之楔": { + "Id": 11546, + "Name": "罚罪之楔", + "Description": "增加角色 25 点攻击力和 10% 攻击力。", + "BackgroundStory": "从裁决尖碑坠落的塔刹碎片,尖端仍萦绕着泰坦调试世界时遗弃的错误符文。", + "ItemType": 1, + "WeaponType": 9, + "QualityType": 1, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7006, + "Name": "罚罪之楔", + "SkillType": 3, + "Effects": [ + { + "Id": 8001, + "exatk": 25 + }, + { + "Id": 8023, + "exatk": 0.1 + } + ] + } + ] + }, + "Others": { + "region": 12 + } + }, + "忏悔齿轮": { + "Id": 11547, + "Name": "忏悔齿轮", + "Description": "增加角色 30 点攻击力和 5% 暴击率。", + "BackgroundStory": "齿轮坟场拾到的噬罪者遗物,嵌入手掌的齿轮会转动着磨碎使用者的谎言。", + "ItemType": 1, + "WeaponType": 10, + "QualityType": 1, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7007, + "Name": "忏悔齿轮", + "SkillType": 3, + "Effects": [ + { + "Id": 8001, + "exatk": 30 + }, + { + "Id": 8014, + "excr": 0.05 + } + ] + } + ] + }, + "Others": { + "region": 5 + } + }, + "鱿熔之信": { + "Id": 11548, + "Name": "鱿熔之信", + "Description": "增加角色 30 点攻击力和 20% 物理穿透。", + "BackgroundStory": "永燃坩埚的岩浆鱿鱼群将信仰铸进剑身,触碰活体金属苔藓会引发火山鲸的共鸣。", + "ItemType": 1, + "WeaponType": 1, + "QualityType": 1, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7008, + "Name": "鱿熔之信", + "SkillType": 3, + "Effects": [ + { + "Id": 8001, + "exatk": 30 + }, + { + "Id": 8017, + "exppt": 0.2 + } + ] + } + ] + }, + "Others": { + "region": 3 + } + }, + "冬眠之怒": { + "Id": 11549, + "Name": "冬眠之怒", + "Description": "增加角色 65 点攻击力。", + "BackgroundStory": "古龙封印解除前剥落的鳞甲,重击时飘出精灵封印术式的碎光——那是古龙在梦中的反击。", + "ItemType": 1, + "WeaponType": 2, + "QualityType": 2, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7009, + "Name": "冬眠之怒", + "SkillType": 3, + "Effects": [ + { + "Id": 8001, + "exatk": 65 + } + ] + } + ] + }, + "Others": { + "region": 2 + } + }, + "溺影者": { + "Id": 11550, + "Name": "溺影者", + "Description": "增加角色 65 点攻击力。", + "BackgroundStory": "被千瞳湖倒影之城同化过的长弓,射出的箭总在触及目标前变成反向流动的湖水。", + "ItemType": 1, + "WeaponType": 3, + "QualityType": 2, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7010, + "Name": "溺影者", + "SkillType": 3, + "Effects": [ + { + "Id": 8001, + "exatk": 65 + } + ] + } + ] + }, + "Others": { + "region": 6 + } + }, + "罚罪遗针": { + "Id": 11551, + "Name": "罚罪遗针", + "Description": "增加角色 65 点攻击力。", + "BackgroundStory": "似乎是由断裂的引雷柱碎片改造,耳畔传来低沉不安的低语——泰坦的罪人。", + "ItemType": 1, + "WeaponType": 11, + "QualityType": 2, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7011, + "Name": "罚罪遗针", + "SkillType": 3, + "Effects": [ + { + "Id": 8001, + "exatk": 65 + } + ] + } + ] + }, + "Others": { + "region": 12 + } + }, + "星癔症": { + "Id": 11552, + "Name": "星癔症", + "Description": "增加角色 50 点攻击力和 10% 魔法穿透。", + "BackgroundStory": "顶端晶石持续吸入星光,施法过量将使持杖者瞳孔显现星空巨兽轮廓。", + "ItemType": 1, + "WeaponType": 8, + "QualityType": 2, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7012, + "Name": "星癔症", + "SkillType": 3, + "Effects": [ + { + "Id": 8001, + "exatk": 50 + }, + { + "Id": 8018, + "exmpt": 0.1 + } + ] + } + ] + }, + "Others": { + "region": 10 + } + }, + "火钻之癌": { + "Id": 11553, + "Name": "火钻之癌", + "Description": "增加角色 50 点攻击力和 30% 物理穿透。", + "BackgroundStory": "剑身火钻随杀戮增殖,当覆盖全身时持剑者将化为新矿脉。", + "ItemType": 1, + "WeaponType": 1, + "QualityType": 2, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7013, + "Name": "火钻之癌", + "SkillType": 3, + "Effects": [ + { + "Id": 8001, + "exatk": 50 + }, + { + "Id": 8017, + "exppt": 0.3 + } + ] + } + ] + }, + "Others": { + "region": 3 + } + }, + "昨日借据": { + "Id": 11554, + "Name": "昨日借据", + "Description": "增加角色 50 点攻击力和 15% 暴击伤害。", + "BackgroundStory": "每次开弓弓弦渗出更多时之沙,然后偷取光阴。", + "ItemType": 1, + "WeaponType": 3, + "QualityType": 2, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7014, + "Name": "昨日借据", + "SkillType": 3, + "Effects": [ + { + "Id": 8001, + "exatk": 50 + }, + { + "Id": 8015, + "excrd": 0.15 + } + ] + } + ] + }, + "Others": { + "region": 7 + } + }, + "永劫婚契": { + "Id": 11555, + "Name": "永劫婚契", + "Description": "增加角色 50 点攻击力和 40 行动速度。", + "BackgroundStory": "影玫瑰在矛尖绽放时,时间流速突然减半,随后逐渐丧失色彩感知。", + "ItemType": 1, + "WeaponType": 9, + "QualityType": 2, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7015, + "Name": "永劫婚契", + "SkillType": 3, + "Effects": [ + { + "Id": 8001, + "exatk": 50 + }, + { + "Id": 8009, + "exspd": 40 + } + ] + } + ] + }, + "Others": { + "region": 10 + } + }, + "母体赐胎": { + "Id": 11556, + "Name": "母体赐胎", + "Description": "增加角色 95 点攻击力。", + "BackgroundStory": "刀柄菌丝随着杀戮逐渐向心脏延伸一寸,菌丝满布时将蜕变为新母体。", + "ItemType": 1, + "WeaponType": 6, + "QualityType": 3, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7016, + "Name": "母体赐胎", + "SkillType": 3, + "Effects": [ + { + "Id": 8001, + "exatk": 95 + } + ] + } + ] + }, + "Others": { + "region": 9 + } + }, + "痛觉回路": { + "Id": 11557, + "Name": "痛觉回路", + "Description": "增加角色 95 点攻击力。", + "BackgroundStory": "据说神经宝石与原主痛觉神经直连,每当原主施放伤害性法术时会先承受双倍痛苦。", + "ItemType": 1, + "WeaponType": 8, + "QualityType": 3, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7017, + "Name": "痛觉回路", + "SkillType": 3, + "Effects": [ + { + "Id": 8001, + "exatk": 95 + } + ] + } + ] + }, + "Others": { + "region": 12 + } + }, + "坟场低语": { + "Id": 11558, + "Name": "坟场低语", + "Description": "增加角色 95 点攻击力。", + "BackgroundStory": "齿轮残骸自发组合成的武器,接触血肉时会背诵上古机械法典。", + "ItemType": 1, + "WeaponType": 5, + "QualityType": 3, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7018, + "Name": "坟场低语", + "SkillType": 3, + "Effects": [ + { + "Id": 8001, + "exatk": 95 + } + ] + } + ] + }, + "Others": { + "region": 5 + } + }, + "替身指骨": { + "Id": 11559, + "Name": "替身指骨", + "Description": "增加角色 70 点攻击力和 12% 暴击率。", + "BackgroundStory": "裹着机械坟场拾回的神经皮膜,每当齿轮转动时它就模拟出原主人断裂的掌纹。", + "ItemType": 1, + "WeaponType": 8, + "QualityType": 3, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7019, + "Name": "替身指骨", + "SkillType": 3, + "Effects": [ + { + "Id": 8001, + "exatk": 70 + }, + { + "Id": 8014, + "excr": 0.12 + } + ] + } + ] + }, + "Others": { + "region": 5 + } + }, + "冬眠之弦": { + "Id": 11560, + "Name": "冬眠之弦", + "Description": "增加角色 60 点攻击力和 20% 攻击力。", + "BackgroundStory": "拉开弓弦时会掉落冰晶粉末——那是林海在冬季凝结时,遗留在树梢的叹息。", + "ItemType": 1, + "WeaponType": 3, + "QualityType": 3, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7020, + "Name": "冬眠之弦", + "SkillType": 3, + "Effects": [ + { + "Id": 8001, + "exatk": 60 + }, + { + "Id": 8023, + "exatk": 0.2 + } + ] + } + ] + }, + "Others": { + "region": 2 + } + }, + "矿工的遗恨": { + "Id": 11561, + "Name": "矿工的遗恨", + "Description": "增加角色 70 点攻击力和 40% 物理穿透。", + "BackgroundStory": "最后一位熔岩矿工将它插进裂缝,刀尖在冷却前吞下了他坠入元素位面的剪影。", + "ItemType": 1, + "WeaponType": 6, + "QualityType": 3, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7021, + "Name": "矿工的遗恨", + "SkillType": 3, + "Effects": [ + { + "Id": 8001, + "exatk": 70 + }, + { + "Id": 8017, + "exppt": 0.4 + } + ] + } + ] + }, + "Others": { + "region": 3 + } + }, + "镜癌": { + "Id": 11562, + "Name": "镜癌", + "Description": "增加角色 70 点攻击力和 20% 魔法穿透。", + "BackgroundStory": "千瞳湖的镜像病感染了它的表面,光滑的倒影里总爬行着鳞片状增生组织。", + "ItemType": 1, + "WeaponType": 7, + "QualityType": 3, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7022, + "Name": "镜癌", + "SkillType": 3, + "Effects": [ + { + "Id": 8001, + "exatk": 70 + }, + { + "Id": 8018, + "exmpt": 0.2 + } + ] + } + ] + }, + "Others": { + "region": 6 + } + }, + "千瞳折跃": { + "Id": 11563, + "Description": "增加角色 130 点攻击力。", + "Name": "千瞳折跃", + "BackgroundStory": "千瞳镜湖底部的瞳孔门碎片镀在刃上,投掷时会在重力倒转的镜像中二次折射。", + "ItemType": 1, + "WeaponType": 11, + "QualityType": 4, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7023, + "Name": "千瞳折跃", + "SkillType": 3, + "Effects": [ + { + "Id": 8001, + "exatk": 130 + } + ] + } + ] + }, + "Others": { + "region": 6 + } + }, + "时渊弦歌": { + "Id": 11564, + "Name": "时渊弦歌", + "Description": "增加角色 130 点攻击力。", + "BackgroundStory": "用永霜裂痕的时钟齿轮做弓弣,拉满时冰封记忆在弦上凝成冰晶箭簇。", + "ItemType": 1, + "WeaponType": 3, + "QualityType": 4, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7024, + "Name": "时渊弦歌", + "SkillType": 3, + "Effects": [ + { + "Id": 8001, + "exatk": 130 + } + ] + } + ] + }, + "Others": { + "region": 4 + } + }, + "创世余颤": { + "Id": 11565, + "Name": "创世余颤", + "Description": "增加角色 130 点攻击力。", + "BackgroundStory": "雷霆王座裁决尖碑脱落的符文嵌于斧面,挥舞时重播泰坦调试世界的低语。", + "ItemType": 1, + "WeaponType": 2, + "QualityType": 4, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7025, + "Name": "创世余颤", + "SkillType": 3, + "Effects": [ + { + "Id": 8001, + "exatk": 130 + } + ] + } + ] + }, + "Others": { + "region": 12 + } + }, + "血脉协奏曲": { + "Id": 11566, + "Name": "血脉协奏曲", + "Description": "增加角色 90 点攻击力和 10% 生命偷取。", + "BackgroundStory": "植入了林海树木的荧蓝汁液导管,拳风会随精灵封印节拍闪烁。", + "ItemType": 1, + "WeaponType": 10, + "QualityType": 4, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7026, + "Name": "血脉协奏曲", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exatk": 90, + "exls": 0.1 + } + ] + } + ] + }, + "Others": { + "region": 2 + } + }, + "真空虹彩": { + "Id": 11567, + "Name": "真空虹彩", + "Description": "增加角色 75 点攻击力和 30% 攻击力。", + "BackgroundStory": "穹顶之泪湖的星辉凝露在法器内分层,每道咒语都折射出肉眼未见的宇宙色谱。", + "ItemType": 1, + "WeaponType": 7, + "QualityType": 4, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7027, + "Name": "真空虹彩", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exatk": 75, + "exatk2": 0.3 + } + ] + } + ] + }, + "Others": { + "region": 1 + } + }, + "语律沉默": { + "Id": 11568, + "Name": "语律沉默", + "Description": "增加角色 90 点攻击力和 35% 魔法穿透。", + "BackgroundStory": "辉煌的外表上蚀刻着泰坦调试世界时的废弃词条,挥动时引发语法乱流。", + "ItemType": 1, + "WeaponType": 7, + "QualityType": 4, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7028, + "Name": "语律沉默", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exatk": 90, + "exmpt": 0.35 + } + ] + } + ] + }, + "Others": { + "region": 12 + } + }, + "鸳鸯眼": { + "Id": 11569, + "Name": "鸳鸯眼", + "Description": "增加角色 90 点攻击力和 55% 物理穿透。", + "BackgroundStory": "梦境碎片在刀刃显影,左刀写情诗,右刀寄讣告。", + "ItemType": 1, + "WeaponType": 6, + "QualityType": 4, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7029, + "Name": "鸳鸯眼", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exatk": 90, + "exppt": 0.55 + } + ] + } + ] + }, + "Others": { + "region": 8 + } + }, + "昴宿": { + "Id": 11570, + "Name": "昴宿", + "Description": "增加角色 90 点攻击力和 20% 暴击率。", + "BackgroundStory": "用苍穹碎屿坠落的星锚残骸铸造,枪尖永远指向被束缚巨兽的哀鸣坐标。", + "ItemType": 1, + "WeaponType": 9, + "QualityType": 4, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7030, + "Name": "昴宿", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exatk": 90, + "excr": 0.2 + } + ] + } + ] + }, + "Others": { + "region": 10 + } + }, + "蔷薇花环": { + "Id": 11571, + "Name": "蔷薇花环", + "Description": "增加角色 90 点攻击力和 35% 暴击伤害。", + "BackgroundStory": "一环荆棘与花朵交织的暗器,美丽而致命,象征着爱与痛的纠缠。", + "ItemType": 1, + "WeaponType": 11, + "QualityType": 4, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7031, + "Name": "蔷薇花环", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exatk": 90, + "excrd": 0.35 + } + ] + } + ] + }, + "Others": { + "region": 10 + } + }, + "金箍棒": { + "Id": 11572, + "Name": "金箍棒", + "Description": "增加角色 90 点攻击力。克敌机先:普通攻击有 60% 概率无视闪避。", + "BackgroundStory": "天河定底神珍棒,棒名如意世间高。", + "ItemType": 1, + "WeaponType": 9, + "QualityType": 4, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7032, + "Name": "金箍棒", + "SkillType": 3, + "Effects": [ + { + "Id": 8001, + "exatk": 90 + }, + { + "Id": 8033, + "p": 0.6 + } + ] + } + ] + } + }, + "黑千鸟·白千鸟": { + "Id": 11573, + "Name": "黑千鸟·白千鸟", + "Description": "增加角色 110 点攻击力和 70% 物理穿透。", + "BackgroundStory": "一如夜色中无声的掠影,一如破晓时致命的闪光,它们在死寂中起舞,在血光中归巢。", + "ItemType": 1, + "WeaponType": 6, + "QualityType": 5, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7033, + "Name": "黑千鸟·白千鸟", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exatk": 110, + "exppt": 0.7 + } + ] + } + ] + }, + "Others": { + "region": 10 + } + }, + "红雪剑·白雨刀": { + "Id": 11574, + "Name": "红雪剑·白雨刀", + "Description": "增加角色 110 点攻击力和 50% 暴击伤害。", + "BackgroundStory": "一者铭刻血色宿命,一者涤尽尘世铅华,共谱一曲绝美的终章。", + "ItemType": 1, + "WeaponType": 6, + "QualityType": 5, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7034, + "Name": "红雪剑·白雨刀", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exatk": 110, + "excrd": 0.5 + } + ] + } + ] + } + }, + "羔羊颂": { + "Id": 11575, + "Name": "羔羊颂", + "Description": "增加角色 110 点攻击力和 30% 暴击率。", + "BackgroundStory": "银芒流转若垂首月光,锋刃低吟待迷途羔羊。", + "ItemType": 1, + "WeaponType": 1, + "QualityType": 5, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7035, + "Name": "羔羊颂", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exatk": 110, + "excr": 0.3 + } + ] + } + ] + }, + "Others": { + "region": 1 + } + }, + "紫苑": { + "Id": 11576, + "Name": "紫苑", + "Description": "增加角色 170 点攻击力。", + "BackgroundStory": "流星不过是谎言的残烬,而这把弓,只射穿未亡的昨日。", + "ItemType": 1, + "WeaponType": 3, + "QualityType": 5, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7036, + "Name": "紫苑", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exatk": 170 + } + ] + } + ] + }, + "Others": { + "region": 7 + } + }, + "机械星": { + "Id": 11577, + "Name": "机械星", + "Description": "增加角色 170 点攻击力。", + "BackgroundStory": "精密擒纵囚禁着失控熵增,水晶透镜后无数彗星正在溺亡。", + "ItemType": 1, + "WeaponType": 7, + "QualityType": 5, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7037, + "Name": "机械星", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exatk": 170 + } + ] + } + ] + }, + "Others": { + "region": 5 + } + }, + "镇魂铃": { + "Id": 11578, + "Name": "镇魂铃", + "Description": "增加角色 110 点攻击力和 50% 魔法穿透。", + "BackgroundStory": "十二律蚀骨为笼,余音锻魂成铜锈——此铃只囚未冷的灰烬。", + "ItemType": 1, + "WeaponType": 7, + "QualityType": 5, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7038, + "Name": "镇魂铃", + "SkillType": 3, + "Effects": [ + { + "Id": 8001, + "exatk": 110 + }, + { + "Id": 8018, + "exmpt": 0.5 + } + ] + } + ] + }, + "Others": { + "region": 11 + } + }, + "终焉之紫荆花": { + "Id": 11579, + "Name": "终焉之紫荆花", + "Description": "增加角色 110 点攻击力和 15% 生命偷取。", + "BackgroundStory": "他们看见剑刃绽放的紫荆时,总误以为春天将至。殊不知那千万盛开的花瓣,每一片都刻着古龙冬眠前的最后一个纪元。", + "ItemType": 1, + "WeaponType": 11, + "QualityType": 5, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7039, + "Name": "终焉之紫荆花", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exatk": 110, + "exls": 0.15 + } + ] + } + ] + }, + "Others": { + "region": 2 + } + }, + "初级法袍": { + "Id": 12500, + "Name": "初级法袍", + "Description": "增加角色 8% 魔法抗性。", + "BackgroundStory": "可以不穿,不能没有。", + "ItemType": 2, + "WeaponType": 0, + "QualityType": 0, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7100, + "Name": "初级法袍", + "SkillType": 3, + "Effects": [ + { + "Id": 8020, + "mdftype": 0, + "mdfvalue": 0.08 + } + ] + } + ] + } + }, + "学院派法则": { + "Id": 12501, + "Name": "学院派法则", + "Description": "增加角色 5% 魔法抗性和 20 点物理护甲。", + "BackgroundStory": "小孩子才做选择。", + "ItemType": 2, + "WeaponType": 0, + "QualityType": 0, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7101, + "Name": "学院派法则", + "SkillType": 3, + "Effects": [ + { + "Id": 8020, + "mdftype": 0, + "mdfvalue": 0.05 + }, + { + "Id": 8002, + "exdef": 20 + } + ] + } + ] + } + }, + "高中校服": { + "Id": 12502, + "Name": "高中校服", + "Description": "增加角色 40 点物理护甲。", + "BackgroundStory": "珍藏的回忆。", + "ItemType": 2, + "WeaponType": 0, + "QualityType": 0, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7102, + "Name": "高中校服", + "SkillType": 3, + "Effects": [ + { + "Id": 8002, + "exdef": 40 + } + ] + } + ] + } + }, + "圣洁之盾": { + "Id": 12503, + "Name": "圣洁之盾", + "Description": "增加 10% 物理伤害减免。", + "BackgroundStory": "传说中由圣光祝福的盾牌,能够抵挡邪恶的力量。", + "ItemType": 2, + "WeaponType": 0, + "QualityType": 1, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7103, + "Name": "圣光护佑", + "SkillType": 3, + "Effects": [ + { + "Id": 8019, + "expdr": 0.1 + } + ] + } + ] + } + }, + "魔能法袍": { + "Id": 12504, + "Name": "魔能法袍", + "Description": "增加角色 8 点智力和 8% 魔法抗性。", + "BackgroundStory": "法袍蕴含着神秘的魔力,穿戴者能增强魔法威力。", + "ItemType": 2, + "WeaponType": 0, + "QualityType": 1, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7104, + "Name": "魔力增幅", + "SkillType": 3, + "Effects": [ + { + "Id": 8005, + "exint": 8 + }, + { + "Id": 8020, + "mdftype": 0, + "mdfvalue": 0.08 + } + ] + } + ] + } + }, + "炼狱战铠": { + "Id": 12505, + "Name": "炼狱战铠", + "Description": "增加角色 60 点物理护甲和 5 点每秒生命回复。", + "BackgroundStory": "在无尽战火中锻造而成,具有极高的防御力。", + "ItemType": 2, + "WeaponType": 0, + "QualityType": 1, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7105, + "Name": "战火庇护", + "SkillType": 3, + "Effects": [ + { + "Id": 8002, + "exdef": 60 + }, + { + "Id": 8021, + "exhr": 5 + } + ] + } + ] + } + }, + "幽影斗篷": { + "Id": 12506, + "Name": "幽影斗篷", + "Description": "增加角色 60 点物理护甲和 8% 闪避率。", + "BackgroundStory": "黑暗中编织而成的斗篷,能让穿戴者更加敏捷。", + "ItemType": 2, + "WeaponType": 0, + "QualityType": 1, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7106, + "Name": "幽影闪避", + "SkillType": 3, + "Effects": [ + { + "Id": 8002, + "exdef": 60 + }, + { + "Id": 8016, + "exer": 0.08 + } + ] + } + ] + } + }, + "泰坦诗戒": { + "Id": 12507, + "Name": "泰坦诗戒", + "Description": "增加角色 75 点物理护甲和 10% 魔法抗性。", + "BackgroundStory": "裁决尖碑拓印符文的水晶额冠,雷光在思维间隙谱写创世韵脚。", + "ItemType": 2, + "WeaponType": 0, + "QualityType": 2, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7107, + "Name": "泰坦诗戒", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exdef": 75, + "mdftype": 0, + "mdfvalue": 0.10 + } + ] + } + ] + }, + "Others": { + "region": 12 + } + }, + "星缎礼赞": { + "Id": 12508, + "Name": "星缎礼赞", + "Description": "增加角色 120 点物理护甲。", + "BackgroundStory": "银辉城液态月光凝固的丝绸衬甲,移动时衣褶流淌银河碎影。", + "ItemType": 2, + "WeaponType": 0, + "QualityType": 2, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7108, + "Name": "星缎礼赞", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exdef": 120 + } + ] + } + ] + }, + "Others": { + "region": 1 + } + }, + "千瞳幻纱": { + "Id": 12509, + "Name": "千瞳幻纱", + "Description": "增加角色 14% 魔法抗性。", + "BackgroundStory": "千镜湖底抽丝编织的星雾薄纱,倒影中浮动的门扉始终半掩。", + "ItemType": 2, + "WeaponType": 0, + "QualityType": 2, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7109, + "Name": "千瞳幻纱", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "mdftype": 0, + "mdfvalue": 0.14 + } + ] + } + ] + }, + "Others": { + "region": 6 + } + }, + "时隙沙漏裙": { + "Id": 12510, + "Name": "时隙沙漏裙", + "Description": "增加角色 12% 物理伤害减免和 10% 加速系数。", + "BackgroundStory": "昨日之城时光经纬织就的流砂裙摆,每步落下皆绽开石英花。", + "ItemType": 2, + "WeaponType": 0, + "QualityType": 2, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7110, + "Name": "时隙沙漏裙", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "expdr": 0.12, + "exacc": 0.1 + } + ] + } + ] + }, + "Others": { + "region": 7 + } + }, + "冰魄披肩": { + "Id": 12511, + "Name": "冰魄披肩", + "Description": "增加角色 12% 物理伤害减免和 15% 冷却缩减。", + "BackgroundStory": "当你途经战场残影,冰晶会重演她未寄出的诀别信。", + "ItemType": 2, + "WeaponType": 0, + "QualityType": 3, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7111, + "Name": "冰魄披肩", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "expdr": 0.12, + "excdr": 0.15 + } + ] + } + ] + }, + "Others": { + "region": 4 + } + }, + "炉心丝绸": { + "Id": 12512, + "Name": "炉心丝绸", + "Description": "增加角色 18% 魔法抗性。", + "BackgroundStory": "岩浆鱿鱼吞噬老匠人那夜,他未完成的丝绸内甲突然绽放活体金纹。", + "ItemType": 2, + "WeaponType": 0, + "QualityType": 3, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7112, + "Name": "炉心丝绸", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "mdftype": 0, + "mdfvalue": 0.18 + } + ] + } + ] + }, + "Others": { + "region": 3 + } + }, + "液态月光嫁衣": { + "Id": 12513, + "Name": "液态月光嫁衣", + "Description": "增加角色 160 点物理护甲。", + "BackgroundStory": "礼成时衣袂每道流光都在虚空中绘制他消散的轮廓。", + "ItemType": 2, + "WeaponType": 0, + "QualityType": 3, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7113, + "Name": "液态月光嫁衣", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exdef": 160 + } + ] + } + ] + }, + "Others": { + "region": 1 + } + }, + "古树脐带": { + "Id": 12514, + "Name": "古树脐带", + "Description": "增加角色 120 点物理护甲和 10 点力量、敏捷、智力。", + "BackgroundStory": "精灵将濒死古龙封印进母树髓心,年轮间泌出的金色树脂,至今仍随龙息涨落闪烁。", + "ItemType": 2, + "WeaponType": 0, + "QualityType": 3, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7114, + "Name": "古树脐带", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exdef": 120, + "exstr": 10, + "exagi": 10, + "exint": 10 + } + ] + } + ] + }, + "Others": { + "region": 2 + } + }, + "千瞳悲影": { + "Id": 12515, + "Name": "千瞳悲影", + "Description": "增加角色 105 点物理护甲和 14% 魔法抗性。", + "BackgroundStory": "她为找回溺亡妹妹潜入倒影城,上岸时左眼变成湖水般的银瞳。", + "ItemType": 2, + "WeaponType": 0, + "QualityType": 3, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7115, + "Name": "千瞳悲影", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exdef": 105, + "mdftype": 0, + "mdfvalue": 0.14 + } + ] + } + ] + }, + "Others": { + "region": 6 + } + }, + "沙时襁褓": { + "Id": 12516, + "Name": "沙时襁褓", + "Description": "增加角色 16% 物理伤害减免。", + "BackgroundStory": "襁褓内衬编织着时间碎片,每当沙丘重组,表面浮起海市蜃楼般的昨日城虚影。", + "ItemType": 2, + "WeaponType": 0, + "QualityType": 3, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7116, + "Name": "沙时襁褓", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "expdr": 0.16 + } + ] + } + ] + }, + "Others": { + "region": 7 + } + }, + "星锚襞襟": { + "Id": 12517, + "Name": "星锚襞襟", + "Description": "增加角色 18% 物理伤害减免和 7 点每秒生命回复。", + "BackgroundStory": "老守望者纵身跃入星渊,黎明时他的亚麻领巾飘回塔楼,别针已化作微缩星锚。", + "ItemType": 2, + "WeaponType": 0, + "QualityType": 4, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7117, + "Name": "星锚襞襟", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "expdr": 0.18, + "exhr": 7 + } + ] + } + ] + }, + "Others": { + "region": 10 + } + }, + "母体菌毯": { + "Id": 12518, + "Name": "母体菌毯", + "Description": "增加角色 20% 魔法抗性和 7 点每秒魔法回复。", + "BackgroundStory": "她自愿被菌丝吞噬与母体对话,菌群却在她脊背织出春之草原——那是共生意识偷藏的纯粹梦境。", + "ItemType": 2, + "WeaponType": 0, + "QualityType": 4, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7118, + "Name": "母体菌毯", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "mdftype": 0, + "mdfvalue": 0.20, + "exmr": 7 + } + ] + } + ] + }, + "Others": { + "region": 9 + } + }, + "未寄信札": { + "Id": 12519, + "Name": "未寄信札", + "Description": "增加角色 135 点物理护甲和 8% 加速系数、8% 冷却缩减。", + "BackgroundStory": "『勿忘春野的第37次绽放』——烙在胸甲内侧的遗书,那些字迹随温度变化浮现。", + "ItemType": 2, + "WeaponType": 0, + "QualityType": 4, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7119, + "Name": "未寄信札", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exdef": 135, + "exacc": 0.08, + "excdr": 0.08 + } + ] + } + ] + }, + "Others": { + "region": 4 + } + }, + "遗留的绷带": { + "Id": 12520, + "Name": "遗留的绷带", + "Description": "增加角色 135 点物理护甲和 16% 魔法抗性。", + "BackgroundStory": "银辉城的老妪用液态月光缝合战争伤口,绷带末端的针还悬着半颗未绣完的彗星。", + "ItemType": 2, + "WeaponType": 0, + "QualityType": 4, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7120, + "Name": "遗留的绷带", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exdef": 135, + "mdftype": 0, + "mdfvalue": 0.16 + } + ] + } + ] + }, + "Others": { + "region": 1 + } + }, + "吟游诗者的肋骨": { + "Id": 12521, + "Name": "吟游诗者的肋骨", + "Description": "增加角色 200 点物理护甲。", + "BackgroundStory": "断口处仿佛标记着《幽灵船安魂曲》的休止符,仍能听到咸腥的海风呼啸。", + "ItemType": 2, + "WeaponType": 0, + "QualityType": 4, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7121, + "Name": "吟游诗者的肋骨", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exdef": 200 + } + ] + } + ] + }, + "Others": { + "region": 11 + } + }, + "精灵封月戒律": { + "Id": 12522, + "Name": "精灵封月戒律", + "Description": "增加角色 22% 魔法抗性。", + "BackgroundStory": "当月光流淌到第三根肋骨,冰晶铠甲会浮现古龙的咒文,那是林海在封印时刺入精灵掌心的遗书。", + "ItemType": 2, + "WeaponType": 0, + "QualityType": 4, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7122, + "Name": "精灵封月戒律", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "mdftype": 0, + "mdfvalue": 0.22 + } + ] + } + ] + }, + "Others": { + "region": 2 + } + }, + "时光的遗嘱": { + "Id": 12523, + "Name": "时光的遗嘱", + "Description": "增加角色 240 点物理护甲。", + "BackgroundStory": "冰晶裂帛织就的斗篷,衣摆封印着不同世纪的雪暴,当永霜裂痕哨塔时钟倒转,那些冻结在斗篷中的战士突然举起刀剑,将原主拉入某场未结束的战役。", + "ItemType": 2, + "WeaponType": 0, + "QualityType": 5, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7123, + "Name": "时光的遗嘱", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exdef": 240 + } + ] + } + ] + }, + "Others": { + "region": 4 + } + }, + "流沙时冕": { + "Id": 12524, + "Name": "流沙时冕", + "Description": "增加角色 26% 魔法抗性。", + "BackgroundStory": "第十万次沙丘重组后,甲缝里开出早已灭绝的时痕花——它用十二片花瓣重新定义了沙漠的晨昏。", + "ItemType": 2, + "WeaponType": 0, + "QualityType": 5, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7124, + "Name": "流沙时冕", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "mdftype": 0, + "mdfvalue": 0.26 + } + ] + } + ] + }, + "Others": { + "region": 7 + } + }, + "菌网摇篮": { + "Id": 12525, + "Name": "菌网摇篮", + "Description": "增加角色 165 点物理护甲和 20% 魔法抗性。", + "BackgroundStory": "翡翠色菌丝在银质臂甲上编织神经网络,剧毒孢子在肘关节处凝结成婴孩蜷睡的形态。当沼渊毒气弥漫时,菌婴会睁开星眸吹散迷雾。", + "ItemType": 2, + "WeaponType": 0, + "QualityType": 5, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7125, + "Name": "菌网摇篮", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exdef": 165, + "mdftype": 0, + "mdfvalue": 0.2 + } + ] + } + ] + }, + "Others": { + "region": 9 + } + }, + "骨桥挽歌": { + "Id": 12526, + "Name": "骨桥挽歌", + "Description": "增加角色 22% 物理伤害减免和 15 点力量、敏捷、智力。", + "BackgroundStory": "当虚空磷火漫过桥柱时,胸甲上的晶化石英中突然浮现出八百年前鲸落前的声纹,那正是幽灵船撞碎在骸骨桥墩前,水手们合唱的最后一节《归港祷词》。", + "ItemType": 2, + "WeaponType": 0, + "QualityType": 5, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7126, + "Name": "骨桥挽歌", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "expdr": 0.22, + "exstr": 15, + "exagi": 15, + "exint": 15 + } + ] + } + ] + }, + "Others": { + "region": 11 + } + }, + "泰坦谬论": { + "Id": 12527, + "Name": "泰坦谬论", + "Description": "增加角色 24% 魔法抗性和 15% 生命偷取。", + "BackgroundStory": "额前悬浮的暗铜罗盘持续解离现实,视线所及之处建筑边缘流淌着错误代码。月圆之夜头盔开裂,泄露出泰坦调试世界时废弃的创世草案。", + "ItemType": 2, + "WeaponType": 0, + "QualityType": 5, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7127, + "Name": "泰坦谬论", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "mdftype": 0, + "mdfvalue": 0.24, + "exls": 0.15 + } + ] + } + ] + }, + "Others": { + "region": 12 + } + }, + "棱镜安魂曲": { + "Id": 12528, + "Name": "棱镜安魂曲", + "Description": "增加角色 180 点物理护甲和 15% 生命偷取。", + "BackgroundStory": "晶簇里冰封着最后一声狼嚎,穿甲者从此在雾中行走时,步步踏碎永夜的休止符。", + "ItemType": 2, + "WeaponType": 0, + "QualityType": 5, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7128, + "Name": "棱镜安魂曲", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exdef": 180, + "exls": 0.15 + } + ] + } + ] + }, + "Others": { + "region": 11 + } + }, + "帆布鞋": { + "Id": 13501, + "Name": "帆布鞋", + "Description": "增加角色 40 点行动速度。", + "BackgroundStory": "一如年少模样。", + "ItemType": 3, + "WeaponType": 0, + "QualityType": 0, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7201, + "Name": "帆布鞋", + "SkillType": 3, + "Effects": [ + { + "Id": 8009, + "exspd": 40 + } + ] + } + ] + } + }, + "疾风靴": { + "Id": 13502, + "Name": "疾风靴", + "Description": "增加角色 80 点行动速度。", + "BackgroundStory": "这双靴子由风元素加持,步伐轻盈如风。", + "ItemType": 3, + "WeaponType": 0, + "QualityType": 1, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7202, + "Name": "疾风靴", + "SkillType": 3, + "Effects": [ + { + "Id": 8009, + "exspd": 80 + } + ] + } + ] + } + }, + "轻灵之鞋": { + "Id": 13503, + "Name": "轻灵之鞋", + "Description": "增加角色 60 点行动速度和 10% 闪避率。", + "BackgroundStory": "传说这双鞋能让穿戴者的步伐鬼魅般飘忽不定。", + "ItemType": 3, + "WeaponType": 0, + "QualityType": 1, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7203, + "Name": "轻灵之步", + "SkillType": 3, + "Effects": [ + { + "Id": 8009, + "exspd": 60 + }, + { + "Id": 8016, + "exer": 0.1 + } + ] + } + ] + } + }, + "雷电靴": { + "Id": 13504, + "Name": "雷电靴", + "Description": "增加角色 60 点行动速度和 10% 冷却缩减。", + "BackgroundStory": "这双靴子蕴含雷电之力,使穿戴者快速出击。", + "ItemType": 3, + "WeaponType": 0, + "QualityType": 1, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7204, + "Name": "雷霆之速", + "SkillType": 3, + "Effects": [ + { + "Id": 8009, + "exspd": 60 + }, + { + "Id": 8011, + "excdr": 0.1 + } + ] + } + ] + } + }, + "暗影之靴": { + "Id": 13505, + "Name": "暗影之靴", + "Description": "增加角色 45 点行动速度和 8% 暴击率。", + "BackgroundStory": "这双鞋在黑暗中隐藏,赋予穿戴者暗影的力量。", + "ItemType": 3, + "WeaponType": 0, + "QualityType": 1, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7205, + "Name": "暗影疾行", + "SkillType": 3, + "Effects": [ + { + "Id": 8009, + "exspd": 45 + }, + { + "Id": 8014, + "excr": 0.08 + } + ] + } + ] + } + }, + "月轨巡游靴": { + "Id": 13506, + "Name": "月轨巡游靴", + "Description": "增加角色 90 点行动速度和 20% 智力。在战棋地图中增加 1 格移动距离。", + "BackgroundStory": "鞋跟镶嵌悖论引擎残片,踏过建筑时荡漾开环形光漪。", + "ItemType": 3, + "WeaponType": 0, + "QualityType": 2, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7206, + "Name": "月轨巡游靴", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exspd": 90, + "exmov": 1, + "exint2": 0.2 + } + ] + } + ] + }, + "Others": { + "region": 1 + } + }, + "冬眠牧歌之踵": { + "Id": 13507, + "Name": "冬眠牧歌之踵", + "Description": "增加角色 75 点行动速度和 16% 暴击伤害。在战棋地图中增加 1 格移动距离。", + "BackgroundStory": "冰晶蹄铁包裹精灵封印苔藓,足迹蔓延霜花组成的五线谱。", + "ItemType": 3, + "WeaponType": 0, + "QualityType": 2, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7207, + "Name": "冬眠牧歌之踵", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exspd": 75, + "exmov": 1, + "excrd": 0.16 + } + ] + } + ] + }, + "Others": { + "region": 2 + } + }, + "星锚咏叹滑轮": { + "Id": 13508, + "Name": "星锚咏叹滑轮", + "Description": "增加角色 90 点行动速度和 10% 加速系数。在战棋地图中增加 1 格移动距离。", + "BackgroundStory": "苍穹碎屿星骸熔铸的汞银滚轮,滑行轨迹牵引彗尾般的光尘。", + "ItemType": 3, + "WeaponType": 0, + "QualityType": 2, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7208, + "Name": "星锚咏叹滑轮", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exspd": 90, + "exmov": 1, + "exacc": 0.1 + } + ] + } + ] + }, + "Others": { + "region": 10 + } + }, + "律动共鸣屐": { + "Id": 13509, + "Name": "律动共鸣屐", + "Description": "增加角色 90 点行动速度和 8 点每秒生命回复。在战棋地图中增加 1 格移动距离。", + "BackgroundStory": "悲鸣矿脉宝石雕琢的音叉鞋扣,敌人哀嚎转化为疗愈共鸣波。", + "ItemType": 3, + "WeaponType": 0, + "QualityType": 2, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7209, + "Name": "律动共鸣屐", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exspd": 90, + "exmov": 1, + "exhr": 8 + } + ] + } + ] + }, + "Others": { + "region": 12 + } + }, + "永劫圆舞靴": { + "Id": 13510, + "Name": "永劫圆舞靴", + "Description": "增加角色 120 点行动速度。在战棋地图中增加 1 格移动距离。", + "BackgroundStory": "左履镶嵌永昼晨露右履凝结永夜月髓,旋转时激荡出时光缓冲的涟漪。", + "ItemType": 3, + "WeaponType": 0, + "QualityType": 2, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7210, + "Name": "永劫圆舞靴", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exspd": 120, + "exmov": 1 + } + ] + } + ] + }, + "Others": { + "region": 10 + } + }, + "昨日回响之履": { + "Id": 13511, + "Name": "昨日回响之履", + "Description": "增加角色 120 点行动速度和 15% 冷却缩减。在战棋地图中增加 1 格移动距离。", + "BackgroundStory": "流沙时计荒漠的寻宝者陷入昨日之城幻境前,将怀表埋进沙丘,往昔之城在脚踝处投影为指南的虚影。", + "ItemType": 3, + "WeaponType": 0, + "QualityType": 3, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7211, + "Name": "昨日回响之履", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exspd": 120, + "exmov": 1, + "excdr": 0.15 + } + ] + } + ] + }, + "Others": { + "region": 7 + } + }, + "悖论足铃": { + "Id": 13512, + "Name": "悖论足铃", + "Description": "增加角色 120 点行动速度和 8 点每秒魔法回复。在战棋地图中增加 1 格移动距离。", + "BackgroundStory": "银辉城舞姬踩着悖论引擎裂缝起舞时,液态月光浸染了银铃。", + "ItemType": 3, + "WeaponType": 0, + "QualityType": 3, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7212, + "Name": "悖论足铃", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exspd": 120, + "exmov": 1, + "exmr": 8 + } + ] + } + ] + }, + "Others": { + "region": 1 + } + }, + "彗尾巡礼": { + "Id": 13513, + "Name": "彗尾巡礼", + "Description": "增加角色 160 点行动速度。在战棋地图中增加 1 格移动距离。", + "BackgroundStory": "她盗取液态月光灌入高跟鞋,逃跑时洒落的银珠在建筑侧面凝固成阶梯,而整座城成为她的舞池。", + "ItemType": 3, + "WeaponType": 0, + "QualityType": 3, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7213, + "Name": "彗尾巡礼", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exspd": 160, + "exmov": 1 + } + ] + } + ] + }, + "Others": { + "region": 1 + } + }, + "冬韵回声": { + "Id": 13514, + "Name": "冬韵回声", + "Description": "增加角色 105 点行动速度和 15% 暴击率。在战棋地图中增加 1 格移动距离。", + "BackgroundStory": "春季融雪时分,冰晶跌落声恰是古龙梦中的呼噜节奏。", + "ItemType": 3, + "WeaponType": 0, + "QualityType": 3, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7214, + "Name": "冬韵回声", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exspd": 105, + "exmov": 1, + "excr": 0.15 + } + ] + } + ] + }, + "Others": { + "region": 2 + } + }, + "渊虹跃步": { + "Id": 13515, + "Name": "渊虹跃步", + "Description": "增加角色 120 点行动速度和 10% 魔法穿透。在战棋地图中增加 1 格移动距离。", + "BackgroundStory": "沉浸在迷幻的都市中漫步数小时后,才惊觉花蕊里沉睡着未渡之魂。", + "ItemType": 3, + "WeaponType": 0, + "QualityType": 3, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7215, + "Name": "渊虹跃步", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exspd": 120, + "exmov": 1, + "exmpt": 0.1 + } + ] + } + ] + }, + "Others": { + "region": 8 + } + }, + "悖论圆舞": { + "Id": 13516, + "Name": "悖论圆舞", + "Description": "增加角色 120 点行动速度和 15% 加速系数。在战棋地图中增加 1 格移动距离。", + "BackgroundStory": "观众说她的舞步撕裂现实,却不知缎鞋每次点地都在不同时空。", + "ItemType": 3, + "WeaponType": 0, + "QualityType": 3, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7216, + "Name": "悖论圆舞", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exspd": 120, + "exmov": 1, + "exacc": 0.15 + } + ] + } + ] + }, + "Others": { + "region": 1 + } + }, + "月光潮信": { + "Id": 13517, + "Name": "月光潮信", + "Description": "增加角色 150 点行动速度和 10% 魔法抗性。在战棋地图中增加 2 格移动距离。", + "BackgroundStory": "靴面流淌着鲸落蓝的磷火,每当踏上骸骨桥梁,鞋跟便敲击出管风琴般的低鸣。", + "ItemType": 3, + "WeaponType": 0, + "QualityType": 4, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7217, + "Name": "月光潮信", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exspd": 150, + "exmov": 2, + "mdftype": 0, + "mdfvalue": 0.1 + } + ] + } + ] + }, + "Others": { + "region": 11 + } + }, + "心跳图谱": { + "Id": 13518, + "Name": "心跳图谱", + "Description": "增加角色 200 点行动速度。在战棋地图中增加 2 格移动距离。", + "BackgroundStory": "被惊动的晶簇守卫不再攻击,反而跟随靴印的韵律跳起机械圆舞,矿道疼痛化为深紫色的探戈节奏。", + "ItemType": 3, + "WeaponType": 0, + "QualityType": 4, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7218, + "Name": "心跳图谱", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exspd": 200, + "exmov": 2 + } + ] + } + ] + }, + "Others": { + "region": 12 + } + }, + "凝霜邮路": { + "Id": 13519, + "Name": "凝霜邮路", + "Description": "增加角色 135 点行动速度和 30% 暴击伤害。在战棋地图中增加 2 格移动距离。", + "BackgroundStory": "鹿皮鞣制的靴筒沁出冷雾,踏过冰面时凝结出冰蔷薇驿站。", + "ItemType": 3, + "WeaponType": 0, + "QualityType": 4, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7219, + "Name": "凝霜邮路", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exspd": 135, + "exmov": 2, + "excrd": 0.3 + } + ] + } + ] + }, + "Others": { + "region": 4 + } + }, + "镜语者的倒影": { + "Id": 13520, + "Name": "镜语者的倒影", + "Description": "增加角色 150 点行动速度和 10 点力量、敏捷、智力。在战棋地图中增加 2 格移动距离。", + "BackgroundStory": "铎京光学实验室用湖底瞳孔门镀膜的探勘靴,靴底重力传感器在镜像城自动校准方位,踏错一步便触发全息警报。", + "ItemType": 3, + "WeaponType": 0, + "QualityType": 4, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7220, + "Name": "镜语者的倒影", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exspd": 150, + "exmov": 2, + "exstr": 10, + "exagi": 10, + "exint": 10 + } + ] + } + ] + }, + "Others": { + "region": 6 + } + }, + "影狼祭司的声纹": { + "Id": 13521, + "Name": "影狼祭司的声纹", + "Description": "增加角色 150 点行动速度和 20% 加速系数。在战棋地图中增加 2 格移动距离。", + "BackgroundStory": "以水晶为弦柱,以嚎叫为弓,可把整片红杉林调律成驱散雾气的巨型音叉。", + "ItemType": 3, + "WeaponType": 0, + "QualityType": 4, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7221, + "Name": "影狼祭司的声纹", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exspd": 155, + "exmov": 2, + "exacc": 0.20 + } + ] + } + ] + }, + "Others": { + "region": 11 + } + }, + "永恒婚礼": { + "Id": 13522, + "Name": "永恒婚礼", + "Description": "增加角色 240 点行动速度。在战棋地图中增加 3 格移动距离。", + "BackgroundStory": "当昼夜切换湮灭将至,鞋尖交织出婚戒状光轮,于时光断层中开辟出三秒的栖身花园。", + "ItemType": 3, + "WeaponType": 0, + "QualityType": 5, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7222, + "Name": "永恒婚礼", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exspd": 240, + "exmov": 3 + } + ] + } + ] + }, + "Others": { + "region": 10 + } + }, + "髓海轮迹": { + "Id": 13523, + "Name": "髓海轮迹", + "Description": "增加角色 180 点行动速度和 25% 加速系数。在战棋地图中增加 3 格移动距离。", + "BackgroundStory": "鲸椎骨雕琢的滚轮浸透骨髓冷光,碾过虚空时留下幽蓝冰痕。", + "ItemType": 3, + "WeaponType": 0, + "QualityType": 5, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7223, + "Name": "髓海轮迹", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exspd": 180, + "exmov": 3, + "exacc": 0.25 + } + ] + } + ] + }, + "Others": { + "region": 11 + } + }, + "裂痕里的哨兵": { + "Id": 13524, + "Name": "裂痕里的哨兵", + "Description": "增加角色 165 点行动速度和 22% 暴击率。在战棋地图中增加 3 格移动距离。", + "BackgroundStory": "鞋跟嵌着冻结的时霜药滴,步伐间甩出冰晶沙粒。若在时钟哨塔倒转时起舞,鞋尖将滋生半透明的时间肿瘤,瘤内封存着穿戴者昨日的身影。", + "ItemType": 3, + "WeaponType": 0, + "QualityType": 5, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7224, + "Name": "裂痕里的哨兵", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exspd": 165, + "exmov": 3, + "excr": 0.22 + } + ] + } + ] + }, + "Others": { + "region": 4 + } + }, + "谵妄探戈": { + "Id": 13525, + "Name": "谵妄探戈", + "Description": "增加角色 165 点行动速度和 44% 暴击伤害。在战棋地图中增加 3 格移动距离。", + "BackgroundStory": "鞋面流动着虹彩毒雾,每个鞋印都盛开致幻鸢尾。当思维寄生虫逼近,迷雾中伸出无数苍白手臂,牵引穿戴者跳出规避神经寄生的亡命舞步。", + "ItemType": 3, + "WeaponType": 0, + "QualityType": 5, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7225, + "Name": "谵妄探戈", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exspd": 165, + "exmov": 3, + "excrd": 0.44 + } + ] + } + ] + }, + "Others": { + "region": 8 + } + }, + "母体脐滑屐": { + "Id": 13526, + "Name": "母体脐滑屐", + "Description": "增加角色 180 点行动速度和 15 点力量、敏捷、智力。在战棋地图中增加 3 格移动距离。", + "BackgroundStory": "它教你在深渊行走如履襁褓,菌丝每一寸伸展都在复刻母体失落的胞宫记忆。", + "ItemType": 3, + "WeaponType": 0, + "QualityType": 5, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7226, + "Name": "母体脐滑屐", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exspd": 180, + "exmov": 3, + "exstr": 15, + "exagi": 15, + "exint": 15 + } + ] + } + ] + }, + "Others": { + "region": 9 + } + }, + "守护吊坠": { + "Id": 14501, + "Name": "守护吊坠", + "Description": "增加角色 4 点力量、敏捷、智力。", + "BackgroundStory": "带着一丝丝念想。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 0, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7301, + "Name": "守护吊坠", + "SkillType": 3, + "Effects": [ + { + "Id": 8003, + "exstr": 4 + }, + { + "Id": 8004, + "exagi": 4 + }, + { + "Id": 8005, + "exint": 4 + } + ] + } + ] + } + }, + "富贵头冠": { + "Id": 14502, + "Name": "富贵头冠", + "Description": "增加角色 90 点最大生命值和 50 点最大魔法值。", + "BackgroundStory": "辉煌华贵的头冠。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 0, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7302, + "Name": "守护吊坠", + "SkillType": 3, + "Effects": [ + { + "Id": 8012, + "exhp": 90 + }, + { + "Id": 8013, + "exmp": 50 + } + ] + } + ] + } + }, + "黄金挂坠": { + "Id": 14503, + "Name": "黄金挂坠", + "Description": "增加角色 300 点最大生命值。", + "BackgroundStory": "珍贵稀有的黄金挂件,象征财富与荣耀的护身符。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 1, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7303, + "Name": "守护吊坠", + "SkillType": 3, + "Effects": [ + { + "Id": 8012, + "exhp": 300 + } + ] + } + ] + } + }, + "辉煌光环": { + "Id": 14504, + "Name": "辉煌光环", + "Description": "增加角色 80 点最大魔法值和 3 点每秒魔法回复。", + "BackgroundStory": "流光溢彩的光环。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 1, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7304, + "Name": "辉煌光环", + "SkillType": 3, + "Effects": [ + { + "Id": 8013, + "exmp": 80 + }, + { + "Id": 8022, + "exmr": 3 + } + ] + } + ] + } + }, + "银质手环": { + "Id": 14505, + "Name": "银质手环", + "Description": "增加角色 8 点力量、敏捷、智力。", + "BackgroundStory": "素雅精致的银质手环。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 1, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7305, + "Name": "银质手环", + "SkillType": 3, + "Effects": [ + { + "Id": 8003, + "exstr": 8 + }, + { + "Id": 8004, + "exagi": 8 + }, + { + "Id": 8005, + "exint": 8 + } + ] + } + ] + } + }, + "星辉护符": { + "Id": 14506, + "Name": "星辉护符", + "Description": "增加角色 15 点智力和 12% 暴击伤害。", + "BackgroundStory": "护符上镶嵌着神秘的星辉宝石,传说能提升佩戴者的法术威力。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 2, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7306, + "Name": "星辉启示", + "SkillType": 3, + "Effects": [ + { + "Id": 8005, + "exint": 15 + }, + { + "Id": 8015, + "excrd": 0.12 + } + ] + } + ] + } + }, + "雷鸣之戒": { + "Id": 14507, + "Name": "雷鸣之戒", + "Description": "增加角色 12 点力量和 8% 暴击率。", + "BackgroundStory": "戒指中流淌着雷电的力量,增强佩戴者的战斗威力。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 2, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7307, + "Name": "雷电之力", + "SkillType": 3, + "Effects": [ + { + "Id": 8003, + "exstr": 12 + }, + { + "Id": 8014, + "excr": 0.08 + } + ] + } + ] + } + }, + "精灵之戒": { + "Id": 14508, + "Name": "精灵之戒", + "Description": "增加角色 12 点智力和 6 点每秒生命回复。", + "BackgroundStory": "这枚戒指由精灵制成,佩戴者能感受到充沛的生命力。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 2, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7308, + "Name": "法力复苏", + "SkillType": 3, + "Effects": [ + { + "Id": 8021, + "exhr": 6 + }, + { + "Id": 8005, + "exint": 12 + } + ] + } + ] + } + }, + "暗影项链": { + "Id": 14509, + "Name": "暗影项链", + "Description": "增加角色 15 点敏捷和 10% 冷却缩减。", + "BackgroundStory": "项链蕴含着黑暗的力量,让佩戴者更具敏捷性。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 2, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7309, + "Name": "黑暗敏捷", + "SkillType": 3, + "Effects": [ + { + "Id": 8004, + "exagi": 15 + }, + { + "Id": 8011, + "excdr": 0.1 + } + ] + } + ] + } + }, + "YukiのCalfSocks": { + "Id": 14510, + "Name": "YukiのCalfSocks", + "Description": "增加角色 10% 暴击率和 25% 暴击伤害。", + "BackgroundStory": "小雪的小腿袜,拥有神秘的力量,令人神往。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 3, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7310, + "Name": "YukiのCalfSocks", + "SkillType": 3, + "Effects": [ + { + "Id": 8014, + "excr": 0.1 + }, + { + "Id": 8015, + "excrd": 0.25 + } + ] + } + ] + } + }, + "雷欧尼的现代汉语字典": { + "Id": 14511, + "Name": "雷欧尼的现代汉语字典", + "Description": "增加角色 10% 攻击力和 40% 物理护甲。", + "BackgroundStory": "懂又不懂。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 3, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7311, + "Name": "雷欧尼的现代汉语字典", + "SkillType": 3, + "Effects": [ + { + "Id": 8024, + "exdef": 0.4 + }, + { + "Id": 8023, + "exatk": 0.10 + } + ] + } + ] + } + }, + "金刚石": { + "Id": 14512, + "Name": "金刚石", + "Description": "增加角色 10% 最大生命值。", + "BackgroundStory": "罕见宝石,蕴含不可动摇的坚韧之力。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 3, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7312, + "Name": "金刚石", + "SkillType": 3, + "Effects": [ + { + "Id": 8030, + "exhp": 0.10 + } + ] + } + ] + } + }, + "路人哥的cos服": { + "Id": 14513, + "Name": "路人哥的cos服", + "Description": "增加角色 15% 攻击力,增加角色 12% 魔法抗性,但是会减少 8% 物理伤害减免。", + "BackgroundStory": "一套神秘的服饰,据说穿上后会引发未知的力量变化。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 3, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7313, + "Name": "路人哥的cos服", + "SkillType": 3, + "Effects": [ + { + "Id": 8023, + "exatk": 0.15 + }, + { + "Id": 8020, + "mdftype": 0, + "mdfvalue": 0.12 + }, + { + "Id": 8019, + "expdr": -0.08 + } + ] + } + ] + } + }, + "白月光的玉佩": { + "Id": 14514, + "Name": "白月光的玉佩", + "Description": "增加角色 10% 魔法抗性,4 点每秒魔法回复和 5% 冷却缩减。", + "BackgroundStory": "据说每个总裁都有一个救命恩人,还有一个冒充救命恩人的人。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 3, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7314, + "Name": "白月光的玉佩", + "SkillType": 3, + "Effects": [ + { + "Id": 8020, + "mdftype": 0, + "mdfvalue": 0.10 + }, + { + "Id": 8022, + "exmr": 4 + }, + { + "Id": 8011, + "excdr": 0.05 + } + ] + } + ] + } + }, + "YukiのCalfSocks-圣诞限定": { + "Id": 14515, + "Name": "YukiのCalfSocks-圣诞限定", + "Description": "增加角色 40% 暴击伤害。", + "BackgroundStory": "小雪的圣诞限定小腿袜,结合了圣诞树的红绿色,还有铃铛和鹿角的装饰。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 3, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7315, + "Name": "YukiのCalfSocks-圣诞限定", + "SkillType": 3, + "Effects": [ + { + "Id": 8015, + "excrd": 0.4 + } + ] + } + ] + } + }, + "星穹智核": { + "Id": 14516, + "Name": "星穹智核", + "Description": "增加角色 25% 智力和 10% 冷却缩减。", + "BackgroundStory": "银辉城核心「悖论引擎」的微型碎片,在星辰的辉光下被锻造成型,仿佛将整个星穹的智慧凝于一点。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 3, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7316, + "Name": "星穹智核", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exint2": 0.25, + "excdr": 0.1 + } + ] + } + ] + }, + "Others": { + "region": 1 + } + }, + "林海律动之心": { + "Id": 14517, + "Name": "林海律动之心", + "Description": "增加角色 5% 最大生命值和 10 点每秒生命回复。", + "BackgroundStory": "瑟兰薇歌林海深处,古老树木的生命精华与旋律古龙的低语交织,凝结成这颗荧蓝色的晶体。它跳动着森林的原始脉搏,每一次律动都为佩戴者注入源源不断的生机,使其与大地的根脉相连,坚不可摧。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 3, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7317, + "Name": "林海律动之心", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exhp2": 0.05, + "exhr": 10 + } + ] + } + ] + }, + "Others": { + "region": 2 + } + }, + "时空裂痕之眼": { + "Id": 14518, + "Name": "时空裂痕之眼", + "Description": "增加角色 12% 物理穿透和 8% 魔法穿透。", + "BackgroundStory": "永霜裂痕中,由无数冰封的战争残影与扭曲的时空碎片凝聚而成。佩戴者能从中窥见时间的缝隙,预判命运的轨迹,仿佛拥有了时空扭曲者的部分洞察力,让敌人在眼前化为虚无。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 3, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7318, + "Name": "时空裂痕之眼", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exppt": 0.12, + "exmpt": 0.08 + } + ] + } + ] + }, + "Others": { + "region": 4 + } + }, + "炽心熔炉": { + "Id": 14519, + "Name": "炽心熔炉", + "Description": "增加角色 25% 敏捷和 10% 加速系数。", + "BackgroundStory": "永燃坩埚的核心,由最纯粹的深渊火钻与活体金属苔藓在岩浆的洗礼下铸就。它燃烧着不灭的锻造之火,将佩戴者的意志与熔岩巨兽的蛮力融为一体,每一次挥击都带着足以融化钢铁的炽热威能。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 3, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7319, + "Name": "炽心熔炉", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exagi2": 0.25, + "exacc": 0.1 + } + ] + } + ] + }, + "Others": { + "region": 3 + } + }, + "畸变利刃": { + "Id": 14520, + "Name": "畸变利刃", + "Description": "增加角色 25% 力量和 5% 生命偷取。", + "BackgroundStory": "齿与血回廊的残酷产物,由被强制改造的闯入者最坚韧的骨骼与活体魔力血浸染而成。它不再是单纯的骨骼,而是承载着无尽痛苦与扭曲意志的锋刃。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 3, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7320, + "Name": "畸变利刃", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exstr2": 0.25, + "exls": 0.05 + } + ] + } + ] + }, + "Others": { + "region": 5 + } + }, + "虚空行者的残章": { + "Id": 14521, + "Name": "虚空行者的残章", + "Description": "增加角色 18% 智力,减少所有主动技能 2 秒硬直时间,但会减少 30% 物理护甲。", + "BackgroundStory": "一本失落的古老游记残篇,据传由一位曾漫游于虚空边缘的学者所著。它曾被遗弃在千瞳镜湖的深处,后被骨桥深渊的幽灵船队偶然拾起。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 3, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7321, + "Name": "虚空行者的残章", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exint2": 0.18, + "shtr": 2, + "exdef2": -0.3 + } + ] + } + ] + }, + "Others": { + "region": 11 + } + }, + "永燃之心": { + "Id": 14522, + "Name": "永燃之心", + "Description": "增加角色 20% 攻击力和 20% 暴击伤害,但是会减少 10% 魔法抗性。", + "BackgroundStory": "在永燃坩埚的深处,熔岩之王的心脏在无尽的火焰中锤炼而成。据说其诞生之初,赫菲斯托斯之喉的火山都为之颤抖,喷涌出前所未有的深渊火钻。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 3, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7322, + "Name": "永燃之心", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exatk2": 0.20, + "excrd": 0.20, + "mdftype": 0, + "mdfvalue": -0.1 + } + ] + } + ] + }, + "Others": { + "region": 3 + } + }, + "时之沙漏": { + "Id": 14523, + "Name": "时之沙漏", + "Description": "增加角色 80 点行动速度和 10% 冷却缩减、10% 加速系数,减少 10% 普通攻击和主动技能的硬直时间;但是会减少 10% 闪避率和 5% 物理伤害减免、5% 魔法抗性。", + "BackgroundStory": "曾有记载一位时空扭曲者手持此物,在时间洪流中穿梭自如。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 3, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7323, + "Name": "时之沙漏", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exspd": 80, + "excdr": 0.1, + "exacc": 0.1, + "nahtr2": 0.1, + "shtr2": 0.1, + "exer": -0.1, + "expdr": -0.05, + "mdftype": 0, + "mdfvalue": -0.05 + } + ] + } + ] + }, + "Others": { + "region": 7 + } + }, + "苍穹之泪": { + "Id": 14524, + "Name": "苍穹之泪", + "Description": "增加角色 15% 最大魔法值,增加角色 10% 魔法穿透,但是会增加所有主动技能 2 秒硬直时间。", + "BackgroundStory": "这滴泪水曾坠入穹顶之泪湖,引发了星辉水母群的重力法则异变。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 3, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7324, + "Name": "苍穹之泪", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exmp2": 0.15, + "exmpt": 0.10, + "shtr": -2 + } + ] + } + ] + }, + "Others": { + "region": 1 + } + }, + "悲鸣矿核": { + "Id": 14525, + "Name": "悲鸣矿核", + "Description": "增加角色 20% 物理穿透和 10% 生命偷取,但是会减少 10% 攻击力和 10% 最大生命值。", + "BackgroundStory": "悲鸣矿脉深处,由无数神经宝石与矿脉神经纤维交织而成的核心。曾有传闻,齿与血回廊的造物车间曾试图将其改造,但最终以失败告终,只因其内部的悲鸣之力过于强大。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 3, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7325, + "Name": "悲鸣矿核", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exppt": 0.20, + "exls": 0.1, + "exatk2": -0.1, + "exhp2": -0.1 + } + ] + } + ] + }, + "Others": { + "region": 12 + } + }, + "泰坦回响之核": { + "Id": 14526, + "Name": "泰坦回响之核", + "Description": "增加角色 22 点力量、敏捷、智力。", + "BackgroundStory": "在雷霆王座山脉的裁决尖碑下发现的古老核心,其中封印着泰坦巨神在创世之初留下的回响。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 4, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7326, + "Name": "泰坦回响之核", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exstr": 22, + "exagi": 22, + "exint": 22 + } + ] + } + ] + }, + "Others": { + "region": 12 + } + }, + "虚空低语之石": { + "Id": 14527, + "Name": "虚空低语之石", + "Description": "增加角色 25% 生命偷取,增加角色 25% 攻击力,但是会减少 10% 最大魔法值和 10% 闪避率。", + "BackgroundStory": "一块从骨桥深渊中被无尽虚空能量侵蚀的诡异奇石。它无声地发出诱惑的低语,散发着吞噬一切的原始欲望。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 4, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7327, + "Name": "虚空低语之石", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exls": 0.25, + "exatk2": 0.25, + "exmp2": -0.1, + "exer": -0.1 + } + ] + } + ] + }, + "Others": { + "region": 11 + } + }, + "视界切片": { + "Id": 14528, + "Name": "视界切片", + "Description": "增加角色 20% 物理穿透和 10% 魔法穿透。", + "BackgroundStory": "封存着镜湖守卫眼球的棱柱水晶,每只瞳孔倒映不同时空的溺毙者。当两片水晶夹角呈 53 度时,会投射出正在下沉的观测者自身。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 4, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7328, + "Name": "视界切片", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exppt": 0.2, + "exmpt": 0.1 + } + ] + } + ] + }, + "Others": { + "region": 6 + } + }, + "谵妄纪事": { + "Id": 14529, + "Name": "谵妄纪事", + "Description": "增加角色 65% 暴击伤害,但是会减少 10% 最大生命值。", + "BackgroundStory": "装订工洛伦佐用自身褪下的脑膜与可食用梦境碎片压制成的册页,翻开时将浮现他书写的 365 种死法。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 4, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7329, + "Name": "谵妄纪事", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "excrd": 0.65, + "exhp2": -0.1 + } + ] + } + ] + }, + "Others": { + "region": 8 + } + }, + "熔钢挽歌轴承": { + "Id": 14530, + "Name": "熔钢挽歌轴承", + "Description": "增加角色 30% 物理穿透和 10% 攻击力。", + "BackgroundStory": "荒野游牧民将其安装在祭坛转经轮上,转动后,方圆十里的沙粒齿轮突然同时裂解成粉尘。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 4, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7330, + "Name": "熔钢挽歌轴承", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exppt": 0.3, + "exatk2": 0.1 + } + ] + } + ] + }, + "Others": { + "region": 5 + } + }, + "时渊漂流瓶": { + "Id": 14531, + "Name": "时渊漂流瓶", + "Description": "增加角色 100 点行动速度和 10% 最大魔法值、10% 魔法穿透。", + "BackgroundStory": "倒悬教堂尖顶采集的重力露珠,包裹着平行时空的星光碎屑。清洁工报告碎片中渗出咸涩液体,成分与镜湖水完全一致。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 4, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7331, + "Name": "时渊漂流瓶", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exspd": 100, + "exmp2": 0.1, + "exmpt": 0.1 + } + ] + } + ] + }, + "Others": { + "region": 6 + } + }, + "幻疡腺体吊坠": { + "Id": 14532, + "Name": "幻疡腺体吊坠", + "Description": "增加角色 35% 智力。", + "BackgroundStory": "寄生在梦魇之主神经节上的发光囊肿,被商队剥离后仍随现实光线涨缩。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 4, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7332, + "Name": "幻疡腺体吊坠", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exint2": 0.35 + } + ] + } + ] + }, + "Others": { + "region": 8 + } + }, + "萤瘘共生囊": { + "Id": 14533, + "Name": "萤瘘共生囊", + "Description": "增加角色 15% 最大生命值和 20% 生命偷取。", + "BackgroundStory": "剥取自朝圣者与荧光毒气共生形成的皮下肿瘤,浸泡在母体脑脊液中保存。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 4, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7333, + "Name": "萤瘘共生囊", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exhp2": 0.15, + "exls": 0.2 + } + ] + } + ] + }, + "Others": { + "region": 9 + } + }, + "梦魇织心": { + "Id": 14534, + "Name": "梦魇织心", + "Description": "增加角色 15% 暴击率和 15% 魔法穿透。", + "BackgroundStory": "每一次跳动都牵引着无形的梦境丝线,将现实与虚幻的边界模糊,引人进入无尽的幻象。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 4, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7334, + "Name": "梦魇织心", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "excr": 0.15, + "exmpt": 0.15 + } + ] + } + ] + }, + "Others": { + "region": 8 + } + }, + "残魂之核": { + "Id": 14535, + "Name": "残魂之核", + "Description": "增加角色 30% 智力和 10 点每秒魔法回复。", + "BackgroundStory": "其内部的齿轮仿佛永不停歇地转动,低语着机械文明的辉煌与陨落,每一次律动都牵引着液态魔力。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 4, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7335, + "Name": "残魂之核", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exint2": 0.3, + "exmr": 10 + } + ] + } + ] + }, + "Others": { + "region": 5 + } + }, + "熔铸之喉": { + "Id": 14536, + "Name": "熔铸之喉", + "Description": "增加角色 30% 力量和 10% 攻击力。", + "BackgroundStory": "当火山刮起硫磺风,化石孔隙会发出赫菲斯托斯之喉锻造车间的打铁声,声波使接触到的活体金属苔藓疯狂增殖。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 4, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7336, + "Name": "熔铸之喉", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exstr2": 0.3, + "exatk2": 0.1 + } + ] + } + ] + }, + "Others": { + "region": 3 + } + }, + "圣树年轮": { + "Id": 14537, + "Name": "圣树年轮", + "Description": "增加角色 15% 最大生命值和 10% 魔法抗性。", + "BackgroundStory": "圣树第十三层城市大火后,某节烧焦枝干断面上显露出三千道金色年轮。每轮刻有不同时期的古龙旋律片段,指尖划过会激活对应年代的生态投影。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 4, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7337, + "Name": "圣树年轮", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exhp2": 0.15, + "mdftype": 0, + "mdfvalue": 0.1 + } + ] + } + ] + }, + "Others": { + "region": 2 + } + }, + "湮灭婚契书": { + "Id": 14538, + "Name": "湮灭婚契书", + "Description": "增加角色 30% 敏捷和 10% 冷却缩减。", + "BackgroundStory": "永劫婚契武器锻造场的废稿,被光鹰衔至昼夜交界处。羊皮纸上未完成的誓词吸收月光化为金箔纹,吞噬暗影凝成血咒文。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 4, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7338, + "Name": "湮灭婚契书", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exagi2": 0.3, + "excdr": 0.1 + } + ] + } + ] + }, + "Others": { + "region": 10 + } + }, + "时霜假肢": { + "Id": 14539, + "Name": "时霜假肢", + "Description": "增加角色 12 点每秒生命回复和 15% 生命偷取。", + "BackgroundStory": "时钟加速时,假肢膝关节渗出鲜血染红冰层——鲜血汇成的溪流尽头,总坐着正在给自己接骨的年轻将军幻影。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 4, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7339, + "Name": "时霜假肢", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exhr": 12, + "exls": 0.15 + } + ] + } + ] + }, + "Others": { + "region": 4 + } + }, + "鱿熔创生碑": { + "Id": 14540, + "Name": "鱿熔创生碑", + "Description": "增加角色 25% 物理穿透和 10% 生命偷取。", + "BackgroundStory": "岩浆鱿鱼群聚自杀的矿坑底部,活体金属苔藓吞噬鱿鱼眼球后疯狂生长。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 4, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7340, + "Name": "鱿熔创生碑", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exppt": 0.25, + "exls": 0.1 + } + ] + } + ] + }, + "Others": { + "region": 3 + } + }, + "影狼喉骨钟": { + "Id": 14541, + "Name": "影狼喉骨钟", + "Description": "增加角色 20% 冷却缩减和 10% 魔法穿透。", + "BackgroundStory": "狼嚎声波在骨腔内结晶为计时沙,每当幽灵船驶过桥下,沙粒便倾泻奏响亡者安魂曲。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 4, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7341, + "Name": "影狼喉骨钟", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "excdr": 0.2, + "exmpt": 0.1 + } + ] + } + ] + }, + "Others": { + "region": 11 + } + }, + "创世胚胎": { + "Id": 14542, + "Name": "创世胚胎", + "Description": "增加角色 30 点力量、敏捷、智力。", + "BackgroundStory": "雷霆泰坦封印在裁决尖碑底部的金属子宫。胚胎啃食神经宝石时发出的哀嚎,使悬浮岩迷宫重组为接生器械阵列。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 5, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7342, + "Name": "创世胚胎", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exstr": 30, + "exagi": 30, + "exint": 30 + } + ] + } + ] + }, + "Others": { + "region": 12 + } + }, + "菌脑星环": { + "Id": 14543, + "Name": "菌脑星环", + "Description": "增加角色 35% 力量和 15% 魔法抗性。", + "BackgroundStory": "共生母体脑沟深处滋生的环状菌核。菌环每七十二小时脱落一枚子核,子核坠入毒沼即模仿光鹰求偶频闪。直至银辉城下起荧光之雨。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 5, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7343, + "Name": "菌脑星环", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exstr2": 0.35, + "mdftype": 0, + "mdfvalue": 0.15 + } + ] + } + ] + }, + "Others": { + "region": 9 + } + }, + "梦魇珊瑚石": { + "Id": 14545, + "Name": "梦魇珊瑚石", + "Description": "增加角色 15% 暴击率和 35% 暴击伤害。", + "BackgroundStory": "巢眼持续喷吐思维寄生虫幼虫,幼虫钻入市民耳蜗分泌认知粘液。粘液硬化后形成的琉璃蛹悬挂街头,每个蛹内都冻结着交易者最恐惧的清醒瞬间。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 5, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7345, + "Name": "梦魇珊瑚石", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "excr": 0.15, + "excrd": 0.35 + } + ] + } + ] + }, + "Others": { + "region": 8 + } + }, + "君王朝露皿": { + "Id": 14546, + "Name": "君王朝露皿", + "Description": "增加角色 125 点行动速度和 20% 加速系数。", + "BackgroundStory": "时间吞噬者咬断时之君王脊椎时,髓液喷溅在时漏仙人掌上凝结的露皿。皿中沙粒每小时重组为微型昨日之城,城内居民皆是流沙蝎演化的历史幻影。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 5, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7346, + "Name": "君王朝露皿", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exspd": 125, + "exacc": 0.2 + } + ] + } + ] + }, + "Others": { + "region": 7 + } + }, + "千瞳同调": { + "Id": 14547, + "Name": "千瞳同调", + "Description": "增加角色 30% 物理穿透和 15% 魔法穿透。", + "BackgroundStory": "镜像之主剜出湖底千枚瞳孔门镶嵌在头骨内壁,头颅悬浮于湖心形成活体罗盘。每颗瞳孔仍持续接收平行时空的信号,当湖面出现相同频率的引力波纹,头骨便吐出对应时空的重力参数。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 5, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7347, + "Name": "千瞳同调", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exppt": 0.3, + "exmpt": 0.15 + } + ] + } + ] + }, + "Others": { + "region": 6 + } + }, + "忏悔圣经": { + "Id": 14548, + "Name": "忏悔圣经", + "Description": "增加角色 35% 智力和 12 点每秒魔法回复。", + "BackgroundStory": "报废巨龙咬断自己脊椎抛向沙海,液态魔力血浸染椎骨形成书页。书页记载被改造者临终忏悔,活体建筑群将窗户化作活字镶嵌书脊。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 5, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7348, + "Name": "忏悔圣经", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exint2": 0.35, + "exmr": 12 + } + ] + } + ] + }, + "Others": { + "region": 5 + } + }, + "时骸怀表": { + "Id": 14549, + "Name": "时骸怀表", + "Description": "增加角色 20% 魔法穿透和 20% 加速系数。", + "BackgroundStory": "扭曲者冻结自己心脏铸成表壳,冰霜傀儡拆下肋骨打磨为表针。怀表齿轮由压缩的战争残影浇注,发条乃时霜药剂结晶。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 5, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7349, + "Name": "时骸怀表", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exmpt": 0.2, + "exacc": 0.2 + } + ] + } + ] + }, + "Others": { + "region": 4 + } + }, + "火钻圣碑": { + "Id": 14550, + "Name": "火钻圣碑", + "Description": "增加角色 25% 物理穿透和 25% 攻击力。", + "BackgroundStory": "熔岩巨兽撕下背鳞铺就祭坛,岩浆鱿鱼群衔来火钻镶嵌鳞隙。当矿工第万次锤击引发火山共鸣,祭坛突然直立为碑。碑文由活体金属苔藓拼写:凡触碰者皆化为新火种。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 5, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7350, + "Name": "火钻圣碑", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exppt": 0.25, + "exatk2": 0.25 + } + ] + } + ] + }, + "Others": { + "region": 3 + } + }, + "绝唱留声机": { + "Id": 14551, + "Name": "绝唱留声机", + "Description": "增加角色 60% 暴击伤害。", + "BackgroundStory": "封印旋律古龙的法阵中心,脉轮圣树分泌的蜜蜡裹住精灵长老的咽喉。七百年间树脂持续记录森林声景,可编程蜜蜡在树脂表面蚀刻出音纹沟壑。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 5, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7351, + "Name": "绝唱留声机", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "excrd": 0.6 + } + ] + } + ] + }, + "Others": { + "region": 2 + } + }, + "悖论胎衣": { + "Id": 14552, + "Name": "悖论胎衣", + "Description": "增加角色 20% 最大生命值和 80% 物理护甲。", + "BackgroundStory": "当星辉巨母吞噬过量液态月光,其甲壳裂缝渗出银白色羊水,在悖论引擎辐射下凝固成茧。三昼夜后茧内传出金属摩擦的心跳声,星银守卫集体融化渗入茧壁,整座城市随之收缩为跳动子宫。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 5, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7352, + "Name": "悖论胎衣", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exhp2": 0.2, + "exdef2": 0.8 + } + ] + } + ] + }, + "Others": { + "region": 1 + } + }, + "星锚脐轮": { + "Id": 14553, + "Name": "星锚脐轮", + "Description": "增加角色 35% 敏捷和 16% 加速系数。", + "BackgroundStory": "巨兽扯断束缚锁链时,断裂的星锚晶石嵌入守护者胸腔。晶石在血肉中重组成罗盘,永昼侧转针由光鹰翎羽熔铸,永夜侧配重是影玫瑰的压缩锭。", + "ItemType": 4, + "WeaponType": 0, + "QualityType": 5, + "Skills": { + "Active": null, + "Passives": [ + { + "Id": 7353, + "Name": "星锚脐轮", + "SkillType": 3, + "Effects": [ + { + "Id": 8032, + "exagi2": 0.35, + "exacc": 0.16 + } + ] + } + ] + }, + "Others": { + "region": 10 + } + } +} diff --git a/OshimaBot.Game/Constants/OshimaGameModuleConstant.cs b/OshimaBot.Game/Constants/OshimaGameModuleConstant.cs new file mode 100644 index 0000000..05abac0 --- /dev/null +++ b/OshimaBot.Game/Constants/OshimaGameModuleConstant.cs @@ -0,0 +1,19 @@ +namespace OshimaBot.Game.Constants +{ + public class OshimaGameModuleConstant + { + public const string General = "oshima-studios"; + public const string WebAPI = "oshima.fungame.webapi"; + public const string FastAuto = "oshima.fungame.fastauto"; + public const string Character = "oshima.fungame.characters"; + public const string Skill = "oshima.fungame.skills"; + public const string Item = "oshima.fungame.items"; + public const string Description = "Oshima Studios Presents"; + public const string Version = "1.0.0"; + public const string Author = "Oshima Studios"; + public const string FastAutoMap = "oshima.fungame.fastauto.map"; + public const string Anonymous = "oshima.fungame.anonymous"; + public const string AnonymousMap = "oshima.fungame.anonymous.map"; + public const string Server = "oshima.fungame.server"; + } +} diff --git a/OshimaBot.Game/Modules/CharacterModule.cs b/OshimaBot.Game/Modules/CharacterModule.cs new file mode 100644 index 0000000..9e89a48 --- /dev/null +++ b/OshimaBot.Game/Modules/CharacterModule.cs @@ -0,0 +1,62 @@ +using OshimaBot.Game.Constants; +using FunGame.Core.Api; +using FunGame.Core.Entity; +using OshimaBot.Content.Characters; +using CM = FunGame.Core.Library.Module.CharacterModule; + +namespace OshimaBot.Game.Modules +{ + public class CharacterModule : CM + { + public override string Name => OshimaGameModuleConstant.Character; + public override string Description => OshimaGameModuleConstant.Description; + public override string Version => OshimaGameModuleConstant.Version; + public override string Author => OshimaGameModuleConstant.Author; + public Dictionary KnownCharacters { get; } = []; + + public override Dictionary Characters + { + get + { + Dictionary characters = Factory.GetGameModuleInstances(OshimaGameModuleConstant.General, OshimaGameModuleConstant.Character); + if (KnownCharacters.Count == 0 && characters.Count > 0) + { + foreach (string key in characters.Keys) + { + KnownCharacters[key] = characters[key]; + } + } + return characters; + } + } + + protected override Factory.EntityFactoryDelegate CharacterFactory() + { + return (id, name, args) => + { + return id switch + { + 1 => new OshimaShiya(), + 2 => new XinYin(), + 3 => new Yang(), + 4 => new NanGanYu(), + 5 => new NiuNan(), + 6 => new DokyoMayor(), + 7 => new MagicalGirl(), + 8 => new QingXiang(), + 9 => new QWQAQW(), + 10 => new ColdBlue(), + 11 => new Dddovo(), + 12 => new Quduoduo(), + 13 => new ShiYu(), + 14 => new XReouni(), + 15 => new Neptune(), + 16 => new CHAOS(), + 17 => new Ryuko(), + 18 => new TheGodK(), + _ => null, + }; + }; + } + } +} diff --git a/OshimaBot.Game/Modules/ItemModule.cs b/OshimaBot.Game/Modules/ItemModule.cs new file mode 100644 index 0000000..6ecf060 --- /dev/null +++ b/OshimaBot.Game/Modules/ItemModule.cs @@ -0,0 +1,160 @@ +using OshimaBot.Game.Constants; +using FunGame.Core.Api; +using FunGame.Core.Entity; +using OshimaBot.Content.Items; +using IM = FunGame.Core.Library.Module.ItemModule; + +namespace OshimaBot.Game.Modules +{ + public class ItemModule : IM + { + public override string Name => OshimaGameModuleConstant.Item; + public override string Description => OshimaGameModuleConstant.Description; + public override string Version => OshimaGameModuleConstant.Version; + public override string Author => OshimaGameModuleConstant.Author; + public Dictionary KnownItems { get; } = []; + + public override Dictionary Items + { + get + { + Dictionary items = Factory.GetGameModuleInstances(OshimaGameModuleConstant.General, OshimaGameModuleConstant.Item); + if (KnownItems.Count == 0 && items.Count > 0) + { + foreach (string key in items.Keys) + { + KnownItems[key] = items[key]; + } + } + return items; + } + } + + protected override Factory.EntityFactoryDelegate ItemFactory() + { + return (id, name, args) => + { + return id switch + { + (long)WeaponID.糖糖一周年纪念武器 => new 糖糖一周年纪念武器(), + (long)ArmorID.糖糖一周年纪念防具 => new 糖糖一周年纪念防具(), + (long)ShoesID.糖糖一周年纪念鞋子 => new 糖糖一周年纪念鞋子(), + (long)AccessoryID.攻击之爪10 => new 攻击之爪10(), + (long)AccessoryID.攻击之爪25 => new 攻击之爪25(), + (long)AccessoryID.攻击之爪40 => new 攻击之爪40(), + (long)AccessoryID.攻击之爪55 => new 攻击之爪55(), + (long)AccessoryID.攻击之爪70 => new 攻击之爪70(), + (long)AccessoryID.攻击之爪85 => new 攻击之爪85(), + (long)AccessoryID.攻击之爪100 => new 攻击之爪100(), + (long)AccessoryID.糖糖一周年纪念饰品1 => new 糖糖一周年纪念饰品1(), + (long)AccessoryID.糖糖一周年纪念饰品2 => new 糖糖一周年纪念饰品2(), + (long)AccessoryID.行军医箱1 => new 行军医箱1(), + (long)AccessoryID.行军医箱2 => new 行军医箱2(), + (long)AccessoryID.行军医箱3 => new 行军医箱3(), + (long)AccessoryID.共鸣核心1 => new 共鸣核心1(), + (long)AccessoryID.共鸣核心2 => new 共鸣核心2(), + (long)AccessoryID.共鸣核心3 => new 共鸣核心3(), + (long)AccessoryID.接力信标1 => new 接力信标1(), + (long)AccessoryID.接力信标2 => new 接力信标2(), + (long)AccessoryID.接力信标3 => new 接力信标3(), + (long)AccessoryID.应急装置1 => new 应急装置1(), + (long)AccessoryID.应急装置2 => new 应急装置2(), + (long)AccessoryID.应急装置3 => new 应急装置3(), + (long)AccessoryID.万能钥匙1 => new 万能钥匙1(), + (long)AccessoryID.万能钥匙2 => new 万能钥匙2(), + (long)AccessoryID.万能钥匙3 => new 万能钥匙3(), + (long)AccessoryID.节拍器1 => new 节拍器1(), + (long)AccessoryID.节拍器2 => new 节拍器2(), + (long)AccessoryID.节拍器3 => new 节拍器3(), + (long)ConsumableID.小经验书 => new 小经验书(), + (long)ConsumableID.中经验书 => new 中经验书(), + (long)ConsumableID.大经验书 => new 大经验书(), + (long)CollectibleID.青松 => new 青松(), + (long)CollectibleID.流星石 => new 流星石(), + (long)CollectibleID.向日葵 => new 向日葵(), + (long)CollectibleID.金铃花 => new 金铃花(), + (long)CollectibleID.琉璃珠 => new 琉璃珠(), + (long)CollectibleID.鸣草 => new 鸣草(), + (long)CollectibleID.马尾 => new 马尾(), + (long)CollectibleID.鬼兜虫 => new 鬼兜虫(), + (long)CollectibleID.烈焰花花蕊 => new 烈焰花花蕊(), + (long)CollectibleID.堇瓜 => new 堇瓜(), + (long)CollectibleID.水晶球 => new 水晶球(), + (long)CollectibleID.薰衣草 => new 薰衣草(), + (long)CollectibleID.青石 => new 青石(), + (long)CollectibleID.莲花 => new 莲花(), + (long)CollectibleID.陶罐 => new 陶罐(), + (long)CollectibleID.海灵芝 => new 海灵芝(), + (long)CollectibleID.四叶草 => new 四叶草(), + (long)CollectibleID.露珠 => new 露珠(), + (long)CollectibleID.茉莉花 => new 茉莉花(), + (long)CollectibleID.绿萝 => new 绿萝(), + (long)CollectibleID.檀木扇 => new 檀木扇(), + (long)CollectibleID.鸟蛋 => new 鸟蛋(), + (long)CollectibleID.竹笋 => new 竹笋(), + (long)CollectibleID.晶核 => new 晶核(), + (long)CollectibleID.手工围巾 => new 手工围巾(), + (long)CollectibleID.柳条篮 => new 柳条篮(), + (long)CollectibleID.风筝 => new 风筝(), + (long)CollectibleID.羽毛 => new 羽毛(), + (long)CollectibleID.发光髓 => new 发光髓(), + (long)CollectibleID.紫罗兰 => new 紫罗兰(), + (long)CollectibleID.松果 => new 松果(), + (long)CollectibleID.电气水晶 => new 电气水晶(), + (long)CollectibleID.薄荷 => new 薄荷(), + (long)CollectibleID.竹节 => new 竹节(), + (long)CollectibleID.铁砧 => new 铁砧(), + (long)CollectibleID.冰雾花 => new 冰雾花(), + (long)CollectibleID.海草 => new 海草(), + (long)CollectibleID.磐石 => new 磐石(), + (long)CollectibleID.砂砾 => new 砂砾(), + (long)CollectibleID.铁甲贝壳 => new 铁甲贝壳(), + (long)CollectibleID.蜥蜴尾巴 => new 蜥蜴尾巴(), + (long)CollectibleID.古老钟摆 => new 古老钟摆(), + (long)CollectibleID.枯藤 => new 枯藤(), + (long)SpecialItemID.升华之印 => new 升华之印(), + (long)SpecialItemID.流光之印 => new 流光之印(), + (long)SpecialItemID.永恒之印 => new 永恒之印(), + (long)SpecialItemID.技能卷轴 => new 技能卷轴(), + (long)SpecialItemID.智慧之果 => new 智慧之果(), + (long)SpecialItemID.奥术符文 => new 奥术符文(), + (long)SpecialItemID.混沌之核 => new 混沌之核(), + (long)SpecialItemID.奖券 => new 奖券(), + (long)SpecialItemID.十连奖券 => new 十连奖券(), + (long)SpecialItemID.改名卡 => new 改名卡(), + (long)SpecialItemID.原初之印 => new 原初之印(), + (long)SpecialItemID.创生之印 => new 创生之印(), + (long)SpecialItemID.法则精粹 => new 法则精粹(), + (long)SpecialItemID.大师锻造券 => new 大师锻造券(), + (long)SpecialItemID.钻石 => new 钻石(), + (long)SpecialItemID.探索许可 => new 探索许可(), + (long)ConsumableID.小回复药 => new 小回复药(), + (long)ConsumableID.中回复药 => new 中回复药(), + (long)ConsumableID.大回复药 => new 大回复药(), + (long)ConsumableID.魔力填充剂1 => new 魔力填充剂1(), + (long)ConsumableID.魔力填充剂2 => new 魔力填充剂2(), + (long)ConsumableID.魔力填充剂3 => new 魔力填充剂3(), + (long)ConsumableID.能量饮料1 => new 能量饮料1(), + (long)ConsumableID.能量饮料2 => new 能量饮料2(), + (long)ConsumableID.能量饮料3 => new 能量饮料3(), + (long)ConsumableID.复苏药1 => new 复苏药1(), + (long)ConsumableID.复苏药2 => new 复苏药2(), + (long)ConsumableID.复苏药3 => new 复苏药3(), + (long)ConsumableID.全回复药 => new 全回复药(), + (long)GiftBoxID.年夜饭 => new 年夜饭(), + (long)GiftBoxID.蛇年大吉 => new 蛇年大吉(), + (long)GiftBoxID.新春快乐 => new 新春快乐(), + (long)GiftBoxID.毕业礼包 => new 毕业礼包(), + (long)GiftBoxID.魔法卡礼包 => new 魔法卡礼包(), + (long)GiftBoxID.探索助力礼包 => new 探索助力礼包(), + (long)GiftBoxID.一周年纪念礼包 => new 一周年纪念礼包(), + (long)GiftBoxID.一周年纪念套装 => new 一周年纪念套装(), + (long)GiftBoxID.冬至快乐 => new 冬至快乐(), + (long)GiftBoxID.圣诞礼包 => new 圣诞礼包(), + (long)GiftBoxID.元旦快乐 => new 元旦快乐(), + _ => null, + }; + }; + } + } +} diff --git a/OshimaBot.Game/Modules/SkillModule.cs b/OshimaBot.Game/Modules/SkillModule.cs new file mode 100644 index 0000000..3651212 --- /dev/null +++ b/OshimaBot.Game/Modules/SkillModule.cs @@ -0,0 +1,331 @@ +using OshimaBot.Game.Constants; +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using OshimaBot.Content.Effects.ItemEffects; +using OshimaBot.Content.Effects.OpenEffects; +using OshimaBot.Content.Items; +using OshimaBot.Content.Skills; +using SM = FunGame.Core.Library.Module.SkillModule; + +namespace OshimaBot.Game.Modules +{ + public class SkillModule : SM + { + public override string Name => OshimaGameModuleConstant.Skill; + public override string Description => OshimaGameModuleConstant.Description; + public override string Version => OshimaGameModuleConstant.Version; + public override string Author => OshimaGameModuleConstant.Author; + public Dictionary KnownSkills { get; } = []; + + public override Dictionary Skills + { + get + { + Dictionary skills = Factory.GetGameModuleInstances(OshimaGameModuleConstant.General, OshimaGameModuleConstant.Skill); + if (KnownSkills.Count == 0 && skills.Count > 0) + { + foreach (string key in skills.Keys) + { + KnownSkills[key] = skills[key]; + } + } + return skills; + } + } + + protected override void AfterLoad() + { + General.GameplayEquilibriumConstant.InGameTime = "秒"; + General.GameplayEquilibriumConstant.InGameMaterial = "钻石"; + General.GameplayEquilibriumConstant.UseMagicType = [MagicType.None]; + } + + protected override Factory.EntityFactoryDelegate SkillFactory() + { + return (id, name, args) => + { + return id switch + { + (long)MagicID.冰霜攻击 => new 冰霜攻击(), + (long)MagicID.火之矢 => new 火之矢(), + (long)MagicID.水之矢 => new 水之矢(), + (long)MagicID.石之锤 => new 石之锤(), + (long)MagicID.风之轮 => new 风之轮(), + (long)MagicID.心灵之霞 => new 心灵之霞(), + (long)MagicID.次元上升 => new 次元上升(), + (long)MagicID.暗物质 => new 暗物质(), + (long)MagicID.回复术 => new 回复术(), + (long)MagicID.治愈术 => new 治愈术(), + (long)MagicID.复苏术 => new 复苏术(), + (long)MagicID.圣灵术 => new 圣灵术(), + (long)MagicID.时间加速 => new 时间加速(), + (long)MagicID.时间减速 => new 时间减速(), + (long)MagicID.反魔法领域 => new 反魔法领域(), + (long)MagicID.沉默十字 => new 沉默十字(), + (long)MagicID.虚弱领域 => new 虚弱领域(), + (long)MagicID.混沌烙印 => new 混沌烙印(), + (long)MagicID.凝胶稠絮 => new 凝胶稠絮(), + (long)MagicID.大地之墙 => new 大地之墙(), + (long)MagicID.盖亚之盾 => new 盖亚之盾(), + (long)MagicID.风之守护 => new 风之守护(), + (long)MagicID.结晶防护 => new 结晶防护(), + (long)MagicID.强音之力 => new 强音之力(), + (long)MagicID.神圣祝福 => new 神圣祝福(), + (long)MagicID.根源屏障 => new 根源屏障(), + (long)MagicID.灾难冲击波 => new 灾难冲击波(), + (long)MagicID.银色荆棘 => new 银色荆棘(), + (long)MagicID.等离子之波 => new 等离子之波(), + (long)MagicID.地狱之门 => new 地狱之门(), + (long)MagicID.钻石星尘 => new 钻石星尘(), + (long)MagicID.死亡咆哮 => new 死亡咆哮(), + (long)MagicID.鬼魅之痛 => new 鬼魅之痛(), + (long)MagicID.导力停止 => new 导力停止(), + (long)MagicID.冰狱冥嚎 => new 冰狱冥嚎(), + (long)MagicID.火山咆哮 => new 火山咆哮(), + (long)MagicID.水蓝轰炸 => new 水蓝轰炸(), + (long)MagicID.岩石之息 => new 岩石之息(), + (long)MagicID.弧形日珥 => new 弧形日珥(), + (long)MagicID.苍白地狱 => new 苍白地狱(), + (long)MagicID.破碎虚空 => new 破碎虚空(), + (long)MagicID.弧光消耗 => new 弧光消耗(), + (long)MagicID.回复术改 => new 回复术改(), + (long)MagicID.回复术复 => new 回复术复(), + (long)MagicID.治愈术复 => new 治愈术复(), + (long)MagicID.风之守护复 => new 风之守护复(), + (long)MagicID.强音之力复 => new 强音之力复(), + (long)MagicID.结晶防护复 => new 结晶防护复(), + (long)MagicID.神圣祝福复 => new 神圣祝福复(), + (long)MagicID.时间加速改 => new 时间加速改(), + (long)MagicID.时间减速改 => new 时间减速改(), + (long)MagicID.时间加速复 => new 时间加速复(), + (long)MagicID.时间减速复 => new 时间减速复(), + (long)MagicID.十二宫星环 => new 十二宫星环(), + (long)MagicID.时间剥夺 => new 时间剥夺(), + (long)SkillID.疾风步 => new 疾风步(), + (long)SkillID.助威 => new 助威(), + (long)SkillID.挑拨 => new 挑拨(), + (long)SkillID.绞丝棍 => new 绞丝棍(), + (long)SkillID.金刚击 => new 金刚击(), + (long)SkillID.旋风轮 => new 旋风轮(), + (long)SkillID.双连击 => new 双连击(), + (long)SkillID.绝影 => new 绝影(), + (long)SkillID.胧 => new 胧(), + (long)SkillID.魔眼 => new 魔眼(), + (long)SkillID.天堂之吻 => new 天堂之吻(), + (long)SkillID.回复弹 => new 回复弹(), + (long)SkillID.养命功 => new 养命功(), + (long)SkillID.镜花水月 => new 镜花水月(), + (long)SkillID.剑风闪 => new 剑风闪(), + (long)SkillID.鲨鱼锚击 => new 鲨鱼锚击(), + (long)SkillID.疾走 => new 疾走(), + (long)SkillID.闪现 => new 闪现(), + (long)SkillID.风之鞭 => new 风之鞭(), + (long)SkillID.拘束之鞭 => new 拘束之鞭(), + (long)SkillID.狐媚暗随 => new 狐媚暗随(), + (long)SkillID.快速狙击 => new 快速狙击(), + (long)SkillID.精准射击 => new 精准射击(), + (long)SkillID.欢乐激发 => new 欢乐激发(), + (long)SkillID.乱心安魂曲 => new 乱心安魂曲(), + (long)SkillID.斗魂 => new 斗魂(), + (long)SkillID.岚 => new 岚(), + (long)SkillID.公牛之怒 => new 公牛之怒(), + (long)SkillID.火焰碎击 => new 火焰碎击(), + (long)SkillID.螺旋之刃 => new 螺旋之刃(), + (long)SkillID.霸王疾风 => new 霸王疾风(), + (long)SkillID.导力装甲 => new 导力装甲(), + (long)SkillID.回复原状 => new 回复原状(), + (long)SkillID.强打 => new 强打(), + (long)SkillID.龙神功 => new 龙神功(), + (long)SkillID.月华掌 => new 月华掌(), + (long)SkillID.雷神脚 => new 雷神脚(), + (long)SkillID.弓刃交错 => new 弓刃交错(), + (long)SkillID.神圣祈祷 => new 神圣祈祷(), + (long)SkillID.牺牲之箭 => new 牺牲之箭(), + (long)SkillID.石化之矢 => new 石化之矢(), + (long)SkillID.死亡制裁 => new 死亡制裁(), + (long)SkillID.落叶 => new 落叶(), + (long)SkillID.风花阵 => new 风花阵(), + (long)SkillID.陀螺舞 => new 陀螺舞(), + (long)SkillID.光破斩 => new 光破斩(), + (long)SkillID.跳跃点射 => new 跳跃点射(), + (long)SkillID.光鬼斩 => new 光鬼斩(), + (long)SkillID.雷索吸缚 => new 雷索吸缚(), + (long)SkillID.狂刃剑舞 => new 狂刃剑舞(), + (long)SkillID.无相飞刀 => new 无相飞刀(), + (long)SkillID.破邪显正 => new 破邪显正(), + (long)SkillID.号令 => new 号令(), + (long)SkillID.千剑之雨 => new 千剑之雨(), + (long)SkillID.无尽剑制 => new 无尽剑制(), + (long)SkillID.灾难一掷 => new 灾难一掷(), + (long)SkillID.血腥旋转 => new 血腥旋转(), + (long)SkillID.断罪斩 => new 断罪斩(), + // 决策点维度(2026-09-23 新增) + (long)SkillID.战术部署 => new 战术部署(), + (long)SkillID.过载 => new 过载(), + (long)SuperSkillID.催战鼓 => new 催战鼓(), + (long)SkillID.抢夺命运 => new 抢夺命运(), + (long)SkillID.命运剥夺 => new 命运剥夺(), + (long)SkillID.命运馈赠 => new 命运馈赠(), + (long)SkillID.命运之赐 => new 命运之赐(), + (long)SuperSkillID.熵灭极诣 => new 熵灭极诣(), + (long)SuperSkillID.千羽瞬华 => new 千羽瞬华(), + (long)SuperSkillID.咒怨洪流 => new 咒怨洪流(), + (long)SuperSkillID.三相灵枢 => new 三相灵枢(), + (long)SuperSkillID.变幻之心 => new 变幻之心(), + (long)SuperSkillID.零式灭杀 => new 零式灭杀(), + (long)SuperSkillID.绝对领域 => new 绝对领域(), + (long)SuperSkillID.残香凋零 => new 残香凋零(), + (long)SuperSkillID.宿命时律 => new 宿命时律(), + (long)SuperSkillID.极寒渴望 => new 极寒渴望(), + (long)SuperSkillID.身心一境 => new 身心一境(), + (long)SuperSkillID.饕餮盛宴 => new 饕餮盛宴(), + (long)SuperSkillID.放监 => new 放监(), + (long)SuperSkillID.归元环 => new 归元环(), + (long)SuperSkillID.海王星的野望 => new 海王星的野望(), + (long)SuperSkillID.全军出击 => new 全军出击(), + (long)SuperSkillID.宿命之潮 => new 宿命之潮(), + (long)SuperSkillID.神之因果 => new 神之因果(), + (long)SuperSkillID.樱花无双击 => new 樱花无双击(), + (long)SuperSkillID.漆黑之牙 => new 漆黑之牙(), + (long)SuperSkillID.女王之怒 => new 女王之怒(), + (long)SuperSkillID.裁决塔罗 => new 裁决塔罗(), + (long)SuperSkillID.光明之环 => new 光明之环(), + (long)SuperSkillID.圣星光旋 => new 圣星光旋(), + (long)SuperSkillID.炎龙倒海 => new 炎龙倒海(), + (long)SuperSkillID.卫星激光 => new 卫星激光(), + (long)SuperSkillID.泰山玄武靠 => new 泰山玄武靠(), + (long)SuperSkillID.星杯领域 => new 星杯领域(), + (long)SuperSkillID.魔枪洛亚 => new 魔枪洛亚(), + (long)SuperSkillID.八叶灭杀 => new 八叶灭杀(), + (long)SuperSkillID.樱花残月 => new 樱花残月(), + (long)SuperSkillID.圣洁祝福 => new 圣洁祝福(), + (long)SuperSkillID.天堂阻灭 => new 天堂阻灭(), + (long)SuperSkillID.歼灭 => new 歼灭(), + (long)PassiveID.META马 => new META马(), + (long)PassiveID.心灵之弦 => new 心灵之弦(), + (long)PassiveID.蚀魂震击 => new 蚀魂震击(), + (long)PassiveID.灵能反射 => new 灵能反射(), + (long)PassiveID.双生流转 => new 双生流转(), + (long)PassiveID.零式崩解 => new 零式崩解(), + (long)PassiveID.少女绮想 => new 少女绮想(), + (long)PassiveID.暗香疏影 => new 暗香疏影(), + (long)PassiveID.破釜沉舟 => new 破釜沉舟(), + (long)PassiveID.累积之压 => new 累积之压(), + (long)PassiveID.银隼之赐 => new 银隼之赐(), + (long)PassiveID.弱者猎手 => new 弱者猎手(), + (long)PassiveID.开宫 => new 开宫(), + (long)PassiveID.八卦阵 => new 八卦阵(), + (long)PassiveID.深海之戟 => new 深海之戟(), + (long)PassiveID.概念之骰 => new 概念之骰(), + (long)PassiveID.掠夺者 => new 掠夺者(), + (long)PassiveID.雇佣兵团 => new 雇佣兵团(), + (long)PassiveID.不息之流 => new 不息之流(), + (long)PassiveID.征服者 => new 征服者(), + (long)PassiveID.致命节奏 => new 致命节奏(), + (long)PassiveID.强攻 => new 强攻(), + (long)PassiveID.电刑 => new 电刑(), + (long)PassiveID.黑暗收割 => new 黑暗收割(), + (long)PassiveID.迅捷步法 => new 迅捷步法(), + (long)PassiveID.贪欲猎手 => new 贪欲猎手(), + (long)PassiveID.丛刃 => new 丛刃(), + (long)PassiveID.召唤艾黎 => new 召唤艾黎(), + (long)PassiveID.相位猛冲 => new 相位猛冲(), + (long)PassiveID.奥术彗星 => new 奥术彗星(), + (long)PassiveID.风暴聚集 => new 风暴聚集(), + (long)PassiveID.不灭之握 => new 不灭之握(), + (long)PassiveID.余震 => new 余震(), + (long)PassiveID.守护者 => new 守护者(), + (long)PassiveID.骸骨镀层 => new 骸骨镀层(), + (long)PassiveID.冰川增幅 => new 冰川增幅(), + (long)PassiveID.先攻 => new 先攻(), + (long)PassiveID.饼干配送 => new 饼干配送(), + (long)PassiveID.折射 => new 折射(), + (long)PassiveID.恩赐解脱 => new 恩赐解脱(), + (long)PassiveID.静电场 => new 静电场(), + (long)PassiveID.竭心光环 => new 竭心光环(), + (long)PassiveID.海妖外壳 => new 海妖外壳(), + (long)PassiveID.自然蔽护 => new 自然蔽护(), + (long)PassiveID.勇气之霎 => new 勇气之霎(), + (long)PassiveID.深海重击 => new 深海重击(), + (long)PassiveID.反击螺旋 => new 反击螺旋(), + (long)PassiveID.刀光谍影 => new 刀光谍影(), + (long)PassiveID.幽冥剧毒 => new 幽冥剧毒(), + // 辅助型通用被动(2026-09-22 新增):给予队友治疗 / 护盾 / 增益 + (long)PassiveID.生命链接 => new 生命链接(), + (long)PassiveID.共鸣护盾 => new 共鸣护盾(), + (long)PassiveID.战地巡诊 => new 战地巡诊(), + (long)PassiveID.同袍之誓 => new 同袍之誓(), + (long)PassiveID.援护号令 => new 援护号令(), + (long)PassiveID.战术余裕 => new 战术余裕(), + (long)ItemPassiveID.万能钥匙 => new 万能钥匙技能(), + (long)ItemPassiveID.节拍器 => new 节拍器技能(), + (long)ItemPassiveID.攻击之爪 => new 攻击之爪技能(), + (long)ItemPassiveID.糖糖一周年纪念武器 => new 糖糖一周年纪念武器技能(), + (long)ItemPassiveID.糖糖一周年纪念防具 => new 糖糖一周年纪念防具技能(), + (long)ItemPassiveID.糖糖一周年纪念鞋子 => new 糖糖一周年纪念鞋子技能(), + (long)ItemPassiveID.糖糖一周年纪念饰品1 => new 糖糖一周年纪念饰品技能1(), + (long)ItemPassiveID.糖糖一周年纪念饰品2 => new 糖糖一周年纪念饰品技能2(), + (long)ItemActiveID.经验书 => new 经验书技能(), + (long)ItemActiveID.礼包 => new 礼包技能(), + (long)ItemActiveID.应急装置 => new 应急装置技能(), + _ => null + }; + }; + } + + protected override Factory.EffectFactoryDelegate EffectFactory() + { + return (id, name, skill, args) => + { + args ??= []; + return (EffectID)id switch + { + EffectID.ExATK => new ExATK(skill, args), + EffectID.ExDEF => new ExDEF(skill, args), + EffectID.ExSTR => new ExSTR(skill, args), + EffectID.ExAGI => new ExAGI(skill, args), + EffectID.ExINT => new ExINT(skill, args), + EffectID.SkillHardTimeReduce => new SkillHardTimeReduce(skill, args), + EffectID.NormalAttackHardTimeReduce => new NormalAttackHardTimeReduce(skill, args), + EffectID.AccelerationCoefficient => new AccelerationCoefficient(skill, args), + EffectID.ExSPD => new ExSPD(skill, args), + EffectID.ExActionCoefficient => new ExActionCoefficient(skill, args), + EffectID.ExCDR => new ExCDR(skill, args), + EffectID.ExMaxHP => new ExMaxHP(skill, args), + EffectID.ExMaxMP => new ExMaxMP(skill, args), + EffectID.ExCritRate => new ExCritRate(skill, args), + EffectID.ExCritDMG => new ExCritDMG(skill, args), + EffectID.ExEvadeRate => new ExEvadeRate(skill, args), + EffectID.PhysicalPenetration => new PhysicalPenetration(skill, args), + EffectID.MagicalPenetration => new MagicalPenetration(skill, args), + EffectID.ExPDR => new ExPDR(skill, args), + EffectID.ExMDF => new ExMDF(skill, args), + EffectID.ExHR => new ExHR(skill, args), + EffectID.ExMR => new ExMR(skill, args), + EffectID.ExATK2 => new ExATK2(skill, args), + EffectID.ExDEF2 => new ExDEF2(skill, args), + EffectID.ExSTR2 => new ExSTR2(skill, args), + EffectID.ExAGI2 => new ExAGI2(skill, args), + EffectID.ExINT2 => new ExINT2(skill, args), + EffectID.SkillHardTimeReduce2 => new SkillHardTimeReduce2(skill, args), + EffectID.NormalAttackHardTimeReduce2 => new NormalAttackHardTimeReduce2(skill, args), + EffectID.ExMaxHP2 => new ExMaxHP2(skill, args), + EffectID.ExMaxMP2 => new ExMaxMP2(skill, args), + EffectID.DynamicsEffect => new DynamicsEffect(skill, args), + EffectID.IgnoreEvade => new IgnoreEvade(skill, args), + EffectID.ExATR => new ExATR(skill, args), + EffectID.ExMOV => new ExMOV(skill, args), + EffectID.ExLifesteal => new ExLifesteal(skill, args), + EffectID.RecoverHP => new RecoverHP(skill, args), + EffectID.RecoverMP => new RecoverMP(skill, args), + EffectID.RecoverHP2 => new RecoverHP2(skill, args), + EffectID.RecoverMP2 => new RecoverMP2(skill, args), + EffectID.GetEP => new GetEP(skill, args), + EffectID.GetEXP => new GetEXP(skill, args), + _ => null + }; + }; + } + } +} diff --git a/OshimaBot.Game/OshimaBot.Game.csproj b/OshimaBot.Game/OshimaBot.Game.csproj new file mode 100644 index 0000000..5910b7f --- /dev/null +++ b/OshimaBot.Game/OshimaBot.Game.csproj @@ -0,0 +1,18 @@ + + + + net10.0 + enable + enable + OshimaBot.Game + + + + + + + + + + + diff --git a/OshimaBot.Game/Services/FunGameRuntime.cs b/OshimaBot.Game/Services/FunGameRuntime.cs new file mode 100644 index 0000000..a90c31b --- /dev/null +++ b/OshimaBot.Game/Services/FunGameRuntime.cs @@ -0,0 +1,32 @@ +using OshimaBot.Game.Modules; + +namespace OshimaBot.Game.Services +{ + /// + /// 进程级游戏目录初始化。FunGame.Core 的工厂是全局状态,必须且只能初始化一次。 + /// + public static class FunGameRuntime + { + private static readonly Lock Sync = new(); + private static bool _initialized; + + public static DateTimeOffset StartedAt { get; private set; } + + public static void EnsureInitialized() + { + lock (Sync) + { + if (_initialized) return; + + new CharacterModule().Load(); + new SkillModule().Load(); + new ItemModule().Load(); + FunGameService.InitFunGame(); + FunGameSimulation.InitializeStatistics(); + + StartedAt = DateTimeOffset.UtcNow; + _initialized = true; + } + } + } +} diff --git a/OshimaBot.Game/Services/FunGameService.cs b/OshimaBot.Game/Services/FunGameService.cs new file mode 100644 index 0000000..3fa0384 --- /dev/null +++ b/OshimaBot.Game/Services/FunGameService.cs @@ -0,0 +1,937 @@ +using OshimaBot.Game.Constants; +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.PrefabricatedEntity; +using OshimaBot.Content.Characters; +using OshimaBot.Content.Effects.OpenEffects; +using OshimaBot.Content.Items; +using OshimaBot.Content.Skills; +using Milimoe.FunGameTesting.Others; + +namespace OshimaBot.Game.Services +{ + public class FunGameService + { + public static List Characters { get; } = []; + public static List Skills { get; } = []; + public static List PassiveSkills { get; } = []; + public static List CommonPassiveSkills { get; } = []; + public static List SuperSkills { get; } = []; + public static List CommonSuperSkills { get; } = []; + public static List Magics { get; } = []; + public static List Equipment { get; } = []; + public static List Items { get; } = []; + public static List ItemSkills { get; } = []; + public static List AllItems { get; } = []; + public static List AllSkills { get; } = []; + + public static void InitFunGame() + { + Characters.Add(new OshimaShiya()); + Characters.Add(new XinYin()); + Characters.Add(new Yang()); + Characters.Add(new NanGanYu()); + Characters.Add(new NiuNan()); + Characters.Add(new DokyoMayor()); + Characters.Add(new MagicalGirl()); + Characters.Add(new QingXiang()); + Characters.Add(new QWQAQW()); + Characters.Add(new ColdBlue()); + Characters.Add(new Dddovo()); + Characters.Add(new Quduoduo()); + Characters.Add(new ShiYu()); + Characters.Add(new XReouni()); + Characters.Add(new Neptune()); + Characters.Add(new CHAOS()); + Characters.Add(new Ryuko()); + Characters.Add(new TheGodK()); + + Skills.AddRange([new 疾风步(), new 助威(), new 挑拨(), new 绞丝棍(), new 金刚击(), new 旋风轮(), new 双连击(), new 绝影(), new 胧(), new 魔眼(), + new 天堂之吻(), new 回复弹(), new 养命功(), new 镜花水月(), new 剑风闪(), new 鲨鱼锚击(), new 疾走(), new 闪现(), + new 风之鞭(), new 拘束之鞭(), new 狐媚暗随(), new 快速狙击(), new 精准射击(), new 欢乐激发(), new 乱心安魂曲(), new 斗魂(), new 岚(), new 公牛之怒(), + new 火焰碎击(), new 螺旋之刃(), new 霸王疾风(), new 导力装甲(), new 回复原状(), new 强打(), new 龙神功(), new 月华掌(), new 雷神脚(), new 弓刃交错(), + new 神圣祈祷(), new 牺牲之箭(), new 石化之矢(), new 死亡制裁(), new 落叶(), new 风花阵(), new 陀螺舞(), new 光破斩(), new 跳跃点射(), new 光鬼斩(), + new 雷索吸缚(), new 狂刃剑舞(), new 无相飞刀(), new 破邪显正(), new 号令(), new 千剑之雨(), new 无尽剑制(), new 灾难一掷(), new 血腥旋转(), + new 抢夺命运(), new 命运剥夺(), new 命运馈赠(), new 命运之赐(), new 断罪斩(), + // 决策点维度(2026-09-23 新增) + new 战术部署(), new 过载(), + // 决策点/节奏维度(2026-09-23 新增) + new 战术余裕()]); + + SuperSkills.AddRange([new 极寒渴望(), new 身心一境(), new 绝对领域(), new 零式灭杀(), new 三相灵枢(), new 变幻之心(), new 熵灭极诣(), new 残香凋零(), new 饕餮盛宴(), + new 宿命时律(), new 千羽瞬华(), new 咒怨洪流(), new 放监(), new 归元环(), new 海王星的野望(), new 全军出击(), new 宿命之潮(), new 神之因果()]); + + PassiveSkills.AddRange([new META马(), new 心灵之弦(), new 蚀魂震击(), new 灵能反射(), new 双生流转(), new 零式崩解(), new 少女绮想(), new 暗香疏影(), new 破釜沉舟(), + new 累积之压(), new 银隼之赐(), new 弱者猎手(), new 开宫(), new 八卦阵(), new 深海之戟(), new 雇佣兵团(), new 不息之流(), new 概念之骰()]); + + CommonPassiveSkills.AddRange([new 征服者(), new 致命节奏(), new 强攻(), new 电刑(), new 黑暗收割(), new 迅捷步法(), new 贪欲猎手(), + new 丛刃(), new 召唤艾黎(), new 相位猛冲(), new 奥术彗星(), new 风暴聚集(), new 不灭之握(), new 余震(), new 守护者(), new 骸骨镀层(), new 冰川增幅(), + new 先攻(), new 饼干配送(), new 折射(), new 恩赐解脱(), new 静电场(), new 竭心光环(), new 海妖外壳(), new 自然蔽护(), new 勇气之霎(), + new 深海重击(), new 反击螺旋(), new 刀光谍影(), new 幽冥剧毒(), new 掠夺者(), + // 辅助型通用被动(2026-09-22 新增):给予队友治疗 / 护盾 / 增益 + new 生命链接(), new 共鸣护盾(), new 战地巡诊(), new 同袍之誓(), new 援护号令()]); + + CommonSuperSkills.AddRange([new 樱花无双击(), new 漆黑之牙(), new 女王之怒(), new 裁决塔罗(), new 光明之环(), new 圣星光旋(), new 炎龙倒海(), new 卫星激光(), new 泰山玄武靠(), + new 星杯领域(), new 魔枪洛亚(), new 八叶灭杀(), new 樱花残月(), new 圣洁祝福(), new 天堂阻灭(), new 歼灭(), new 催战鼓()]); + + Magics.AddRange([new 冰霜攻击(), new 火之矢(), new 水之矢(), new 风之轮(), new 石之锤(), new 心灵之霞(), new 次元上升(), new 暗物质(), + new 回复术(), new 治愈术(), new 复苏术(), new 圣灵术(), new 时间加速(), new 时间减速(), new 反魔法领域(), new 沉默十字(), new 虚弱领域(), new 混沌烙印(), new 凝胶稠絮(), + new 大地之墙(), new 盖亚之盾(), new 风之守护(), new 结晶防护(), new 强音之力(), new 神圣祝福(), new 根源屏障(), new 灾难冲击波(), new 银色荆棘(), new 等离子之波(), + new 地狱之门(), new 钻石星尘(), new 死亡咆哮(), new 鬼魅之痛(), new 导力停止(), new 冰狱冥嚎(), new 火山咆哮(), new 水蓝轰炸(), new 岩石之息(), new 弧形日珥(), new 苍白地狱(), new 破碎虚空(), + new 弧光消耗(), new 回复术改(), new 回复术复(), new 治愈术复(), new 风之守护复(), new 强音之力复(), new 结晶防护复(), new 神圣祝福复(), new 时间加速改(), new 时间减速改(), + new 时间加速复(), new 时间减速复(), new 十二宫星环(), new 时间剥夺()]); + + Dictionary exItems = Factory.GetGameModuleInstances(OshimaGameModuleConstant.General, OshimaGameModuleConstant.Item); + Equipment.AddRange(exItems.Values.Where(i => (int)i.ItemType >= 0 && (int)i.ItemType < 5)); + Equipment.AddRange([new 攻击之爪10(), new 攻击之爪25(), new 攻击之爪40(), new 攻击之爪55(), new 攻击之爪70(), new 攻击之爪85(), new 糖糖一周年纪念武器(), + new 糖糖一周年纪念防具(), new 糖糖一周年纪念鞋子(), new 糖糖一周年纪念饰品1(), new 糖糖一周年纪念饰品2(), + new 行军医箱1(), new 行军医箱2(), new 行军医箱3(), + new 共鸣核心1(), new 共鸣核心2(), new 共鸣核心3(), + new 接力信标1(), new 接力信标2(), new 接力信标3(), + new 应急装置1(), new 应急装置2(), new 应急装置3(), + // 决策点/节奏维度(2026-09-23 新增) + new 万能钥匙1(), new 万能钥匙2(), new 万能钥匙3(), + new 节拍器1(), new 节拍器2(), new 节拍器3()]); + + Items.AddRange(exItems.Values.Where(i => (int)i.ItemType > 4)); + Items.AddRange([new 小经验书(), new 中经验书(), new 大经验书(), new 升华之印(), new 流光之印(), new 永恒之印(), new 技能卷轴(), new 智慧之果(), new 奥术符文(), new 混沌之核(), + new 小回复药(), new 中回复药(), new 大回复药(), new 魔力填充剂1(), new 魔力填充剂2(), new 魔力填充剂3(), new 能量饮料1(), new 能量饮料2(), new 能量饮料3(), new 年夜饭(), new 蛇年大吉(), new 新春快乐(), new 毕业礼包(), + new 复苏药1(), new 复苏药2(), new 复苏药3(), new 全回复药(), new 魔法卡礼包(), new 奖券(), new 十连奖券(), new 改名卡(), new 原初之印(), new 创生之印(), new 法则精粹(), new 大师锻造券(), + new 一周年纪念礼包(), new 一周年纪念套装(), new 冬至快乐(), new 圣诞礼包(), new 元旦快乐() + ]); + + AllItems.AddRange(Equipment); + AllItems.AddRange(Items); + + Skill?[] activeSkills = [.. Equipment.Select(i => i.Skills.Active), .. Items.Select(i => i.Skills.Active)]; + foreach (Skill? skill in activeSkills) + { + if (skill != null) + { + ItemSkills.Add(skill); + } + } + ItemSkills.AddRange([.. Equipment.SelectMany(i => i.Skills.Passives), .. Items.SelectMany(i => i.Skills.Passives)]); + + AllSkills.AddRange(Magics); + AllSkills.AddRange(Skills); + AllSkills.AddRange(PassiveSkills); + AllSkills.AddRange(CommonPassiveSkills); + AllSkills.AddRange(ItemSkills); + AllSkills.AddRange(SuperSkills); + AllSkills.AddRange(CommonSuperSkills); + } + + public static void Reload() + { + Characters.Clear(); + Equipment.Clear(); + Skills.Clear(); + SuperSkills.Clear(); + CommonSuperSkills.Clear(); + PassiveSkills.Clear(); + CommonPassiveSkills.Clear(); + Magics.Clear(); + AllItems.Clear(); + ItemSkills.Clear(); + AllSkills.Clear(); + InitFunGame(); + } + + public static void AddCharacterSkills(Character character, int passiveLevel, int skillLevel, int superLevel) + { + long id = character.Id; + Math.Sign(skillLevel); + if (id == 1) + { + Skill META马 = new META马(character) + { + Level = passiveLevel + }; + character.Skills.Add(META马); + + Skill 熵灭极诣 = new 熵灭极诣(character) + { + Level = superLevel + }; + character.Skills.Add(熵灭极诣); + } + + if (id == 2) + { + Skill 心灵之弦 = new 心灵之弦(character) + { + Level = passiveLevel + }; + character.Skills.Add(心灵之弦); + + Skill 千羽瞬华 = new 千羽瞬华(character) + { + Level = superLevel + }; + character.Skills.Add(千羽瞬华); + } + + if (id == 3) + { + Skill 蚀魂震击 = new 蚀魂震击(character) + { + Level = passiveLevel + }; + character.Skills.Add(蚀魂震击); + + Skill 咒怨洪流 = new 咒怨洪流(character) + { + Level = superLevel + }; + character.Skills.Add(咒怨洪流); + } + + if (id == 4) + { + Skill 灵能反射 = new 灵能反射(character) + { + Level = passiveLevel + }; + character.Skills.Add(灵能反射); + + Skill 三相灵枢 = new 三相灵枢(character) + { + Level = superLevel + }; + character.Skills.Add(三相灵枢); + } + + if (id == 5) + { + Skill 双生流转 = new 双生流转(character) + { + Level = passiveLevel + }; + character.Skills.Add(双生流转); + + Skill 变幻之心 = new 变幻之心(character) + { + Level = superLevel + }; + character.Skills.Add(变幻之心); + } + + if (id == 6) + { + Skill 零式崩解 = new 零式崩解(character) + { + Level = passiveLevel + }; + character.Skills.Add(零式崩解); + + Skill 零式灭杀 = new 零式灭杀(character) + { + Level = superLevel + }; + character.Skills.Add(零式灭杀); + } + + if (id == 7) + { + Skill 少女绮想 = new 少女绮想(character) + { + Level = passiveLevel + }; + character.Skills.Add(少女绮想); + + Skill 绝对领域 = new 绝对领域(character) + { + Level = superLevel + }; + character.Skills.Add(绝对领域); + } + + if (id == 8) + { + Skill 暗香疏影 = new 暗香疏影(character) + { + Level = passiveLevel + }; + character.Skills.Add(暗香疏影); + + Skill 残香凋零 = new 残香凋零(character) + { + Level = superLevel + }; + character.Skills.Add(残香凋零); + } + + if (id == 9) + { + Skill 破釜沉舟 = new 破釜沉舟(character) + { + Level = passiveLevel + }; + character.Skills.Add(破釜沉舟); + + Skill 宿命时律 = new 宿命时律(character) + { + Level = superLevel + }; + character.Skills.Add(宿命时律); + } + + if (id == 10) + { + Skill 累积之压 = new 累积之压(character) + { + Level = passiveLevel + }; + character.Skills.Add(累积之压); + + Skill 极寒渴望 = new 极寒渴望(character) + { + Level = superLevel + }; + character.Skills.Add(极寒渴望); + } + + if (id == 11) + { + Skill 银隼之赐 = new 银隼之赐(character) + { + Level = passiveLevel + }; + character.Skills.Add(银隼之赐); + + Skill 身心一境 = new 身心一境(character) + { + Level = superLevel + }; + character.Skills.Add(身心一境); + } + + if (id == 12) + { + Skill 弱者猎手 = new 弱者猎手(character) + { + Level = passiveLevel + }; + character.Skills.Add(弱者猎手); + + Skill 饕餮盛宴 = new 饕餮盛宴(character) + { + Level = superLevel + }; + character.Skills.Add(饕餮盛宴); + } + + if (id == 13) + { + Skill 开宫 = new 开宫(character) + { + Level = passiveLevel + }; + character.Skills.Add(开宫); + + Skill 放监 = new 放监(character) + { + Level = superLevel + }; + character.Skills.Add(放监); + } + + if (id == 14) + { + Skill 八卦阵 = new 八卦阵(character) + { + Level = passiveLevel + }; + character.Skills.Add(八卦阵); + + Skill 归元环 = new 归元环(character) + { + Level = superLevel + }; + character.Skills.Add(归元环); + } + + if (id == 15) + { + Skill 深海之戟 = new 深海之戟(character) + { + Level = passiveLevel + }; + character.Skills.Add(深海之戟); + + Skill 海王星的野望 = new 海王星的野望(character) + { + Level = superLevel + }; + character.Skills.Add(海王星的野望); + } + + if (id == 16) + { + Skill 雇佣兵团 = new 雇佣兵团(character) + { + Level = passiveLevel + }; + character.Skills.Add(雇佣兵团); + + Skill 全军出击 = new 全军出击(character) + { + Level = superLevel + }; + character.Skills.Add(全军出击); + } + + if (id == 17) + { + Skill 不息之流 = new 不息之流(character) + { + Level = passiveLevel + }; + character.Skills.Add(不息之流); + + Skill 宿命之潮 = new 宿命之潮(character) + { + Level = superLevel + }; + character.Skills.Add(宿命之潮); + } + + if (id == 18) + { + Skill 概念之骰 = new 概念之骰(character) + { + Level = passiveLevel + }; + character.Skills.Add(概念之骰); + + Skill 神之因果 = new 神之因果(character) + { + Level = superLevel + }; + character.Skills.Add(神之因果); + } + } + + public static List GenerateMagicCards(Random random, int count, QualityType? qualityType = null, long[]? magicIds = null, (int str, int agi, int intelligence)[]? values = null) + { + List items = []; + + for (int i = 0; i < count; i++) + { + long magicId = 0; + if (magicIds != null && magicIds.Length > i) magicId = magicIds[i]; + (int str, int agi, int intelligence) = (0, 0, 0); + if (values != null && values.Length > i) + { + str = values[i].str; + agi = values[i].agi; + intelligence = values[i].intelligence; + } + items.Add(GenerateMagicCard(random, qualityType, magicId, str, agi, intelligence)); + } + + return items; + } + + public static Item GenerateMagicCard(Random random, QualityType? qualityType = null, long magicId = 0, int str = 0, int agi = 0, int intelligence = 0) + { + Item item = new() + { + Id = CreateItemId("16", random), + Name = RandomNames.GenerateRandomChineseName(random), + ItemType = ItemType.MagicCard, + RemainUseTimes = 1 + }; + + GenerateAndAddSkillToMagicCard(random, item, qualityType, magicId, str, agi, intelligence); + + return item; + } + + public static void GenerateAndAddSkillToMagicCard(Random random, Item item, QualityType? qualityType = null, long magicId = 0, int str = 0, int agi = 0, int intelligence = 0) + { + int total = str + agi + intelligence; + if (total == 0) + { + if (qualityType != null) + { + item.QualityType = qualityType.Value; + if (item.QualityType > QualityType.Gold) item.QualityType = QualityType.Gold; + total = item.QualityType switch + { + QualityType.Green => random.Next(7, 13), + QualityType.Blue => random.Next(13, 19), + QualityType.Purple => random.Next(19, 25), + QualityType.Orange => random.Next(25, 31), + QualityType.Red => random.Next(31, 37), + QualityType.Gold => random.Next(37, 43), + _ => random.Next(1, 7) + }; + } + else total = random.Next(1, 43); + + // 随机决定将多少个属性赋给其中一个属性,确保至少一个不为零 + int nonZeroAttributes = random.Next(1, Math.Min(4, total + 1)); // 随机决定非零属性的数量,确保在 total = 1 时最多只有1个非零属性 + + // 根据非零属性数量分配属性点 + if (nonZeroAttributes == 1) + { + // 只有一个属性不为零 + int attribute = random.Next(0, 3); + if (attribute == 0) str = total; + else if (attribute == 1) agi = total; + else intelligence = total; + } + else if (nonZeroAttributes == 2 && total >= 2) + { + // 两个属性不为零 + int first = random.Next(1, total); // 第一个属性的值 + int second = total - first; // 第二个属性的值 + + int attribute = random.Next(0, 3); + if (attribute == 0) + { + str = first; + } + else if (attribute == 1) + { + agi = first; + } + else + { + intelligence = first; + } + + attribute = random.Next(0, 3); + while ((attribute == 0 && str > 0) || (attribute == 1 && agi > 0) || (attribute == 2 && intelligence > 0)) + { + attribute = random.Next(0, 3); + } + + if (attribute == 0) + { + str = second; + } + else if (attribute == 1) + { + agi = second; + } + else + { + intelligence = second; + } + } + else if (total >= 3) + { + // 三个属性都不为零 + str = random.Next(1, total - 1); // 第一个属性的值 + agi = random.Next(1, total - str); // 第二个属性的值 + intelligence = total - str - agi; // 剩下的值给第三个属性 + } + } + + if (item.QualityType == QualityType.White) + { + if (total > 6 && total <= 12) + { + item.QualityType = QualityType.Green; + } + else if (total > 12 && total <= 18) + { + item.QualityType = QualityType.Blue; + } + else if (total > 18 && total <= 24) + { + item.QualityType = QualityType.Purple; + } + else if (total > 24 && total <= 30) + { + item.QualityType = QualityType.Orange; + } + else if (total > 30 && total <= 36) + { + item.QualityType = QualityType.Red; + } + else if (total > 36) + { + item.QualityType = QualityType.Gold; + } + } + + Skill? magic = null; + if (magicId != 0) + { + magic = Magics.FirstOrDefault(m => m.Id == magicId); + } + magic ??= Magics[random.Next(Magics.Count)].Copy(); + magic.AssociatedItemGuid = item.Guid; + magic.Level = (int)item.QualityType switch + { + 2 => 2, + 3 => 2, + 4 => 3, + 5 => 4, + 6 => 5, + _ => 1 + }; + if (magic.Level > 1) + { + item.Name += $" +{magic.Level - 1}"; + } + item.Skills.Active = magic; + + Skill skill = Factory.OpenFactory.GetInstance(item.Id, "动态矩阵", []); + GenerateAndAddEffectsToMagicCard(skill, str, agi, intelligence); + + skill.Level = 1; + List strings = []; + if (str > 0) strings.Add($"{str:0.##} 点力量"); + if (agi > 0) strings.Add($"{agi:0.##} 点敏捷"); + if (intelligence > 0) strings.Add($"{intelligence:0.##} 点智力"); + item.Description = $"包含魔法:{item.Skills.Active.Name + (item.Skills.Active.Level > 1 ? $" +{item.Skills.Active.Level - 1}" : "")}\r\n" + + $"增加角色属性:{string.Join(",", strings)}"; + item.Skills.Passives.Add(skill); + } + + public static void GenerateAndAddEffectsToMagicCard(Skill skill, int str, int agi, int intelligence) + { + if (str > 0) + { + skill.Effects.Add(Factory.OpenFactory.GetInstance((long)EffectID.ExSTR, "", skill, new() + { + { "exstr", str } + })); + } + + if (agi > 0) + { + skill.Effects.Add(Factory.OpenFactory.GetInstance((long)EffectID.ExAGI, "", skill, new() + { + { "exagi", agi } + })); + } + + if (intelligence > 0) + { + skill.Effects.Add(Factory.OpenFactory.GetInstance((long)EffectID.ExINT, "", skill, new() + { + { "exint", intelligence } + })); + } + } + + public static Item? ConflateMagicCardPack(Random random, IEnumerable magicCards) + { + if (magicCards.Any()) + { + List magics = [.. magicCards.Where(i => i.Skills.Active != null).Select(i => i.Skills.Active!)]; + List passives = [.. magicCards.SelectMany(i => i.Skills.Passives)]; + Item item = new() + { + Id = CreateItemId("10", random), + Name = RandomNames.GenerateRandomChineseName(random), + ItemType = ItemType.MagicCardPack + }; + double str = 0, agi = 0, intelligence = 0; + foreach (Skill skill in passives) + { + Skill newSkill = skill.Copy(); + foreach (Effect effect in newSkill.Effects) + { + switch ((EffectID)effect.Id) + { + case EffectID.ExSTR: + if (effect is ExSTR exstr) + { + str += exstr.Value; + } + break; + case EffectID.ExAGI: + if (effect is ExAGI exagi) + { + agi += exagi.Value; + } + break; + case EffectID.ExINT: + if (effect is ExINT exint) + { + intelligence += exint.Value; + } + break; + } + } + newSkill.Level = skill.Level; + newSkill.Item = item; + item.Skills.Passives.Add(newSkill); + } + List strings = []; + if (str > 0) strings.Add($"{str:0.##} 点力量"); + if (agi > 0) strings.Add($"{agi:0.##} 点敏捷"); + if (intelligence > 0) strings.Add($"{intelligence:0.##} 点智力"); + foreach (Skill skill in magics) + { + IEnumerable has = item.Skills.Magics.Where(m => m.Id == skill.Id); + if (has.Any() && has.First() is Skill s) + { + s.Level += skill.Level; + if (s.Level > 1) s.Name = s.Name.Split(' ')[0] + $" +{s.Level - 1}"; + } + else + { + Skill magic = skill.Copy(); + magic.AssociatedItemGuid = item.Guid; + magic.Level = skill.Level; + item.Skills.Magics.Add(magic); + } + } + item.Description = $"包含魔法:{string.Join(",", item.Skills.Magics.Select(m => m.Name + (m.Level > 1 ? $" +{m.Level - 1}" : "")))}\r\n" + + $"增加角色属性:{string.Join(",", strings)}"; + double total = str + agi + intelligence; + if (total > 18 && total <= 36) + { + item.QualityType = QualityType.Green; + } + else if (total > 36 && total <= 54) + { + item.QualityType = QualityType.Blue; + } + else if (total > 54 && total <= 72) + { + item.QualityType = QualityType.Purple; + } + else if (total > 72 && total <= 90) + { + item.QualityType = QualityType.Orange; + } + else if (total > 90 && total <= 108) + { + item.QualityType = QualityType.Red; + } + else if (total > 108) + { + item.QualityType = QualityType.Gold; + } + return item; + } + return null; + } + + public static Item? GenerateMagicCardPack(Random random, int magicCardCount, QualityType? qualityType = null, long[]? magicIds = null, (int str, int agi, int intelligence)[]? values = null) + { + List magicCards = GenerateMagicCards(random, magicCardCount, qualityType, magicIds, values); + Item? magicCardPack = ConflateMagicCardPack(random, magicCards); + return magicCardPack; + } + + /// + /// 以核心库 MagicCardPack 为载体的卡包(新做法):三围写入原生 AttributeBoosts(exstr/exagi/exint), + /// 不再生成 Ex 被动特效技能。魔法合并 / 品质映射 / 描述口径与 ConflateMagicCardPack 保持一致。 + /// + public static Item? GenerateCoreMagicCardPack(Random random, int magicCardCount, QualityType? qualityType = null, long[]? magicIds = null, (int str, int agi, int intelligence)[]? values = null) + { + List magicCards = GenerateMagicCards(random, magicCardCount, qualityType, magicIds, values); + return ConflateCoreMagicCardPack(random, magicCards); + } + + /// + /// 将若干魔法卡合成为核心库 MagicCardPack。 + /// 说明:不修改原 ConflateMagicCardPack / 卡片生成流程;三围取自卡片被动技能的 Ex 特效(typed 优先、参数 Values 兜底)。 + /// 宿主未注册特效工厂时 OpenFactory 只会产出 Id=0 且参数丢失的泛型 Effect——新方法与旧方法在该类宿主下的取值表现一致。 + /// + public static Item? ConflateCoreMagicCardPack(Random random, IEnumerable magicCards) + { + if (!magicCards.Any()) + { + return null; + } + List magics = [.. magicCards.Where(i => i.Skills.Active != null).Select(i => i.Skills.Active!)]; + double str = 0, agi = 0, intelligence = 0; + foreach (Item card in magicCards) + { + foreach (Skill skill in card.Skills.Passives) + { + foreach (Effect effect in skill.Effects) + { + double ex = 0, ag = 0, it = 0; + switch (effect) + { + case ExSTR s: ex = s.Value; break; + case ExAGI a: ag = a.Value; break; + case ExINT i: it = i.Value; break; + default: + foreach (KeyValuePair kv in effect.Values) + { + if (kv.Key.Equals("exstr", StringComparison.OrdinalIgnoreCase) && double.TryParse(kv.Value.ToString(), out double sx)) ex = sx; + else if (kv.Key.Equals("exagi", StringComparison.OrdinalIgnoreCase) && double.TryParse(kv.Value.ToString(), out double ax)) ag = ax; + else if (kv.Key.Equals("exint", StringComparison.OrdinalIgnoreCase) && double.TryParse(kv.Value.ToString(), out double ix)) it = ix; + } + break; + } + str += ex; + agi += ag; + intelligence += it; + } + } + } + MagicCardPack item = new(new Dictionary + { + { "exstr", str }, + { "exagi", agi }, + { "exint", intelligence } + }) + { + Id = CreateItemId("10", random), + Name = RandomNames.GenerateRandomChineseName(random) + }; + List strings = []; + if (str > 0) strings.Add($"{str:0.##} 点力量"); + if (agi > 0) strings.Add($"{agi:0.##} 点敏捷"); + if (intelligence > 0) strings.Add($"{intelligence:0.##} 点智力"); + foreach (Skill skill in magics) + { + IEnumerable has = item.Skills.Magics.Where(m => m.Id == skill.Id); + if (has.Any() && has.First() is Skill s) + { + s.Level += skill.Level; + if (s.Level > 1) s.Name = s.Name.Split(' ')[0] + $" +{s.Level - 1}"; + } + else + { + Skill magic = skill.Copy(); + magic.AssociatedItemGuid = item.Guid; + magic.Level = skill.Level; + item.Skills.Magics.Add(magic); + } + } + item.Description = $"包含魔法:{string.Join(",", item.Skills.Magics.Select(m => m.Name + (m.Level > 1 ? $" +{m.Level - 1}" : "")))}\r\n" + + $"增加角色属性:{string.Join(",", strings)}"; + double total = str + agi + intelligence; + if (total > 18 && total <= 36) + { + item.QualityType = QualityType.Green; + } + else if (total > 36 && total <= 54) + { + item.QualityType = QualityType.Blue; + } + else if (total > 54 && total <= 72) + { + item.QualityType = QualityType.Purple; + } + else if (total > 72 && total <= 90) + { + item.QualityType = QualityType.Orange; + } + else if (total > 90 && total <= 108) + { + item.QualityType = QualityType.Red; + } + else if (total > 108) + { + item.QualityType = QualityType.Gold; + } + return item; + } + + public static double CalculateRating(CharacterStatistics stats, Team? team = null, CharacterStatistics[]? allStats = null) + { + double k = stats.Kills; + double a = stats.Assists; + double d = Math.Max(0, stats.Deaths); + double dmg = stats.TotalDamage + (stats.TotalTrueDamage * 0.2); + double heal = stats.TotalHeal + stats.TotalShield; + double cc = stats.ControlTime; + double taken = stats.TotalTakenDamage; + double live = stats.LiveTime; + + if (team != null) + { + double teamTotalDmg = allStats?.Sum(s => s.TotalDamage + s.TotalTrueDamage * 0.2) ?? dmg; + double teamTotalHeal = allStats?.Sum(s => s.TotalHeal + s.TotalShield) ?? heal; + int playerCount = allStats?.Length ?? 1; + + double dmgShare = dmg / Math.Max(2.3, teamTotalDmg); + double healShare = heal / Math.Max(1, teamTotalHeal); + double roleContribution = Math.Max(dmgShare, healShare) * playerCount * 0.6; + double roleScore = Math.Min(1.0, roleContribution); + + double kdaRatio = (k * 1.4 + a * 0.2) / (d + 1.8); + double kdaScore = Math.Min(1.0, (kdaRatio / 3.0) * 0.4); + + double ccScore = Math.Min(0.10, (cc / 60.0) * 0.05); + double tankScore = Math.Min(0.10, (taken / (d + 1) / 10000.0) * 0.1); + + double totalRating = roleScore + kdaScore + ccScore + tankScore; + + double avgDeaths = allStats?.Average(s => s.Deaths) ?? d; + if (d > avgDeaths && kdaRatio < 1.0) totalRating *= 0.75; + + return Math.Round(Math.Max(0.01, totalRating), 4); + } + else + { + int rank = stats.LastRank; + int totalPlayers = allStats?.Length ?? 10; + double maxKills = allStats?.Max(s => s.Kills) ?? k; + double maxDmg = allStats?.Max(s => s.TotalDamage + s.TotalTrueDamage * 0.2) ?? dmg; + + double rankScore = ((totalPlayers - rank + 1.0) / totalPlayers) * 0.8; + + double killPart = (k * 1.7 + a * 0.1) / Math.Max(1, maxKills + 1); + double dmgPart = (dmg / Math.Max(1, maxDmg * 1.8)) * 0.1; + double combatScore = Math.Min(0.8, killPart * 0.4 + dmgPart); + + double utilityScore = Math.Min(0.2, (cc / 60.0) * 0.04 + (heal / Math.Max(1, maxDmg)) * 0.05); + + double totalRating = rankScore + combatScore + utilityScore; + + if (k == 0) + { + totalRating *= 0.6; + } + + if (rank == 1 && k > 0) + { + if (k >= maxKills) totalRating += 0.15; + } + + if (rank > 5 && k >= maxKills * 0.8 && k > 0) + { + totalRating += 0.15; + } + + return Math.Round(Math.Max(0.01, totalRating), 4); + } + } + + public static void GetCharacterRating(Dictionary statistics, bool isTeam, List teams) + { + foreach (Character character in statistics.Keys) + { + Team? team = null; + CharacterStatistics[]? teammateStats = null; + if (isTeam) + { + team = teams.FirstOrDefault(t => t.IsOnThisTeam(character)); + if (team != null) + { + teammateStats = [.. statistics.Where(kv => team.Members.Contains(kv.Key)).Select(kv => kv.Value)]; + } + } + statistics[character].Rating = CalculateRating(statistics[character], team, teammateStats); + } + } + + /// + /// 用本局随机源生成物品 Id(原 依赖 DateTime.Now + new Random(),不可复现) + /// + /// Id 前缀("16"=魔法卡,"10"=卡包) + /// 本局随机源 + public static long CreateItemId(string prefix, Random random) + { + return Convert.ToInt64(prefix + random.Next(10_000_000, 100_000_000).ToString()); + } + } +} \ No newline at end of file diff --git a/OshimaBot.Game/Services/FunGameSimulation.cs b/OshimaBot.Game/Services/FunGameSimulation.cs new file mode 100644 index 0000000..f792c89 --- /dev/null +++ b/OshimaBot.Game/Services/FunGameSimulation.cs @@ -0,0 +1,1442 @@ +using System.IO.Compression; +using System.Text; +using System.Text.Json; +using OshimaBot.Game.Constants; +using FunGame.Core.Api; +using FunGame.Core.Entity; +using FunGame.Core.Interface.Base; +using FunGame.Core.Library.Constant; +using FunGame.Core.Model.EffectContext; +using FunGame.Core.Model.Framework; +using FunGame.Core.Model.Queue; +using OshimaBot.Content.Effects.OpenEffects; +using OshimaBot.Content.Skills; +using Milimoe.FunGameTesting.Others; + +namespace OshimaBot.Game.Services +{ + public class FunGameSimulation + { + public static Dictionary CharacterStatistics { get; } = []; + public static Dictionary TeamCharacterStatistics { get; } = []; + public static IReadOnlyList LastRecord { get; private set; } = []; + public static IReadOnlyList LastFullRecord { get; private set; } = []; + public static GameMap Map { get; } = new FastAutoMap(); + + public static void InitializeStatistics() + { + CharacterStatistics.Clear(); + TeamCharacterStatistics.Clear(); + LastRecord = []; + LastFullRecord = []; + + foreach (Character character in FunGameService.Characters) + { + CharacterStatistics.Add(character, new()); + TeamCharacterStatistics.Add(character, new()); + } + } + public static bool IsRuning { get; set; } = false; + public static bool IsWeb { get; set; } = false; + public static bool IsDebug { get; set; } = false; + public static bool PrintOut { get; set; } = false; + public static bool DeathMatchRoundDetail { get; set; } = false; + public static string Msg { get; set; } = ""; + + /// + /// 指定本局使用的随机种子;为 null 时每局自动随机
+ /// 设值后(或读取 得到的上一局实际值)同一份输入数据下整局模拟可复现 + ///
+ public static int? SeedOverride { get; set; } = null; + + /// + /// 固定武器 Id(0 = 不固定,按品质随机)。由 传入。 + /// 用于平衡测试时消除「武器攻击力 20–170(8.5×)+ 副属性各异 + 武器类型倍率 1.41×」这组混淆变量。 + /// + public static long FixedWeaponId { get; set; } = 0; + + /// + /// 本局实际使用的随机种子(开局确定并保留,便于复现) + /// + public static int Seed { get; private set; } = 0; + + /// + /// 模拟器自己的随机数生成器(由 决定) + /// 队列创建之前的角色抽选、技能分配、分队等走它;队列创建之后一律走 。 + /// 两者同源,因此本文件内禁止使用进程级的 Random.Shared,否则整局不可复现 + /// + public static Random Random { get; private set; } = new(); + + public static async Task> StartSimulationGame(SimulationOptions options) + { + PrintOut = options.PrintOut; + IsWeb = options.IsWeb; + DeathMatchRoundDetail = options.DeathMatchRoundDetail; + + // 展开为局部变量:方法体其余部分沿用旧参数名,保持最小改动 + bool isWeb = options.IsWeb; + bool isTeam = options.IsTeam; + bool deathMatchRoundDetail = options.DeathMatchRoundDetail; + int maxRespawnTimesMix = options.MaxRespawnTimesMix; + bool useStore = options.UseStore; + bool hasMap = options.HasMap; + bool isDebug = options.IsDebug; + + try + { + if (IsRuning) return ["游戏正在模拟中,请勿重复请求!"]; + + List result = []; + List lastRecord = []; + Msg = ""; + + IsRuning = true; + + // 本局种子:未指定则自动随机一次并保留实际值。 + // 局前随机(本类 Random)与局内随机(GamingQueue.Random)都由它派生,因此同种子整局可复现。 + Seed = SeedOverride ?? System.Random.Shared.Next(); + Random = new Random(Seed); + + // 固定武器(0 = 不固定);平衡测试用,消除武器带来的攻击力/副属性/类型倍率变量 + FixedWeaponId = options.FixedWeaponId; + + // 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 + + List list = [.. FunGameService.Characters.Select(c => c.Copy())]; + + if (list.Count > 10) + { + if (PrintOut) Console.WriteLine(); + if (PrintOut) Console.WriteLine("Start!!!"); + if (PrintOut) Console.WriteLine(); + + List characters = [.. list.OrderBy(o => Random.Next()).Take(10)]; + + // 起始等级:默认 10 / 2 / 2(与旧版硬编码一致);平衡测试可经 SimulationOptions 直接拉满 + // 到 60 / 6 / 8,使实测口径对齐《数值设计手册·判定基准》的标尺(否则会被低等级阶段稀释) + int clevel = options.CharacterLevel > 0 ? options.CharacterLevel : 10; + int slevel = options.SkillLevel > 0 ? options.SkillLevel : 2; + int mlevel = options.NormalAttackLevel > 0 ? options.NormalAttackLevel : 2; + + // 升级和赋能 + for (int index = 0; index < characters.Count; index++) + { + Character c = characters[index]; + c.Level = clevel; + c.NormalAttack.Level = mlevel; + FunGameService.AddCharacterSkills(c, 1, slevel, slevel); + foreach (Skill skillLoop in FunGameService.Skills.Where(s => s is not 疾走 && s is not 回复原状).OrderBy(o => Random.Next()).Take(3)) + { + Skill skill = skillLoop.Copy(); + skill.Character = c; + skill.Level = slevel; + c.Skills.Add(skill); + } + foreach (Skill skillLoop in FunGameService.CommonPassiveSkills.OrderBy(o => Random.Next()).Take(3)) + { + Skill passive = skillLoop.Copy(); + passive.Character = c; + passive.Level = 1; + c.Skills.Add(passive); + } + foreach (Skill skillLoop in FunGameService.CommonSuperSkills.OrderBy(o => Random.Next()).Take(3)) + { + Skill super = skillLoop.Copy(); + super.Character = c; + super.Level = slevel; + c.Skills.Add(super); + } + foreach (Effect e in c.Effects) + { + e.OnEffectLost(new HookContext(e.GamingQueue, c)); + } + } + + // 创建顺序表并排序(把本局种子交给队列:局内伤害浮动、AI 决策随机等全部由它派生) + GamingQueue actionQueue; + MixGamingQueue? mgq = null; + TeamGamingQueue? tgq = null; + if (isTeam) + { + tgq = new TeamGamingQueue(characters, WriteLine, seed: Seed) + { + MaxRespawnTimes = -1, + MaxScoreToWin = 30 + }; + actionQueue = tgq; + } + else + { + mgq = new MixGamingQueue(characters, WriteLine, seed: Seed) + { + MaxRespawnTimes = maxRespawnTimesMix + }; + actionQueue = mgq; + } + if (hasMap) actionQueue.LoadGameMap(Map); + actionQueue.UseQueueProtected = false; + if (PrintOut) Console.WriteLine(); + + // 总游戏时长 + double totalTime = 0; + + // 初始化商店 团队模式专供 + useStore = useStore && isTeam; + List store = []; + if (useStore) + { + AddStoreItems(actionQueue, store); + } + + // 开始空投 + Msg = ""; + WriteLine($"[种子] 本局模拟使用随机种子 {Seed}(同种子可复现整局)。"); + int mQuality = 0; + int wQuality = 0; + int aQuality = 0; + int sQuality = 0; + int acQuality = 0; + double nextDropTime = 0; + if (!useStore) + { + WriteLine($"社区送温暖了,现在随机发放空投!!"); + DropItems(actionQueue, mQuality, wQuality, aQuality, sQuality, acQuality, false); + WriteLine(""); + if (isWeb) result.Add("=== 空投 ===\r\n" + Msg); + nextDropTime = isTeam ? 90 : 60; + if (mQuality < 5) + { + mQuality++; + } + if (wQuality < 5) + { + wQuality++; + } + if (aQuality < 5) + { + aQuality++; + } + if (sQuality < 5) + { + sQuality++; + } + if (acQuality < 5) + { + acQuality++; + } + } + + // 显示角色信息 + if (PrintOut) characters.ForEach(c => Console.WriteLine(c.GetInfo())); + + // 初始化队列,准备开始游戏 + actionQueue.IsDebug = IsDebug || isDebug; + actionQueue.InitActionQueue(); + actionQueue.SetCharactersToAIControl(false, characters); + if (PrintOut) Console.WriteLine(); + + // 团队模式 + if (isTeam && actionQueue is TeamGamingQueue tg) + { + Msg = "=== 团队模式随机分组 ===\r\n\r\n"; + // 打乱角色列表 + List shuffledCharacters = [.. characters.OrderBy(c => actionQueue.Random.Next())]; + + // 创建两个团队 + List group1 = []; + List group2 = []; + + // 将角色交替分配到两个团队中 + for (int cid = 0; cid < shuffledCharacters.Count; cid++) + { + // 创建角色的用户,用于绑定金币 + User user = new() + { + Username = RandomNames.GenerateRandomChineseUserName(actionQueue.Random) + }; + user.Inventory.Credits = 20; + Character thisCharacter = shuffledCharacters[cid]; + //thisCharacter.User = user; + + if (cid % 2 == 0) + { + group1.Add(thisCharacter); + } + else + { + group2.Add(thisCharacter); + } + } + + // 添加到团队字典,第一个为队长 + tg.AddTeam($"{group1.First()}的小队", group1); + tg.AddTeam($"{group2.First()}的小队", group2); + + foreach (string team in tg.Teams.Keys) + { + WriteLine($"团队【{team}】的成员:\r\n{string.Join("\r\n", tg.Teams[team].Members)}\r\n"); + } + result.Add(Msg); + } + + // 显示初始顺序表 + actionQueue.DisplayQueue(); + if (PrintOut) Console.WriteLine(); + + actionQueue.CharacterDeathEvent += ActionQueue_CharacterDeath; + + // 地图放置角色 + if (actionQueue.Map != null) + { + GameMap map = actionQueue.Map; + HashSet allocated = []; + List allGrids = [.. map.Grids.Values]; + if (isTeam && tgq != null) + { + Team team1 = tgq.Teams.Values.First(); + Team team2 = tgq.Teams.Values.Last(); + + // 团队模式放置角色 + List team1Members = [.. team1.Members]; + List team2Members = [.. team2.Members]; + + // 获取地图尺寸 + int mapLength = map.Length; + int mapWidth = map.Width; + + // 放置队伍一在左下角区域 + PlaceTeamInCorner(actionQueue, map, team1Members, allocated, startX: 0, endX: mapLength / 4, startY: mapWidth * 3 / 4, endY: mapWidth - 1); + + // 放置队伍二在右上角区域 + PlaceTeamInCorner(actionQueue, map, team2Members, allocated, startX: mapLength * 3 / 4, endX: mapLength - 1, startY: 0, endY: mapWidth / 4); + } + else + { + // 非团队模式,随机放置角色 + foreach (Character character in characters) + { + character.NormalAttack.GamingQueue = actionQueue; + Grid grid = Grid.Empty; + do + { + grid = allGrids[actionQueue.Random.Next(allGrids.Count)]; + } + while (allocated.Contains(grid)); + allocated.Add(grid); + map.SetCharacterCurrentGrid(character, grid); + } + } + } + + // 总回合数 + int maxRound = 9999; + + // 随机回合奖励(特效池已迁入模组公共区域 RoundRewardPool) + // 只取一次随机结果并存下来:Keys 与取值必须来自同一份实例 + Dictionary> roundRewards = RoundRewardPool.Create(actionQueue.Random); + Dictionary effects = RoundRewardPool.BuildEffectMap(roundRewards.Keys); + actionQueue.InitRoundRewards(effects, options.BindToCharacter, id => roundRewards[(EffectID)id]); + + int i = 1; + while (i < maxRound) + { + if (i != 1) + { + lastRecord.Add(actionQueue.LastRound.ToString()); + } + + Msg = ""; + if (i == maxRound - 1) + { + if (isTeam) + { + WriteLine("两队打到天昏地暗,流局了!!"); + break; + } + else + { + WriteLine($"=== 终局审判 ==="); + Dictionary 他们的血量百分比 = []; + foreach (Character c in characters) + { + 他们的血量百分比.TryAdd(c, c.HP / c.MaxHP); + } + double max = 他们的血量百分比.Values.Max(); + Character winner = 他们的血量百分比.Keys.Where(c => 他们的血量百分比[c] == max).First(); + WriteLine("[ " + winner + " ] 成为了天选之人!!"); + foreach (Character c in characters.Where(c => c != winner && c.HP > 0)) + { + WriteLine("[ " + winner + " ] 对 [ " + c + " ] 造成了 99999999999 点真实伤害。"); + actionQueue.DeathCalculation(winner, c); + } + result.Add(Msg); + mgq?.EndGameInfo(winner); + break; + } + } + + // 检查是否有角色可以行动 + Character? characterToAct = actionQueue.NextCharacter(); + + // 处理回合 + if (characterToAct != null) + { + WriteLine($"=== Round {i++} [ Time: {totalTime} ] ==="); + WriteLine("现在是 [ " + characterToAct + (tgq != null ? "(" + (tgq.GetTeam(characterToAct)?.Name ?? "") + ")" : "") + " ] 的回合!"); + + bool isGameEnd = actionQueue.ProcessTurn(characterToAct); + + if (isGameEnd) + { + result.Add(Msg); + lastRecord.Add(actionQueue.LastRound.ToString()); + break; + } + + if (isWeb) actionQueue.DisplayQueue(); + WriteLine(""); + if (actionQueue.Map != null) + { + WriteLine(DisplayMapInConsole(actionQueue.Map)); + WriteLine(""); + } + } + + string roundMsg = ""; + if (actionQueue.LastRound.HasKill) + { + roundMsg = Msg; + if (!deathMatchRoundDetail) + { + roundMsg = actionQueue.LastRound.ToString().Trim() + $"\r\n{(tgq != null ? $"比分:{string.Join(" / ", tgq.Teams.Values.Select(t => $"{t.Name}({t.Score})"))},击杀来自{tgq.GetTeam(tgq.LastRound.Actor)}" : "")}\r\n"; + } + Msg = ""; + } + + // 模拟时间流逝 + double timeLapse = actionQueue.TimeLapse(); + totalTime = actionQueue.TotalTime; + nextDropTime -= timeLapse; + //Thread.Sleep(1); + + if (actionQueue.GameOver) + { + result.Add(Msg); + lastRecord.Add(actionQueue.LastRound.ToString()); + break; + } + + if (roundMsg != "") + { + if ((isTeam && deathMatchRoundDetail || !isTeam) && isWeb) + { + roundMsg += "\r\n" + Msg; + } + result.Add(roundMsg); + } + + // 模拟商店购买 + if (useStore) + { + // 发钱了 + foreach (Character character in actionQueue.HardnessTime.Keys) + { + character.User.Inventory.Credits += 3 * timeLapse; + } + BuyItems(actionQueue, store); + } + + // 周期空投:EnablePeriodicDrop=false 时跳过,只保留开局那次(DropItems(..., addLevel: false)), + // 使装备与技能池在整局内恒定,便于测量「技能在定态下的收益」 + if (!useStore && options.EnablePeriodicDrop && nextDropTime <= 0) + { + // 空投 + Msg = ""; + WriteLine($"社区送温暖了,现在随机发放空投!!"); + DropItems(actionQueue, mQuality, wQuality, aQuality, sQuality, acQuality); + WriteLine(""); + if (isWeb) result.Add("=== 空投 ===\r\n" + Msg); + nextDropTime = 40; + if (mQuality <= 5) + { + mQuality++; + } + if (wQuality <= 5) + { + wQuality++; + } + if (aQuality <= 5) + { + aQuality++; + } + if (sQuality <= 5) + { + sQuality++; + } + if (acQuality <= 5) + { + acQuality++; + } + } + } + + if (PrintOut) + { + Console.WriteLine("--- End ---"); + Console.WriteLine($"总游戏时长:{totalTime:0.##}"); + Console.WriteLine(""); + } + + // 赛后统计 + FunGameService.GetCharacterRating(actionQueue.CharacterStatistics, isTeam, tgq != null ? tgq.EliminatedTeams : []); + actionQueue.Rounds.Last().CharacterStatistics = actionQueue.CharacterStatistics; + + // 统计技术得分,评选 MVP + Character? mvp = actionQueue.CharacterStatistics.OrderByDescending(d => d.Value.Rating).Select(d => d.Key).FirstOrDefault(); + StringBuilder mvpBuilder = new(); + if (mvp != null) + { + CharacterStatistics stats = actionQueue.CharacterStatistics[mvp]; + stats.MVPs++; + mvpBuilder.AppendLine($"{(tgq != null ? "[ " + tgq.GetTeamFromEliminated(mvp)?.Name + " ] " : "")}[ {mvp.ToStringWithLevel()} ]"); + mvpBuilder.AppendLine($"技术得分:{stats.Rating:0.0#} / 击杀数:{stats.Kills} / 助攻数:{stats.Assists}{(actionQueue.MaxRespawnTimes != 0 ? " / 死亡数:" + stats.Deaths : "")}"); + mvpBuilder.AppendLine($"存活时长:{stats.LiveTime:0.##} / 存活回合数:{stats.LiveRound} / 行动回合数:{stats.ActionTurn} / 总计决策数:{stats.TurnDecisions} / 总计决策点:{stats.UseDecisionPoints}"); + mvpBuilder.AppendLine($"控制时长:{stats.ControlTime:0.##} / 总计治疗:{stats.TotalHeal:0.##} / 护盾抵消:{stats.TotalShield:0.##}"); + mvpBuilder.AppendLine($"总计伤害:{stats.TotalDamage:0.##} / 总计物理伤害:{stats.TotalPhysicalDamage:0.##} / 总计魔法伤害:{stats.TotalMagicDamage:0.##}"); + mvpBuilder.AppendLine($"总承受伤害:{stats.TotalTakenDamage:0.##} / 总承受物理伤害:{stats.TotalTakenPhysicalDamage:0.##} / 总承受魔法伤害:{stats.TotalTakenMagicDamage:0.##}"); + if (stats.TotalTrueDamage > 0 || stats.TotalTakenTrueDamage > 0) mvpBuilder.AppendLine($"总计真实伤害:{stats.TotalTrueDamage:0.##} / 总承受真实伤害:{stats.TotalTakenTrueDamage:0.##}"); + mvpBuilder.AppendLine($"每秒伤害:{stats.DamagePerSecond:0.##} / 每回合伤害:{stats.DamagePerTurn:0.##}"); + if (actionQueue.IsDebug) WriteLine(mvp.GetInfo()); + } + + int top = isWeb ? actionQueue.CharacterStatistics.Count : 0; // 回执多少个角色的统计信息 + int count = 1; + if (isWeb) + { + WriteLine("=== 技术得分排行榜 ==="); // 这是输出在界面上的 + Msg = $"=== 技术得分排行榜 TOP{top} ===\r\n"; // 这个是下一条给Result回执的标题,覆盖掉上面方法里的赋值了 + } + else + { + StringBuilder ratingBuilder = new(); + if (tgq != null) + { + ratingBuilder.AppendLine($"=== 赛后数据 ==="); + foreach (Team team in tgq.EliminatedTeams) + { + ratingBuilder.AppendLine($"☆--- [ {team} ] ---☆"); + foreach (Character character in tgq.CharacterStatistics.Where(d => team.Members.Contains(d.Key)) + .OrderByDescending(d => d.Value.Rating).Select(d => d.Key)) + { + CharacterStatistics stats = tgq.CharacterStatistics[character]; + ratingBuilder.AppendLine($"[ {stats.Rating:0.0#} ] {character}({stats.Kills} / {stats.Assists} / {stats.Deaths})"); + } + } + } + else if (mgq != null) + { + ratingBuilder.AppendLine($"=== 赛后数据 ==="); + foreach (Character statCharacter in actionQueue.CharacterStatistics + .OrderBy(kv => kv.Value.Deaths) + .ThenByDescending(kv => kv.Value.Rating) + .ThenByDescending(kv => kv.Value.Kills).Select(kv => kv.Key)) + { + CharacterStatistics stats = actionQueue.CharacterStatistics[statCharacter]; + ratingBuilder.AppendLine($"[ {stats.Rating:0.0#} ] {statCharacter}({stats.Kills} / {stats.Assists} / {stats.Deaths})"); + } + } + WriteLine("=== 本场比赛最佳角色 ==="); + Msg = $"=== 本场比赛最佳角色 ===\r\n"; + WriteLine(mvpBuilder.ToString() + "\r\n\r\n" + ratingBuilder.ToString()); + + if (PrintOut) + { + Console.WriteLine(); + Console.WriteLine("=== 技术得分排行榜 ==="); + } + } + + if (tgq != null) + { + foreach (Character character in tgq.CharacterStatistics.OrderByDescending(d => d.Value.Rating).Select(d => d.Key)) + { + StringBuilder builder = new(); + CharacterStatistics stats = tgq.CharacterStatistics[character]; + builder.AppendLine($"{(isWeb ? count + "." : ("[ " + tgq.GetTeamFromEliminated(character)?.Name + " ]" ?? ""))} [ {character.ToStringWithLevel()} ]"); + builder.AppendLine($"技术得分:{stats.Rating:0.0#} / 击杀数:{stats.Kills} / 助攻数:{stats.Assists}{(tgq.MaxRespawnTimes != 0 ? " / 死亡数:" + stats.Deaths : "")}"); + builder.AppendLine($"存活时长:{stats.LiveTime:0.##} / 存活回合数:{stats.LiveRound} / 行动回合数:{stats.ActionTurn} / 总计决策数:{stats.TurnDecisions} / 总计决策点:{stats.UseDecisionPoints}"); + builder.AppendLine($"控制时长:{stats.ControlTime:0.##} / 总计治疗:{stats.TotalHeal:0.##} / 护盾抵消:{stats.TotalShield:0.##}"); + builder.AppendLine($"总计伤害:{stats.TotalDamage:0.##} / 总计物理伤害:{stats.TotalPhysicalDamage:0.##} / 总计魔法伤害:{stats.TotalMagicDamage:0.##}"); + builder.AppendLine($"总承受伤害:{stats.TotalTakenDamage:0.##} / 总承受物理伤害:{stats.TotalTakenPhysicalDamage:0.##} / 总承受魔法伤害:{stats.TotalTakenMagicDamage:0.##}"); + if (stats.TotalTrueDamage > 0 || stats.TotalTakenTrueDamage > 0) builder.AppendLine($"总计真实伤害:{stats.TotalTrueDamage:0.##} / 总承受真实伤害:{stats.TotalTakenTrueDamage:0.##}"); + builder.Append($"每秒伤害:{stats.DamagePerSecond:0.##} / 每回合伤害:{stats.DamagePerTurn:0.##}"); + if (count++ <= top) + { + WriteLine(builder.ToString()); + } + else + { + if (PrintOut) Console.WriteLine(builder.ToString()); + } + + if (!useStore) + { + CharacterStatistics? totalStats = TeamCharacterStatistics.Where(kv => kv.Key.GetName() == character.GetName()).Select(kv => kv.Value).FirstOrDefault(); + if (totalStats != null) + { + UpdateStatistics(totalStats, stats); + } + } + } + } + else + { + foreach (Character character in actionQueue.CharacterStatistics.OrderByDescending(d => d.Value.Rating).Select(d => d.Key)) + { + StringBuilder builder = new(); + CharacterStatistics stats = actionQueue.CharacterStatistics[character]; + builder.AppendLine($"{(isWeb ? count + ". " : "")}[ {character.ToStringWithLevel()} ]"); + builder.AppendLine($"技术得分:{stats.Rating:0.0#} / 击杀数:{stats.Kills} / 助攻数:{stats.Assists}{(actionQueue.MaxRespawnTimes != 0 ? " / 死亡数:" + stats.Deaths : "")}"); + builder.AppendLine($"存活时长:{stats.LiveTime:0.##} / 存活回合数:{stats.LiveRound} / 行动回合数:{stats.ActionTurn} / 总计决策数:{stats.TurnDecisions} / 总计决策点:{stats.UseDecisionPoints}"); + builder.AppendLine($"控制时长:{stats.ControlTime:0.##} / 总计治疗:{stats.TotalHeal:0.##} / 护盾抵消:{stats.TotalShield:0.##}"); + builder.AppendLine($"总计伤害:{stats.TotalDamage:0.##} / 总计物理伤害:{stats.TotalPhysicalDamage:0.##} / 总计魔法伤害:{stats.TotalMagicDamage:0.##}"); + builder.AppendLine($"总承受伤害:{stats.TotalTakenDamage:0.##} / 总承受物理伤害:{stats.TotalTakenPhysicalDamage:0.##} / 总承受魔法伤害:{stats.TotalTakenMagicDamage:0.##}"); + if (stats.TotalTrueDamage > 0 || stats.TotalTakenTrueDamage > 0) builder.AppendLine($"总计真实伤害:{stats.TotalTrueDamage:0.##} / 总承受真实伤害:{stats.TotalTakenTrueDamage:0.##}"); + builder.Append($"每秒伤害:{stats.DamagePerSecond:0.##} / 每回合伤害:{stats.DamagePerTurn:0.##}"); + if (count++ <= top) + { + WriteLine(builder.ToString()); + } + else + { + if (PrintOut) Console.WriteLine(builder.ToString()); + } + + if (!useStore) + { + CharacterStatistics? totalStats = CharacterStatistics.Where(kv => kv.Key.GetName() == character.GetName()).Select(kv => kv.Value).FirstOrDefault(); + if (totalStats != null) + { + UpdateStatistics(totalStats, stats); + } + } + } + } + + result.Add(Msg); + lastRecord.Add(Msg); + + // 显示每个角色的信息 + if (isWeb) + { + if (tgq != null) + { + top = 1; + for (i = tgq.EliminatedTeams.Count - 1; i >= 0; i--) + { + Team team = tgq.EliminatedTeams[i]; + string topTeam = ""; + if (top == 1) + { + topTeam = "冠军"; + } + if (top == 2) + { + topTeam = "亚军"; + } + if (top == 3) + { + topTeam = "季军"; + } + if (top > 3) + { + topTeam = $"第 {top} 名"; + } + foreach (Character character in team.Members) + { + string msg = $"== {topTeam}团队 [ {team.Name} ] ==\r\n== 角色:[ {character} ] ==\r\n{character.GetInfo()}"; + result.Add(msg); + lastRecord.Add(msg); + } + top++; + } + } + else + { + for (i = actionQueue.Eliminated.Count - 1; i >= 0; i--) + { + Character character = actionQueue.Eliminated[i]; + string msg = $"=== 角色 [ {character} ] ===\r\n{character.GetInfo()}"; + result.Add(msg); + lastRecord.Add(msg); + } + } + } + + string zipFileName = "rounds_archive.zip"; + try + { + WriteRoundsToZip(actionQueue.Rounds.ToDictionary(kv => kv.Round, kv => kv), zipFileName); + } + catch (Exception ex) + { + // 档案落盘失败(IO/权限/磁盘满等)不应连带丢弃整局模拟结果 + string msg = $"回合记录写入失败({zipFileName}):{ex.Message}"; + Console.WriteLine(ex); + result.Add(msg); + lastRecord.Add(msg); + } + + LastRecord = result; + LastFullRecord = lastRecord; + IsRuning = false; + } + + return result; + } + catch (Exception ex) + { + IsRuning = false; + Console.WriteLine(ex); + return [ex.ToString()]; + } + } + + private static bool ActionQueue_CharacterDeath(DeathContext ctx) + { + if (ctx.Trigger is not Character death) return true; + death.Items.Clear(); + return true; + } + + /// + /// 将回合记录字典序列化为 JSON,然后压缩并写入 ZIP 文件 + /// + /// 逐回合容错:单个回合序列化失败(例如历史版本因同名技能重复键抛出的 ArgumentException) + /// 只跳过该回合,并把原因写入同档案的 rounds_skipped.json,其余回合与整局结果不受影响。 + /// 逐回合序列化到字符串后再 输出, + /// 保证失败回合不会在主 JSON 里留下半截对象;内存里同时只保留一个回合的 JSON。 + /// + /// 要写入的字典数据 + /// 输出的 ZIP 文件路径 + /// 被跳过的回合及其原因(未跳过时为空列表) + public static List<(int Round, string Error)> WriteRoundsToZip(Dictionary roundsData, string zipFilePath) + { + // 确保目标目录存在 + string? directory = Path.GetDirectoryName(zipFilePath); + if (!string.IsNullOrEmpty(directory) && !Directory.Exists(directory)) + { + Directory.CreateDirectory(directory); + } + + List<(int Round, string Error)> skipped = []; + + // 创建 ZIP 文件 + using FileStream zipFileStream = new(zipFilePath, FileMode.Create); + using ZipArchive zipArchive = new(zipFileStream, ZipArchiveMode.Create); + // 在 ZIP 档案中创建一个条目来存放 JSON 数据 + ZipArchiveEntry jsonEntry = zipArchive.CreateEntry("rounds_data.json", CompressionLevel.Optimal); + + // 手动写出字典外壳,逐回合序列化:坏回合可以单独跳过 + using (Stream entryStream = jsonEntry.Open()) + { + using Utf8JsonWriter writer = new(entryStream); + writer.WriteStartObject(); + foreach (KeyValuePair kv in roundsData) + { + string roundJson; + try + { + roundJson = JsonSerializer.Serialize(kv.Value, JsonTool.JsonSerializerOptions); + } + catch (Exception ex) + { + skipped.Add((kv.Key, $"{ex.GetType().Name}: {ex.Message}")); + Console.WriteLine($"[警告] 第 {kv.Key} 回合序列化失败,已跳过:{ex.Message}"); + continue; + } + + writer.WritePropertyName(kv.Key.ToString()); + // 内容由 System.Text.Json 自己产出,必然是合法 JSON,跳过二次校验 + writer.WriteRawValue(roundJson, skipInputValidation: true); + } + writer.WriteEndObject(); + } + + if (skipped.Count > 0) + { + ZipArchiveEntry skippedEntry = zipArchive.CreateEntry("rounds_skipped.json", CompressionLevel.Optimal); + using Stream skippedStream = skippedEntry.Open(); + using Utf8JsonWriter skippedWriter = new(skippedStream, new JsonWriterOptions { Indented = true }); + skippedWriter.WriteStartArray(); + foreach ((int round, string error) in skipped) + { + skippedWriter.WriteStartObject(); + skippedWriter.WriteNumber("Round", round); + skippedWriter.WriteString("Error", error); + skippedWriter.WriteEndObject(); + } + skippedWriter.WriteEndArray(); + + Console.WriteLine($"回合记录已写入到: {zipFilePath},其中 {skipped.Count} 个回合因序列化失败被跳过(详见 rounds_skipped.json)。"); + } + else + { + Console.WriteLine($"回合记录已成功序列化、压缩并写入到: {zipFilePath}"); + } + + return skipped; + } + + /// + /// 从 ZIP 文件中读取并解压 JSON 数据,然后反序列化为回合记录字典 + /// + /// 输入的 ZIP 文件路径 + /// 反序列化后的字典数据 + public static Dictionary? ReadRoundsFromZip(string zipFilePath) + { + if (!File.Exists(zipFilePath)) + { + Console.WriteLine($"错误: 文件不存在 {zipFilePath}"); + return null; + } + + Dictionary? roundsData; + + // 打开 ZIP 文件 + using FileStream? zipFileStream = new(zipFilePath, FileMode.Open); + using ZipArchive? zipArchive = new(zipFileStream, ZipArchiveMode.Read); + ZipArchiveEntry? jsonEntry = zipArchive.GetEntry("rounds_data.json"); + + if (jsonEntry == null) + { + Console.WriteLine($"错误: ZIP 档案中找不到 'rounds_data.json' 条目。"); + return null; + } + + // 获取条目的流,从这个流中读取 JSON 数据 + using Stream? entryStream = jsonEntry.Open(); + try + { + roundsData = JsonSerializer.Deserialize>(entryStream, JsonTool.JsonSerializerOptions); + } + catch (JsonException ex) + { + Console.WriteLine($"JSON 反序列化错误: {ex.Message}"); + return null; + } + catch (Exception ex) + { + Console.WriteLine($"读取或反序列化过程中发生未知错误: {ex.Message}"); + return null; + } + + Console.WriteLine($"回合记录已成功从 {zipFilePath} 读取、解压并反序列化。"); + return roundsData; + } + + public static void WriteLine(string str) + { + Msg += str + "\r\n"; + if (PrintOut) Console.WriteLine(str); + } + + public static void AddStoreItems(GamingQueue queue, List store) + { + foreach (Item item in FunGameService.Equipment) + { + Item realItem = item.Copy(); + realItem.SetGamingQueue(queue); + realItem.Price = queue.Random.Next(1, 10) * ((int)item.QualityType + 1) * 2; + store.Add(realItem); + } + } + + public static void BuyItems(GamingQueue queue, List store) + { + // 升级成本 + double costLevel = 20; + + // 卡包购买/升级成本 + Dictionary costMCP = new() + { + { QualityType.White, 5 }, // 普通 + { QualityType.Green, 10 }, // 优秀 + { QualityType.Blue, 15 }, // 稀有 + { QualityType.Purple, 20 }, // 史诗 + { QualityType.Orange, 25 }, // 传说 + }; + + foreach (Character character in queue.HardnessTime.Keys) + { + // 购买欲望,可以加多个判断 + List> funcs = [ + () => queue.Random.NextDouble() > 0.3 + ]; + + if (funcs.All(f => f())) + { + // 定义操作的概率(优先级) + Dictionary pOperations = new() + { + { "升级角色", 0.8 }, // 会同时升级技能等级,优先级高 + { "买卡包", 0.6 }, // 会获得属性加成和魔法技能,优先级高 + { "买武器", 0.4 }, // 提升攻击力 + { "买防具", 0.4 }, // 提升防御性能 + { "买鞋子", 0.4 }, // 提升速度 + { "买饰品", 0.4 } // 提升综合能力 + }; + + // 记录操作 + Dictionary operation = new() + { + { "升级角色", false }, + { "买卡包", false }, + { "买武器", false }, + { "买防具", false }, + { "买鞋子", false }, + { "买饰品", false } + }; + + // 本次购买只提升? + bool onlyLarger = queue.Random.NextDouble() > 0.3; + + bool buy = true; + int failedBuyTimes = 0; + while (buy && pOperations.Values.Any(o => o != 0) && operation.Values.Any(o => o == false)) + { + // 先看手上的钱能买什么 + IEnumerable canBuys = store.Where(i => i.Price <= character.User.Inventory.Credits); + + // 然后看能买的东西里,是否品质符合 + Item[] weapons = [.. canBuys.Where(i => i.ItemType == ItemType.Weapon && + (onlyLarger ? (int)i.QualityType > Convert.ToInt32(character.EquipSlot.Weapon?.QualityType) : (int)i.QualityType >= Convert.ToInt32(character.EquipSlot.Weapon?.QualityType)))]; + Item[] armors = [.. canBuys.Where(i => i.ItemType == ItemType.Armor && + (onlyLarger ? (int)i.QualityType > Convert.ToInt32(character.EquipSlot.Armor?.QualityType) : (int)i.QualityType >= Convert.ToInt32(character.EquipSlot.Armor?.QualityType)))]; + Item[] shoes = [.. canBuys.Where(i => i.ItemType == ItemType.Shoes && + (onlyLarger ? (int)i.QualityType > Convert.ToInt32(character.EquipSlot.Shoes?.QualityType) : (int)i.QualityType >= Convert.ToInt32(character.EquipSlot.Shoes?.QualityType)))]; + Item[] accessories = [.. canBuys.Where(i => i.ItemType == ItemType.Accessory && + (onlyLarger ? (int)i.QualityType > Math.Min(Convert.ToInt32(character.EquipSlot.Accessory1?.QualityType), Convert.ToInt32(character.EquipSlot.Accessory2?.QualityType)) + : (int)i.QualityType >= Math.Min(Convert.ToInt32(character.EquipSlot.Accessory1?.QualityType), Convert.ToInt32(character.EquipSlot.Accessory2?.QualityType))))]; + + // 魔法卡包单独列出 + int mQuality = Convert.ToInt32(character.EquipSlot.MagicCardPack?.QualityType); + + if (character.User.Inventory.Credits < costLevel) + { + pOperations["升级角色"] = 0; + } + + if (character.User.Inventory.Credits < costMCP[(QualityType)mQuality]) + { + pOperations["买卡包"] = 0; + } + + if (weapons.Length == 0) + { + pOperations["买武器"] = 0; + } + + if (armors.Length == 0) + { + pOperations["买防具"] = 0; + } + + if (shoes.Length == 0) + { + pOperations["买鞋子"] = 0; + } + + if (accessories.Length == 0) + { + pOperations["买饰品"] = 0; + } + + double p = queue.Random.NextDouble(); + + foreach (KeyValuePair kvp in pOperations.OrderByDescending(kv => kv.Value)) + { + string op = ""; + if (kvp.Value != 0 && p <= kvp.Value) + { + op = kvp.Key; + } + else + { + continue; + } + switch (op) + { + case "升级角色": + // 钱够吗? + if (character.User.Inventory.Credits >= costLevel) + { + character.User.Inventory.Credits -= costLevel; + operation["升级角色"] = true; + character.SetLevel(character.Level + 10, false); + character.NormalAttack.Level += 2; + foreach (Skill skill in character.Skills) + { + if (skill.SkillType == SkillType.Passive) continue; + skill.Level += 2; + } + Character? original = queue.Original[character.Guid]; + if (original != null) + { + original.Level += 10; + original.NormalAttack.Level += 2; + foreach (Skill skill in original.Skills) + { + if (skill.SkillType == SkillType.Passive) continue; + skill.Level += 2; + } + } + WriteLine($"[ {character} ] 消费了 {costLevel} {General.GameplayEquilibriumConstant.InGameCurrency},购买了【升级角色】!当前角色 {character.Level} 级,技能 {character.NormalAttack.Level} 级(战技、爆发技最高 6 级)。"); + } + else failedBuyTimes++; + break; + case "买卡包": + // 看角色能购买的最高级卡包是什么 + QualityType canBuyMCP = costMCP.Where(kv => (int)kv.Key >= mQuality && character.User.Inventory.Credits >= kv.Value).OrderByDescending(kv => kv.Value).Select(kv => kv.Key).FirstOrDefault(); + double mcpCost = costMCP[canBuyMCP]; + // 买卡包 + if (character.User.Inventory.Credits >= mcpCost) + { + character.User.Inventory.Credits -= mcpCost; + operation["买卡包"] = true; + Item? mcp = FunGameService.GenerateCoreMagicCardPack(queue.Random, 3, canBuyMCP); + if (mcp != null) + { + foreach (Skill magic in mcp.Skills.Magics) + { + magic.Level = character.NormalAttack.Level; + } + mcp.SetGamingQueue(queue); + WriteLine($"[ {character} ] 消费了 {mcpCost} {General.GameplayEquilibriumConstant.InGameCurrency},购买了【卡包-{mcp.Name}】!详细说明:\r\n{mcp}"); + queue.Equip(character, mcp); + } + } + else failedBuyTimes++; + break; + case "买武器": + Item weapon = weapons[queue.Random.Next(weapons.Length)]; + double wCost = weapon.Price; + if (character.User.Inventory.Credits >= wCost) + { + character.User.Inventory.Credits -= wCost; + operation["买武器"] = true; + Item realItem = weapon.Copy(); + realItem.SetGamingQueue(queue); + WriteLine($"[ {character} ] 消费了 {wCost} {General.GameplayEquilibriumConstant.InGameCurrency},购买了武器-{realItem.Name}!详细说明:\r\n{realItem}"); + queue.Equip(character, realItem); + } + else failedBuyTimes++; + break; + case "买防具": + Item armor = armors[queue.Random.Next(armors.Length)]; + double aCost = armor.Price; + if (character.User.Inventory.Credits >= aCost) + { + character.User.Inventory.Credits -= aCost; + operation["买防具"] = true; + Item realItem = armor.Copy(); + realItem.SetGamingQueue(queue); + WriteLine($"[ {character} ] 消费了 {aCost} {General.GameplayEquilibriumConstant.InGameCurrency},购买了防具-{realItem.Name}!详细说明:\r\n{realItem}"); + queue.Equip(character, realItem); + } + else failedBuyTimes++; + break; + case "买鞋子": + Item shoe = shoes[queue.Random.Next(shoes.Length)]; + double sCost = shoe.Price; + if (character.User.Inventory.Credits >= sCost) + { + character.User.Inventory.Credits -= sCost; + operation["买鞋子"] = true; + Item realItem = shoe.Copy(); + realItem.SetGamingQueue(queue); + WriteLine($"[ {character} ] 消费了 {sCost} {General.GameplayEquilibriumConstant.InGameCurrency},购买了鞋子-{realItem.Name}!详细说明:\r\n{realItem}"); + queue.Equip(character, realItem); + } + else failedBuyTimes++; + break; + case "买饰品": + Item accessory = accessories[queue.Random.Next(accessories.Length)]; + double acCost = accessory.Price; + if (character.User.Inventory.Credits >= acCost) + { + character.User.Inventory.Credits -= acCost; + operation["买饰品"] = true; + Item realItem = accessory.Copy(); + realItem.SetGamingQueue(queue); + WriteLine($"[ {character} ] 消费了 {acCost} {General.GameplayEquilibriumConstant.InGameCurrency},购买了饰品-{realItem.Name}!详细说明:\r\n{realItem}"); + queue.Equip(character, realItem); + } + else failedBuyTimes++; + break; + default: + break; + } + } + // 看还要不要买,超过两次购买失败说明没钱别买了 + buy = failedBuyTimes < 2 && funcs.All(f => f()); + } + WriteLine($"[ {character} ] 结束购买,剩余{General.GameplayEquilibriumConstant.InGameCurrency}:{character.User.Inventory.Credits:0.00}。"); + } + } + } + + public static void DropItems(GamingQueue queue, int mQuality, int wQuality, int aQuality, int sQuality, int acQuality, bool addLevel = true) + { + Item[] weapons = [.. FunGameService.Equipment.Where(i => i.ItemType == ItemType.Weapon && (wQuality >= 5 && (int)i.QualityType >= 5 || wQuality < 5 && (int)i.QualityType == wQuality))]; + Item[] armors = [.. FunGameService.Equipment.Where(i => i.ItemType == ItemType.Armor && (aQuality >= 5 && (int)i.QualityType >= 5 || aQuality < 5 && (int)i.QualityType == aQuality))]; + Item[] shoes = [.. FunGameService.Equipment.Where(i => i.ItemType == ItemType.Shoes && (sQuality >= 5 && (int)i.QualityType >= 5 || sQuality < 5 && (int)i.QualityType == sQuality))]; + Item[] accessories = [.. FunGameService.Equipment.Where(i => i.ItemType == ItemType.Accessory && (acQuality >= 5 && (int)i.QualityType >= 5 || acQuality < 5 && (int)i.QualityType == acQuality))]; + Item[] consumables = [.. FunGameService.AllItems.Where(i => i.ItemType == ItemType.Consumable && i.IsInGameItem)]; + foreach (Character character in queue.AllCharacters) + { + if (addLevel) + { + character.SetLevel(character.Level + 8, false); + character.NormalAttack.Level += 1; + foreach (Skill skill in character.Skills) + { + if (skill.SkillType == SkillType.Passive) continue; + skill.Level += 1; + } + Character? original = queue.Original[character.Guid]; + if (original != null) + { + original.Level += 8; + original.NormalAttack.Level += 1; + foreach (Skill skill in original.Skills) + { + if (skill.SkillType == SkillType.Passive) continue; + skill.Level += 1; + } + } + } + Item? mcp = FunGameService.GenerateCoreMagicCardPack(queue.Random, 3, (QualityType)mQuality); + if (mcp != null) + { + foreach (Skill magic in mcp.Skills.Magics) + { + magic.Level = character.NormalAttack.Level; + } + mcp.SetGamingQueue(queue); + queue.Equip(character, mcp); + } + if (wQuality == -1 && aQuality == -1 && sQuality == -1 && acQuality == -1) + { + continue; + } + Item? weapon = null, armor = null, shoe = null, accessory1 = null, accessory2 = null; + if (FixedWeaponId != 0) + { + // 平衡测试:固定武器,消除「攻击力 20–170(8.5×)+ 副属性各异 + 类型倍率 1.41×」的混淆 + weapon = FunGameService.Equipment.FirstOrDefault(i => i.Id == FixedWeaponId) + ?? FunGameService.AllItems.FirstOrDefault(i => i.Id == FixedWeaponId); + } + if (weapon == null && weapons.Length > 0) + { + weapon = weapons[queue.Random.Next(weapons.Length)]; + } + if (armors.Length > 0) + { + armor = armors[queue.Random.Next(armors.Length)]; + } + if (shoes.Length > 0) + { + shoe = shoes[queue.Random.Next(shoes.Length)]; + } + if (accessories.Length > 0) + { + accessory1 = accessories[queue.Random.Next(accessories.Length)]; + } + if (accessories.Length > 0) + { + accessory2 = accessories[queue.Random.Next(accessories.Length)]; + } + List thisDrops = []; + if (weapon != null) thisDrops.Add(weapon); + if (armor != null) thisDrops.Add(armor); + if (shoe != null) thisDrops.Add(shoe); + if (accessory1 != null) thisDrops.Add(accessory1); + if (accessory2 != null) thisDrops.Add(accessory2); + foreach (Item item in thisDrops) + { + Item realItem = item.Copy(); + realItem.SetGamingQueue(queue); + queue.Equip(character, realItem); + } + if (consumables.Length > 0 && character.Items.Count < 5) + { + for (int i = 0; i < 2; i++) + { + Item consumable = consumables[queue.Random.Next(consumables.Length)].Copy(); + character.Items.Add(consumable); + } + } + } + } + + public static void UpdateStatistics(CharacterStatistics totalStats, CharacterStatistics stats) + { + // 统计此角色的所有数据 + totalStats.TotalDamage = Calculation.Round2Digits(totalStats.TotalDamage + stats.TotalDamage); + totalStats.TotalPhysicalDamage = Calculation.Round2Digits(totalStats.TotalPhysicalDamage + stats.TotalPhysicalDamage); + totalStats.TotalMagicDamage = Calculation.Round2Digits(totalStats.TotalMagicDamage + stats.TotalMagicDamage); + totalStats.TotalTrueDamage = Calculation.Round2Digits(totalStats.TotalTrueDamage + stats.TotalTrueDamage); + totalStats.TotalTakenDamage = Calculation.Round2Digits(totalStats.TotalTakenDamage + stats.TotalTakenDamage); + totalStats.TotalTakenPhysicalDamage = Calculation.Round2Digits(totalStats.TotalTakenPhysicalDamage + stats.TotalTakenPhysicalDamage); + totalStats.TotalTakenMagicDamage = Calculation.Round2Digits(totalStats.TotalTakenMagicDamage + stats.TotalTakenMagicDamage); + totalStats.TotalTakenTrueDamage = Calculation.Round2Digits(totalStats.TotalTakenTrueDamage + stats.TotalTakenTrueDamage); + totalStats.TotalHeal = Calculation.Round2Digits(totalStats.TotalHeal + stats.TotalHeal); + totalStats.LiveRound += stats.LiveRound; + totalStats.ActionTurn += stats.ActionTurn; + totalStats.LiveTime = Calculation.Round2Digits(totalStats.LiveTime + stats.LiveTime); + totalStats.ControlTime = Calculation.Round2Digits(totalStats.ControlTime + stats.ControlTime); + totalStats.TotalShield = Calculation.Round2Digits(totalStats.TotalShield + stats.TotalShield); + totalStats.TotalEarnedMoney += stats.TotalEarnedMoney; + totalStats.Kills += stats.Kills; + totalStats.Deaths += stats.Deaths; + totalStats.Assists += stats.Assists; + totalStats.FirstKills += stats.FirstKills; + totalStats.FirstDeaths += stats.FirstDeaths; + totalStats.LastRank = stats.LastRank; + double totalRank = totalStats.AvgRank * totalStats.Plays + totalStats.LastRank; + double totalRating = totalStats.Rating * totalStats.Plays + stats.Rating; + totalStats.Plays += stats.Plays; + if (totalStats.Plays != 0) totalStats.AvgRank = Calculation.Round2Digits(totalRank / totalStats.Plays); + else totalStats.AvgRank = stats.LastRank; + if (totalStats.Plays != 0) totalStats.Rating = Calculation.Round4Digits(totalRating / totalStats.Plays); + else totalStats.Rating = stats.Rating; + totalStats.Wins += stats.Wins; + totalStats.Top3s += stats.Top3s; + totalStats.Loses += stats.Loses; + totalStats.MVPs += stats.MVPs; + totalStats.UseDecisionPoints += stats.UseDecisionPoints; + totalStats.TurnDecisions += stats.TurnDecisions; + if (totalStats.Plays != 0) + { + totalStats.AvgDamage = Calculation.Round2Digits(totalStats.TotalDamage / totalStats.Plays); + totalStats.AvgPhysicalDamage = Calculation.Round2Digits(totalStats.TotalPhysicalDamage / totalStats.Plays); + totalStats.AvgMagicDamage = Calculation.Round2Digits(totalStats.TotalMagicDamage / totalStats.Plays); + totalStats.AvgTrueDamage = Calculation.Round2Digits(totalStats.TotalTrueDamage / totalStats.Plays); + totalStats.AvgTakenDamage = Calculation.Round2Digits(totalStats.TotalTakenDamage / totalStats.Plays); + totalStats.AvgTakenPhysicalDamage = Calculation.Round2Digits(totalStats.TotalTakenPhysicalDamage / totalStats.Plays); + totalStats.AvgTakenMagicDamage = Calculation.Round2Digits(totalStats.TotalTakenMagicDamage / totalStats.Plays); + totalStats.AvgTakenTrueDamage = Calculation.Round2Digits(totalStats.TotalTakenTrueDamage / totalStats.Plays); + totalStats.AvgHeal = Calculation.Round2Digits(totalStats.TotalHeal / totalStats.Plays); + totalStats.AvgLiveRound = totalStats.LiveRound / totalStats.Plays; + totalStats.AvgActionTurn = totalStats.ActionTurn / totalStats.Plays; + totalStats.AvgLiveTime = Calculation.Round2Digits(totalStats.LiveTime / totalStats.Plays); + totalStats.AvgControlTime = Calculation.Round2Digits(totalStats.ControlTime / totalStats.Plays); + totalStats.AvgShield = Calculation.Round2Digits(totalStats.TotalShield / totalStats.Plays); + totalStats.AvgEarnedMoney = totalStats.TotalEarnedMoney / totalStats.Plays; + totalStats.Winrate = Calculation.Round4Digits(Convert.ToDouble(totalStats.Wins) / Convert.ToDouble(totalStats.Plays)); + totalStats.Top3rate = Calculation.Round4Digits(Convert.ToDouble(totalStats.Top3s) / Convert.ToDouble(totalStats.Plays)); + totalStats.AvgUseDecisionPoints = totalStats.UseDecisionPoints / totalStats.Plays; + totalStats.AvgTurnDecisions = totalStats.TurnDecisions / totalStats.Plays; + } + if (totalStats.LiveRound != 0) totalStats.DamagePerRound = Calculation.Round2Digits(totalStats.TotalDamage / totalStats.LiveRound); + if (totalStats.ActionTurn != 0) totalStats.DamagePerTurn = Calculation.Round2Digits(totalStats.TotalDamage / totalStats.ActionTurn); + if (totalStats.LiveTime != 0) totalStats.DamagePerSecond = Calculation.Round2Digits(totalStats.TotalDamage / totalStats.LiveTime); + } + + private static void PlaceTeamInCorner(GamingQueue queue, GameMap map, List teamMembers, HashSet allocated, int startX, int endX, int startY, int endY) + { + // 确保坐标有效 + startX = Math.Clamp(startX, 0, map.Length - 1); + endX = Math.Clamp(endX, 0, map.Length - 1); + startY = Math.Clamp(startY, 0, map.Width - 1); + endY = Math.Clamp(endY, 0, map.Width - 1); + + // 计算可用空间 + int availableWidth = endX - startX + 1; + int availableHeight = endY - startY + 1; + + // 计算每行最多角色数(保持至少2格间距) + int maxPerRow = Math.Min(availableWidth, Math.Max(1, availableWidth / 3)); + + // 计算起始位置 + int currentX = startX; + int currentY = endY; // 从底部开始放置 + + foreach (Character character in teamMembers) + { + character.NormalAttack.GamingQueue = queue; + Grid? grid = null; + int attempts = 0; + + // 尝试在指定区域找到合适位置 + do + { + // 获取网格 + grid = map[currentX, currentY, 0]; + + // 如果网格无效或已被占用,尝试下一个位置 + if (grid == null || allocated.Contains(grid)) + { + // 移动到下一个位置 + currentX++; + + // 换行处理 + if (currentX > endX || currentX - startX >= maxPerRow) + { + currentX = startX; + currentY--; // 向上移动一行 + + // 如果超出区域,回到底部 + if (currentY < startY) + { + currentY = endY; + } + } + } + + attempts++; + + // 如果尝试次数过多,使用随机位置 + if (attempts > teamMembers.Count * 2) + { + grid = GetRandomGridInArea(queue.Random, map, allocated, startX, endX, startY, endY); + break; + } + } + while (grid == null || allocated.Contains(grid)); + + // 放置角色 + if (grid != null) + { + allocated.Add(grid); + map.SetCharacterCurrentGrid(character, grid); + + // 移动到下一个位置(保持间距) + currentX += 2; // 水平间距2格 + + // 换行处理 + if (currentX > endX || currentX - startX >= maxPerRow) + { + currentX = startX; + currentY -= 2; // 垂直间距2格 + + // 如果超出区域,回到底部 + if (currentY < startY) + { + currentY = endY; + } + } + } + else + { + // 回退到随机放置 + Grid randomGrid = map.Grids.Values.FirstOrDefault(g => !allocated.Contains(g)) ?? Grid.Empty; + allocated.Add(randomGrid); + map.SetCharacterCurrentGrid(character, randomGrid); + } + } + } + + private static Grid? GetRandomGridInArea(Random random, GameMap map, HashSet allocated, int startX, int endX, int startY, int endY) + { + List availableGrids = []; + + for (int x = startX; x <= endX; x++) + { + for (int y = startY; y <= endY; y++) + { + Grid? grid = map[x, y, 0]; + if (grid != null && !allocated.Contains(grid)) + { + availableGrids.Add(grid); + } + } + } + + return availableGrids.Count > 0 ? + availableGrids[random.Next(availableGrids.Count)] : + null; + } + + private static string DisplayMapInConsole(GameMap map) + { + StringBuilder sb = new(); + + // 打印列坐标 + sb.Append(" "); + for (int x = 0; x < map.Length; x++) + { + sb.Append($" {x} "); + } + sb.AppendLine(); + + for (int y = 0; y < map.Width; y++) + { + // 打印行坐标 + sb.Append($"{y} "); + + for (int x = 0; x < map.Length; x++) + { + Grid? grid = map[x, y, 0]; + + if (grid is null) + { + sb.Append(" "); + continue; + } + + // 检查格子上是否有角色 + if (grid.Characters.Count > 0) + { + // 取第一个角色的昵称首字母 + Character character = grid.Characters.First(); + string displayChar = character.NickName.Length > 0 ? character.NickName[0].ToString().ToUpper() : "?"; + sb.Append($"[{displayChar}] "); + } + else + { + sb.Append(" . "); + } + } + sb.AppendLine(); + } + + return sb.ToString(); + } + } + + public class FastAutoMap : GameMap + { + public override string Name => OshimaGameModuleConstant.FastAutoMap; + public override string Description => OshimaGameModuleConstant.Description; + public override string Version => OshimaGameModuleConstant.Version; + public override string Author => OshimaGameModuleConstant.Author; + + public override int Length => 9; + public override int Width => 9; + public override int Height => 6; + + public override float Size => 12; + + public override GameMap InitGamingQueue(IGamingQueue queue) + { + GameMap map = new FastAutoMap(); + map.Load(); + + if (queue is GamingQueue gq) + { + gq.WriteLine($"地图 {map.Name} 已加载。"); + } + + return map; + } + } +} \ No newline at end of file diff --git a/OshimaBot.Game/Services/SimulationOptions.cs b/OshimaBot.Game/Services/SimulationOptions.cs new file mode 100644 index 0000000..fc71a47 --- /dev/null +++ b/OshimaBot.Game/Services/SimulationOptions.cs @@ -0,0 +1,97 @@ +namespace OshimaBot.Game.Services +{ + /// + /// 的参数包,替代原先一长串位置 / 命名参数 + /// · 用法:new SimulationOptions { IsTeam = true, BindToCharacter = true } + /// · 在 new 时默认为 1(与旧版可选参数默认值一致), + /// 默认为 true(角色绑定的回合奖励默认启用),其余字段默认为 false + /// + public struct SimulationOptions + { + /// 控制台输出开关(旧参数 printout) + public bool PrintOut { get; set; } + + /// Web 模式:影响回合消息的收集与输出 + public bool IsWeb { get; set; } + + /// 团队模式(TeamGamingQueue),否则为混战模式(MixGamingQueue) + public bool IsTeam { get; set; } + + /// 死斗模式输出逐回合详情 + public bool DeathMatchRoundDetail { get; set; } + + /// 混战模式的最大复活次数 + public int MaxRespawnTimesMix { get; set; } + + /// 启用商店(仅团队模式生效) + public bool UseStore { get; set; } + + /// 是否加载地图 + public bool HasMap { get; set; } + + /// 调试模式(输出更多运行细节) + public bool IsDebug { get; set; } + + /// + /// 是否启用「角色绑定的回合奖励」(对应 InitRoundRewards 的 bindToCharacter)。 + /// 默认 true:不启用时【命运XX】系技能(抢夺 / 剥夺 / 馈赠)与【强运】会全部静默失效。 + /// + public bool BindToCharacter { get; set; } + + /// + /// 初始角色等级(默认 10)。局内会由空投 DropItems 每 40 时间单位 +8 逐步提升, + /// 直到 GameplayEquilibriumConstant.MaxLevel(60)。 + /// 平衡测试可设为 60 直接拉满,使实测口径与《数值设计手册·判定基准》的 Lv60 标尺一致 + /// —— 否则一局里前 ~60% 时长在低等级,会把实测值稀释(实测普攻每目标伤害在 t≈280 前只有满级的 1/5)。 + /// + public int CharacterLevel { get; set; } + + /// + /// 初始战技 / 魔法 / 爆发技等级(默认 2)。空投每次 +1,上限:战技·爆发技 6、魔法 8。 + /// 拉满用 6(战技·爆发技封顶)或 8(魔法封顶)。 + /// + public int SkillLevel { get; set; } + + /// + /// 初始普攻等级(默认 2)。空投每次 +1,上限 MaxNormalAttackLevel(8)。 + /// + public int NormalAttackLevel { get; set; } + + /// + /// 周期空投开关(默认 true,即保持原有对局行为)。 + /// · true:每 40 时间单位空投一次,发装备 + 魔法卡包并提升等级 —— 对局持续成长(实战态)。
+ /// · false:只在开局发放一次(DropItems(..., addLevel: false)),此后装备与技能池保持恒定 —— 定态。 + /// + /// 定态用于测量「技能在固定装备/固定技能池下的收益」:可消除局内数值漂移带来的异方差 + /// (实测渐进态下普攻每目标伤害从 149 涨到 1136,同一技能的样本跨 7.6 倍量级)。 + /// 注意:开局那次空投不能省,否则角色没有装备、也没有魔法卡包附带的魔法。 + ///
+ public bool EnablePeriodicDrop { get; set; } + + /// + /// 固定武器 Id(默认 0 = 不固定,按品质随机抽取)。 + /// 40 件武器**全部**带攻击力副属性,且 exatk 跨度 20(品质0)– 170(品质5)= 8.5×, + /// 副属性还各不相同(excr/exppt/exmpt/excrd/exspd/exls/exatk2), + /// 武器类型倍率另有 0.85–1.20 的 1.41× 跨度。固定武器可一次性消除这些变量 + /// (防具/鞋/饰品中仅 2 件带攻击力,占比 2/107,影响可忽略)。 + /// 平衡测试建议配合 =false 使用, + /// 推荐值 11575(羔羊颂·品质5 单手剑,exatk 110 + excr 0.3,单手剑倍率 1.0 中性)。 + /// + public long FixedWeaponId { get; set; } + + /// + /// 构造参数包: 默认 1,等级默认为 10 / 2 / 2(与旧版硬编码一致), + /// 与 默认 true,其余布尔默认 false + /// + public SimulationOptions() + { + MaxRespawnTimesMix = 1; + CharacterLevel = 10; + SkillLevel = 2; + NormalAttackLevel = 2; + EnablePeriodicDrop = true; + // 角色绑定的回合奖励默认启用:否则命运系技能与强运全部静默失效 + BindToCharacter = true; + } + } +} diff --git a/OshimaBot.slnx b/OshimaBot.slnx new file mode 100644 index 0000000..2b8f05c --- /dev/null +++ b/OshimaBot.slnx @@ -0,0 +1,6 @@ + + + + + + diff --git a/OshimaBot/Controllers/FunGameController.cs b/OshimaBot/Controllers/FunGameController.cs new file mode 100644 index 0000000..f4f6ec2 --- /dev/null +++ b/OshimaBot/Controllers/FunGameController.cs @@ -0,0 +1,146 @@ +using OshimaBot.Game.Services; +using OshimaBot.Models; +using OshimaBot.Services; +using Microsoft.AspNetCore.Mvc; + +namespace OshimaBot.Controllers +{ + [ApiController] + [Route("[controller]")] + public sealed class FunGameController( + FunGameQueryService queries, + FunGameSimulationService simulations) : ControllerBase + { + [HttpGet("status")] + public IActionResult GetStatus() => Ok(new + { + core = "FunGame.Core v3", + startedAt = FunGameRuntime.StartedAt, + isSimulationRunning = simulations.IsRunning, + characters = FunGameService.Characters.Count, + skills = FunGameService.AllSkills.Count, + items = FunGameService.AllItems.Count + }); + + [HttpGet("characters")] + public IReadOnlyList GetCharacters() => queries.GetCharacters(); + + [HttpGet("skills")] + public IReadOnlyList GetSkills() => queries.GetSkills(); + + [HttpGet("items")] + public IReadOnlyList GetItems() => queries.GetItems(); + + [HttpGet("test")] + public Task>> GetTest( + [FromQuery] bool? isweb = null, + [FromQuery] bool? isteam = null, + [FromQuery] bool? showall = null, + [FromQuery] int? maxRespawnTimesMix = null, + [FromQuery] bool? hasMap = null, + [FromQuery] int? seed = null, + [FromQuery] int? characterLevel = null, + [FromQuery] int? skillLevel = null, + [FromQuery] int? normalAttackLevel = null, + [FromQuery] bool? enablePeriodicDrop = null, + [FromQuery] long? fixedWeaponId = null, + CancellationToken cancellationToken = default) + => RunSimulation(false, isweb, isteam, showall, maxRespawnTimesMix, hasMap, seed, + characterLevel, skillLevel, normalAttackLevel, enablePeriodicDrop, fixedWeaponId, cancellationToken); + + [HttpGet("testdebug")] + public Task>> GetTestDebug( + [FromQuery] bool? isweb = null, + [FromQuery] bool? isteam = null, + [FromQuery] bool? showall = null, + [FromQuery] int? maxRespawnTimesMix = null, + [FromQuery] bool? hasMap = null, + [FromQuery] int? seed = null, + [FromQuery] int? characterLevel = null, + [FromQuery] int? skillLevel = null, + [FromQuery] int? normalAttackLevel = null, + [FromQuery] bool? enablePeriodicDrop = null, + [FromQuery] long? fixedWeaponId = null, + CancellationToken cancellationToken = default) + => RunSimulation(true, isweb, isteam, showall, maxRespawnTimesMix, hasMap, seed, + characterLevel, skillLevel, normalAttackLevel, enablePeriodicDrop, fixedWeaponId, cancellationToken); + + private async Task>> RunSimulation( + bool debug, bool? isWeb, bool? isTeam, bool? showAll, int? maxRespawnTimes, + bool? hasMap, int? seed, int? characterLevel, int? skillLevel, int? normalAttackLevel, + bool? enablePeriodicDrop, long? fixedWeaponId, CancellationToken cancellationToken) + { + SimulationResult? result = await simulations.RunAsync(new SimulationRequest + { + IsWeb = isWeb ?? true, + IsTeam = isTeam ?? false, + ShowAll = showAll ?? false, + MaxRespawnTimesMix = maxRespawnTimes ?? 1, + HasMap = hasMap ?? false, + IsDebug = debug, + Seed = seed, + CharacterLevel = characterLevel ?? 10, + SkillLevel = skillLevel ?? 2, + NormalAttackLevel = normalAttackLevel ?? 2, + EnablePeriodicDrop = enablePeriodicDrop ?? true, + FixedWeaponId = fixedWeaponId ?? 0 + }, cancellationToken); + + if (result is null) + { + return Conflict(new ProblemDetails + { + Title = "游戏正在模拟中,请勿重复请求!", + Status = StatusCodes.Status409Conflict + }); + } + return Ok(result.Messages); + } + + [HttpGet("last")] + public async Task> GetLast([FromQuery] bool full = false, CancellationToken cancellationToken = default) + => await simulations.GetLastAsync(full, cancellationToken); + + [HttpGet("stats")] + public async Task GetStats([FromQuery] int? id = null, CancellationToken cancellationToken = default) + => await queries.GetStatsAsync(id ?? 0, false, cancellationToken); + + [HttpGet("teamstats")] + public async Task GetTeamStats([FromQuery] int? id = null, CancellationToken cancellationToken = default) + => await queries.GetStatsAsync(id ?? 0, true, cancellationToken); + + [HttpGet("winraterank")] + public async Task> GetWinrateRank([FromQuery] bool? isteam = null, CancellationToken cancellationToken = default) + => await queries.GetRankingAsync(isteam ?? false, false, cancellationToken); + + [HttpGet("ratingrank")] + public async Task> GetRatingRank([FromQuery] bool? isteam = null, CancellationToken cancellationToken = default) + => await queries.GetRankingAsync(isteam ?? false, true, cancellationToken); + + [HttpGet("characterinfo")] + public BotReply GetCharacterInfo([FromQuery] int? id = null, [FromQuery] string? name = null) + => id.HasValue ? queries.GetCharacterInfo(id.Value) : queries.GetCharacterInfo(name ?? ""); + + [HttpGet("skillinfo")] + public BotReply GetSkillInfo([FromQuery] long? id = null) + => queries.GetSkillInfo(id, null); + + [HttpGet("skillinfoname")] + public BotReply GetSkillInfoByName([FromQuery] string? name = null) + => queries.GetSkillInfo(null, name); + + [HttpGet("iteminfo")] + public BotReply GetItemInfo([FromQuery] long? id = null) + => queries.GetItemInfo(id, null); + + [HttpGet("iteminfoname")] + public BotReply GetItemInfoByName([FromQuery] string? name = null) + => queries.GetItemInfo(null, name); + + [HttpGet("newmagiccard")] + public BotReply GenerateMagicCard() => queries.GenerateMagicCard(); + + [HttpGet("newmagiccardpack")] + public BotReply GenerateMagicCardPack() => queries.GenerateMagicCardPack(); + } +} diff --git a/OshimaBot/Controllers/QQBotController.cs b/OshimaBot/Controllers/QQBotController.cs new file mode 100644 index 0000000..8edbb82 --- /dev/null +++ b/OshimaBot/Controllers/QQBotController.cs @@ -0,0 +1,147 @@ +using System.Text; +using System.Text.Json; +using OshimaBot.Models; +using OshimaBot.Security; +using OshimaBot.Services; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Caching.Memory; +using Microsoft.Extensions.Options; +using Rebex.Security.Cryptography; + +namespace OshimaBot.Controllers +{ + [ApiController] + [Route("[controller]")] + public sealed class QQBotController( + IOptions options, + ILogger logger, + BotMessageQueue queue, + IMemoryCache memoryCache) : ControllerBase + { + private readonly QQBotOptions _options = options.Value; + + [HttpPost] + public async Task Post([FromBody] Payload? payload, CancellationToken cancellationToken) + { + if (payload is null) return BadRequest("Payload 格式无效。"); + + try + { + return payload.Op switch + { + 13 => HandleValidation(payload), + 0 => await HandleEventAsync(payload, cancellationToken), + _ => Ok() + }; + } + catch (JsonException exception) + { + logger.LogWarning(exception, "QQ Webhook JSON 格式无效。"); + return BadRequest("无效的 JSON 格式。"); + } + } + + private IActionResult HandleValidation(Payload payload) + { + if (string.IsNullOrWhiteSpace(_options.Secret)) + { + return StatusCode(StatusCodes.Status503ServiceUnavailable, "QQBot Secret 尚未配置。"); + } + + ValidationRequest? validation = payload.Data.Deserialize(); + if (validation is null || string.IsNullOrWhiteSpace(validation.PlainToken) || string.IsNullOrWhiteSpace(validation.EventTs)) + { + return BadRequest("无效的验证 Payload 格式。"); + } + + string seed = _options.Secret; + while (seed.Length < 32) seed += seed; + seed = seed[..32]; + + Ed25519 ed25519 = new(); + ed25519.FromSeed(Encoding.UTF8.GetBytes(seed)); + byte[] signature = ed25519.SignMessage(Encoding.UTF8.GetBytes(validation.EventTs + validation.PlainToken)); + + return Ok(new ValidationResponse + { + PlainToken = validation.PlainToken, + Signature = Convert.ToHexString(signature).ToLowerInvariant() + }); + } + + private async Task HandleEventAsync(Payload payload, CancellationToken cancellationToken) + { + if (!string.IsNullOrWhiteSpace(payload.Id)) + { + string cacheKey = $"OshimaBot:QQBot:Event:{payload.Id}"; + if (memoryCache.TryGetValue(cacheKey, out _)) return Ok(); + memoryCache.Set(cacheKey, true, TimeSpan.FromMinutes(10)); + } + + IBotMessage? message = payload.EventType switch + { + "C2C_MESSAGE_CREATE" => payload.Data.Deserialize(), + "GROUP_AT_MESSAGE_CREATE" => payload.Data.Deserialize(), + "INTERACTION_CREATE" => payload.Data.Deserialize(), + _ => null + }; + + if (message is null) + { + if (payload.EventType is "C2C_MESSAGE_CREATE" or "GROUP_AT_MESSAGE_CREATE" or "INTERACTION_CREATE") + { + return BadRequest("无效的消息事件数据。"); + } + logger.LogDebug("忽略未定义的 QQ 事件:{EventType}", payload.EventType); + return Ok(); + } + + if (string.IsNullOrWhiteSpace(message.OpenId) || string.IsNullOrWhiteSpace(message.Detail)) + { + return Ok(); + } + + logger.LogInformation("收到 QQ {EventType} 消息:MessageId={MessageId}", payload.EventType, message.Id); + await queue.QueueAsync(message, cancellationToken); + return Ok(); + } + + [RequireApiKey] + [HttpPost("thirdparty")] + public async Task ThirdParty( + [FromBody] ThirdPartyMessage? message, + [FromServices] RainBotService rainBot, + CancellationToken cancellationToken) + { + if (message is null) return Ok(""); + + OtherData data = new() { RequestUrl = $"{Request.Scheme}://{Request.Host}{Request.PathBase}" }; + bool handled = await rainBot.Handler(message, data, cancellationToken); + return Ok(!handled || message.IsCompleted ? message.Result : ""); + } + + [RequireApiKey] + [HttpPost("thirdpartytest")] + public async Task ThirdPartyTest( + [FromQuery] string msg, + [FromQuery] string openID, + [FromServices] RainBotService rainBot, + CancellationToken cancellationToken) + { + if (string.IsNullOrWhiteSpace(msg)) return Ok(""); + + ThirdPartyMessage message = new() + { + IsGroup = false, + AuthorOpenId = openID, + OpenId = openID, + Detail = msg, + Id = openID, + Timestamp = DateTimeOffset.Now.ToString("yyyy-MM-dd HH:mm:ss") + }; + OtherData data = new() { RequestUrl = $"{Request.Scheme}://{Request.Host}{Request.PathBase}" }; + bool handled = await rainBot.Handler(message, data, cancellationToken); + return Ok(!handled || message.IsCompleted ? message.Result : ""); + } + } +} diff --git a/OshimaBot/Models/BotMessages.cs b/OshimaBot/Models/BotMessages.cs new file mode 100644 index 0000000..02ddf8c --- /dev/null +++ b/OshimaBot/Models/BotMessages.cs @@ -0,0 +1,229 @@ +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace OshimaBot.Models +{ + public sealed class Payload + { + [JsonPropertyName("id")] public string Id { get; set; } = ""; + [JsonPropertyName("op")] public int Op { get; set; } + [JsonPropertyName("d")] public JsonElement Data { get; set; } + [JsonPropertyName("s")] public int SequenceNumber { get; set; } + [JsonPropertyName("t")] public string EventType { get; set; } = ""; + } + + public sealed class ValidationRequest + { + [JsonPropertyName("plain_token")] public string PlainToken { get; set; } = ""; + [JsonPropertyName("event_ts")] public string EventTs { get; set; } = ""; + } + + public sealed class ValidationResponse + { + [JsonPropertyName("plain_token")] public string PlainToken { get; set; } = ""; + [JsonPropertyName("signature")] public string Signature { get; set; } = ""; + } + + public sealed class Author + { + [JsonPropertyName("user_openid")] public string UserOpenId { get; set; } = ""; + [JsonPropertyName("member_openid")] public string MemberOpenId { get; set; } = ""; + } + + public interface IBotMessage + { + string Id { get; } + bool IsGroup { get; } + string Detail { get; set; } + string Timestamp { get; } + string OpenId { get; } + string AuthorOpenId { get; } + long FunGameUID { get; set; } + bool SendProactive { get; set; } + } + + public sealed class ThirdPartyMessage : IBotMessage + { + [JsonPropertyName("id")] public string Id { get; set; } = ""; + [JsonPropertyName("isgroup")] public bool IsGroup { get; set; } + [JsonPropertyName("group_openid")] public string GroupOpenId { get; set; } = ""; + [JsonPropertyName("detail")] public string Detail { get; set; } = ""; + [JsonPropertyName("timestamp")] public string Timestamp { get; set; } = ""; + [JsonPropertyName("openid")] public string OpenId { get; set; } = ""; + [JsonPropertyName("authoropenid")] public string AuthorOpenId { get; set; } = ""; + [JsonIgnore] public long FunGameUID { get; set; } + [JsonIgnore] public bool SendProactive { get; set; } + [JsonIgnore] public bool IsCompleted { get; set; } + [JsonIgnore] public string Result { get; set; } = ""; + } + + public sealed class C2CMessage : IBotMessage + { + [JsonPropertyName("id")] public string Id { get; set; } = ""; + [JsonPropertyName("author")] public Author Author { get; set; } = new(); + [JsonPropertyName("content")] public string Content { get; set; } = ""; + [JsonPropertyName("timestamp")] public string Timestamp { get; set; } = ""; + [JsonIgnore] public long FunGameUID { get; set; } + [JsonIgnore] public bool SendProactive { get; set; } + public string Detail { get => Content; set => Content = value; } + public string OpenId => Author.UserOpenId; + public string AuthorOpenId => Author.UserOpenId; + public bool IsGroup => false; + } + + public sealed class GroupAtMessage : IBotMessage + { + [JsonPropertyName("id")] public string Id { get; set; } = ""; + [JsonPropertyName("author")] public Author Author { get; set; } = new(); + [JsonPropertyName("content")] public string Content { get; set; } = ""; + [JsonPropertyName("timestamp")] public string Timestamp { get; set; } = ""; + [JsonPropertyName("group_openid")] public string GroupOpenId { get; set; } = ""; + [JsonIgnore] public long FunGameUID { get; set; } + [JsonIgnore] public bool SendProactive { get; set; } + public string Detail { get => Content; set => Content = value; } + public string OpenId => GroupOpenId; + public string AuthorOpenId => Author.MemberOpenId; + public bool IsGroup => true; + } + + public sealed class InteractionEvent : IBotMessage + { + [JsonPropertyName("id")] public string Id { get; set; } = ""; + [JsonPropertyName("chat_type")] public int ChatType { get; set; } + [JsonPropertyName("timestamp")] public string Timestamp { get; set; } = ""; + [JsonPropertyName("group_openid")] public string GroupOpenId { get; set; } = ""; + [JsonPropertyName("user_openid")] public string UserOpenId { get; set; } = ""; + [JsonPropertyName("data")] public InteractionData Data { get; set; } = new(); + [JsonIgnore] public long FunGameUID { get; set; } + [JsonIgnore] public bool SendProactive { get; set; } + public string Detail { get => Data.Resolved?.ButtonData ?? ""; set { } } + public string OpenId => IsGroup ? GroupOpenId : UserOpenId; + public string AuthorOpenId => UserOpenId; + public bool IsGroup => ChatType == 1; + } + + public sealed class InteractionData + { + [JsonPropertyName("resolved")] public InteractionResolved? Resolved { get; set; } + } + + public sealed class InteractionResolved + { + [JsonPropertyName("button_id")] public string ButtonId { get; set; } = ""; + [JsonPropertyName("button_data")] public string ButtonData { get; set; } = ""; + [JsonPropertyName("message_id")] public string MessageId { get; set; } = ""; + } + + public sealed class OtherData + { + public string RequestUrl { get; set; } = ""; + } + + public sealed class BotReply + { + public string Text { get; set; } = ""; + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public MarkdownMessage? Markdown { get; set; } + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public KeyboardMessage? Keyboard { get; set; } + + public static BotReply FromText(string text) => new() { Text = text }; + public static BotReply FromMarkdown(string markdown, KeyboardMessage? keyboard = null) => new() + { + Markdown = new MarkdownMessage { Content = markdown }, + Keyboard = keyboard + }; + public static implicit operator BotReply(string text) => FromText(text); + } + + public sealed class MarkdownMessage + { + [JsonPropertyName("content")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public string? Content { get; set; } + + [JsonPropertyName("custom_template_id")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public string? CustomTemplateId { get; set; } + + [JsonPropertyName("params")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public List? Params { get; set; } + } + + public sealed class MarkdownParam + { + [JsonPropertyName("key")] public string Key { get; set; } = ""; + [JsonPropertyName("values")] public List Values { get; set; } = []; + } + + public sealed class KeyboardMessage + { + [JsonPropertyName("id")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public string? Id { get; set; } + + [JsonPropertyName("content")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public KeyboardContent? Content { get; set; } + } + + public sealed class KeyboardContent + { + [JsonPropertyName("rows")] public List Rows { get; set; } = []; + } + + public sealed class KeyboardRow + { + [JsonPropertyName("buttons")] public List Buttons { get; set; } = []; + } + + public sealed class KeyboardButton + { + [JsonPropertyName("id")] public string Id { get; set; } = Guid.NewGuid().ToString(); + [JsonPropertyName("render_data")] public KeyboardRenderData RenderData { get; set; } = new(); + [JsonPropertyName("action")] public KeyboardAction Action { get; set; } = new(); + } + + public sealed class KeyboardRenderData + { + [JsonPropertyName("label")] public string Label { get; set; } = ""; + [JsonPropertyName("visited_label")] public string VisitedLabel { get; set; } = ""; + [JsonPropertyName("style")] public int Style { get; set; } = 1; + } + + public sealed class KeyboardAction + { + [JsonPropertyName("type")] public int Type { get; set; } = 2; + [JsonPropertyName("permission")] public KeyboardPermission Permission { get; set; } = new(); + [JsonPropertyName("data")] public string Data { get; set; } = ""; + [JsonPropertyName("enter")] public bool? Enter { get; set; } = true; + [JsonPropertyName("reply")] public bool? Reply { get; set; } + } + + public sealed class KeyboardPermission + { + [JsonPropertyName("type")] public int Type { get; set; } = 2; + [JsonPropertyName("specify_user_ids")] public List SpecifyUserIds { get; set; } = []; + } + + public sealed class MediaResponse + { + [JsonPropertyName("file_uuid")] public string FileUuid { get; set; } = ""; + [JsonPropertyName("file_info")] public string FileInfo { get; set; } = ""; + [JsonPropertyName("ttl")] public int Ttl { get; set; } + } + + public sealed class UploadMediaResult + { + public string? FileUuid { get; set; } + public string? FileInfo { get; set; } + public int Ttl { get; set; } + public string? Error { get; set; } + [JsonIgnore] public bool IsSuccess => string.IsNullOrEmpty(Error); + } + + public sealed class AccessTokenResponse + { + [JsonPropertyName("access_token")] public string AccessToken { get; set; } = ""; + [JsonPropertyName("expires_in")] public string ExpiresIn { get; set; } = ""; + } +} diff --git a/OshimaBot/Models/BotOptions.cs b/OshimaBot/Models/BotOptions.cs new file mode 100644 index 0000000..576f92c --- /dev/null +++ b/OshimaBot/Models/BotOptions.cs @@ -0,0 +1,26 @@ +namespace OshimaBot.Models +{ + public sealed class QQBotOptions + { + public const string SectionName = "QQBot"; + + public bool Enabled { get; set; } + public string AppId { get; set; } = ""; + public string Secret { get; set; } = ""; + public string ApiBaseAddress { get; set; } = "https://api.sgroup.qq.com"; + public string TokenAddress { get; set; } = "https://bots.qq.com/app/getAppAccessToken"; + public int RequestTimeoutSeconds { get; set; } = 30; + + public bool IsConfigured => Enabled + && !string.IsNullOrWhiteSpace(AppId) + && !string.IsNullOrWhiteSpace(Secret); + } + + public sealed class ServerOptions + { + public const string SectionName = "Server"; + + public string ApiKey { get; set; } = ""; + public int MaximumRespawnTimes { get; set; } = 10; + } +} diff --git a/OshimaBot/OshimaBot.csproj b/OshimaBot/OshimaBot.csproj new file mode 100644 index 0000000..adeb1e1 --- /dev/null +++ b/OshimaBot/OshimaBot.csproj @@ -0,0 +1,21 @@ + + + + net10.0 + enable + enable + OshimaBot + OshimaBot + 8d0ef0f5-2aa4-4c0f-9e4f-7d42ab971e95 + + + + + + + + + + + + diff --git a/OshimaBot/Program.cs b/OshimaBot/Program.cs new file mode 100644 index 0000000..a9d4a68 --- /dev/null +++ b/OshimaBot/Program.cs @@ -0,0 +1,58 @@ +using OshimaBot.Game.Services; +using OshimaBot.Models; +using OshimaBot.Services; + +FunGameRuntime.EnsureInitialized(); + +WebApplicationBuilder builder = WebApplication.CreateBuilder(args); + +builder.Services.AddControllers(); +builder.Services.AddOpenApi(); +builder.Services.AddProblemDetails(); +builder.Services.AddMemoryCache(); + +builder.Services.AddOptions() + .Bind(builder.Configuration.GetSection(QQBotOptions.SectionName)) + .Validate(options => !options.Enabled || options.IsConfigured, "启用 QQBot 时必须配置 AppId 和 Secret。") + .Validate(options => options.RequestTimeoutSeconds is > 0 and <= 300, "QQBot 请求超时必须在 1 到 300 秒之间。") + .ValidateOnStart(); +builder.Services.AddOptions() + .Bind(builder.Configuration.GetSection(ServerOptions.SectionName)) + .Validate(options => options.MaximumRespawnTimes is >= 0 and <= 100, "最大复活次数必须在 0 到 100 之间。") + .ValidateOnStart(); + +builder.Services.AddHttpClient(QQBotService.HttpClientName, client => +{ + client.Timeout = TimeSpan.FromSeconds(builder.Configuration.GetValue("QQBot:RequestTimeoutSeconds", 30)); +}); +builder.Services.AddSingleton(); +builder.Services.AddSingleton(); +builder.Services.AddSingleton(); +builder.Services.AddScoped(); +builder.Services.AddSingleton(); +builder.Services.AddHostedService(); + +WebApplication app = builder.Build(); + +app.UseExceptionHandler(); + +if (app.Environment.IsDevelopment()) +{ + app.MapOpenApi(); +} + +app.MapGet("/", () => Results.Ok(new +{ + name = "OshimaBot", + description = "Oshima FunGame WebAPI", + core = "FunGame.Core v3", + startedAt = FunGameRuntime.StartedAt, + characters = FunGameService.Characters.Count, + skills = FunGameService.AllSkills.Count, + items = FunGameService.AllItems.Count +})); +app.MapControllers(); + +app.Run(); + +public partial class Program; diff --git a/OshimaBot/Properties/launchSettings.json b/OshimaBot/Properties/launchSettings.json new file mode 100644 index 0000000..1a07d91 --- /dev/null +++ b/OshimaBot/Properties/launchSettings.json @@ -0,0 +1,14 @@ +{ + "$schema": "https://json.schemastore.org/launchsettings.json", + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": false, + "applicationUrl": "http://localhost:5090", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/OshimaBot/README.md b/OshimaBot/README.md new file mode 100644 index 0000000..0d38c73 --- /dev/null +++ b/OshimaBot/README.md @@ -0,0 +1,51 @@ +# OshimaBot WebAPI + +基于 FunGame.Core v3 与 OshimaBot.Content 的独立 ASP.NET Core 游戏服务器,不依赖 FunGameServer、OshimaServers 或旧 WebAPI 插件。 + +## 项目结构 + +- `OshimaBot`:WebAPI、RainBot、QQ Bot 与后台消息队列。 +- `OshimaBot.Game`:共享的 `FunGameService`、模拟器和初始化逻辑。 +- `OshimaBot.Content`:角色、技能、物品内容包。 + +## 启动 + +在解决方案根目录执行: + +```powershell +dotnet run --project OshimaBot/OshimaBot.csproj +``` + +默认地址为 `http://localhost:5090`,开发环境 OpenAPI 文档位于 `/openapi/v1.json`。也可在解决方案目录构建全部项目: + +```powershell +dotnet build OshimaBot.slnx +``` + +## 首轮接口 + +保留旧版核心路由: + +- `GET /FunGame/test`、`/FunGame/testdebug`:混战或团队模拟,支持种子、地图、初始等级等参数。 +- `GET /FunGame/last?full=false`:最近模拟日志。 +- `GET /FunGame/characterinfo`、`skillinfo`、`skillinfoname`、`iteminfo`、`iteminfoname`。 +- `GET /FunGame/stats`、`teamstats`、`winraterank`、`ratingrank`。 +- `GET /FunGame/newmagiccard`、`newmagiccardpack`。 +- `POST /QQBot`:QQ Webhook;`POST /QQBot/thirdparty`:第三方机器人消息。 + +新增 `GET /FunGame/status`、`characters`、`skills`、`items` 用于服务状态和目录查询。 + +## 配置 + +QQ 外部发送默认关闭。通过用户机密、环境变量或部署配置设置,不要提交真实凭据: + +```powershell +dotnet user-secrets set "QQBot:Enabled" "true" --project OshimaBot/OshimaBot.csproj +dotnet user-secrets set "QQBot:AppId" "" --project OshimaBot/OshimaBot.csproj +dotnet user-secrets set "QQBot:Secret" "" --project OshimaBot/OshimaBot.csproj +dotnet user-secrets set "Server:ApiKey" "" --project OshimaBot/OshimaBot.csproj +``` + +第三方接口使用 `X-API-Key: ` 或 `Authorization: Bearer `。未配置 `Server:ApiKey` 时,第三方接口返回 503。 + +RainBot 首轮支持帮助、角色/技能/物品查询、魔法卡预览、模拟战、统计和排行。存档、库存、交易、社团、活动等依赖旧数据库与 FunGameServer 的模块不在本轮范围内。 diff --git a/OshimaBot/Security/RequireApiKeyAttribute.cs b/OshimaBot/Security/RequireApiKeyAttribute.cs new file mode 100644 index 0000000..4b922e2 --- /dev/null +++ b/OshimaBot/Security/RequireApiKeyAttribute.cs @@ -0,0 +1,51 @@ +using System.Security.Cryptography; +using System.Text; +using OshimaBot.Models; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.Filters; +using Microsoft.Extensions.Options; + +namespace OshimaBot.Security +{ + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)] + public sealed class RequireApiKeyAttribute : Attribute, IAuthorizationFilter + { + public void OnAuthorization(AuthorizationFilterContext context) + { + ServerOptions options = context.HttpContext.RequestServices + .GetRequiredService>().Value; + if (string.IsNullOrWhiteSpace(options.ApiKey)) + { + context.Result = new ObjectResult(new ProblemDetails + { + Title = "第三方接口尚未配置 API Key。", + Status = StatusCodes.Status503ServiceUnavailable + }) + { + StatusCode = StatusCodes.Status503ServiceUnavailable + }; + return; + } + + string provided = context.HttpContext.Request.Headers["X-API-Key"].ToString(); + if (string.IsNullOrWhiteSpace(provided)) + { + string authorization = context.HttpContext.Request.Headers.Authorization.ToString(); + if (authorization.StartsWith("Bearer ", StringComparison.OrdinalIgnoreCase)) + { + provided = authorization[7..].Trim(); + } + } + + byte[] expectedBytes = Encoding.UTF8.GetBytes(options.ApiKey); + byte[] providedBytes = Encoding.UTF8.GetBytes(provided); + if (providedBytes.Length == 0 + || providedBytes.Length != expectedBytes.Length + || !CryptographicOperations.FixedTimeEquals(providedBytes, expectedBytes)) + { + context.HttpContext.Response.Headers.WWWAuthenticate = "Bearer"; + context.Result = new UnauthorizedResult(); + } + } + } +} diff --git a/OshimaBot/Services/BotMessageQueue.cs b/OshimaBot/Services/BotMessageQueue.cs new file mode 100644 index 0000000..bda6f21 --- /dev/null +++ b/OshimaBot/Services/BotMessageQueue.cs @@ -0,0 +1,60 @@ +using System.Threading.Channels; +using OshimaBot.Models; + +namespace OshimaBot.Services +{ + public sealed class BotMessageQueue + { + private readonly Channel _channel = Channel.CreateBounded(new BoundedChannelOptions(1_000) + { + FullMode = BoundedChannelFullMode.Wait, + SingleReader = true, + SingleWriter = false + }); + + public ValueTask QueueAsync(IBotMessage message, CancellationToken cancellationToken = default) + => _channel.Writer.WriteAsync(message, cancellationToken); + + internal IAsyncEnumerable ReadAllAsync(CancellationToken cancellationToken) + => _channel.Reader.ReadAllAsync(cancellationToken); + + internal void Complete() => _channel.Writer.TryComplete(); + } + + public sealed class BotMessageBackgroundService( + BotMessageQueue queue, + IServiceScopeFactory scopeFactory, + ILogger logger) : BackgroundService + { + protected override async Task ExecuteAsync(CancellationToken stoppingToken) + { + await foreach (IBotMessage message in queue.ReadAllAsync(stoppingToken)) + { + try + { + using IServiceScope scope = scopeFactory.CreateScope(); + RainBotService rainBot = scope.ServiceProvider.GetRequiredService(); + bool handled = await rainBot.Handler(message, new OtherData(), stoppingToken); + if (!handled) + { + logger.LogDebug("忽略未识别的机器人指令:{Command}", message.Detail); + } + } + catch (OperationCanceledException) when (stoppingToken.IsCancellationRequested) + { + break; + } + catch (Exception exception) + { + logger.LogError(exception, "处理机器人消息失败:MessageId={MessageId}", message.Id); + } + } + } + + public override Task StopAsync(CancellationToken cancellationToken) + { + queue.Complete(); + return base.StopAsync(cancellationToken); + } + } +} diff --git a/OshimaBot/Services/FunGameQueryService.cs b/OshimaBot/Services/FunGameQueryService.cs new file mode 100644 index 0000000..50a5fbb --- /dev/null +++ b/OshimaBot/Services/FunGameQueryService.cs @@ -0,0 +1,177 @@ +using System.Text; +using OshimaBot.Game.Services; +using FunGame.Core.Entity; +using FunGame.Core.Library.Constant; + +namespace OshimaBot.Services +{ + public sealed record CatalogEntry(long Id, string Name, string Category); + + public sealed class FunGameQueryService(FunGameSimulationService simulations) + { + public IReadOnlyList GetCharacters() + => [.. FunGameService.Characters.Select(character => new CatalogEntry(character.Id, character.GetName(), "角色"))]; + + public IReadOnlyList GetSkills() + => [.. FunGameService.AllSkills + .GroupBy(skill => skill.Id) + .Select(group => group.First()) + .OrderBy(skill => skill.Id) + .Select(skill => new CatalogEntry(skill.Id, skill.Name, GetSkillCategory(skill)))]; + + public IReadOnlyList GetItems() + => [.. FunGameService.AllItems + .GroupBy(item => item.Id) + .Select(group => group.First()) + .OrderBy(item => item.Id) + .Select(item => new CatalogEntry(item.Id, item.Name, item.ItemType.ToString()))]; + + public string GetCharacterInfo(int id) + { + Character? template = FunGameService.Characters.ElementAtOrDefault(id - 1); + if (id <= 0 || template is null) return ""; + + Character character = template.Copy(); + character.Level = General.GameplayEquilibriumConstant.MaxLevel; + character.NormalAttack.Level = General.GameplayEquilibriumConstant.MaxNormalAttackLevel; + FunGameService.AddCharacterSkills(character, 1, + General.GameplayEquilibriumConstant.MaxSkillLevel, + General.GameplayEquilibriumConstant.MaxSuperSkillLevel); + return character.GetInfo().Trim(); + } + + public string GetCharacterInfo(string idOrName) + => int.TryParse(idOrName, out int id) + ? GetCharacterInfo(id) + : GetCharacterInfo(FunGameService.Characters.FindIndex(character => + string.Equals(character.GetName(), idOrName, StringComparison.OrdinalIgnoreCase) + || string.Equals(character.FirstName, idOrName, StringComparison.OrdinalIgnoreCase)) + 1); + + public string GetSkillInfo(long? id, string? name) + { + Skill? template = FindSkill(id, name); + if (template is null) return ""; + + Character character = CreateDemoCharacter(); + List messages = [$"技能展示的属性基于演示角色:[ {character.ToStringWithLevel()} ]"]; + int maximumLevel = template.IsMagic + ? General.GameplayEquilibriumConstant.MaxMagicLevel + : General.GameplayEquilibriumConstant.MaxSkillLevel; + messages.Add(RenderSkill(template, character, 1)); + messages.Add(RenderSkill(template, character, 2)); + character.Level = General.GameplayEquilibriumConstant.MaxLevel; + character.NormalAttack.Level = General.GameplayEquilibriumConstant.MaxNormalAttackLevel; + messages.Add(RenderSkill(template, character, maximumLevel)); + return string.Join("\r\n\r\n", messages); + } + + public string GetItemInfo(long? id, string? name) + { + Item? template = FindItem(id, name); + if (template is null) return ""; + + Character character = CreateDemoCharacter(); + Item item = template.Copy(); + item.Character = character; + item.SetLevel(1); + return $"物品展示的属性基于演示角色:[ {character.ToStringWithLevel()} ]\r\n\r\n{item.ToString(false, true)}"; + } + + public string GenerateMagicCard() + => FunGameService.GenerateMagicCard(Random.Shared).ToString(false, true); + + public string GenerateMagicCardPack() + => FunGameService.GenerateMagicCardPack(Random.Shared, 3)?.ToString(false, true) ?? ""; + + public Task GetStatsAsync(int id, bool team, CancellationToken cancellationToken = default) + => simulations.ReadAsync(() => + { + Character? character = FunGameService.Characters.ElementAtOrDefault(id - 1); + if (id <= 0 || character is null) return ""; + + Dictionary source = team + ? FunGameSimulation.TeamCharacterStatistics + : FunGameSimulation.CharacterStatistics; + if (!source.TryGetValue(character, out CharacterStatistics? stats)) return ""; + + StringBuilder builder = new(); + builder.AppendLine(character.ToStringWithOutUser()); + builder.AppendLine($"参赛:{stats.Plays} / 胜场:{stats.Wins} / 败场:{stats.Loses} / 胜率:{stats.Winrate * 100:0.##}%"); + if (!team) builder.AppendLine($"前三:{stats.Top3s} / 前三率:{stats.Top3rate * 100:0.##}% / 场均名次:#{stats.AvgRank:0.##}"); + builder.AppendLine($"技术得分:{stats.Rating:0.0#} / MVP:{stats.MVPs}"); + builder.AppendLine($"击杀:{stats.Kills} / 死亡:{stats.Deaths} / 助攻:{stats.Assists} / 首杀:{stats.FirstKills} / 首死:{stats.FirstDeaths}"); + builder.AppendLine($"总伤害:{stats.TotalDamage:0.##} / 场均:{stats.AvgDamage:0.##} / 每秒:{stats.DamagePerSecond:0.##}"); + builder.AppendLine($"物理:{stats.TotalPhysicalDamage:0.##} / 魔法:{stats.TotalMagicDamage:0.##} / 真实:{stats.TotalTrueDamage:0.##}"); + builder.AppendLine($"总承伤:{stats.TotalTakenDamage:0.##} / 场均:{stats.AvgTakenDamage:0.##}"); + builder.AppendLine($"治疗:{stats.TotalHeal:0.##} / 护盾:{stats.TotalShield:0.##}"); + builder.AppendLine($"存活回合:{stats.LiveRound} / 行动回合:{stats.ActionTurn} / 存活时长:{stats.LiveTime:0.##}"); + builder.Append($"决策数:{stats.TurnDecisions} / 决策点:{stats.UseDecisionPoints}"); + return builder.ToString(); + }, cancellationToken); + + public Task> GetRankingAsync(bool team, bool byRating, CancellationToken cancellationToken = default) + => simulations.ReadAsync(() => + { + Dictionary source = team + ? FunGameSimulation.TeamCharacterStatistics + : FunGameSimulation.CharacterStatistics; + IEnumerable> ordered = byRating + ? source.OrderByDescending(entry => entry.Value.Rating) + : source.OrderByDescending(entry => entry.Value.Winrate); + + List result = []; + int rank = 1; + foreach ((Character character, CharacterStatistics stats) in ordered) + { + StringBuilder builder = new(); + builder.AppendLine($"#{rank++} {character.ToStringWithOutUser()}"); + builder.AppendLine($"参赛:{stats.Plays} / 胜场:{stats.Wins} / 胜率:{stats.Winrate * 100:0.##}%"); + if (!team) builder.AppendLine($"前三率:{stats.Top3rate * 100:0.##}% / 场均名次:#{stats.AvgRank:0.##}"); + builder.Append($"技术得分:{stats.Rating:0.0#} / MVP:{stats.MVPs}"); + result.Add(builder.ToString()); + } + return result; + }, cancellationToken); + + private static Character CreateDemoCharacter() + { + Character character = FunGameService.Characters.Count > 1 + ? FunGameService.Characters[1].Copy() + : FunGameService.Characters[0].Copy(); + character.Level = 10; + character.NormalAttack.Level = 2; + return character; + } + + private static string RenderSkill(Skill template, Character character, int level) + { + Skill skill = template.Copy(); + skill.Character = character; + skill.Level = level; + return $"{character.ToStringWithLevel()}\r\n{skill.GetInfo()}"; + } + + private static Skill? FindSkill(long? id, string? name) + { + if (id.HasValue) return FunGameService.AllSkills.FirstOrDefault(skill => skill.Id == id.Value); + if (!string.IsNullOrWhiteSpace(name)) return FunGameService.AllSkills.FirstOrDefault(skill => + string.Equals(skill.Name, name.Trim(), StringComparison.OrdinalIgnoreCase)); + return null; + } + + private static Item? FindItem(long? id, string? name) + { + if (id.HasValue) return FunGameService.AllItems.FirstOrDefault(item => item.Id == id.Value); + if (!string.IsNullOrWhiteSpace(name)) return FunGameService.AllItems.FirstOrDefault(item => + string.Equals(item.Name, name.Trim(), StringComparison.OrdinalIgnoreCase)); + return null; + } + + private static string GetSkillCategory(Skill skill) + { + if (skill.IsSuperSkill) return "爆发技"; + if (skill.IsMagic) return "魔法"; + return skill.IsActive ? "主动技能" : "被动技能"; + } + } +} diff --git a/OshimaBot/Services/FunGameSimulationService.cs b/OshimaBot/Services/FunGameSimulationService.cs new file mode 100644 index 0000000..a9e1567 --- /dev/null +++ b/OshimaBot/Services/FunGameSimulationService.cs @@ -0,0 +1,101 @@ +using OshimaBot.Game.Services; +using OshimaBot.Models; +using Microsoft.Extensions.Options; + +namespace OshimaBot.Services +{ + public sealed class SimulationRequest + { + public bool IsWeb { get; set; } = true; + public bool IsTeam { get; set; } + public bool ShowAll { get; set; } + public int MaxRespawnTimesMix { get; set; } = 1; + public bool HasMap { get; set; } + public bool IsDebug { get; set; } + public bool UseStore { get; set; } + public bool EnablePeriodicDrop { get; set; } = true; + public bool BindToCharacter { get; set; } = true; + public int CharacterLevel { get; set; } = 10; + public int SkillLevel { get; set; } = 2; + public int NormalAttackLevel { get; set; } = 2; + public long FixedWeaponId { get; set; } + public int? Seed { get; set; } + } + + public sealed record SimulationResult( + IReadOnlyList Messages, + int Seed, + DateTimeOffset CompletedAt, + TimeSpan Duration); + + public sealed class FunGameSimulationService(IOptions options) + { + private readonly SemaphoreSlim _gate = new(1, 1); + private readonly int _maximumRespawnTimes = options.Value.MaximumRespawnTimes; + + public bool IsRunning => FunGameSimulation.IsRuning; + + public async Task RunAsync(SimulationRequest request, CancellationToken cancellationToken = default) + { + if (!await _gate.WaitAsync(0, cancellationToken)) return null; + + DateTimeOffset startedAt = DateTimeOffset.UtcNow; + try + { + FunGameSimulation.SeedOverride = request.Seed is > 0 ? request.Seed : null; + SimulationOptions simulationOptions = new() + { + PrintOut = false, + IsWeb = request.IsWeb, + IsTeam = request.IsTeam, + DeathMatchRoundDetail = request.ShowAll, + MaxRespawnTimesMix = Math.Clamp(request.MaxRespawnTimesMix, 0, _maximumRespawnTimes), + UseStore = request.UseStore, + HasMap = request.HasMap, + IsDebug = request.IsDebug, + BindToCharacter = request.BindToCharacter, + CharacterLevel = Math.Clamp(request.CharacterLevel, 1, 60), + SkillLevel = Math.Clamp(request.SkillLevel, 1, 8), + NormalAttackLevel = Math.Clamp(request.NormalAttackLevel, 1, 8), + EnablePeriodicDrop = request.EnablePeriodicDrop, + FixedWeaponId = request.FixedWeaponId + }; + + List messages = await Task.Run( + () => FunGameSimulation.StartSimulationGame(simulationOptions), + CancellationToken.None); + + return new SimulationResult( + messages, + FunGameSimulation.Seed, + DateTimeOffset.UtcNow, + DateTimeOffset.UtcNow - startedAt); + } + finally + { + FunGameSimulation.SeedOverride = null; + _gate.Release(); + } + } + + public async Task ReadAsync(Func reader, CancellationToken cancellationToken = default) + { + await _gate.WaitAsync(cancellationToken); + try + { + return reader(); + } + finally + { + _gate.Release(); + } + } + + public Task> GetLastAsync(bool full, CancellationToken cancellationToken = default) + => ReadAsync(() => + { + IReadOnlyList source = full ? FunGameSimulation.LastFullRecord : FunGameSimulation.LastRecord; + return (IReadOnlyList)[.. source]; + }, cancellationToken); + } +} diff --git a/OshimaBot/Services/QQBotService.cs b/OshimaBot/Services/QQBotService.cs new file mode 100644 index 0000000..045aad1 --- /dev/null +++ b/OshimaBot/Services/QQBotService.cs @@ -0,0 +1,209 @@ +using System.Net.Http.Headers; +using System.Text; +using System.Text.Json; +using OshimaBot.Models; +using Microsoft.Extensions.Caching.Memory; +using Microsoft.Extensions.Options; + +namespace OshimaBot.Services +{ + public interface IQQBotService + { + Task SendC2CMessageAsync(string openid, string content, int msgType = 0, object? media = null, string? msgId = null, int? msgSeq = null, CancellationToken cancellationToken = default); + Task SendGroupMessageAsync(string groupOpenid, string content, int msgType = 0, object? media = null, string? msgId = null, int? msgSeq = null, CancellationToken cancellationToken = default); + Task SendC2CMarkdownAsync(string openid, MarkdownMessage markdown, KeyboardMessage? keyboard = null, string? msgId = null, int? msgSeq = null, CancellationToken cancellationToken = default); + Task SendGroupMarkdownAsync(string groupOpenid, MarkdownMessage markdown, KeyboardMessage? keyboard = null, string? msgId = null, int? msgSeq = null, CancellationToken cancellationToken = default); + Task UploadC2CMediaAsync(string openid, int fileType, string url, CancellationToken cancellationToken = default); + Task UploadGroupMediaAsync(string groupOpenid, int fileType, string url, CancellationToken cancellationToken = default); + Task GetAccessTokenAsync(CancellationToken cancellationToken = default); + Task RefreshTokenAsync(CancellationToken cancellationToken = default); + } + + public sealed class QQBotService( + IOptions options, + ILogger logger, + IHttpClientFactory httpClientFactory, + IMemoryCache memoryCache) : IQQBotService + { + public const string HttpClientName = "QQBot"; + private const string AccessTokenCacheKey = "OshimaBot:QQBot:AccessToken"; + private static readonly JsonSerializerOptions JsonOptions = new(JsonSerializerDefaults.Web); + + private readonly QQBotOptions _options = options.Value; + private readonly HttpClient _httpClient = httpClientFactory.CreateClient(HttpClientName); + private readonly SemaphoreSlim _tokenLock = new(1, 1); + + public Task SendC2CMessageAsync(string openid, string content, int msgType = 0, object? media = null, string? msgId = null, int? msgSeq = null, CancellationToken cancellationToken = default) + => SendMessageAsync($"/v2/users/{Uri.EscapeDataString(openid)}/messages", content, msgType, media, msgId, msgSeq, cancellationToken); + + public Task SendGroupMessageAsync(string groupOpenid, string content, int msgType = 0, object? media = null, string? msgId = null, int? msgSeq = null, CancellationToken cancellationToken = default) + => SendMessageAsync($"/v2/groups/{Uri.EscapeDataString(groupOpenid)}/messages", content, msgType, media, msgId, msgSeq, cancellationToken); + + public Task SendC2CMarkdownAsync(string openid, MarkdownMessage markdown, KeyboardMessage? keyboard = null, string? msgId = null, int? msgSeq = null, CancellationToken cancellationToken = default) + => SendMarkdownMessageAsync($"/v2/users/{Uri.EscapeDataString(openid)}/messages", markdown, keyboard, msgId, msgSeq, cancellationToken); + + public Task SendGroupMarkdownAsync(string groupOpenid, MarkdownMessage markdown, KeyboardMessage? keyboard = null, string? msgId = null, int? msgSeq = null, CancellationToken cancellationToken = default) + => SendMarkdownMessageAsync($"/v2/groups/{Uri.EscapeDataString(groupOpenid)}/messages", markdown, keyboard, msgId, msgSeq, cancellationToken); + + private async Task SendMessageAsync(string path, string content, int msgType, object? media, string? msgId, int? msgSeq, CancellationToken cancellationToken) + { + Dictionary body = new() + { + ["content"] = content, + ["msg_type"] = msgType + }; + AddMessageContext(body, media, msgId, msgSeq); + await PostAsync(path, body, cancellationToken); + } + + private async Task SendMarkdownMessageAsync(string path, MarkdownMessage markdown, KeyboardMessage? keyboard, string? msgId, int? msgSeq, CancellationToken cancellationToken) + { + Dictionary body = new() + { + ["msg_type"] = 2, + ["markdown"] = markdown + }; + if (keyboard is not null) body["keyboard"] = keyboard; + AddMessageContext(body, null, msgId, msgSeq); + await PostAsync(path, body, cancellationToken); + } + + private static void AddMessageContext(Dictionary body, object? media, string? msgId, int? msgSeq) + { + if (media is not null) body["media"] = media; + if (!string.IsNullOrWhiteSpace(msgId)) body["msg_id"] = msgId; + if (msgSeq.HasValue) body["msg_seq"] = msgSeq.Value; + } + + public Task UploadC2CMediaAsync(string openid, int fileType, string url, CancellationToken cancellationToken = default) + => UploadMediaAsync($"/v2/users/{Uri.EscapeDataString(openid)}/files", fileType, url, cancellationToken); + + public Task UploadGroupMediaAsync(string groupOpenid, int fileType, string url, CancellationToken cancellationToken = default) + => UploadMediaAsync($"/v2/groups/{Uri.EscapeDataString(groupOpenid)}/files", fileType, url, cancellationToken); + + private async Task UploadMediaAsync(string path, int fileType, string fileUrl, CancellationToken cancellationToken) + { + Dictionary body = new() + { + ["file_type"] = fileType, + ["url"] = fileUrl, + ["srv_send_msg"] = false + }; + + using HttpResponseMessage response = await PostAsync(path, body, cancellationToken, throwOnError: false); + string responseBody = await response.Content.ReadAsStringAsync(cancellationToken); + if (!response.IsSuccessStatusCode) + { + logger.LogError("QQ 富媒体上传失败:{StatusCode},{Response}", (int)response.StatusCode, responseBody); + return new UploadMediaResult { Error = $"QQ 富媒体上传失败(HTTP {(int)response.StatusCode})。" }; + } + + MediaResponse? media = JsonSerializer.Deserialize(responseBody, JsonOptions); + if (media is null || string.IsNullOrWhiteSpace(media.FileInfo)) + { + return new UploadMediaResult { Error = "QQ 富媒体响应格式无效。" }; + } + + return new UploadMediaResult + { + FileUuid = media.FileUuid, + FileInfo = media.FileInfo, + Ttl = media.Ttl + }; + } + + private async Task PostAsync(string path, object body, CancellationToken cancellationToken, bool throwOnError = true) + { + EnsureConfigured(); + string accessToken = await GetAccessTokenAsync(cancellationToken); + using HttpRequestMessage request = new(HttpMethod.Post, $"{_options.ApiBaseAddress.TrimEnd('/')}{path}"); + request.Headers.Authorization = new AuthenticationHeaderValue("QQBot", accessToken); + request.Content = new StringContent(JsonSerializer.Serialize(body, JsonOptions), Encoding.UTF8, "application/json"); + + HttpResponseMessage response = await _httpClient.SendAsync(request, cancellationToken); + if (throwOnError && !response.IsSuccessStatusCode) + { + string error = await response.Content.ReadAsStringAsync(cancellationToken); + response.Dispose(); + logger.LogError("QQ 消息接口调用失败:{StatusCode},{Response}", (int)response.StatusCode, error); + throw new HttpRequestException($"QQ 消息接口返回 HTTP {(int)response.StatusCode}。"); + } + return response; + } + + public async Task GetAccessTokenAsync(CancellationToken cancellationToken = default) + { + EnsureConfigured(); + if (memoryCache.TryGetValue(AccessTokenCacheKey, out string? token) && !string.IsNullOrWhiteSpace(token)) + { + return token; + } + + await _tokenLock.WaitAsync(cancellationToken); + try + { + if (memoryCache.TryGetValue(AccessTokenCacheKey, out token) && !string.IsNullOrWhiteSpace(token)) + { + return token; + } + return await RequestAccessTokenAsync(cancellationToken); + } + finally + { + _tokenLock.Release(); + } + } + + public async Task RefreshTokenAsync(CancellationToken cancellationToken = default) + { + EnsureConfigured(); + await _tokenLock.WaitAsync(cancellationToken); + try + { + return await RequestAccessTokenAsync(cancellationToken); + } + finally + { + _tokenLock.Release(); + } + } + + private async Task RequestAccessTokenAsync(CancellationToken cancellationToken) + { + using HttpRequestMessage request = new(HttpMethod.Post, _options.TokenAddress) + { + Content = new StringContent(JsonSerializer.Serialize(new + { + appId = _options.AppId, + clientSecret = _options.Secret + }), Encoding.UTF8, "application/json") + }; + using HttpResponseMessage response = await _httpClient.SendAsync(request, cancellationToken); + string responseBody = await response.Content.ReadAsStringAsync(cancellationToken); + if (!response.IsSuccessStatusCode) + { + logger.LogError("QQ AccessToken 获取失败:{StatusCode}", (int)response.StatusCode); + throw new HttpRequestException($"QQ AccessToken 接口返回 HTTP {(int)response.StatusCode}。"); + } + + AccessTokenResponse? token = JsonSerializer.Deserialize(responseBody, JsonOptions); + if (token is null || string.IsNullOrWhiteSpace(token.AccessToken) || !int.TryParse(token.ExpiresIn, out int expiresIn) || expiresIn <= 0) + { + throw new InvalidOperationException("QQ AccessToken 响应格式无效。"); + } + + int cacheSeconds = Math.Max(1, expiresIn - Math.Min(60, expiresIn / 10)); + memoryCache.Set(AccessTokenCacheKey, token.AccessToken, TimeSpan.FromSeconds(cacheSeconds)); + logger.LogInformation("QQ AccessToken 已刷新,有效期约 {ExpiresIn} 秒。", expiresIn); + return token.AccessToken; + } + + private void EnsureConfigured() + { + if (!_options.IsConfigured) + { + throw new InvalidOperationException("QQBot 未启用或凭据不完整,请配置 QQBot:Enabled、AppId 和 Secret。"); + } + } + } +} diff --git a/OshimaBot/Services/RainBotService.cs b/OshimaBot/Services/RainBotService.cs new file mode 100644 index 0000000..91f1035 --- /dev/null +++ b/OshimaBot/Services/RainBotService.cs @@ -0,0 +1,223 @@ +using System.Text; +using OshimaBot.Game.Services; +using OshimaBot.Models; +using FunGame.Core.Library.Constant; + +namespace OshimaBot.Services +{ + public sealed class RainBotService( + FunGameQueryService queries, + FunGameSimulationService simulations, + IQQBotService qqBot, + ILogger logger) + { + public async Task Handler(IBotMessage message, OtherData data, CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(message); + string command = message.Detail.Trim(); + if (command.StartsWith('/')) command = command[1..].Trim(); + message.Detail = command; + if (command.Length == 0) return false; + + BotReply? reply = await RouteCommandAsync(message, command, cancellationToken); + if (reply is null) return false; + + await SendAsync(message, reply, cancellationToken); + return true; + } + + public Task HandlerByConsole(IBotMessage message, OtherData data, CancellationToken cancellationToken = default) + => Handler(message, data, cancellationToken); + + private async Task RouteCommandAsync(IBotMessage message, string command, CancellationToken cancellationToken) + { + if (command == "帮助") return BotReply.FromMarkdown(CreateHelp()); + if (command is "战斗帮助" or "角色帮助" or "物品帮助") return BotReply.FromMarkdown(CreateBattleHelp()); + if (command == "重置状态") return "当前版本采用无状态指令路由,无需重置指令状态。"; + if (command == "获取接入码" && !message.IsGroup) return $"你的接入码为 {message.AuthorOpenId},请妥善保存!"; + if (command == "查询服务器启动时间") return $"OshimaBot 启动时间(UTC):{FunGameRuntime.StartedAt:yyyy-MM-dd HH:mm:ss}"; + + if (command == "预览魔法卡") return queries.GenerateMagicCard(); + if (command == "预览魔法卡包") return queries.GenerateMagicCardPack(); + + if (TryArgument(command, "查角色", out string character)) + return RequireResult(queries.GetCharacterInfo(character), "未找到角色。用法:查角色 <编号或名称>"); + if (TryArgument(command, "查技能", out string skill)) + { + string result = long.TryParse(skill, out long id) + ? queries.GetSkillInfo(id, null) + : queries.GetSkillInfo(null, skill); + return RequireResult(result, "未找到技能。用法:查技能 <编号或名称>"); + } + if (TryArgument(command, "查物品", out string item)) + { + string result = long.TryParse(item, out long id) + ? queries.GetItemInfo(id, null) + : queries.GetItemInfo(null, item); + return RequireResult(result, "未找到物品。用法:查物品 <编号或名称>"); + } + + if (TryArgument(command, "查团队数据", out string teamStats) && int.TryParse(teamStats, out int teamStatsId)) + return RequireResult(await queries.GetStatsAsync(teamStatsId, true, cancellationToken), "未找到角色团队统计。"); + if (TryArgument(command, "查数据", out string stats) && int.TryParse(stats, out int statsId)) + return RequireResult(await queries.GetStatsAsync(statsId, false, cancellationToken), "未找到角色统计。"); + if (command.StartsWith("查团队胜率", StringComparison.OrdinalIgnoreCase)) + return MergeRanking(await queries.GetRankingAsync(true, false, cancellationToken)); + if (command.StartsWith("查个人胜率", StringComparison.OrdinalIgnoreCase)) + return MergeRanking(await queries.GetRankingAsync(false, false, cancellationToken)); + if (command.StartsWith("查团队评分", StringComparison.OrdinalIgnoreCase)) + return MergeRanking(await queries.GetRankingAsync(true, true, cancellationToken)); + if (command.StartsWith("查个人评分", StringComparison.OrdinalIgnoreCase)) + return MergeRanking(await queries.GetRankingAsync(false, true, cancellationToken)); + + if (command == "上次的完整日志") + return MergeToMarkdown("上次的完整日志:", await simulations.GetLastAsync(true, cancellationToken)); + if (command == "上次的日志") + return MergeToMarkdown("上次的模拟日志:", await simulations.GetLastAsync(false, cancellationToken)); + + if (command.StartsWith("团队调试模拟", StringComparison.OrdinalIgnoreCase)) + return await RunSimulationAsync(new SimulationRequest { IsTeam = true, HasMap = true, IsDebug = true, ShowAll = true, MaxRespawnTimesMix = 0 }, cancellationToken); + if (command.StartsWith("团队地图模拟", StringComparison.OrdinalIgnoreCase)) + return await RunSimulationAsync(new SimulationRequest { IsTeam = true, HasMap = true }, cancellationToken); + if (command.StartsWith("FunGame团队模拟", StringComparison.OrdinalIgnoreCase)) + return await RunSimulationAsync(new SimulationRequest { IsTeam = true }, cancellationToken); + if (command.StartsWith("个人地图模拟", StringComparison.OrdinalIgnoreCase)) + return await RunSimulationAsync(new SimulationRequest { HasMap = true, MaxRespawnTimesMix = 0 }, cancellationToken); + if (TryArgument(command, "混战模拟", out string respawn)) + return await RunSimulationAsync(new SimulationRequest + { + MaxRespawnTimesMix = int.TryParse(respawn, out int times) ? times : 1 + }, cancellationToken); + if (command.StartsWith("FunGame模拟", StringComparison.OrdinalIgnoreCase)) + return await RunSimulationAsync(new SimulationRequest { MaxRespawnTimesMix = 0 }, cancellationToken); + + if (command is "存档帮助" or "玩法帮助" or "社团帮助" or "活动帮助" or "商店帮助") + return "该模块尚未迁移到 OshimaBot。首轮已开放角色、物品、战斗查询与模拟指令。"; + + return null; + } + + private async Task RunSimulationAsync(SimulationRequest request, CancellationToken cancellationToken) + { + SimulationResult? result = await simulations.RunAsync(request, cancellationToken); + if (result is null) return "游戏正在模拟中,请勿重复请求!"; + logger.LogInformation("RainBot 模拟完成:Seed={Seed},Duration={Duration}", result.Seed, result.Duration); + return MergeToMarkdown($"模拟结果如下(种子:{result.Seed}):", result.Messages); + } + + private async Task SendAsync(IBotMessage message, BotReply reply, CancellationToken cancellationToken) + { + if (message is ThirdPartyMessage thirdParty) + { + thirdParty.Result = reply.Markdown?.Content ?? reply.Text; + thirdParty.IsCompleted = true; + return; + } + + string? msgId = message.SendProactive ? null : message.Id; + if (reply.Markdown is not null && !string.IsNullOrWhiteSpace(reply.Markdown.Content)) + { + if (message.IsGroup) + await qqBot.SendGroupMarkdownAsync(message.OpenId, reply.Markdown, reply.Keyboard, msgId, 1, cancellationToken); + else + await qqBot.SendC2CMarkdownAsync(message.OpenId, reply.Markdown, reply.Keyboard, msgId, 1, cancellationToken); + } + else if (!string.IsNullOrWhiteSpace(reply.Text)) + { + string content = message.IsGroup ? "\r\n" + reply.Text.Trim() : reply.Text.Trim(); + if (message.IsGroup) + await qqBot.SendGroupMessageAsync(message.OpenId, content, msgId: msgId, msgSeq: 1, cancellationToken: cancellationToken); + else + await qqBot.SendC2CMessageAsync(message.OpenId, content, msgId: msgId, msgSeq: 1, cancellationToken: cancellationToken); + } + } + + public BotReply MergeToMarkdown(string subtitle, IReadOnlyCollection messages) + { + if (messages.Count == 0) return "暂无记录,请先运行一次模拟。"; + + List selected = [.. messages]; + if (selected.Count > 30) + { + selected = [.. selected[..15], $"\r\n……已省略 {messages.Count - 30} 段日志……\r\n", .. selected[^15..]]; + } + + StringBuilder content = new(); + content.AppendLine(subtitle).AppendLine("```"); + foreach (string message in selected) + { + if (content.Length > 48_000) + { + content.AppendLine("……日志过长,后续内容已省略……"); + break; + } + content.AppendLine(message); + } + content.AppendLine("```"); + return BotReply.FromMarkdown(content.ToString()); + } + + public List MergeMessages(IReadOnlyCollection messages) + { + const int groupSize = 5; + List merged = []; + List source = [.. messages]; + if (source.Count > 20) source = [source[0], .. source[^20..]]; + for (int index = 0; index < source.Count; index += groupSize) + { + merged.Add(string.Join("\r\n", source.Skip(index).Take(groupSize))); + } + return merged.Count >= 3 ? [merged[0], .. merged[^2..]] : merged; + } + + public BotReply CreateMarkdownFromText(string text) => BotReply.FromMarkdown(text); + + private static BotReply MergeRanking(IReadOnlyCollection ranking) + => ranking.Count == 0 ? "暂无统计数据。" : string.Join("\r\n\r\n", ranking); + + private static BotReply RequireResult(string result, string fallback) + => string.IsNullOrWhiteSpace(result) ? fallback : result; + + private static bool TryArgument(string command, string prefix, out string argument) + { + argument = ""; + if (!command.StartsWith(prefix, StringComparison.OrdinalIgnoreCase)) return false; + argument = command[prefix.Length..].Trim(); + return true; + } + + private static string CreateHelp() => $""" + 欢迎使用《筽祀牻》OshimaBot 服务器! + 核心库版本:{FunGameInfo.FunGame_Version} + + 首轮指令: + 1. 查角色 <编号或名称> + 2. 查技能 <编号或名称> + 3. 查物品 <编号或名称> + 4. 预览魔法卡 / 预览魔法卡包 + 5. 查数据 <编号> / 查团队数据 <编号> + 6. 查个人胜率 / 查团队胜率 / 查个人评分 / 查团队评分 + 7. 混战模拟 [复活次数] / FunGame模拟 / FunGame团队模拟 + 8. 个人地图模拟 / 团队地图模拟 / 团队调试模拟 + 9. 上次的日志 / 上次的完整日志 + 10. 查询服务器启动时间 + + 存档、社团、活动和商店等旧模块将在后续迁移。 + """; + + private static string CreateBattleHelp() => """ + 《筽祀牻》战斗指令 + 1. 查角色 <编号或名称>:查看满级角色资料。 + 2. 查技能 <编号或名称>:查看 1、2 级与满级技能资料。 + 3. 查物品 <编号或名称>:查看物品资料。 + 4. 混战模拟 [复活次数]:开始个人混战模拟。 + 5. FunGame模拟:开始无复活混战模拟。 + 6. FunGame团队模拟:开始团队模拟。 + 7. 个人地图模拟 / 团队地图模拟:开始带地图的模拟。 + 8. 团队调试模拟:输出团队地图调试模拟。 + 9. 查数据 / 查团队数据:查看角色累计统计。 + 10. 查个人胜率 / 查团队胜率 / 查个人评分 / 查团队评分:查看排行。 + 11. 上次的日志 / 上次的完整日志:查看最近模拟记录。 + """; + } +} diff --git a/OshimaBot/appsettings.Development.json b/OshimaBot/appsettings.Development.json new file mode 100644 index 0000000..ec868d3 --- /dev/null +++ b/OshimaBot/appsettings.Development.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Information", + "OshimaBot": "Debug" + } + } +} diff --git a/OshimaBot/appsettings.json b/OshimaBot/appsettings.json new file mode 100644 index 0000000..48685e7 --- /dev/null +++ b/OshimaBot/appsettings.json @@ -0,0 +1,21 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*", + "QQBot": { + "Enabled": false, + "AppId": "", + "Secret": "", + "ApiBaseAddress": "https://api.sgroup.qq.com", + "TokenAddress": "https://bots.qq.com/app/getAppAccessToken", + "RequestTimeoutSeconds": 30 + }, + "Server": { + "ApiKey": "", + "MaximumRespawnTimes": 10 + } +}