private static SolidColorBrush GetColoringFor(ItemMod mod, int i) { if (mod.ValueColor.Count > i && i >= 0) switch (mod.ValueColor[i]) { case ItemMod.ValueColoring.LocallyAffected: return LocallyAffectedColor; case ItemMod.ValueColoring.Fire: return FireAffectedColor; case ItemMod.ValueColoring.Cold: return ColdAffectedColor; case ItemMod.ValueColoring.Lightning: return LightningAffectedColor; case ItemMod.ValueColoring.Chaos: return ChaosAffectedColor; } return Brushes.White; }
public override string ToString() { return("ItemMod: " + Mod + " {" + ItemMod.Range(Mod) + "}"); }
// Creates added damage from weapon local mod. public static Added Create(DamageSource source, ItemMod itemMod) { Match m = ReAddMod.Match(itemMod.Attribute); if (m.Success) return new Added(source, m.Groups[1].Value, itemMod.Value[0], itemMod.Value[1]); else { m = ReAddInHandMod.Match(itemMod.Attribute); if (m.Success) return new Added(source, m.Groups[1].Value, itemMod.Value[0], itemMod.Value[1]) { Hand = m.Groups[2].Value == "Main" ? WeaponHand.Main : WeaponHand.Off }; } return null; }
private static void AddAttribute(ItemMod mod, string group, ICollection<Attribute> attributes, Attribute existingAttribute) { if (existingAttribute == null) { attributes.Add(new Attribute(mod.Attribute, mod.Value, group)); } else { existingAttribute.Add(mod.Value); } }
public List<ItemMod> GetRawProperties(float quality = 0) { var props = new List<ItemMod>(); if (ItemGroup == ItemGroup.TwoHandedWeapon || ItemGroup == ItemGroup.OneHandedWeapon) { var type = ItemType; if (type == ItemType.Sceptre) type = ItemType.OneHandedMace; else if (type == ItemType.ThrustingOneHandedSword) type = ItemType.OneHandedSword; props.Add(new ItemMod(ItemType, Regex.Replace(type.ToString(), @"([a-z])([A-Z])", @"$1 $2"))); } if (quality > 0) { var qProp = new ItemMod(ItemType, "Quality: +#%"); qProp.Value.Add(quality); qProp.ValueColor.Add(ItemMod.ValueColoring.LocallyAffected); props.Add(qProp); } if (Properties != null) props.AddRange(Properties.Select(prop => prop.ToItemMod(true))); return props; }
public ItemMod Sum(ItemMod m) { return new ItemMod { IsLocal = IsLocal, Attribute = Attribute, Parent = Parent, ValueColor = ValueColor.ToList(), Value = Value.Zip(m.Value, (f1, f2) => f1 + f2).ToList() }; }