Consolidate instances of TickInterval/TicksPerHour into a single function
This commit is contained in:
parent
42b465430e
commit
6f3f3d28cf
Binary file not shown.
|
@ -204,9 +204,9 @@ namespace RJW_Menstruation
|
|||
{
|
||||
// comp is used for Hydrogen's RJW Muscle Injury
|
||||
float totalleak = volume;
|
||||
float decayPerInterval = 1 - Mathf.Pow(1 - Configurations.CumDecayRatio, (float)comp.TickInterval / GenDate.TicksPerHour);
|
||||
float fertilityDecayPerInterval = 1 - Mathf.Pow(1 - Configurations.CumFertilityDecayRatio, (float)comp.TickInterval / GenDate.TicksPerHour);
|
||||
antisperm *= (float)comp.TickInterval / GenDate.TicksPerHour;
|
||||
float decayPerInterval = 1 - Mathf.Pow(1 - Configurations.CumDecayRatio, comp.SimulationsPerHour);
|
||||
float fertilityDecayPerInterval = 1 - Mathf.Pow(1 - Configurations.CumFertilityDecayRatio, comp.SimulationsPerHour);
|
||||
antisperm *= comp.SimulationsPerHour;
|
||||
volume *= Math.Max(0, 1 - decayPerInterval * (1 - DecayResist) * leakfactor);
|
||||
fertility *= Math.Max(0, 1 - (fertilityDecayPerInterval * (1 - DecayResist) + antisperm));
|
||||
CutMinor();
|
||||
|
|
|
@ -160,7 +160,7 @@ namespace RJW_Menstruation
|
|||
new CurvePoint(1.0f,0.5f)
|
||||
};
|
||||
|
||||
public int TickInterval
|
||||
protected int TickInterval
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -169,13 +169,15 @@ namespace RJW_Menstruation
|
|||
if (Pawn.IsAnimal()) tickInterval = Configurations.AnimalTickInterval;
|
||||
else if (Pawn.IsColonist || Pawn.IsPrisonerOfColony || Pawn.IsSlaveOfColony) tickInterval = Configurations.ColonistTickInterval;
|
||||
else tickInterval = Configurations.NonColonistTickInterval;
|
||||
if (tickInterval <= 0) tickInterval = 1;
|
||||
if (tickInterval <= Configurations.TickIntervalMinimum) tickInterval = Configurations.TickIntervalMinimum;
|
||||
}
|
||||
return tickInterval;
|
||||
}
|
||||
set => tickInterval = value;
|
||||
}
|
||||
|
||||
public float SimulationsPerHour => (float)TickInterval / GenDate.TicksPerHour;
|
||||
|
||||
public Hediff Pregnancy {
|
||||
get
|
||||
{
|
||||
|
@ -1059,9 +1061,9 @@ namespace RJW_Menstruation
|
|||
if (Pawn.CurJobDef == xxx.knotted) leakfactor = 0f;
|
||||
foreach (Cum cum in cums)
|
||||
{
|
||||
if (Rand.Chance((float)TickInterval / GenDate.TicksPerHour)) cum.CumEffects(Pawn);
|
||||
if (Rand.Chance(SimulationsPerHour)) cum.CumEffects(Pawn);
|
||||
float vd = cum.DismishNatural(leakfactor, this, antisperm);
|
||||
cum.MakeThinner((float)Configurations.CycleAcceleration * TickInterval / GenDate.TicksPerHour);
|
||||
cum.MakeThinner((float)Configurations.CycleAcceleration * SimulationsPerHour);
|
||||
totalleak += AbsorbCum(vd, absorber);
|
||||
string tmp = "FilthLabelWithSource".Translate(cum.FilthDef.label, cum.pawn?.LabelShort ?? "Unknown", 1.ToString());
|
||||
filthlabels.Add(tmp.Replace(" x1", ""));
|
||||
|
@ -1366,7 +1368,7 @@ namespace RJW_Menstruation
|
|||
|
||||
//float fertFailChancePerHour = Mathf.Pow(1.0f - Configurations.FertilizeChance, totalFertPower * Props.basefertilizationChanceFactor);
|
||||
//float fertFailChancePerInterval = Mathf.Pow(fertFailChancePerHour, (float)TickInterval / GenDate.TicksPerHour);
|
||||
float fertFailChancePerInterval = Mathf.Pow(1.0f - Configurations.FertilizeChance, totalFertPower * Props.basefertilizationChanceFactor * TickInterval / GenDate.TicksPerHour);
|
||||
float fertFailChancePerInterval = Mathf.Pow(1.0f - Configurations.FertilizeChance, totalFertPower * Props.basefertilizationChanceFactor * SimulationsPerHour);
|
||||
|
||||
if (Rand.Chance(fertFailChancePerInterval)) return null;
|
||||
|
||||
|
@ -1509,7 +1511,7 @@ namespace RJW_Menstruation
|
|||
protected void BleedOut()
|
||||
{
|
||||
// ~1.5 per hour times acceleration
|
||||
float bledAmount = 0.03f * Configurations.BleedingAmount * Configurations.CycleAcceleration * Rand.Range(0.5f, 1.5f) * TickInterval / GenDate.TicksPerHour;
|
||||
float bledAmount = 0.03f * Configurations.BleedingAmount * Configurations.CycleAcceleration * Rand.Range(0.5f, 1.5f) * SimulationsPerHour;
|
||||
CumIn(Pawn, bledAmount, Translations.Menstrual_Blood, -5.0f, Pawn.RaceProps?.BloodDef ?? ThingDefOf.Filth_Blood);
|
||||
Cum blood = GetNotCum(Translations.Menstrual_Blood);
|
||||
if (blood != null) blood.Color = BloodColor;
|
||||
|
|
Loading…
Reference in New Issue