public static void Postfix(AttackDirector __instance, MessageCenterMessage message) { CustomAmmoCategoriesLog.Log.LogWrite($"Try jamm weapon\n"); while (JammingEnabler.jammQueue.Count > 0) { AbstractActor actor = JammingEnabler.jammQueue.Dequeue(); CustomAmmoCategoriesLog.Log.LogWrite($"Try jamm weapon of " + actor.DisplayName + "\n"); foreach (Weapon weapon in actor.Weapons) { CustomAmmoCategoriesLog.Log.LogWrite($" weapon " + weapon.UIName + " rounds since last fire " + weapon.roundsSinceLastFire + "\n"); if (weapon.roundsSinceLastFire > 0) { continue; } float flatJammingChance = CustomAmmoCategories.getWeaponFlatJammingChance(weapon); CustomAmmoCategoriesLog.Log.LogWrite($" flatJammingChance " + flatJammingChance + "\n"); if (flatJammingChance > CustomAmmoCategories.Epsilon) { CustomAmmoCategoriesLog.Log.LogWrite($" Try jamm weapon " + weapon.UIName + "\n"); float Roll = Random.Range(0.0f, 1.0f); CustomAmmoCategoriesLog.Log.LogWrite($" Jamming chance " + flatJammingChance + " roll " + Roll + "\n"); if (Roll < flatJammingChance) { CustomAmmoCategoriesLog.Log.LogWrite($" Jammed!\n"); CustomAmmoCategories.AddJam(actor, weapon); } } if (CustomAmmoCategories.getWeaponCooldown(weapon) > 0) { CustomAmmoCategories.AddCooldown(actor, weapon); } } } }