public override float Calculate(Pawn observer, Pawn assessed) { XenoRomanceExtension observerXenoRomance = observer.def.GetModExtension <XenoRomanceExtension>(); XenoRomanceExtension assessedXenoRomance = assessed.def.GetModExtension <XenoRomanceExtension>(); float extraspeciesAppeal = assessedXenoRomance.extraspeciesAppeal; if (extraspeciesAppeal <= 0) { return(0f); } if (extraspeciesAppeal >= 1) { return(1f); } float xenoFactor = extraspeciesAppeal; if (observerXenoRomance.faceCategory != assessedXenoRomance.faceCategory) { xenoFactor *= extraspeciesAppeal; } if (observerXenoRomance.bodyCategory != assessedXenoRomance.bodyCategory) { xenoFactor *= extraspeciesAppeal; } if (observerXenoRomance.mindCategory != assessedXenoRomance.mindCategory) { xenoFactor *= extraspeciesAppeal; } return(xenoFactor); }
public override float Calculate(Pawn observer, Pawn assessed) { if (GradualRomanceMod.extraspeciesRomance == GradualRomanceMod.ExtraspeciesRomanceSetting.NoXenoRomance || ModHooks.IsXenophobe(observer)) { return(0f); } if (GradualRomanceMod.extraspeciesRomance == GradualRomanceMod.ExtraspeciesRomanceSetting.OnlyXenophiles && !ModHooks.IsXenophile(observer)) { return(0f); } if (GradualRomanceMod.extraspeciesRomance == GradualRomanceMod.ExtraspeciesRomanceSetting.CaptainKirk) { return(1f); } XenoRomanceExtension observerXenoRomance = observer.def.GetModExtension <XenoRomanceExtension>(); XenoRomanceExtension assessedXenoRomance = assessed.def.GetModExtension <XenoRomanceExtension>(); float extraspeciesAppeal = assessedXenoRomance.extraspeciesAppeal; if (extraspeciesAppeal <= 0) { return(0f); } if (extraspeciesAppeal >= 1) { return(1f); } float xenoFactor = extraspeciesAppeal; if (observerXenoRomance.faceCategory != assessedXenoRomance.faceCategory) { xenoFactor *= extraspeciesAppeal; } if (observerXenoRomance.bodyCategory != assessedXenoRomance.bodyCategory) { xenoFactor *= extraspeciesAppeal; } if (observerXenoRomance.mindCategory != assessedXenoRomance.mindCategory) { xenoFactor *= extraspeciesAppeal; } return(xenoFactor); }
public override float Calculate(Pawn observer, Pawn assessed) { XenoRomanceExtension observerExtension = observer.def.GetModExtension <XenoRomanceExtension>(); XenoRomanceExtension assessedExtension = assessed.def.GetModExtension <XenoRomanceExtension>(); float assessedMaturityPct = Mathf.Clamp01(Mathf.InverseLerp(assessedExtension.youngAdultAge, assessed.RaceProps.lifeExpectancy, assessed.ageTracker.AgeBiologicalYearsFloat)); float observerMaturityPct = Mathf.Clamp01(Mathf.InverseLerp(observerExtension.youngAdultAge, observer.RaceProps.lifeExpectancy, observer.ageTracker.AgeBiologicalYearsFloat)); float observerAgeTolerance = GenMath.LerpDoubleClamped(observerExtension.youngAdultAge, observerExtension.midlifeAge, observerExtension.minimumAgeDeviation, observerExtension.maximumAgeDeviation, observer.ageTracker.AgeBiologicalYearsFloat); float ageTolerancePct = (observerAgeTolerance / observer.RaceProps.lifeExpectancy); float ageDifference = Mathf.Abs(observerMaturityPct - assessedMaturityPct); return(Mathf.Clamp01(Mathf.Pow(ageTolerancePct / ageDifference, ageDeviationDampener))); //People are generally attracted to members of their own age group. //For young pawns, this is very significant. //As pawns get older, age is less of a factor. /* * float observerAge = observer.ageTracker.AgeBiologicalYearsFloat; * float assessedAge = assessed.ageTracker.AgeBiologicalYearsFloat; * float ageDifference = Math.Abs(observerAge - assessedAge); * float acceptableAgeDifference = AttractionUtility.GetAgeDeviation(observer); * if (ageDifference - acceptableAgeDifference <= 0f) * { * return 1f; * } * * float ageFactor = acceptableAgeDifference / ageDifference; * * //Makes females pawns more tolerant of old age difference. * //Some people really don't like this, which is why it can be toggled off in the settings. * if (GRHelper.ShouldApplyFemaleDifference(observer.gender)) * { * if (observerAge < assessedAge) * { * ageFactor = Mathf.Pow(ageFactor, GenderedAgePreference); * } * } */ }
public static XenoRomanceExtension CreateXenoRomanceExtensionFor(ThingDef pawnType) { XenoRomanceExtension xenoRomance = new XenoRomanceExtension() { }; float maxAge = pawnType.race.lifeExpectancy; //xenoRomance.youngAdultAge = (maxAge * 0.15f); //xenoRomance.midlifeAge = (maxAge * 0.5f); //xenoRomance.subspeciesOf = null; xenoRomance.extraspeciesAppeal = 0.5f; List <LifeStageAge> lifeStageDefs = pawnType.race.lifeStageAges; float reproductiveStart = 0f; for (int i = 0; i < lifeStageDefs.Count(); i++) { if (lifeStageDefs[i].def.reproductive) { reproductiveStart = lifeStageDefs[i].minAge; } } xenoRomance.maturityByAgeCurveFemale.Add(new Vector2(0f, 0.01f)); xenoRomance.maturityByAgeCurveFemale.Add(new Vector2(reproductiveStart, 1f)); xenoRomance.maturityByAgeCurveFemale.Add(new Vector2(Mathf.Lerp(reproductiveStart, maxAge, 0.5f), 2f)); xenoRomance.maturityByAgeCurveFemale.Add(new Vector2(maxAge, 3f)); xenoRomance.maturityByAgeCurveMale.Add(new Vector2(0f, 0.01f)); xenoRomance.maturityByAgeCurveMale.Add(new Vector2(reproductiveStart, 1f)); xenoRomance.maturityByAgeCurveMale.Add(new Vector2(Mathf.Lerp(reproductiveStart, maxAge, 0.5f), 2f)); xenoRomance.maturityByAgeCurveMale.Add(new Vector2(maxAge, 3f)); xenoRomance.sexDriveByAgeCurveFemale.Add(new Vector2((reproductiveStart * 0.7f), 0f)); xenoRomance.sexDriveByAgeCurveFemale.Add(new Vector2((reproductiveStart), 3f)); xenoRomance.sexDriveByAgeCurveFemale.Add(new Vector2(Mathf.Lerp(reproductiveStart, maxAge, 0.5f), 1f)); xenoRomance.sexDriveByAgeCurveFemale.Add(new Vector2(maxAge, 0.1f)); xenoRomance.sexDriveByAgeCurveMale.Add(new Vector2((reproductiveStart * 0.7f), 0f)); xenoRomance.sexDriveByAgeCurveMale.Add(new Vector2((reproductiveStart), 3f)); xenoRomance.sexDriveByAgeCurveMale.Add(new Vector2(Mathf.Lerp(reproductiveStart, maxAge, 0.5f), 1f)); xenoRomance.sexDriveByAgeCurveMale.Add(new Vector2(maxAge, 0.1f)); return(xenoRomance); }