diff --git a/About/Manifest.xml b/About/Manifest.xml index 6fade71..d6a9b16 100644 --- a/About/Manifest.xml +++ b/About/Manifest.xml @@ -1,7 +1,7 @@ RJW Menstruation - 1.0.4.2a + 1.0.4.3 diff --git a/Assemblies/RJW_Menstruation.dll b/Assemblies/RJW_Menstruation.dll index 1b5963d..1ff2f7e 100644 Binary files a/Assemblies/RJW_Menstruation.dll and b/Assemblies/RJW_Menstruation.dll differ diff --git a/Defs/Recipe_Surgery/Recipes_Surgery_Breast.xml b/Defs/Recipe_Surgery/Recipes_Surgery_Breast.xml new file mode 100644 index 0000000..4041c52 --- /dev/null +++ b/Defs/Recipe_Surgery/Recipes_Surgery_Breast.xml @@ -0,0 +1,65 @@ + + + + Surgery + Recipe_Surgery + MedicalOperationSpeed + Medicine + 0.2 + 400 + false + +
  • Human
  • +
    + 100 + +
  • + + +
  • Medicine
  • + + + 1 + +
    + + +
  • Medicine
  • +
    +
    +
    + + + Surgery_ExpandAreola + + expand areola. + RJW_Menstruation.Recipe_ExpandAreola + expanding areola + + + + Surgery_ContractAreola + + contract areola. + RJW_Menstruation.Recipe_ContractAreola + contracting areola + + + + Surgery_ExpandNipple + + expand nipple. + RJW_Menstruation.Recipe_ExpandNipple + expanding nipple + + + + Surgery_ContractNipple + + contract nipple. + RJW_Menstruation.Recipe_ContractNipple + contracting nipple + + + +
    diff --git a/Patches/Overlays/Arrow.png b/Patches/Overlays/Arrow.png deleted file mode 100644 index 3bfd1c0..0000000 Binary files a/Patches/Overlays/Arrow.png and /dev/null differ diff --git a/Patches/Overlays/Barrel.png b/Patches/Overlays/Barrel.png deleted file mode 100644 index bf40616..0000000 Binary files a/Patches/Overlays/Barrel.png and /dev/null differ diff --git a/Patches/Overlays/BrokenDown.png b/Patches/Overlays/BrokenDown.png deleted file mode 100644 index 42e68d1..0000000 Binary files a/Patches/Overlays/BrokenDown.png and /dev/null differ diff --git a/Patches/Overlays/DesignatedGenericTex.png b/Patches/Overlays/DesignatedGenericTex.png deleted file mode 100644 index 5aa8de5..0000000 Binary files a/Patches/Overlays/DesignatedGenericTex.png and /dev/null differ diff --git a/Patches/Overlays/DragHighlightCell.png b/Patches/Overlays/DragHighlightCell.png deleted file mode 100644 index 145bb89..0000000 Binary files a/Patches/Overlays/DragHighlightCell.png and /dev/null differ diff --git a/Patches/Overlays/FuelingPort.png b/Patches/Overlays/FuelingPort.png deleted file mode 100644 index daa6802..0000000 Binary files a/Patches/Overlays/FuelingPort.png and /dev/null differ diff --git a/Patches/Overlays/GrayTextBG.png b/Patches/Overlays/GrayTextBG.png deleted file mode 100644 index 51abaed..0000000 Binary files a/Patches/Overlays/GrayTextBG.png and /dev/null differ diff --git a/Patches/Overlays/InteractionCell.png b/Patches/Overlays/InteractionCell.png deleted file mode 100644 index 0887213..0000000 Binary files a/Patches/Overlays/InteractionCell.png and /dev/null differ diff --git a/Patches/Overlays/LaunchableMouseAttachment.png b/Patches/Overlays/LaunchableMouseAttachment.png deleted file mode 100644 index 6e9c35b..0000000 Binary files a/Patches/Overlays/LaunchableMouseAttachment.png and /dev/null differ diff --git a/Patches/Overlays/Locked.png b/Patches/Overlays/Locked.png deleted file mode 100644 index 3cc34f3..0000000 Binary files a/Patches/Overlays/Locked.png and /dev/null differ diff --git a/Patches/Overlays/MouseoverBracketTex.png b/Patches/Overlays/MouseoverBracketTex.png deleted file mode 100644 index 68cfce9..0000000 Binary files a/Patches/Overlays/MouseoverBracketTex.png and /dev/null differ diff --git a/Patches/Overlays/NeedsPower.png b/Patches/Overlays/NeedsPower.png deleted file mode 100644 index 8c30802..0000000 Binary files a/Patches/Overlays/NeedsPower.png and /dev/null differ diff --git a/Patches/Overlays/OneSidedLine.png b/Patches/Overlays/OneSidedLine.png deleted file mode 100644 index 1ecc2be..0000000 Binary files a/Patches/Overlays/OneSidedLine.png and /dev/null differ diff --git a/Patches/Overlays/OutOfFuel.png b/Patches/Overlays/OutOfFuel.png deleted file mode 100644 index c667f33..0000000 Binary files a/Patches/Overlays/OutOfFuel.png and /dev/null differ diff --git a/Patches/Overlays/PowerOff.png b/Patches/Overlays/PowerOff.png deleted file mode 100644 index 349d30f..0000000 Binary files a/Patches/Overlays/PowerOff.png and /dev/null differ diff --git a/Patches/Overlays/QuestionMark.png b/Patches/Overlays/QuestionMark.png deleted file mode 100644 index 71bd692..0000000 Binary files a/Patches/Overlays/QuestionMark.png and /dev/null differ diff --git a/Patches/Overlays/ReservedDestination.png b/Patches/Overlays/ReservedDestination.png deleted file mode 100644 index 19ea6ba..0000000 Binary files a/Patches/Overlays/ReservedDestination.png and /dev/null differ diff --git a/Patches/Overlays/ReservedDestinationSelection.png b/Patches/Overlays/ReservedDestinationSelection.png deleted file mode 100644 index 722dffc..0000000 Binary files a/Patches/Overlays/ReservedDestinationSelection.png and /dev/null differ diff --git a/Patches/Overlays/ReservedForWork.png b/Patches/Overlays/ReservedForWork.png deleted file mode 100644 index 364b48f..0000000 Binary files a/Patches/Overlays/ReservedForWork.png and /dev/null differ diff --git a/Patches/Overlays/SelectionBracket.png b/Patches/Overlays/SelectionBracket.png deleted file mode 100644 index 3e46491..0000000 Binary files a/Patches/Overlays/SelectionBracket.png and /dev/null differ diff --git a/Patches/Overlays/SelectionBracketGUI.png b/Patches/Overlays/SelectionBracketGUI.png deleted file mode 100644 index 3e46491..0000000 Binary files a/Patches/Overlays/SelectionBracketGUI.png and /dev/null differ diff --git a/Patches/Overlays/SquadFlag.png b/Patches/Overlays/SquadFlag.png deleted file mode 100644 index b54b6e2..0000000 Binary files a/Patches/Overlays/SquadFlag.png and /dev/null differ diff --git a/Patches/Overlays/TargetHighlight_Side.png b/Patches/Overlays/TargetHighlight_Side.png deleted file mode 100644 index 35d0d5d..0000000 Binary files a/Patches/Overlays/TargetHighlight_Side.png and /dev/null differ diff --git a/Patches/Overlays/TargetHighlight_Square.png b/Patches/Overlays/TargetHighlight_Square.png deleted file mode 100644 index 1dc98cb..0000000 Binary files a/Patches/Overlays/TargetHighlight_Square.png and /dev/null differ diff --git a/Patches/Overlays/ThingLine.png b/Patches/Overlays/ThingLine.png deleted file mode 100644 index fb85b5b..0000000 Binary files a/Patches/Overlays/ThingLine.png and /dev/null differ diff --git a/Patches/Overlays/WaypointMouseAttachment.png b/Patches/Overlays/WaypointMouseAttachment.png deleted file mode 100644 index 5c1645b..0000000 Binary files a/Patches/Overlays/WaypointMouseAttachment.png and /dev/null differ diff --git a/changelogs.txt b/changelogs.txt index 2f13a1f..7076f64 100644 --- a/changelogs.txt +++ b/changelogs.txt @@ -1,3 +1,13 @@ +Version 1.0.4.3 + - fixed errors on pregnancy + - added surgeries for nipple/areola + - changed cum calculate method + - cum's fertility will remain + - IUD will diminish cum's fertility + - changed default settings + - fertilization chance raised 5% to 15% + - cum decay ratio raised 15% to 30% + Version 1.0.4.2a - fixed hybrid custom UI diff --git a/source/RJW_Menstruation/RJW_Menstruation/Configurations.cs b/source/RJW_Menstruation/RJW_Menstruation/Configurations.cs index ff4656a..9aa8acb 100644 --- a/source/RJW_Menstruation/RJW_Menstruation/Configurations.cs +++ b/source/RJW_Menstruation/RJW_Menstruation/Configurations.cs @@ -9,10 +9,10 @@ namespace RJW_Menstruation { public const float ImplantationChanceDefault = 0.65f; public const int ImplantationChanceAdjustDefault = 65; - public const float FertilizeChanceDefault = 0.05f; - public const int FertilizeChanceAdjustDefault = 50; - public const float CumDecayRatioDefault = 0.15f; - public const int CumDecayRatioAdjustDefault = 150; + public const float FertilizeChanceDefault = 0.15f; + public const int FertilizeChanceAdjustDefault = 150; + public const float CumDecayRatioDefault = 0.30f; + public const int CumDecayRatioAdjustDefault = 300; public const float CumFertilityDecayRatioDefault = 0.2f; public const int CumFertilityDecayRatioAdjustDefault = 200; public const int CycleAccelerationDefault = 6; diff --git a/source/RJW_Menstruation/RJW_Menstruation/Cum.cs b/source/RJW_Menstruation/RJW_Menstruation/Cum.cs index a0b18d6..f2e5007 100644 --- a/source/RJW_Menstruation/RJW_Menstruation/Cum.cs +++ b/source/RJW_Menstruation/RJW_Menstruation/Cum.cs @@ -9,14 +9,30 @@ namespace RJW_Menstruation { public Pawn pawn; - public float volume; // ml - public float fertvolume; + protected float volume; // ml + protected float fertvolume; public float fertFactor = 1.0f; public bool notcum = false; // for other fluids public string notcumLabel = ""; - private bool useCustomColor = false; - private float notcumthickness = 0; - private float cumthickness = 1.0f; + protected bool useCustomColor = false; + protected float notcumthickness = 0; + protected float cumthickness = 1.0f; + + public float Volume + { + get + { + return volume; + } + } + + public float FertVolume + { + get + { + return fertvolume; + } + } public float CumThickness { @@ -38,7 +54,7 @@ namespace RJW_Menstruation notcumthickness = value; } } - private Color customColor; + protected Color customColor; public PawnDNAModExtension DNA { @@ -63,7 +79,7 @@ namespace RJW_Menstruation else return DNAcache; } } - private PawnDNAModExtension DNAcache = null; + protected PawnDNAModExtension DNAcache = null; public ThingDef FilthDef { get @@ -76,7 +92,7 @@ namespace RJW_Menstruation filthDef = value; } } - private ThingDef filthDef = null; + protected ThingDef filthDef = null; public Color color { get @@ -102,6 +118,14 @@ namespace RJW_Menstruation fertvolume = 1.0f; } + /// + /// Not Cum + /// + /// + /// + /// + /// + /// public Cum(Pawn pawn, float volume, string notcumlabel, float decayresist = 0, ThingDef filthDef = null) { this.pawn = pawn; @@ -117,12 +141,7 @@ namespace RJW_Menstruation { this.pawn = pawn; this.volume = volume; - if (fertility > 0) - { - this.fertvolume = volume; - this.fertFactor = fertility; - } - else this.fertvolume = 0; + this.fertvolume = volume * fertility; this.filthDef = filthDef; } @@ -150,21 +169,57 @@ namespace RJW_Menstruation } } - public void MergeWithCum(float volumein, ThingDef updatefilthDef = null) + public void MergeWithCum(float volumein, float fertility, ThingDef updatefilthDef = null) { if (updatefilthDef != null) filthDef = updatefilthDef; - volume = volumein; - fertvolume = volumein; + volume += volumein; + fertvolume += volumein*fertility; cumthickness = Mathf.Lerp(cumthickness, 1.0f, volumein / volume); } public void MergeWithFluid(float volumein, float thickness, ThingDef updatefilthDef = null) { if (updatefilthDef != null) filthDef = updatefilthDef; - volume = volumein; + volume += volumein; cumthickness = Mathf.Lerp(cumthickness, thickness, volumein / volume); } + public bool ShouldRemove() + { + if (fertvolume < 0.001f && volume < 0.001f) return true; + return false; + } + + + public float DismishNatural(float leakfactor, float antisperm = 0.0f) + { + float totalleak = volume; + volume *= Math.Max(0, (1 - (Configurations.CumDecayRatio * (1 - decayresist)) * leakfactor)); + fertvolume *= Math.Max(0, 1 - (Configurations.CumFertilityDecayRatio * (1 - decayresist) + antisperm)); + CutMinor(); + totalleak -= volume; + return totalleak; + } + + public float DismishForce(float portion, float leakfactor = 1.0f) + { + float totalleak = volume; + volume *= Math.Max(0, 1 - (portion * (1 - decayresist)) * leakfactor); + fertvolume *= Math.Max(0, 1 - (portion * (1 - decayresist)) * leakfactor); + CutMinor(); + totalleak -= volume; + return totalleak; + + } + + protected void CutMinor() + { + if (volume < 0.01f) volume = 0f; + if (fertvolume < 0.001f) fertvolume = 0f; + + } + + } diff --git a/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Breast.cs b/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Breast.cs index 1644e3e..2dcc603 100644 --- a/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Breast.cs +++ b/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Breast.cs @@ -260,9 +260,26 @@ namespace RJW_Menstruation float variance = breastSizeIncreased * Math.Min(ratio, 1.0f); breastSizeIncreased -= variance; parent.Severity -= variance; - } - + + public void AdjustNippleSizeImmidiately(float amount) + { + originnipple = Math.Max(0, originnipple + amount); + nippleSizePermanent = Math.Min(MaxNipple, nippleSizePermanent + amount); + nippleSize = Math.Min(MaxNipple, nippleSize + amount); + nippleSizeCurrent = nippleSize; + } + + public void AdjustAreolaSizeImmidiately(float amount) + { + originareola = Math.Max(0, originareola + amount); + areolaSizePermanent = Math.Min(MaxAreola, areolaSizePermanent + amount); + areolaSize = Math.Min(MaxAreola, areolaSize + amount); + areolaSizeCurrent = areolaSize; + } + + + public void UpdateColor() { cachedcolor = Colors.CMYKLerp(parent?.pawn?.story?.SkinColor ?? Color.white, Props.BlackNippleColor, Alpha); diff --git a/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_InducedOvaulator.cs b/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_InducedOvaulator.cs index cf0c068..d20cff6 100644 --- a/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_InducedOvaulator.cs +++ b/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_InducedOvaulator.cs @@ -43,7 +43,7 @@ namespace RJW_Menstruation } } - public override void AfterCumIn(Pawn cummer) + protected override void AfterCumIn(Pawn cummer) { base.AfterCumIn(cummer); if (curStage == Stage.Follicular) curStage = Stage.Ovulatory; diff --git a/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs b/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs index b2c4c7b..9795870 100644 --- a/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs +++ b/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs @@ -111,6 +111,7 @@ namespace RJW_Menstruation protected bool estrusflag = false; protected int opcache = -1; protected HediffComp_Breast breastcache = null; + protected float antisperm = 0.0f; public int ovarypowerthreshold { @@ -137,7 +138,7 @@ namespace RJW_Menstruation if (cums.NullOrEmpty()) return 0; foreach (Cum cum in cums) { - res += cum.volume; + res += cum.Volume; } return res; } @@ -150,7 +151,7 @@ namespace RJW_Menstruation if (cums.NullOrEmpty()) return 0; foreach (Cum cum in cums) { - if (!cum.notcum) res += cum.fertvolume; + if (!cum.notcum) res += cum.FertVolume; } return res; } @@ -163,7 +164,7 @@ namespace RJW_Menstruation if (cums.NullOrEmpty()) return 0; foreach (Cum cum in cums) { - res += cum.volume; + res += cum.Volume; } return res / Props.maxCumCapacity; } @@ -214,8 +215,8 @@ namespace RJW_Menstruation { if (!cums.NullOrEmpty()) foreach (Cum cum in cums) { - if (!cum.notcum) yield return String.Format(cum.pawn?.Label + ": {0:0.##}ml", cum.volume); - else yield return String.Format(cum.notcumLabel + ": {0:0.##}ml", cum.volume); + if (!cum.notcum) yield return String.Format(cum.pawn?.Label + ": {0:0.##}ml", cum.Volume); + else yield return String.Format(cum.notcumLabel + ": {0:0.##}ml", cum.Volume); } else yield return Translations.Info_noCum; } @@ -231,8 +232,11 @@ namespace RJW_Menstruation float mixedsofar = 0; foreach (Cum cum in cums) { - mixedcolor = Colors.CMYKLerp(mixedcolor, cum.color, cum.volume / (mixedsofar + cum.volume)); - mixedsofar += cum.volume; + if (cum.Volume > 0) + { + mixedcolor = Colors.CMYKLerp(mixedcolor, cum.color, cum.Volume / (mixedsofar + cum.Volume)); + mixedsofar += cum.Volume; + } } } return mixedcolor; @@ -334,7 +338,7 @@ namespace RJW_Menstruation { if (!cums.NullOrEmpty()) foreach (Cum cum in cums) { - if (cum.fertvolume > 0) return true; + if (cum.FertVolume > 0) return true; } return false; @@ -367,6 +371,8 @@ namespace RJW_Menstruation { get { + if (parent.pawn.health.hediffSet.HasHediff(VariousDefOf.RJW_IUD)) return false; + if (curStage == Stage.Follicular || curStage == Stage.ClimactericFollicular) { if (curStageHrs > 0.7f * (follicularIntervalhours - bleedingIntervalhours)) return true; @@ -432,7 +438,7 @@ namespace RJW_Menstruation Scribe_Values.Look(ref eggstack, "eggstack", eggstack, true); Scribe_Values.Look(ref estrusflag, "estrusflag", estrusflag, true); - + } @@ -510,11 +516,10 @@ namespace RJW_Menstruation { if (cum.pawn.Equals(pawn)) { - cum.MergeWithCum(volume, filthdef); + cum.MergeWithCum(volume, fertility, filthdef); merged = true; } - cum.volume *= 1 - cumoutrate; - cum.fertvolume *= 1 - cumoutrate; + cum.DismishForce(cumoutrate); } if (!merged) cums.Add(new Cum(pawn, volume * (1 - cumoutrate), fertility, filthdef)); } @@ -526,7 +531,7 @@ namespace RJW_Menstruation { if (cum.pawn.Equals(pawn)) { - cum.MergeWithCum(volume, filthdef); + cum.MergeWithCum(volume, fertility, filthdef); merged = true; } } @@ -560,8 +565,7 @@ namespace RJW_Menstruation cum.MergeWithFluid(volume, decayresist, filthdef); merged = true; } - cum.volume *= 1 - cumoutrate; - cum.fertvolume *= 1 - cumoutrate; + cum.DismishForce(cumoutrate); } if (!merged) cums.Add(new Cum(pawn, volume * (1 - cumoutrate), notcumlabel, decayresist, filthdef)); } @@ -584,13 +588,13 @@ namespace RJW_Menstruation AfterFluidIn(cumd); } - public virtual void AfterCumIn(Pawn cummer) + protected virtual void AfterCumIn(Pawn cummer) { ThoughtCumInside(cummer); } - public virtual void AfterNotCumIn() + protected virtual void AfterNotCumIn() { } @@ -599,15 +603,19 @@ namespace RJW_Menstruation /// Action for both Cum and NotCum /// /// Fluid deviation - public virtual void AfterFluidIn(float fd) + protected virtual void AfterFluidIn(float fd) { } - public void BeforeCumOut(out Absorber absorber) + protected void BeforeCumOut(out Absorber absorber) { + + if (parent.pawn.health.hediffSet.HasHediff(VariousDefOf.RJW_IUD)) antisperm = 0.70f; + else antisperm = 0.0f; + absorber = (Absorber)parent.pawn.apparel?.WornApparel?.Find(x => x is Absorber); if (absorber != null) { @@ -619,7 +627,7 @@ namespace RJW_Menstruation /// /// For natural leaking /// - public virtual void AfterCumOut() + protected virtual void AfterCumOut() { parent.pawn.needs?.mood?.thoughts?.memories?.TryGainMemory(VariousDefOf.LeakingFluids); } @@ -628,7 +636,7 @@ namespace RJW_Menstruation /// For all type of leaking /// /// - public virtual void AfterFluidOut(float fd) + protected virtual void AfterFluidOut(float fd) { } @@ -651,16 +659,12 @@ namespace RJW_Menstruation List removecums = new List(); foreach (Cum cum in cums) { - float vd = cum.volume; - cum.volume *= Math.Max(0, (1 - (Configurations.CumDecayRatio * (1 - cum.decayresist)) * leakfactor)); - cum.fertvolume *= Math.Max(0, (1 - (Configurations.CumDecayRatio * (1 - cum.decayresist)) * leakfactor) * (1 - (Configurations.CumFertilityDecayRatio * (1 - cum.decayresist)))); - vd -= cum.volume; + float vd = cum.DismishNatural(leakfactor, antisperm); cum.MakeThinner(Configurations.CycleAcceleration); totalleak += AbsorbCum(cum, vd, absorber); string tmp = "FilthLabelWithSource".Translate(cum.FilthDef.label, cum.pawn?.LabelShort ?? "Unknown", 1.ToString()); filthlabels.Add(tmp.Replace(" x1", "")); - if (cum.fertvolume < 0.01f) cum.fertvolume = 0; - if (cum.volume < 0.01f) removecums.Add(cum); + if (cum.ShouldRemove()) removecums.Add(cum); } if (cums.Count > 1) MakeCumFilthMixture(totalleak, filthlabels); else if (cums.Count == 1) MakeCumFilth(cums.First(), totalleak); @@ -683,25 +687,21 @@ namespace RJW_Menstruation /// public float CumOut(Cum targetcum, float portion = 0.1f) { - float leakfactor = 1.0f; + if (cums.NullOrEmpty()) return 0; float totalleak = 0; List filthlabels = new List(); - if (cums.NullOrEmpty()) return 0; float outcum = 0; float cumd = TotalCumPercent; List removecums = new List(); foreach (Cum cum in cums) { - float vd = cum.volume; - if (cum.Equals(targetcum)) outcum = cum.volume * (portion * (1 - cum.decayresist)); - cum.volume *= Math.Max(0, 1 - (portion * (1 - cum.decayresist)) * leakfactor); - cum.fertvolume *= Math.Max(0, (1 - (portion * (1 - cum.decayresist)) * leakfactor) * (1 - (Configurations.CumFertilityDecayRatio * (1 - cum.decayresist)))); + float vd = cum.DismishForce(portion); + if (cum.Equals(targetcum)) outcum = vd; //MakeCumFilth(cum, vd - cum.volume); string tmp = "FilthLabelWithSource".Translate(cum.FilthDef.label, cum.pawn?.LabelShort ?? "Unknown", 1.ToString()); filthlabels.Add(tmp.Replace(" x1", "")); - totalleak += vd - cum.volume; - if (cum.fertvolume < 0.01f) cum.fertvolume = 0; - if (cum.volume < 0.01f) removecums.Add(cum); + totalleak += vd; + if (cum.ShouldRemove()) removecums.Add(cum); } if (cums.Count > 1) MakeCumFilthMixture(totalleak, filthlabels); else if (cums.Count == 1) MakeCumFilth(cums.First(), totalleak); @@ -715,54 +715,13 @@ namespace RJW_Menstruation return outcum; } - /// - /// Ignores cum's decayratio and absorber and get excreted amount of specific cum - /// - /// - /// - /// - public float CumOutForce(Cum targetcum = null, float portion = 0.1f) - { - if (cums.NullOrEmpty()) return 0; - float outcum = 0; - float totalleak = 0; - List filthlabels = new List(); - float cumd = TotalCumPercent; - List removecums = new List(); - foreach (Cum cum in cums) - { - float vd = cum.volume; - if (cum.Equals(targetcum)) outcum = cum.volume * (portion); - cum.volume *= 1 - (portion); - cum.fertvolume *= (1 - (portion)) * (1 - (Configurations.CumFertilityDecayRatio)); - //MakeCumFilth(cum, vd - cum.volume); - string tmp = "FilthLabelWithSource".Translate(cum.FilthDef.label, cum.pawn?.LabelShort ?? "Unknown", 1.ToString()); - filthlabels.Add(tmp.Replace(" x1", "")); - totalleak += vd - cum.volume; - if (cum.fertvolume < 0.01f) cum.fertvolume = 0; - if (cum.volume < 0.1f) removecums.Add(cum); - } - if (cums.Count > 1) MakeCumFilthMixture(totalleak, filthlabels); - else if (cums.Count == 1) MakeCumFilth(cums.First(), totalleak); - foreach (Cum cum in removecums) - { - cums.Remove(cum); - } - removecums.Clear(); - cumd = TotalCumPercent - cumd; - AfterFluidOut(cumd); - return outcum; - } - - - /// /// Fertilize eggs and return the result /// /// - public bool FertilizationCheck() + protected bool FertilizationCheck() { if (!eggs.NullOrEmpty()) { @@ -864,7 +823,7 @@ namespace RJW_Menstruation loaded = true; } - public void AfterSimulator() + protected void AfterSimulator() { if (Configurations.EnableMenopause && ovarypower < ovarypowerthreshold) { @@ -926,7 +885,7 @@ namespace RJW_Menstruation foreach (Cum cum in cums) { float rand = Rand.Range(0.0f, 1.0f); - if (cum.pawn != null && !cum.notcum && rand < cum.fertvolume * cum.fertFactor * Configurations.FertilizeChance * Props.basefertilizationChanceFactor) + if (cum.pawn != null && !cum.notcum && rand < cum.FertVolume * cum.fertFactor * Configurations.FertilizeChance * Props.basefertilizationChanceFactor) { if (!RJWPregnancySettings.bestial_pregnancy_enabled && (xxx.is_animal(parent.pawn) ^ xxx.is_animal(cum.pawn))) continue; return cum.pawn; diff --git a/source/RJW_Menstruation/RJW_Menstruation/HediffComps/MenstruationUtility.cs b/source/RJW_Menstruation/RJW_Menstruation/HediffComps/MenstruationUtility.cs new file mode 100644 index 0000000..b5c351d --- /dev/null +++ b/source/RJW_Menstruation/RJW_Menstruation/HediffComps/MenstruationUtility.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using RimWorld; +using Verse; + + +namespace RJW_Menstruation +{ + public static class MenstruationUtility + { + public static float GetFertilityChance(this HediffComp_Menstruation comp) + { + return comp.TotalFertCum * Configurations.FertilizeChance; + } + + + + } +} diff --git a/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs b/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs index cf76acf..0d67dcd 100644 --- a/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs +++ b/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs @@ -490,11 +490,17 @@ namespace RJW_Menstruation { PawnKindDef res = null; Pawn opposite = second; - HybridInformations info = Configurations.HybridOverride.FirstOrDefault(x => x.defName == first.def?.defName && (x.hybridExtension?.Exists(y => y.defName == second.def?.defName) ?? false)); - if (info == null) + HybridInformations info = null; + + + if (!Configurations.HybridOverride.NullOrEmpty()) { - info = Configurations.HybridOverride.FirstOrDefault(x => x.defName == second.def?.defName && (x.hybridExtension?.Exists(y => y.defName == first.def?.defName) ?? false)); - opposite = first; + info = Configurations.HybridOverride.FirstOrDefault(x => x.defName == first.def?.defName && (x.hybridExtension?.Exists(y => y.defName == second.def?.defName) ?? false)); + if (info == null) + { + info = Configurations.HybridOverride.FirstOrDefault(x => x.defName == second.def?.defName && (x.hybridExtension?.Exists(y => y.defName == first.def?.defName) ?? false)); + opposite = first; + } } if (info != null) diff --git a/source/RJW_Menstruation/RJW_Menstruation/JobDrivers.cs b/source/RJW_Menstruation/RJW_Menstruation/JobDrivers.cs index 2e57ad1..bdca9a4 100644 --- a/source/RJW_Menstruation/RJW_Menstruation/JobDrivers.cs +++ b/source/RJW_Menstruation/RJW_Menstruation/JobDrivers.cs @@ -20,7 +20,7 @@ namespace RJW_Menstruation HediffComp_Menstruation Comp = Utility.GetMenstruationComp(pawn); this.FailOn(delegate { - return !(Comp.TotalCumPercent > 0.01); + return !(Comp.TotalCumPercent > 0.001); }); Toil excreting = Toils_General.Wait(excretingTime, TargetIndex.None);//duration of @@ -30,8 +30,8 @@ namespace RJW_Menstruation { initAction = delegate () { - Comp.CumOutForce(null, 0.5f); - if (Comp.TotalCumPercent > 0.01) this.JumpToToil(excreting); + Comp.CumOut(null, 0.5f); + if (Comp.TotalCumPercent > 0.001) JumpToToil(excreting); } }; //yield return excreting; diff --git a/source/RJW_Menstruation/RJW_Menstruation/RJW_Menstruation.csproj b/source/RJW_Menstruation/RJW_Menstruation/RJW_Menstruation.csproj index 5199a15..c757a46 100644 --- a/source/RJW_Menstruation/RJW_Menstruation/RJW_Menstruation.csproj +++ b/source/RJW_Menstruation/RJW_Menstruation/RJW_Menstruation.csproj @@ -57,6 +57,8 @@ + + diff --git a/source/RJW_Menstruation/RJW_Menstruation/Recipe_Surgery.cs b/source/RJW_Menstruation/RJW_Menstruation/Recipe_Surgery.cs new file mode 100644 index 0000000..89ed888 --- /dev/null +++ b/source/RJW_Menstruation/RJW_Menstruation/Recipe_Surgery.cs @@ -0,0 +1,82 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using RimWorld; +using Verse; +using rjw; + + +namespace RJW_Menstruation +{ + public class Recipe_BreastSurgery : Recipe_Surgery + { + public override IEnumerable GetPartsToApplyOn(Pawn pawn, RecipeDef recipe) + { + + if (pawn.gender != Gender.Female) + { + yield break; + } + + BodyPartRecord part = Genital_Helper.get_breastsBPR(pawn); + if (part != null) + { + + if (pawn.GetBreastComp() != null) yield return part; + } + } + + public override void ApplyOnPawn(Pawn pawn, BodyPartRecord part, Pawn billDoer, List ingredients, Bill bill) + { + HediffComp_Breast breast = pawn.GetBreastComp(); + if (billDoer != null && breast != null) + { + TaleRecorder.RecordTale(TaleDefOf.DidSurgery, new object[] + { + billDoer, + pawn + }); + SurgeryResult(breast); + } + } + + protected virtual void SurgeryResult(HediffComp_Breast breast) + { + } + } + + + public class Recipe_ExpandAreola : Recipe_BreastSurgery + { + protected override void SurgeryResult(HediffComp_Breast breast) + { + breast.AdjustAreolaSizeImmidiately(0.1f); + } + } + + public class Recipe_ContractAreola : Recipe_BreastSurgery + { + protected override void SurgeryResult(HediffComp_Breast breast) + { + breast.AdjustAreolaSizeImmidiately(-0.1f); + } + } + + public class Recipe_ExpandNipple : Recipe_BreastSurgery + { + protected override void SurgeryResult(HediffComp_Breast breast) + { + breast.AdjustNippleSizeImmidiately(0.1f); + } + } + + public class Recipe_ContractNipple : Recipe_BreastSurgery + { + protected override void SurgeryResult(HediffComp_Breast breast) + { + breast.AdjustNippleSizeImmidiately(-0.1f); + } + } +} diff --git a/source/RJW_Menstruation/RJW_Menstruation/TextureCache.cs b/source/RJW_Menstruation/RJW_Menstruation/TextureCache.cs index e4f6efc..685a151 100644 --- a/source/RJW_Menstruation/RJW_Menstruation/TextureCache.cs +++ b/source/RJW_Menstruation/RJW_Menstruation/TextureCache.cs @@ -86,7 +86,7 @@ namespace RJW_Menstruation } } - + public static readonly Texture2D FertChanceTex = SolidColorMaterials.NewSolidColorTexture(new Color(1f, 1f, 1f, 0.4f)); private static Texture2D milktexturecache = null; diff --git a/source/RJW_Menstruation/RJW_Menstruation/UI/Dialog_WombStatus.cs b/source/RJW_Menstruation/RJW_Menstruation/UI/Dialog_WombStatus.cs index dde502b..5cf20f8 100644 --- a/source/RJW_Menstruation/RJW_Menstruation/UI/Dialog_WombStatus.cs +++ b/source/RJW_Menstruation/RJW_Menstruation/UI/Dialog_WombStatus.cs @@ -394,6 +394,8 @@ namespace RJW_Menstruation statvalue = Configurations.ImplantationChance * comp.Props.baseImplantationChanceFactor * comp.ImplantFactor; FillableBarLabeled(lineRect, " " + xxx.reproduction.LabelCap.CapitalizeFirst() + " " + statvalue.ToStringPercent(), statvalue, TextureCache.fertilityTexture, Texture2D.blackTexture); + Rect overayRect = new Rect(lineRect.x, lineRect.y, lineRect.width * Math.Min(1.0f, comp.GetFertilityChance()), lineRect.height); + GUI.DrawTexture(overayRect, TextureCache.FertChanceTex); lineRect.y += height; }