using Fantasy.Entitas; using Fantasy.Entitas.Interface; using MongoDB.Bson.Serialization.Attributes; using MongoDB.Bson.Serialization.Options; namespace Fantasy; /// /// 代表装备的某一个属性 /// public class EquipAttr : Entity { [BsonElement("K")] public int Key; // 属性数值对应的Key [BsonElement("V")] public int Value; // 属性对应额数值 [BsonElement("S")] public int SValue; // 附加或强化属性的对应数值 [BsonIgnore] public int ValidValue => Value + SValue; // 真实的数值 } /// /// 挂载到Item下的组件,用来表示这个Item是一个装备 /// public class EquipComponent : Entity, ISupportedDataBase { /// /// 主属性 /// [BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)] public Dictionary MainAttrs = new Dictionary(); /// /// 附加(副)属性 /// [BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)] public Dictionary EntryAttrs = new Dictionary(); /// /// 词缀 /// public List Affixs = new List(); public int DurableMax; // 耐久度上限 public int Durable; // 耐久度 } /* * {"sdfsdfsdfsdf":111} * {"s":111} * 2000,100 = 150 - 50 = 100 * 2001,200 * * 优化后的处理方式 * 2000,100 ,50 = 100 + 50 = 150 * 50 - 50 = 0 , 100 + 0 = 100 * 力量 + 50 (+20) */