添加角色状态显示

This commit is contained in:
milimoe 2025-01-02 01:10:03 +08:00
parent 1b68cc6290
commit 188316e1ef
Signed by: milimoe
GPG Key ID: 05D280912DA6C69E

View File

@ -1419,7 +1419,7 @@ namespace Milimoe.FunGame.Core.Entity
/// 获取角色的简略信息
/// </summary>
/// <returns></returns>
public string GetSimpleInfo(bool showUser = true, bool showGrowth = true, bool showEXP = false)
public string GetSimpleInfo(bool showUser = true, bool showGrowth = true, bool showEXP = false, bool showBasicOnly = false)
{
StringBuilder builder = new();
@ -1442,74 +1442,84 @@ namespace Milimoe.FunGame.Core.Entity
MDF.Bright + MDF.Shadow + MDF.Element + MDF.Fleabane + MDF.Particle) / 9) * 100;
if (Calculation.IsApproximatelyZero(mdf)) mdf = 0;
builder.AppendLine($"魔法抗性:{mdf:0.##}%(平均)");
double exSPD = AGI * General.GameplayEquilibriumConstant.AGItoSPDMultiplier + ExSPD;
builder.AppendLine($"行动速度:{SPD:0.##}" + (exSPD != 0 ? $" [{InitialSPD:0.##} {(exSPD >= 0 ? "+" : "-")} {Math.Abs(exSPD):0.##}]" : "") + $" ({ActionCoefficient * 100:0.##}%)");
builder.AppendLine($"核心属性:{CharacterSet.GetPrimaryAttributeName(PrimaryAttribute)}");
double exSTR = ExSTR + ExSTR2;
builder.AppendLine($"力量:{STR:0.##}" + (exSTR != 0 ? $" [{BaseSTR:0.##} {(exSTR >= 0 ? "+" : "-")} {Math.Abs(exSTR):0.##}]" : "") + (showGrowth ? $"{(STRGrowth >= 0 ? "+" : "-")}{Math.Abs(STRGrowth)}/Lv" : ""));
double exAGI = ExAGI + ExAGI2;
builder.AppendLine($"敏捷:{AGI:0.##}" + (exAGI != 0 ? $" [{BaseAGI:0.##} {(exAGI >= 0 ? "+" : "-")} {Math.Abs(exAGI):0.##}]" : "") + (showGrowth ? $"{(AGIGrowth >= 0 ? "+" : "-")}{Math.Abs(AGIGrowth)}/Lv" : ""));
double exINT = ExINT + ExINT2;
builder.AppendLine($"智力:{INT:0.##}" + (exINT != 0 ? $" [{BaseINT:0.##} {(exINT >= 0 ? "+" : "-")} {Math.Abs(exINT):0.##}]" : "") + (showGrowth ? $"{(INTGrowth >= 0 ? "+" : "-")}{Math.Abs(INTGrowth)}/Lv" : ""));
if (showBasicOnly)
{
builder.AppendLine($"核心属性:{PrimaryAttributeValue:0.##}{CharacterSet.GetPrimaryAttributeName(PrimaryAttribute)}");
}
else
{
double exSPD = AGI * General.GameplayEquilibriumConstant.AGItoSPDMultiplier + ExSPD;
builder.AppendLine($"行动速度:{SPD:0.##}" + (exSPD != 0 ? $" [{InitialSPD:0.##} {(exSPD >= 0 ? "+" : "-")} {Math.Abs(exSPD):0.##}]" : "") + $" ({ActionCoefficient * 100:0.##}%)");
builder.AppendLine($"核心属性:{CharacterSet.GetPrimaryAttributeName(PrimaryAttribute)}");
double exSTR = ExSTR + ExSTR2;
builder.AppendLine($"力量:{STR:0.##}" + (exSTR != 0 ? $" [{BaseSTR:0.##} {(exSTR >= 0 ? "+" : "-")} {Math.Abs(exSTR):0.##}]" : "") + (showGrowth ? $"{(STRGrowth >= 0 ? "+" : "-")}{Math.Abs(STRGrowth)}/Lv" : ""));
double exAGI = ExAGI + ExAGI2;
builder.AppendLine($"敏捷:{AGI:0.##}" + (exAGI != 0 ? $" [{BaseAGI:0.##} {(exAGI >= 0 ? "+" : "-")} {Math.Abs(exAGI):0.##}]" : "") + (showGrowth ? $"{(AGIGrowth >= 0 ? "+" : "-")}{Math.Abs(AGIGrowth)}/Lv" : ""));
double exINT = ExINT + ExINT2;
builder.AppendLine($"智力:{INT:0.##}" + (exINT != 0 ? $" [{BaseINT:0.##} {(exINT >= 0 ? "+" : "-")} {Math.Abs(exINT):0.##}]" : "") + (showGrowth ? $"{(INTGrowth >= 0 ? "+" : "-")}{Math.Abs(INTGrowth)}/Lv" : ""));
}
builder.AppendLine($"生命回复:{HR:0.##}" + (ExHR != 0 ? $" [{InitialHR + STR * General.GameplayEquilibriumConstant.STRtoHRFactor:0.##} {(ExHR >= 0 ? "+" : "-")} {Math.Abs(ExHR):0.##}]" : ""));
builder.AppendLine($"魔法回复:{MR:0.##}" + (ExMR != 0 ? $" [{InitialMR + INT * General.GameplayEquilibriumConstant.INTtoMRFactor:0.##} {(ExMR >= 0 ? "+" : "-")} {Math.Abs(ExMR):0.##}]" : ""));
if (CharacterState != CharacterState.Actionable)
if (!showBasicOnly)
{
builder.AppendLine(CharacterSet.GetCharacterState(CharacterState));
}
if (CharacterState != CharacterState.Actionable)
{
builder.AppendLine(CharacterSet.GetCharacterState(CharacterState));
}
if (IsNeutral)
{
builder.AppendLine("角色是无敌的");
}
if (IsNeutral)
{
builder.AppendLine("角色是无敌的");
}
if (IsUnselectable)
{
builder.AppendLine("角色是不可选中的");
}
if (IsUnselectable)
{
builder.AppendLine("角色是不可选中的");
}
if (Skills.Count > 0)
{
builder.AppendLine("== 角色技能 ==");
builder.AppendLine(string.Join("", Skills.Select(s => s.Name)));
}
if (Skills.Count > 0)
{
builder.AppendLine("== 角色技能 ==");
builder.AppendLine(string.Join("", Skills.Select(s => s.Name)));
}
if (EquipSlot.Any())
{
builder.AppendLine("== 已装备槽位 ==");
List<EquipSlotType> types = [];
if (EquipSlot.MagicCardPack != null)
if (EquipSlot.Any())
{
types.Add(EquipSlotType.MagicCardPack);
builder.AppendLine("== 已装备槽位 ==");
List<EquipSlotType> types = [];
if (EquipSlot.MagicCardPack != null)
{
types.Add(EquipSlotType.MagicCardPack);
}
if (EquipSlot.Weapon != null)
{
types.Add(EquipSlotType.Weapon);
}
if (EquipSlot.Armor != null)
{
types.Add(EquipSlotType.Armor);
}
if (EquipSlot.Shoes != null)
{
types.Add(EquipSlotType.Shoes);
}
if (EquipSlot.Accessory1 != null)
{
types.Add(EquipSlotType.Accessory1);
}
if (EquipSlot.Accessory2 != null)
{
types.Add(EquipSlotType.Accessory2);
}
builder.AppendLine(string.Join("", types.Select(ItemSet.GetEquipSlotTypeName)));
}
if (EquipSlot.Weapon != null)
{
types.Add(EquipSlotType.Weapon);
}
if (EquipSlot.Armor != null)
{
types.Add(EquipSlotType.Armor);
}
if (EquipSlot.Shoes != null)
{
types.Add(EquipSlotType.Shoes);
}
if (EquipSlot.Accessory1 != null)
{
types.Add(EquipSlotType.Accessory1);
}
if (EquipSlot.Accessory2 != null)
{
types.Add(EquipSlotType.Accessory2);
}
builder.AppendLine(string.Join("", types.Select(ItemSet.GetEquipSlotTypeName)));
}
if (Effects.Where(e => e.EffectType != EffectType.Item).Any())
{
builder.AppendLine("== 状态栏 ==");
builder.Append(string.Join("", Effects.Where(e => e.EffectType != EffectType.Item).Select(e => e.Name)));
if (Effects.Where(e => e.EffectType != EffectType.Item).Any())
{
builder.AppendLine("== 状态栏 ==");
builder.Append(string.Join("", Effects.Where(e => e.EffectType != EffectType.Item).Select(e => e.Name)));
}
}
return builder.ToString();