using Verse;
using rjw;
using System;
using System.Collections.Generic;
namespace RJW_Genes
{
public class SizeAdjuster
{
///
/// Re-Rolls the sizes for all vaginas of the pawn to be between lower and upper limit.
///
/// The pawn whos vaginas are rerolled
/// The minimum severity for the vagina
/// The maximum severity for the vagina
public static void AdjustAllVaginaSizes(Pawn pawn, float lowerLimit = 0.0f, float upperLimit = 1.0f){
List AllVaginas = Genital_Helper.get_AllPartsHediffList(pawn).FindAll(x => Genital_Helper.is_vagina(x));
ResizeAll(AllVaginas, lowerLimit, upperLimit);
}
///
/// Re-Rolls the sizes for all anus of the pawn to be between lower and upper limit.
///
/// The pawn whos anus are rerolled
/// The minimum severity for the vagina
/// The maximum severity for the vagina
public static void AdjustAllAnusSizes(Pawn pawn, float lowerLimit = 0.0f, float upperLimit = 1.0f)
{
List AllAnus = Genital_Helper.get_AllPartsHediffList(pawn).FindAll(x => GenitaliaChanger.IsAnus(x));
ResizeAll(AllAnus, lowerLimit, upperLimit);
}
///
/// Re-Rolls the sizes for all penis of the pawn to be between lower and upper limit.
///
/// The pawn whos penisses are rerolled
/// The minimum severity for the vagina
/// The maximum severity for the vagina
public static void AdjustAllPenisSizes(Pawn pawn, float lowerLimit = 0.0f, float upperLimit = 1.0f)
{
List AllPenisses = Genital_Helper.get_AllPartsHediffList(pawn).FindAll(x => Genital_Helper.is_penis(x));
ResizeAll(AllPenisses, lowerLimit, upperLimit);
}
///
/// Re-Rolls the sizes for all breasts of the pawn to be between lower and upper limit.
///
/// The pawn whos breasts are rerolled
/// The minimum severity for the vagina
/// The maximum severity for the vagina
public static void AdjustAllBreastSizes(Pawn pawn, float lowerLimit = 0.0f, float upperLimit = 1.0f)
{
List AllBreasts = Genital_Helper.get_AllPartsHediffList(pawn).FindAll(x => x.def.defName.ToLower().Contains("breasts"));
ResizeAll(AllBreasts,lowerLimit,upperLimit);
}
private static void ResizeAll(IEnumerable toResize,float lowerLimit, float upperLimit)
{
foreach (var hediff in toResize)
{
Random rnd = new Random();
float size = (float)(rnd.NextDouble() * (upperLimit - lowerLimit) + lowerLimit);
hediff.Severity = size;
}
}
}
}