diff --git a/Api/Utility/General.cs b/Api/Utility/General.cs
index dd7355a..d9c86b3 100644
--- a/Api/Utility/General.cs
+++ b/Api/Utility/General.cs
@@ -780,7 +780,9 @@ namespace Milimoe.FunGame.Core.Api.Utility
///
public static double Round(double value, int digits)
{
- return Math.Round(value, digits, MidpointRounding.AwayFromZero);
+ value = Math.Round(value, digits, MidpointRounding.AwayFromZero);
+ if (IsApproximatelyZero(value)) value = 0;
+ return value;
}
///
diff --git a/Entity/Character/Character.cs b/Entity/Character/Character.cs
index a5c293d..8378251 100644
--- a/Entity/Character/Character.cs
+++ b/Entity/Character/Character.cs
@@ -1249,6 +1249,7 @@ namespace Milimoe.FunGame.Core.Entity
{
effect.OnAttributeChanged(this);
}
+ NormalAttack.ResolveMagicType();
}
///
@@ -1391,7 +1392,7 @@ namespace Milimoe.FunGame.Core.Entity
builder.AppendLine($"攻击力:{ATK:0.##}" + (exATK != 0 ? $" [{BaseATK:0.##} {(exATK >= 0 ? "+" : "-")} {Math.Abs(exATK):0.##}]" : ""));
double exDEF = ExDEF + ExDEF2 + ExDEF3;
builder.AppendLine($"物理护甲:{DEF:0.##}" + (exDEF != 0 ? $" [{BaseDEF:0.##} {(exDEF >= 0 ? "+" : "-")} {Math.Abs(exDEF):0.##}]" : "") + $" ({PDR * 100:0.##}%)");
- builder.AppendLine($"魔法抗性:{MDF.Avg:0.##}%(平均)");
+ builder.AppendLine(GetMagicResistanceInfo().Trim());
double exSPD = AGI * 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)}");
@@ -1443,46 +1444,12 @@ namespace Milimoe.FunGame.Core.Entity
if (EquipSlot.Any())
{
- builder.AppendLine("== 装备栏 ==");
- if (EquipSlot.MagicCardPack != null)
- {
- builder.AppendLine($"[{ItemSet.GetQualityTypeName(EquipSlot.MagicCardPack.QualityType)}]" + ItemSet.GetEquipSlotTypeName(EquipSlotType.MagicCardPack) + ":" + EquipSlot.MagicCardPack.Name);
- builder.AppendLine(EquipSlot.MagicCardPack.Description);
- }
- if (EquipSlot.Weapon != null)
- {
- builder.AppendLine($"[{ItemSet.GetQualityTypeName(EquipSlot.Weapon.QualityType)}]" + ItemSet.GetEquipSlotTypeName(EquipSlotType.Weapon) + ":" + EquipSlot.Weapon.Name);
- builder.AppendLine(EquipSlot.Weapon.Description);
- }
- if (EquipSlot.Armor != null)
- {
- builder.AppendLine($"[{ItemSet.GetQualityTypeName(EquipSlot.Armor.QualityType)}]" + ItemSet.GetEquipSlotTypeName(EquipSlotType.Armor) + ":" + EquipSlot.Armor.Name);
- builder.AppendLine(EquipSlot.Armor.Description);
- }
- if (EquipSlot.Shoes != null)
- {
- builder.AppendLine($"[{ItemSet.GetQualityTypeName(EquipSlot.Shoes.QualityType)}]" + ItemSet.GetEquipSlotTypeName(EquipSlotType.Shoes) + ":" + EquipSlot.Shoes.Name);
- builder.AppendLine(EquipSlot.Shoes.Description);
- }
- if (EquipSlot.Accessory1 != null)
- {
- builder.AppendLine($"[{ItemSet.GetQualityTypeName(EquipSlot.Accessory1.QualityType)}]" + ItemSet.GetEquipSlotTypeName(EquipSlotType.Accessory1) + ":" + EquipSlot.Accessory1.Name);
- builder.AppendLine(EquipSlot.Accessory1.Description);
- }
- if (EquipSlot.Accessory2 != null)
- {
- builder.AppendLine($"[{ItemSet.GetQualityTypeName(EquipSlot.Accessory2.QualityType)}]" + ItemSet.GetEquipSlotTypeName(EquipSlotType.Accessory2) + ":" + EquipSlot.Accessory2.Name);
- builder.AppendLine(EquipSlot.Accessory2.Description);
- }
+ builder.AppendLine(GetEquipSlotInfo().Trim());
}
if (Items.Count > 0)
{
- builder.AppendLine("== 角色背包 ==");
- foreach (Item item in Items)
- {
- builder.Append(item.ToString());
- }
+ builder.AppendLine(GetBackpackItemsInfo().Trim());
}
Effect[] effects = [.. Effects.Where(e => e.ShowInStatusBar)];
@@ -1525,7 +1492,7 @@ namespace Milimoe.FunGame.Core.Entity
builder.AppendLine($"攻击力:{ATK:0.##}" + (exATK != 0 ? $" [{BaseATK:0.##} {(exATK >= 0 ? "+" : "-")} {Math.Abs(exATK):0.##}]" : ""));
double exDEF = ExDEF + ExDEF2 + ExDEF3;
builder.AppendLine($"物理护甲:{DEF:0.##}" + (exDEF != 0 ? $" [{BaseDEF:0.##} {(exDEF >= 0 ? "+" : "-")} {Math.Abs(exDEF):0.##}]" : "") + $" ({PDR * 100:0.##}%)");
- builder.AppendLine($"魔法抗性:{MDF.Avg:0.##}%(平均)");
+ builder.AppendLine(GetMagicResistanceInfo().Trim());
if (showBasicOnly)
{
builder.AppendLine($"核心属性:{PrimaryAttributeValue:0.##}({CharacterSet.GetPrimaryAttributeName(PrimaryAttribute)})");
@@ -1774,7 +1741,7 @@ namespace Milimoe.FunGame.Core.Entity
builder.AppendLine($"攻击力:{ATK:0.##}" + (exATK != 0 ? $" [{BaseATK:0.##} {(exATK >= 0 ? "+" : "-")} {Math.Abs(exATK):0.##}]" : ""));
double exDEF = ExDEF + ExDEF2 + ExDEF3;
builder.AppendLine($"物理护甲:{DEF:0.##}" + (exDEF != 0 ? $" [{BaseDEF:0.##} {(exDEF >= 0 ? "+" : "-")} {Math.Abs(exDEF):0.##}]" : "") + $" ({PDR * 100:0.##}%)");
- builder.AppendLine($"魔法抗性:{MDF.Avg:0.##}%(平均)");
+ builder.AppendLine(GetMagicResistanceInfo().Trim());
double exSPD = AGI * 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)}");
@@ -1799,51 +1766,109 @@ namespace Milimoe.FunGame.Core.Entity
if (EquipSlot.Any())
{
- builder.AppendLine("== 装备栏 ==");
- if (EquipSlot.MagicCardPack != null)
- {
- builder.AppendLine($"[{ItemSet.GetQualityTypeName(EquipSlot.MagicCardPack.QualityType)}]" + ItemSet.GetEquipSlotTypeName(EquipSlotType.MagicCardPack) + ":" + EquipSlot.MagicCardPack.Name);
- builder.AppendLine(EquipSlot.MagicCardPack.Description);
- }
- if (EquipSlot.Weapon != null)
- {
- builder.AppendLine($"[{ItemSet.GetQualityTypeName(EquipSlot.Weapon.QualityType)}]" + ItemSet.GetEquipSlotTypeName(EquipSlotType.Weapon) + ":" + EquipSlot.Weapon.Name);
- builder.AppendLine(EquipSlot.Weapon.Description);
- }
- if (EquipSlot.Armor != null)
- {
- builder.AppendLine($"[{ItemSet.GetQualityTypeName(EquipSlot.Armor.QualityType)}]" + ItemSet.GetEquipSlotTypeName(EquipSlotType.Armor) + ":" + EquipSlot.Armor.Name);
- builder.AppendLine(EquipSlot.Armor.Description);
- }
- if (EquipSlot.Shoes != null)
- {
- builder.AppendLine($"[{ItemSet.GetQualityTypeName(EquipSlot.Shoes.QualityType)}]" + ItemSet.GetEquipSlotTypeName(EquipSlotType.Shoes) + ":" + EquipSlot.Shoes.Name);
- builder.AppendLine(EquipSlot.Shoes.Description);
- }
- if (EquipSlot.Accessory1 != null)
- {
- builder.AppendLine($"[{ItemSet.GetQualityTypeName(EquipSlot.Accessory1.QualityType)}]" + ItemSet.GetEquipSlotTypeName(EquipSlotType.Accessory1) + ":" + EquipSlot.Accessory1.Name);
- builder.AppendLine(EquipSlot.Accessory1.Description);
- }
- if (EquipSlot.Accessory2 != null)
- {
- builder.AppendLine($"[{ItemSet.GetQualityTypeName(EquipSlot.Accessory2.QualityType)}]" + ItemSet.GetEquipSlotTypeName(EquipSlotType.Accessory2) + ":" + EquipSlot.Accessory2.Name);
- builder.AppendLine(EquipSlot.Accessory2.Description);
- }
+ builder.AppendLine(GetEquipSlotInfo().Trim());
}
if (Items.Count > 0)
{
- builder.AppendLine("== 角色背包 ==");
- foreach (Item item in Items)
+ builder.AppendLine(GetBackpackItemsInfo().Trim());
+ }
+
+ return builder.ToString();
+ }
+
+ ///
+ /// 获取角色装备栏信息
+ ///
+ ///
+ public string GetEquipSlotInfo()
+ {
+ StringBuilder builder = new();
+
+ builder.AppendLine("== 装备栏 ==");
+ if (EquipSlot.MagicCardPack != null)
+ {
+ builder.AppendLine($"[{ItemSet.GetQualityTypeName(EquipSlot.MagicCardPack.QualityType)}]" + ItemSet.GetEquipSlotTypeName(EquipSlotType.MagicCardPack) + ":" + EquipSlot.MagicCardPack.Name);
+ builder.AppendLine(EquipSlot.MagicCardPack.Description);
+ }
+ if (EquipSlot.Weapon != null)
+ {
+ builder.AppendLine($"[{ItemSet.GetQualityTypeName(EquipSlot.Weapon.QualityType)}]" + ItemSet.GetEquipSlotTypeName(EquipSlotType.Weapon) + ":" + EquipSlot.Weapon.Name);
+ builder.AppendLine(EquipSlot.Weapon.Description);
+ }
+ if (EquipSlot.Armor != null)
+ {
+ builder.AppendLine($"[{ItemSet.GetQualityTypeName(EquipSlot.Armor.QualityType)}]" + ItemSet.GetEquipSlotTypeName(EquipSlotType.Armor) + ":" + EquipSlot.Armor.Name);
+ builder.AppendLine(EquipSlot.Armor.Description);
+ }
+ if (EquipSlot.Shoes != null)
+ {
+ builder.AppendLine($"[{ItemSet.GetQualityTypeName(EquipSlot.Shoes.QualityType)}]" + ItemSet.GetEquipSlotTypeName(EquipSlotType.Shoes) + ":" + EquipSlot.Shoes.Name);
+ builder.AppendLine(EquipSlot.Shoes.Description);
+ }
+ if (EquipSlot.Accessory1 != null)
+ {
+ builder.AppendLine($"[{ItemSet.GetQualityTypeName(EquipSlot.Accessory1.QualityType)}]" + ItemSet.GetEquipSlotTypeName(EquipSlotType.Accessory1) + ":" + EquipSlot.Accessory1.Name);
+ builder.AppendLine(EquipSlot.Accessory1.Description);
+ }
+ if (EquipSlot.Accessory2 != null)
+ {
+ builder.AppendLine($"[{ItemSet.GetQualityTypeName(EquipSlot.Accessory2.QualityType)}]" + ItemSet.GetEquipSlotTypeName(EquipSlotType.Accessory2) + ":" + EquipSlot.Accessory2.Name);
+ builder.AppendLine(EquipSlot.Accessory2.Description);
+ }
+
+ return builder.ToString();
+ }
+
+ ///
+ /// 获取角色背包信息
+ ///
+ ///
+ public string GetBackpackItemsInfo()
+ {
+ StringBuilder builder = new();
+
+ builder.AppendLine("== 角色背包 ==");
+ foreach (Item item in Items)
+ {
+ builder.AppendLine($"[{ItemSet.GetQualityTypeName(item.QualityType)}]" + ItemSet.GetItemTypeName(item.ItemType) + ":" + item.Name);
+ builder.AppendLine(item.Description);
+ if (item.Skills.Active != null)
{
- builder.Append(item.ToString());
+ Skill skill = item.Skills.Active;
+ List strings = [];
+ if (skill.RealMPCost > 0) strings.Add($"魔法消耗:{skill.RealMPCost}");
+ if (skill.RealEPCost > 0) strings.Add($"能量消耗:{skill.RealEPCost}");
+ if (skill.RealCD > 0) strings.Add($"冷却时间:{skill.RealCD}{(skill.CurrentCD > 0 ? $"(正在冷却:剩余 {skill.CurrentCD} {GameplayEquilibriumConstant.InGameTime})" : "")}");
+ if (skill.RealHardnessTime > 0) strings.Add($"硬直时间:{skill.RealHardnessTime}");
+ builder.AppendLine($"技能【{skill.Name}】描述:{skill.Description.Trim()}{(strings.Count > 0 ? $"({string.Join(";", strings)})" : "")}");
}
}
return builder.ToString();
}
+ ///
+ /// 获取魔法抗性信息
+ ///
+ ///
+ public string GetMagicResistanceInfo()
+ {
+ StringBuilder builder = new();
+
+ if (GameplayEquilibriumConstant.UseMagicType.Count > 0)
+ {
+ foreach (MagicType magicType in GameplayEquilibriumConstant.UseMagicType)
+ {
+ builder.Append(CharacterSet.GetMagicResistanceName(magicType));
+ builder.AppendLine($":{Calculation.Round4Digits(MDF[magicType] * 100):0.##}%");
+ }
+ }
+ else builder.AppendLine($"魔法抗性:{Calculation.Round4Digits(MDF.Avg * 100):0.##}%(平均)");
+
+ return builder.ToString();
+ }
+
///
/// 更新角色的状态,参见 、 用法
///
diff --git a/Entity/Character/CharacterBuilder.cs b/Entity/Character/CharacterBuilder.cs
index d3e8907..106def0 100644
--- a/Entity/Character/CharacterBuilder.cs
+++ b/Entity/Character/CharacterBuilder.cs
@@ -252,7 +252,10 @@ namespace Milimoe.FunGame.Core.Entity
character.EXP = reference.EXP;
}
character.NormalAttack.Level = reference.NormalAttack.Level;
- character.NormalAttack.HardnessTime = reference.NormalAttack.HardnessTime;
+ character.NormalAttack.ExDamage = reference.NormalAttack.ExDamage;
+ character.NormalAttack.ExDamage2 = reference.NormalAttack.ExDamage2;
+ character.NormalAttack.ExHardnessTime = reference.NormalAttack.ExHardnessTime;
+ character.NormalAttack.ExHardnessTime2 = reference.NormalAttack.ExHardnessTime2;
character.NormalAttack.SetMagicType(reference.NormalAttack.IsMagic, reference.NormalAttack.MagicType);
if (!recovery)
{
diff --git a/Entity/Character/MagicResistance.cs b/Entity/Character/MagicResistance.cs
index fb7c95b..18fb28e 100644
--- a/Entity/Character/MagicResistance.cs
+++ b/Entity/Character/MagicResistance.cs
@@ -60,7 +60,7 @@ namespace Milimoe.FunGame.Core.Entity
{
get
{
- double mdf = Calculation.Round4Digits((None + Starmark + PurityNatural + PurityContemporary + Bright + Shadow + Element + Aster + SpatioTemporal) / 9) * 100;
+ double mdf = Calculation.Round4Digits((None + Starmark + PurityNatural + PurityContemporary + Bright + Shadow + Element + Aster + SpatioTemporal) / 9);
if (Calculation.IsApproximatelyZero(mdf)) mdf = 0;
return mdf;
}
@@ -123,39 +123,6 @@ namespace Milimoe.FunGame.Core.Entity
}
}
- ///
- /// 对所有抗性赋值
- ///
- ///
- ///
- public void SetAllValue(double value, bool assignment = true)
- {
- if (assignment)
- {
- None = value;
- SpatioTemporal = value;
- Aster = value;
- Element = value;
- Shadow = value;
- Bright = value;
- PurityContemporary = value;
- PurityNatural = value;
- Starmark = value;
- }
- else
- {
- None += value;
- SpatioTemporal += value;
- Aster += value;
- Element += value;
- Shadow += value;
- Bright += value;
- PurityContemporary += value;
- PurityNatural += value;
- Starmark += value;
- }
- }
-
///
/// 增加所有抗性,传入负数来减少
///
@@ -163,14 +130,14 @@ namespace Milimoe.FunGame.Core.Entity
public void AddAllValue(double value)
{
None += value;
- SpatioTemporal += value;
- Aster += value;
- Element += value;
- Shadow += value;
- Bright += value;
- PurityContemporary += value;
- PurityNatural += value;
Starmark += value;
+ PurityNatural += value;
+ PurityContemporary += value;
+ Element += value;
+ Bright += value;
+ Shadow += value;
+ Aster += value;
+ SpatioTemporal += value;
}
///
diff --git a/Entity/Item/Item.cs b/Entity/Item/Item.cs
index e79f401..0358da2 100644
--- a/Entity/Item/Item.cs
+++ b/Entity/Item/Item.cs
@@ -176,18 +176,10 @@ namespace Milimoe.FunGame.Core.Entity
foreach (Skill skill in Skills.Passives)
{
skill.Character = _character;
- foreach (Effect e in skill.Effects)
- {
- e.Source = _character;
- }
}
foreach (Skill skill in Skills.Magics)
{
skill.Character = _character;
- foreach (Effect e in skill.Effects)
- {
- e.Source = _character;
- }
}
}
}
diff --git a/Entity/Skill/NormalAttack.cs b/Entity/Skill/NormalAttack.cs
index e0f13f9..eb3551a 100644
--- a/Entity/Skill/NormalAttack.cs
+++ b/Entity/Skill/NormalAttack.cs
@@ -16,22 +16,74 @@ namespace Milimoe.FunGame.Core.Entity
///
/// 普通攻击说明
///
- public string Description => $"对目标敌人造成 {(1.0 + 0.05 * (Level - 1)) * 100:0.##}% 攻击力 [ {Damage:0.##} ] 点{(IsMagic ? CharacterSet.GetMagicDamageName(MagicType) : "物理伤害")}。";
+ public string Description => $"对目标敌人造成 {BaseDamageMultiplier * 100:0.##}% 攻击力 [ {Damage:0.##} ] 点{(IsMagic ? CharacterSet.GetMagicDamageName(MagicType) : "物理伤害")}。";
///
/// 普通攻击的通用说明
///
- public string GeneralDescription => $"对目标敌人造成基于 100(+5/Lv)% 攻击力的{(IsMagic ? CharacterSet.GetMagicDamageName(MagicType) : "物理伤害")}。";
+ public string GeneralDescription => $"对目标敌人造成基于总攻击力的{(IsMagic ? CharacterSet.GetMagicDamageName(MagicType) : "物理伤害")}。";
///
/// 所属的角色
///
public Character Character { get; } = character;
+ ///
+ /// 基础普通攻击伤害倍率 [ 武器类型相关 ]
+ ///
+ private double BaseDamageMultiplier
+ {
+ get
+ {
+ double baseMultiplier = 1.0 + 0.05 * (Level - 1);
+ if (Character.EquipSlot.Weapon != null)
+ {
+ baseMultiplier = Character.EquipSlot.Weapon.WeaponType switch
+ {
+ WeaponType.OneHandedSword => 1.0,
+ WeaponType.TwoHandedSword => 1.2,
+ WeaponType.Bow => 0.9,
+ WeaponType.Pistol => 0.8,
+ WeaponType.Rifle => 1.1,
+ WeaponType.DualDaggers => 0.85,
+ WeaponType.Talisman => 1.0,
+ WeaponType.Staff => 1.15,
+ WeaponType.Polearm => 0.95,
+ WeaponType.Gauntlet => 1.05,
+ WeaponType.HiddenWeapon => 0.9,
+ _ => 1.0
+ };
+ double levelBonus = Character.EquipSlot.Weapon.WeaponType switch
+ {
+ WeaponType.TwoHandedSword => 0.06,
+ WeaponType.Staff => 0.056,
+ WeaponType.Bow => 0.045,
+ WeaponType.Pistol => 0.0375,
+ WeaponType.DualDaggers => 0.0375,
+ WeaponType.Polearm => 0.044,
+ WeaponType.HiddenWeapon => 0.044,
+ _ => 0.05
+ };
+ baseMultiplier += levelBonus * (Level - 1);
+ }
+ return baseMultiplier;
+ }
+ }
+
///
/// 普通攻击的伤害
///
- public double Damage => Character.ATK * (1.0 + 0.05 * (Level - 1));
+ public double Damage => Character.ATK * BaseDamageMultiplier * (1 + ExDamage2) + ExDamage;
+
+ ///
+ /// 额外普通攻击伤害 [ 技能和物品相关 ]
+ ///
+ public double ExDamage { get; set; } = 0;
+
+ ///
+ /// 额外普通攻击伤害% [ 技能和物品相关 ]
+ ///
+ public double ExDamage2 { get; set; } = 0;
///
/// 普通攻击等级
@@ -74,9 +126,44 @@ namespace Milimoe.FunGame.Core.Entity
public ImmuneType IgnoreImmune { get; set; } = ImmuneType.None;
///
- /// 硬直时间
+ /// 硬直时间 [ 武器类型相关 ]
///
- public double HardnessTime { get; set; } = 10;
+ public double HardnessTime
+ {
+ get
+ {
+ double ht = 10;
+ if (Character.EquipSlot.Weapon != null)
+ {
+ ht = Character.EquipSlot.Weapon.WeaponType switch
+ {
+ WeaponType.OneHandedSword => 8,
+ WeaponType.TwoHandedSword => 12,
+ WeaponType.Bow => 9,
+ WeaponType.Pistol => 6,
+ WeaponType.Rifle => 11,
+ WeaponType.DualDaggers => 7,
+ WeaponType.Talisman => 10,
+ WeaponType.Staff => 12,
+ WeaponType.Polearm => 10,
+ WeaponType.Gauntlet => 8,
+ WeaponType.HiddenWeapon => 7,
+ _ => 10,
+ };
+ }
+ return ht * (1 + ExHardnessTime2) + ExHardnessTime;
+ }
+ }
+
+ ///
+ /// 额外硬直时间 [ 技能和物品相关 ]
+ ///
+ public double ExHardnessTime { get; set; } = 0;
+
+ ///
+ /// 额外硬直时间% [ 技能和物品相关 ]
+ ///
+ public double ExHardnessTime2 { get; set; } = 0;
///
/// 实际硬直时间
@@ -133,6 +220,11 @@ namespace Milimoe.FunGame.Core.Entity
///
public double CurrentCD => 0;
+ ///
+ /// 绑定到特效的普通攻击扩展。键为特效,值为对应的普攻扩展对象。
+ ///
+ public Dictionary NormalAttackOfEffects { get; } = [];
+
///
/// 获取可选择的目标列表
///
@@ -177,7 +269,7 @@ namespace Milimoe.FunGame.Core.Entity
{
if (enemy.HP > 0)
{
- queue.WriteLine("[ " + Character + $" ] 对 [ {enemy} ] 发起了普通攻击!");
+ queue.WriteLine($"[ {Character} ] 对 [ {enemy} ] 发起了普通攻击!");
double expected = Damage;
int changeCount = 0;
DamageResult result = IsMagic ? queue.CalculateMagicalDamage(attacker, enemy, true, MagicType, expected, out double damage, ref changeCount) : queue.CalculatePhysicalDamage(attacker, enemy, true, expected, out damage, ref changeCount);
@@ -187,14 +279,81 @@ namespace Milimoe.FunGame.Core.Entity
}
///
- /// 修改伤害类型
+ /// 修改基础伤害类型。不一定转换成功,要看是否有特效覆盖
///
///
///
- public void SetMagicType(bool isMagic, MagicType magicType)
+ ///
+ public void SetMagicType(bool? isMagic, MagicType? magicType = null, IGamingQueue? queue = null)
{
- _IsMagic = isMagic;
- _MagicType = magicType;
+ _ExIsMagic = isMagic;
+ if (isMagic.HasValue && isMagic.Value)
+ {
+ magicType ??= MagicType.None;
+ }
+ _ExMagicType = magicType;
+ ResolveMagicType(queue);
+ }
+
+ ///
+ /// 修改伤害类型。不一定转换成功,要看是否有其他特效覆盖
+ ///
+ ///
+ ///
+ public void SetMagicType(NormalAttackOfEffect naoe, IGamingQueue? queue = null)
+ {
+ NormalAttackOfEffects[naoe.Effect] = naoe;
+ ResolveMagicType(queue);
+ }
+
+ ///
+ /// 移除特效对伤害类型的更改
+ ///
+ ///
+ ///
+ public void UnsetMagicType(Effect effect, IGamingQueue? queue = null)
+ {
+ NormalAttackOfEffects.Remove(effect);
+ ResolveMagicType(queue);
+ }
+
+ ///
+ /// 计算是否是魔法伤害和当前的魔法类型
+ ///
+ internal void ResolveMagicType(IGamingQueue? queue = null)
+ {
+ bool past = _IsMagic;
+ MagicType pastType = _MagicType;
+ if (NormalAttackOfEffects.Count > 0)
+ {
+ if (NormalAttackOfEffects.Values.OrderByDescending(n => n.Priority).FirstOrDefault() is NormalAttackOfEffect naoe)
+ {
+ _IsMagic = naoe.IsMagic;
+ _MagicType = naoe.MagicType;
+ }
+ }
+ else if (_ExIsMagic.HasValue && _ExMagicType.HasValue)
+ {
+ _IsMagic = _ExIsMagic.Value;
+ _MagicType = _ExMagicType.Value;
+ }
+ else
+ {
+ _IsMagic = false;
+ _MagicType = MagicType.None;
+ if (Character.EquipSlot.Weapon != null)
+ {
+ WeaponType type = Character.EquipSlot.Weapon.WeaponType;
+ if (type == WeaponType.Talisman || type == WeaponType.Staff)
+ {
+ _IsMagic = true;
+ }
+ }
+ }
+ if (queue != null && (past != _IsMagic || pastType != _MagicType))
+ {
+ queue.WriteLine($"[ {Character} ] 的普通攻击类型已转变为:{(_IsMagic ? CharacterSet.GetMagicDamageName(_MagicType) : "物理伤害")}!");
+ }
}
///
@@ -235,13 +394,34 @@ namespace Milimoe.FunGame.Core.Entity
private int _Level = 0;
///
- /// 是否是魔法伤害
+ /// 是否是魔法伤害 [ 生效型 ]
///
private bool _IsMagic = isMagic;
///
- /// 魔法类型
+ /// 魔法类型 [ 生效型 ]
///
private MagicType _MagicType = magicType;
+
+ ///
+ /// 是否是魔法伤害 [ 修改型 ]
+ ///
+ private bool? _ExIsMagic = null;
+
+ ///
+ /// 魔法类型 [ 修改型 ]
+ ///
+ private MagicType? _ExMagicType = null;
+ }
+
+ ///
+ /// 绑定到特效的普通攻击扩展。这个类没有 JSON 转换器支持。
+ ///
+ public class NormalAttackOfEffect(Effect effect, bool isMagic, MagicType type, int priority)
+ {
+ public Effect Effect { get; set; } = effect;
+ public bool IsMagic { get; set; } = isMagic;
+ public MagicType MagicType { get; set; } = type;
+ public int Priority { get; set; } = priority;
}
}
diff --git a/Entity/Skill/Skill.cs b/Entity/Skill/Skill.cs
index d51adf5..d4f9fd1 100644
--- a/Entity/Skill/Skill.cs
+++ b/Entity/Skill/Skill.cs
@@ -481,39 +481,39 @@ namespace Milimoe.FunGame.Core.Entity
{
if (RealMPCost > 0)
{
- builder.AppendLine($"魔法消耗:{RealMPCost:0.##}{(showOriginal && RealMPCost != MPCost ? $"(原始值:{MPCost})" : "")}");
+ builder.AppendLine($"魔法消耗:{RealMPCost:0.##}{(showOriginal && RealMPCost != MPCost ? $"(原始值:{MPCost:0.##})" : "")}");
}
if (RealEPCost > 0)
{
- builder.AppendLine($"能量消耗:{RealEPCost:0.##}{(showOriginal && RealEPCost != EPCost ? $"(原始值:{EPCost})" : "")}");
+ builder.AppendLine($"能量消耗:{RealEPCost:0.##}{(showOriginal && RealEPCost != EPCost ? $"(原始值:{EPCost:0.##})" : "")}");
}
}
else
{
if (IsSuperSkill)
{
- builder.AppendLine($"能量消耗:{RealEPCost:0.##}{(showOriginal && RealEPCost != EPCost ? $"(原始值:{EPCost})" : "")}");
+ builder.AppendLine($"能量消耗:{RealEPCost:0.##}{(showOriginal && RealEPCost != EPCost ? $"(原始值:{EPCost:0.##})" : "")}");
}
else
{
if (IsMagic)
{
- builder.AppendLine($"魔法消耗:{RealMPCost:0.##}{(showOriginal && RealMPCost != MPCost ? $"(原始值:{MPCost})" : "")}");
- builder.AppendLine($"吟唱时间:{RealCastTime:0.##}{(showOriginal && RealCastTime != CastTime ? $"(原始值:{CastTime})" : "")}");
+ builder.AppendLine($"魔法消耗:{RealMPCost:0.##}{(showOriginal && RealMPCost != MPCost ? $"(原始值:{MPCost:0.##})" : "")}");
+ builder.AppendLine($"吟唱时间:{RealCastTime:0.##}{(showOriginal && RealCastTime != CastTime ? $"(原始值:{CastTime:0.##})" : "")}");
}
else
{
- builder.AppendLine($"能量消耗:{RealEPCost:0.##}{(showOriginal && RealEPCost != EPCost ? $"(原始值:{EPCost})" : "")}");
+ builder.AppendLine($"能量消耗:{RealEPCost:0.##}{(showOriginal && RealEPCost != EPCost ? $"(原始值:{EPCost:0.##})" : "")}");
}
}
}
if (showCD && CD > 0)
{
- builder.AppendLine($"冷却时间:{RealCD:0.##}{(showOriginal && RealCD != CD ? $"(原始值:{CD})" : "")}");
+ builder.AppendLine($"冷却时间:{RealCD:0.##}{(showOriginal && RealCD != CD ? $"(原始值:{CD:0.##})" : "")}");
}
if (showHardness && HardnessTime > 0)
{
- builder.AppendLine($"硬直时间:{RealHardnessTime:0.##}{(showOriginal && RealHardnessTime != HardnessTime ? $"(原始值:{HardnessTime})" : "")}");
+ builder.AppendLine($"硬直时间:{RealHardnessTime:0.##}{(showOriginal && RealHardnessTime != HardnessTime ? $"(原始值:{HardnessTime:0.##})" : "")}");
}
}
diff --git a/Library/Common/JsonConverter/CharacterConverter.cs b/Library/Common/JsonConverter/CharacterConverter.cs
index ae0c545..bb33128 100644
--- a/Library/Common/JsonConverter/CharacterConverter.cs
+++ b/Library/Common/JsonConverter/CharacterConverter.cs
@@ -218,7 +218,10 @@ namespace Milimoe.FunGame.Core.Library.Common.JsonConverter
case nameof(Character.NormalAttack):
NormalAttack normalAttack = NetworkUtility.JsonDeserialize(ref reader, options) ?? new NormalAttack(result);
result.NormalAttack.Level = normalAttack.Level;
- result.NormalAttack.HardnessTime = normalAttack.HardnessTime;
+ result.NormalAttack.ExDamage = normalAttack.ExDamage;
+ result.NormalAttack.ExDamage2 = normalAttack.ExDamage2;
+ result.NormalAttack.ExHardnessTime = normalAttack.ExHardnessTime;
+ result.NormalAttack.ExHardnessTime2 = normalAttack.ExHardnessTime2;
result.NormalAttack.SetMagicType(normalAttack.IsMagic, normalAttack.MagicType);
break;
case nameof(Character.Skills):
diff --git a/Library/Common/JsonConverter/NormalAttackConverter.cs b/Library/Common/JsonConverter/NormalAttackConverter.cs
index 7446b02..6e8f3c0 100644
--- a/Library/Common/JsonConverter/NormalAttackConverter.cs
+++ b/Library/Common/JsonConverter/NormalAttackConverter.cs
@@ -20,8 +20,17 @@ namespace Milimoe.FunGame.Core.Library.Common.JsonConverter
case nameof(NormalAttack.Level):
result.Level = reader.GetInt32();
break;
- case nameof(NormalAttack.HardnessTime):
- result.HardnessTime = reader.GetDouble();
+ case nameof(NormalAttack.ExDamage):
+ result.ExDamage = reader.GetDouble();
+ break;
+ case nameof(NormalAttack.ExDamage2):
+ result.ExDamage2 = reader.GetDouble();
+ break;
+ case nameof(NormalAttack.ExHardnessTime):
+ result.ExHardnessTime = reader.GetDouble();
+ break;
+ case nameof(NormalAttack.ExHardnessTime2):
+ result.ExHardnessTime2 = reader.GetDouble();
break;
case nameof(NormalAttack.IsMagic):
result.SetMagicType(reader.GetBoolean(), result.MagicType);
diff --git a/Model/EquilibriumConstant.cs b/Model/EquilibriumConstant.cs
index df23e83..53fdd74 100644
--- a/Model/EquilibriumConstant.cs
+++ b/Model/EquilibriumConstant.cs
@@ -1,4 +1,5 @@
using Milimoe.FunGame.Core.Entity;
+using Milimoe.FunGame.Core.Library.Constant;
namespace Milimoe.FunGame.Core.Model
{
@@ -37,6 +38,14 @@ namespace Milimoe.FunGame.Core.Model
{ "E", 200 },
};
+ ///
+ /// 使用的魔法类型
+ ///
+ public HashSet UseMagicType { get; set; } = [
+ MagicType.None, MagicType.Starmark, MagicType.PurityNatural, MagicType.PurityContemporary,
+ MagicType.Element, MagicType.Bright, MagicType.Shadow, MagicType.Aster, MagicType.SpatioTemporal
+ ];
+
///
/// 初始生命值
///
diff --git a/Model/GamingQueue.cs b/Model/GamingQueue.cs
index 30ddd51..8490984 100644
--- a/Model/GamingQueue.cs
+++ b/Model/GamingQueue.cs
@@ -471,6 +471,7 @@ namespace Milimoe.FunGame.Core.Model
{
FirstKiller = null;
CustomData.Clear();
+ _allCharacter.Clear();
_original.Clear();
_queue.Clear();
_hardnessTimes.Clear();