添加所有已完成的技能测试

This commit is contained in:
milimoe 2024-09-15 01:32:50 +08:00 committed by GitHub
commit c38e755f4f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
39 changed files with 2886 additions and 77 deletions

View File

@ -13,11 +13,11 @@
InitializeComponent(); InitializeComponent();
InitializeChessboard(); InitializeChessboard();
foreach (var panel in chessboardDict.Values) //foreach (var panel in chessboardDict.Values)
{ //{
panel.MouseEnter += OnCellMouseEnter; // panel.MouseEnter += OnCellMouseEnter;
panel.MouseLeave += OnCellMouseLeave; // panel.MouseLeave += OnCellMouseLeave;
} //}
string key = "5_9"; string key = "5_9";
Button b = new Button(); Button b = new Button();

View File

@ -5,7 +5,9 @@ VisualStudioVersion = 17.5.33516.290
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FunGame.Testing", "Library\FunGame.Testing.csproj", "{6F6B4A21-8F39-4B0D-84E8-98AE3E93F06F}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FunGame.Testing", "Library\FunGame.Testing.csproj", "{6F6B4A21-8F39-4B0D-84E8-98AE3E93F06F}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FunGame.Testing.Desktop", "Desktop\FunGame.Testing.Desktop.csproj", "{05FA61CB-22AA-4834-8C45-1161C42DF2C7}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FunGame.Testing.Desktop", "Desktop\FunGame.Testing.Desktop.csproj", "{05FA61CB-22AA-4834-8C45-1161C42DF2C7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FunGame.Core", "..\FunGame.Core\FunGame.Core.csproj", "{94B564CD-7A1E-4B3C-AF78-23EBCD5D627E}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -21,6 +23,10 @@ Global
{05FA61CB-22AA-4834-8C45-1161C42DF2C7}.Debug|Any CPU.Build.0 = Debug|Any CPU {05FA61CB-22AA-4834-8C45-1161C42DF2C7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{05FA61CB-22AA-4834-8C45-1161C42DF2C7}.Release|Any CPU.ActiveCfg = Release|Any CPU {05FA61CB-22AA-4834-8C45-1161C42DF2C7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{05FA61CB-22AA-4834-8C45-1161C42DF2C7}.Release|Any CPU.Build.0 = Release|Any CPU {05FA61CB-22AA-4834-8C45-1161C42DF2C7}.Release|Any CPU.Build.0 = Release|Any CPU
{94B564CD-7A1E-4B3C-AF78-23EBCD5D627E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{94B564CD-7A1E-4B3C-AF78-23EBCD5D627E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{94B564CD-7A1E-4B3C-AF78-23EBCD5D627E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{94B564CD-7A1E-4B3C-AF78-23EBCD5D627E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@ -0,0 +1,309 @@
using Milimoe.FunGame.Core.Api.Utility;
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Constant;
namespace FunGame.Testing.Characters
{
public class Characters
{
public static Character Oshima
{
get
{
Character c = Factory.GetCharacter();
c.Name = "Oshima";
c.FirstName = "Shiya";
c.NickName = "大島シヤ";
c.PrimaryAttribute = PrimaryAttribute.STR;
c.InitialATK = 25;
c.InitialHP = 145;
c.InitialMP = 10;
c.InitialSTR = 35;
c.STRGrowth = 3.5;
c.InitialAGI = 0;
c.AGIGrowth = 0;
c.InitialINT = 0;
c.INTGrowth = 0;
c.InitialSPD = 300;
c.InitialHR = 4;
c.InitialMR = 2;
return c;
}
}
public static Character Xinyin
{
get
{
Character c = Factory.GetCharacter();
c.Name = "Xiyue";
c.FirstName = "XinYin";
c.NickName = "心音";
c.PrimaryAttribute = PrimaryAttribute.AGI;
c.InitialATK = 22;
c.InitialHP = 80;
c.InitialMP = 60;
c.InitialSTR = 8;
c.STRGrowth = 0.9;
c.InitialAGI = 19;
c.AGIGrowth = 1.7;
c.InitialINT = 3;
c.INTGrowth = 0.4;
c.InitialSPD = 300;
c.InitialHR = 4;
c.InitialMR = 2;
return c;
}
}
public static Character Yang
{
get
{
Character c = Factory.GetCharacter();
c.Name = "Ya";
c.FirstName = "Yang";
c.NickName = "吖养";
c.PrimaryAttribute = PrimaryAttribute.STR;
c.InitialATK = 23;
c.InitialHP = 105;
c.InitialMP = 55;
c.InitialSTR = 11;
c.STRGrowth = 1.8;
c.InitialAGI = 9;
c.AGIGrowth = 0.5;
c.InitialINT = 10;
c.INTGrowth = 0.7;
c.InitialSPD = 300;
c.InitialHR = 4;
c.InitialMR = 2;
return c;
}
}
public static Character NanGanyu
{
get
{
Character c = Factory.GetCharacter();
c.Name = "Nan";
c.FirstName = "Ganyu";
c.NickName = "男甘雨";
c.PrimaryAttribute = PrimaryAttribute.INT;
c.InitialATK = 17;
c.InitialHP = 115;
c.InitialMP = 80;
c.InitialSTR = 6;
c.STRGrowth = 0.6;
c.InitialAGI = 7;
c.AGIGrowth = 0.7;
c.InitialINT = 17;
c.INTGrowth = 1.7;
c.InitialSPD = 300;
c.InitialHR = 4;
c.InitialMR = 2;
return c;
}
}
public static Character NiuNan
{
get
{
Character c = Factory.GetCharacter();
c.Name = "Niu";
c.FirstName = "Nan";
c.NickName = "牛腩";
c.PrimaryAttribute = PrimaryAttribute.INT;
c.InitialATK = 16;
c.InitialHP = 75;
c.InitialMP = 90;
c.InitialSTR = 0;
c.STRGrowth = 0;
c.InitialAGI = 0;
c.AGIGrowth = 0;
c.InitialINT = 30;
c.INTGrowth = 3;
c.InitialSPD = 300;
c.InitialHR = 4;
c.InitialMR = 2;
return c;
}
}
public static Character Mayor
{
get
{
Character c = Factory.GetCharacter();
c.Name = "Dokyo";
c.FirstName = "Mayor";
c.NickName = "铎京市长";
c.PrimaryAttribute = PrimaryAttribute.AGI;
c.InitialATK = 21;
c.InitialHP = 120;
c.InitialMP = 20;
c.InitialSTR = 7;
c.STRGrowth = 1;
c.InitialAGI = 21;
c.AGIGrowth = 1.8;
c.InitialINT = 2;
c.INTGrowth = 0.2;
c.InitialSPD = 300;
c.InitialHR = 4;
c.InitialMR = 2;
return c;
}
}
public static Character
{
get
{
Character c = Factory.GetCharacter();
c.Name = "Magical";
c.FirstName = "Girl";
c.NickName = "魔法少女";
c.PrimaryAttribute = PrimaryAttribute.AGI;
c.InitialATK = 20;
c.InitialHP = 95;
c.InitialMP = 35;
c.InitialSTR = 7;
c.STRGrowth = 0.3;
c.InitialAGI = 15;
c.AGIGrowth = 2.3;
c.InitialINT = 8;
c.INTGrowth = 0.4;
c.InitialSPD = 300;
c.InitialHR = 4;
c.InitialMR = 2;
return c;
}
}
public static Character QingXiang
{
get
{
Character c = Factory.GetCharacter();
c.Name = "Qing";
c.FirstName = "Xiang";
c.NickName = "清香";
c.PrimaryAttribute = PrimaryAttribute.INT;
c.InitialATK = 26;
c.InitialHP = 110;
c.InitialMP = 80;
c.InitialSTR = 6;
c.STRGrowth = 0.5;
c.InitialAGI = 4;
c.AGIGrowth = 0.5;
c.InitialINT = 20;
c.INTGrowth = 2;
c.InitialSPD = 300;
c.InitialHR = 4;
c.InitialMR = 2;
return c;
}
}
public static Character QWQAQW
{
get
{
Character c = Factory.GetCharacter();
c.Name = "QWQ";
c.FirstName = "AQW";
c.NickName = "LUOLI66";
c.PrimaryAttribute = PrimaryAttribute.INT;
c.InitialATK = 18;
c.InitialHP = 85;
c.InitialMP = 45;
c.InitialSTR = 0;
c.STRGrowth = 0;
c.InitialAGI = 15;
c.AGIGrowth = 1.5;
c.InitialINT = 15;
c.INTGrowth = 1.5;
c.InitialSPD = 300;
c.InitialHR = 4;
c.InitialMR = 2;
return c;
}
}
public static Character ColdBlue
{
get
{
Character c = Factory.GetCharacter();
c.Name = "Cold";
c.FirstName = "Blue";
c.NickName = "冷蓝";
c.PrimaryAttribute = PrimaryAttribute.STR;
c.InitialATK = 28;
c.InitialHP = 135;
c.InitialMP = 25;
c.InitialSTR = 22;
c.STRGrowth = 1.9;
c.InitialAGI = 4;
c.AGIGrowth = 0.6;
c.InitialINT = 4;
c.INTGrowth = 0.6;
c.InitialSPD = 300;
c.InitialHR = 4;
c.InitialMR = 2;
return c;
}
}
public static Character 绿
{
get
{
Character c = Factory.GetCharacter();
c.Name = "ddd";
c.FirstName = "ovo";
c.NickName = "绿拱门";
c.PrimaryAttribute = PrimaryAttribute.AGI;
c.InitialATK = 22;
c.InitialHP = 65;
c.InitialMP = 22;
c.InitialSTR = 10;
c.STRGrowth = 1;
c.InitialAGI = 20;
c.AGIGrowth = 2;
c.InitialINT = 0;
c.INTGrowth = 0;
c.InitialSPD = 300;
c.InitialHR = 4;
c.InitialMR = 2;
return c;
}
}
public static Character QuDuoduo
{
get
{
Character c = Factory.GetCharacter();
c.Name = "Qu";
c.FirstName = "Duoduo";
c.NickName = "趣多多";
c.PrimaryAttribute = PrimaryAttribute.STR;
c.InitialATK = 19;
c.InitialHP = 90;
c.InitialMP = 40;
c.InitialSTR = 13;
c.STRGrowth = 1.5;
c.InitialAGI = 13;
c.AGIGrowth = 1.2;
c.InitialINT = 4;
c.INTGrowth = 0.3;
c.InitialSPD = 300;
c.InitialHR = 4;
c.InitialMR = 2;
return c;
}
}
}
}

47
Library/Effects/眩晕.cs Normal file
View File

@ -0,0 +1,47 @@
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Constant;
namespace Milimoe.FunGame.Testing.Effects
{
public class : Effect
{
public override long Id => 4101;
public override string Name => "眩晕";
public override string Description => $"此角色被眩晕了,不能行动。来自:[ {Source} ] 的 [ {Skill.Name} ]";
public override EffectControlType ControlType => EffectControlType.Stun;
public override bool TargetSelf => true;
public override Character Source => _sourceCharacter;
public override bool Durative => _durative;
public override double Duration => _duration;
public override int DurationTurn => _durationTurn;
private readonly Character _sourceCharacter;
private readonly bool _durative;
private readonly double _duration;
private readonly int _durationTurn;
public (Skill skill, Character sourceCharacter, bool durative = false, double duration = 0, int durationTurn = 1) : base(skill)
{
ActionQueue = skill.ActionQueue;
_sourceCharacter = sourceCharacter;
_durative = durative;
_duration = duration;
_durationTurn = durationTurn;
}
public override void OnEffectGained(Character character)
{
if (_durative) RemainDuration = Duration;
else RemainDurationTurn = DurationTurn;
character.CharacterEffectStates.Add(this, [CharacterState.NotActionable]);
character.UpdateCharacterState();
InterruptCasting(character, Source);
}
public override void OnEffectLost(Character character)
{
character.CharacterEffectStates.Remove(this);
character.UpdateCharacterState();
}
}
}

View File

@ -0,0 +1,24 @@
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Constant;
namespace Milimoe.FunGame.Testing.Effects
{
public class : Effect
{
public override long Id => 4102;
public override string Name => "累积之压标记";
public override string Description => $"此角色持有累积之压标记,已累计 {MarkLevel} 层。来自:[ {Source} ]";
public override EffectControlType ControlType => EffectControlType.Mark;
public override bool TargetSelf => true;
public override Character Source => _sourceCharacter;
public int MarkLevel { get; set; } = 1;
private readonly Character _sourceCharacter;
public (Skill skill, Character sourceCharacter) : base(skill)
{
ActionQueue = skill.ActionQueue;
_sourceCharacter = sourceCharacter;
}
}
}

View File

@ -1,74 +1,14 @@
using System.Collections; using Milimoe.FunGame.Testing.Tests;
using System.Data;
using ConverterExample;
using Milimoe.FunGame.Core.Api.Utility;
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Common.JsonConverter;
DataSet ds = new(); bool printout = false;
DataTable table = new("SampleTable1"); List<string> strs = FunGameSimulation.StartGame(printout);
table.Columns.Add("Id", typeof(int)); if (printout == false)
table.Columns.Add("Name", typeof(string));
table.Columns.Add("Age", typeof(int));
table.Rows.Add(1, "John", 30);
table.Rows.Add(2, "Jane", 25);
table.Rows.Add(3, "Bob", 40);
ds.Tables.Add(table);
table = new("SampleTable2");
table.Columns.Add("Id", typeof(int));
table.Columns.Add("Name", typeof(string));
table.Columns.Add("Age", typeof(int));
table.Rows.Add(1, "John", 30);
table.Rows.Add(2, "Jane", 25);
table.Rows.Add(3, "Bob", 40);
ds.Tables.Add(table);
JsonTool JsonTool = new();
JsonTool.AddConverters(new System.Text.Json.Serialization.JsonConverter[] { new UserConverter(), new RoomConverter(), new PersonConverter(), new AddressConverter() });
Room r = Factory.GetRoom(1294367, "w5rtvh8".ToUpper(), DateTime.Now, Factory.GetUser(), Milimoe.FunGame.Core.Library.Constant.RoomType.Mix, "", "", Milimoe.FunGame.Core.Library.Constant.RoomState.Created);
User u = Factory.GetUser(1, "LUOLI", DateTime.Now, DateTime.Now, "LUOLI@66.COM", "QWQAQW");
Hashtable hashtable = new()
{ {
{ "table", table }, foreach (string str in strs)
{ "room", r },
{ "user", u }
};
string json = JsonTool.GetString(hashtable);
Hashtable hashtable2 = JsonTool.GetObject<Hashtable>(json) ?? new();
DataTable table2 = JsonTool.GetObject<DataTable>(json) ?? new();
User u2 = JsonTool.GetObject<User>(hashtable2, "user") ?? Factory.GetUser();
Room r2 = JsonTool.GetObject<Room>(hashtable2, "room") ?? Factory.GetRoom();
table2.AsEnumerable().ToList().ForEach(row =>
{ {
Console.WriteLine("Id: " + row["Id"] + ", Name: "+ row["Name"] + ", Age: " + row["Age"]); Console.WriteLine(str);
}); }
Console.WriteLine(u2.Username + " 进入了 " + r2.Roomid + " 房间");
Person p = new()
{
Age = (int)r2.Id,
Name = u2.Username,
Address = new()
{
State = "呵呵州(Hehe State)",
City = "哈哈市(Haha City)"
} }
};
json = JsonTool.GetString(p);
Person p2 = JsonTool.GetObject<Person>(json) ?? new(); Console.ReadKey();
Console.WriteLine("My name is " + p2.Name + ", I am " + p2.Age + "-year-old. I live at " + p2.Address.State + " " + p2.Address.City);
Console.WriteLine("摆烂了86");
// 生成一对公钥秘钥
//TwoFactorAuthenticator.CreateSecretKey();

View File

@ -0,0 +1,65 @@
using Milimoe.FunGame.Core.Api.Utility;
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Constant;
using Milimoe.FunGame.Testing.Effects;
namespace Milimoe.FunGame.Testing.Skills
{
public class : Skill
{
public override long Id => 3010;
public override string Name => "嗜血本能";
public override string Description => Effects.Count > 0 ? Effects.First().Description : "";
public override double EPCost => 100;
public override double CD => 42 - 1 * (Level - 1);
public override double HardnessTime => 12;
public (Character character) : base(SkillType.SuperSkill, character)
{
Effects.Add(new (this));
}
}
public class (Skill skill) : Effect(skill)
{
public override long Id => Skill.Id;
public override string Name => Skill.Name;
public override string Description => $"{Duration} 时间内,攻击拥有标记的角色将根据标记层数获得 {吸血 * 100:0.##}% 吸血每层。";
public override bool TargetSelf => true;
public override bool Durative => true;
public override double Duration => 30;
public HashSet<Character> { get; } = [];
private double => Calculation.Round4Digits(0.03 * Level);
public override void AfterDamageCalculation(Character character, Character enemy, double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, DamageResult damageResult)
{
if (character == Skill.Character && damageResult != DamageResult.Evaded && character.HP < character.MaxHP)
{
int = 0;
if (enemy.Effects.Where(e => e is ).FirstOrDefault() is e)
{
= e.MarkLevel;
}
else if (.Remove(enemy))
{
= 4;
}
double = Calculation.Round2Digits( * * damage);
character.HP += ;
WriteLine($"[ {character} ] 回复了 {实际吸血} 点生命值!");
}
}
public override void OnSkillCasted(Character caster, List<Character> enemys, List<Character> teammates, Dictionary<string, object> others)
{
RemainDuration = Duration;
if (!caster.Effects.Contains(this))
{
.Clear();
caster.Effects.Add(this);
OnEffectGained(caster);
}
}
}
}

View File

@ -0,0 +1,90 @@
using Milimoe.FunGame.Core.Api.Utility;
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Constant;
using Milimoe.FunGame.Testing.Effects;
namespace Milimoe.FunGame.Testing.Skills
{
public class : Skill
{
public override long Id => 4010;
public override string Name => "累积之压";
public override string Description => Effects.Count > 0 ? Effects.First().Description : "";
public (Character character) : base(SkillType.Passive, character)
{
Effects.Add(new (this));
}
public override IEnumerable<Effect> AddInactiveEffectToCharacter()
{
return Effects;
}
}
public class (Skill skill) : Effect(skill)
{
public override long Id => Skill.Id;
public override string Name => Skill.Name;
public override string Description => $"每次造成伤害都可以叠一层标记,累计 4 层时回收该角色所有标记并造成眩晕 1 回合,额外对该角色造成 {系数 * 100:0.##}% 最大生命值的物理伤害。";
public override bool TargetSelf => true;
private readonly double = 0.12;
private bool = false;
public override void AfterDamageCalculation(Character character, Character enemy, double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, DamageResult damageResult)
{
if (character == Skill.Character && damageResult != DamageResult.Evaded && !)
{
// 叠标记
IEnumerable<Effect> effects = enemy.Effects.Where(e => e is );
if (effects.Any() && effects.First() is e)
{
e.MarkLevel++;
IEnumerable<Effect> effects2 = character.Effects.Where(e => e is );
if (effects2.Any() && effects2.First() is e2)
{
if (e.MarkLevel >= 4)
{
e2..Add(enemy);
}
else
{
e2..Remove(enemy);
}
}
if (e.MarkLevel >= 4)
{
// 移除标记
enemy.Effects.Remove(e);
double = Calculation.Round2Digits(enemy.MaxHP * );
WriteLine($"[ {character} ] 发动了累积之压!将对 [ {enemy} ] 造成眩晕和额外伤害!");
// 眩晕
IEnumerable<Effect> effects3 = enemy.Effects.Where(e => e is && e.Skill == Skill);
if (effects3.Any())
{
effects3.First().RemainDurationTurn++;
}
else
{
e3 = new(Skill, character, false, 0, 1);
enemy.Effects.Add(e3);
e3.OnEffectGained(enemy);
}
= true;
DamageToEnemy(character, enemy, false, magicType, );
}
}
else
{
enemy.Effects.Add(new (Skill, character));
}
}
if (character == Skill.Character && )
{
= false;
}
}
}
}

View File

@ -0,0 +1,64 @@
using Milimoe.FunGame.Core.Api.Utility;
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Constant;
namespace Milimoe.FunGame.Testing.Skills
{
public class : Skill
{
public override long Id => 3006;
public override string Name => "精准打击";
public override string Description => Effects.Count > 0 ? Effects.First().Description : "";
public override double EPCost => 100;
public override double CD => 40 - 1 * (Level - 1);
public override double HardnessTime => 8;
public (Character character) : base(SkillType.SuperSkill, character)
{
Effects.Add(new (this));
}
}
public class (Skill skill) : Effect(skill)
{
public override long Id => Skill.Id;
public override string Name => Skill.Name;
public override string Description => $"30 时间内暴击率提升 {暴击率提升 * 100:0.##}%,暴击伤害再提升 {暴击伤害提升 * 100:0.##}%。";
public override bool TargetSelf => true;
public override bool Durative => true;
public override double Duration => 30;
private double => Calculation.Round4Digits(0.2 + 0.03 * (Level - 1));
private double => Calculation.Round4Digits(0.8 + 0.04 * (Level - 1));
private double = 0;
private double = 0;
public override void OnEffectGained(Character character)
{
= ;
= ;
character.ExCritRate += ;
WriteLine($"[ {character} ] 的暴击率提升了 [ {实际暴击率提升 * 100:0.##}% ] ");
character.ExCritDMG += ;
WriteLine($"[ {character} ] 的暴击伤害提升了 [ {实际暴击伤害提升 * 100:0.##}% ] ");
}
public override void OnEffectLost(Character character)
{
character.ExCritRate -= ;
character.ExCritDMG -= ;
}
public override void OnSkillCasted(Character caster, List<Character> enemys, List<Character> teammates, Dictionary<string, object> others)
{
RemainDuration = Duration;
if (!caster.Effects.Contains(this))
{
= 0;
= 0;
caster.Effects.Add(this);
OnEffectGained(caster);
}
}
}
}

View File

@ -0,0 +1,40 @@
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Constant;
namespace Milimoe.FunGame.Testing.Skills
{
public class : Skill
{
public override long Id => 4006;
public override string Name => "致命打击";
public override string Description => Effects.Count > 0 ? Effects.First().Description : "";
public (Character character) : base(SkillType.Passive, character)
{
Effects.Add(new (this));
}
public override IEnumerable<Effect> AddInactiveEffectToCharacter()
{
return Effects;
}
}
public class (Skill skill) : Effect(skill)
{
public override long Id => Skill.Id;
public override string Name => Skill.Name;
public override string Description => $"暴击伤害提升 30%。";
public override bool TargetSelf => true;
public override void OnEffectGained(Character character)
{
character.ExCritDMG += 0.3;
}
public override void OnEffectLost(Character character)
{
character.ExCritDMG -= 0.3;
}
}
}

View File

@ -0,0 +1,64 @@
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Constant;
namespace Milimoe.FunGame.Testing.Skills
{
public class : Skill
{
public override long Id => 3004;
public override string Name => "三重叠加";
public override string Description => Effects.Count > 0 ? Effects.First().Description : "";
public override double EPCost => 100;
public override double CD => 35 - 2 * (Level - 1);
public override double HardnessTime => 10;
public (Character character) : base(SkillType.SuperSkill, character)
{
Effects.Add(new (this));
}
}
public class (Skill skill) : Effect(skill)
{
public override long Id => Skill.Id;
public override string Name => "三重叠加";
public override string Description => $"使 [ 灵能反射 ] 支持普通攻击,且当前释放魔法次数归零,最大硬直消除次数提高到 {灵能反射次数} 次;在魔法命中和普通攻击命中时能够回复所回复能量值的 10 倍魔法值,持续 {技能持续次数} 次(灵能反射每消除次数达到最大时算一次)。" +
$"(剩余:{剩余持续次数} 次)";
public override bool TargetSelf => true;
public int { get; set; } = 0;
private readonly int = 3;
private readonly int = 2;
public override void OnEffectGained(Character character)
{
IEnumerable<Effect> effects = character.Effects.Where(e => e is );
if (effects.Any() && effects.First() is e)
{
e. = true;
e. = 3;
e. = 0;
}
}
public override void OnEffectLost(Character character)
{
IEnumerable<Effect> effects = character.Effects.Where(e => e is );
if (effects.Any() && effects.First() is e)
{
e. = false;
e. = 2;
}
}
public override void OnSkillCasted(Character caster, List<Character> enemys, List<Character> teammates, Dictionary<string, object> others)
{
= ;
if (!caster.Effects.Contains(this))
{
caster.Effects.Add(this);
OnEffectGained(caster);
}
}
}
}

View File

@ -0,0 +1,103 @@
using Milimoe.FunGame.Core.Api.Utility;
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Constant;
namespace Milimoe.FunGame.Testing.Skills
{
public class : Skill
{
public override long Id => 4004;
public override string Name => "灵能反射";
public override string Description => Effects.Count > 0 ? Effects.First().Description : "";
public (Character character) : base(SkillType.Passive, character)
{
Effects.Add(new (this));
}
public override IEnumerable<Effect> AddInactiveEffectToCharacter()
{
return Effects;
}
}
public class (Skill skill) : Effect(skill)
{
public override long Id => Skill.Id;
public override string Name => Skill.Name;
public override string Description => $"每释放 {触发硬直次数} 次魔法才会触发硬直时间,且魔法命中时基于 25% 智力 [ {获得额外能量值} ] 获得额外能量值。";
public override bool TargetSelf => true;
public 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 override void AfterDamageCalculation(Character character, Character enemy, double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, DamageResult damageResult)
{
if (character == Skill.Character && ( && isNormalAttack || isMagicDamage) && damageResult != DamageResult.Evaded && character.EP < 200)
{
double = ;
character.EP += ;
WriteLine("[ " + character + " ] 发动了灵能反射!额外获得了 " + + " 能量!");
IEnumerable<Effect> effects = character.Effects.Where(e => e is );
if (effects.Any() && effects.First() is e)
{
double = Calculation.Round2Digits( * 10);
character.MP += ;
WriteLine("[ " + character + " ] 发动了三重叠加!回复了 " + + " 魔法值!");
}
}
}
public override void AlterHardnessTimeAfterNormalAttack(Character character, ref double baseHardnessTime, ref bool isCheckProtected)
{
if ()
{
AlterHardnessTime(character, ref baseHardnessTime, ref isCheckProtected);
}
}
public override void AlterHardnessTimeAfterCastSkill(Character character, Skill skill, ref double baseHardnessTime, ref bool isCheckProtected)
{
if (skill.SkillType == SkillType.Magic)
{
AlterHardnessTime(character, ref baseHardnessTime, ref isCheckProtected);
}
}
public void AlterHardnessTime(Character character, ref double baseHardnessTime, ref bool isCheckProtected)
{
++;
if ( < )
{
baseHardnessTime = 0;
isCheckProtected = false;
WriteLine($"[ {character} ] 发动了灵能反射,消除了硬直时间!!");
}
else
{
= 0;
IEnumerable<Effect> effects = character.Effects.Where(e => e is );
if (effects.Any() && effects.First() is e)
{
baseHardnessTime = 0;
isCheckProtected = false;
WriteLine($"[ {character} ] 发动了灵能反射,消除了硬直时间!!");
e.--;
if (e. == 0)
{
character.Effects.Remove(e);
e.OnEffectLost(character);
}
}
}
}
}
}

View File

@ -0,0 +1,77 @@
using Milimoe.FunGame.Core.Api.Utility;
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Constant;
namespace Milimoe.FunGame.Testing.Skills
{
public class : Skill
{
public override long Id => 3005;
public override string Name => "变幻之心";
public override string Description => Effects.Count > 0 ? Effects.First().Description : "";
public override double EPCost => 100;
public override double CD => 30;
public override double HardnessTime => 10;
public (Character character) : base(SkillType.SuperSkill, character)
{
Effects.Add(new (this));
}
}
public class (Skill skill) : Effect(skill)
{
public override long Id => Skill.Id;
public override string Name => "变幻之心";
public override string Description => $"检查 [ 智慧与力量 ] 的模式。在力量模式下,立即回复 {生命值回复 * 100: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));
public override void OnEffectGained(Character character)
{
Skill.IsInEffect = true;
}
public override void OnEffectLost(Character character)
{
Skill.IsInEffect = false;
}
public override void AlterExpectedDamageBeforeCalculation(Character character, Character enemy, ref double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType)
{
if (character == Skill.Character && isMagicDamage)
{
double = ;
double = Calculation.Round2Digits(damage * );
damage = Calculation.Round2Digits(damage + );
WriteLine("[ " + character + " ] 发动了变幻之心!伤害提升了 " + + " 点!");
character.Effects.Remove(this);
OnEffectLost(character);
}
}
public override void OnSkillCasted(Character caster, List<Character> enemys, List<Character> teammates, Dictionary<string, object> others)
{
IEnumerable<Effect> effects = caster.Effects.Where(e => e is );
if (effects.Any())
{
if (caster.PrimaryAttribute == PrimaryAttribute.STR)
{
double = Calculation.Round2Digits( * caster.MaxHP);
caster.HP += ;
WriteLine("[ " + caster + " ] 回复了 " + + " 点生命值!");
}
else if (caster.PrimaryAttribute == PrimaryAttribute.INT)
{
if (!caster.Effects.Contains(this))
{
caster.Effects.Add(this);
OnEffectGained(caster);
}
}
}
}
}
}

View File

@ -0,0 +1,91 @@
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Constant;
namespace Milimoe.FunGame.Testing.Skills
{
public class : Skill
{
public override long Id => 4005;
public override string Name => "智慧与力量";
public override string Description => Effects.Count > 0 ? Effects.First().Description : "";
public (Character character) : base(SkillType.Passive, character)
{
Effects.Add(new (this));
}
public override IEnumerable<Effect> AddInactiveEffectToCharacter()
{
return Effects;
}
}
public class (Skill skill) : Effect(skill)
{
public override long Id => Skill.Id;
public override string Name => Skill.Name;
public override string Description => $"当生命值低于 30% 时,智力转化为力量;当生命值高于或等于 30% 时,力量转化为智力。" +
(Skill.Character != null ? "(当前模式:" + CharacterSet.GetPrimaryAttributeName(Skill.Character.PrimaryAttribute) + "" : "");
public override bool TargetSelf => true;
private double = 0;
private double = 0;
public override void OnAttributeChanged(Character character)
{
if (Skill.Character != null)
{
if (Skill.Character.PrimaryAttribute == PrimaryAttribute.INT)
{
double diff = character.ExSTR - ;
character.ExINT = + character.BaseSTR + diff;
}
else if (Skill.Character.PrimaryAttribute == PrimaryAttribute.STR)
{
double diff = character.ExINT - ;
character.ExSTR = + character.BaseINT + diff;
}
}
}
public override void OnTimeElapsed(Character character, double elapsed)
{
if (Skill.Character != null)
{
Character c = Skill.Character;
if (c.HP < c.MaxHP * 0.3)
{
if (c.PrimaryAttribute == PrimaryAttribute.INT)
{
double pastHP = c.HP;
double pastMaxHP = c.MaxHP;
double pastMP = c.MP;
double pastMaxMP = c.MaxMP;
c.PrimaryAttribute = PrimaryAttribute.STR;
= c.ExINT;
= c.ExSTR;
c.ExINT = -c.BaseINT;
c.ExSTR = + c.BaseINT + ;
c.Recovery(pastHP, pastMP, pastMaxHP, pastMaxMP);
}
}
else
{
if (c.PrimaryAttribute == PrimaryAttribute.STR)
{
double pastHP = c.HP;
double pastMaxHP = c.MaxHP;
double pastMP = c.MP;
double pastMaxMP = c.MaxMP;
c.PrimaryAttribute = PrimaryAttribute.INT;
= c.ExINT;
= c.ExSTR;
c.ExINT = + c.BaseSTR + ;
c.ExSTR = -c.BaseSTR;
c.Recovery(pastHP, pastMP, pastMaxHP, pastMaxMP);
}
}
}
}
}
}

View File

@ -0,0 +1,47 @@
using Milimoe.FunGame.Core.Api.Utility;
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Constant;
namespace Milimoe.FunGame.Testing.Skills
{
public class META马 : Skill
{
public override long Id => 4001;
public override string Name => "META马";
public override string Description => Effects.Count > 0 ? Effects.First().Description : "";
public META马(Character character) : base(SkillType.Passive, character)
{
Effects.Add(new META马特效(this));
}
public override IEnumerable<Effect> AddInactiveEffectToCharacter()
{
return Effects;
}
}
public class META马特效(Skill skill) : Effect(skill)
{
public override long Id => Skill.Id;
public override string Name => Skill.Name;
public override string Description => $"META马专属被动力量+5力量成长+0.5在受到伤害时获得的能量提升50%,每回合开始还能获得额外的 [ {EP} ] 能量值。";
public override bool TargetSelf => true;
public static double EP => 10;
public override void AlterEPAfterGetDamage(Character character, ref double baseEP)
{
baseEP = Calculation.Round2Digits(baseEP * 1.5);
if (Skill.Character != null) WriteLine("[ " + Skill.Character + " ] 发动了META马专属被动本次获得了 " + baseEP + " 能量!");
}
public override void OnTurnStart(Character character)
{
if (character.EP < 200)
{
character.EP += EP;
WriteLine("[ " + character + " ] 发动了META马专属被动本次获得了 " + EP + " 能量!");
}
}
}
}

View File

@ -0,0 +1,58 @@
using Milimoe.FunGame.Core.Api.Utility;
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Constant;
namespace Milimoe.FunGame.Testing.Skills
{
public class : Skill
{
public override long Id => 3002;
public override string Name => "力量爆发";
public override string Description => Effects.Count > 0 ? Effects.First().Description : "";
public override double EPCost => 100;
public override double CD => 55;
public override double HardnessTime => 0;
public (Character character) : base(SkillType.SuperSkill, character)
{
Effects.Add(new (this));
}
}
public class (Skill skill) : Effect(skill)
{
public override long Id => Skill.Id;
public override string Name => "力量爆发";
public override string Description => $"获得 150% 力量 [ {攻击力加成} ] 的攻击力加成,持续 {Duration} 时间。";
public override bool TargetSelf => true;
public override bool Durative => true;
public override double Duration => 10 + 1 * (Level - 1);
private double => Calculation.Round2Digits(Skill.Character?.STR * 1.5 ?? 0);
private double = 0;
public override void OnEffectGained(Character character)
{
= ;
character.ExATK2 += ;
WriteLine($"[ {character} ] 的攻击力增加了 [ {实际攻击力加成} ] ");
}
public override void OnEffectLost(Character character)
{
// 恢复到原始攻击力
character.ExATK2 -= ;
}
public override void OnSkillCasted(Character caster, List<Character> enemys, List<Character> teammates, Dictionary<string, object> others)
{
RemainDuration = Duration;
if (!caster.Effects.Contains(this))
{
= 0;
caster.Effects.Add(this);
OnEffectGained(caster);
}
}
}
}

View File

@ -0,0 +1,101 @@
using Milimoe.FunGame.Core.Api.Utility;
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Constant;
namespace Milimoe.FunGame.Testing.Skills
{
public class : Skill
{
public override long Id => 4009;
public override string Name => "玻璃大炮";
public override string Description => Effects.Count > 0 ? Effects.First().Description : "";
public (Character character) : base(SkillType.Passive, character)
{
Effects.Add(new (this));
}
public override IEnumerable<Effect> AddInactiveEffectToCharacter()
{
return Effects;
}
}
public class (Skill skill) : Effect(skill)
{
public override long Id => Skill.Id;
public override string Name => Skill.Name;
public override string Description => $"生命值高于 30% 时,受到额外的 [ {高于30额外伤害下限}~{高于30额外伤害上限}% ] 伤害,但是获得 [ 累计所受伤害的 {高于30的加成下限}~{高于30的加成上限}% ] 伤害加成;生命值低于等于 30% 时,不会受到额外的伤害,仅能获得 [ 累计受到的伤害 {低于30的加成下限}~{低于30的加成上限}% ] 伤害加成。" +
$"在没有受到任何伤害的时候,将获得 {常规伤害加成 * 100:0.##}% 伤害加成。" + ( > 0 ? $"(当前伤害加成:{伤害加成(累计受到的伤害) * 100:0.##}%" : "");
public override bool TargetSelf => true;
private double = 0;
private double = 0;
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 = 100;
private readonly int 30 = 80;
private readonly int 30 = 60;
private readonly int 30 = 40;
private double (double damage)
{
double = ;
Character? character = Skill.Character;
if (character != null && != 0)
{
if (character.HP > character.MaxHP * 0.3)
{
= Calculation.Round4Digits(1.0 + ((new Random().Next(30, 30) + 0.0) / 100));
}
else
{
= Calculation.Round4Digits(1.0 + ((new Random().Next(30, 30) + 0.0) / 100));
}
return Calculation.Round2Digits( * );
}
return Calculation.Round2Digits( * damage);
}
public override void AlterExpectedDamageBeforeCalculation(Character character, Character enemy, ref double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType)
{
if (character == Skill.Character)
{
= (damage);
damage = Calculation.Round2Digits(damage + );
WriteLine($"[ {character} ] 发动了玻璃大炮,获得了 {这次的伤害加成} 点伤害加成!");
= 0;
}
if (enemy == Skill.Character)
{
HP = enemy.HP;
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} ] 的玻璃大炮触发,将额外受到 {这次受到的额外伤害} 点伤害!");
}
else = 0;
}
}
public override void AfterDamageCalculation(Character character, Character enemy, double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, DamageResult damageResult)
{
if (enemy == Skill.Character && damageResult != DamageResult.Evaded)
{
= Calculation.Round2Digits( + damage);
if (enemy.HP < 0 && HP - damage + > 0)
{
enemy.HP = 10;
WriteLine($"[ {enemy} ] 的玻璃大炮触发,保护了自己不进入死亡!!");
}
}
}
}
}

View File

@ -0,0 +1,67 @@
using Milimoe.FunGame.Core.Api.Utility;
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Constant;
namespace Milimoe.FunGame.Testing.Skills
{
public class : Skill
{
public override long Id => 3009;
public override string Name => "迅捷之势";
public override string Description => Effects.Count > 0 ? Effects.First().Description : "";
public override double EPCost => 100;
public override double CD => 60 - 2 * (Level - 1);
public override double HardnessTime => 15;
public (Character character) : base(SkillType.SuperSkill, character)
{
Effects.Add(new (this));
}
}
public class (Skill skill) : Effect(skill)
{
public override long Id => Skill.Id;
public override string Name => Skill.Name;
public override string Description => $"{Duration} 时间内普通攻击转为魔法伤害且硬直时间减少50%,并基于 {智力系数 * 100: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);
public override void OnEffectGained(Character character)
{
character.NormalAttack.SetMagicType(true, character.MagicType);
}
public override void OnEffectLost(Character character)
{
character.NormalAttack.SetMagicType(false, character.MagicType);
}
public override void AlterExpectedDamageBeforeCalculation(Character character, Character enemy, ref double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType)
{
if (character == Skill.Character && isNormalAttack)
{
damage = Calculation.Round2Digits(damage + );
}
}
public override void AlterHardnessTimeAfterNormalAttack(Character character, ref double baseHardnessTime, ref bool isCheckProtected)
{
baseHardnessTime = Calculation.Round2Digits(baseHardnessTime * 0.5);
}
public override void OnSkillCasted(Character caster, List<Character> enemys, List<Character> teammates, Dictionary<string, object> others)
{
RemainDuration = Duration;
if (!caster.Effects.Contains(this))
{
caster.Effects.Add(this);
OnEffectGained(caster);
}
}
}
}

View File

@ -0,0 +1,57 @@
using Milimoe.FunGame.Core.Api.Utility;
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Constant;
namespace Milimoe.FunGame.Testing.Skills
{
public class : Skill
{
public override long Id => 4008;
public override string Name => "枯竭打击";
public override string Description => Effects.Count > 0 ? Effects.First().Description : "";
public (Character character) : base(SkillType.Passive, character)
{
Effects.Add(new (this));
}
public override IEnumerable<Effect> AddInactiveEffectToCharacter()
{
return Effects;
}
}
public class (Skill skill) : Effect(skill)
{
public override long Id => Skill.Id;
public override string Name => Skill.Name;
public override string Description => $"每次造成伤害都会随机减少对方 [ 10~25 ] 点能量值,对能量值低于一半的角色额外造成 30% 伤害。对于枯竭打击而言能量值大于100且小于150时视为低于一半。";
public override bool TargetSelf => true;
private bool = false;
public override void AfterDamageCalculation(Character character, Character enemy, double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, DamageResult damageResult)
{
if (character == Skill.Character && damageResult != DamageResult.Evaded && !)
{
// 减少能量
double EP = new Random().Next(10, 25);
enemy.EP -= EP;
WriteLine($"[ {character} ] 发动了枯竭打击![ {enemy} ] 的能量值被减少了 {EP} 点!现有能量:{enemy.EP}。");
// 额外伤害
if (enemy.EP >= 0 && enemy.EP < 50 || enemy.EP >= 100 && enemy.EP < 150)
{
double = Calculation.Round2Digits(damage * 0.3);
WriteLine($"[ {character} ] 发动了枯竭打击!将造成额外伤害!");
= true;
DamageToEnemy(character, enemy, isMagicDamage, magicType, );
}
}
if (character == Skill.Character && )
{
= false;
}
}
}
}

View File

@ -0,0 +1,45 @@
using Milimoe.FunGame.Core.Api.Utility;
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Constant;
namespace Milimoe.FunGame.Testing.Skills
{
public class : Skill
{
public override long Id => 3008;
public override string Name => "能量毁灭";
public override string Description => Effects.Count > 0 ? Effects.First().Description : "";
public override double EPCost => 100;
public override double CD => 55 - 3 * (Level - 1);
public override double HardnessTime => 25;
public (Character character) : base(SkillType.SuperSkill, character)
{
Effects.Add(new (this));
}
}
public class (Skill skill) : Effect(skill)
{
public override long Id => Skill.Id;
public override string Name => Skill.Name;
public override string Description => $"对所有角色造成 " +
$"{能量系数 * 100:0.##}% 其现有能量值 + {智力系数 * 100:0.##}% 智力 [ {智力伤害} ] 的魔法伤害。";
public override bool TargetSelf => false;
public override double TargetRange => 999;
private double => Calculation.Round4Digits(0.55 * Level);
private double => Calculation.Round2Digits( * Skill.Character?.INT ?? 0);
private readonly double = Calculation.Round4Digits(4.5);
public override void OnSkillCasted(Character caster, List<Character> enemys, List<Character> teammates, Dictionary<string, object> others)
{
foreach (Character c in enemys)
{
WriteLine($"[ {caster} ] 正在毁灭 [ {c} ] 的能量!!");
double ep = c.EP;
DamageToEnemy(caster, c, true, MagicType, Calculation.Round2Digits(ep * + ));
}
}
}
}

View File

@ -0,0 +1,52 @@
using Milimoe.FunGame.Core.Api.Utility;
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Constant;
namespace Milimoe.FunGame.Testing.Skills
{
public class : Skill
{
public override long Id => 4012;
public override string Name => "弱者猎手";
public override string Description => Effects.Count > 0 ? Effects.First().Description : "";
public (Character character) : base(SkillType.Passive, character)
{
Effects.Add(new (this));
}
public override IEnumerable<Effect> AddInactiveEffectToCharacter()
{
return Effects;
}
}
public class (Skill skill) : Effect(skill)
{
public override long Id => Skill.Id;
public override string Name => Skill.Name;
public override string Description => $"优先攻击血量更低的角色,对生命值百分比低于自己的角色造成 150% 伤害。";
public override bool TargetSelf => true;
public override void AlterExpectedDamageBeforeCalculation(Character character, Character enemy, ref double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType)
{
if (character == Skill.Character && (enemy.HP / enemy.MaxHP) <= (character.HP / character.MaxHP))
{
double = Calculation.Round2Digits(damage * 0.5);
damage = Calculation.Round2Digits(damage + );
}
}
public override bool AlterEnemyListBeforeAction(Character character, List<Character> enemys, List<Character> teammates, List<Skill> skills, Dictionary<Character, int> continuousKilling, Dictionary<Character, int> earnedMoney)
{
IEnumerable<Character> list = [.. enemys.OrderBy(e => Calculation.Round4Digits(e.HP / e.MaxHP))];
if (list.Any())
{
enemys.Clear();
enemys.Add(list.First());
WriteLine($"[ {character} ] 发动了弱者猎手![ {list.First()} ] 被盯上了!");
}
return true;
}
}
}

View File

@ -0,0 +1,52 @@
using Milimoe.FunGame.Core.Api.Utility;
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Constant;
using Milimoe.FunGame.Testing.Effects;
namespace Milimoe.FunGame.Testing.Skills
{
public class : Skill
{
public override long Id => 4012;
public override string Name => "血之狂欢";
public override string Description => Effects.Count > 0 ? Effects.First().Description : "";
public override double EPCost => 100;
public override double CD => 45;
public override double HardnessTime => 7;
public (Character character) : base(SkillType.SuperSkill, character)
{
Effects.Add(new (this));
}
}
public class (Skill skill) : Effect(skill)
{
public override long Id => Skill.Id;
public override string Name => Skill.Name;
public override string Description => $"获得 40% 吸血,持续 {Duration} 时间。";
public override bool TargetSelf => true;
public override bool Durative => true;
public override double Duration => 30;
public override void AfterDamageCalculation(Character character, Character enemy, double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, DamageResult damageResult)
{
if (character == Skill.Character && damageResult != DamageResult.Evaded && character.HP < character.MaxHP)
{
double = Calculation.Round2Digits(0.4 * damage);
character.HP += ;
WriteLine($"[ {character} ] 回复了 {实际吸血} 点生命值!");
}
}
public override void OnSkillCasted(Character caster, List<Character> enemys, List<Character> teammates, Dictionary<string, object> others)
{
RemainDuration = Duration;
if (!caster.Effects.Contains(this))
{
caster.Effects.Add(this);
OnEffectGained(caster);
}
}
}
}

View File

@ -0,0 +1,90 @@
using Milimoe.FunGame.Core.Api.Utility;
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Constant;
namespace Milimoe.FunGame.Testing.Skills
{
public class : Skill
{
public override long Id => 3001;
public override string Name => "天赐之力";
public override string Description => Effects.Count > 0 ? Effects.First().Description : "";
public override double EPCost => 100;
public override double CD => 60;
public override double HardnessTime => 15;
public (Character character) : base(SkillType.SuperSkill, character)
{
Effects.Add(new (this));
}
}
public class (Skill skill) : Effect(skill)
{
public override long Id => Skill.Id;
public override string Name => Skill.Name;
public override string Description => $"{Duration} 时间内,增加 40% 攻击力 [ {攻击力提升} ]、30% 物理穿透和 25% 闪避率(不可叠加),普通攻击硬直时间额外减少 20%,基于 {系数 * 100:0.##}% 敏捷 [ {伤害加成} ] 强化普通攻击的伤害。在持续时间内,【心灵之火】的冷却时间降低至 3 时间。";
public override bool TargetSelf => false;
public override int TargetCount => 1;
public override bool Durative => true;
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 = 0;
public override void OnEffectGained(Character character)
{
= ;
character.ExATK2 += ;
character.PhysicalPenetration += 0.3;
character.ExEvadeRate += 0.25;
if (character.Effects.Where(e => e is ).FirstOrDefault() is e)
{
e. = 3;
if (e. > e.) e. = e.;
}
}
public override void OnEffectLost(Character character)
{
character.ExATK2 -= ;
character.PhysicalPenetration -= 0.3;
character.ExEvadeRate -= 0.25;
if (character.Effects.Where(e => e is ).FirstOrDefault() is e)
{
e. = 8;
}
}
public override CharacterActionType AlterActionTypeBeforeAction(Character character, CharacterState state, ref bool canUseItem, ref bool canCastSkill, ref double pUseItem, ref double pCastSkill, ref double pNormalAttack)
{
pNormalAttack += 0.1;
return CharacterActionType.None;
}
public override void AlterExpectedDamageBeforeCalculation(Character character, Character enemy, ref double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType)
{
if (character == Skill.Character && isNormalAttack)
{
damage = Calculation.Round2Digits(damage + );
}
}
public override void AlterHardnessTimeAfterNormalAttack(Character character, ref double baseHardnessTime, ref bool isCheckProtected)
{
baseHardnessTime = Calculation.Round2Digits(baseHardnessTime * 0.8);
}
public override void OnSkillCasted(Character caster, List<Character> enemys, List<Character> teammates, Dictionary<string, object> others)
{
RemainDuration = Duration;
if (!caster.Effects.Contains(this))
{
caster.Effects.Add(this);
OnEffectGained(caster);
}
}
}
}

View File

@ -0,0 +1,69 @@
using Milimoe.FunGame.Core.Api.Utility;
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Constant;
namespace Milimoe.FunGame.Testing.Skills
{
public class : Skill
{
public override long Id => 4002;
public override string Name => "心灵之火";
public override string Description => Effects.Count > 0 ? Effects.First().Description : "";
public (Character character) : base(SkillType.Passive, character)
{
Effects.Add(new (this));
}
public override IEnumerable<Effect> AddInactiveEffectToCharacter()
{
return Effects;
}
}
public class (Skill skill) : Effect(skill)
{
public override long Id => Skill.Id;
public override string Name => Skill.Name;
public override string Description => $"普通攻击硬直时间减少 20%。每次使用普通攻击时,额外再发动一次普通攻击,伤害特效可叠加,冷却 {基础冷却时间:0.##} 时间。" +
( > 0 ? $"(正在冷却:剩余 {冷却时间:0.##} 时间)" : "");
public override bool TargetSelf => true;
public double { get; set; } = 0;
public double { get; set; } = 20;
private bool = false;
public override void AfterDamageCalculation(Character character, Character enemy, double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, DamageResult damageResult)
{
if (character == Skill.Character && isNormalAttack && == 0 && ! && ActionQueue != null)
{
WriteLine($"[ {character} ] 发动了心灵之火!额外进行一次普通攻击!");
= ;
= true;
character.NormalAttack.Attack(ActionQueue, character, enemy);
}
if (character == Skill.Character && )
{
= false;
}
}
public override void OnTimeElapsed(Character character, double elapsed)
{
if ( > 0)
{
= Calculation.Round2Digits( - elapsed);
if ( <= 0)
{
= 0;
}
}
}
public override void AlterHardnessTimeAfterNormalAttack(Character character, ref double baseHardnessTime, ref bool isCheckProtected)
{
baseHardnessTime = Calculation.Round2Digits(baseHardnessTime * 0.8);
}
}
}

View File

@ -0,0 +1,65 @@
using Milimoe.FunGame.Core.Api.Utility;
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Constant;
namespace Milimoe.FunGame.Testing.Skills
{
public class : Skill
{
public override long Id => 3003;
public override string Name => "魔法涌流";
public override string Description => Effects.Count > 0 ? Effects.First().Description : "";
public override double EPCost => 100;
public override double CD => 35;
public override double HardnessTime => 10;
public (Character character) : base(SkillType.SuperSkill, character)
{
Effects.Add(new (this));
}
}
public class (Skill skill) : Effect(skill)
{
public override long Id => Skill.Id;
public override string Name => "魔法涌流";
public override string Description => $"{Duration} 时间内,增加所有伤害的 {减伤比例 * 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;
public override void OnEffectGained(Character character)
{
= ;
character.NormalAttack.SetMagicType(true, character.MagicType);
}
public override void OnEffectLost(Character character)
{
character.NormalAttack.SetMagicType(false, character.MagicType);
}
public override bool AlterActualDamageAfterCalculation(Character character, Character enemy, ref double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, DamageResult damageResult)
{
if (enemy == Skill.Character)
{
damage = Calculation.Round2Digits(damage * (1 - ));
}
return false;
}
public override void OnSkillCasted(Character caster, List<Character> enemys, List<Character> teammates, Dictionary<string, object> others)
{
RemainDuration = Duration;
if (!caster.Effects.Contains(this))
{
= 0;
caster.Effects.Add(this);
OnEffectGained(caster);
}
}
}
}

View File

@ -0,0 +1,50 @@
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Constant;
using Milimoe.FunGame.Testing.Effects;
namespace Milimoe.FunGame.Testing.Skills
{
public class : Skill
{
public override long Id => 4003;
public override string Name => "魔法震荡";
public override string Description => Effects.Count > 0 ? Effects.First().Description : "";
public (Character character) : base(SkillType.Passive, character)
{
Effects.Add(new (this));
}
public override IEnumerable<Effect> AddInactiveEffectToCharacter()
{
return Effects;
}
}
public class (Skill skill) : Effect(skill)
{
public override long Id => Skill.Id;
public override string Name => Skill.Name;
public override string Description => $"造成魔法伤害时有 35% 几率使敌人眩晕 1 回合。";
public override bool TargetSelf => true;
public override void AfterDamageCalculation(Character character, Character enemy, double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, DamageResult damageResult)
{
if (character == Skill.Character && isMagicDamage && damageResult != DamageResult.Evaded && new Random().NextDouble() < 0.35)
{
IEnumerable<Effect> effects = enemy.Effects.Where(e => e is && e.Skill == Skill);
if (effects.Any())
{
effects.First().RemainDurationTurn++;
}
else
{
e = new(Skill, character, false, 0, 1);
enemy.Effects.Add(e);
e.OnEffectGained(enemy);
}
WriteLine($"[ {character} ] 的魔法伤害触发了魔法震荡,[ {enemy} ] 被眩晕了!");
}
}
}
}

View File

@ -0,0 +1,85 @@
using Milimoe.FunGame.Core.Api.Utility;
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Constant;
namespace Milimoe.FunGame.Testing.Skills
{
public class : Skill
{
public override long Id => 2001;
public override string Name => "疾风步";
public override string Description => Effects.Count > 0 ? Effects.First().Description : "";
public override double EPCost => 35;
public override double CD => 35;
public override double HardnessTime => 5;
public (Character character) : base(SkillType.Skill, character)
{
Effects.Add(new (this));
}
}
public class (Skill skill) : Effect(skill)
{
public override long Id => Skill.Id;
public override string Name => Skill.Name;
public override string Description => $"进入不可选中状态,获得 100 行动速度,提高 8% 暴击率,持续 {Duration} 时间。破隐一击:在持续时间内,首次造成伤害会附加 {系数 * 100:0.##}% 敏捷 [ {伤害加成} ] 的强化伤害,并解除不可选中状态。";
public override bool TargetSelf => true;
public override bool Durative => true;
public override double Duration => 12 + (1 * (Level - 1));
private double => Calculation.Round4Digits(0.5 + 0.5 * (Skill.Level - 1));
private double => Calculation.Round2Digits( * Skill.Character?.AGI ?? 0);
private bool { get; set; } = true;
private bool { get; set; } = false;
public override void OnEffectGained(Character character)
{
Skill.IsInEffect = true;
character.CharacterEffectControlTypes.Add(this, [EffectControlType.Unselectable]);
character.UpdateCharacterState();
character.ExSPD += 100;
character.ExCritRate += 0.08;
}
public override void OnEffectLost(Character character)
{
Skill.IsInEffect = false;
if (!)
{
// 在没有打出破隐一击的情况下,恢复角色状态
character.CharacterEffectControlTypes.Remove(this);
character.UpdateCharacterState();
}
character.ExSPD -= 100;
character.ExCritRate -= 0.08;
}
public override bool AlterActualDamageAfterCalculation(Character character, Character enemy, ref double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, DamageResult damageResult)
{
if (character == Skill.Character && )
{
= false;
= true;
character.CharacterEffectControlTypes.Remove(this);
character.UpdateCharacterState();
double d = ;
damage = Calculation.Round2Digits(damage + d);
WriteLine($"[ {character} ] 触发了疾风步破隐一击,获得了 [ {d} ] 点伤害加成!");
}
return false;
}
public override void OnSkillCasted(Character caster, List<Character> enemys, List<Character> teammates, Dictionary<string, object> others)
{
if (!caster.Effects.Contains(this))
{
= true;
= false;
RemainDuration = Duration;
caster.Effects.Add(this);
OnEffectGained(caster);
}
}
}
}

View File

@ -0,0 +1,70 @@
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Constant;
namespace Milimoe.FunGame.Testing.Skills
{
public class : Skill
{
public override long Id => 4011;
public override string Name => "平衡强化";
public override string Description => Effects.Count > 0 ? Effects.First().Description : "";
public override double EPCost => 100;
public override double CD => 55 - (1 * (Level - 1));
public override double HardnessTime => 12;
public (Character character) : base(SkillType.SuperSkill, character)
{
Effects.Add(new (this));
}
}
public class (Skill skill) : Effect(skill)
{
public override long Id => Skill.Id;
public override string Name => Skill.Name;
public override string Description => $"敏捷提高 20%,然后将目前的力量补充到与敏捷持平,持续 {Duration} 时间。";
public override bool TargetSelf => true;
public override bool Durative => true;
public override double Duration => 30;
private double = 0;
private double = 0;
public override void OnEffectGained(Character character)
{
double pastHP = character.HP;
double pastMaxHP = character.MaxHP;
double pastMP = character.MP;
double pastMaxMP = character.MaxMP;
= character.BaseAGI * 0.2;
character.ExAGI += ;
= character.AGI - character.STR;
character.ExSTR += ;
character.Recovery(pastHP, pastMP, pastMaxHP, pastMaxMP);
WriteLine($"[ {character} ] 敏捷提升了 {本次提升的敏捷:0.##},力量提升了 {本次提升的力量:0.##}");
}
public override void OnEffectLost(Character character)
{
double pastHP = character.HP;
double pastMaxHP = character.MaxHP;
double pastMP = character.MP;
double pastMaxMP = character.MaxMP;
character.ExAGI -= character.BaseAGI * 0.2;
character.ExSTR -= ;
character.Recovery(pastHP, pastMP, pastMaxHP, pastMaxMP);
}
public override void OnSkillCasted(Character caster, List<Character> enemys, List<Character> teammates, Dictionary<string, object> others)
{
RemainDuration = Duration;
if (!caster.Effects.Contains(this))
{
= 0;
= 0;
caster.Effects.Add(this);
OnEffectGained(caster);
}
}
}
}

View File

@ -0,0 +1,50 @@
using Milimoe.FunGame.Core.Api.Utility;
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Constant;
namespace Milimoe.FunGame.Testing.Skills
{
public class : Skill
{
public override long Id => 4011;
public override string Name => "敏捷之刃";
public override string Description => Effects.Count > 0 ? Effects.First().Description : "";
public (Character character) : base(SkillType.Passive, character)
{
Effects.Add(new (this));
}
public override IEnumerable<Effect> AddInactiveEffectToCharacter()
{
return Effects;
}
}
public class (Skill skill) : Effect(skill)
{
public override long Id => Skill.Id;
public override string Name => Skill.Name;
public override string Description => $"每次普通攻击都将附带基于 {敏捷系数 * 100:0.##}% 敏捷 [ {敏捷伤害} ] 的魔法伤害。";
public override bool TargetSelf => true;
private double => Calculation.Round2Digits( * Skill.Character?.AGI ?? 0);
private readonly double = 2.5;
private bool = false;
public override void AfterDamageCalculation(Character character, Character enemy, double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, DamageResult damageResult)
{
if (character == Skill.Character && isNormalAttack && damageResult != DamageResult.Evaded && !)
{
WriteLine($"[ {character} ] 发动了敏捷之刃!将造成额外伤害!");
= true;
DamageToEnemy(character, enemy, true, magicType, );
}
if (character == Skill.Character && )
{
= false;
}
}
}
}

View File

@ -0,0 +1,59 @@
using Milimoe.FunGame.Core.Api.Utility;
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Constant;
namespace Milimoe.FunGame.Testing.Skills
{
public class : Skill
{
public override long Id => 4007;
public override string Name => "毁灭之势";
public override string Description => Effects.Count > 0 ? Effects.First().Description : "";
public (Character character) : base(SkillType.Passive, character)
{
Effects.Add(new (this));
}
public override IEnumerable<Effect> AddInactiveEffectToCharacter()
{
return Effects;
}
}
public class (Skill skill) : Effect(skill)
{
public override long Id => Skill.Id;
public override string Name => Skill.Name;
public override string Description => $"每时间提升 5.5% 所有伤害,无上限,但受到伤害时效果清零。" + ( > 0 ? $"(当前总提升:{累计伤害 * 100:0.##}%" : "");
public override bool TargetSelf => true;
private readonly double = 0.055;
private double = 0;
public override bool AlterActualDamageAfterCalculation(Character character, Character enemy, ref double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, DamageResult damageResult)
{
if (damageResult != DamageResult.Evaded)
{
if (enemy == Skill.Character && damage > 0 && !enemy.Effects.Where(e => e is ).Any())
{
= 0;
}
if (character == Skill.Character)
{
double = Calculation.Round2Digits(damage * );
damage = Calculation.Round2Digits(damage + );
if ( > 0) WriteLine($"[ {character} ] 的伤害提升了 {实际伤害提升} 点!");
}
}
return false;
}
public override void OnTimeElapsed(Character character, double eapsed)
{
= Calculation.Round4Digits( + * eapsed);
WriteLine($"[ {character} ] 的 [ {Name} ] 效果增加了,当前总提升:{累计伤害 * 100:0.##}%。");
}
}
}

View File

@ -0,0 +1,74 @@
using Milimoe.FunGame.Core.Api.Utility;
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Constant;
namespace Milimoe.FunGame.Testing.Skills
{
public class : Skill
{
public override long Id => 3007;
public override string Name => "绝对领域";
public override string Description => Effects.Count > 0 ? Effects.First().Description : "";
public override double EPCost => Math.Max(100, Character?.EP ?? 100);
public override double CD => 32 + (1 * (Level - 1));
public override double HardnessTime => 12;
public (Character character) : base(SkillType.SuperSkill, character)
{
Effects.Add(new (this));
}
}
public class (Skill skill) : Effect(skill)
{
public override long Id => Skill.Id;
public override string Name => Skill.Name;
public override string Description => $"{Duration} 时间内无法受到任何伤害,且敏捷提升 {系数 * 100:0.##}% [ {敏捷提升} ]。此技能会消耗至少 100 点能量。";
public override bool TargetSelf => true;
public override bool Durative => true;
public override double Duration => Calculation.Round2Digits(16 + * 0.03);
private double => Calculation.Round4Digits(0.3 + 0.03 * (Level - 1));
private double => Calculation.Round2Digits( * Skill.Character?.BaseAGI ?? 0);
private double = 0;
private double = 0;
public override void OnEffectGained(Character character)
{
= ;
character.ExAGI += ;
WriteLine($"[ {character} ] 的敏捷提升了 {系数 * 100:0.##}% [ {实际敏捷提升} ] ");
}
public override void OnEffectLost(Character character)
{
character.ExAGI -= ;
}
public override bool AlterActualDamageAfterCalculation(Character character, Character enemy, ref double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, DamageResult damageResult)
{
if (enemy == Skill.Character && damageResult != DamageResult.Evaded)
{
WriteLine($"[ {enemy} ] 发动了绝对领域,巧妙的化解了此伤害!");
return true;
}
return false;
}
public override void OnSkillCasting(Character caster)
{
= caster.EP;
}
public override void OnSkillCasted(Character caster, List<Character> enemys, List<Character> teammates, Dictionary<string, object> others)
{
RemainDuration = Duration;
if (!caster.Effects.Contains(this))
{
= 0;
caster.Effects.Add(this);
OnEffectGained(caster);
}
}
}
}

View File

@ -0,0 +1,54 @@
using Milimoe.FunGame.Core.Api.Utility;
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Constant;
namespace Milimoe.FunGame.Testing.Skills
{
public class : Skill
{
public override long Id => 2001;
public override string Name => "冰霜攻击";
public override string Description => Effects.Count > 0 ? Effects.First().Description : "";
public override double MPCost => BaseMPCost + (50 * (Level - 1));
public override double CD => 20;
public override double CastTime => 6;
public override double HardnessTime => 3;
protected override double BaseMPCost => 30;
public (Character character) : base(SkillType.Magic, character)
{
Effects.Add(new (this));
}
}
public class (Skill skill) : Effect(skill)
{
public override long Id => Skill.Id;
public override string Name => Skill.Name;
public override string Description => $"对目标敌人造成 {Calculation.Round2Digits(90 + 60 * (Skill.Level - 1))} + {Calculation.Round2Digits((1.2 + 1.8 * (Skill.Level - 1)) * 100)}% 智力 [ {Damage} ] 点{CharacterSet.GetMagicName(MagicType)}。";
public override bool TargetSelf => false;
public override int TargetCount => 1;
private double Damage
{
get
{
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);
}
return d;
}
}
public override void OnSkillCasted(Character caster, List<Character> enemys, List<Character> teammates, Dictionary<string, object> others)
{
if (enemys.Count > 0)
{
Character enemy = enemys[new Random().Next(enemys.Count)];
DamageToEnemy(caster, enemy, true, MagicType, Damage);
}
}
}
}

View File

@ -7,7 +7,7 @@ namespace FunGame.Testing.Solutions
{ {
public class MyPlugin : Plugin, ILoginEvent, IConnectEvent, IIntoRoomEvent public class MyPlugin : Plugin, ILoginEvent, IConnectEvent, IIntoRoomEvent
{ {
public override string Name => "测试插件"; public override string Name => "milimoe.fungame.testplugin";
public override string Description => "My First Plugin"; public override string Description => "My First Plugin";

View File

@ -19,7 +19,12 @@ namespace ConverterExample
public class AddressConverter : BaseEntityConverter<Address> public class AddressConverter : BaseEntityConverter<Address>
{ {
public override void ReadPropertyName(ref Utf8JsonReader reader, string propertyName, JsonSerializerOptions options, ref Address? result) public override Address NewInstance()
{
return new();
}
public override void ReadPropertyName(ref Utf8JsonReader reader, string propertyName, JsonSerializerOptions options, ref Address result)
{ {
result ??= new(); result ??= new();
switch (propertyName) switch (propertyName)
@ -47,7 +52,12 @@ namespace ConverterExample
public class PersonConverter : BaseEntityConverter<Person> public class PersonConverter : BaseEntityConverter<Person>
{ {
public override void ReadPropertyName(ref Utf8JsonReader reader, string propertyName, JsonSerializerOptions options, ref Person? result) public override Person NewInstance()
{
return new();
}
public override void ReadPropertyName(ref Utf8JsonReader reader, string propertyName, JsonSerializerOptions options, ref Person result)
{ {
result ??= new(); result ??= new();
switch (propertyName) switch (propertyName)

View File

@ -0,0 +1,79 @@
using Milimoe.FunGame.Core.Api.Utility;
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Common.Addon;
namespace Addons
{
public class ExampleGameModuleConstant
{
public const string Example = "fungame.example.gamemode";
public const string ExampleCharacter = "fungame.example.character";
public const string ExampleSkill = "fungame.example.skill";
public const string ExampleItem = "fungame.example.item";
}
public class ExampleCharacterModule : CharacterModule
{
public override string Name => ExampleGameModuleConstant.ExampleCharacter;
public override string Description => "My First CharacterModule";
public override string Version => "1.0.0";
public override string Author => "FunGamer";
public override List<Character> Characters
{
get
{
EntityModuleConfig<Character> config = new(ExampleGameModuleConstant.Example, ExampleGameModuleConstant.ExampleCharacter);
config.LoadConfig();
return [.. config.Values];
}
}
}
public class ExampleSkillModule : SkillModule
{
public override string Name => ExampleGameModuleConstant.ExampleSkill;
public override string Description => "My First SkillModule";
public override string Version => "1.0.0";
public override string Author => "FunGamer";
public override List<Skill> Skills
{
get
{
List<Skill> list = [];
return list;
}
}
}
public class ExampleItemModule : ItemModule
{
public override string Name => ExampleGameModuleConstant.ExampleItem;
public override string Description => "My First ItemModule";
public override string Version => "1.0.0";
public override string Author => "FunGamer";
public override List<Item> Items
{
get
{
List<Item> list = [];
Item i = Factory.GetItem();
i.Name = "Example Item";
i.Price = 20;
list.Add(i);
return list;
}
}
}
}

View File

@ -0,0 +1,70 @@
using FunGame.Testing.Characters;
using Milimoe.FunGame.Core.Api.Utility;
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Interface;
using Milimoe.FunGame.Core.Library.Common.Addon;
using Milimoe.FunGame.Core.Library.Common.Event;
namespace Addons
{
public class TestPlugin : Plugin, ILoginEvent
{
public override string Name => "fungame.example.plugin";
public override string Description => "My First Plugin";
public override string Version => "1.0.0";
public override string Author => "FunGamer";
protected override bool BeforeLoad()
{
EntityModuleConfig<Character> config = new(ExampleGameModuleConstant.Example, ExampleGameModuleConstant.ExampleCharacter)
{
{ "Oshima", Characters.Oshima },
{ "Xinyin", Characters.Xinyin },
{ "Yang", Characters.Yang },
{ "NanGanyu", Characters.NanGanyu },
{ "NiuNan", Characters.NiuNan },
{ "Mayor", Characters.Mayor },
{ "马猴烧酒", Characters. },
{ "QingXiang", Characters.QingXiang },
{ "QWQAQW", Characters.QWQAQW },
{ "ColdBlue", Characters.ColdBlue },
{ "绿拱门", Characters.绿 },
{ "QuDuoduo", Characters.QuDuoduo }
};
config.SaveConfig();
PluginConfig config2 = new(Name, "config")
{
{ "flush", 10000 },
{ "oshima", "呵呵了" }
};
config2.SaveConfig();
return true;
}
public void AfterLoginEvent(object sender, LoginEventArgs e)
{
Console.WriteLine("after");
}
public void BeforeLoginEvent(object sender, LoginEventArgs e)
{
Console.WriteLine("before");
// 如果这里设置Cancel = true将终止登录
e.Cancel = true;
}
public void FailedLoginEvent(object sender, LoginEventArgs e)
{
Console.WriteLine("failed");
}
public void SucceedLoginEvent(object sender, LoginEventArgs e)
{
Console.WriteLine("succeed");
}
}
}

66
Library/Tests/CheckDLL.cs Normal file
View File

@ -0,0 +1,66 @@
using Milimoe.FunGame.Core.Api.Utility;
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Common.Addon;
using Milimoe.FunGame.Core.Library.Common.Event;
using Milimoe.FunGame.Core.Library.Constant;
namespace Milimoe.FunGame.Testing.Tests
{
internal class CheckDLL
{
internal CheckDLL()
{
PluginLoader plugins = PluginLoader.LoadPlugins([]);
foreach (string plugin in plugins.Plugins.Keys)
{
Console.WriteLine(plugin + " is loaded.");
}
Dictionary<string, string> plugindllsha512 = [];
foreach (string pfp in PluginLoader.PluginFilePaths.Keys)
{
string text = Encryption.FileSha512(PluginLoader.PluginFilePaths[pfp]);
plugindllsha512.Add(pfp, text);
Console.WriteLine(pfp + $" is {text}.");
}
LoginEventArgs e = new();
plugins.OnBeforeLoginEvent(plugins, e);
if (!e.Cancel)
{
plugins.OnSucceedLoginEvent(plugins, e);
plugins.OnFailedLoginEvent(plugins, e);
}
plugins.OnAfterLoginEvent(plugins, e);
List<Character> list = [];
GameModuleLoader modules = GameModuleLoader.LoadGameModules(FunGameInfo.FunGame.FunGame_Desktop, []);
foreach (CharacterModule cm in modules.Characters.Values)
{
foreach (Character c in cm.Characters)
{
Console.WriteLine(c.Name);
list.Add(c);
}
}
Dictionary<string, string> moduledllsha512 = [];
foreach (string mfp in GameModuleLoader.ModuleFilePaths.Keys)
{
string text = Encryption.FileSha512(GameModuleLoader.ModuleFilePaths[mfp]);
moduledllsha512.Add(mfp, text);
Console.WriteLine(mfp + $" is {text}.");
}
foreach (string moduledll in moduledllsha512.Keys)
{
string server = moduledllsha512[moduledll];
if (plugindllsha512.TryGetValue(moduledll, out string? client) && client != "" && server == client)
{
Console.WriteLine(moduledll + $" is checked pass.");
}
}
}
}
}

436
Library/Tests/FunGame.cs Normal file
View File

@ -0,0 +1,436 @@
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.Testing.Skills;
namespace Milimoe.FunGame.Testing.Tests
{
public class FunGameSimulation
{
public static bool IsRuning { get; set; } = false;
public static bool PrintOut { get; set; } = false;
public static string Msg { get; set; } = "";
public static List<string> StartGame(bool printout)
{
PrintOut = printout;
try
{
if (IsRuning) return ["游戏正在模拟中,请勿重复请求!"];
List<string> result = [];
int deaths = 0;
Msg = "";
IsRuning = true;
PluginLoader plugins = PluginLoader.LoadPlugins([]);
foreach (string plugin in plugins.Plugins.Keys)
{
Console.WriteLine(plugin + " is loaded.");
}
Dictionary<string, string> plugindllsha512 = [];
foreach (string pfp in PluginLoader.PluginFilePaths.Keys)
{
string text = Encryption.FileSha512(PluginLoader.PluginFilePaths[pfp]);
plugindllsha512.Add(pfp, text);
if (PrintOut) Console.WriteLine(pfp + $" is {text}.");
}
List<Character> list = [];
GameModuleLoader modules = GameModuleLoader.LoadGameModules(FunGameInfo.FunGame.FunGame_Desktop, []);
foreach (CharacterModule cm in modules.Characters.Values)
{
foreach (Character c in cm.Characters)
{
if (PrintOut) Console.WriteLine(c.Name);
list.Add(c);
}
}
Dictionary<string, string> moduledllsha512 = [];
foreach (string mfp in GameModuleLoader.ModuleFilePaths.Keys)
{
string text = Encryption.FileSha512(GameModuleLoader.ModuleFilePaths[mfp]);
moduledllsha512.Add(mfp, text);
if (PrintOut) Console.WriteLine(mfp + $" is {text}.");
}
foreach (string moduledll in moduledllsha512.Keys)
{
string server = moduledllsha512[moduledll];
if (plugindllsha512.TryGetValue(moduledll, out string? client) && client != "" && server == client)
{
Console.WriteLine(moduledll + $" is checked pass.");
}
}
// M = 0, W = 7, P1 = 1, P3 = 1
// M = 1, W = 6, P1 = 2, P3 = 0
// M = 2, W = 4, P1 = 0, P3 = 2
// M = 2, W = 5, P1 = 0, P3 = 0
// M = 3, W = 3, P1 = 1, P3 = 1
// M = 4, W = 2, P1 = 2, P3 = 0
// M = 5, W = 0, P1 = 0, P3 = 2
// M = 5, W = 1, P1 = 0, P3 = 0
if (list.Count > 3)
{
if (PrintOut) Console.WriteLine();
if (PrintOut) Console.WriteLine("Start!!!");
if (PrintOut) Console.WriteLine();
Character character1 = list[0].Copy();
Character character2 = list[1].Copy();
Character character3 = list[2].Copy();
Character character4 = list[3].Copy();
Character character5 = list[4].Copy();
Character character6 = list[5].Copy();
Character character7 = list[6].Copy();
Character character8 = list[7].Copy();
Character character9 = list[8].Copy();
Character character10 = list[9].Copy();
Character character11 = list[10].Copy();
Character character12 = list[11].Copy();
List<Character> characters = [
character1, character2, character3, character4,
character5, character6, character7, character8,
character9, character10, character11, character12
];
int clevel = 60;
int slevel = 6;
int mlevel = 8;
// 升级和赋能
for (int index = 0; index < characters.Count; index++)
{
Character c = characters[index];
c.Level = clevel;
c.NormalAttack.Level = mlevel;
Skill = new (c)
{
Level = mlevel
};
c.Skills.Add();
Skill = new (c)
{
Level = slevel
};
c.Skills.Add();
if (c == character1)
{
Skill META马 = new META马(c)
{
Level = 1
};
c.Skills.Add(META马);
Skill = new (c)
{
Level = mlevel
};
c.Skills.Add();
}
if (c == character2)
{
Skill = new (c)
{
Level = 1
};
c.Skills.Add();
Skill = new (c)
{
Level = slevel
};
c.Skills.Add();
}
if (c == character3)
{
Skill = new (c)
{
Level = 1
};
c.Skills.Add();
Skill = new (c)
{
Level = slevel
};
c.Skills.Add();
}
if (c == character4)
{
Skill = new (c)
{
Level = 1
};
c.Skills.Add();
Skill = new (c)
{
Level = slevel
};
c.Skills.Add();
}
if (c == character5)
{
Skill = new (c)
{
Level = 1
};
c.Skills.Add();
Skill = new (c)
{
Level = slevel
};
c.Skills.Add();
}
if (c == character6)
{
Skill = new (c)
{
Level = 1
};
c.Skills.Add();
Skill = new (c)
{
Level = slevel
};
c.Skills.Add();
}
if (c == character7)
{
Skill = new (c)
{
Level = 1
};
c.Skills.Add();
Skill = new (c)
{
Level = slevel
};
c.Skills.Add();
}
if (c == character8)
{
Skill = new (c)
{
Level = 1
};
c.Skills.Add();
Skill = new (c)
{
Level = slevel
};
c.Skills.Add();
}
if (c == character9)
{
Skill = new (c)
{
Level = 1
};
c.Skills.Add();
Skill = new (c)
{
Level = slevel
};
c.Skills.Add();
}
if (c == character10)
{
Skill = new (c)
{
Level = 1
};
c.Skills.Add();
Skill = new (c)
{
Level = slevel
};
c.Skills.Add();
}
if (c == character11)
{
Skill = new (c)
{
Level = 1
};
c.Skills.Add();
Skill = new (c)
{
Level = slevel
};
c.Skills.Add();
}
if (c == character12)
{
Skill = new (c)
{
Level = 1
};
c.Skills.Add();
Skill = new (c)
{
Level = slevel
};
c.Skills.Add();
}
}
// 显示角色信息
if (PrintOut) characters.ForEach(c => Console.WriteLine(c.GetInfo()));
// 创建顺序表并排序
ActionQueue actionQueue = new(characters, WriteLine);
if (PrintOut) Console.WriteLine();
// 显示初始顺序表
actionQueue.DisplayQueue();
if (PrintOut) Console.WriteLine();
// 总游戏时长
double totalTime = 0;
// 总回合数
int i = 1;
while (i < 999)
{
Msg = "";
if (i == 998)
{
WriteLine($"=== 终局审判 ===");
Dictionary<Character, double> = [];
foreach (Character c in characters)
{
.TryAdd(c, Calculation.Round4Digits(c.HP / c.MaxHP));
}
double max = .Values.Max();
Character winner = .Keys.Where(c => [c] == max).First();
WriteLine("[ " + winner + " ] 成为了天选之人!!");
foreach (Character c in characters.Where(c => c != winner && c.HP > 0))
{
WriteLine("[ " + winner + " ] 对 [ " + c + " ] 造成了 99999999999 点真实伤害。");
actionQueue.DeathCalculation(winner, c);
}
actionQueue.EndGameInfo(winner);
result.Add(Msg);
break;
}
// 检查是否有角色可以行动
Character? characterToAct = actionQueue.NextCharacter();
// 处理回合
if (characterToAct != null)
{
WriteLine($"=== Round {i++} ===");
WriteLine("现在是 [ " + characterToAct + " ] 的回合!");
bool isGameEnd = actionQueue.ProcessTurn(characterToAct);
if (isGameEnd)
{
result.Add(Msg);
break;
}
actionQueue.DisplayQueue();
WriteLine("");
}
// 模拟时间流逝
totalTime += actionQueue.TimeLapse();
if (actionQueue.Eliminated.Count > deaths)
{
deaths = actionQueue.Eliminated.Count;
string roundMsg = Msg;
string[] strs = roundMsg.Split("==== 角色状态 ====");
if (strs.Length > 0)
{
roundMsg = strs[0];
}
result.Add(roundMsg);
}
}
if (PrintOut)
{
Console.WriteLine("--- End ---");
Console.WriteLine("总游戏时长:" + Calculation.Round2Digits(totalTime));
Console.WriteLine("");
}
// 赛后统计
WriteLine("==== 伤害排行榜 TOP6 ====");
Msg = "==== 伤害排行榜 TOP6 ====\r\n";
// 显示前四的角色统计
int count = 1;
foreach (Character character in actionQueue.CharacterStatistics.OrderByDescending(d => d.Value.TotalDamage).Select(d => d.Key))
{
StringBuilder builder = new();
CharacterStatistics stats = actionQueue.CharacterStatistics[character];
builder.AppendLine($"{count}. [ {character.ToStringWithLevel()} ]");
builder.AppendLine($"存活时长:{stats.LiveTime} / 存活回合数:{stats.LiveRound} / 行动回合数:{stats.ActionTurn}");
builder.AppendLine($"总计伤害:{stats.TotalDamage} / 每秒伤害:{stats.DamagePerSecond} / 每回合伤害:{stats.DamagePerTurn}");
builder.Append($"总计物理伤害:{stats.TotalPhysicalDamage} / 总计魔法伤害:{stats.TotalMagicDamage}");
if (count++ <= 6)
{
WriteLine(builder.ToString());
}
else
{
if (PrintOut) Console.WriteLine(builder.ToString());
}
}
result.Add(Msg);
IsRuning = false;
}
return result;
}
catch (Exception ex)
{
IsRuning = false;
Console.WriteLine(ex);
return [ex.ToString()];
}
}
public static void WriteLine(string str)
{
Msg += str + "\r\n";
if (PrintOut) Console.WriteLine(str);
}
}
}

83
Library/Tests/Old.cs Normal file
View File

@ -0,0 +1,83 @@
using System.Collections;
using System.Data;
using ConverterExample;
using Milimoe.FunGame.Core.Api.Utility;
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Common.JsonConverter;
namespace Milimoe.FunGame.Testing.Tests
{
internal class Old
{
internal Old()
{
DataSet ds = new();
DataTable table = new("SampleTable1");
table.Columns.Add("Id", typeof(int));
table.Columns.Add("Name", typeof(string));
table.Columns.Add("Age", typeof(int));
table.Rows.Add(1, "John", 30);
table.Rows.Add(2, "Jane", 25);
table.Rows.Add(3, "Bob", 40);
ds.Tables.Add(table);
table = new("SampleTable2");
table.Columns.Add("Id", typeof(int));
table.Columns.Add("Name", typeof(string));
table.Columns.Add("Age", typeof(int));
table.Rows.Add(1, "John", 30);
table.Rows.Add(2, "Jane", 25);
table.Rows.Add(3, "Bob", 40);
ds.Tables.Add(table);
JsonTool JsonTool = new();
JsonTool.AddConverters(new System.Text.Json.Serialization.JsonConverter[] { new UserConverter(), new RoomConverter(), new PersonConverter(), new AddressConverter() });
Room r = Factory.GetRoom(1294367, "w5rtvh8".ToUpper(), DateTime.Now, Factory.GetUser(), Milimoe.FunGame.Core.Library.Constant.RoomType.Mix, "", "", Milimoe.FunGame.Core.Library.Constant.RoomState.Created);
User u = Factory.GetUser(1, "LUOLI", DateTime.Now, DateTime.Now, "LUOLI@66.COM", "QWQAQW");
Hashtable hashtable = new()
{
{ "table", table },
{ "room", r },
{ "user", u }
};
string json = JsonTool.GetString(hashtable);
Hashtable hashtable2 = JsonTool.GetObject<Hashtable>(json) ?? new();
DataTable table2 = JsonTool.GetObject<DataTable>(json) ?? new();
User u2 = JsonTool.GetObject<User>(hashtable2, "user") ?? Factory.GetUser();
Room r2 = JsonTool.GetObject<Room>(hashtable2, "room") ?? Factory.GetRoom();
table2.AsEnumerable().ToList().ForEach(row =>
{
Console.WriteLine("Id: " + row["Id"] + ", Name: " + row["Name"] + ", Age: " + row["Age"]);
});
Console.WriteLine(u2.Username + " 进入了 " + r2.Roomid + " 房间");
Person p = new()
{
Age = (int)r2.Id,
Name = u2.Username,
Address = new()
{
State = "呵呵州(Hehe State)",
City = "哈哈市(Haha City)"
}
};
json = JsonTool.GetString(p);
Person p2 = JsonTool.GetObject<Person>(json) ?? new();
Console.WriteLine("My name is " + p2.Name + ", I am " + p2.Age + "-year-old. I live at " + p2.Address.State + " " + p2.Address.City);
Console.WriteLine("摆烂了86");
// 生成一对公钥秘钥
//TwoFactorAuthenticator.CreateSecretKey();
}
}
}