public static void Postfix(AbstractActor unit, bool isStationary, BehaviorTreeResults __result)
 {
     CustomAmmoCategoriesLog.Log.LogWrite("Choose result for " + unit.DisplayName + "\n");
     try
     {
         if (__result.nodeState == BehaviorNodeState.Failure)
         {
             CustomAmmoCategoriesLog.Log.LogWrite("  AI choosed not attack\n");
         }
         else
         if (__result.orderInfo is AttackOrderInfo)
         {
             CustomAmmoCategoriesLog.Log.LogWrite("  AI choosed to attack " + (__result.orderInfo as AttackOrderInfo).TargetUnit.DisplayName + "\n");
             CustomAmmoCategories.ChooseBestWeaponForTarget(unit, (__result.orderInfo as AttackOrderInfo).TargetUnit, isStationary);
         }
         else
         {
             CustomAmmoCategoriesLog.Log.LogWrite("  AI choosed something else beside attaking\n");
         }
         return;
     }
     catch (Exception e)
     {
         CustomAmmoCategoriesLog.Log.LogWrite("Exception " + e.ToString() + "\nFallback to default\n");
         return;
     }
 }
 public static bool Prefix(AbstractActor unit, ICombatant target, int enemyUnitIndex, bool isStationary)
 {
     CustomAmmoCategoriesLog.Log.LogWrite(unit.DisplayName + " choosing best weapon for target " + target.DisplayName + "\n");
     try {
         CustomAmmoCategories.ChooseBestWeaponForTarget(unit, target, isStationary);
         return(true);
     } catch (Exception e) {
         CustomAmmoCategoriesLog.Log.LogWrite("Exception " + e.ToString() + "\nFallback to default\n");
         return(true);
     }
 }