Refactor RecordRandomizer

This commit is contained in:
amevarashi 2022-06-12 09:03:56 +05:00
parent 862676e61a
commit 77ddd1da33
1 changed files with 42 additions and 32 deletions

View File

@ -21,7 +21,6 @@ namespace RJWSexperience
bool isvirgin = Rand.Chance(Settings.VirginRatio); bool isvirgin = Rand.Chance(Settings.VirginRatio);
int totalsex = 0; int totalsex = 0;
int totalbirth = 0; int totalbirth = 0;
int deviation = (int)Settings.MaxSexCountDeviation;
if (isvirgin) if (isvirgin)
log.Message("Rand.Chance rolled virgin"); log.Message("Rand.Chance rolled virgin");
@ -35,7 +34,7 @@ namespace RJWSexperience
LifeStageAge lifeStageAges = pawn.RaceProps.lifeStageAges.Find(x => x.def.reproductive); LifeStageAge lifeStageAges = pawn.RaceProps.lifeStageAges.Find(x => x.def.reproductive);
if (lifeStageAges == null) if (lifeStageAges == null)
{ {
log.Message($"No reproductive life stage! {pawn.NameShortColored}'s randomizstion cancelled"); log.Message($"No reproductive life stage! {pawn.NameShortColored}'s randomization cancelled");
return false; return false;
} }
minsexage = (int)lifeStageAges.minAge; minsexage = (int)lifeStageAges.minAge;
@ -69,42 +68,13 @@ namespace RJWSexperience
} }
if (!isvirgin) if (!isvirgin)
{ {
if (xxx.is_rapist(pawn)) totalsex += GeneratePartnerTypeRecords(pawn, avgsex);
{
if (xxx.is_zoophile(pawn))
{
if (pawn.Has(Quirk.ChitinLover)) totalsex += RandomizeRecord(pawn, xxx.CountOfRapedInsects, avgsex, deviation);
else totalsex += RandomizeRecord(pawn, xxx.CountOfRapedAnimals, avgsex, deviation);
}
else
{
totalsex += RandomizeRecord(pawn, xxx.CountOfRapedHumanlikes, avgsex, deviation);
}
avgsex /= 8;
}
if (xxx.is_zoophile(pawn))
{
if (pawn.Has(Quirk.ChitinLover)) totalsex += RandomizeRecord(pawn, xxx.CountOfRapedInsects, avgsex, deviation);
else totalsex += RandomizeRecord(pawn, xxx.CountOfSexWithAnimals, avgsex, deviation);
avgsex /= 10;
}
else if (xxx.is_necrophiliac(pawn))
{
totalsex += RandomizeRecord(pawn, xxx.CountOfSexWithCorpse, avgsex, deviation);
avgsex /= 4;
}
if (Settings.SlavesBeenRapedExp && pawn.IsSlave) if (Settings.SlavesBeenRapedExp && pawn.IsSlave)
{ {
totalsex += RandomizeRecord(pawn, xxx.CountOfBeenRapedByAnimals, Rand.Range(-50, 10), Rand.Range(0, 10) * sexableage); totalsex += RandomizeRecord(pawn, xxx.CountOfBeenRapedByAnimals, Rand.Range(-50, 10), Rand.Range(0, 10) * sexableage);
totalsex += RandomizeRecord(pawn, xxx.CountOfBeenRapedByHumanlikes, 0, Rand.Range(0, 100) * sexableage); totalsex += RandomizeRecord(pawn, xxx.CountOfBeenRapedByHumanlikes, 0, Rand.Range(0, 100) * sexableage);
} }
totalsex += RandomizeRecord(pawn, xxx.CountOfSexWithHumanlikes, avgsex, deviation);
if (totalsex > 0) pawn.records.AddTo(VariousDefOf.SexPartnerCount, Math.Max(1, Rand.Range(0, totalsex / 7)));
} }
} }
pawn.records?.SetTo(xxx.CountOfSex, totalsex); pawn.records?.SetTo(xxx.CountOfSex, totalsex);
@ -140,6 +110,46 @@ namespace RJWSexperience
return value; return value;
} }
private static int GeneratePartnerTypeRecords(Pawn pawn, int avgsex)
{
int deviation = (int)Settings.MaxSexCountDeviation;
int totalSexCount = 0;
if (xxx.is_rapist(pawn))
{
if (xxx.is_zoophile(pawn))
{
if (pawn.Has(Quirk.ChitinLover)) totalSexCount += RandomizeRecord(pawn, xxx.CountOfRapedInsects, avgsex, deviation);
else totalSexCount += RandomizeRecord(pawn, xxx.CountOfRapedAnimals, avgsex, deviation);
}
else
{
totalSexCount += RandomizeRecord(pawn, xxx.CountOfRapedHumanlikes, avgsex, deviation);
}
avgsex /= 8;
}
if (xxx.is_zoophile(pawn))
{
if (pawn.Has(Quirk.ChitinLover)) totalSexCount += RandomizeRecord(pawn, xxx.CountOfRapedInsects, avgsex, deviation);
else totalSexCount += RandomizeRecord(pawn, xxx.CountOfSexWithAnimals, avgsex, deviation);
avgsex /= 10;
}
else if (xxx.is_necrophiliac(pawn))
{
totalSexCount += RandomizeRecord(pawn, xxx.CountOfSexWithCorpse, avgsex, deviation);
avgsex /= 4;
}
totalSexCount += RandomizeRecord(pawn, xxx.CountOfSexWithHumanlikes, avgsex, deviation);
if (totalSexCount > 0)
pawn.records.AddTo(VariousDefOf.SexPartnerCount, Math.Max(1, Rand.Range(0, totalSexCount / 7)));
return totalSexCount;
}
private static void GenerateSextypeRecords(Pawn pawn, int totalsex) private static void GenerateSextypeRecords(Pawn pawn, int totalsex)
{ {
float totalweight = float totalweight =