示例#1
0
 public static bool Prefix(ToHit __instance, int evasivePips, Weapon weapon, ref float __result)
 {
     //CustomAmmoCategoriesLog.Log.LogWrite("ToHit.GetEvasivePipsModifier");
     try
     {
         float num = 0.0f;
         if (evasivePips > 0)
         {
             int index = Mathf.RoundToInt((float)((double)evasivePips - 1.0 - (weapon == null ? 0.0 : (double)(CustomAmmoCategories.getWeaponEvasivePipsIgnored(weapon)))));
             if (index > -1)
             {
                 CombatGameState combat = (CombatGameState)typeof(ToHit).GetField("combat", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(__instance);
                 num += combat.Constants.ToHit.ToHitMovingPipUMs[index];
             }
         }
         __result = num;
         return(false);
     }
     catch (Exception e)
     {
         CustomAmmoCategoriesLog.Log.LogWrite("Exception " + e.ToString() + "\nFallback to default\n");
         return(true);
     }
 }