更新做法

This commit is contained in:
milimoe 2025-12-23 00:23:21 +08:00
parent 2c14e7fdd2
commit 82d8f927fe
Signed by: milimoe
GPG Key ID: 9554D37E4B8991D0
3 changed files with 45 additions and 29 deletions

View File

@ -5,7 +5,7 @@ namespace Milimoe.FunGame.Core.Model.PrefabricatedEntity
/// <summary> /// <summary>
/// 继承此类以表示勇气指令技能 /// 继承此类以表示勇气指令技能
/// </summary> /// </summary>
public class CourageCommandSkill : Skill public class CourageCommandSkill(long id, string name, Dictionary<string, object> args, Character? character = null) : OpenSkill(id, name, args, character)
{ {
} }

View File

@ -6,7 +6,7 @@ namespace Milimoe.FunGame.Core.Model.PrefabricatedEntity
/// <summary> /// <summary>
/// 魔法卡包的基础实现 /// 魔法卡包的基础实现
/// </summary> /// </summary>
public class MagicCardPack : Item public class MagicCardPack : OpenItem
{ {
public override ItemType ItemType => ItemType.MagicCardPack; public override ItemType ItemType => ItemType.MagicCardPack;
@ -16,9 +16,14 @@ namespace Milimoe.FunGame.Core.Model.PrefabricatedEntity
public HashSet<Skill> Magics => Skills.Magics; public HashSet<Skill> Magics => Skills.Magics;
/// <summary> /// <summary>
/// 属性增强:增加角色额外核心属性 /// 动态矩阵:增加角色额外核心属性
/// </summary> /// </summary>
public HashSet<AttributeBoost> AttributeBoosts { get; } = []; public Dictionary<PrimaryAttribute, double> AttributeBoosts { get; } = new()
{
{ PrimaryAttribute.STR, 0 },
{ PrimaryAttribute.AGI, 0 },
{ PrimaryAttribute.INT, 0 }
};
/// <summary> /// <summary>
/// 同频共振:强制转换角色的核心属性为该属性 [ 优先级:仅在装备时改变,覆盖该时刻的核心属性,后续可被其他物品/技能覆盖 ] /// 同频共振:强制转换角色的核心属性为该属性 [ 优先级:仅在装备时改变,覆盖该时刻的核心属性,后续可被其他物品/技能覆盖 ]
@ -45,23 +50,46 @@ namespace Milimoe.FunGame.Core.Model.PrefabricatedEntity
/// </summary> /// </summary>
private PrimaryAttribute _originalAttribute = PrimaryAttribute.None; private PrimaryAttribute _originalAttribute = PrimaryAttribute.None;
protected override void OnItemEquipped(Character character, EquipSlotType type) public MagicCardPack(long id, string name, Dictionary<string, object> args) : base(id, name, args)
{ {
foreach (AttributeBoost ab in AttributeBoosts) foreach (string key in args.Keys)
{ {
switch (ab.PrimaryAttribute) switch (key.ToLower())
{ {
case PrimaryAttribute.AGI: case "exstr":
character.ExAGI += ab.Value; if (double.TryParse(args[key].ToString(), out double strValue))
{
AttributeBoosts[PrimaryAttribute.STR] = strValue;
}
break; break;
case PrimaryAttribute.INT: case "exagi":
character.ExINT += ab.Value; if (double.TryParse(args[key].ToString(), out double agiValue))
{
AttributeBoosts[PrimaryAttribute.AGI] = agiValue;
}
break; break;
default: case "exint":
character.ExSTR += ab.Value; if (double.TryParse(args[key].ToString(), out double intValue))
{
AttributeBoosts[PrimaryAttribute.INT] = intValue;
}
break;
case "res":
case "resonance":
if (Enum.TryParse(args[key].ToString(), out PrimaryAttribute resonance))
{
Resonance = resonance;
}
break; break;
} }
} }
}
protected override void OnItemEquipped(Character character, EquipSlotType type)
{
character.ExSTR += AttributeBoosts[PrimaryAttribute.STR];
character.ExAGI += AttributeBoosts[PrimaryAttribute.AGI];
character.ExINT += AttributeBoosts[PrimaryAttribute.INT];
if (Resonance != PrimaryAttribute.None) if (Resonance != PrimaryAttribute.None)
{ {
_originalAttribute = character.PrimaryAttribute; _originalAttribute = character.PrimaryAttribute;
@ -84,21 +112,9 @@ namespace Milimoe.FunGame.Core.Model.PrefabricatedEntity
protected override void OnItemUnEquipped(Character character, EquipSlotType type) protected override void OnItemUnEquipped(Character character, EquipSlotType type)
{ {
foreach (AttributeBoost ab in AttributeBoosts) character.ExSTR -= AttributeBoosts[PrimaryAttribute.STR];
{ character.ExAGI -= AttributeBoosts[PrimaryAttribute.AGI];
switch (ab.PrimaryAttribute) character.ExINT -= AttributeBoosts[PrimaryAttribute.INT];
{
case PrimaryAttribute.AGI:
character.ExAGI -= ab.Value;
break;
case PrimaryAttribute.INT:
character.ExINT -= ab.Value;
break;
default:
character.ExSTR -= ab.Value;
break;
}
}
if (_originalAttribute != PrimaryAttribute.None) if (_originalAttribute != PrimaryAttribute.None)
{ {
character.PrimaryAttribute = _originalAttribute; character.PrimaryAttribute = _originalAttribute;

View File

@ -5,7 +5,7 @@ namespace Milimoe.FunGame.Core.Model.PrefabricatedEntity
/// <summary> /// <summary>
/// 继承此类以表示灵魂绑定技能 /// 继承此类以表示灵魂绑定技能
/// </summary> /// </summary>
public class SoulboundSkill : Skill public class SoulboundSkill(long id, string name, Dictionary<string, object> args, Character? character = null) : OpenSkill(id, name, args, character)
{ {
public override bool CostAllEP => true; public override bool CostAllEP => true;
public override double MinCostEP => 100; public override double MinCostEP => 100;