From 81753d5e2fdc8a477ccdc3615686b380603cd538 Mon Sep 17 00:00:00 2001 From: milimoe Date: Tue, 10 Sep 2024 00:54:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8A=A9=E6=94=BB=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=EF=BC=8C=E4=BF=AE=E5=A4=8D=E4=B8=80=E4=BA=9BBUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Api/Utility/ActionQueue.cs | 128 ++++++++++++------ Entity/Character/AssistDetail.cs | 59 ++++++++ Entity/Character/Character.cs | 66 ++++++++- Entity/Skill/Effect.cs | 38 +++++- Entity/Skill/NormalAttack.cs | 4 +- Entity/Skill/Skill.cs | 30 +++- .../JsonConverter/CharacterConverter.cs | 8 ++ Library/Constant/ConstantSet.cs | 1 - Library/Constant/TypeEnum.cs | 9 +- 9 files changed, 275 insertions(+), 68 deletions(-) create mode 100644 Entity/Character/AssistDetail.cs diff --git a/Api/Utility/ActionQueue.cs b/Api/Utility/ActionQueue.cs index a271e63..d9ad16d 100644 --- a/Api/Utility/ActionQueue.cs +++ b/Api/Utility/ActionQueue.cs @@ -1,5 +1,4 @@ -using System.Text; -using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Constant; namespace Milimoe.FunGame.Core.Api.Utility @@ -42,7 +41,7 @@ namespace Milimoe.FunGame.Core.Api.Utility /// /// 角色目前赚取的金钱 /// - protected readonly Dictionary _earnedMoney = []; + protected readonly Dictionary _earnedMoney = []; /// /// 角色目前的连杀数 @@ -53,6 +52,11 @@ namespace Milimoe.FunGame.Core.Api.Utility /// 角色被插队次数 /// protected readonly Dictionary _cutCount = []; + + /// + /// 助攻伤害 + /// + protected readonly Dictionary _assistDamage = []; /// /// 游戏是否结束 @@ -84,7 +88,9 @@ namespace Milimoe.FunGame.Core.Api.Utility if (group.Count() == 1) { // 如果只有一个角色,直接加入队列 - AddCharacter(group.First(), Calculation.Round2Digits(_queue.Count * 0.1), false); + Character character = group.First(); + AddCharacter(character, Calculation.Round2Digits(_queue.Count * 0.1), false); + _assistDamage.Add(character, new AssistDetail(character, characters.Where(c => c != character))); } else { @@ -132,6 +138,7 @@ namespace Milimoe.FunGame.Core.Api.Utility if (selectedCharacter != null) { AddCharacter(selectedCharacter, Calculation.Round2Digits(_queue.Count * 0.1), false); + _assistDamage.Add(selectedCharacter, new AssistDetail(selectedCharacter, characters.Where(c => c != selectedCharacter))); WriteLine("decided: " + selectedCharacter.Name + "\r\n"); sortedList.Remove(selectedCharacter); } @@ -164,14 +171,33 @@ namespace Milimoe.FunGame.Core.Api.Utility // 如果没有找到满足条件的角色,返回 -1 int protectIndex = list.Select(x => x.Index).LastOrDefault(-1); - // 判断是否需要插入到受保护角色的后面 - if (protectIndex != -1 && (insertIndex != -1 && insertIndex <= protectIndex)) + if (protectIndex != -1) { - // 如果按硬直时间插入的位置在受保护角色之前或相同,则插入到受保护角色的后面一位 - insertIndex = protectIndex + 1; - hardnessTime = _hardnessTimes[list.Select(x => x.Character).Last()]; - // 列出受保护角色的名单 - WriteLine($"由于 [ {string.Join(" ],[ ", list.Select(x => x.Character))} ] 受到行动保护,因此角色 [ {character} ] 将插入至顺序表第 {insertIndex + 1} 位。"); + // 获取最后一个符合条件的角色 + Character lastProtectedCharacter = list.Last().Character; + double lastProtectedHardnessTime = _hardnessTimes[lastProtectedCharacter]; + + // 查找与最后一个受保护角色相同硬直时间的其他角色 + var sameHardnessList = _queue + .Select((c, index) => new { Character = c, Index = index }) + .Where(x => _hardnessTimes[x.Character] == lastProtectedHardnessTime && x.Index > protectIndex); + + // 如果找到了相同硬直时间的角色,更新 protectIndex 为它们中最后一个的索引 + if (sameHardnessList.Any()) + { + protectIndex = sameHardnessList.Select(x => x.Index).Last(); + } + + // 判断是否需要插入到受保护角色的后面 + if (insertIndex != -1 && insertIndex <= protectIndex) + { + // 如果按硬直时间插入的位置在受保护角色之前或相同,则插入到受保护角色的后面一位 + insertIndex = protectIndex + 1; + hardnessTime = lastProtectedHardnessTime; + + // 列出受保护角色的名单 + WriteLine($"由于 [ {string.Join(" ],[ ", list.Select(x => x.Character))} ] 受到行动保护,因此角色 [ {character} ] 将插入至顺序表第 {insertIndex + 1} 位。"); + } } } @@ -225,23 +251,11 @@ namespace Milimoe.FunGame.Core.Api.Utility /// public void DisplayQueue() { - StringBuilder text = new(); - - text.AppendLine("==== 角色状态 ===="); + WriteLine("==== 角色状态 ===="); foreach (Character c in _queue) { - text.AppendLine("角色 [ " + c + " ]"); - text.AppendLine($"生命值:{c.HP} / {c.MaxHP}" + (c.ExHP + c.ExHP2 > 0 ? $" [{c.BaseHP} + {c.ExHP + c.ExHP2}]" : "")); - text.AppendLine($"魔法值:{c.MP} / {c.MaxMP}" + (c.ExMP + c.ExMP2 > 0 ? $" [{c.BaseMP} + {c.ExMP + c.ExMP2}]" : "")); - text.AppendLine($"能量值:{c.EP} / 200"); - if (c.CharacterState != CharacterState.Actionable) - { - text.AppendLine(CharacterSet.GetCharacterState(c.CharacterState)); - } - text.AppendLine($"硬直时间:{_hardnessTimes[c]}"); + WriteLine(c.GetInBattleInfo(_hardnessTimes[c])); } - - WriteLine(text.ToString()); } /// @@ -274,13 +288,13 @@ namespace Milimoe.FunGame.Core.Api.Utility double baseTime = new Random().Next(10, 30); // 敌人列表 - List enemys = [.. _queue.Where(c => c != character && c.CharacterState != CharacterState.Neutral)]; + List enemys = [.. _queue.Where(c => c != character && !c.IsUnselectable)]; // 队友列表 List teammates = []; // 技能列表 - List skills = [.. character.Skills.Where(s => s.Level > 0 && s.IsActive && s.Enable && s.CurrentCD == 0 && + List skills = [.. character.Skills.Where(s => s.Level > 0 && s.IsActive && s.Enable && !s.IsInEffect && s.CurrentCD == 0 && ((s.IsSuperSkill && s.EPCost <= character.EP) || (!s.IsSuperSkill && s.IsMagic && s.MPCost <= character.MP) || (!s.IsSuperSkill && !s.IsMagic && s.EPCost <= character.EP)))]; // 作出了什么行动 @@ -394,8 +408,7 @@ namespace Milimoe.FunGame.Core.Api.Utility { Character enemy = enemys[new Random().Next(enemys.Count)]; character.NormalAttack.Attack(this, character, enemy); - // 普通攻击的默认硬直时间为7 - baseTime = 7; + baseTime = character.NormalAttack.HardnessTime; foreach (Effect effect in character.Effects.Where(e => e.Level > 0)) { if (effect.AlterHardnessTimeAfterNormalAttack(character, baseTime, out double newTime)) @@ -618,6 +631,7 @@ namespace Milimoe.FunGame.Core.Api.Utility // 移除到时间的特效 foreach (Effect effect in character.Effects.ToList()) { + if (!effect.Skill.IsActive) continue; if (!effect.Durative || effect.Level == 0) { character.Effects.Remove(effect); @@ -666,6 +680,9 @@ namespace Milimoe.FunGame.Core.Api.Utility else WriteLine("[ " + enemy + $" ] 受到了 {damage} 点物理伤害!"); enemy.HP = Calculation.Round2Digits(enemy.HP - damage); + // 计算助攻 + _assistDamage[actor][enemy] += damage; + // 造成伤害和受伤都可以获得能量 double ep = GetEP(damage, 0.2, 40); foreach (Effect effect in actor.Effects) @@ -677,7 +694,7 @@ namespace Milimoe.FunGame.Core.Api.Utility } actor.EP += ep; ep = GetEP(damage, 0.1, 20); - foreach (Effect effect in actor.Effects.Where(e => e.Level > 0)) + foreach (Effect effect in enemy.Effects.Where(e => e.Level > 0)) { if (effect.AlterEPAfterGetDamage(enemy, ep, out double newep)) { @@ -698,7 +715,7 @@ namespace Milimoe.FunGame.Core.Api.Utility { effect.AfterDeathCalculation(enemy, actor, _continuousKilling, _earnedMoney); } - if (_queue.Remove(enemy) && (!_queue.Where(c => c != actor && c.CharacterState != CharacterState.Neutral).Any())) + if (_queue.Remove(enemy) && (!_queue.Where(c => c != actor).Any())) { // 没有其他的角色了,游戏结束 EndGameInfo(actor); @@ -844,17 +861,46 @@ namespace Milimoe.FunGame.Core.Api.Utility public void DeathCalculation(Character killer, Character death) { if (!_continuousKilling.TryAdd(killer, 1)) _continuousKilling[killer] += 1; - double money = new Random().Next(200, 400); + int money = new Random().Next(250, 350); + Character[] assists = _assistDamage.Keys.Where(c => c != death && _assistDamage[c].GetPercentage(death) > 0.10).ToArray(); + double totalDamagePercentage = Calculation.Round4Digits(_assistDamage.Keys.Where(assists.Contains).Select(c => _assistDamage[c].GetPercentage(death)).Sum()); + int totalMoney = Math.Min(Convert.ToInt32(money * totalDamagePercentage), 425); // 防止刷伤害设置金钱上限 + + // 按伤害比分配金钱 只有造成10%伤害以上才能参与 + foreach (Character assist in assists) + { + int cmoney = Convert.ToInt32(_assistDamage[assist].GetPercentage(death) / totalDamagePercentage * totalMoney); + if (assist != killer) + { + if (!_earnedMoney.TryAdd(assist, cmoney)) _earnedMoney[assist] += cmoney; + } + else + { + money = cmoney; + } + } + + // 终结击杀的奖励仍然是全额的 if (_continuousKilling.TryGetValue(death, out int coefficient) && coefficient > 1) { - money = Calculation.Round(money + ((coefficient + 1) * new Random().Next(100, 200)), 0); + money += (coefficient + 1) * new Random().Next(100, 200); string termination = CharacterSet.GetContinuousKilling(coefficient); - WriteLine("[ " + killer + " ] 终结了 [ " + death + " ]" + (termination != "" ? " 的" + termination : "") + $",获得 {money} 金钱!"); + string msg = $"[ {killer} ] 终结了 [ {death} ] {(termination != "" ? " 的" + termination : "")},获得 {money} 金钱!"; + if (assists.Length > 1) + { + msg += "助攻:[ " + string.Join(" ] / [ ", assists.Where(c => c != killer)) + " ]"; + } + WriteLine(msg); } else { - WriteLine("[ " + killer + " ] 杀死了 [ " + death + $" ],获得 {money} 金钱!"); + string msg = $"[ {killer} ] 杀死了 [ {death} ],获得 {money} 金钱!"; + if (assists.Length > 1) + { + msg += "助攻:[ " + string.Join(" ] / [ ", assists.Where(c => c != killer)) + " ]"; + } + WriteLine(msg); } int kills = _continuousKilling[killer]; @@ -875,7 +921,7 @@ namespace Milimoe.FunGame.Core.Api.Utility { WriteLine("[ " + killer + " ] 已经" + continuousKilling + "!拜托谁去杀了他吧!!!"); } - + if (!_earnedMoney.TryAdd(killer, money)) _earnedMoney[killer] += money; _eliminated.Add(death); @@ -894,7 +940,7 @@ namespace Milimoe.FunGame.Core.Api.Utility WriteLine("=== 排名 ==="); for (int i = _eliminated.Count - 1; i >= 0; i--) { - string topCharacter = _eliminated[i].ToString() + (_earnedMoney.TryGetValue(_eliminated[i], out double earned) ? $" [ 已赚取 {earned} 金钱 ]" : ""); + string topCharacter = _eliminated[i].ToString() + (_continuousKilling.TryGetValue(_eliminated[i], out int kills) && kills > 1 ? $" [ {CharacterSet.GetContinuousKilling(kills)} ]" : "") + (_earnedMoney.TryGetValue(_eliminated[i], out int earned) ? $" [ 已赚取 {earned} 金钱 ]" : ""); if (top == 1) { WriteLine("冠军:" + topCharacter); @@ -960,14 +1006,14 @@ namespace Milimoe.FunGame.Core.Api.Utility /// public void WillPreCastSuperSkill(Character character) { - CharacterState[] checkStates = [CharacterState.Actionable, CharacterState.Neutral]; + CharacterState[] checkStates = [CharacterState.Actionable]; // 选取在顺序表一半之后的角色 foreach (Character other in _queue.Where(c => c != character && checkStates.Contains(c.CharacterState) && _queue.IndexOf(c) >= _queue.Count / 2).ToList()) { // 有 65% 欲望插队 if (new Random().NextDouble() < 0.65) { - List skills = other.Skills.Where(s => s.IsSuperSkill && s.Level > 0 && s.IsActive && s.Enable && s.CurrentCD == 0 && other.EP >= s.EPCost).ToList(); + List skills = other.Skills.Where(s => s.IsSuperSkill && s.Level > 0 && s.IsActive && s.Enable && !s.IsInEffect && s.CurrentCD == 0 && other.EP >= s.EPCost).ToList(); if (skills.Count > 0) { Skill skill = skills[new Random().Next(skills.Count)]; @@ -979,9 +1025,9 @@ namespace Milimoe.FunGame.Core.Api.Utility WriteLine("[ " + other + " ] 预释放了爆发技!!"); foreach (Character c in _hardnessTimes.Keys) { - if (c != other) + if (_hardnessTimes[c] != 0) { - _hardnessTimes[c] += 0.01; + _hardnessTimes[c] = Calculation.Round2Digits(_hardnessTimes[c] + 0.01); } } foreach (Effect effect in character.Effects.Where(e => e.Level > 0)) diff --git a/Entity/Character/AssistDetail.cs b/Entity/Character/AssistDetail.cs new file mode 100644 index 0000000..2226d2b --- /dev/null +++ b/Entity/Character/AssistDetail.cs @@ -0,0 +1,59 @@ +using Milimoe.FunGame.Core.Api.Utility; + +namespace Milimoe.FunGame.Core.Entity +{ + /// + /// 用于记录对哪个角色造成了多少伤害 + /// + public class AssistDetail : Dictionary + { + /// + /// 此详情类属于哪个角色 + /// + public Character Character { get; } + + /// + /// 初始化一个助攻详情类 + /// + /// + /// + public AssistDetail(Character character, IEnumerable enemys) + { + Character = character; + foreach (Character enemy in enemys) + { + this[enemy] = 0; + } + } + + /// + /// 获取和设置对 的伤害 + /// + /// + /// + public new double this[Character enemy] + { + get + { + return base[enemy]; + } + set + { + if (!base.TryAdd(enemy, Calculation.Round2Digits(value))) + { + base[enemy] = Calculation.Round2Digits(value); + } + } + } + + /// + /// 获取对 的伤害 + /// + /// + /// 目标的 的百分比形式 + public double GetPercentage(Character enemy) + { + return Calculation.Round2Digits(base[enemy] / enemy.MaxHP); + } + } +} diff --git a/Entity/Character/Character.cs b/Entity/Character/Character.cs index 3632fa3..03797a9 100644 --- a/Entity/Character/Character.cs +++ b/Entity/Character/Character.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using System.Text; +using System.Text; using Milimoe.FunGame.Core.Api.Utility; using Milimoe.FunGame.Core.Interface.Entity; using Milimoe.FunGame.Core.Library.Constant; @@ -136,6 +135,16 @@ namespace Milimoe.FunGame.Core.Entity /// public CharacterState CharacterState { get; set; } = CharacterState.Actionable; + /// + /// 角色是否是中立的/无敌的 [ 战斗相关 ] + /// + public bool IsNeutral { get; set; } = false; + + /// + /// 角色是否是不可选中的 [ 战斗相关 ] + /// + public bool IsUnselectable { get; set; } = false; + /// /// 初始生命值 [ 初始设定 ] /// @@ -655,7 +664,7 @@ namespace Milimoe.FunGame.Core.Entity /// 角色的技能列表 /// public HashSet Skills { get; } = []; - + /// /// 角色的持续性特效列表 /// @@ -674,7 +683,7 @@ namespace Milimoe.FunGame.Core.Entity /// 等级 /// private int _Level = 1; - + /// /// 能量值 /// @@ -840,6 +849,7 @@ namespace Milimoe.FunGame.Core.Entity builder.AppendLine($"暴击伤害:{CritDMG * 100:f2}%"); builder.AppendLine($"闪避率:{EvadeRate * 100:f2}%"); builder.AppendLine($"冷却缩减:{CDR * 100:f2}%"); + builder.AppendLine($"加速系数:{AccelerationCoefficient * 100:f2}%"); builder.AppendLine($"物理穿透:{PhysicalPenetration * 100:f2}%"); builder.AppendLine($"魔法穿透:{MagicalPenetration * 100:f2}%"); @@ -848,6 +858,16 @@ namespace Milimoe.FunGame.Core.Entity builder.AppendLine(CharacterSet.GetCharacterState(CharacterState)); } + if (IsNeutral) + { + builder.AppendLine("角色是无敌的"); + } + + if (IsUnselectable) + { + builder.AppendLine("角色是不可选中的"); + } + builder.AppendLine("== 普通攻击 =="); builder.Append(NormalAttack.ToString()); @@ -872,6 +892,44 @@ namespace Milimoe.FunGame.Core.Entity return builder.ToString(); } + public string GetInBattleInfo(double hardnessTimes) + { + StringBuilder builder = new(); + + builder.AppendLine(ToStringWithLevel()); + builder.AppendLine($"生命值:{HP} / {MaxHP}" + (ExHP + ExHP2 > 0 ? $" [{BaseHP} + {ExHP + ExHP2}]" : "")); + builder.AppendLine($"魔法值:{MP} / {MaxMP}" + (ExMP + ExMP2 > 0 ? $" [{BaseMP} + {ExMP + ExMP2}]" : "")); + builder.AppendLine($"能量值:{EP} / 200"); + + if (CharacterState != CharacterState.Actionable) + { + builder.AppendLine(CharacterSet.GetCharacterState(CharacterState)); + } + + if (IsNeutral) + { + builder.AppendLine("角色是无敌的"); + } + + if (IsUnselectable) + { + builder.AppendLine("角色是不可选中的"); + } + + builder.AppendLine($"硬直时间:{hardnessTimes}"); + + if (Effects.Count > 0) + { + builder.AppendLine("== 状态栏 =="); + foreach (Effect effect in Effects) + { + builder.Append(effect.ToString()); + } + } + + return builder.ToString(); + } + /// /// 复制一个角色 /// [ 推荐从模组中复制后使用对象 ] diff --git a/Entity/Skill/Effect.cs b/Entity/Skill/Effect.cs index e3a4c39..4094c24 100644 --- a/Entity/Skill/Effect.cs +++ b/Entity/Skill/Effect.cs @@ -1,4 +1,5 @@ -using Milimoe.FunGame.Core.Api.Utility; +using System.Text; +using Milimoe.FunGame.Core.Api.Utility; using Milimoe.FunGame.Core.Interface.Entity; using Milimoe.FunGame.Core.Library.Constant; @@ -28,7 +29,7 @@ namespace Milimoe.FunGame.Core.Entity /// 作用范围 /// public virtual double TargetRange { get; } = 0; - + /// /// 持续性的 /// 配合 使用,而不是 。 @@ -40,18 +41,23 @@ namespace Milimoe.FunGame.Core.Entity /// 配合 使用。 /// public virtual double Duration { get; } = 0; - + /// /// 持续时间(回合) /// 使用此属性需要将 设置为 false。 /// public virtual double DurationTurn { get; } = 0; - + /// /// 剩余持续时间 /// public double RemainDuration { get; set; } = 0; + /// + /// 剩余持续时间(回合) + /// + public double RemainDurationTurn { get; set; } = 0; + /// /// 魔法类型 /// @@ -137,7 +143,7 @@ namespace Milimoe.FunGame.Core.Entity newHardnessTime = baseHardnessTime; return false; } - + /// /// 在完成释放技能动作之后修改硬直时间 /// @@ -240,7 +246,7 @@ namespace Milimoe.FunGame.Core.Entity { } - + /// /// 在特效持有者的回合开始后 /// @@ -277,7 +283,7 @@ namespace Milimoe.FunGame.Core.Entity /// /// /// - public virtual void AfterDeathCalculation(Character death, Character? killer, Dictionary continuousKilling, Dictionary earnedMoney) + public virtual void AfterDeathCalculation(Character death, Character? killer, Dictionary continuousKilling, Dictionary earnedMoney) { } @@ -304,6 +310,24 @@ namespace Milimoe.FunGame.Core.Entity } + public override string ToString() + { + StringBuilder builder = new(); + + string isDurative = ""; + if (Durative) + { + isDurative = "(剩余:" + RemainDuration + " 时间)"; + } + else if (DurationTurn > 0) + { + isDurative = "(剩余:" + RemainDurationTurn + " 回合)"; + } + builder.AppendLine("【" + Name + " - 等级 " + Level + "】" + Description + isDurative); + + return builder.ToString(); + } + public override bool Equals(IBaseEntity? other) { return other is Effect c && c.Name == Name; diff --git a/Entity/Skill/NormalAttack.cs b/Entity/Skill/NormalAttack.cs index bb98669..179830f 100644 --- a/Entity/Skill/NormalAttack.cs +++ b/Entity/Skill/NormalAttack.cs @@ -55,7 +55,7 @@ namespace Milimoe.FunGame.Core.Entity /// /// 硬直时间 /// - public double HardnessTime { get; } = 7; + public double HardnessTime { get; } = 10; /// /// 对目标(或多个目标)发起普通攻击 @@ -86,7 +86,7 @@ namespace Milimoe.FunGame.Core.Entity { StringBuilder builder = new(); - builder.AppendLine(Name + " - " + "等级:" + Level); + builder.AppendLine(Name + " - 等级 " + Level); builder.AppendLine("技能描述:" + Description); builder.AppendLine("硬直时间:" + HardnessTime); diff --git a/Entity/Skill/Skill.cs b/Entity/Skill/Skill.cs index 71eced5..c61d7bb 100644 --- a/Entity/Skill/Skill.cs +++ b/Entity/Skill/Skill.cs @@ -42,24 +42,29 @@ namespace Milimoe.FunGame.Core.Entity } /// - /// 是否是主动技能 + /// 是否是主动技能 [ 此项为最高优先级 ] /// [InitRequired] public bool IsActive { get; set; } = true; /// - /// 是否可用 + /// 是否可用 [ 此项为最高优先级 ] /// public bool Enable { get; set; } = true; /// - /// 是否是爆发技 [ 此项为最高优先级 ] + /// 效果持续生效中 [ 此项设置为true后不允许再次释放,防止重复释放 ] + /// + public bool IsInEffect { get; set; } = false; + + /// + /// 是否是爆发技 [ 此项为高优先级 ] /// [InitRequired] public bool IsSuperSkill { get; set; } = false; /// - /// 是否属于魔法 [ 会失效 ],反之为战技 + /// 是否属于魔法 [ 必须为 true ],反之为战技 /// [InitRequired] public bool IsMagic { get; set; } = true; @@ -152,7 +157,7 @@ namespace Milimoe.FunGame.Core.Entity } } } - + /// /// 触发技能效果 /// @@ -178,8 +183,21 @@ namespace Milimoe.FunGame.Core.Entity StringBuilder builder = new(); string type = IsSuperSkill ? "【爆发技】" : (IsMagic ? "【魔法】" : (IsActive ? "【主动】" : "【被动】")); - builder.AppendLine(type + Name + " - " + "等级 " + Level); + string level = Level > 0 ? " - 等级 " + Level : " - 尚未学习"; + builder.AppendLine(type + Name + level); builder.AppendLine("技能描述:" + Description); + if (CurrentCD > 0) + { + builder.AppendLine("正在冷却:剩余 " + CurrentCD + " 秒"); + } + if (!Enable) + { + builder.AppendLine("技能当前不可用"); + } + if (IsInEffect) + { + builder.AppendLine("效果结束前不可用"); + } if (IsActive) { if (IsSuperSkill) diff --git a/Library/Common/JsonConverter/CharacterConverter.cs b/Library/Common/JsonConverter/CharacterConverter.cs index 1136228..0cf09be 100644 --- a/Library/Common/JsonConverter/CharacterConverter.cs +++ b/Library/Common/JsonConverter/CharacterConverter.cs @@ -50,6 +50,12 @@ namespace Milimoe.FunGame.Core.Library.Common.JsonConverter case nameof(Character.EXP): result.EXP = reader.GetDouble(); break; + case nameof(Character.IsNeutral): + result.IsNeutral = reader.GetBoolean(); + break; + case nameof(Character.IsUnselectable): + result.IsUnselectable = reader.GetBoolean(); + break; case nameof(Character.InitialHP): result.InitialHP = reader.GetDouble(); break; @@ -175,6 +181,8 @@ namespace Milimoe.FunGame.Core.Library.Common.JsonConverter writer.WriteNumber(nameof(Character.PrimaryAttribute), (int)value.PrimaryAttribute); writer.WriteNumber(nameof(Character.Level), value.Level); writer.WriteNumber(nameof(Character.EXP), value.EXP); + writer.WriteBoolean(nameof(Character.IsNeutral), value.IsNeutral); + writer.WriteBoolean(nameof(Character.IsUnselectable), value.IsUnselectable); writer.WriteNumber(nameof(Character.CharacterState), (int)value.CharacterState); writer.WriteNumber(nameof(Character.InitialHP), value.InitialHP); writer.WriteNumber(nameof(Character.ExHP2), value.ExHP2); diff --git a/Library/Constant/ConstantSet.cs b/Library/Constant/ConstantSet.cs index 6601470..5355657 100644 --- a/Library/Constant/ConstantSet.cs +++ b/Library/Constant/ConstantSet.cs @@ -350,7 +350,6 @@ namespace Milimoe.FunGame.Core.Library.Constant CharacterState.ActionRestricted => "角色现在行动受限", CharacterState.BattleRestricted => "角色现在战斗不能", CharacterState.SkillRestricted => "角色现在技能受限", - CharacterState.Neutral => "角色现在是无敌的", _ => "角色现在完全行动不能" }; } diff --git a/Library/Constant/TypeEnum.cs b/Library/Constant/TypeEnum.cs index b004872..2dde4c8 100644 --- a/Library/Constant/TypeEnum.cs +++ b/Library/Constant/TypeEnum.cs @@ -296,16 +296,11 @@ namespace Milimoe.FunGame.Core.Library.Constant /// 处于吟唱中 [ 战斗相关 ] [ 技能相关 ] /// Casting, - + /// /// 预释放爆发技(插队) [ 战斗相关 ] [ 技能相关 ] /// - PreCastSuperSkill, - - /// - /// 是中立单位(无敌的) [ 战斗相关 ] - /// - Neutral + PreCastSuperSkill } public enum PrimaryAttribute