mirror of
https://github.com/amevarashi/RJW-Sexperience.git
synced 2024-08-14 23:54:08 +00:00
Change filter implementation
This commit is contained in:
parent
54ba77f17c
commit
20c7b303c0
10 changed files with 286 additions and 190 deletions
|
@ -9,14 +9,8 @@ namespace RJWSexperience.Ideology.HistoryEvents
|
|||
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
|
||||
public HistoryEventDef historyEventDef;
|
||||
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
|
||||
public PartnerFilter filter;
|
||||
public TwoPawnFilter filter;
|
||||
|
||||
public bool Applies(Pawn pawn, Pawn partner)
|
||||
{
|
||||
if (filter == null)
|
||||
return false;
|
||||
|
||||
return filter.Applies(pawn, partner);
|
||||
}
|
||||
public bool Applies(Pawn pawn, Pawn partner) => filter?.Applies(pawn, partner) == true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
using RimWorld;
|
||||
using rjw;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Verse;
|
||||
|
||||
|
@ -25,7 +23,7 @@ namespace RJWSexperience.Ideology.Precepts
|
|||
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
|
||||
public float multiplier = 1f;
|
||||
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
|
||||
public PartnerFilter filter;
|
||||
public TwoPawnFilter filter;
|
||||
|
||||
public bool Applies(Pawn pawn, Pawn partner)
|
||||
{
|
||||
|
|
|
@ -1,22 +1,15 @@
|
|||
using RimWorld;
|
||||
using rjw;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Verse;
|
||||
|
||||
namespace RJWSexperience.Ideology
|
||||
{
|
||||
public class PartnerFilter
|
||||
public class RelationFilter
|
||||
{
|
||||
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
|
||||
public bool? isAnimal;
|
||||
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
|
||||
public bool? isVeneratedAnimal;
|
||||
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
|
||||
public bool? isSlave;
|
||||
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
|
||||
public bool? isPrisoner;
|
||||
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
|
||||
public bool? isAlien;
|
||||
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
|
||||
public List<PawnRelationDef> hasOneOfRelations;
|
||||
|
@ -29,18 +22,9 @@ namespace RJWSexperience.Ideology
|
|||
|
||||
public bool Applies(Pawn pawn, Pawn partner)
|
||||
{
|
||||
if (isAnimal != null && isAnimal != partner.IsAnimal())
|
||||
return false;
|
||||
|
||||
if (isVeneratedAnimal != null && isVeneratedAnimal != pawn.Ideo.IsVeneratedAnimal(partner))
|
||||
return false;
|
||||
|
||||
if (isSlave != null && isSlave != partner.IsSlave)
|
||||
return false;
|
||||
|
||||
if (isPrisoner != null && isPrisoner != partner.IsPrisoner)
|
||||
return false;
|
||||
|
||||
//if (isAlien != null && isAlien != partner)
|
||||
// return false;
|
||||
|
30
RJWSexperience/IdeologyAddon/Ideology/SinglePawnFilter.cs
Normal file
30
RJWSexperience/IdeologyAddon/Ideology/SinglePawnFilter.cs
Normal file
|
@ -0,0 +1,30 @@
|
|||
using rjw;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Verse;
|
||||
|
||||
namespace RJWSexperience.Ideology
|
||||
{
|
||||
public class SinglePawnFilter
|
||||
{
|
||||
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
|
||||
public bool? isAnimal;
|
||||
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
|
||||
public bool? isSlave;
|
||||
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
|
||||
public bool? isPrisoner;
|
||||
|
||||
public bool Applies(Pawn pawn)
|
||||
{
|
||||
if (isAnimal != null && isAnimal != pawn.IsAnimal())
|
||||
return false;
|
||||
|
||||
if (isSlave != null && isSlave != pawn.IsSlave)
|
||||
return false;
|
||||
|
||||
if (isPrisoner != null && isPrisoner != pawn.IsPrisoner)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
30
RJWSexperience/IdeologyAddon/Ideology/TwoPawnFilter.cs
Normal file
30
RJWSexperience/IdeologyAddon/Ideology/TwoPawnFilter.cs
Normal file
|
@ -0,0 +1,30 @@
|
|||
using rjw;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Verse;
|
||||
|
||||
namespace RJWSexperience.Ideology
|
||||
{
|
||||
public class TwoPawnFilter
|
||||
{
|
||||
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
|
||||
public SinglePawnFilter doer;
|
||||
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
|
||||
public SinglePawnFilter partner;
|
||||
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
|
||||
public RelationFilter relations;
|
||||
|
||||
public bool Applies(Pawn pawn, Pawn partner)
|
||||
{
|
||||
if (doer?.Applies(pawn) == false)
|
||||
return false;
|
||||
|
||||
if (this.partner?.Applies(pawn) == false)
|
||||
return false;
|
||||
|
||||
if (relations?.Applies(pawn, partner) == false)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -52,6 +52,9 @@
|
|||
<Compile Include="Ideology\HistoryEvents\ArgsNamesCustom.cs" />
|
||||
<Compile Include="Ideology\IssueUtility.cs" />
|
||||
<Compile Include="Ideology\Keyed.cs" />
|
||||
<Compile Include="Ideology\RelationFilter.cs" />
|
||||
<Compile Include="Ideology\TwoPawnFilter.cs" />
|
||||
<Compile Include="Ideology\SinglePawnFilter.cs" />
|
||||
<Compile Include="Ideology\Precepts\Comp_SelfTookMemoryThought_Gendered.cs" />
|
||||
<Compile Include="Ideology\Precepts\Comp_KnowsMemoryThought_Gendered.cs" />
|
||||
<Compile Include="Ideology\RJWUtility_Ideo.cs" />
|
||||
|
@ -63,7 +66,6 @@
|
|||
<Compile Include="Ideology\Precepts\DefExtension_ModifyBestialityMtb.cs" />
|
||||
<Compile Include="Ideology\Precepts\DefExtension_ModifyPreference.cs" />
|
||||
<Compile Include="Ideology\Precepts\DefExtension_MultipleMemesRequired.cs" />
|
||||
<Compile Include="Ideology\PartnerFilter.cs" />
|
||||
<Compile Include="Ideology\Rituals\JobGiver_GangbangConsensual.cs" />
|
||||
<Compile Include="Ideology\Rituals\LordJob_Rituals.cs" />
|
||||
<Compile Include="Ideology\Patches\RJW_Patch_Ideo.cs" />
|
||||
|
|
|
@ -16,32 +16,46 @@
|
|||
<generationRules>
|
||||
<li>
|
||||
<filter>
|
||||
<relations>
|
||||
<isVeneratedAnimal>true</isVeneratedAnimal>
|
||||
</relations>
|
||||
</filter>
|
||||
<historyEventDef>RSI_SexWithVeneratedAnimal</historyEventDef>
|
||||
</li>
|
||||
<li>
|
||||
<filter>
|
||||
<partner>
|
||||
<isAnimal>true</isAnimal>
|
||||
</partner>
|
||||
<relations>
|
||||
<isVeneratedAnimal>false</isVeneratedAnimal>
|
||||
</relations>
|
||||
</filter>
|
||||
<historyEventDef>RSI_SexWithNonVeneratedAnimal</historyEventDef>
|
||||
</li>
|
||||
<li>
|
||||
<filter>
|
||||
<partner>
|
||||
<isAnimal>true</isAnimal>
|
||||
</partner>
|
||||
<relations>
|
||||
<hasOneOfRelations>
|
||||
<li>Bond</li>
|
||||
</hasOneOfRelations>
|
||||
</relations>
|
||||
</filter>
|
||||
<historyEventDef>RSI_SexWithBondedAnimal</historyEventDef>
|
||||
</li>
|
||||
<li>
|
||||
<filter>
|
||||
<partner>
|
||||
<isAnimal>true</isAnimal>
|
||||
</partner>
|
||||
<relations>
|
||||
<hasNoneOfRelations>
|
||||
<li>Bond</li>
|
||||
</hasNoneOfRelations>
|
||||
</relations>
|
||||
</filter>
|
||||
<historyEventDef>RSI_SexWithNonBondAnimal</historyEventDef>
|
||||
</li>
|
||||
|
@ -113,7 +127,9 @@
|
|||
<rules>
|
||||
<li>
|
||||
<filter>
|
||||
<partner>
|
||||
<isAnimal>true</isAnimal>
|
||||
</partner>
|
||||
</filter>
|
||||
<multiplier>0.05</multiplier>
|
||||
</li>
|
||||
|
@ -160,7 +176,9 @@
|
|||
<rules>
|
||||
<li>
|
||||
<filter>
|
||||
<partner>
|
||||
<isAnimal>true</isAnimal>
|
||||
</partner>
|
||||
</filter>
|
||||
<multiplier>0.1</multiplier>
|
||||
</li>
|
||||
|
@ -210,7 +228,9 @@
|
|||
<rules>
|
||||
<li>
|
||||
<filter>
|
||||
<partner>
|
||||
<isAnimal>true</isAnimal>
|
||||
</partner>
|
||||
</filter>
|
||||
<multiplier>0.5</multiplier>
|
||||
</li>
|
||||
|
@ -279,14 +299,20 @@
|
|||
<rules>
|
||||
<li>
|
||||
<filter>
|
||||
<relations>
|
||||
<isVeneratedAnimal>true</isVeneratedAnimal>
|
||||
</relations>
|
||||
</filter>
|
||||
<multiplier>2.0</multiplier>
|
||||
</li>
|
||||
<li>
|
||||
<filter>
|
||||
<partner>
|
||||
<isAnimal>true</isAnimal>
|
||||
</partner>
|
||||
<relations>
|
||||
<isVeneratedAnimal>false</isVeneratedAnimal>
|
||||
</relations>
|
||||
</filter>
|
||||
<multiplier>0.05</multiplier>
|
||||
</li>
|
||||
|
@ -342,19 +368,27 @@
|
|||
<rules>
|
||||
<li>
|
||||
<filter>
|
||||
<partner>
|
||||
<isAnimal>true</isAnimal>
|
||||
</partner>
|
||||
<relations>
|
||||
<hasOneOfRelations>
|
||||
<li>Bond</li>
|
||||
</hasOneOfRelations>
|
||||
</relations>
|
||||
</filter>
|
||||
<multiplier>2.0</multiplier>
|
||||
</li>
|
||||
<li>
|
||||
<filter>
|
||||
<partner>
|
||||
<isAnimal>true</isAnimal>
|
||||
</partner>
|
||||
<relations>
|
||||
<hasNoneOfRelations>
|
||||
<li>Bond</li>
|
||||
</hasNoneOfRelations>
|
||||
</relations>
|
||||
</filter>
|
||||
<multiplier>0.1</multiplier>
|
||||
</li>
|
||||
|
@ -409,7 +443,9 @@
|
|||
<rules>
|
||||
<li>
|
||||
<filter>
|
||||
<partner>
|
||||
<isAnimal>true</isAnimal>
|
||||
</partner>
|
||||
</filter>
|
||||
<multiplier>2.0</multiplier>
|
||||
</li>
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
<overrideRules>
|
||||
<li>
|
||||
<filter>
|
||||
<relations>
|
||||
<hasOneOfRelations>
|
||||
<li>Parent</li>
|
||||
<li>Child</li>
|
||||
|
@ -36,11 +37,13 @@
|
|||
<li>NephewOrNiece</li>
|
||||
<li>UncleOrAunt</li>
|
||||
</hasOneOfRelations>
|
||||
</relations>
|
||||
</filter>
|
||||
<historyEventDef>RSI_CloseRelativeMarriage</historyEventDef>
|
||||
</li>
|
||||
<li>
|
||||
<filter>
|
||||
<relations>
|
||||
<hasOneOfRelations>
|
||||
<li>Parent</li>
|
||||
<li>Child</li>
|
||||
|
@ -59,6 +62,7 @@
|
|||
<li>Cousin</li>
|
||||
<li>Kin</li>
|
||||
</hasOneOfRelations>
|
||||
</relations>
|
||||
</filter>
|
||||
<historyEventDef>RSI_IncestuosMarriage</historyEventDef>
|
||||
</li>
|
||||
|
@ -85,6 +89,7 @@
|
|||
<overrideRules>
|
||||
<li>
|
||||
<filter>
|
||||
<relations>
|
||||
<hasOneOfRelations>
|
||||
<li>Parent</li>
|
||||
<li>Child</li>
|
||||
|
@ -95,11 +100,13 @@
|
|||
<li>NephewOrNiece</li>
|
||||
<li>UncleOrAunt</li>
|
||||
</hasOneOfRelations>
|
||||
</relations>
|
||||
</filter>
|
||||
<historyEventDef>RSI_CloseRelativeSex</historyEventDef>
|
||||
</li>
|
||||
<li>
|
||||
<filter>
|
||||
<relations>
|
||||
<hasOneOfRelations>
|
||||
<li>Parent</li>
|
||||
<li>Child</li>
|
||||
|
@ -118,6 +125,7 @@
|
|||
<li>Cousin</li>
|
||||
<li>Kin</li>
|
||||
</hasOneOfRelations>
|
||||
</relations>
|
||||
</filter>
|
||||
<historyEventDef>RSI_IncestuosSex</historyEventDef>
|
||||
</li>
|
||||
|
@ -163,6 +171,7 @@
|
|||
<rules>
|
||||
<li>
|
||||
<filter>
|
||||
<relations>
|
||||
<hasOneOfRelations>
|
||||
<li>Parent</li>
|
||||
<li>Child</li>
|
||||
|
@ -176,6 +185,7 @@
|
|||
<hasNoneOfRelations>
|
||||
<li>Spouse</li>
|
||||
</hasNoneOfRelations>
|
||||
</relations>
|
||||
</filter>
|
||||
<multiplier>0.5</multiplier>
|
||||
</li>
|
||||
|
@ -212,6 +222,7 @@
|
|||
<rules>
|
||||
<li>
|
||||
<filter>
|
||||
<relations>
|
||||
<hasOneOfRelations>
|
||||
<li>Parent</li>
|
||||
<li>Child</li>
|
||||
|
@ -233,6 +244,7 @@
|
|||
<hasNoneOfRelations>
|
||||
<li>Spouse</li>
|
||||
</hasNoneOfRelations>
|
||||
</relations>
|
||||
</filter>
|
||||
<multiplier>0.5</multiplier>
|
||||
</li>
|
||||
|
@ -269,6 +281,7 @@
|
|||
<rules>
|
||||
<li>
|
||||
<filter>
|
||||
<relations>
|
||||
<hasOneOfRelations>
|
||||
<li>Parent</li>
|
||||
<li>Child</li>
|
||||
|
@ -290,6 +303,7 @@
|
|||
<hasNoneOfRelations>
|
||||
<li>Spouse</li>
|
||||
</hasNoneOfRelations>
|
||||
</relations>
|
||||
</filter>
|
||||
<multiplier>0.1</multiplier>
|
||||
</li>
|
||||
|
@ -324,6 +338,7 @@
|
|||
<rules>
|
||||
<li>
|
||||
<filter>
|
||||
<relations>
|
||||
<hasOneOfRelations>
|
||||
<li>Parent</li>
|
||||
<li>Child</li>
|
||||
|
@ -342,6 +357,7 @@
|
|||
<li>Cousin</li>
|
||||
<li>Kin</li>
|
||||
</hasOneOfRelations>
|
||||
</relations>
|
||||
</filter>
|
||||
<multiplier>2.0</multiplier>
|
||||
</li>
|
||||
|
|
|
@ -16,13 +16,17 @@
|
|||
<overrideRules>
|
||||
<li>
|
||||
<filter>
|
||||
<partner>
|
||||
<isSlave>true</isSlave>
|
||||
</partner>
|
||||
</filter>
|
||||
<historyEventDef>RSI_RapedSlave</historyEventDef>
|
||||
</li>
|
||||
<li>
|
||||
<filter>
|
||||
<partner>
|
||||
<isPrisoner>true</isPrisoner>
|
||||
</partner>
|
||||
</filter>
|
||||
<historyEventDef>RSI_RapedPrisoner</historyEventDef>
|
||||
</li>
|
||||
|
|
|
@ -21,9 +21,11 @@
|
|||
<generationRules>
|
||||
<li>
|
||||
<filter>
|
||||
<relations>
|
||||
<hasNoneOfRelations>
|
||||
<li>Spouse</li>
|
||||
</hasNoneOfRelations>
|
||||
</relations>
|
||||
</filter>
|
||||
<historyEventDef>RSI_VirginTakenNotSpouse</historyEventDef>
|
||||
</li>
|
||||
|
|
Loading…
Reference in a new issue