Exemple #1
0
 private static void BeforeReadjust_ClearHistory(DynamicDifficultySystem __instance)
 {
     try {
         float[] val = __instance.BattleOutcomes.GetType().GetField("_items", NonPublic | Instance).GetValue(__instance.BattleOutcomes) as float[];
         if (val == null)
         {
             return;
         }
         Info("Resetting battle history to 1.0 from {0}", __instance.BattleOutcomes.DefaultIfEmpty(1f).Average());
         // Can't just clear the outcome, that will reset all history to 0 without removing them!
         for (int i = 0; i < val.Length; i++)
         {
             val[i] = 1f;
         }
     } catch (Exception ex) { Error(ex); }
 }
Exemple #2
0
        private static void BeforeCalculate_Readjust(DynamicDifficultySystem __instance, GeoMission mission, Dictionary <DifficultyThreatLevel, DynamicDifficultySystem.DeploymentModifier> ____deploymentModPerThreatLevel)
        {
            try {
                Info("Deploy Modifier: Min {0} Cur {1}",
                     ____deploymentModPerThreatLevel[mission.ThreatLevel].MinDeploymentModifier,
                     ____deploymentModPerThreatLevel[mission.ThreatLevel].CurrentDeploymentModifier
                     );
                ____deploymentModPerThreatLevel.Clear();

                /*
                 * typeof( DynamicDifficultySystem ).GetMethod( "SetInitialDeploymentValues", NonPublic | Instance ).Invoke( __instance, new object[]{ mission.ThreatLevel } );
                 * Info( "After recalc: Min {0} Cur {1}",
                 * ____deploymentModPerThreatLevel[ mission.ThreatLevel ].MinDeploymentModifier,
                 * ____deploymentModPerThreatLevel[ mission.ThreatLevel ].CurrentDeploymentModifier
                 * );
                 */
            } catch (Exception ex) { Error(ex); }
        }