private static void GetStreakHits(AttackDirector.AttackSequence instance, ref WeaponHitInfo hitInfo, int groupIdx, int weaponIdx, Weapon weapon, float toHitChance, float prevDodgedDamage) { CustomAmmoCategoriesLog.Log.LogWrite("GetStreakHits\n"); if (hitInfo.numberOfShots == 0) { return; } ; if (AttackDirector.hitLogger.IsLogEnabled) { AttackDirector.hitLogger.Log((object)string.Format("???????? RANDOM HIT ROLLS (GetClusteredHits): Weapon Group: {0} // Weapon: {1}", (object)groupIdx, (object)weaponIdx)); } hitInfo.toHitRolls = instance.GetRandomNumbers(groupIdx, weaponIdx, hitInfo.numberOfShots); if (AttackDirector.hitLogger.IsLogEnabled) { AttackDirector.hitLogger.Log((object)string.Format("???????? RANDOM LOCATION ROLLS (GetClusteredHits): Weapon Group: {0} // Weapon: {1}", (object)groupIdx, (object)weaponIdx)); } hitInfo.locationRolls = instance.GetRandomNumbers(groupIdx, weaponIdx, hitInfo.numberOfShots); if (AttackDirector.hitLogger.IsLogEnabled) { AttackDirector.hitLogger.Log((object)string.Format("???????? DODGE ROLLS (GetClusteredHits): Weapon Group: {0} // Weapon: {1}", (object)groupIdx, (object)weaponIdx)); } hitInfo.dodgeRolls = instance.GetRandomNumbers(groupIdx, weaponIdx, hitInfo.numberOfShots); hitInfo.hitVariance = instance.GetVarianceSums(groupIdx, weaponIdx, hitInfo.numberOfShots, weapon); int previousHitLocation = 0; float originalMultiplier = 1f; float adjacentMultiplier = 1f; AbstractActor target = instance.target as AbstractActor; Team team = weapon == null || weapon.parent == null || weapon.parent.team == null ? (Team)null : weapon.parent.team; bool primeSucceeded = false; bool primeFlag = false; for (int hitIndex = 0; hitIndex < hitInfo.numberOfShots; ++hitIndex) { float corrRolls = (float)typeof(AttackDirector.AttackSequence).GetMethod("GetCorrectedRoll", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(instance, new object[2] { (object)hitInfo.toHitRolls[hitIndex], (object)team }); //bool succeeded = (double)instance.GetCorrectedRoll(hitInfo.toHitRolls[hitIndex], team) <= (double)toHitChance; bool succeeded = (double)corrRolls <= (double)toHitChance; if (team != null) { team.ProcessRandomRoll(toHitChance, succeeded); } bool flag = false; if (target != null) { flag = target.CheckDodge(instance.attacker, weapon, hitInfo, hitIndex, instance.IsBreachingShot); } if (hitIndex == 0) { primeSucceeded = succeeded; primeFlag = flag; CustomAmmoCategoriesLog.Log.LogWrite(" prime success:" + primeSucceeded + " dodge:" + primeFlag + "\n"); } if (primeSucceeded && primeFlag) { hitInfo.dodgeSuccesses[hitIndex] = true; instance.FlagAttackContainsDodge(); } else { hitInfo.dodgeSuccesses[hitIndex] = false; } if (primeSucceeded && !primeFlag) { if (previousHitLocation == 0) { previousHitLocation = instance.target.GetHitLocation(instance.attacker, instance.attackPosition, hitInfo.locationRolls[hitIndex], instance.calledShotLocation, instance.attacker.CalledShotBonusMultiplier); hitInfo.hitLocations[hitIndex] = previousHitLocation; CustomAmmoCategoriesLog.Log.LogWrite(" hitLocation:" + hitInfo.hitLocations[hitIndex] + "\n"); if (AttackDirector.attackLogger.IsLogEnabled) { AttackDirector.attackLogger.Log((object)string.Format("SEQ:{0}: WEAP:{1} SHOT:{2} Initial clustered hit! Location: {3}", (object)instance.id, (object)weaponIdx, (object)hitIndex, (object)hitInfo.hitLocations[hitIndex])); } if (AttackDirector.hitminLogger.IsLogEnabled) { AttackDirector.hitminLogger.Log((object)string.Format("WEAPON: {0} - SHOT: {1} Hits! ////// INITIAL HIT - HEX VAL {2}", (object)weapon.Name, (object)hitIndex, (object)hitInfo.hitLocations[hitIndex])); } } else { hitInfo.hitLocations[hitIndex] = instance.target.GetAdjacentHitLocation(instance.attackPosition, hitInfo.locationRolls[hitIndex], previousHitLocation, originalMultiplier, adjacentMultiplier); CustomAmmoCategoriesLog.Log.LogWrite(" hitLocation:" + hitInfo.hitLocations[hitIndex] + "\n"); if (AttackDirector.attackLogger.IsLogEnabled) { AttackDirector.attackLogger.Log((object)string.Format("SEQ:{0}: WEAP:{1} SHOT:{2} Clustered hit! Location: {3}", (object)instance.id, (object)weaponIdx, (object)hitIndex, (object)hitInfo.hitLocations[hitIndex])); } if (AttackDirector.hitminLogger.IsLogEnabled) { AttackDirector.hitminLogger.Log((object)string.Format("WEAPON: {0} - SHOT: {1} Hits! ////// CLUSTER HIT - HEX VAL {2}", (object)weapon.Name, (object)hitIndex, (object)hitInfo.hitLocations[hitIndex])); } } hitInfo.hitQualities[hitIndex] = instance.Director.Combat.ToHit.GetBlowQuality(instance.attacker, instance.attackPosition, weapon, instance.target, instance.meleeAttackType, instance.IsBreachingShot); instance.FlagShotHit(); } else { hitInfo.hitLocations[hitIndex] = 0; CustomAmmoCategoriesLog.Log.LogWrite(" hitLocation:" + hitInfo.hitLocations[hitIndex] + "\n"); if (AttackDirector.attackLogger.IsLogEnabled) { AttackDirector.attackLogger.Log((object)string.Format("SEQ:{0}: WEAP:{1} SHOT:{2} Miss!", (object)instance.id, (object)weaponIdx, (object)hitIndex, (object)hitInfo.hitLocations[hitIndex])); } if (AttackDirector.hitminLogger.IsLogEnabled) { AttackDirector.hitminLogger.Log((object)string.Format("WEAPON: {0} - SHOT: {1} Misses!", (object)weapon.Name, (object)hitIndex)); } instance.FlagShotMissed(); } hitInfo.hitPositions[hitIndex] = instance.target.GetImpactPosition(instance.attacker, instance.attackPosition, weapon, ref hitInfo.hitLocations[hitIndex]); } }