static bool getResult(RestrictionCanGatherPower __instance) { UnitPartKineticist unitPartKineticist = __instance.Owner.Get <UnitPartKineticist>(); if (unitPartKineticist == null) { return(false); } UnitBody body = __instance.Owner.Body; if (body.IsPolymorphed) { return(false); } ItemEntity maybeItem1 = body.PrimaryHand.MaybeItem; WeaponCategory?category = (maybeItem1 as ItemEntityWeapon)?.Blueprint.Category; bool flag = category.GetValueOrDefault() == WeaponCategory.KineticBlast && category.HasValue; if (maybeItem1 != null && !flag) { return(false); } ItemEntity maybeItem2 = body.SecondaryHand.MaybeItem; if (maybeItem2 == null) { return(true); } ArmorProficiencyGroup?proficiencyGroup = body.SecondaryHand.MaybeShield?.Blueprint.Type.ProficiencyGroup; if (proficiencyGroup.HasValue && (proficiencyGroup.GetValueOrDefault() != ArmorProficiencyGroup.TowerShield)) { return(unitPartKineticist.CanGatherPowerWithShield || Helpers.hasFreeHand(body.SecondaryHand)); } return(false); }
static bool Prefix(RestrictionCanGatherPower __instance, ref bool __result) { __result = getResult(__instance); return(false); }