Have TotalFertCum account for destroyed pawns and animals

This commit is contained in:
lutepickle 2024-03-13 08:03:02 -07:00
parent c393ab45c0
commit ba8801370f
1 changed files with 10 additions and 2 deletions

View File

@ -259,7 +259,7 @@ namespace RJW_Menstruation
}
public float TotalFertCum
{
get => cums?.Sum(cum => cum.FertVolume) ?? 0;
get => cums?.Where(cum => CumCanFertilize(cum)).Sum(cum => cum.FertVolume) ?? 0;
}
public float TotalCumPercent
{
@ -1335,10 +1335,18 @@ namespace RJW_Menstruation
}
}
public bool CumCanFertilize(Cum cum)
{
return !cum.notcum &&
cum.FertVolume > 0 &&
!(cum.pawn?.Destroyed ?? true) &&
(RJWPregnancySettings.bestial_pregnancy_enabled || xxx.is_animal(Pawn) == xxx.is_animal(cum.pawn));
}
protected Pawn Fertilize()
{
if (cums.NullOrEmpty()) return null;
List<Cum> eligibleCum = cums.FindAll(cum => !cum.notcum && cum.FertVolume > 0 && !(cum.pawn?.Destroyed ?? true) && (RJWPregnancySettings.bestial_pregnancy_enabled || xxx.is_animal(Pawn) == xxx.is_animal(cum.pawn)));
List<Cum> eligibleCum = cums.FindAll(cum => CumCanFertilize(cum));
if (eligibleCum.Count == 0) return null;
float totalFertPower = eligibleCum.Sum(cum => cum.FertVolume);