private static int GetTrueSpentExperienceValue(SimGameState sim, Pilot pilot) { var gunnery = sim.GetLevelRangeCost(1, pilot.pilotDef.SkillGunnery - 1); var piloting = sim.GetLevelRangeCost(1, pilot.pilotDef.SkillPiloting - 1); var guts = sim.GetLevelRangeCost(1, pilot.pilotDef.SkillGuts - 1); var tactics = sim.GetLevelRangeCost(1, pilot.pilotDef.SkillTactics - 1); // It's a bit dodgy to do this here... but... //"pilot_assassin" : "Decreased XP cost for leveling Gunnery." //"pilot_bookish" : "Decreased XP cost for leveling Tactics. Increased XP cost for leveling Guts." , //"pilot_klutz" : "Increased XP cost to level Piloting and a small chance to eject when knocked down.", //NB: reflects cost to reach their current levels from 1, not from where they actually started... if (pilot.pilotDef.PilotTags.Contains("pilot_assassin")) { gunnery = GetLevelRangeCostAdjusted(1, pilot.pilotDef.SkillGunnery - 1, 0.85f); Logger.Log($"Assassin gunnery: normal value would be = {sim.GetLevelRangeCost(1, pilot.pilotDef.SkillGunnery - 1)}, actual value = {gunnery}"); } if (pilot.pilotDef.PilotTags.Contains("pilot_bookish")) { tactics = GetLevelRangeCostAdjusted(1, pilot.pilotDef.SkillTactics - 1, 0.85f); Logger.Log($"Bookish tactics: normal value would be = {sim.GetLevelRangeCost(1, pilot.pilotDef.SkillTactics - 1)}, actual value = {tactics}"); guts = GetLevelRangeCostAdjusted(1, pilot.pilotDef.SkillGuts - 1, 1.15f); Logger.Log($"Bookish guts: normal value would be = {sim.GetLevelRangeCost(1, pilot.pilotDef.SkillGuts - 1)}, actual value = {guts}"); } if (pilot.pilotDef.PilotTags.Contains("pilot_klutz")) { piloting = GetLevelRangeCostAdjusted(1, pilot.pilotDef.SkillPiloting - 1, 1.15f); Logger.Log($"Klutz piloting: normal value would be = {sim.GetLevelRangeCost(1, pilot.pilotDef.SkillPiloting - 1)}, actual value = {piloting}"); } //Logger.Log($"Skill:\t{pilot.pilotDef.SkillGunnery}, {pilot.pilotDef.SkillPiloting}, {pilot.pilotDef.SkillGuts}, {pilot.pilotDef.SkillTactics}"); //Logger.Log($"Base:\t{pilot.pilotDef.BaseGunnery}, {pilot.pilotDef.BasePiloting}, {pilot.pilotDef.BaseGuts}, {pilot.pilotDef.BaseTactics}"); //Logger.Log($"Bonus:\t{pilot.pilotDef.BonusGunnery}, {pilot.pilotDef.BonusPiloting}, {pilot.pilotDef.BonusGuts}, {pilot.pilotDef.BonusTactics}"); //Logger.Log($"Spent:\t{gunnery} + {piloting} + {guts} + {tactics} = {gunnery + piloting + guts + tactics} =? {pilot.pilotDef.ExperienceSpent + pilot.pilotDef.ExperienceUnspent} = {pilot.pilotDef.ExperienceSpent} + {pilot.pilotDef.ExperienceUnspent}"); //var gunnery2 = sim.GetLevelRangeCost(pilot.pilotDef.BaseGunnery, pilot.pilotDef.SkillGunnery - 1); //var piloting2 = sim.GetLevelRangeCost(pilot.pilotDef.BasePiloting, pilot.pilotDef.SkillPiloting - 1); //var guts2 = sim.GetLevelRangeCost(pilot.pilotDef.BaseGuts, pilot.pilotDef.SkillGuts - 1); //var tactics2 = sim.GetLevelRangeCost(pilot.pilotDef.BaseTactics, pilot.pilotDef.SkillTactics - 1); //Logger.Log($"Skill/Base diff:\t{gunnery2} + {piloting2} + {guts2} + {tactics2} = {gunnery2 + piloting2 + guts2 + tactics2} =? {pilot.pilotDef.ExperienceSpent} spent"); return(gunnery + piloting + guts + tactics); }
public static void Postfix(SimGameState __instance, ref Pilot pilot) { try { PilotDef pilotDef = pilot.pilotDef.CopyToSim(); isIncreased = false; isDecreased = false; isBookish = pilot.pilotDef.PilotTags.Contains("pilot_bookish"); isKlutz = pilot.pilotDef.PilotTags.Contains("pilot_klutz"); isAssassin = pilot.pilotDef.PilotTags.Contains("pilot_assassin"); if (isBookish || isKlutz || isAssassin) { int NewXP = 0; if (pilotDef.BonusPiloting > 0) { if (isKlutz) { isIncreased = true; } else { isIncreased = false; } isDecreased = false; NewXP += __instance.GetLevelRangeCost(pilotDef.BasePiloting, pilotDef.SkillPiloting - 1); } if (pilotDef.BonusGunnery > 0) { isIncreased = false; if (isAssassin) { isDecreased = true; } else { isDecreased = false; } NewXP += __instance.GetLevelRangeCost(pilotDef.BaseGunnery, pilotDef.SkillGunnery - 1); } if (pilotDef.BonusGunnery > 0) { if (isBookish) { isIncreased = true; } else { isIncreased = false; } isDecreased = false; NewXP += __instance.GetLevelRangeCost(pilotDef.BaseGunnery, pilotDef.SkillGunnery - 1); } if (pilotDef.BonusTactics > 0) { isIncreased = false; if (isBookish) { isDecreased = true; } else { isDecreased = false; } NewXP += __instance.GetLevelRangeCost(pilotDef.BaseTactics, pilotDef.SkillTactics - 1); } int XPAdjust = NewXP - pilot.pilotDef.ExperienceUnspent; pilot.AddExperience(0, "Respec", XPAdjust); } } catch (Exception e) { Logger.LogError(e); } }