diff --git a/Desktop/Solutions/EntityCreator/EntityEditor.cs b/Desktop/Solutions/EntityCreator/EntityEditor.cs index db908f4..5e3b10b 100644 --- a/Desktop/Solutions/EntityCreator/EntityEditor.cs +++ b/Desktop/Solutions/EntityCreator/EntityEditor.cs @@ -205,33 +205,33 @@ namespace Milimoe.FunGame.Testing.Desktop.Solutions public static Skill? 从模组加载器中获取技能(long id, string name, SkillType type) { - if (GameModuleLoader != null) - { - foreach (SkillModule module in GameModuleLoader.Skills.Values) - { - Skill? s = module.GetSkill(id, name, type); - if (s != null) - { - return s; - } - } - } + //if (GameModuleLoader != null) + //{ + // foreach (SkillModule module in GameModuleLoader.Skills.Values) + // { + // Skill? s = module.GetSkill(id, name, type); + // if (s != null) + // { + // return s; + // } + // } + //} return null; } public static Item? 从模组加载器中获取物品(long id, string name, ItemType type) { - if (GameModuleLoader != null) - { - foreach (ItemModule module in GameModuleLoader.Items.Values) - { - Item? i = module.GetItem(id, name, type); - if (i != null) - { - return i; - } - } - } + //if (GameModuleLoader != null) + //{ + // foreach (ItemModule module in GameModuleLoader.Items.Values) + // { + // Item? i = module.GetItem(id, name, type); + // if (i != null) + // { + // return i; + // } + // } + //} return null; } diff --git a/Library/Effects/ItemEffects/冷却缩减加成.cs b/Library/Effects/ItemEffects/冷却缩减加成.cs index cfdd5e8..18e822f 100644 --- a/Library/Effects/ItemEffects/冷却缩减加成.cs +++ b/Library/Effects/ItemEffects/冷却缩减加成.cs @@ -1,7 +1,7 @@ using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Constant; -namespace Milimoe.FunGame.Testing.Effects +namespace Milimoe.FunGame.Testing.ItemEffects { public class 冷却缩减加成 : Effect { @@ -24,12 +24,12 @@ namespace Milimoe.FunGame.Testing.Effects character.ExCDR -= 实际冷却缩减加成; } - public 冷却缩减加成(Skill skill, Character? source, Item? item, double exCdr) : base(skill) + public 冷却缩减加成(Skill skill, double exCdr, Character? source = null, Item? item = null) : base(skill) { GamingQueue = skill.GamingQueue; + 实际冷却缩减加成 = exCdr; Source = source; Item = item; - 实际冷却缩减加成 = exCdr; } } } diff --git a/Library/Effects/ItemEffects/技能硬直时间减少.cs b/Library/Effects/ItemEffects/技能硬直时间减少.cs index c4dc6b5..4c81131 100644 --- a/Library/Effects/ItemEffects/技能硬直时间减少.cs +++ b/Library/Effects/ItemEffects/技能硬直时间减少.cs @@ -1,14 +1,13 @@ -using Milimoe.FunGame.Core.Api.Utility; -using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Constant; -namespace Milimoe.FunGame.Testing.Effects +namespace Milimoe.FunGame.Testing.ItemEffects { public class 技能硬直时间减少 : Effect { public override long Id => Skill.Id; public override string Name => Skill.Name; - public override string Description => $"减少角色的所有主动技能 {实际硬直时间减少} 硬直时间。" + (!TargetSelf ? $"来自:[ {Source} ]" + (Item != null ? $" 的 [ {Item.Name} ]" : "") : ""); + public override string Description => $"减少角色的所有主动技能 {实际硬直时间减少:0.##} 硬直时间。" + (!TargetSelf ? $"来自:[ {Source} ]" + (Item != null ? $" 的 [ {Item.Name} ]" : "") : ""); public override EffectType EffectType => EffectType.Item; public override bool TargetSelf => true; @@ -19,12 +18,12 @@ namespace Milimoe.FunGame.Testing.Effects { foreach (Skill s in character.Skills) { - s.HardnessTime = Calculation.Round2Digits(s.HardnessTime - 实际硬直时间减少); + s.HardnessTime -= 实际硬直时间减少; } foreach (Skill? s in character.Items.Select(i => i.Skills.Active)) { if (s != null) - s.HardnessTime = Calculation.Round2Digits(s.HardnessTime - 实际硬直时间减少); + s.HardnessTime -= 实际硬直时间减少; } } @@ -32,21 +31,21 @@ namespace Milimoe.FunGame.Testing.Effects { foreach (Skill s in character.Skills) { - s.HardnessTime = Calculation.Round2Digits(s.HardnessTime + 实际硬直时间减少); + s.HardnessTime += 实际硬直时间减少; } foreach (Skill? s in character.Items.Select(i => i.Skills.Active)) { if (s != null) - s.HardnessTime = Calculation.Round2Digits(s.HardnessTime + 实际硬直时间减少); + s.HardnessTime += 实际硬直时间减少; } } - public 技能硬直时间减少(Skill skill, Character? source, Item? item, double reduce) : base(skill) + public 技能硬直时间减少(Skill skill, double reduce, Character? source = null, Item? item = null) : base(skill) { GamingQueue = skill.GamingQueue; + 实际硬直时间减少 = reduce; Source = source; Item = item; - 实际硬直时间减少 = reduce; } } } diff --git a/Library/Effects/ItemEffects/攻击力加成.cs b/Library/Effects/ItemEffects/攻击力加成.cs index 10afe56..8c72e55 100644 --- a/Library/Effects/ItemEffects/攻击力加成.cs +++ b/Library/Effects/ItemEffects/攻击力加成.cs @@ -1,13 +1,13 @@ using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Constant; -namespace Milimoe.FunGame.Testing.Effects +namespace Milimoe.FunGame.Testing.ItemEffects { public class 攻击力加成 : Effect { public override long Id => Skill.Id; public override string Name => Skill.Name; - public override string Description => $"增加角色 {实际攻击力加成} 点攻击力。" + (!TargetSelf ? $"来自:[ {Source} ]" + (Item != null ? $" 的 [ {Item.Name} ]" : "") : ""); + public override string Description => $"增加角色 {实际攻击力加成:0.##} 点攻击力。" + (!TargetSelf ? $"来自:[ {Source} ]" + (Item != null ? $" 的 [ {Item.Name} ]" : "") : ""); public override EffectType EffectType => EffectType.Item; public override bool TargetSelf => true; @@ -24,12 +24,12 @@ namespace Milimoe.FunGame.Testing.Effects character.ExATK2 -= 实际攻击力加成; } - public 攻击力加成(Skill skill, Character? source, Item? item, double exATK) : base(skill) + public 攻击力加成(Skill skill, double exATK, Character? source = null, Item? item = null) : base(skill) { GamingQueue = skill.GamingQueue; + 实际攻击力加成 = exATK; Source = source; Item = item; - 实际攻击力加成 = exATK; } } } diff --git a/Library/Effects/ItemEffects/普攻硬直时间减少.cs b/Library/Effects/ItemEffects/普攻硬直时间减少.cs index 361d739..95bdf74 100644 --- a/Library/Effects/ItemEffects/普攻硬直时间减少.cs +++ b/Library/Effects/ItemEffects/普攻硬直时间减少.cs @@ -1,14 +1,13 @@ -using Milimoe.FunGame.Core.Api.Utility; -using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Constant; -namespace Milimoe.FunGame.Testing.Effects +namespace Milimoe.FunGame.Testing.ItemEffects { public class 普攻硬直时间减少 : Effect { public override long Id => Skill.Id; public override string Name => Skill.Name; - public override string Description => $"减少角色的普通攻击 {实际硬直时间减少} 硬直时间。" + (!TargetSelf ? $"来自:[ {Source} ]" + (Item != null ? $" 的 [ {Item.Name} ]" : "") : ""); + public override string Description => $"减少角色的普通攻击 {实际硬直时间减少:0.##} 硬直时间。" + (!TargetSelf ? $"来自:[ {Source} ]" + (Item != null ? $" 的 [ {Item.Name} ]" : "") : ""); public override EffectType EffectType => EffectType.Item; public override bool TargetSelf => true; @@ -17,20 +16,20 @@ namespace Milimoe.FunGame.Testing.Effects public override void OnEffectGained(Character character) { - character.NormalAttack.HardnessTime = Calculation.Round2Digits(character.NormalAttack.HardnessTime - 实际硬直时间减少); ; + character.NormalAttack.HardnessTime -= 实际硬直时间减少; } public override void OnEffectLost(Character character) { - character.NormalAttack.HardnessTime = Calculation.Round2Digits(character.NormalAttack.HardnessTime + 实际硬直时间减少); ; + character.NormalAttack.HardnessTime += 实际硬直时间减少; } - public 普攻硬直时间减少(Skill skill, Character? source, Item? item, double reduce) : base(skill) + public 普攻硬直时间减少(Skill skill, double reduce, Character? source = null, Item? item = null) : base(skill) { GamingQueue = skill.GamingQueue; + 实际硬直时间减少 = reduce; Source = source; Item = item; - 实际硬直时间减少 = reduce; } } } diff --git a/Library/Effects/ItemEffects/物理护甲加成.cs b/Library/Effects/ItemEffects/物理护甲加成.cs index aa2781e..6571c49 100644 --- a/Library/Effects/ItemEffects/物理护甲加成.cs +++ b/Library/Effects/ItemEffects/物理护甲加成.cs @@ -1,13 +1,13 @@ using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Constant; -namespace Milimoe.FunGame.Testing.Effects +namespace Milimoe.FunGame.Testing.ItemEffects { public class 物理护甲加成 : Effect { public override long Id => Skill.Id; public override string Name => Skill.Name; - public override string Description => $"增加角色 {实际物理护甲加成} 点物理护甲。" + (!TargetSelf ? $"来自:[ {Source} ]" + (Item != null ? $" 的 [ {Item.Name} ]" : "") : ""); + public override string Description => $"增加角色 {实际物理护甲加成:0.##} 点物理护甲。" + (!TargetSelf ? $"来自:[ {Source} ]" + (Item != null ? $" 的 [ {Item.Name} ]" : "") : ""); public override EffectType EffectType => EffectType.Item; public override bool TargetSelf => true; @@ -24,12 +24,12 @@ namespace Milimoe.FunGame.Testing.Effects character.ExDEF2 -= 实际物理护甲加成; } - public 物理护甲加成(Skill skill, Character? source, Item? item, double exDef) : base(skill) + public 物理护甲加成(Skill skill, double exDef, Character? source = null, Item? item = null) : base(skill) { GamingQueue = skill.GamingQueue; + 实际物理护甲加成 = exDef; Source = source; Item = item; - 实际物理护甲加成 = exDef; } } } diff --git a/Library/Effects/OpenEffects/AccelerationCoefficient.cs b/Library/Effects/OpenEffects/AccelerationCoefficient.cs new file mode 100644 index 0000000..7e481e1 --- /dev/null +++ b/Library/Effects/OpenEffects/AccelerationCoefficient.cs @@ -0,0 +1,42 @@ +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Testing.OpenEffects +{ + public class AccelerationCoefficient : Effect + { + public override long Id => (long)EffectID.AccelerationCoefficient; + public override string Name => "加速系数加成"; + public override string Description => $"增加角色 {实际加成 * 100:0.##}% 加速系数。" + (!TargetSelf ? $"来自:[ {Source} ]" + (Item != null ? $" 的 [ {Item.Name} ]" : "") : ""); + public override EffectType EffectType => EffectType.Item; + public override bool TargetSelf => true; + + public Item? Item { get; } + private readonly double 实际加成 = 0; + + public override void OnEffectGained(Character character) + { + character.AccelerationCoefficient += 实际加成; + } + + public override void OnEffectLost(Character character) + { + character.AccelerationCoefficient -= 实际加成; + } + + public AccelerationCoefficient(Skill skill, Character? source = null, Item? item = null) : base(skill) + { + GamingQueue = skill.GamingQueue; + Source = source; + Item = item; + if (skill.OtherArgs.Count > 0) + { + string key = skill.OtherArgs.Keys.FirstOrDefault(s => s.Equals("exacc", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(skill.OtherArgs[key].ToString(), out double exACC)) + { + 实际加成 = exACC; + } + } + } + } +} diff --git a/Library/Effects/OpenEffects/EffectID.cs b/Library/Effects/OpenEffects/EffectID.cs new file mode 100644 index 0000000..6c86f7b --- /dev/null +++ b/Library/Effects/OpenEffects/EffectID.cs @@ -0,0 +1,115 @@ +namespace Milimoe.FunGame.Testing.OpenEffects +{ + public enum EffectID : long + { + /// + /// 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, + + /// + /// expp + /// + PhysicalPenetration = 8017, + + /// + /// exmp + /// + MagicalPenetration = 8018, + + /// + /// expdr + /// + ExPDR = 8019, + + /// + /// mdftype, mdfvalue + /// + ExMDF = 8020, + + /// + /// exhr + /// + ExHR = 8021, + + /// + /// exmr + /// + ExMR = 8022 + } +} diff --git a/Library/Effects/OpenEffects/ExAGI.cs b/Library/Effects/OpenEffects/ExAGI.cs new file mode 100644 index 0000000..f3ec161 --- /dev/null +++ b/Library/Effects/OpenEffects/ExAGI.cs @@ -0,0 +1,42 @@ +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Testing.OpenEffects +{ + public class ExAGI : Effect + { + public override long Id => (long)EffectID.ExAGI; + public override string Name => "敏捷加成"; + public override string Description => $"增加角色 {实际加成:0.##} 点敏捷。" + (!TargetSelf ? $"来自:[ {Source} ]" + (Item != null ? $" 的 [ {Item.Name} ]" : "") : ""); + public override EffectType EffectType => EffectType.Item; + public override bool TargetSelf => true; + + public Item? Item { get; } + private readonly double 实际加成 = 0; + + public override void OnEffectGained(Character character) + { + character.ExAGI += 实际加成; + } + + public override void OnEffectLost(Character character) + { + character.ExAGI -= 实际加成; + } + + public ExAGI(Skill skill, Character? source = null, Item? item = null) : base(skill) + { + GamingQueue = skill.GamingQueue; + Source = source; + Item = item; + if (skill.OtherArgs.Count > 0) + { + string key = skill.OtherArgs.Keys.FirstOrDefault(s => s.Equals("exagi", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(skill.OtherArgs[key].ToString(), out double exAGI)) + { + 实际加成 = exAGI; + } + } + } + } +} diff --git a/Library/Effects/OpenEffects/ExATK.cs b/Library/Effects/OpenEffects/ExATK.cs index 6b91089..9ede1eb 100644 --- a/Library/Effects/OpenEffects/ExATK.cs +++ b/Library/Effects/OpenEffects/ExATK.cs @@ -1,40 +1,40 @@ using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Constant; -namespace Milimoe.FunGame.Testing.Effects +namespace Milimoe.FunGame.Testing.OpenEffects { public class ExATK : Effect { - public override long Id => 8001; + public override long Id => (long)EffectID.ExATK; public override string Name => "攻击力加成"; - public override string Description => $"增加角色 {实际攻击力加成} 点攻击力。" + (!TargetSelf ? $"来自:[ {Source} ]" + (Item != null ? $" 的 [ {Item.Name} ]" : "") : ""); + public override string Description => $"增加角色 {实际加成:0.##} 点攻击力。" + (!TargetSelf ? $"来自:[ {Source} ]" + (Item != null ? $" 的 [ {Item.Name} ]" : "") : ""); public override EffectType EffectType => EffectType.Item; public override bool TargetSelf => true; public Item? Item { get; } - private readonly double 实际攻击力加成 = 0; + private readonly double 实际加成 = 0; public override void OnEffectGained(Character character) { - character.ExATK2 += 实际攻击力加成; + character.ExATK2 += 实际加成; } public override void OnEffectLost(Character character) { - character.ExATK2 -= 实际攻击力加成; + character.ExATK2 -= 实际加成; } - public ExATK(Skill skill, Character? source, Item? item) : base(skill) + public ExATK(Skill skill, Character? source = null, Item? item = null) : base(skill) { GamingQueue = skill.GamingQueue; Source = source; Item = item; if (skill.OtherArgs.Count > 0) { - IEnumerable keys = skill.OtherArgs.Keys.Where(s => s.Equals("exatk", StringComparison.CurrentCultureIgnoreCase)); - if (keys.Any() && double.TryParse(skill.OtherArgs[keys.First()].ToString(), out double exATK)) + string key = skill.OtherArgs.Keys.FirstOrDefault(s => s.Equals("exatk", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(skill.OtherArgs[key].ToString(), out double exATK)) { - 实际攻击力加成 = exATK; + 实际加成 = exATK; } } } diff --git a/Library/Effects/OpenEffects/ExActionCoefficient.cs b/Library/Effects/OpenEffects/ExActionCoefficient.cs new file mode 100644 index 0000000..36f6822 --- /dev/null +++ b/Library/Effects/OpenEffects/ExActionCoefficient.cs @@ -0,0 +1,42 @@ +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Testing.OpenEffects +{ + public class ExActionCoefficient : Effect + { + public override long Id => (long)EffectID.ExActionCoefficient; + public override string Name => "行动系数加成"; + public override string Description => $"增加角色 {实际加成 * 100:0.##}% 行动系数。" + (!TargetSelf ? $"来自:[ {Source} ]" + (Item != null ? $" 的 [ {Item.Name} ]" : "") : ""); + public override EffectType EffectType => EffectType.Item; + public override bool TargetSelf => true; + + public Item? Item { get; } + private readonly double 实际加成 = 0; + + public override void OnEffectGained(Character character) + { + character.ExActionCoefficient += 实际加成; + } + + public override void OnEffectLost(Character character) + { + character.ExActionCoefficient -= 实际加成; + } + + public ExActionCoefficient(Skill skill, Character? source = null, Item? item = null) : base(skill) + { + GamingQueue = skill.GamingQueue; + Source = source; + Item = item; + if (skill.OtherArgs.Count > 0) + { + string key = skill.OtherArgs.Keys.FirstOrDefault(s => s.Equals("exac", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(skill.OtherArgs[key].ToString(), out double exAC)) + { + 实际加成 = exAC; + } + } + } + } +} diff --git a/Library/Effects/OpenEffects/ExCDR.cs b/Library/Effects/OpenEffects/ExCDR.cs new file mode 100644 index 0000000..f55208b --- /dev/null +++ b/Library/Effects/OpenEffects/ExCDR.cs @@ -0,0 +1,42 @@ +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Testing.OpenEffects +{ + public class ExCDR : Effect + { + public override long Id => (long)EffectID.ExCDR; + public override string Name => "冷却缩减加成"; + public override string Description => $"增加角色 {实际加成 * 100:0.##}% 冷却缩减。" + (!TargetSelf ? $"来自:[ {Source} ]" + (Item != null ? $" 的 [ {Item.Name} ]" : "") : ""); + public override EffectType EffectType => EffectType.Item; + public override bool TargetSelf => true; + + public Item? Item { get; } + private readonly double 实际加成 = 0; + + public override void OnEffectGained(Character character) + { + character.ExCDR += 实际加成; + } + + public override void OnEffectLost(Character character) + { + character.ExCDR -= 实际加成; + } + + public ExCDR(Skill skill, Character? source = null, Item? item = null) : base(skill) + { + GamingQueue = skill.GamingQueue; + Source = source; + Item = item; + if (skill.OtherArgs.Count > 0) + { + string key = skill.OtherArgs.Keys.FirstOrDefault(s => s.Equals("excdr", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(skill.OtherArgs[key].ToString(), out double exCDR)) + { + 实际加成 = exCDR; + } + } + } + } +} diff --git a/Library/Effects/OpenEffects/ExCritDMG.cs b/Library/Effects/OpenEffects/ExCritDMG.cs new file mode 100644 index 0000000..a337d20 --- /dev/null +++ b/Library/Effects/OpenEffects/ExCritDMG.cs @@ -0,0 +1,42 @@ +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Testing.OpenEffects +{ + public class ExCritDMG : Effect + { + public override long Id => (long)EffectID.ExCritDMG; + public override string Name => "暴击伤害加成"; + public override string Description => $"增加角色 {实际加成 * 100:0.##}% 暴击伤害。" + (!TargetSelf ? $"来自:[ {Source} ]" + (Item != null ? $" 的 [ {Item.Name} ]" : "") : ""); + public override EffectType EffectType => EffectType.Item; + public override bool TargetSelf => true; + + public Item? Item { get; } + private readonly double 实际加成 = 0; + + public override void OnEffectGained(Character character) + { + character.ExCritDMG += 实际加成; + } + + public override void OnEffectLost(Character character) + { + character.ExCritDMG -= 实际加成; + } + + public ExCritDMG(Skill skill, Character? source = null, Item? item = null) : base(skill) + { + GamingQueue = skill.GamingQueue; + Source = source; + Item = item; + if (skill.OtherArgs.Count > 0) + { + string key = skill.OtherArgs.Keys.FirstOrDefault(s => s.Equals("excrd", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(skill.OtherArgs[key].ToString(), out double exCRD)) + { + 实际加成 = exCRD; + } + } + } + } +} diff --git a/Library/Effects/OpenEffects/ExCritRate.cs b/Library/Effects/OpenEffects/ExCritRate.cs new file mode 100644 index 0000000..213036c --- /dev/null +++ b/Library/Effects/OpenEffects/ExCritRate.cs @@ -0,0 +1,42 @@ +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Testing.OpenEffects +{ + public class ExCritRate : Effect + { + public override long Id => (long)EffectID.ExCritRate; + public override string Name => "暴击率加成"; + public override string Description => $"增加角色 {实际加成 * 100:0.##}% 暴击率。" + (!TargetSelf ? $"来自:[ {Source} ]" + (Item != null ? $" 的 [ {Item.Name} ]" : "") : ""); + public override EffectType EffectType => EffectType.Item; + public override bool TargetSelf => true; + + public Item? Item { get; } + private readonly double 实际加成 = 0; + + public override void OnEffectGained(Character character) + { + character.ExCritRate += 实际加成; + } + + public override void OnEffectLost(Character character) + { + character.ExCritRate -= 实际加成; + } + + public ExCritRate(Skill skill, Character? source = null, Item? item = null) : base(skill) + { + GamingQueue = skill.GamingQueue; + Source = source; + Item = item; + if (skill.OtherArgs.Count > 0) + { + string key = skill.OtherArgs.Keys.FirstOrDefault(s => s.Equals("excr", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(skill.OtherArgs[key].ToString(), out double exCR)) + { + 实际加成 = exCR; + } + } + } + } +} diff --git a/Library/Effects/OpenEffects/ExDEF.cs b/Library/Effects/OpenEffects/ExDEF.cs index 55b3d0e..424be1d 100644 --- a/Library/Effects/OpenEffects/ExDEF.cs +++ b/Library/Effects/OpenEffects/ExDEF.cs @@ -1,40 +1,40 @@ using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Constant; -namespace Milimoe.FunGame.Testing.Effects +namespace Milimoe.FunGame.Testing.OpenEffects { public class ExDEF : Effect { - public override long Id => 8002; + public override long Id => (long)EffectID.ExDEF; public override string Name => "物理护甲加成"; - public override string Description => $"增加角色 {实际物理护甲加成} 点物理护甲。" + (!TargetSelf ? $"来自:[ {Source} ]" + (Item != null ? $" 的 [ {Item.Name} ]" : "") : ""); + public override string Description => $"增加角色 {实际加成:0.##} 点物理护甲。" + (!TargetSelf ? $"来自:[ {Source} ]" + (Item != null ? $" 的 [ {Item.Name} ]" : "") : ""); public override EffectType EffectType => EffectType.Item; public override bool TargetSelf => true; public Item? Item { get; } - private readonly double 实际物理护甲加成 = 0; + private readonly double 实际加成 = 0; public override void OnEffectGained(Character character) { - character.ExDEF2 += 实际物理护甲加成; + character.ExDEF2 += 实际加成; } public override void OnEffectLost(Character character) { - character.ExDEF2 -= 实际物理护甲加成; + character.ExDEF2 -= 实际加成; } - public ExDEF(Skill skill, Character? source, Item? item) : base(skill) + public ExDEF(Skill skill, Character? source = null, Item? item = null) : base(skill) { GamingQueue = skill.GamingQueue; Source = source; Item = item; if (skill.OtherArgs.Count > 0) { - IEnumerable keys = skill.OtherArgs.Keys.Where(s => s.Equals("exdef", StringComparison.CurrentCultureIgnoreCase)); - if (keys.Any() && double.TryParse(skill.OtherArgs[keys.First()].ToString(), out double exDEF)) + string key = skill.OtherArgs.Keys.FirstOrDefault(s => s.Equals("exdef", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(skill.OtherArgs[key].ToString(), out double exDEF)) { - 实际物理护甲加成 = exDEF; + 实际加成 = exDEF; } } } diff --git a/Library/Effects/OpenEffects/ExEvadeRate.cs b/Library/Effects/OpenEffects/ExEvadeRate.cs new file mode 100644 index 0000000..96ebcf6 --- /dev/null +++ b/Library/Effects/OpenEffects/ExEvadeRate.cs @@ -0,0 +1,42 @@ +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Testing.OpenEffects +{ + public class ExEvadeRate : Effect + { + public override long Id => (long)EffectID.ExEvadeRate; + public override string Name => "闪避率加成"; + public override string Description => $"增加角色 {实际加成 * 100:0.##}% 闪避率。" + (!TargetSelf ? $"来自:[ {Source} ]" + (Item != null ? $" 的 [ {Item.Name} ]" : "") : ""); + public override EffectType EffectType => EffectType.Item; + public override bool TargetSelf => true; + + public Item? Item { get; } + private readonly double 实际加成 = 0; + + public override void OnEffectGained(Character character) + { + character.ExEvadeRate += 实际加成; + } + + public override void OnEffectLost(Character character) + { + character.ExEvadeRate -= 实际加成; + } + + public ExEvadeRate(Skill skill, Character? source = null, Item? item = null) : base(skill) + { + GamingQueue = skill.GamingQueue; + Source = source; + Item = item; + if (skill.OtherArgs.Count > 0) + { + string key = skill.OtherArgs.Keys.FirstOrDefault(s => s.Equals("exer", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(skill.OtherArgs[key].ToString(), out double exER)) + { + 实际加成 = exER; + } + } + } + } +} diff --git a/Library/Effects/OpenEffects/ExHR.cs b/Library/Effects/OpenEffects/ExHR.cs new file mode 100644 index 0000000..82220f5 --- /dev/null +++ b/Library/Effects/OpenEffects/ExHR.cs @@ -0,0 +1,42 @@ +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Testing.OpenEffects +{ + public class ExHR : Effect + { + public override long Id => (long)EffectID.ExHR; + public override string Name => "生命回复加成"; + public override string Description => $"增加角色 {实际加成:0.##} 点生命回复。" + (!TargetSelf ? $"来自:[ {Source} ]" + (Item != null ? $" 的 [ {Item.Name} ]" : "") : ""); + public override EffectType EffectType => EffectType.Item; + public override bool TargetSelf => true; + + public Item? Item { get; } + private readonly double 实际加成 = 0; + + public override void OnEffectGained(Character character) + { + character.ExHR += 实际加成; + } + + public override void OnEffectLost(Character character) + { + character.ExHR -= 实际加成; + } + + public ExHR(Skill skill, Character? source = null, Item? item = null) : base(skill) + { + GamingQueue = skill.GamingQueue; + Source = source; + Item = item; + if (skill.OtherArgs.Count > 0) + { + string key = skill.OtherArgs.Keys.FirstOrDefault(s => s.Equals("exhr", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(skill.OtherArgs[key].ToString(), out double exHR)) + { + 实际加成 = exHR; + } + } + } + } +} diff --git a/Library/Effects/OpenEffects/ExINT.cs b/Library/Effects/OpenEffects/ExINT.cs new file mode 100644 index 0000000..77effde --- /dev/null +++ b/Library/Effects/OpenEffects/ExINT.cs @@ -0,0 +1,42 @@ + using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Testing.OpenEffects +{ + public class ExINT : Effect + { + public override long Id => (long)EffectID.ExINT; + public override string Name => "智力加成"; + public override string Description => $"增加角色 {实际加成:0.##} 点智力。" + (!TargetSelf ? $"来自:[ {Source} ]" + (Item != null ? $" 的 [ {Item.Name} ]" : "") : ""); + public override EffectType EffectType => EffectType.Item; + public override bool TargetSelf => true; + + public Item? Item { get; } + private readonly double 实际加成 = 0; + + public override void OnEffectGained(Character character) + { + character.ExINT += 实际加成; + } + + public override void OnEffectLost(Character character) + { + character.ExINT -= 实际加成; + } + + public ExINT(Skill skill, Character? source = null, Item? item = null) : base(skill) + { + GamingQueue = skill.GamingQueue; + Source = source; + Item = item; + if (skill.OtherArgs.Count > 0) + { + string key = skill.OtherArgs.Keys.FirstOrDefault(s => s.Equals("exint", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(skill.OtherArgs[key].ToString(), out double exINT)) + { + 实际加成 = exINT; + } + } + } + } +} diff --git a/Library/Effects/OpenEffects/ExMDF.cs b/Library/Effects/OpenEffects/ExMDF.cs new file mode 100644 index 0000000..78f3428 --- /dev/null +++ b/Library/Effects/OpenEffects/ExMDF.cs @@ -0,0 +1,123 @@ +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Testing.OpenEffects +{ + public class ExMDF : Effect + { + public override long Id => (long)EffectID.ExMDF; + public override string Name => "魔法抗性加成"; + public override string Description => $"增加角色 {实际加成 * 100:0.##}% {CharacterSet.GetMagicResistanceName(魔法类型)}。" + (!TargetSelf ? $"来自:[ {Source} ]" + (Item != null ? $" 的 [ {Item.Name} ]" : "") : ""); + public override EffectType EffectType => EffectType.Item; + public override bool TargetSelf => true; + + public Item? Item { get; } + private readonly double 实际加成 = 0; + private readonly MagicType 魔法类型 = MagicType.None; + + public override void OnEffectGained(Character character) + { + switch (魔法类型) + { + case MagicType.Starmark: + character.MDF.Starmark += 实际加成; + break; + case MagicType.PurityNatural: + character.MDF.PurityNatural += 实际加成; + break; + case MagicType.PurityContemporary: + character.MDF.PurityContemporary += 实际加成; + break; + case MagicType.Bright: + character.MDF.Bright += 实际加成; + break; + case MagicType.Shadow: + character.MDF.Shadow += 实际加成; + break; + case MagicType.Element: + character.MDF.Element += 实际加成; + break; + case MagicType.Fleabane: + character.MDF.Fleabane += 实际加成; + break; + case MagicType.Particle: + character.MDF.Particle += 实际加成; + break; + case MagicType.None: + default: + character.MDF.None += 实际加成; + character.MDF.Starmark += 实际加成; + character.MDF.PurityNatural += 实际加成; + character.MDF.PurityContemporary += 实际加成; + character.MDF.Bright += 实际加成; + character.MDF.Shadow += 实际加成; + character.MDF.Element += 实际加成; + character.MDF.Fleabane += 实际加成; + character.MDF.Particle += 实际加成; + break; + } + } + + public override void OnEffectLost(Character character) + { + switch (魔法类型) + { + case MagicType.Starmark: + character.MDF.Starmark -= 实际加成; + break; + case MagicType.PurityNatural: + character.MDF.PurityNatural -= 实际加成; + break; + case MagicType.PurityContemporary: + character.MDF.PurityContemporary -= 实际加成; + break; + case MagicType.Bright: + character.MDF.Bright -= 实际加成; + break; + case MagicType.Shadow: + character.MDF.Shadow -= 实际加成; + break; + case MagicType.Element: + character.MDF.Element -= 实际加成; + break; + case MagicType.Fleabane: + character.MDF.Fleabane -= 实际加成; + break; + case MagicType.Particle: + character.MDF.Particle -= 实际加成; + break; + case MagicType.None: + default: + character.MDF.None -= 实际加成; + break; + } + } + + public ExMDF(Skill skill, Character? source = null, Item? item = null) : base(skill) + { + GamingQueue = skill.GamingQueue; + Source = source; + Item = item; + if (skill.OtherArgs.Count > 0) + { + string key = skill.OtherArgs.Keys.FirstOrDefault(s => s.Equals("mdfType", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && int.TryParse(skill.OtherArgs[key].ToString(), out int mdfType)) + { + if (Enum.IsDefined(typeof(MagicType), mdfType)) + { + 魔法类型 = (MagicType)mdfType; + } + else + { + 魔法类型 = MagicType.None; + } + } + key = skill.OtherArgs.Keys.FirstOrDefault(s => s.Equals("mdfvalue", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(skill.OtherArgs[key].ToString(), out double mdfValue)) + { + 实际加成 = mdfValue; + } + } + } + } +} diff --git a/Library/Effects/OpenEffects/ExMR.cs b/Library/Effects/OpenEffects/ExMR.cs new file mode 100644 index 0000000..91da5ad --- /dev/null +++ b/Library/Effects/OpenEffects/ExMR.cs @@ -0,0 +1,42 @@ +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Testing.OpenEffects +{ + public class ExMR : Effect + { + public override long Id => (long)EffectID.ExMR; + public override string Name => "魔法回复加成"; + public override string Description => $"增加角色 {实际加成:0.##} 点魔法回复。" + (!TargetSelf ? $"来自:[ {Source} ]" + (Item != null ? $" 的 [ {Item.Name} ]" : "") : ""); + public override EffectType EffectType => EffectType.Item; + public override bool TargetSelf => true; + + public Item? Item { get; } + private readonly double 实际加成 = 0; + + public override void OnEffectGained(Character character) + { + character.ExMR += 实际加成; + } + + public override void OnEffectLost(Character character) + { + character.ExMR -= 实际加成; + } + + public ExMR(Skill skill, Character? source = null, Item? item = null) : base(skill) + { + GamingQueue = skill.GamingQueue; + Source = source; + Item = item; + if (skill.OtherArgs.Count > 0) + { + string key = skill.OtherArgs.Keys.FirstOrDefault(s => s.Equals("exmr", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(skill.OtherArgs[key].ToString(), out double exMR)) + { + 实际加成 = exMR; + } + } + } + } +} diff --git a/Library/Effects/OpenEffects/ExMaxHP.cs b/Library/Effects/OpenEffects/ExMaxHP.cs new file mode 100644 index 0000000..1d3e388 --- /dev/null +++ b/Library/Effects/OpenEffects/ExMaxHP.cs @@ -0,0 +1,42 @@ +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Testing.OpenEffects +{ + public class ExMaxHP : Effect + { + public override long Id => (long)EffectID.ExMaxHP; + public override string Name => "最大生命值加成"; + public override string Description => $"增加角色 {实际加成:0.##} 点最大生命值。" + (!TargetSelf ? $"来自:[ {Source} ]" + (Item != null ? $" 的 [ {Item.Name} ]" : "") : ""); + public override EffectType EffectType => EffectType.Item; + public override bool TargetSelf => true; + + public Item? Item { get; } + private readonly double 实际加成 = 0; + + public override void OnEffectGained(Character character) + { + character.ExHP2 += 实际加成; + } + + public override void OnEffectLost(Character character) + { + character.ExHP2 -= 实际加成; + } + + public ExMaxHP(Skill skill, Character? source = null, Item? item = null) : base(skill) + { + GamingQueue = skill.GamingQueue; + Source = source; + Item = item; + if (skill.OtherArgs.Count > 0) + { + string key = skill.OtherArgs.Keys.FirstOrDefault(s => s.Equals("exhp", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(skill.OtherArgs[key].ToString(), out double exHP)) + { + 实际加成 = exHP; + } + } + } + } +} diff --git a/Library/Effects/OpenEffects/ExMaxMP.cs b/Library/Effects/OpenEffects/ExMaxMP.cs new file mode 100644 index 0000000..ea090f0 --- /dev/null +++ b/Library/Effects/OpenEffects/ExMaxMP.cs @@ -0,0 +1,42 @@ +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Testing.OpenEffects +{ + public class ExMaxMP : Effect + { + public override long Id => (long)EffectID.ExMaxMP; + public override string Name => "最大魔法值加成"; + public override string Description => $"增加角色 {实际加成:0.##} 点最大魔法值。" + (!TargetSelf ? $"来自:[ {Source} ]" + (Item != null ? $" 的 [ {Item.Name} ]" : "") : ""); + public override EffectType EffectType => EffectType.Item; + public override bool TargetSelf => true; + + public Item? Item { get; } + private readonly double 实际加成 = 0; + + public override void OnEffectGained(Character character) + { + character.ExMP2 += 实际加成; + } + + public override void OnEffectLost(Character character) + { + character.ExMP2 -= 实际加成; + } + + public ExMaxMP(Skill skill, Character? source = null, Item? item = null) : base(skill) + { + GamingQueue = skill.GamingQueue; + Source = source; + Item = item; + if (skill.OtherArgs.Count > 0) + { + string key = skill.OtherArgs.Keys.FirstOrDefault(s => s.Equals("exmp", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(skill.OtherArgs[key].ToString(), out double exMP)) + { + 实际加成 = exMP; + } + } + } + } +} diff --git a/Library/Effects/OpenEffects/ExPDR.cs b/Library/Effects/OpenEffects/ExPDR.cs new file mode 100644 index 0000000..b0a6027 --- /dev/null +++ b/Library/Effects/OpenEffects/ExPDR.cs @@ -0,0 +1,42 @@ +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Testing.OpenEffects +{ + public class ExPDR : Effect + { + public override long Id => (long)EffectID.ExPDR; + public override string Name => "物理伤害减免加成"; + public override string Description => $"增加角色 {实际加成 * 100:0.##}% 物理伤害减免。" + (!TargetSelf ? $"来自:[ {Source} ]" + (Item != null ? $" 的 [ {Item.Name} ]" : "") : ""); + public override EffectType EffectType => EffectType.Item; + public override bool TargetSelf => true; + + public Item? Item { get; } + private readonly double 实际加成 = 0; + + public override void OnEffectGained(Character character) + { + character.ExPDR += 实际加成; + } + + public override void OnEffectLost(Character character) + { + character.ExPDR -= 实际加成; + } + + public ExPDR(Skill skill, Character? source = null, Item? item = null) : base(skill) + { + GamingQueue = skill.GamingQueue; + Source = source; + Item = item; + if (skill.OtherArgs.Count > 0) + { + string key = skill.OtherArgs.Keys.FirstOrDefault(s => s.Equals("expdr", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(skill.OtherArgs[key].ToString(), out double exPDR)) + { + 实际加成 = exPDR; + } + } + } + } +} diff --git a/Library/Effects/OpenEffects/ExSPD.cs b/Library/Effects/OpenEffects/ExSPD.cs new file mode 100644 index 0000000..4d0f2df --- /dev/null +++ b/Library/Effects/OpenEffects/ExSPD.cs @@ -0,0 +1,42 @@ +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Testing.OpenEffects +{ + public class ExSPD : Effect + { + public override long Id => (long)EffectID.ExSPD; + public override string Name => "行动速度加成"; + public override string Description => $"增加角色 {实际加成:0.##} 点行动速度。" + (!TargetSelf ? $"来自:[ {Source} ]" + (Item != null ? $" 的 [ {Item.Name} ]" : "") : ""); + public override EffectType EffectType => EffectType.Item; + public override bool TargetSelf => true; + + public Item? Item { get; } + private readonly double 实际加成 = 0; + + public override void OnEffectGained(Character character) + { + character.ExSPD += 实际加成; + } + + public override void OnEffectLost(Character character) + { + character.ExSPD -= 实际加成; + } + + public ExSPD(Skill skill, Character? source = null, Item? item = null) : base(skill) + { + GamingQueue = skill.GamingQueue; + Source = source; + Item = item; + if (skill.OtherArgs.Count > 0) + { + string key = skill.OtherArgs.Keys.FirstOrDefault(s => s.Equals("exspd", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(skill.OtherArgs[key].ToString(), out double exSPD)) + { + 实际加成 = exSPD; + } + } + } + } +} diff --git a/Library/Effects/OpenEffects/ExSTR.cs b/Library/Effects/OpenEffects/ExSTR.cs index e1d1706..5c8b913 100644 --- a/Library/Effects/OpenEffects/ExSTR.cs +++ b/Library/Effects/OpenEffects/ExSTR.cs @@ -1,40 +1,40 @@ using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Constant; -namespace Milimoe.FunGame.Testing.Effects +namespace Milimoe.FunGame.Testing.OpenEffects { public class ExSTR : Effect { - public override long Id => 8003; + public override long Id => (long)EffectID.ExSTR; public override string Name => "力量加成"; - public override string Description => $"增加角色 {实际力量加成} 点力量。" + (!TargetSelf ? $"来自:[ {Source} ]" + (Item != null ? $" 的 [ {Item.Name} ]" : "") : ""); + public override string Description => $"增加角色 {实际加成:0.##} 点力量。" + (!TargetSelf ? $"来自:[ {Source} ]" + (Item != null ? $" 的 [ {Item.Name} ]" : "") : ""); public override EffectType EffectType => EffectType.Item; public override bool TargetSelf => true; public Item? Item { get; } - private readonly double 实际力量加成 = 0; + private readonly double 实际加成 = 0; public override void OnEffectGained(Character character) { - character.ExDEF2 += 实际力量加成; + character.ExDEF2 += 实际加成; } public override void OnEffectLost(Character character) { - character.ExDEF2 -= 实际力量加成; + character.ExDEF2 -= 实际加成; } - public ExSTR(Skill skill, Character? source, Item? item) : base(skill) + public ExSTR(Skill skill, Character? source = null, Item? item = null) : base(skill) { GamingQueue = skill.GamingQueue; Source = source; Item = item; if (skill.OtherArgs.Count > 0) { - IEnumerable keys = skill.OtherArgs.Keys.Where(s => s.Equals("exstr", StringComparison.CurrentCultureIgnoreCase)); - if (keys.Any() && double.TryParse(skill.OtherArgs[keys.First()].ToString(), out double exSTR)) + string key = skill.OtherArgs.Keys.FirstOrDefault(s => s.Equals("exstr", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(skill.OtherArgs[key].ToString(), out double exSTR)) { - 实际力量加成 = exSTR; + 实际加成 = exSTR; } } } diff --git a/Library/Effects/OpenEffects/MagicalPenetration.cs b/Library/Effects/OpenEffects/MagicalPenetration.cs new file mode 100644 index 0000000..9d8d52a --- /dev/null +++ b/Library/Effects/OpenEffects/MagicalPenetration.cs @@ -0,0 +1,42 @@ +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Testing.OpenEffects +{ + public class MagicalPenetration : Effect + { + public override long Id => (long)EffectID.MagicalPenetration; + public override string Name => "魔法穿透加成"; + public override string Description => $"增加角色 {实际加成 * 100:0.##}% 魔法穿透。" + (!TargetSelf ? $"来自:[ {Source} ]" + (Item != null ? $" 的 [ {Item.Name} ]" : "") : ""); + public override EffectType EffectType => EffectType.Item; + public override bool TargetSelf => true; + + public Item? Item { get; } + private readonly double 实际加成 = 0; + + public override void OnEffectGained(Character character) + { + character.MagicalPenetration += 实际加成; + } + + public override void OnEffectLost(Character character) + { + character.MagicalPenetration -= 实际加成; + } + + public MagicalPenetration(Skill skill, Character? source = null, Item? item = null) : base(skill) + { + GamingQueue = skill.GamingQueue; + Source = source; + Item = item; + if (skill.OtherArgs.Count > 0) + { + string key = skill.OtherArgs.Keys.FirstOrDefault(s => s.Equals("exmp", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(skill.OtherArgs[key].ToString(), out double exMP)) + { + 实际加成 = exMP; + } + } + } + } +} diff --git a/Library/Effects/OpenEffects/NormalAttackHardTimeReduce.cs b/Library/Effects/OpenEffects/NormalAttackHardTimeReduce.cs new file mode 100644 index 0000000..32a524f --- /dev/null +++ b/Library/Effects/OpenEffects/NormalAttackHardTimeReduce.cs @@ -0,0 +1,42 @@ +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Testing.OpenEffects +{ + public class NormalAttackHardTimeReduce : Effect + { + public override long Id => (long)EffectID.NormalAttackHardTimeReduce; + public override string Name => Skill.Name; + public override string Description => $"减少角色的普通攻击 {实际硬直时间减少:0.##} 硬直时间。" + (!TargetSelf ? $"来自:[ {Source} ]" + (Item != null ? $" 的 [ {Item.Name} ]" : "") : ""); + public override EffectType EffectType => EffectType.Item; + public override bool TargetSelf => true; + + public Item? Item { get; } + private readonly double 实际硬直时间减少 = 0; + + public override void OnEffectGained(Character character) + { + character.NormalAttack.HardnessTime -= 实际硬直时间减少; + } + + public override void OnEffectLost(Character character) + { + character.NormalAttack.HardnessTime += 实际硬直时间减少; + } + + public NormalAttackHardTimeReduce(Skill skill, Character? source = null, Item? item = null) : base(skill) + { + GamingQueue = skill.GamingQueue; + Source = source; + Item = item; + if (skill.OtherArgs.Count > 0) + { + string key = skill.OtherArgs.Keys.FirstOrDefault(s => s.Equals("nahtr", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(skill.OtherArgs[key].ToString(), out double nahtr)) + { + 实际硬直时间减少 = nahtr; + } + } + } + } +} diff --git a/Library/Effects/OpenEffects/PhysicalPenetration.cs b/Library/Effects/OpenEffects/PhysicalPenetration.cs new file mode 100644 index 0000000..6197f0a --- /dev/null +++ b/Library/Effects/OpenEffects/PhysicalPenetration.cs @@ -0,0 +1,42 @@ +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Testing.OpenEffects +{ + public class PhysicalPenetration : Effect + { + public override long Id => (long)EffectID.PhysicalPenetration; + public override string Name => "物理穿透加成"; + public override string Description => $"增加角色 {实际加成 * 100:0.##}% 物理穿透。" + (!TargetSelf ? $"来自:[ {Source} ]" + (Item != null ? $" 的 [ {Item.Name} ]" : "") : ""); + public override EffectType EffectType => EffectType.Item; + public override bool TargetSelf => true; + + public Item? Item { get; } + private readonly double 实际加成 = 0; + + public override void OnEffectGained(Character character) + { + character.PhysicalPenetration += 实际加成; + } + + public override void OnEffectLost(Character character) + { + character.PhysicalPenetration -= 实际加成; + } + + public PhysicalPenetration(Skill skill, Character? source = null, Item? item = null) : base(skill) + { + GamingQueue = skill.GamingQueue; + Source = source; + Item = item; + if (skill.OtherArgs.Count > 0) + { + string key = skill.OtherArgs.Keys.FirstOrDefault(s => s.Equals("expp", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(skill.OtherArgs[key].ToString(), out double exPP)) + { + 实际加成 = exPP; + } + } + } + } +} diff --git a/Library/Effects/OpenEffects/SkillHardTimeReduce.cs b/Library/Effects/OpenEffects/SkillHardTimeReduce.cs new file mode 100644 index 0000000..2220923 --- /dev/null +++ b/Library/Effects/OpenEffects/SkillHardTimeReduce.cs @@ -0,0 +1,58 @@ +using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Testing.OpenEffects +{ + public class SkillHardTimeReduce : Effect + { + public override long Id => (long)EffectID.SkillHardTimeReduce; + public override string Name => Skill.Name; + public override string Description => $"减少角色的所有主动技能 {实际硬直时间减少:0.##} 硬直时间。" + (!TargetSelf ? $"来自:[ {Source} ]" + (Item != null ? $" 的 [ {Item.Name} ]" : "") : ""); + public override EffectType EffectType => EffectType.Item; + public override bool TargetSelf => true; + + public Item? Item { get; } + private readonly double 实际硬直时间减少 = 0; + + public override void OnEffectGained(Character character) + { + foreach (Skill s in character.Skills) + { + s.HardnessTime -= 实际硬直时间减少; + } + foreach (Skill? s in character.Items.Select(i => i.Skills.Active)) + { + if (s != null) + s.HardnessTime -= 实际硬直时间减少; + } + } + + public override void OnEffectLost(Character character) + { + foreach (Skill s in character.Skills) + { + s.HardnessTime += 实际硬直时间减少; + } + foreach (Skill? s in character.Items.Select(i => i.Skills.Active)) + { + if (s != null) + s.HardnessTime += 实际硬直时间减少; + } + } + + public SkillHardTimeReduce(Skill skill, Character? source = null, Item? item = null) : base(skill) + { + GamingQueue = skill.GamingQueue; + Source = source; + Item = item; + if (skill.OtherArgs.Count > 0) + { + string key = skill.OtherArgs.Keys.FirstOrDefault(s => s.Equals("shtr", StringComparison.CurrentCultureIgnoreCase)) ?? ""; + if (key.Length > 0 && double.TryParse(skill.OtherArgs[key].ToString(), out double shtr)) + { + 实际硬直时间减少 = shtr; + } + } + } + } +} diff --git a/Library/Items/Accessory/攻击之爪.cs b/Library/Items/Accessory/攻击之爪.cs index 170f2b7..b83446f 100644 --- a/Library/Items/Accessory/攻击之爪.cs +++ b/Library/Items/Accessory/攻击之爪.cs @@ -1,7 +1,7 @@ -using Milimoe.FunGame.Testing.Effects; -using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Constant; using Milimoe.FunGame.Testing.Skills; +using Milimoe.FunGame.Testing.ItemEffects; namespace Milimoe.FunGame.Testing.Items { @@ -52,7 +52,7 @@ namespace Milimoe.FunGame.Testing.Items { Level = 1; Item = item; - Effects.Add(new 攻击力加成(this, character, item, exATK)); + Effects.Add(new 攻击力加成(this, exATK, character, item)); } public override IEnumerable AddInactiveEffectToCharacter() diff --git a/Library/Items/Weapon/独奏弓.cs b/Library/Items/Weapon/独奏弓.cs index 970ce72..19258f9 100644 --- a/Library/Items/Weapon/独奏弓.cs +++ b/Library/Items/Weapon/独奏弓.cs @@ -1,6 +1,6 @@ -using Milimoe.FunGame.Testing.Effects; -using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Constant; +using Milimoe.FunGame.Testing.ItemEffects; namespace FunGame.Testing.Items { @@ -22,7 +22,6 @@ namespace FunGame.Testing.Items public override long Id => 5002; public override string Name => "独奏弓"; public override string Description => $"增加角色 {攻击力加成} 点攻击力,减少普通攻击 {硬直时间减少} 硬直时间。"; - public Item Item { get; } private readonly double 攻击力加成 = 80; private readonly double 硬直时间减少 = 2; @@ -31,8 +30,8 @@ namespace FunGame.Testing.Items { Level = 1; Item = item; - Effects.Add(new 攻击力加成(this, character, item, 攻击力加成)); - Effects.Add(new 普攻硬直时间减少(this, character, item, 硬直时间减少)); + Effects.Add(new 攻击力加成(this, 攻击力加成, character, item)); + Effects.Add(new 普攻硬直时间减少(this, 硬直时间减少, character, item)); } public override IEnumerable AddInactiveEffectToCharacter() diff --git a/Library/Skills/ColdBlue/嗜血本能.cs b/Library/Skills/ColdBlue/嗜血本能.cs index 13d8133..e457a21 100644 --- a/Library/Skills/ColdBlue/嗜血本能.cs +++ b/Library/Skills/ColdBlue/嗜血本能.cs @@ -1,5 +1,4 @@ -using Milimoe.FunGame.Core.Api.Utility; -using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Constant; using Milimoe.FunGame.Testing.Effects; @@ -30,7 +29,7 @@ namespace Milimoe.FunGame.Testing.Skills public override double Duration => 30; public HashSet 角色有第四层 { get; } = []; - private double 吸血 => Calculation.Round4Digits(0.03 * Level); + private double 吸血 => 0.03 * Level; public override void AfterDamageCalculation(Character character, Character enemy, double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, DamageResult damageResult) { @@ -45,9 +44,9 @@ namespace Milimoe.FunGame.Testing.Skills { 层数 = 4; } - double 实际吸血 = Calculation.Round2Digits(吸血 * 层数 * damage); + double 实际吸血 = 吸血 * 层数 * damage; character.HP += 实际吸血; - WriteLine($"[ {character} ] 回复了 {实际吸血} 点生命值!"); + WriteLine($"[ {character} ] 回复了 {实际吸血:0.##} 点生命值!"); } } diff --git a/Library/Skills/ColdBlue/累积之压.cs b/Library/Skills/ColdBlue/累积之压.cs index eab67cc..ae351ab 100644 --- a/Library/Skills/ColdBlue/累积之压.cs +++ b/Library/Skills/ColdBlue/累积之压.cs @@ -1,5 +1,4 @@ -using Milimoe.FunGame.Core.Api.Utility; -using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Constant; using Milimoe.FunGame.Testing.Effects; @@ -57,7 +56,7 @@ namespace Milimoe.FunGame.Testing.Skills { // 移除标记 enemy.Effects.Remove(e); - double 额外伤害 = Calculation.Round2Digits(enemy.MaxHP * 系数); + double 额外伤害 = enemy.MaxHP * 系数; WriteLine($"[ {character} ] 发动了累积之压!将对 [ {enemy} ] 造成眩晕和额外伤害!"); // 眩晕 IEnumerable effects3 = enemy.Effects.Where(e => e is 眩晕 && e.Skill == Skill); diff --git a/Library/Skills/马猴烧酒/毁灭之势.cs b/Library/Skills/MagicalGirl/毁灭之势.cs similarity index 82% rename from Library/Skills/马猴烧酒/毁灭之势.cs rename to Library/Skills/MagicalGirl/毁灭之势.cs index c53eee4..01ad7f6 100644 --- a/Library/Skills/马猴烧酒/毁灭之势.cs +++ b/Library/Skills/MagicalGirl/毁灭之势.cs @@ -1,5 +1,4 @@ -using Milimoe.FunGame.Core.Api.Utility; -using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Constant; namespace Milimoe.FunGame.Testing.Skills @@ -39,12 +38,12 @@ namespace Milimoe.FunGame.Testing.Skills { 累计伤害 = 0; } - + if (character == Skill.Character) { - double 实际伤害提升 = Calculation.Round2Digits(damage * 累计伤害); - damage = Calculation.Round2Digits(damage + 实际伤害提升); - if (实际伤害提升 > 0) WriteLine($"[ {character} ] 的伤害提升了 {实际伤害提升} 点!"); + double 实际伤害提升 = damage * 累计伤害; + damage += 实际伤害提升; + if (实际伤害提升 > 0) WriteLine($"[ {character} ] 的伤害提升了 {实际伤害提升:0.##} 点!"); } } return false; @@ -52,7 +51,7 @@ namespace Milimoe.FunGame.Testing.Skills public override void OnTimeElapsed(Character character, double eapsed) { - 累计伤害 = Calculation.Round4Digits(累计伤害 + 伤害提升 * eapsed); + 累计伤害 += 伤害提升 * eapsed; WriteLine($"[ {character} ] 的 [ {Name} ] 效果增加了,当前总提升:{累计伤害 * 100:0.##}%。"); } } diff --git a/Library/Skills/马猴烧酒/绝对领域.cs b/Library/Skills/MagicalGirl/绝对领域.cs similarity index 80% rename from Library/Skills/马猴烧酒/绝对领域.cs rename to Library/Skills/MagicalGirl/绝对领域.cs index 1fa9d21..c7a0c4f 100644 --- a/Library/Skills/马猴烧酒/绝对领域.cs +++ b/Library/Skills/MagicalGirl/绝对领域.cs @@ -1,5 +1,4 @@ -using Milimoe.FunGame.Core.Api.Utility; -using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Constant; namespace Milimoe.FunGame.Testing.Skills @@ -23,13 +22,13 @@ namespace Milimoe.FunGame.Testing.Skills { public override long Id => Skill.Id; public override string Name => Skill.Name; - public override string Description => $"{Duration} 时间内无法受到任何伤害,且敏捷提升 {系数 * 100:0.##}% [ {敏捷提升} ]。此技能会消耗至少 100 点能量。"; + public override string Description => $"{Duration:0.##} 时间内无法受到任何伤害,且敏捷提升 {系数 * 100:0.##}% [ {敏捷提升:0.##} ]。此技能会消耗至少 100 点能量。"; public override bool TargetSelf => true; public override bool Durative => true; - public override double Duration => Calculation.Round2Digits(16 + 释放时的能量值 * 0.03); + public override double Duration => 16 + 释放时的能量值 * 0.03; - private double 系数 => Calculation.Round4Digits(0.3 + 0.03 * (Level - 1)); - private double 敏捷提升 => Calculation.Round2Digits(系数 * Skill.Character?.BaseAGI ?? 0); + private double 系数 => 0.3 + 0.03 * (Level - 1); + private double 敏捷提升 => 系数 * Skill.Character?.BaseAGI ?? 0; private double 实际敏捷提升 = 0; private double 释放时的能量值 = 0; @@ -37,7 +36,7 @@ namespace Milimoe.FunGame.Testing.Skills { 实际敏捷提升 = 敏捷提升; character.ExAGI += 实际敏捷提升; - WriteLine($"[ {character} ] 的敏捷提升了 {系数 * 100:0.##}% [ {实际敏捷提升} ] !"); + WriteLine($"[ {character} ] 的敏捷提升了 {系数 * 100:0.##}% [ {实际敏捷提升:0.##} ] !"); } public override void OnEffectLost(Character character) diff --git a/Library/Skills/Mayor/精准打击.cs b/Library/Skills/Mayor/精准打击.cs index ac2aff7..0498a13 100644 --- a/Library/Skills/Mayor/精准打击.cs +++ b/Library/Skills/Mayor/精准打击.cs @@ -1,5 +1,4 @@ -using Milimoe.FunGame.Core.Api.Utility; -using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Constant; namespace Milimoe.FunGame.Testing.Skills @@ -28,8 +27,8 @@ namespace Milimoe.FunGame.Testing.Skills public override bool Durative => true; public override double Duration => 30; - private double 暴击率提升 => Calculation.Round4Digits(0.2 + 0.03 * (Level - 1)); - private double 暴击伤害提升 => Calculation.Round4Digits(0.8 + 0.04 * (Level - 1)); + private double 暴击率提升 => 0.2 + 0.03 * (Level - 1); + private double 暴击伤害提升 => 0.8 + 0.04 * (Level - 1); private double 实际暴击率提升 = 0; private double 实际暴击伤害提升 = 0; diff --git a/Library/Skills/NanGanyu/三重叠加.cs b/Library/Skills/NanGanyu/三重叠加.cs index d2bf8dc..6a049dd 100644 --- a/Library/Skills/NanGanyu/三重叠加.cs +++ b/Library/Skills/NanGanyu/三重叠加.cs @@ -40,7 +40,7 @@ namespace Milimoe.FunGame.Testing.Skills e.释放次数 = 0; } } - + public override void OnEffectLost(Character character) { IEnumerable effects = character.Effects.Where(e => e is 灵能反射特效); diff --git a/Library/Skills/NanGanyu/灵能反射.cs b/Library/Skills/NanGanyu/灵能反射.cs index ac7bb56..3ed1117 100644 --- a/Library/Skills/NanGanyu/灵能反射.cs +++ b/Library/Skills/NanGanyu/灵能反射.cs @@ -1,5 +1,4 @@ -using Milimoe.FunGame.Core.Api.Utility; -using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Constant; namespace Milimoe.FunGame.Testing.Skills @@ -25,19 +24,13 @@ namespace Milimoe.FunGame.Testing.Skills { public override long Id => Skill.Id; public override string Name => Skill.Name; - public override string Description => $"每释放 {触发硬直次数} 次魔法才会触发硬直时间,且魔法命中时基于 25% 智力 [ {获得额外能量值} ] 获得额外能量值。"; + public override string Description => $"每释放 {触发硬直次数:0.##} 次魔法才会触发硬直时间,且魔法命中时基于 25% 智力 [ {获得额外能量值:0.##} ] 获得额外能量值。"; public override bool TargetSelf => true; public bool 是否支持普攻 { get; set; } = false; public int 触发硬直次数 { get; set; } = 2; public int 释放次数 { get; set; } = 0; - public double 获得额外能量值 - { - get - { - return Calculation.Round2Digits(0.25 * Skill.Character?.INT ?? 0); - } - } + public double 获得额外能量值 => 0.25 * Skill.Character?.INT ?? 0; public override void AfterDamageCalculation(Character character, Character enemy, double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, DamageResult damageResult) { @@ -45,13 +38,13 @@ namespace Milimoe.FunGame.Testing.Skills { double 实际获得能量值 = 获得额外能量值; character.EP += 实际获得能量值; - WriteLine("[ " + character + " ] 发动了灵能反射!额外获得了 " + 实际获得能量值 + " 能量!"); + WriteLine($"[ {character} ] 发动了灵能反射!额外获得了 {实际获得能量值:0.##} 能量!"); IEnumerable effects = character.Effects.Where(e => e is 三重叠加特效); if (effects.Any() && effects.First() is 三重叠加特效 e) { - double 获得的魔法值 = Calculation.Round2Digits(实际获得能量值 * 10); + double 获得的魔法值 = 实际获得能量值 * 10; character.MP += 获得的魔法值; - WriteLine("[ " + character + " ] 发动了三重叠加!回复了 " + 获得的魔法值 + " 魔法值!"); + WriteLine($"[ {character} ] 发动了三重叠加!回复了 {获得的魔法值:0.##} 魔法值!"); } } } @@ -63,7 +56,7 @@ namespace Milimoe.FunGame.Testing.Skills AlterHardnessTime(character, ref baseHardnessTime, ref isCheckProtected); } } - + public override void AlterHardnessTimeAfterCastSkill(Character character, Skill skill, ref double baseHardnessTime, ref bool isCheckProtected) { if (skill.SkillType == SkillType.Magic) diff --git a/Library/Skills/NiuNan/变幻之心.cs b/Library/Skills/NiuNan/变幻之心.cs index 3e8f8e4..f200aa4 100644 --- a/Library/Skills/NiuNan/变幻之心.cs +++ b/Library/Skills/NiuNan/变幻之心.cs @@ -1,5 +1,4 @@ -using Milimoe.FunGame.Core.Api.Utility; -using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Constant; namespace Milimoe.FunGame.Testing.Skills @@ -26,8 +25,8 @@ namespace Milimoe.FunGame.Testing.Skills public override string Description => $"检查 [ 智慧与力量 ] 的模式。在力量模式下,立即回复 {生命值回复 * 100:0.##}% 生命值;智力模式下,下一次魔法伤害提升 {伤害提升 * 100:0.##}%。"; public override bool TargetSelf => true; - private double 生命值回复 => Calculation.Round4Digits(0.25 + 0.03 * (Level - 1)); - private double 伤害提升 => Calculation.Round4Digits(0.55 + 0.25 * (Level - 1)); + private double 生命值回复 => 0.25 + 0.03 * (Level - 1); + private double 伤害提升 => 0.55 + 0.25 * (Level - 1); public override void OnEffectGained(Character character) { @@ -44,9 +43,9 @@ namespace Milimoe.FunGame.Testing.Skills if (character == Skill.Character && isMagicDamage) { double 实际伤害提升百分比 = 伤害提升; - double 实际伤害提升 = Calculation.Round2Digits(damage * 实际伤害提升百分比); - damage = Calculation.Round2Digits(damage + 实际伤害提升); - WriteLine("[ " + character + " ] 发动了变幻之心!伤害提升了 " + 实际伤害提升 + " 点!"); + double 实际伤害提升 = damage * 实际伤害提升百分比; + damage += 实际伤害提升; + WriteLine($"[ {character} ] 发动了变幻之心!伤害提升了 {实际伤害提升:0.##} 点!"); character.Effects.Remove(this); OnEffectLost(character); } @@ -59,9 +58,9 @@ namespace Milimoe.FunGame.Testing.Skills { if (caster.PrimaryAttribute == PrimaryAttribute.STR) { - double 回复的生命 = Calculation.Round2Digits(生命值回复 * caster.MaxHP); + double 回复的生命 = 生命值回复 * caster.MaxHP; caster.HP += 回复的生命; - WriteLine("[ " + caster + " ] 回复了 " + 回复的生命 + " 点生命值!"); + WriteLine($"[ {caster} ] 回复了 {回复的生命:0.##} 点生命值!"); } else if (caster.PrimaryAttribute == PrimaryAttribute.INT) { diff --git a/Library/Skills/Oshima/META马.cs b/Library/Skills/Oshima/META马.cs index 2a3082f..b1aae68 100644 --- a/Library/Skills/Oshima/META马.cs +++ b/Library/Skills/Oshima/META马.cs @@ -1,5 +1,4 @@ -using Milimoe.FunGame.Core.Api.Utility; -using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Constant; namespace Milimoe.FunGame.Testing.Skills @@ -25,14 +24,14 @@ namespace Milimoe.FunGame.Testing.Skills { public override long Id => Skill.Id; public override string Name => Skill.Name; - public override string Description => $"META马专属被动:力量+5,力量成长+0.5;在受到伤害时,获得的能量提升50%,每回合开始还能获得额外的 [ {EP} ] 能量值。"; + public override string Description => $"META马专属被动:力量+5,力量成长+0.5;在受到伤害时,获得的能量提升50%,每回合开始还能获得额外的 [ {EP:0.##} ] 能量值。"; public override bool TargetSelf => true; public static double EP => 10; public override void AlterEPAfterGetDamage(Character character, ref double baseEP) { - baseEP = Calculation.Round2Digits(baseEP * 1.5); - if (Skill.Character != null) WriteLine("[ " + Skill.Character + " ] 发动了META马专属被动!本次获得了 " + baseEP + " 能量!"); + baseEP *= 1.5; + if (Skill.Character != null) WriteLine($"[ {Skill.Character} ] 发动了META马专属被动!本次获得了 {baseEP:0.##} 能量!"); } public override void OnTurnStart(Character character) @@ -40,7 +39,7 @@ namespace Milimoe.FunGame.Testing.Skills if (character.EP < 200) { character.EP += EP; - WriteLine("[ " + character + " ] 发动了META马专属被动!本次获得了 " + EP + " 能量!"); + WriteLine($"[ {character} ] 发动了META马专属被动!本次获得了 {EP:0.##} 能量!"); } } } diff --git a/Library/Skills/Oshima/力量爆发.cs b/Library/Skills/Oshima/力量爆发.cs index 6a79569..3c4fc6f 100644 --- a/Library/Skills/Oshima/力量爆发.cs +++ b/Library/Skills/Oshima/力量爆发.cs @@ -1,5 +1,4 @@ -using Milimoe.FunGame.Core.Api.Utility; -using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Constant; namespace Milimoe.FunGame.Testing.Skills @@ -23,19 +22,20 @@ namespace Milimoe.FunGame.Testing.Skills { public override long Id => Skill.Id; public override string Name => "力量爆发"; - public override string Description => $"获得 150% 力量 [ {攻击力加成} ] 的攻击力加成,持续 {Duration} 时间。"; + public override string Description => $"获得 150% 力量 [ {攻击力加成:0.##} ] 的攻击力加成,但每次攻击都会损失 9% 当前生命值 [ {当前生命值:0.##} ],持续 {Duration:0.##} 时间。"; public override bool TargetSelf => true; public override bool Durative => true; public override double Duration => 10 + 1 * (Level - 1); - private double 攻击力加成 => Calculation.Round2Digits(Skill.Character?.STR * 1.5 ?? 0); + private double 攻击力加成 => Skill.Character?.STR * 1.5 ?? 0; + private double 当前生命值 => Skill.Character?.HP * 0.09 ?? 0; private double 实际攻击力加成 = 0; public override void OnEffectGained(Character character) { 实际攻击力加成 = 攻击力加成; character.ExATK2 += 实际攻击力加成; - WriteLine($"[ {character} ] 的攻击力增加了 [ {实际攻击力加成} ] !"); + WriteLine($"[ {character} ] 的攻击力增加了 [ {实际攻击力加成:0.##} ] !"); } public override void OnEffectLost(Character character) @@ -44,6 +44,16 @@ namespace Milimoe.FunGame.Testing.Skills character.ExATK2 -= 实际攻击力加成; } + public override void AfterDamageCalculation(Character character, Character enemy, double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, DamageResult damageResult) + { + if (character == Skill.Character && isNormalAttack) + { + double 生命值减少 = 当前生命值; + character.HP -= 生命值减少; + WriteLine($"[ {character} ] 由于自身力量过于强大而被反噬,损失了 [ {生命值减少:0.##} ] 点生命值!"); + } + } + public override void OnSkillCasted(Character caster, List enemys, List teammates, Dictionary others) { RemainDuration = Duration; diff --git a/Library/Skills/QWQAQW/玻璃大炮.cs b/Library/Skills/QWQAQW/玻璃大炮.cs index 1688971..5ff455c 100644 --- a/Library/Skills/QWQAQW/玻璃大炮.cs +++ b/Library/Skills/QWQAQW/玻璃大炮.cs @@ -1,5 +1,4 @@ -using Milimoe.FunGame.Core.Api.Utility; -using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Constant; namespace Milimoe.FunGame.Testing.Skills @@ -26,7 +25,7 @@ namespace Milimoe.FunGame.Testing.Skills public override long Id => Skill.Id; public override string Name => Skill.Name; public override string Description => $"生命值高于 30% 时,受到额外的 [ {高于30额外伤害下限}~{高于30额外伤害上限}% ] 伤害,但是获得 [ 累计所受伤害的 {高于30的加成下限}~{高于30的加成上限}% ] 伤害加成;生命值低于等于 30% 时,不会受到额外的伤害,仅能获得 [ 累计受到的伤害 {低于30的加成下限}~{低于30的加成上限}% ] 伤害加成。" + - $"在没有受到任何伤害的时候,将获得 {常规伤害加成 * 100:0.##}% 伤害加成。" + (累计受到的伤害 > 0 ? $"(当前累计受到伤害:{累计受到的伤害})" : ""); + $"在没有受到任何伤害的时候,将获得 {常规伤害加成 * 100:0.##}% 伤害加成。" + (累计受到的伤害 > 0 ? $"(当前累计受到伤害:{累计受到的伤害:0.##})" : ""); public override bool TargetSelf => true; private double 累计受到的伤害 = 0; @@ -34,8 +33,8 @@ namespace Milimoe.FunGame.Testing.Skills private double 受到伤害之前的HP = 0; private double 这次受到的额外伤害 = 0; private readonly double 常规伤害加成 = 0.35; - private readonly int 高于30额外伤害上限 = 40; - private readonly int 高于30额外伤害下限 = 20; + private readonly int 高于30额外伤害上限 = 30; + private readonly int 高于30额外伤害下限 = 15; private readonly int 高于30的加成上限 = 100; private readonly int 高于30的加成下限 = 80; private readonly int 低于30的加成上限 = 60; @@ -49,15 +48,15 @@ namespace Milimoe.FunGame.Testing.Skills { if (character.HP > character.MaxHP * 0.3) { - 系数 = Calculation.Round4Digits(1.0 + ((new Random().Next(高于30的加成下限, 高于30的加成上限) + 0.0) / 100)); + 系数 = 1.0 + ((Random.Shared.Next(高于30的加成下限, 高于30的加成上限) + 0.0) / 100); } else { - 系数 = Calculation.Round4Digits(1.0 + ((new Random().Next(低于30的加成下限, 低于30的加成上限) + 0.0) / 100)); + 系数 = 1.0 + ((Random.Shared.Next(低于30的加成下限, 低于30的加成上限) + 0.0) / 100); } - return Calculation.Round2Digits(系数 * 累计受到的伤害); + return 系数 * 累计受到的伤害; } - return Calculation.Round2Digits(系数 * damage); + return 系数 * damage; } public override void AlterExpectedDamageBeforeCalculation(Character character, Character enemy, ref double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType) @@ -65,8 +64,8 @@ namespace Milimoe.FunGame.Testing.Skills if (character == Skill.Character) { 这次的伤害加成 = 伤害加成(damage); - damage = Calculation.Round2Digits(damage + 这次的伤害加成); - WriteLine($"[ {character} ] 发动了玻璃大炮,获得了 {这次的伤害加成} 点伤害加成!"); + damage += 这次的伤害加成; + WriteLine($"[ {character} ] 发动了玻璃大炮,获得了 {这次的伤害加成:0.##} 点伤害加成!"); 累计受到的伤害 = 0; } @@ -76,10 +75,10 @@ namespace Milimoe.FunGame.Testing.Skills if (enemy.HP > enemy.MaxHP * 0.3) { // 额外受到伤害 - double 系数 = Calculation.Round4Digits((new Random().Next(高于30额外伤害下限, 高于30额外伤害上限) + 0.0) / 100); - 这次受到的额外伤害 = Calculation.Round2Digits(damage * 系数); - damage = Calculation.Round2Digits(damage + 这次受到的额外伤害); - WriteLine($"[ {enemy} ] 的玻璃大炮触发,将额外受到 {这次受到的额外伤害} 点伤害!"); + double 系数 = (Random.Shared.Next(高于30额外伤害下限, 高于30额外伤害上限) + 0.0) / 100; + 这次受到的额外伤害 = damage * 系数; + damage += 这次受到的额外伤害; + WriteLine($"[ {enemy} ] 的玻璃大炮触发,将额外受到 {这次受到的额外伤害:0.##} 点伤害!"); } else 这次受到的额外伤害 = 0; } @@ -89,7 +88,7 @@ namespace Milimoe.FunGame.Testing.Skills { if (enemy == Skill.Character && damageResult != DamageResult.Evaded) { - 累计受到的伤害 = Calculation.Round2Digits(累计受到的伤害 + damage); + 累计受到的伤害 += damage; if (enemy.HP < 0 && 受到伤害之前的HP - damage + 这次受到的额外伤害 > 0) { enemy.HP = 10; diff --git a/Library/Skills/QWQAQW/迅捷之势.cs b/Library/Skills/QWQAQW/迅捷之势.cs index 81234fa..8bef40f 100644 --- a/Library/Skills/QWQAQW/迅捷之势.cs +++ b/Library/Skills/QWQAQW/迅捷之势.cs @@ -1,5 +1,4 @@ -using Milimoe.FunGame.Core.Api.Utility; -using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Constant; namespace Milimoe.FunGame.Testing.Skills @@ -23,13 +22,13 @@ namespace Milimoe.FunGame.Testing.Skills { public override long Id => Skill.Id; public override string Name => Skill.Name; - public override string Description => $"{Duration} 时间内,普通攻击转为魔法伤害,且硬直时间减少50%,并基于 {智力系数 * 100:0.##}% 智力 [{智力加成}] 强化普通攻击伤害。"; + public override string Description => $"{Duration:0.##} 时间内,普通攻击转为魔法伤害,且硬直时间减少50%,并基于 {智力系数 * 100:0.##}% 智力 [ {智力加成:0.##} ] 强化普通攻击伤害。"; public override bool TargetSelf => true; public override bool Durative => true; public override double Duration => 40; - private double 智力系数 => Calculation.Round4Digits(1.4 + 0.4 * (Level - 1)); - private double 智力加成 => Calculation.Round2Digits(智力系数 * Skill.Character?.INT ?? 0); + private double 智力系数 => 1.4 + 0.4 * (Level - 1); + private double 智力加成 => 智力系数 * Skill.Character?.INT ?? 0; public override void OnEffectGained(Character character) { @@ -45,13 +44,13 @@ namespace Milimoe.FunGame.Testing.Skills { if (character == Skill.Character && isNormalAttack) { - damage = Calculation.Round2Digits(damage + 智力加成); + damage += 智力加成; } } public override void AlterHardnessTimeAfterNormalAttack(Character character, ref double baseHardnessTime, ref bool isCheckProtected) { - baseHardnessTime = Calculation.Round2Digits(baseHardnessTime * 0.5); + baseHardnessTime *= 0.5; } public override void OnSkillCasted(Character caster, List enemys, List teammates, Dictionary others) diff --git a/Library/Skills/QingXiang/枯竭打击.cs b/Library/Skills/QingXiang/枯竭打击.cs index c1f9b86..3c9ff60 100644 --- a/Library/Skills/QingXiang/枯竭打击.cs +++ b/Library/Skills/QingXiang/枯竭打击.cs @@ -1,5 +1,4 @@ -using Milimoe.FunGame.Core.Api.Utility; -using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Constant; namespace Milimoe.FunGame.Testing.Skills @@ -35,13 +34,13 @@ namespace Milimoe.FunGame.Testing.Skills if (character == Skill.Character && damageResult != DamageResult.Evaded && !是否是嵌套伤害) { // 减少能量 - double EP = new Random().Next(10, 25); + double EP = Random.Shared.Next(10, 25); enemy.EP -= EP; - WriteLine($"[ {character} ] 发动了枯竭打击![ {enemy} ] 的能量值被减少了 {EP} 点!现有能量:{enemy.EP}。"); + WriteLine($"[ {character} ] 发动了枯竭打击![ {enemy} ] 的能量值被减少了 {EP:0.##} 点!现有能量:{enemy.EP:0.##}。"); // 额外伤害 if (enemy.EP >= 0 && enemy.EP < 50 || enemy.EP >= 100 && enemy.EP < 150) { - double 额外伤害 = Calculation.Round2Digits(damage * 0.3); + double 额外伤害 = damage * 0.3; WriteLine($"[ {character} ] 发动了枯竭打击!将造成额外伤害!"); 是否是嵌套伤害 = true; DamageToEnemy(character, enemy, isMagicDamage, magicType, 额外伤害); diff --git a/Library/Skills/QingXiang/能量毁灭.cs b/Library/Skills/QingXiang/能量毁灭.cs index 7148b4a..f70d136 100644 --- a/Library/Skills/QingXiang/能量毁灭.cs +++ b/Library/Skills/QingXiang/能量毁灭.cs @@ -1,5 +1,4 @@ -using Milimoe.FunGame.Core.Api.Utility; -using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Constant; namespace Milimoe.FunGame.Testing.Skills @@ -24,13 +23,13 @@ namespace Milimoe.FunGame.Testing.Skills public override long Id => Skill.Id; public override string Name => Skill.Name; public override string Description => $"对所有角色造成 " + - $"{能量系数 * 100:0.##}% 其现有能量值 + {智力系数 * 100:0.##}% 智力 [ {智力伤害} ] 的魔法伤害。"; + $"{能量系数 * 100:0.##}% 其现有能量值 + {智力系数 * 100:0.##}% 智力 [ {智力伤害:0.##} ] 的魔法伤害。"; public override bool TargetSelf => false; public override double TargetRange => 999; - private double 智力系数 => Calculation.Round4Digits(0.55 * Level); - private double 智力伤害 => Calculation.Round2Digits(智力系数 * Skill.Character?.INT ?? 0); - private double 能量系数 => Calculation.Round4Digits(0.75 * Level); + private double 智力系数 => 0.55 * Level; + private double 智力伤害 => 智力系数 * Skill.Character?.INT ?? 0; + private double 能量系数 => 0.75 * Level; public override void OnSkillCasted(Character caster, List enemys, List teammates, Dictionary others) { @@ -38,7 +37,7 @@ namespace Milimoe.FunGame.Testing.Skills { WriteLine($"[ {caster} ] 正在毁灭 [ {c} ] 的能量!!"); double ep = c.EP; - DamageToEnemy(caster, c, true, MagicType, Calculation.Round2Digits(ep * 能量系数 + 智力伤害)); + DamageToEnemy(caster, c, true, MagicType, ep * 能量系数 + 智力伤害); } } } diff --git a/Library/Skills/QuDuoduo/弱者猎手.cs b/Library/Skills/QuDuoduo/弱者猎手.cs index 44fbb97..ce62853 100644 --- a/Library/Skills/QuDuoduo/弱者猎手.cs +++ b/Library/Skills/QuDuoduo/弱者猎手.cs @@ -1,5 +1,4 @@ -using Milimoe.FunGame.Core.Api.Utility; -using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Constant; namespace Milimoe.FunGame.Testing.Skills @@ -32,14 +31,14 @@ namespace Milimoe.FunGame.Testing.Skills { if (character == Skill.Character && (enemy.HP / enemy.MaxHP) <= (character.HP / character.MaxHP)) { - double 额外伤害 = Calculation.Round2Digits(damage * 0.5); - damage = Calculation.Round2Digits(damage + 额外伤害); + double 额外伤害 = damage * 0.5; + damage += 额外伤害; } } public override bool AlterEnemyListBeforeAction(Character character, List enemys, List teammates, List skills, Dictionary continuousKilling, Dictionary earnedMoney) { - IEnumerable list = [.. enemys.OrderBy(e => Calculation.Round4Digits(e.HP / e.MaxHP))]; + IEnumerable list = [.. enemys.OrderBy(e => e.HP / e.MaxHP)]; if (list.Any()) { enemys.Clear(); diff --git a/Library/Skills/QuDuoduo/血之狂欢.cs b/Library/Skills/QuDuoduo/血之狂欢.cs index 3f8f941..1cf8ac5 100644 --- a/Library/Skills/QuDuoduo/血之狂欢.cs +++ b/Library/Skills/QuDuoduo/血之狂欢.cs @@ -1,7 +1,5 @@ -using Milimoe.FunGame.Core.Api.Utility; -using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Constant; -using Milimoe.FunGame.Testing.Effects; namespace Milimoe.FunGame.Testing.Skills { @@ -24,7 +22,7 @@ namespace Milimoe.FunGame.Testing.Skills { public override long Id => Skill.Id; public override string Name => Skill.Name; - public override string Description => $"获得 40% 吸血,持续 {Duration} 时间。"; + public override string Description => $"获得 40% 吸血,持续 {Duration:0.##} 时间。"; public override bool TargetSelf => true; public override bool Durative => true; public override double Duration => 30; @@ -33,9 +31,9 @@ namespace Milimoe.FunGame.Testing.Skills { if (character == Skill.Character && damageResult != DamageResult.Evaded && character.HP < character.MaxHP) { - double 实际吸血 = Calculation.Round2Digits(0.4 * damage); + double 实际吸血 = 0.4 * damage; character.HP += 实际吸血; - WriteLine($"[ {character} ] 回复了 {实际吸血} 点生命值!"); + WriteLine($"[ {character} ] 回复了 {实际吸血:0.##} 点生命值!"); } } diff --git a/Library/Skills/XinYin/天赐之力.cs b/Library/Skills/XinYin/天赐之力.cs index 258087f..385fbf8 100644 --- a/Library/Skills/XinYin/天赐之力.cs +++ b/Library/Skills/XinYin/天赐之力.cs @@ -1,5 +1,4 @@ -using Milimoe.FunGame.Core.Api.Utility; -using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Constant; namespace Milimoe.FunGame.Testing.Skills @@ -23,15 +22,15 @@ namespace Milimoe.FunGame.Testing.Skills { public override long Id => Skill.Id; public override string Name => Skill.Name; - public override string Description => $"{Duration} 时间内,增加 40% 攻击力 [ {攻击力提升} ]、30% 物理穿透和 25% 闪避率(不可叠加),普通攻击硬直时间额外减少 20%,基于 {系数 * 100:0.##}% 敏捷 [ {伤害加成} ] 强化普通攻击的伤害。在持续时间内,【心灵之火】的冷却时间降低至 3 时间。"; + public override string Description => $"{Duration:0.##} 时间内,增加 40% 攻击力 [ {攻击力提升:0.##} ]、30% 物理穿透和 25% 闪避率(不可叠加),普通攻击硬直时间额外减少 20%,基于 {系数 * 100:0.##}% 敏捷 [ {伤害加成:0.##} ] 强化普通攻击的伤害。在持续时间内,【心灵之火】的冷却时间降低至 3 时间。"; public override bool TargetSelf => false; public override int TargetCount => 1; public override bool Durative => true; public override double Duration => 40; - private double 系数 => Calculation.Round4Digits(1.2 * (1 + 0.6 * (Skill.Level - 1))); - private double 伤害加成 => Calculation.Round2Digits(系数 * Skill.Character?.AGI ?? 0); - private double 攻击力提升 => Calculation.Round2Digits(0.4 * Skill.Character?.BaseATK ?? 0); + private double 系数 => 1.2 * (1 + 0.6 * (Skill.Level - 1)); + private double 伤害加成 => 系数 * Skill.Character?.AGI ?? 0; + private double 攻击力提升 => 0.4 * Skill.Character?.BaseATK ?? 0; private double 实际的攻击力提升 = 0; public override void OnEffectGained(Character character) @@ -68,13 +67,13 @@ namespace Milimoe.FunGame.Testing.Skills { if (character == Skill.Character && isNormalAttack) { - damage = Calculation.Round2Digits(damage + 伤害加成); + damage += 伤害加成; } } public override void AlterHardnessTimeAfterNormalAttack(Character character, ref double baseHardnessTime, ref bool isCheckProtected) { - baseHardnessTime = Calculation.Round2Digits(baseHardnessTime * 0.8); + baseHardnessTime *= 0.8; } public override void OnSkillCasted(Character caster, List enemys, List teammates, Dictionary others) diff --git a/Library/Skills/XinYin/心灵之火.cs b/Library/Skills/XinYin/心灵之火.cs index 2279b5a..9c8477e 100644 --- a/Library/Skills/XinYin/心灵之火.cs +++ b/Library/Skills/XinYin/心灵之火.cs @@ -1,5 +1,4 @@ -using Milimoe.FunGame.Core.Api.Utility; -using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Constant; namespace Milimoe.FunGame.Testing.Skills @@ -53,7 +52,7 @@ namespace Milimoe.FunGame.Testing.Skills { if (冷却时间 > 0) { - 冷却时间 = Calculation.Round2Digits(冷却时间 - elapsed); + 冷却时间 -= elapsed; if (冷却时间 <= 0) { 冷却时间 = 0; @@ -63,7 +62,7 @@ namespace Milimoe.FunGame.Testing.Skills public override void AlterHardnessTimeAfterNormalAttack(Character character, ref double baseHardnessTime, ref bool isCheckProtected) { - baseHardnessTime = Calculation.Round2Digits(baseHardnessTime * 0.8); + baseHardnessTime *= 0.8; } } } diff --git a/Library/Skills/Yang/魔法涌流.cs b/Library/Skills/Yang/魔法涌流.cs index b6639f5..fdea7ef 100644 --- a/Library/Skills/Yang/魔法涌流.cs +++ b/Library/Skills/Yang/魔法涌流.cs @@ -1,5 +1,4 @@ -using Milimoe.FunGame.Core.Api.Utility; -using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Constant; namespace Milimoe.FunGame.Testing.Skills @@ -23,12 +22,12 @@ namespace Milimoe.FunGame.Testing.Skills { public override long Id => Skill.Id; public override string Name => "魔法涌流"; - public override string Description => $"{Duration} 时间内,增加所有伤害的 {减伤比例 * 100:0.##}% 伤害减免,并将普通攻击转为魔法伤害,可叠加魔法震荡的效果。"; + public override string Description => $"{Duration:0.##} 时间内,增加所有伤害的 {减伤比例 * 100:0.##}% 伤害减免,并将普通攻击转为魔法伤害,可叠加魔法震荡的效果。"; public override bool TargetSelf => true; public override bool Durative => true; public override double Duration => 25; - private double 减伤比例 => Calculation.Round2Digits(0.1 + 0.02 * (Level -1)); + private double 减伤比例 => 0.1 + 0.02 * (Level - 1); private double 实际比例 = 0; public override void OnEffectGained(Character character) @@ -46,7 +45,7 @@ namespace Milimoe.FunGame.Testing.Skills { if (enemy == Skill.Character) { - damage = Calculation.Round2Digits(damage * (1 - 实际比例)); + damage *= 1 - 实际比例; } return false; } diff --git a/Library/Skills/绿拱门/平衡强化.cs b/Library/Skills/dddovo/平衡强化.cs similarity index 99% rename from Library/Skills/绿拱门/平衡强化.cs rename to Library/Skills/dddovo/平衡强化.cs index 6e25ac1..ddff3a0 100644 --- a/Library/Skills/绿拱门/平衡强化.cs +++ b/Library/Skills/dddovo/平衡强化.cs @@ -22,7 +22,7 @@ namespace Milimoe.FunGame.Testing.Skills { public override long Id => Skill.Id; public override string Name => Skill.Name; - public override string Description => $"敏捷提高 20%,然后将目前的力量补充到与敏捷持平,持续 {Duration} 时间。"; + public override string Description => $"敏捷提高 20%,然后将目前的力量补充到与敏捷持平,持续 {Duration:0.##} 时间。"; public override bool TargetSelf => true; public override bool Durative => true; public override double Duration => 30; diff --git a/Library/Skills/绿拱门/敏捷之刃.cs b/Library/Skills/dddovo/敏捷之刃.cs similarity index 91% rename from Library/Skills/绿拱门/敏捷之刃.cs rename to Library/Skills/dddovo/敏捷之刃.cs index 2aa9c8f..867df92 100644 --- a/Library/Skills/绿拱门/敏捷之刃.cs +++ b/Library/Skills/dddovo/敏捷之刃.cs @@ -1,5 +1,4 @@ -using Milimoe.FunGame.Core.Api.Utility; -using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Constant; namespace Milimoe.FunGame.Testing.Skills @@ -28,7 +27,7 @@ namespace Milimoe.FunGame.Testing.Skills public override string Description => $"每次普通攻击都将附带基于 {敏捷系数 * 100:0.##}% 敏捷 [ {敏捷伤害} ] 的魔法伤害。"; public override bool TargetSelf => true; - private double 敏捷伤害 => Calculation.Round2Digits(敏捷系数 * Skill.Character?.AGI ?? 0); + private double 敏捷伤害 => 敏捷系数 * Skill.Character?.AGI ?? 0; private readonly double 敏捷系数 = 2.5; private bool 是否是嵌套伤害 = false; diff --git a/Library/Skills/战技/疾风步.cs b/Library/Skills/战技/疾风步.cs index fb37cd1..da999af 100644 --- a/Library/Skills/战技/疾风步.cs +++ b/Library/Skills/战技/疾风步.cs @@ -1,5 +1,4 @@ -using Milimoe.FunGame.Core.Api.Utility; -using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Constant; namespace Milimoe.FunGame.Testing.Skills @@ -23,13 +22,13 @@ namespace Milimoe.FunGame.Testing.Skills { public override long Id => Skill.Id; public override string Name => Skill.Name; - public override string Description => $"进入不可选中状态,获得 100 行动速度,提高 8% 暴击率,持续 {Duration} 时间。破隐一击:在持续时间内,首次造成伤害会附加 {系数 * 100:0.##}% 敏捷 [ {伤害加成} ] 的强化伤害,并解除不可选中状态。"; + public override string Description => $"进入不可选中状态,获得 100 行动速度,提高 8% 暴击率,持续 {Duration:0.##} 时间。破隐一击:在持续时间内,首次造成伤害会附加 {系数 * 100:0.##}% 敏捷 [ {伤害加成:0.##} ] 的强化伤害,并解除不可选中状态。"; public override bool TargetSelf => true; public override bool Durative => true; public override double Duration => 12 + (1 * (Level - 1)); - private double 系数 => Calculation.Round4Digits(0.5 + 0.5 * (Skill.Level - 1)); - private double 伤害加成 => Calculation.Round2Digits(系数 * Skill.Character?.AGI ?? 0); + 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; @@ -64,8 +63,8 @@ namespace Milimoe.FunGame.Testing.Skills character.CharacterEffectTypes.Remove(this); character.UpdateCharacterState(); double d = 伤害加成; - damage = Calculation.Round2Digits(damage + d); - WriteLine($"[ {character} ] 触发了疾风步破隐一击,获得了 [ {d} ] 点伤害加成!"); + damage += d; + WriteLine($"[ {character} ] 触发了疾风步破隐一击,获得了 [ {d:0.##} ] 点伤害加成!"); } return false; } diff --git a/Library/Skills/魔法/冰霜攻击.cs b/Library/Skills/魔法/冰霜攻击.cs index bd80d23..998c69b 100644 --- a/Library/Skills/魔法/冰霜攻击.cs +++ b/Library/Skills/魔法/冰霜攻击.cs @@ -1,5 +1,4 @@ -using Milimoe.FunGame.Core.Api.Utility; -using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Constant; namespace Milimoe.FunGame.Testing.Skills @@ -24,7 +23,7 @@ namespace Milimoe.FunGame.Testing.Skills { public override long Id => Skill.Id; public override string Name => Skill.Name; - public override string Description => $"对目标敌人造成 {Calculation.Round2Digits(90 + 60 * (Skill.Level - 1))} + {Calculation.Round2Digits((1.2 + 1.8 * (Skill.Level - 1)) * 100)}% 智力 [ {Damage} ] 点{CharacterSet.GetMagicDamageName(MagicType)}。"; + public override string Description => $"对目标敌人造成 {90 + 60 * (Skill.Level - 1):0.##} + {(1.2 + 1.8 * (Skill.Level - 1)) * 100:0.##}% 智力 [ {Damage:0.##} ] 点{CharacterSet.GetMagicDamageName(MagicType)}。"; public override bool TargetSelf => false; public override int TargetCount => 1; @@ -35,7 +34,7 @@ namespace Milimoe.FunGame.Testing.Skills double d = 0; if (Skill.Character != null) { - d = Calculation.Round2Digits(90 + 60 * (Skill.Level - 1) + (1.2 + 1.8 * (Skill.Level - 1)) * Skill.Character.INT); + d = 90 + 60 * (Skill.Level - 1) + (1.2 + 1.8 * (Skill.Level - 1)) * Skill.Character.INT; } return d; } diff --git a/Library/Solutions/TestModule.cs b/Library/Solutions/TestModule.cs index 066371c..efb6a0c 100644 --- a/Library/Solutions/TestModule.cs +++ b/Library/Solutions/TestModule.cs @@ -1,7 +1,7 @@ using Milimoe.FunGame.Core.Api.Utility; using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Common.Addon; -using Milimoe.FunGame.Core.Library.Constant; +using Milimoe.FunGame.Testing.OpenEffects; using Milimoe.FunGame.Testing.Items; using Milimoe.FunGame.Testing.Skills; @@ -25,13 +25,13 @@ namespace Addons public override string Author => "FunGamer"; - public override List Characters + public override Dictionary Characters { get { EntityModuleConfig config = new(ExampleGameModuleConstant.Example, ExampleGameModuleConstant.ExampleCharacter); config.LoadConfig(); - return [.. config.Values]; + return config; } } } @@ -46,113 +46,97 @@ namespace Addons public override string Author => "FunGamer"; - public override List Skills + public override Dictionary Skills { get { - EntityModuleConfig config = new(ExampleGameModuleConstant.Example, ExampleGameModuleConstant.ExampleSkill); - config.LoadConfig(); - foreach (string key in config.Keys) - { - Skill prev = config[key]; - Skill? next = GetSkill(prev.Id, prev.Name, prev.SkillType); - if (next != null) - { - config[key] = next; - } - } - return [.. config.Values]; + return Factory.GetGameModuleInstances(ExampleGameModuleConstant.Example, ExampleGameModuleConstant.ExampleSkill); } } - public override Skill? GetSkill(long id, string name, SkillType type) + protected override Factory.EntityFactoryDelegate SkillFactory() { - if (type == SkillType.Magic) + return (id, name, args) => { - switch ((MagicID)id) + Skill skill = id switch { - case MagicID.冰霜攻击: - return new 冰霜攻击(); - } - } + (long)MagicID.冰霜攻击 => 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)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)ItemPassiveID.攻击之爪 => new 攻击之爪技能(), + _ => new OpenSkill(id, name) + }; - if (type == SkillType.Skill) + if (skill is OpenSkill && args.TryGetValue("others", out object? value) && value is Dictionary dict) + { + foreach (string key in dict.Keys) + { + skill.OtherArgs[key] = dict[key]; + } + } + + return skill; + }; + } + + protected override Factory.EntityFactoryDelegate EffectFactory() + { + return (id, name, args) => { - switch ((SkillID)id) + if (args.TryGetValue("skill", out object? value) && value is Skill skill) { - case SkillID.疾风步: - return new 疾风步(); + return (EffectID)id switch + { + EffectID.ExATK => new ExATK(skill), + EffectID.ExDEF => new ExDEF(skill), + EffectID.ExSTR => new ExSTR(skill), + EffectID.ExAGI => new ExAGI(skill), + EffectID.ExINT => new ExINT(skill), + EffectID.SkillHardTimeReduce => new SkillHardTimeReduce(skill), + EffectID.NormalAttackHardTimeReduce => new NormalAttackHardTimeReduce(skill), + EffectID.AccelerationCoefficient => new AccelerationCoefficient(skill), + EffectID.ExSPD => new ExSPD(skill), + EffectID.ExActionCoefficient => new ExActionCoefficient(skill), + EffectID.ExCDR => new ExCDR(skill), + EffectID.ExMaxHP => new ExMaxHP(skill), + EffectID.ExMaxMP => new ExMaxMP(skill), + EffectID.ExCritRate => new ExCritRate(skill), + EffectID.ExCritDMG => new ExCritDMG(skill), + EffectID.ExEvadeRate => new ExEvadeRate(skill), + EffectID.PhysicalPenetration => new PhysicalPenetration(skill), + EffectID.MagicalPenetration => new MagicalPenetration(skill), + EffectID.ExPDR => new ExPDR(skill), + EffectID.ExMDF => new ExMDF(skill), + EffectID.ExHR => new ExHR(skill), + EffectID.ExMR => new ExMR(skill), + _ => null + }; } - } - - if (type == SkillType.SuperSkill) - { - switch ((SuperSkillID)id) - { - case SuperSkillID.力量爆发: - return new 力量爆发(); - case SuperSkillID.天赐之力: - return new 天赐之力(); - case SuperSkillID.魔法涌流: - return new 魔法涌流(); - case SuperSkillID.三重叠加: - return new 三重叠加(); - case SuperSkillID.变幻之心: - return new 变幻之心(); - case SuperSkillID.精准打击: - return new 精准打击(); - case SuperSkillID.绝对领域: - return new 绝对领域(); - case SuperSkillID.能量毁灭: - return new 能量毁灭(); - case SuperSkillID.迅捷之势: - return new 迅捷之势(); - case SuperSkillID.嗜血本能: - return new 嗜血本能(); - case SuperSkillID.平衡强化: - return new 平衡强化(); - case SuperSkillID.血之狂欢: - return new 血之狂欢(); - } - } - - if (type == SkillType.Passive) - { - switch ((PassiveID)id) - { - case PassiveID.META马: - return new META马(); - case PassiveID.心灵之火: - return new 心灵之火(); - case PassiveID.魔法震荡: - return new 魔法震荡(); - case PassiveID.灵能反射: - return new 灵能反射(); - case PassiveID.智慧与力量: - return new 智慧与力量(); - case PassiveID.致命打击: - return new 致命打击(); - case PassiveID.毁灭之势: - return new 毁灭之势(); - case PassiveID.枯竭打击: - return new 枯竭打击(); - case PassiveID.玻璃大炮: - return new 玻璃大炮(); - case PassiveID.累积之压: - return new 累积之压(); - case PassiveID.敏捷之刃: - return new 敏捷之刃(); - case PassiveID.弱者猎手: - return new 弱者猎手(); - } - switch ((ItemPassiveID)id) - { - case ItemPassiveID.攻击之爪: - return new 攻击之爪技能(); - } - } - - return null; + return null; + }; } } @@ -166,47 +150,26 @@ namespace Addons public override string Author => "FunGamer"; - public override List Items + public override Dictionary Items { get { - EntityModuleConfig config = new(ExampleGameModuleConstant.Example, ExampleGameModuleConstant.ExampleItem); - config.LoadConfig(); - foreach (string key in config.Keys) - { - Item prev = config[key]; - Item? next = GetItem(prev.Id, prev.Name, prev.ItemType); - if (next != null) - { - prev.SetPropertyToItemModuleNew(next); - config[key] = next; - } - } - return [.. config.Values]; + return Factory.GetGameModuleInstances(ExampleGameModuleConstant.Example, ExampleGameModuleConstant.ExampleItem); } } - public override Item? GetItem(long id, string name, ItemType type) + protected override Factory.EntityFactoryDelegate ItemFactory() { - if (type == ItemType.MagicCardPack) + return (id, name, args) => { - - } - - if (type == ItemType.Accessory) - { - switch ((AccessoryID)id) + return id switch { - case AccessoryID.攻击之爪10: - return new 攻击之爪10(); - case AccessoryID.攻击之爪30: - return new 攻击之爪30(); - case AccessoryID.攻击之爪50: - return new 攻击之爪50(); - } - } - - return null; + (long)AccessoryID.攻击之爪10 => new 攻击之爪10(), + (long)AccessoryID.攻击之爪30 => new 攻击之爪30(), + (long)AccessoryID.攻击之爪50 => new 攻击之爪50(), + _ => null, + }; + }; } } } diff --git a/Library/Tests/CheckDLL.cs b/Library/Tests/CheckDLL.cs index 419f02f..94cf406 100644 --- a/Library/Tests/CheckDLL.cs +++ b/Library/Tests/CheckDLL.cs @@ -38,7 +38,7 @@ namespace Milimoe.FunGame.Testing.Tests GameModuleLoader modules = GameModuleLoader.LoadGameModules(FunGameInfo.FunGame.FunGame_Desktop, []); foreach (CharacterModule cm in modules.Characters.Values) { - foreach (Character c in cm.Characters) + foreach (Character c in cm.Characters.Values) { Console.WriteLine(c.Name); list.Add(c); diff --git a/Library/Tests/FunGame.cs b/Library/Tests/FunGame.cs index 96ca223..7d74547 100644 --- a/Library/Tests/FunGame.cs +++ b/Library/Tests/FunGame.cs @@ -1,11 +1,11 @@ using System.Text; using Milimoe.FunGame.Core.Api.Utility; using Milimoe.FunGame.Core.Entity; -using Milimoe.FunGame.Core.Library.Common.Addon; -using Milimoe.FunGame.Core.Library.Constant; using Milimoe.FunGame.Core.Model; -using Milimoe.FunGame.Testing.Items; using Milimoe.FunGame.Testing.Skills; +using Milimoe.FunGame.Testing.Items; +using MilimoeFunGame.Testing.Characters; +using Milimoe.FunGame.Core.Interface.Entity; namespace Milimoe.FunGame.Testing.Tests { @@ -13,7 +13,7 @@ namespace Milimoe.FunGame.Testing.Tests { public FunGameSimulation() { - LoadModules(); + InitCharacter(); bool printout = true; List strs = StartGame(printout); @@ -29,6 +29,7 @@ namespace Milimoe.FunGame.Testing.Tests } public static List Characters { get; } = []; + public static List Items { get; } = []; public static Dictionary CharacterStatistics { get; } = []; public static PluginConfig StatsConfig { get; } = new(nameof(FunGameSimulation), nameof(CharacterStatistics)); public static bool IsRuning { get; set; } = false; @@ -294,11 +295,11 @@ namespace Milimoe.FunGame.Testing.Tests if (PrintOut) characters.ForEach(c => Console.WriteLine(c.GetInfo())); // 创建顺序表并排序 - ActionQueue ActionQueue = new(characters, WriteLine); + ActionQueue actionQueue = new(characters, WriteLine); if (PrintOut) Console.WriteLine(); // 显示初始顺序表 - ActionQueue.DisplayQueue(); + actionQueue.DisplayQueue(); if (PrintOut) Console.WriteLine(); // 总游戏时长 @@ -306,8 +307,9 @@ namespace Milimoe.FunGame.Testing.Tests // 开始空投 Msg = ""; - 空投(ActionQueue, totalTime); + 空投(actionQueue); if (isWeb) result.Add("=== 空投 ===\r\n" + Msg); + double 下一次空投 = 80; // 总回合数 int i = 1; @@ -320,7 +322,7 @@ namespace Milimoe.FunGame.Testing.Tests Dictionary 他们的血量百分比 = []; foreach (Character c in characters) { - 他们的血量百分比.TryAdd(c, Calculation.Round4Digits(c.HP / c.MaxHP)); + 他们的血量百分比.TryAdd(c, c.HP / c.MaxHP); } double max = 他们的血量百分比.Values.Max(); Character winner = 他们的血量百分比.Keys.Where(c => 他们的血量百分比[c] == max).First(); @@ -328,15 +330,15 @@ namespace Milimoe.FunGame.Testing.Tests foreach (Character c in characters.Where(c => c != winner && c.HP > 0)) { WriteLine("[ " + winner + " ] 对 [ " + c + " ] 造成了 99999999999 点真实伤害。"); - ActionQueue.DeathCalculation(winner, c); + actionQueue.DeathCalculation(winner, c); } - ActionQueue.EndGameInfo(winner); + actionQueue.EndGameInfo(winner); result.Add(Msg); break; } // 检查是否有角色可以行动 - Character? characterToAct = ActionQueue.NextCharacter(); + Character? characterToAct = actionQueue.NextCharacter(); // 处理回合 if (characterToAct != null) @@ -344,23 +346,34 @@ namespace Milimoe.FunGame.Testing.Tests WriteLine($"=== Round {i++} ==="); WriteLine("现在是 [ " + characterToAct + " ] 的回合!"); - bool isGameEnd = ActionQueue.ProcessTurn(characterToAct); + bool isGameEnd = actionQueue.ProcessTurn(characterToAct); if (isGameEnd) { result.Add(Msg); break; } - ActionQueue.DisplayQueue(); + actionQueue.DisplayQueue(); WriteLine(""); } // 模拟时间流逝 - totalTime += ActionQueue.TimeLapse(); + double timeLapse = actionQueue.TimeLapse(); + totalTime += timeLapse; + 下一次空投 -= timeLapse; - if (ActionQueue.Eliminated.Count > deaths) + if (下一次空投 <= 0) { - deaths = ActionQueue.Eliminated.Count; + // 空投 + Msg = ""; + 空投(actionQueue); + if (isWeb) result.Add("=== 空投 ===\r\n" + Msg); + 下一次空投 = 100; + } + + if (actionQueue.Eliminated.Count > deaths) + { + deaths = actionQueue.Eliminated.Count; if (!isWeb) { string roundMsg = Msg; @@ -378,7 +391,7 @@ namespace Milimoe.FunGame.Testing.Tests if (PrintOut) { Console.WriteLine("--- End ---"); - Console.WriteLine("总游戏时长:" + Calculation.Round2Digits(totalTime)); + Console.WriteLine($"总游戏时长:{totalTime:0.##}"); Console.WriteLine(""); } @@ -387,10 +400,10 @@ namespace Milimoe.FunGame.Testing.Tests int top = isWeb ? 12 : 6; Msg = $"=== 伤害排行榜 TOP{top} ===\r\n"; int count = 1; - foreach (Character character in ActionQueue.CharacterStatistics.OrderByDescending(d => d.Value.TotalDamage).Select(d => d.Key)) + foreach (Character character in actionQueue.CharacterStatistics.OrderByDescending(d => d.Value.TotalDamage).Select(d => d.Key)) { StringBuilder builder = new(); - CharacterStatistics stats = ActionQueue.CharacterStatistics[character]; + CharacterStatistics stats = actionQueue.CharacterStatistics[character]; builder.AppendLine($"{count}. [ {character.ToStringWithLevel()} ] ({stats.Kills} / {stats.Assists})"); builder.AppendLine($"存活时长:{stats.LiveTime} / 存活回合数:{stats.LiveRound} / 行动回合数:{stats.ActionTurn}"); builder.AppendLine($"总计伤害:{stats.TotalDamage} / 总计物理伤害:{stats.TotalPhysicalDamage} / 总计魔法伤害:{stats.TotalMagicDamage}"); @@ -450,7 +463,7 @@ namespace Milimoe.FunGame.Testing.Tests } 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); + if (totalStats.LiveTime != 0) totalStats.DamagePerSecond = Calculation.Round2Digits(totalStats.TotalDamage / totalStats.LiveTime); } } result.Add(Msg); @@ -458,12 +471,21 @@ namespace Milimoe.FunGame.Testing.Tests // 显示每个角色的信息 if (isWeb) { - for (i = ActionQueue.Eliminated.Count - 1; i >= 0; i--) + for (i = actionQueue.Eliminated.Count - 1; i >= 0; i--) { - Character character = ActionQueue.Eliminated[i]; + Character character = actionQueue.Eliminated[i]; result.Add($"=== 角色 [ {character} ] ===\r\n{character.GetInfo()}"); } } + else + { + Character? character = actionQueue.Eliminated.LastOrDefault(); + if (character != null) + { + Msg = ""; + WriteLine($"\r\n\r\n=== 本次冠军角色 [ {character} ] ===\r\n{character.GetInfo()}"); + } + } lock (StatsConfig) { @@ -493,48 +515,40 @@ namespace Milimoe.FunGame.Testing.Tests if (PrintOut) Console.WriteLine(str); } - public static void 空投(ActionQueue queue, double totalTime) + public static void 空投(ActionQueue queue) { - Item[] 这次发放的空投; - if (totalTime == 0) + Item a = Items[Random.Shared.Next(Items.Count)]; + a.SetGamingQueue(queue); + Item[] 这次发放的空投 = [a]; + WriteLine($"社区送温暖了,现在向所有人发放 [ {a.Name} ]!!"); + foreach (Character character in queue.Queue) { - WriteLine("社区送温暖了,现在向所有人发放 [ 攻击之爪 +10 ]!!"); - foreach (Character character in queue.Queue) + foreach (Item item in 这次发放的空投) { - 这次发放的空投 = [new 攻击之爪10()]; - foreach (Item item in 这次发放的空投) - { - queue.Equip(character, EquipItemToSlot.Accessory1, item); - } + queue.Equip(character, item.Copy(1)); } } + WriteLine(""); } - public static void LoadModules() + public static void InitCharacter() { - PluginLoader plugins = PluginLoader.LoadPlugins([]); - foreach (string plugin in plugins.Plugins.Keys) - { - Console.WriteLine(plugin + " is loaded."); - } + Characters.Add(OshimaCharacters.Oshima); + Characters.Add(OshimaCharacters.Xinyin); + Characters.Add(OshimaCharacters.Yang); + Characters.Add(OshimaCharacters.NanGanyu); + Characters.Add(OshimaCharacters.NiuNan); + Characters.Add(OshimaCharacters.Mayor); + Characters.Add(OshimaCharacters.马猴烧酒); + Characters.Add(OshimaCharacters.QingXiang); + Characters.Add(OshimaCharacters.QWQAQW); + Characters.Add(OshimaCharacters.ColdBlue); + Characters.Add(OshimaCharacters.绿拱门); + Characters.Add(OshimaCharacters.QuDuoduo); - Dictionary plugindllsha512 = []; - foreach (string pfp in PluginLoader.PluginFilePaths.Keys) + foreach (Character c in Characters) { - string text = Encryption.FileSha512(PluginLoader.PluginFilePaths[pfp]); - plugindllsha512.Add(pfp, text); - if (PrintOut) Console.WriteLine(pfp + $" is {text}."); - } - - GameModuleLoader modules = GameModuleLoader.LoadGameModules(FunGameInfo.FunGame.FunGame_Desktop, []); - foreach (CharacterModule cm in modules.Characters.Values) - { - foreach (Character c in cm.Characters) - { - if (PrintOut) Console.WriteLine(c.Name); - Characters.Add(c); - CharacterStatistics.Add(c, new()); - } + CharacterStatistics.Add(c, new()); } StatsConfig.LoadConfig(); @@ -546,22 +560,9 @@ namespace Milimoe.FunGame.Testing.Tests } } - Dictionary moduledllsha512 = []; - foreach (string mfp in GameModuleLoader.ModuleFilePaths.Keys) - { - string text = Encryption.FileSha512(GameModuleLoader.ModuleFilePaths[mfp]); - moduledllsha512.Add(mfp, text); - if (PrintOut) Console.WriteLine(mfp + $" is {text}."); - } - - foreach (string moduledll in moduledllsha512.Keys) - { - string server = moduledllsha512[moduledll]; - if (plugindllsha512.TryGetValue(moduledll, out string? client) && client != "" && server == client) - { - Console.WriteLine(moduledll + $" is checked pass."); - } - } + Dictionary exitem = Factory.GetGameModuleInstances(nameof(SkillJSONTest), nameof(Item)); + Items.AddRange(exitem.Values); + Items.AddRange([new 攻击之爪10(), new 攻击之爪30(), new 攻击之爪50()]); } } } diff --git a/Library/Tests/SkillJSONTest.cs b/Library/Tests/SkillJSONTest.cs index 3000999..c8fc0a6 100644 --- a/Library/Tests/SkillJSONTest.cs +++ b/Library/Tests/SkillJSONTest.cs @@ -1,10 +1,4 @@ -using Milimoe.FunGame.Core.Api.Utility; -using Milimoe.FunGame.Core.Entity; -using Milimoe.FunGame.Core.Library.Constant; -using Milimoe.FunGame.Testing.Effects; -using Milimoe.FunGame.Testing.Items; -using Milimoe.FunGame.Testing.Skills; -using MilimoeFunGame.Testing.Characters; +using Addons; namespace Milimoe.FunGame.Testing.Tests { @@ -12,228 +6,14 @@ namespace Milimoe.FunGame.Testing.Tests { public SkillJSONTest() { - //EntityModuleConfig config = new(nameof(SkillJSONTest), nameof(Character)) - //{ - // { "Oshima", OshimaCharacters.Oshima }, - // { "Xinyin", OshimaCharacters.Xinyin }, - // { "Yang", OshimaCharacters.Yang }, - // { "NanGanyu", OshimaCharacters.NanGanyu }, - // { "NiuNan", OshimaCharacters.NiuNan }, - // { "Mayor", OshimaCharacters.Mayor }, - // { "马猴烧酒", OshimaCharacters.马猴烧酒 }, - // { "QingXiang", OshimaCharacters.QingXiang }, - // { "QWQAQW", OshimaCharacters.QWQAQW }, - // { "ColdBlue", OshimaCharacters.ColdBlue }, - // { "绿拱门", OshimaCharacters.绿拱门 }, - // { "QuDuoduo", OshimaCharacters.QuDuoduo } - //}; - //config.SaveConfig(); - - EntityModuleConfig config2 = new(nameof(SkillJSONTest), nameof(Skill)); - Character c = Factory.GetCharacter(); - List listSkill = []; - listSkill.Add(new 精准打击(c)); - foreach (Skill s in listSkill) - { - config2.Add(s.Name, s); - } - config2.SaveConfig(); - - config2.LoadConfig(); - foreach (string key in config2.Keys) - { - Skill prev = config2[key]; - Skill? next = GetSkill(prev.Id, prev.Name, prev.SkillType); - if (next != null) - { - config2[key] = next; - } - Skill skill = config2[key]; - foreach (Effect effect in skill.Effects.ToList()) - { - Effect? newEffect = GetEffect(effect.Id, effect.Name, skill); - if (newEffect != null) - { - skill.Effects.Remove(effect); - skill.Effects.Add(newEffect); - } - } - } - Console.WriteLine(string.Join("\r\n", config2.Values)); - - EntityModuleConfig config3 = new(nameof(SkillJSONTest), nameof(Item)); ; - //EntityModuleConfig config3 = new(nameof(SkillJSONTest), nameof(Item)) - //{ - // { "攻击之爪10", new 攻击之爪10() } - //}; - //config3.SaveConfig(); - config3.LoadConfig(); - foreach (string key in config3.Keys) - { - Item prev = config3[key]; - Item? next = GetItem(prev.Id, prev.Name, prev.ItemType); - if (next != null) - { - prev.SetPropertyToItemModuleNew(next); - config3[key] = next; - } - Item item = config3[key]; - HashSet skills = item.Skills.Passives; - if (item.Skills.Active != null) skills.Add(item.Skills.Active); - foreach (Skill skill in skills.ToList()) - { - Skill? newSkill = GetSkill(skill.Id, skill.Name, skill.SkillType); - if (newSkill != null) - { - if (newSkill.IsActive) - { - item.Skills.Active = newSkill; - } - else - { - item.Skills.Passives.Remove(skill); - item.Skills.Passives.Add(newSkill); - } - } - Skill s = newSkill ?? skill; - foreach (Effect effect in s.Effects.ToList()) - { - Effect? newEffect = GetEffect(effect.Id, effect.Name, skill); - if (newEffect != null) - { - skill.Effects.Remove(effect); - skill.Effects.Add(newEffect); - } - } - } - } - Console.WriteLine(string.Join("\r\n", config3.Values)); - - } - - public static Item? GetItem(long id, string name, ItemType type) - { - if (type == ItemType.Accessory) - { - switch ((AccessoryID)id) - { - case AccessoryID.攻击之爪10: - return new 攻击之爪10(); - case AccessoryID.攻击之爪30: - return new 攻击之爪30(); - case AccessoryID.攻击之爪50: - return new 攻击之爪50(); - } - } - - return null; - } - - public static Skill? GetSkill(long id, string name, SkillType type) - { - if (type == SkillType.Magic) - { - switch ((MagicID)id) - { - case MagicID.冰霜攻击: - return new 冰霜攻击(); - } - } - - if (type == SkillType.Skill) - { - switch ((SkillID)id) - { - case SkillID.疾风步: - return new 疾风步(); - } - } - - if (type == SkillType.SuperSkill) - { - switch ((SuperSkillID)id) - { - case SuperSkillID.力量爆发: - return new 力量爆发(); - case SuperSkillID.天赐之力: - return new 天赐之力(); - case SuperSkillID.魔法涌流: - return new 魔法涌流(); - case SuperSkillID.三重叠加: - return new 三重叠加(); - case SuperSkillID.变幻之心: - return new 变幻之心(); - case SuperSkillID.精准打击: - return new 精准打击(); - case SuperSkillID.绝对领域: - return new 绝对领域(); - case SuperSkillID.能量毁灭: - return new 能量毁灭(); - case SuperSkillID.迅捷之势: - return new 迅捷之势(); - case SuperSkillID.嗜血本能: - return new 嗜血本能(); - case SuperSkillID.平衡强化: - return new 平衡强化(); - case SuperSkillID.血之狂欢: - return new 血之狂欢(); - } - } - - if (type == SkillType.Passive) - { - switch ((PassiveID)id) - { - case PassiveID.META马: - return new META马(); - case PassiveID.心灵之火: - return new 心灵之火(); - case PassiveID.魔法震荡: - return new 魔法震荡(); - case PassiveID.灵能反射: - return new 灵能反射(); - case PassiveID.智慧与力量: - return new 智慧与力量(); - case PassiveID.致命打击: - return new 致命打击(); - case PassiveID.毁灭之势: - return new 毁灭之势(); - case PassiveID.枯竭打击: - return new 枯竭打击(); - case PassiveID.玻璃大炮: - return new 玻璃大炮(); - case PassiveID.累积之压: - return new 累积之压(); - case PassiveID.敏捷之刃: - return new 敏捷之刃(); - case PassiveID.弱者猎手: - return new 弱者猎手(); - } - switch ((ItemPassiveID)id) - { - case ItemPassiveID.攻击之爪: - return new 攻击之爪技能(); - } - } - - return null; - } - - public static Effect? GetEffect(long id, string name, Skill skill) - { - switch (id) - { - case 8001: - return new ExATK(skill, null, null); - case 8002: - return new ExDEF(skill, null, null); - case 8003: - return new ExSTR(skill, null, null); - default: - break; - } - - return null; + //Factory.CreateGameModuleEntityConfig(nameof(SkillJSONTest), nameof(Item), []); + ExampleCharacterModule cm = new(); + cm.Load(); + ExampleItemModule im = new(); + im.Load(); + ExampleSkillModule sm = new(); + sm.Load(); + _ = new FunGameSimulation(); } } }