public static void Postfix(ItemEntityShield __instance, UnitDescriptor owner, ref bool __result) { if (settings.toggleEquipmentRestrictions) { var blueprint = __instance.Blueprint as BlueprintItemEquipment; __result = blueprint == null ? false : blueprint.CanBeEquippedBy(owner); } }
public override void OnFactActivate() { m_unlock = false; var unit = this.Owner; if (unit == null) { return; } var shield = unit.Body.SecondaryHand.MaybeShield; if (shield == null) { return; } int bonus = value.Calculate(Context) - 1; if (bonus < 0) { bonus = 0; } if (bonus >= enchantments.Length) { bonus = enchantments.Length - 1; } if (shield.ArmorComponent.Enchantments.HasFact(enchantments[bonus])) { return; } m_Enchantment = shield.ArmorComponent.AddEnchantment(enchantments[bonus], Context, new Rounds?()); shield.ArmorComponent.RecalculateStats(); m_Shield = shield; if (lock_slot && !shield.IsNonRemovable) { shield.IsNonRemovable = true; m_unlock = true; } }