public float GetDynamicSkillFactor(SkillNames skill) { float multiple = 1f; bool value; if (!mRelativeSkills.TryGetValue(skill, out value)) { if (!mRelativeSkills.TryGetValue(SkillNames.None, out value)) { value = true; } } if (value) { multiple *= sRelativeFactor; } if (mApplyLifeSpanSkillFactor) { multiple *= (90f / LifeSpan.GetHumanAgeSpanLength()); } if (multiple < 0) { multiple = 0; } return(multiple); }
public void OnTimer() { try { if (StoryProgression.Main == null) { return; } Scenarios.IncStat("OnTimer Try"); if (mInTimer) { return; } mWatch.Restart(); try { mInTimer = true; mRunning = true; if (GetValue <ShowStartScreenOption, bool>()) { FilePersistence.ImportFromTuning("NRaas.StoryProgression.Tuning"); if (!GetValue <ProgressionOption, bool>()) { if (AcceptCancelDialog.Show(Localize("Welcome"))) { GetOption <ProgressionOption>().SetValue(true); new InitialHomelessScenario().Post(Households, true, false); } } } GetOption <ShowStartScreenOption>().SetValue(false); if (GetValue <ProgressionOption, bool>()) { int currentInterval = LifeSpan.GetHumanAgeSpanLength(); if (GetValue <LastAskedIntervalOption, int>() != currentInterval) { if (AcceptCancelDialog.Show(Localize("AgeSpan"))) { AdjustSpeedForAgeSpan((float)currentInterval / GetValue <SavedIntervalOption, int>()); GetOption <SavedIntervalOption>().SetValue(currentInterval); } GetOption <LastAskedIntervalOption>().SetValue(currentInterval); } } Update(false, false); } finally { mInTimer = false; } Scenarios.IncStat("OnTimer Complete"); } catch (Exception exception) { Common.Exception(UnlocalizedName, exception); } }
protected override bool PrivateUpdate(ScenarioFrame frame) { Career career = null; if (Sim.CreatedSim.CurrentInteraction is WorkInRabbitHole) { career = Sim.Occupation as Career; } else if (Sim.CreatedSim.CurrentInteraction is GoToSchoolInRabbitHole) { career = Sim.CareerManager.School; } if (career == null) { IncStat("No Career"); return(false); } if (!(career is School)) { if (career.Performance >= 100) { if (GetValue <PromoteOnTheJobOption, bool>()) { IncStat("On The Job Promote"); // Don't call PromoteSim() it does not work for raises career.PromoteIfShould(); career.ResetPerformance(); return(true); } } else if (career.Performance <= -100) { if (GetValue <PromoteOnTheJobOption, bool>()) { IncStat("On The Job Demote"); career.DemoteSim(); career.ResetPerformance(); return(true); } } } float adjustment = Event.Increment; if ((adjustment > 0) || ((adjustment < 0) && (GetValue <AlterDecreaseRateOption, bool>()))) { string active = null; if (SimTypes.IsSelectable(Sim)) { if (!GetValue <HandleActiveOption, bool>()) { IncStat("Active Denied"); return(false); } active = "Active "; } if (!Careers.Allow(this, Sim)) { // Adjust the full value of the performance } else if ((!career.IsFinalLevel) || (!GetValue <SuspendRaisesAtMaxOption, bool>())) { float scaling = GetValue <ScaledPerformanceOption, int>(); if (scaling <= 0) { scaling = 1; } if (GetValue <AdjustToAgeSpanOption, bool>()) { scaling *= (LifeSpan.GetHumanAgeSpanLength() / 90f); } float stepped = GetValue <SteppedScaledPerformanceOption, int>() / 100f; if (stepped > 0) { for (int i = 1; i < career.Level; i++) { scaling *= (1 + stepped); } } AddScoring(active + "Scaling 100s", (int)(scaling * 100)); if (scaling == 0) { adjustment = 0; } else { adjustment -= (adjustment / scaling); } if ((Math.Abs(Event.Increment) >= 0.1) && (Math.Abs(Event.Increment - adjustment) < 0.1)) { if (Event.Increment > 0) { adjustment = Event.Increment - 0.1f; } else { adjustment = Event.Increment + 0.1f; } IncStat("Performance Floor"); } } AddScoring(active + "Actual 100s", (int)(Event.Increment * 100)); AddScoring(active + "Adjustment 100s", (int)(adjustment * 100)); AddScoring(active + "Difference 100s", (int)((Event.Increment - adjustment) * 100)); career.mPerformance -= adjustment; } return(true); }