FunGame-Core/Entity/System/RoundRecord.cs
milimoe 769d0e4281
添加免疫、驱散;顺序表、爆发技、助攻修改 (#129)
* 特效底层支持直接修改硬直时间;添加驱散类型

* 添加 debuff

* 明确了驱散定义;添加助攻窗口期;修改预释放爆发技为不可驱散;预释放爆发技一定是最先行动;修复复活时导致硬直时间变成负数的问题

* 调整驱散描述

* 实现驱散系统;修复角色百分比公式错误;添加非伤害类助攻;添加辅助数据统计;修改一些文本显示

* 添加免疫、吸血、护盾机制

* 继续完善免疫和驱散、护盾和特效钩子等

* 添加新特效类型
2025-04-26 03:07:10 +08:00

139 lines
6.1 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System.Text;
using Milimoe.FunGame.Core.Api.Utility;
using Milimoe.FunGame.Core.Library.Constant;
namespace Milimoe.FunGame.Core.Entity
{
public class RoundRecord(int round)
{
public int Round { get; set; } = round;
public Character Actor { get; set; } = Factory.GetCharacter();
public CharacterActionType ActionType { get; set; } = CharacterActionType.None;
public List<Character> Targets { get; set; } = [];
public Skill? Skill { get; set; } = null;
public string SkillCost { get; set; } = "";
public Item? Item { get; set; } = null;
public bool HasKill { get; set; } = false;
public Dictionary<Character, double> Damages { get; set; } = [];
public Dictionary<Character, bool> IsCritical { get; set; } = [];
public Dictionary<Character, bool> IsEvaded { get; set; } = [];
public Dictionary<Character, bool> IsImmune { get; set; } = [];
public Dictionary<Character, double> Heals { get; set; } = [];
public Dictionary<Character, List<EffectType>> Effects { get; set; } = [];
public List<string> ActorContinuousKilling { get; set; } = [];
public List<string> DeathContinuousKilling { get; set; } = [];
public double CastTime { get; set; } = 0;
public double HardnessTime { get; set; } = 0;
public Dictionary<Character, double> RespawnCountdowns { get; set; } = [];
public List<Character> Respawns { get; set; } = [];
public List<Skill> RoundRewards { get; set; } = [];
public override string ToString()
{
StringBuilder builder = new();
builder.AppendLine($"=== Round {Round} ===");
if (RoundRewards.Count > 0)
{
builder.AppendLine($"[ {Actor} ] 回合奖励 -> {string.Join(" / ", RoundRewards.Select(s => s.Description)).Trim()}");
}
if (ActionType == CharacterActionType.NormalAttack || ActionType == CharacterActionType.CastSkill || ActionType == CharacterActionType.CastSuperSkill)
{
if (ActionType == CharacterActionType.NormalAttack)
{
builder.Append($"[ {Actor} ] {Actor.NormalAttack.Name} -> ");
}
else if (ActionType == CharacterActionType.CastSkill || ActionType == CharacterActionType.CastSuperSkill)
{
if (Skill != null)
{
builder.Append($"[ {Actor} ] {Skill.Name}{SkillCost}-> ");
}
else
{
builder.Append($"释放魔法 -> ");
}
}
builder.AppendLine(string.Join(" / ", GetTargetsState()));
if (DeathContinuousKilling.Count > 0) builder.AppendLine($"{string.Join("\r\n", DeathContinuousKilling)}");
if (ActorContinuousKilling.Count > 0) builder.AppendLine($"{string.Join("\r\n", ActorContinuousKilling)}");
}
if (ActionType == CharacterActionType.PreCastSkill && Skill != null)
{
if (Skill.IsMagic)
{
builder.AppendLine($"[ {Actor} ] 吟唱 [ {Skill.Name} ],持续时间:{CastTime:0.##}");
}
else
{
builder.AppendLine($"[ {Actor} ]{Skill.Name}{SkillCost}-> ");
builder.AppendLine(string.Join(" / ", GetTargetsState()));
builder.AppendLine($"[ {Actor} ] 回合结束,硬直时间:{HardnessTime:0.##}");
}
}
else
{
builder.AppendLine($"[ {Actor} ] 回合结束,硬直时间:{HardnessTime:0.##}");
}
foreach (Character character in RespawnCountdowns.Keys)
{
builder.AppendLine($"[ {character} ] 进入复活倒计时:{RespawnCountdowns[character]:0.##}");
}
foreach (Character character in Respawns)
{
builder.AppendLine($"[ {character} ] 复活了");
}
return builder.ToString();
}
private List<string> GetTargetsState()
{
List<string> strings = [];
foreach (Character target in Targets.Distinct())
{
string hasDamage = "";
string hasHeal = "";
string hasEffect = "";
if (Damages.TryGetValue(target, out double damage))
{
hasDamage = $"伤害:{damage:0.##}";
if (IsCritical.TryGetValue(target, out bool isCritical) && isCritical)
{
hasDamage = "暴击," + hasDamage;
}
}
if (Heals.TryGetValue(target, out double heals))
{
hasHeal = $"治疗:{heals:0.##}";
}
if (Effects.TryGetValue(target, out List<EffectType>? effectTypes) && effectTypes != null)
{
hasEffect = $"施加:{string.Join(" + ", effectTypes.Select(SkillSet.GetEffectTypeName))}";
}
if (IsEvaded.ContainsKey(target))
{
if (ActionType == CharacterActionType.NormalAttack)
{
hasDamage = "完美闪避";
}
else if ((ActionType == CharacterActionType.PreCastSkill || ActionType == CharacterActionType.CastSkill || ActionType == CharacterActionType.CastSuperSkill))
{
hasDamage = "技能免疫";
}
}
if (IsImmune.ContainsKey(target) && hasDamage != "" && target != Actor)
{
hasDamage = "免疫";
}
string[] strs = [hasDamage, hasHeal, hasEffect];
strings.Add($"[ {target}{string.Join(" / ", strs.Where(s => s != ""))}]");
}
return strings;
}
}
}