新增伤害统计,调整技能参数

This commit is contained in:
milimoe 2024-09-15 01:22:35 +08:00
parent 1169656ced
commit 9c0f001bc0
Signed by: milimoe
GPG Key ID: 05D280912DA6C69E
13 changed files with 149 additions and 63 deletions

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

@ -1,5 +1,14 @@
using Milimoe.FunGame.Testing.Tests; using Milimoe.FunGame.Testing.Tests;
FunGameSimulation.StartGame(true); bool printout = false;
List<string> strs = FunGameSimulation.StartGame(printout);
if (printout == false)
{
foreach (string str in strs)
{
Console.WriteLine(str);
}
}
Console.ReadKey(); Console.ReadKey();

View File

@ -24,7 +24,7 @@ namespace Milimoe.FunGame.Testing.Skills
{ {
public override long Id => Skill.Id; public override long Id => Skill.Id;
public override string Name => Skill.Name; public override string Name => Skill.Name;
public override string Description => $"{Duration} 内,攻击拥有标记的角色将根据标记层数获得 {吸血 * 100:0.##}% 吸血每层。"; public override string Description => $"{Duration} 时间内,攻击拥有标记的角色将根据标记层数获得 {吸血 * 100:0.##}% 吸血每层。";
public override bool TargetSelf => true; public override bool TargetSelf => true;
public override bool Durative => true; public override bool Durative => true;
public override double Duration => 30; public override double Duration => 30;

View File

@ -51,7 +51,7 @@ namespace Milimoe.FunGame.Testing.Skills
{ {
double = Calculation.Round2Digits( * 10); double = Calculation.Round2Digits( * 10);
character.MP += ; character.MP += ;
WriteLine("[ " + character + " ] 发动了三重叠加!额外获得了 " + + " 魔法值!"); WriteLine("[ " + character + " ] 发动了三重叠加!回复了 " + + " 魔法值!");
} }
} }
} }

View File

@ -23,7 +23,7 @@ namespace Milimoe.FunGame.Testing.Skills
{ {
public override long Id => Skill.Id; public override long Id => Skill.Id;
public override string Name => "变幻之心"; public override string Name => "变幻之心";
public override string Description => $"检查 [ 智慧与力量 ] 的模式。在力量模式下,立即回复 {生命值回复 * 100}% 生命值;智力模式下,下一次魔法伤害提升 {伤害提升 * 100}%。"; public override string Description => $"检查 [ 智慧与力量 ] 的模式。在力量模式下,立即回复 {生命值回复 * 100:0.##}% 生命值;智力模式下,下一次魔法伤害提升 {伤害提升 * 100:0.##}%。";
public override bool TargetSelf => true; public override bool TargetSelf => true;
private double => Calculation.Round4Digits(0.25 + 0.03 * (Level - 1)); private double => Calculation.Round4Digits(0.25 + 0.03 * (Level - 1));

View File

@ -23,12 +23,12 @@ namespace Milimoe.FunGame.Testing.Skills
{ {
public override long Id => Skill.Id; public override long Id => Skill.Id;
public override string Name => "力量爆发"; public override string Name => "力量爆发";
public override string Description => $"获得 150% 力量 [ {攻击力加成} ] 的攻击力加成,持续 {Duration} 秒,清除硬直时间。"; public override string Description => $"获得 150% 力量 [ {攻击力加成} ] 的攻击力加成,持续 {Duration} 时间。";
public override bool TargetSelf => true; public override bool TargetSelf => true;
public override bool Durative => true; public override bool Durative => true;
public override double Duration => 10 + 1 * (Level - 1); public override double Duration => 10 + 1 * (Level - 1);
private double => Calculation.Round2Digits(Skill.Character?.STR * 1.5 ?? 0); // 300% 攻击力加成 private double => Calculation.Round2Digits(Skill.Character?.STR * 1.5 ?? 0);
private double = 0; private double = 0;
public override void OnEffectGained(Character character) public override void OnEffectGained(Character character)

View File

@ -25,59 +25,63 @@ namespace Milimoe.FunGame.Testing.Skills
{ {
public override long Id => Skill.Id; public override long Id => Skill.Id;
public override string Name => Skill.Name; public override string Name => Skill.Name;
public override string Description => $"生命值高于30%时,受到额外的 [ 20~40% ] 伤害,但是获得 [ 上次所受伤害的 110~140% ] 伤害加成生命值低于等于30%时,不会受到额外的伤害,仅能获得 [ 上次所受伤害的 35% ] 伤害加成。" + public override string Description => $"生命值高于 30% 时,受到额外的 [ {高于30额外伤害下限}~{高于30额外伤害上限}% ] 伤害,但是获得 [ 累计所受伤害的 {高于30的加成下限}~{高于30的加成上限}% ] 伤害加成;生命值低于等于 30% 时,不会受到额外的伤害,仅能获得 [ 累计受到的伤害 {低于30的加成下限}~{低于30的加成上限}% ] 伤害加成。" +
$"在没有受到任何伤害的时候,将获得 {常规伤害加成 * 100:0.##}% 伤害加成。(当前伤害加成:{伤害加成 * 100:0.##}%"; $"在没有受到任何伤害的时候,将获得 {常规伤害加成 * 100:0.##}% 伤害加成。" + ( > 0 ? $"(当前伤害加成:{伤害加成(累计受到的伤害) * 100:0.##}%" : "");
public override bool TargetSelf => true; public override bool TargetSelf => true;
private double = 0; private double = 0;
private double = 0; private double = 0;
private double HP = 0;
private double = 0; private double = 0;
private readonly double = 0.2; private readonly double = 0.35;
private readonly int 30 = 40; private readonly int 30 = 40;
private readonly int 30 = 10; private readonly int 30 = 20;
private readonly double 30 = 0.35; private readonly int 30 = 100;
private readonly int 30 = 80;
private readonly int 30 = 60;
private readonly int 30 = 40;
private double private double (double damage)
{ {
get double = ;
Character? character = Skill.Character;
if (character != null && != 0)
{ {
double = ; if (character.HP > character.MaxHP * 0.3)
Character? character = Skill.Character;
if (character is null) return ;
if ( != 0)
{ {
if (character.HP > character.MaxHP * 0.3) = Calculation.Round4Digits(1.0 + ((new Random().Next(30, 30) + 0.0) / 100));
{
= Calculation.Round2Digits(1.0 + ((new Random().Next(30, 30) + 0.0) / 100));
}
else
{
= 30;
}
} }
return ; else
{
= Calculation.Round4Digits(1.0 + ((new Random().Next(30, 30) + 0.0) / 100));
}
return Calculation.Round2Digits( * );
} }
return Calculation.Round2Digits( * damage);
} }
public override void AlterExpectedDamageBeforeCalculation(Character character, Character enemy, ref double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType) public override void AlterExpectedDamageBeforeCalculation(Character character, Character enemy, ref double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType)
{ {
if (character == Skill.Character) if (character == Skill.Character)
{ {
= Calculation.Round2Digits(damage * ); = (damage);
damage = Calculation.Round2Digits(damage + ); damage = Calculation.Round2Digits(damage + );
WriteLine($"[ {character} ] 发动了玻璃大炮,获得了 {这次的伤害加成} 点伤害加成!"); WriteLine($"[ {character} ] 发动了玻璃大炮,获得了 {这次的伤害加成} 点伤害加成!");
= 0;
} }
if (enemy == Skill.Character) if (enemy == Skill.Character)
{ {
if (character.HP > character.MaxHP * 0.3) HP = enemy.HP;
if (enemy.HP > enemy.MaxHP * 0.3)
{ {
// 额外受到伤害 // 额外受到伤害
double = Calculation.Round4Digits((new Random().Next(20, 40) + 0.0) / 100); double = Calculation.Round4Digits((new Random().Next(30, 30) + 0.0) / 100);
= Calculation.Round2Digits(damage * ); = Calculation.Round2Digits(damage * );
damage = Calculation.Round2Digits(damage + ); damage = Calculation.Round2Digits(damage + );
WriteLine($"[ {character} ] 的玻璃大炮触发,将额外受到 {这次受到的额外伤害} 点伤害!"); WriteLine($"[ {enemy} ] 的玻璃大炮触发,将额外受到 {这次受到的额外伤害} 点伤害!");
} }
else = 0;
} }
} }
@ -85,7 +89,12 @@ namespace Milimoe.FunGame.Testing.Skills
{ {
if (enemy == Skill.Character && damageResult != DamageResult.Evaded) if (enemy == Skill.Character && damageResult != DamageResult.Evaded)
{ {
= damage; = Calculation.Round2Digits( + damage);
if (enemy.HP < 0 && HP - damage + > 0)
{
enemy.HP = 10;
WriteLine($"[ {enemy} ] 的玻璃大炮触发,保护了自己不进入死亡!!");
}
} }
} }
} }

View File

@ -23,7 +23,7 @@ namespace Milimoe.FunGame.Testing.Skills
{ {
public override long Id => Skill.Id; public override long Id => Skill.Id;
public override string Name => Skill.Name; public override string Name => Skill.Name;
public override string Description => $"{Duration} 普通攻击转为魔法伤害且硬直时间减少50%,并基于 {智力系数 * 100:0.##}% 智力 [{智力加成}] 强化普通攻击伤害。"; public override string Description => $"{Duration} 时间普通攻击转为魔法伤害且硬直时间减少50%,并基于 {智力系数 * 100:0.##}% 智力 [{智力加成}] 强化普通攻击伤害。";
public override bool TargetSelf => true; public override bool TargetSelf => true;
public override bool Durative => true; public override bool Durative => true;
public override double Duration => 40; public override double Duration => 40;

View File

@ -24,12 +24,13 @@ namespace Milimoe.FunGame.Testing.Skills
public override long Id => Skill.Id; public override long Id => Skill.Id;
public override string Name => Skill.Name; public override string Name => Skill.Name;
public override string Description => $"对所有角色造成 " + public override string Description => $"对所有角色造成 " +
$"450% 其现有能量值 + {智力系数 * 100:0.##}% 智力 [ {智力伤害} ] 的魔法伤害。"; $"{能量系数 * 100:0.##}% 其现有能量值 + {智力系数 * 100:0.##}% 智力 [ {智力伤害} ] 的魔法伤害。";
public override bool TargetSelf => false; public override bool TargetSelf => false;
public override double TargetRange => 999; public override double TargetRange => 999;
private double => Calculation.Round4Digits(0.55 * Level); private double => Calculation.Round4Digits(0.55 * Level);
private double => Calculation.Round2Digits( * Skill.Character?.INT ?? 0); 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) public override void OnSkillCasted(Character caster, List<Character> enemys, List<Character> teammates, Dictionary<string, object> others)
{ {
@ -37,7 +38,7 @@ namespace Milimoe.FunGame.Testing.Skills
{ {
WriteLine($"[ {caster} ] 正在毁灭 [ {c} ] 的能量!!"); WriteLine($"[ {caster} ] 正在毁灭 [ {c} ] 的能量!!");
double ep = c.EP; double ep = c.EP;
DamageToEnemy(caster, c, true, MagicType, Calculation.Round2Digits(ep * 6.0 + )); DamageToEnemy(caster, c, true, MagicType, Calculation.Round2Digits(ep * + ));
} }
} }
} }

View File

@ -23,7 +23,7 @@ namespace Milimoe.FunGame.Testing.Skills
{ {
public override long Id => Skill.Id; public override long Id => Skill.Id;
public override string Name => Skill.Name; public override string Name => Skill.Name;
public override string Description => $"{Duration} 时间内,增加 40% 攻击力 [ {攻击力提升} ]、30% 物理穿透和 25% 闪避率(不可叠加),普通攻击硬直时间额外减少 20%,基于 {系数 * 100:0.##}% 敏捷 [ {伤害加成} ] 强化普通攻击的伤害。"; public override string Description => $"{Duration} 时间内,增加 40% 攻击力 [ {攻击力提升} ]、30% 物理穿透和 25% 闪避率(不可叠加),普通攻击硬直时间额外减少 20%,基于 {系数 * 100:0.##}% 敏捷 [ {伤害加成} ] 强化普通攻击的伤害。在持续时间内,【心灵之火】的冷却时间降低至 3 时间。";
public override bool TargetSelf => false; public override bool TargetSelf => false;
public override int TargetCount => 1; public override int TargetCount => 1;
public override bool Durative => true; public override bool Durative => true;
@ -40,6 +40,11 @@ namespace Milimoe.FunGame.Testing.Skills
character.ExATK2 += ; character.ExATK2 += ;
character.PhysicalPenetration += 0.3; character.PhysicalPenetration += 0.3;
character.ExEvadeRate += 0.25; 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) public override void OnEffectLost(Character character)
@ -47,6 +52,16 @@ namespace Milimoe.FunGame.Testing.Skills
character.ExATK2 -= ; character.ExATK2 -= ;
character.PhysicalPenetration -= 0.3; character.PhysicalPenetration -= 0.3;
character.ExEvadeRate -= 0.25; 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) public override void AlterExpectedDamageBeforeCalculation(Character character, Character enemy, ref double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType)

View File

@ -25,20 +25,40 @@ namespace Milimoe.FunGame.Testing.Skills
{ {
public override long Id => Skill.Id; public override long Id => Skill.Id;
public override string Name => Skill.Name; public override string Name => Skill.Name;
public override string Description => $"增加 20% 攻击力且普通攻击硬直时间减少 20%。"; public override string Description => $"普通攻击硬直时间减少 20%。每次使用普通攻击时,额外再发动一次普通攻击,伤害特效可叠加,冷却 {基础冷却时间:0.##} 时间。" +
( > 0 ? $"(正在冷却:剩余 {冷却时间:0.##} 时间)" : "");
public override bool TargetSelf => true; public override bool TargetSelf => true;
private double = 0; public double { get; set; } = 0;
public double { get; set; } = 20;
private bool = false;
public override void OnEffectGained(Character character) public override void AfterDamageCalculation(Character character, Character enemy, double damage, bool isNormalAttack, bool isMagicDamage, MagicType magicType, DamageResult damageResult)
{ {
= character.BaseATK * 0.2; if (character == Skill.Character && isNormalAttack && == 0 && ! && ActionQueue != null)
character.ExATK2 += ; {
WriteLine($"[ {character} ] 发动了心灵之火!额外进行一次普通攻击!");
= ;
= true;
character.NormalAttack.Attack(ActionQueue, character, enemy);
}
if (character == Skill.Character && )
{
= false;
}
} }
public override void OnEffectLost(Character character) public override void OnTimeElapsed(Character character, double elapsed)
{ {
character.ExATK2 -= ; if ( > 0)
{
= Calculation.Round2Digits( - elapsed);
if ( <= 0)
{
= 0;
}
}
} }
public override void AlterHardnessTimeAfterNormalAttack(Character character, ref double baseHardnessTime, ref bool isCheckProtected) public override void AlterHardnessTimeAfterNormalAttack(Character character, ref double baseHardnessTime, ref bool isCheckProtected)

View File

@ -23,7 +23,7 @@ namespace Milimoe.FunGame.Testing.Skills
{ {
public override long Id => Skill.Id; public override long Id => Skill.Id;
public override string Name => "魔法涌流"; public override string Name => "魔法涌流";
public override string Description => $"{Duration} 内,增加所有伤害的 {减伤比例 * 100:0.##}% 伤害减免,并将普通攻击转为魔法伤害,可叠加魔法震荡的效果。"; public override string Description => $"{Duration} 时间内,增加所有伤害的 {减伤比例 * 100:0.##}% 伤害减免,并将普通攻击转为魔法伤害,可叠加魔法震荡的效果。";
public override bool TargetSelf => true; public override bool TargetSelf => true;
public override bool Durative => true; public override bool Durative => true;
public override double Duration => 25; public override double Duration => 25;

View File

@ -1,4 +1,4 @@
using System.Reflection; using System.Text;
using Milimoe.FunGame.Core.Api.Utility; using Milimoe.FunGame.Core.Api.Utility;
using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Common.Addon; using Milimoe.FunGame.Core.Library.Common.Addon;
@ -21,7 +21,7 @@ namespace Milimoe.FunGame.Testing.Tests
if (IsRuning) return ["游戏正在模拟中,请勿重复请求!"]; if (IsRuning) return ["游戏正在模拟中,请勿重复请求!"];
List<string> result = []; List<string> result = [];
int death = 0; int deaths = 0;
Msg = ""; Msg = "";
IsRuning = true; IsRuning = true;
@ -318,6 +318,9 @@ namespace Milimoe.FunGame.Testing.Tests
actionQueue.DisplayQueue(); actionQueue.DisplayQueue();
if (PrintOut) Console.WriteLine(); if (PrintOut) Console.WriteLine();
// 总游戏时长
double totalTime = 0;
// 总回合数 // 总回合数
int i = 1; int i = 1;
while (i < 999) while (i < 999)
@ -365,28 +368,51 @@ namespace Milimoe.FunGame.Testing.Tests
} }
// 模拟时间流逝 // 模拟时间流逝
actionQueue.TimeLapse(); totalTime += actionQueue.TimeLapse();
// 使用反射获取私有字段 if (actionQueue.Eliminated.Count > deaths)
FieldInfo? eliminatedField = actionQueue.GetType().GetField("_eliminated", BindingFlags.NonPublic | BindingFlags.Instance);
// 从对象中获取该字段的值
if (eliminatedField != null)
{ {
if (eliminatedField.GetValue(actionQueue) is List<Character> eliminatedList && eliminatedList.Count > death) deaths = actionQueue.Eliminated.Count;
string roundMsg = Msg;
string[] strs = roundMsg.Split("==== 角色状态 ====");
if (strs.Length > 0)
{ {
death = eliminatedList.Count; roundMsg = strs[0];
string roundMsg = Msg;
string[] strs = roundMsg.Split("==== 角色状态 ====");
if (strs.Length > 0)
{
roundMsg = strs[0];
}
result.Add(roundMsg);
} }
result.Add(roundMsg);
} }
} }
if (PrintOut) Console.WriteLine("--- End ---"); if (PrintOut)
{
Console.WriteLine("--- End ---");
Console.WriteLine("总游戏时长:" + Calculation.Round2Digits(totalTime));
Console.WriteLine("");
}
// 赛后统计
WriteLine("==== 伤害排行榜 TOP6 ====");
Msg = "==== 伤害排行榜 TOP6 ====\r\n";
// 显示前四的角色统计
int count = 1;
foreach (Character character in actionQueue.CharacterStatistics.OrderByDescending(d => d.Value.TotalDamage).Select(d => d.Key))
{
StringBuilder builder = new();
CharacterStatistics stats = actionQueue.CharacterStatistics[character];
builder.AppendLine($"{count}. [ {character.ToStringWithLevel()} ]");
builder.AppendLine($"存活时长:{stats.LiveTime} / 存活回合数:{stats.LiveRound} / 行动回合数:{stats.ActionTurn}");
builder.AppendLine($"总计伤害:{stats.TotalDamage} / 每秒伤害:{stats.DamagePerSecond} / 每回合伤害:{stats.DamagePerTurn}");
builder.Append($"总计物理伤害:{stats.TotalPhysicalDamage} / 总计魔法伤害:{stats.TotalMagicDamage}");
if (count++ <= 6)
{
WriteLine(builder.ToString());
}
else
{
Console.WriteLine(builder.ToString());
}
}
result.Add(Msg);
IsRuning = false; IsRuning = false;
} }