mirror of
https://github.com/vegapnk/RJW-Genes.git
synced 2024-08-15 00:23:31 +00:00
Added a Size Blinded Gene that increases hookups for pawns with big dicks
This commit is contained in:
parent
ef838d1fd3
commit
2d24466985
5 changed files with 117 additions and 0 deletions
|
@ -186,4 +186,20 @@
|
|||
</modExtensions>
|
||||
</GeneDef>
|
||||
|
||||
|
||||
<GeneDef ParentName="RJWGeneDisease">
|
||||
<defName>rjw_genes_size_blinded</defName>
|
||||
<label>size blinded</label>
|
||||
<description>This genetic disease makes the carrier dramatically more drawn to pawns with huge cocks.</description>
|
||||
<iconPath>UI/Icons/ColonistBar/Idle</iconPath>
|
||||
<biostatCpx>1</biostatCpx>
|
||||
<biostatMet>1</biostatMet>
|
||||
<displayOrderInCategory>11</displayOrderInCategory>
|
||||
<modExtensions>
|
||||
<li Class="RJW_Genes.GeneticDiseaseExtension">
|
||||
<infectionChance>0.1</infectionChance>
|
||||
</li>
|
||||
</modExtensions>
|
||||
</GeneDef>
|
||||
|
||||
</Defs>
|
|
@ -126,6 +126,7 @@ namespace RJW_Genes
|
|||
public static readonly GeneDef rjw_genes_minor_vulnerability;
|
||||
public static readonly GeneDef rjw_genes_major_vulnerability;
|
||||
public static readonly GeneDef rjw_genes_fluctual_sexual_needs;
|
||||
public static readonly GeneDef rjw_genes_size_blinded;
|
||||
|
||||
//Other Defs
|
||||
public static readonly XenotypeDef rjw_genes_succubus;
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
using HarmonyLib;
|
||||
using RimWorld;
|
||||
using rjw;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse;
|
||||
|
||||
namespace RJW_Genes
|
||||
{
|
||||
/// <summary>
|
||||
/// This patch helps with the gene `rjw_genes_size_blinded`.
|
||||
/// Within RJW the CasualSexHelper utilizes the basefunction "pawn.relations.SecondaryRomanceChanceFactor"
|
||||
/// https://gitgud.io/Ed86/rjw/-/blob/master/1.5/Source/Common/Helpers/CasualSex_Helper.cs
|
||||
///
|
||||
/// We check on hookup for the other pawn if they have a penis.
|
||||
/// If yes, we modulate the romance chance based on the following:
|
||||
/// (Severity * BodySize - 0.5) * romance_multiplier
|
||||
/// So pawns with a cock smaller than 0.5 will be penalized, while pawns with more than 0.5 will be preferred.
|
||||
/// </summary>
|
||||
[HarmonyPatch(typeof(Pawn_RelationsTracker), "SecondaryRomanceChanceFactor")]
|
||||
public class Patch_SecondaryRomanceChanceFactor_Gene_SizeBlinded
|
||||
{
|
||||
|
||||
const float romance_multiplier = 2f;
|
||||
|
||||
public static void Postfix( Pawn ___pawn, Pawn otherPawn, ref float __result)
|
||||
{
|
||||
if (otherPawn == null || ___pawn == null || ___pawn.genes == null || otherPawn.genes == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (___pawn.genes.HasActiveGene(GeneDefOf.rjw_genes_size_blinded) && Genital_Helper.has_penis_fertile(otherPawn) || (Genital_Helper.has_penis_infertile(otherPawn)))
|
||||
{
|
||||
Hediff biggest_cock = GenitaliaUtility.GetBiggestPenis(otherPawn);
|
||||
if (biggest_cock != null)
|
||||
{
|
||||
float bodysize = GenitaliaUtility.GetBodySizeOfSexPart(biggest_cock);
|
||||
// Bodysize can only be a bonus, not a minus.
|
||||
bodysize = Math.Max(1.0f, bodysize);
|
||||
|
||||
float attraction_bonus = (biggest_cock.Severity * bodysize - 0.5f) * romance_multiplier;
|
||||
float result_backup = __result;
|
||||
__result += attraction_bonus;
|
||||
// Don't make it smaller than 0, to not get issues.
|
||||
__result = __result < 0 ? 0.0f : __result;
|
||||
|
||||
ModLog.Debug($"Gene_SizeBlind: Modulate Romance-Chance {___pawn}-->{otherPawn} from {result_backup} by {attraction_bonus} to {__result}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -73,5 +73,48 @@ namespace RJW_Genes
|
|||
{
|
||||
return candidate.def.defName.ToLower().Contains("breast");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the biggest penis of a pawn.
|
||||
/// In case of a identical severity, the highest body size is returned.
|
||||
/// For women, or pawns without a penis, null is returned.
|
||||
/// </summary>
|
||||
/// <param name="pawn"></param>
|
||||
/// <returns>The biggest penis of a pawn. Null on women or error.</returns>
|
||||
public static Hediff GetBiggestPenis(Pawn pawn)
|
||||
{
|
||||
Hediff best = null;
|
||||
var parts = Genital_Helper.get_AllPartsHediffList(pawn);
|
||||
|
||||
foreach (var part in parts)
|
||||
{
|
||||
if (Genital_Helper.is_sex_part(part) && Genital_Helper.is_penis(part))
|
||||
{
|
||||
if (best == null) best = part;
|
||||
|
||||
// On a draw of size, we check the body-size.
|
||||
if (part.Severity == best.Severity) {
|
||||
var partSize = part.TryGetComp<rjw.CompHediffBodyPart>();
|
||||
var bestSize = part.TryGetComp<rjw.CompHediffBodyPart>();
|
||||
if (partSize == null || bestSize == null) { continue; }
|
||||
|
||||
best = partSize.SizeOwner > bestSize.SizeOwner ? part : best;
|
||||
} else if (part.Severity > best.Severity) {
|
||||
best = part;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return best;
|
||||
}
|
||||
|
||||
public static float GetBodySizeOfSexPart(Hediff part)
|
||||
{
|
||||
if (part == null || part.TryGetComp<rjw.CompHediffBodyPart>() == null)
|
||||
return 0.0f;
|
||||
else
|
||||
return part.TryGetComp<rjw.CompHediffBodyPart>().SizeOwner;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -78,6 +78,7 @@
|
|||
<Compile Include="Genes\Diseases\Defs\GeneticDiseaseExtension.cs" />
|
||||
<Compile Include="Genes\Diseases\Genes\Gene_FluctualSexualNeed.cs" />
|
||||
<Compile Include="Genes\Diseases\Patches\Patch_AftersexUtility_TransferGeneticDiseases.cs" />
|
||||
<Compile Include="Genes\Diseases\Patches\Patch_SecondaryRomanceChanceFactor_Gene_SizeBlinded.cs" />
|
||||
<Compile Include="Genes\Life_Force\Events\SuccubusVisit\IncidentWorker_SuccubusVisit.cs" />
|
||||
<Compile Include="Genes\Life_Force\Events\SuccubusVisit\LordJob_SuccubusVisit.cs" />
|
||||
<Compile Include="Genes\Life_Force\Interactions\SuccubusTailjob\DomSuccubusTailCustomRequirementHandler.cs" />
|
||||
|
|
Loading…
Reference in a new issue