public bool TestCooldown(Common.IStatGenerator stats, SimDescription sim) { if (sim.Partner == null) { stats.IncStat("No Partner"); return(false); } else if (stats.AddScoring("Pregnancy Cooldown", TestElapsedTime <DayOfLastRomanceOption, ExpectedPregnancyScenario.MinTimeFromRomanceToPregnancyOption>(sim)) < 0) { stats.AddStat("Too Soon After Romance", GetElapsedTime <DayOfLastRomanceOption>(sim)); return(false); } else if (stats.AddScoring("Pregnancy Cooldown", TestElapsedTime <DayOfLastRomanceOption, ExpectedPregnancyScenario.MinTimeFromRomanceToPregnancyOption>(sim.Partner)) < 0) { stats.AddStat("Too Soon After Romance", GetElapsedTime <DayOfLastRomanceOption>(sim.Partner)); return(false); } else if (stats.AddScoring("New Baby Cooldown", TestElapsedTime <DayOfLastBabyOption, ExpectedPregnancyScenario.MinTimeFromBabyToPregnancyOption>(sim)) < 0) { stats.AddStat("Too Soon After Baby", GetElapsedTime <DayOfLastBabyOption>(sim)); return(false); } else if (stats.AddScoring("New Baby Cooldown", TestElapsedTime <DayOfLastBabyOption, ExpectedPregnancyScenario.MinTimeFromBabyToPregnancyOption>(sim.Partner)) < 0) { stats.AddStat("Too Soon After Baby", GetElapsedTime <DayOfLastBabyOption>(sim.Partner)); return(false); } return(true); }
public int AddScoring(string stat, int score) { if (!Common.kDebugging) { return(score); } return(mStats.AddScoring(mName + " " + stat, score)); }
public void AddScoring(string stat, Common.IStatGenerator manager) { foreach (ScorePair score in mInternalList) { manager.AddScoring(stat, score.mScore); } }
protected void SetBustMuscleSliders(SimDescription newSim) { bool changed = false; using (CASParts.OutfitBuilder builder = new CASParts.OutfitBuilder(newSim, CASParts.sPrimary)) { if (!builder.OutfitValid) { return; } if (newSim.IsFemale) { Vector2 bustRange = Manager.GetValue <BustRangeOption <TManager>, Vector2>(); if (bustRange.x != bustRange.y) { float value = RandomUtil.GetFloat(bustRange.x, bustRange.y); NormalMap.ApplyBustValue(builder.Builder, value); changed = true; mStats.AddScoring("Bust 100s", (int)(value * 100)); } } else { Vector2 muscleRange = Manager.GetValue <MuscleRangeOption <TManager>, Vector2>(); if (muscleRange.x != muscleRange.y) { float value = RandomUtil.GetFloat(muscleRange.x, muscleRange.y); NormalMap.ApplyMuscleValue(builder.Builder, value); changed = true; mStats.AddScoring("Muscle 100s", (int)(value * 100)); } } } if (changed) { new SavedOutfit.Cache(newSim).PropagateGenetics(newSim, CASParts.sPrimary); } }
protected int Add(Common.IStatGenerator stats, string scoring, SimScoringParameters parameters) { if (mMethod == null) { return(0); } int score = stats.AddScoring(scoring, mMethod.IScore(parameters)); mInternalList.Add(new ScorePair(parameters.Actor, score)); return(score); }
public bool BumpToLowerState(Common.IStatGenerator stats, SimDescription a, SimDescription b, bool story) { if (a.Partner == b) { if ((!AllowBreakup(this, a, Managers.Manager.AllowCheck.None)) || (!AllowBreakup(this, b, Managers.Manager.AllowCheck.None))) { IncStat("BumpDown: Breakup: User Denied"); stats.IncStat("BumpDown: Breakup: User Denied"); return(false); } SetElapsedTime <DayOfLastPartnerOption>(a); SetElapsedTime <DayOfLastPartnerOption>(b); try { a.Partner = null; } catch (Exception e) { Common.DebugException(a, e); } try { b.Partner = null; } catch (Exception e) { Common.DebugException(b, e); } if ((a.CreatedSim != null) && (a.CreatedSim.BuffManager != null)) { a.CreatedSim.BuffManager.RemoveElement(BuffNames.NewlyEngaged); a.CreatedSim.BuffManager.RemoveElement(BuffNames.FirstKiss); a.CreatedSim.BuffManager.RemoveElement(BuffNames.FirstRomance); a.CreatedSim.BuffManager.RemoveElement(BuffNames.JustMarried); a.CreatedSim.BuffManager.RemoveElement(BuffNames.WeddingDay); } if ((b.CreatedSim != null) && (b.CreatedSim.BuffManager != null)) { b.CreatedSim.BuffManager.RemoveElement(BuffNames.NewlyEngaged); b.CreatedSim.BuffManager.RemoveElement(BuffNames.FirstKiss); b.CreatedSim.BuffManager.RemoveElement(BuffNames.FirstRomance); b.CreatedSim.BuffManager.RemoveElement(BuffNames.JustMarried); b.CreatedSim.BuffManager.RemoveElement(BuffNames.WeddingDay); } if (story) { Stories.PrintStory(this, "Breakup", new object[] { a, b }, null); } } Relationship relation = ManagerSim.GetRelationship(a, b); if (relation != null) { LongTermRelationshipTypes currentState = relation.LTR.CurrentLTR; LongTermRelationshipTypes nextState = ChangeRelationship.NextNegativeRomanceState(currentState, relation.IsPetToPetRelationship); if (nextState != LongTermRelationshipTypes.Undefined) { float liking = relation.LTR.Liking; AddStat("BumpDown: Pre", liking); stats.AddStat("BumpDown: Pre", liking); ForceChangeState(relation, nextState); int score = AddScoring("BumpDown: Hate Loss", ScoringLookup.GetScore("HateRomanceLoss", b)); if ((SimTypes.IsSelectable(a)) || (SimTypes.IsSelectable(b)) || (stats.AddScoring("BumpDown: Hate Loss", score) <= 0)) { if (liking > relation.LTR.Liking) { try { relation.LTR.SetLiking(liking); } catch (Exception e) { Common.DebugException(a, b, e); IncStat("BumpDown: Reset Liking Fail"); stats.IncStat("BumpDown: Reset Liking Fail"); } } } AddStat("BumpDown: Post", relation.LTR.Liking); stats.AddStat("BumpDown: Post", relation.LTR.Liking); IncStat("BumpDown " + relation.LTR.CurrentLTR); stats.IncStat("BumpDown " + relation.LTR.CurrentLTR); } } return(true); }