예제 #1
0
        public override bool IsOk(UnitEntityData target)
        {
            if (!base.IsOk(target))
            {
                return(false);
            }

            ItemEntityArmor maybeArmor = target.Body.Armor.MaybeArmor;

            if (maybeArmor == null)
            {
                return(is_light);
            }
            switch (maybeArmor.Blueprint.Type.ProficiencyGroup)
            {
            case ArmorProficiencyGroup.None:
            case ArmorProficiencyGroup.Light:
                return(is_light);

            case ArmorProficiencyGroup.Medium:
            case ArmorProficiencyGroup.Heavy:
                return(!is_light);

            case ArmorProficiencyGroup.Buckler:
            case ArmorProficiencyGroup.LightShield:
            case ArmorProficiencyGroup.HeavyShield:
            case ArmorProficiencyGroup.TowerShield:
                //UberDebug.LogWarning(target, string.Format("Shield in armor slot ({0})", target));
                return(!is_light);

            default:
                return(is_light);
            }
        }
예제 #2
0
파일: Tweaks.cs 프로젝트: ThyWoof/ToyBox
 public static void Postfix(ItemEntityArmor __instance, UnitDescriptor owner, ref bool __result)
 {
     if (settings.toggleEquipmentRestrictions)
     {
         var blueprint = __instance.Blueprint as BlueprintItemEquipment;
         __result = blueprint == null ? false : blueprint.CanBeEquippedBy(owner);
     }
 }
예제 #3
0
        static bool Prefix(ItemEntityArmor __instance, UnitDescriptor owner, ref bool __result)
        {
            BlueprintItemEquipment blueprint = __instance.Blueprint as BlueprintItemEquipment;

            if (blueprint == null || !Helpers.isBodyArmor(__instance.Blueprint))
            {
                return(true);
            }
            __result = blueprint.CanBeEquippedBy(owner);
            return(false);
        }
예제 #4
0
        static public bool hasWildEnchant(ItemEntityArmor armor)
        {
            if (armor == null)
            {
                return(false);
            }
            if (armor.EnchantmentsCollection == null)
            {
                return(false);
            }

            return(armor.EnchantmentsCollection.HasFact(Wildshape.wild_armor_enchant));
        }
        public override void OnFactActivate()
        {
            m_unlock = false;
            var unit = this.Owner;

            if (unit == null)
            {
                return;
            }

            var armor = unit.Body.Armor.MaybeArmor;

            if (armor == null)
            {
                return;
            }

            int bonus = getRemainingGroupSize() - 1;

            if (bonus < 0)
            {
                return;
            }

            if (shift_with_current_enchantment)
            {
                bonus += GameHelper.GetItemEnhancementBonus(armor);
            }

            if (bonus >= enchantments.Length)
            {
                bonus = enchantments.Length - 1;
            }

            if (armor.Enchantments.HasFact(enchantments[bonus]))
            {
                return;
            }


            m_Enchantment = armor.AddEnchantment(enchantments[bonus], Context, new Rounds?());

            armor.RecalculateStats();
            m_Armor = armor;
            if (lock_slot && !armor.IsNonRemovable)
            {
                armor.IsNonRemovable = true;
                m_unlock             = true;
            }
        }
예제 #6
0
 public static void Postfix(ItemEntityArmor __instance)
 {
     if (settings.toggleIgnoreSpeedReduction)
     {
         if (__instance.m_Modifiers != null)
         {
             __instance.m_Modifiers.ForEach(delegate(ModifiableValue.Modifier m) {
                 var appliedTo = m.AppliedTo;
                 var desc      = m.ModDescriptor;
                 if (appliedTo == __instance.Wielder.Stats.Speed && (desc == ModifierDescriptor.Shield || desc == ModifierDescriptor.Armor))
                 {
                     m.Remove();
                 }
             });
         }
     }
 }
        public override void OnFactActivate()
        {
            m_unlock = false;
            var unit = this.Owner;

            if (unit == null)
            {
                return;
            }

            var armor = unit.Body.Armor.MaybeArmor;

            if (armor == null)
            {
                return;
            }

            int bonus = value.Calculate(Context) - 1;

            if (bonus < 0)
            {
                bonus = 0;
            }
            if (bonus >= enchantments.Length)
            {
                bonus = enchantments.Length - 1;
            }

            if (armor.Enchantments.HasFact(enchantments[bonus]))
            {
                return;
            }

            m_Enchantment = armor.AddEnchantment(enchantments[bonus], Context, new Rounds?());

            armor.RecalculateStats();
            m_Armor = armor;
            if (lock_slot && !armor.IsNonRemovable)
            {
                armor.IsNonRemovable = true;
                m_unlock             = true;
            }
        }
예제 #8
0
        static void Postfix(ItemEntityArmor __instance)
        {
            if (__instance?.Wielder == null || __instance?.Owner == null || __instance?.Blueprint == null)
            {
                return;
            }

            if (__instance.Owner.Proficiencies.Contains(__instance.Blueprint.ProficiencyGroup))
            {
                return;
            }

            var tr      = Harmony12.Traverse.Create(__instance);
            int penalty = Rulebook.Trigger <RuleCalculateArmorCheckPenalty>(new RuleCalculateArmorCheckPenalty(__instance.Wielder.Unit, __instance)).Penalty;

            if (penalty < 0)
            {
                tr.Method("AddModifier", (ModifiableValue)__instance.Wielder.Stats.AdditionalAttackBonus, penalty).GetValue();
            }
        }
예제 #9
0
        static void Postfix(ItemEntityArmor __instance)
        {
            if (__instance?.Wielder == null || __instance?.Owner == null || __instance?.Blueprint == null)
            {
                return;
            }

            if (__instance.Owner.Proficiencies.Contains(__instance.Blueprint.ProficiencyGroup) ||
                !Game.Instance.Player.PartyCharacters.Any(c => c.Value == __instance?.Wielder?.Unit))    //a lot of units in the  game do not have required proficiencies, so we will consider only party members
            {
                return;
            }

            var tr      = Harmony12.Traverse.Create(__instance);
            int penalty = Rulebook.Trigger <RuleCalculateArmorCheckPenalty>(new RuleCalculateArmorCheckPenalty(__instance.Wielder.Unit, __instance)).Penalty;

            if (penalty < 0)
            {
                tr.Method("AddModifier", (ModifiableValue)__instance.Wielder.Stats.AdditionalAttackBonus, penalty).GetValue();
            }
        }