Made each gene to have a chance to be inherited

This commit is contained in:
Shabakur 2022-11-30 12:06:35 +01:00
parent 3c5cf22169
commit ddd55d1400
14 changed files with 69 additions and 36 deletions

Binary file not shown.

View File

@ -6,7 +6,7 @@
defName can be anything you want, as long as it is unique
<raceGroup>Canine_Group</raceGroup>
RJW.Racegroupdef, all animals in the raceGroup will be part of this group
RJW.Racegroupdef, all animals in the raceGroup will be part of this group, RJW race support uses this so those can be used to quickly add a group
<raceNames>
<li> </li>
@ -27,9 +27,9 @@
</genes>
The genes which may be inherited.
<geneweights>
<li>90</li>
</geneweights>
<genechances>
<li>0.9</li>
</genechances>
WIP, the chance of each gene to be inherited. Is in same order as genes, so for the second gene the chance to inherit is based on the second line in geweights.
</RJW_BGS.RaceGeneDef>

View File

@ -6,9 +6,9 @@
<genes>
<li>Ears_Floppy</li>
</genes>
<geneweights>
<li>90</li>
</geneweights>
<genechances>
<li>0.9</li>
</genechances>
</RJW_BGS.RaceGeneDef>
<RJW_BGS.RaceGeneDef>
@ -17,9 +17,9 @@
<genes>
<li>Beauty_Ugly</li>
</genes>
<geneweights>
<li>50</li>
</geneweights>
<genechances>
<li>0.5</li>
</genechances>
</RJW_BGS.RaceGeneDef>
<RJW_BGS.RaceGeneDef>
@ -30,11 +30,11 @@
<li>Sleepy</li>
<li>DarkVision</li>
</genes>
<geneweights>
<li>90</li>
<li>25</li>
<li>25</li>
</geneweights>
<genechances>
<li>0.9</li>
<li>0.25</li>
<li>0.25</li>
</genechances>
</RJW_BGS.RaceGeneDef>
<!--
<RJW_BGS.RaceGeneDef>
@ -43,9 +43,9 @@
<genes>
<li>Ears_Floppy</li>
</genes>
<geneweights>
<genechances>
<li>10</li>
</geneweights>
</genechances>
</RJW_BGS.RaceGeneDef>
-->
<RJW_BGS.RaceGeneDef>
@ -55,10 +55,10 @@
<li>Unstoppable</li>
<li>Headbone_CenterHorn</li>
</genes>
<geneweights>
<li>25</li>
<li>90</li>
</geneweights>
<genechances>
<li>0.25</li>
<li>0.9</li>
</genechances>
</RJW_BGS.RaceGeneDef>
<RJW_BGS.RaceGeneDef>
@ -67,9 +67,9 @@
<genes>
<li>Fertile</li>
</genes>
<geneweights>
<li>10</li>
</geneweights>
<genechances>
<li>0.25</li>
</genechances>
</RJW_BGS.RaceGeneDef>
<RJW_BGS.RaceGeneDef>
@ -78,9 +78,9 @@
<genes>
<li>StrongStomach</li>
</genes>
<geneweights>
<li>50</li>
</geneweights>
<genechances>
<li>0.5</li>
</genechances>
</RJW_BGS.RaceGeneDef>
<!--
<RJW_BGS.RaceGeneDef>
@ -89,9 +89,9 @@
<genes>
<li>Ears_Floppy</li>
</genes>
<geneweights>
<genechances>
<li>10</li>
</geneweights>
</genechances>
</RJW_BGS.RaceGeneDef>
-->
<!--
@ -101,9 +101,9 @@
<genes>
<li>Ears_Floppy</li>
</genes>
<geneweights>
<genechances>
<li>10</li>
</geneweights>
</genechances>
</RJW_BGS.RaceGeneDef>
-->
</Defs>

Binary file not shown.

View File

@ -60,5 +60,30 @@ namespace RJW_BGS
}
return genelist;
}
public static List<GeneDef> SelectGenes(Pawn pawn)
{
List<GeneDef> genelist = new List<GeneDef>();
PawnKindDef pawnKindDef = pawn.kindDef;
RaceGeneDef raceGeneDef = RJWcopy.GetRaceGenDefInternal(pawnKindDef);
if (raceGeneDef != null)
{
int num1 = raceGeneDef.genes.Count;
int num2 = raceGeneDef.genechances.Count;
if (num1 != num2)
{
Log.Error("The amount of genes and genechanches are different in " + raceGeneDef.defName + ". Can't select genes to inherit");
return genelist;
}
for (int i = 0; i<num1; i++)
{
if (raceGeneDef.genechances[i] > Rand.Range(0.01f, 1f))
{
genelist.Add(DefDatabase<GeneDef>.GetNamed(raceGeneDef.genes[i]));
}
}
}
return genelist;
}
}
}

View File

@ -32,15 +32,15 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="0Harmony">
<HintPath>..\..\..\..\..\..\workshop\content\294100\2009463077\Current\Assemblies\0Harmony.dll</HintPath>
<HintPath>..\..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\workshop\content\294100\2009463077\Current\Assemblies\0Harmony.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>..\..\..\..\RimWorldWin64_Data\Managed\Assembly-CSharp.dll</HintPath>
<HintPath>..\..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\RimWorld\RimWorldWin64_Data\Managed\Assembly-CSharp.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="RJW">
<HintPath>..\..\..\RJW\1.4\Assemblies\RJW.dll</HintPath>
<HintPath>..\..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\RimWorld\Mods\RJW\1.4\Assemblies\RJW.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
@ -52,7 +52,7 @@
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="UnityEngine">
<HintPath>..\..\..\..\RimWorldWin64_Data\Managed\UnityEngine.dll</HintPath>
<HintPath>..\..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\RimWorld\RimWorldWin64_Data\Managed\UnityEngine.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>

View File

@ -14,7 +14,7 @@ namespace RJW_BGS
public List<string> raceNames;
public List<string> pawnKindNames;
public List<string> genes;
public List<float> geneweights;
public List<float> genechances;
public String hybridName;
}
}

View File

@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]

View File

@ -2,3 +2,7 @@ C:\Program Files (x86)\Steam\steamapps\common\RimWorld\Mods\RJW_Bestiality_Gene_
C:\Program Files (x86)\Steam\steamapps\common\RimWorld\Mods\RJW_Bestiality_Gene_Support\Source\RJW_BGS\obj\Debug\RJW_BGS.csproj.AssemblyReference.cache
C:\Program Files (x86)\Steam\steamapps\common\RimWorld\Mods\RJW_Bestiality_Gene_Support\Source\RJW_BGS\obj\Debug\RJW_BGS.csproj.CoreCompileInputs.cache
C:\Program Files (x86)\Steam\steamapps\common\RimWorld\Mods\RJW_Bestiality_Gene_Support\Source\RJW_BGS\obj\Debug\RJW_BGS.dll
C:\Users\tyrob\OneDrive\Documenten\GitHub\RJW_Animal_Gene_Inheritance\Assemblies\RJW_BGS.dll
C:\Users\tyrob\OneDrive\Documenten\GitHub\RJW_Animal_Gene_Inheritance\Source\RJW_BGS\obj\Debug\RJW_BGS.csproj.AssemblyReference.cache
C:\Users\tyrob\OneDrive\Documenten\GitHub\RJW_Animal_Gene_Inheritance\Source\RJW_BGS\obj\Debug\RJW_BGS.csproj.CoreCompileInputs.cache
C:\Users\tyrob\OneDrive\Documenten\GitHub\RJW_Animal_Gene_Inheritance\Source\RJW_BGS\obj\Debug\RJW_BGS.dll

Binary file not shown.