Draft for Thoughts and Penalties of Missing or Multiple Queens

This commit is contained in:
Vegapnk 2023-04-22 10:11:00 +02:00
parent 8d541c78c9
commit b5121b0a04
15 changed files with 405 additions and 18 deletions

View file

@ -8,7 +8,7 @@
<stunTargetWhileCasting>true</stunTargetWhileCasting>
<displayGizmoWhileUndrafted>true</displayGizmoWhileUndrafted>
<disableGizmoWhileUndrafted>false</disableGizmoWhileUndrafted>
<statBases>
<statBases>
<Ability_Duration>5</Ability_Duration>
</statBases>
<warmupMote>Mote_CoagulateStencil</warmupMote>

View file

@ -14,7 +14,9 @@
<MeditationFocusGain>0.25</MeditationFocusGain>
</statOffsets>
<li Class="ConditionalStatAffecter_MultipleQueens">
<conditionalStatAffecters>
<li Class="RJW_Genes.ConditionalStatAffecter_MultipleQueens">
<statFactors>
<MoveSpeed>0.7</MoveSpeed>
</statFactors>
@ -22,13 +24,13 @@
<WorkSpeedGlobal>-0.5</WorkSpeedGlobal>
</statOffsets>
</li>
<li Class="ConditionalStatAffecter_QueenCloseBy">
<li Class="RJW_Genes.ConditionalStatAffecter_QueenCloseBy">
<statFactors>
<MoveSpeed>0.4</MoveSpeed>
<WorkSpeedGlobal>0.2</WorkSpeedGlobal>
</statFactors>
</li>
</conditionalStatAffecters>
<exclusionTags>
<li>rjw_genes_hive_caste</li>
@ -52,7 +54,7 @@
</exclusionTags>
<conditionalStatAffecters>
<li Class="ConditionalStatAffecter_QueenAbsent">
<li Class="RJW_Genes.ConditionalStatAffecter_QueenAbsent">
<statFactors>
<MoveSpeed>0.9</MoveSpeed>
</statFactors>
@ -81,7 +83,7 @@
</exclusionTags>
<conditionalStatAffecters>
<li Class="ConditionalStatAffecter_QueenAbsent">
<li Class="RJW_Genes.ConditionalStatAffecter_QueenAbsent">
<statFactors>
<MoveSpeed>0.7</MoveSpeed>
</statFactors>
@ -89,7 +91,7 @@
<WorkSpeedGlobal>-0.5</WorkSpeedGlobal>
</statOffsets>
</li>
<li Class="ConditionalStatAffecter_MultipleQueens">
<li Class="RJW_Genes.ConditionalStatAffecter_MultipleQueens">
<statFactors>
<MoveSpeed>0.7</MoveSpeed>
</statFactors>
@ -97,7 +99,7 @@
<WorkSpeedGlobal>-0.5</WorkSpeedGlobal>
</statOffsets>
</li>
<li Class="ConditionalStatAffecter_QueenCloseBy">
<li Class="RJW_Genes.ConditionalStatAffecter_QueenCloseBy">
<statFactors>
<MoveSpeed>1.2</MoveSpeed>
<WorkSpeedGlobal>1.2</WorkSpeedGlobal>

View file

@ -0,0 +1,89 @@
<?xml version="1.0" encoding="utf-8" ?>
<Defs>
<ThoughtDef>
<!-- For Challenged Queens -->
<defName>rjw_genes_rival_queen_mood</defName>
<workerClass>RJW_Genes.Thoughtworker_RivalQueen_Mood</workerClass>
<validWhileDespawned>false</validWhileDespawned>
<stages>
<li>
<label>Rivaled</label>
<description>There is another queen nearby!</description>
<baseMoodEffect>-70</baseMoodEffect>
</li>
</stages>
</ThoughtDef>
<ThoughtDef>
<!-- For Challenged Queens -->
<defName>rjw_genes_rival_queen_social</defName>
<thoughtClass>Thought_SituationalSocial</thoughtClass>
<workerClass>RJW_Genes.Thoughtworker_RivalQueen_Social</workerClass>
<stages>
<li>
<label>rivals me</label>
<description>{0} threatens my dominion. {0} must be perished.</description>
<baseOpinionOffset>-130</baseOpinionOffset>
</li>
</stages>
</ThoughtDef>
<ThoughtDef>
<!-- For Loyal Pawns -->
<defName>rjw_genes_multiple_queens_mood</defName>
<workerClass>RJW_Genes.Thoughtworker_MultipleQueens_Mood</workerClass>
<validWhileDespawned>false</validWhileDespawned>
<stages>
<li>
<label>Confused Servitude</label>
<description>I have too many queens around me!</description>
<baseMoodEffect>-30</baseMoodEffect>
</li>
</stages>
</ThoughtDef>
<ThoughtDef>
<!-- For Loyal Pawns -->
<defName>rjw_genes_queen_loyalty_social</defName>
<thoughtClass>Thought_SituationalSocial</thoughtClass>
<workerClass>RJW_Genes.Thoughtworker_QueenPresent_Social</workerClass>
<stages>
<li>
<label>Worship</label>
<description>{0} is my queen. My one and only reason to live.</description>
<baseOpinionOffset>+80</baseOpinionOffset>
</li>
</stages>
</ThoughtDef>
<ThoughtDef>
<!-- For Loyal Pawns -->
<defName>rjw_genes_no_queen_mood</defName>
<workerClass>RJW_Genes.Thoughtworker_QueenAbsent_Mood</workerClass>
<validWhileDespawned>false</validWhileDespawned>
<stages>
<li>
<label>Missing Queen</label>
<description>We do not have a queen! How are we suppossed to face the cruelties of the world without a shepherd?</description>
<baseMoodEffect>-20</baseMoodEffect>
</li>
</stages>
</ThoughtDef>
<ThoughtDef>
<!-- For Loyal Pawns -->
<defName>rjw_genes_queen_present_mood</defName>
<workerClass>RJW_Genes.Thoughtworker_QueenPresent_Mood</workerClass>
<validWhileDespawned>false</validWhileDespawned>
<stages>
<li>
<label>Queen Present</label>
<description>Our queen is so wonderful.</description>
<baseMoodEffect>+10</baseMoodEffect>
</li>
</stages>
</ThoughtDef>
</Defs>

View file

@ -92,6 +92,15 @@ namespace RJW_Genes
public static readonly GeneDef rjw_genes_succubus_tail;
public static readonly GeneDef rjw_genes_succubus_wings;
// Hive
public static readonly GeneDef rjw_genes_queen;
public static readonly GeneDef rjw_genes_drone;
public static readonly GeneDef rjw_genes_worker;
public static readonly GeneDef rjw_genes_zealous_loyalty;
public static readonly GeneDef rjw_genes_cocoonweaver;
public static readonly GeneDef rjw_genes_spawn_spelopede;
//Other Defs
public static readonly XenotypeDef rjw_genes_succubus;
public static readonly DutyDef rjw_genes_flirt;

View file

@ -19,8 +19,15 @@ namespace RJW_Genes
public override bool Applies(StatRequest req)
{
// => ModsConfig.BiotechActive && req.HasThing && req.Thing.Spawned && req.Thing.Position.InSunlight(req.Thing.Map);
throw new NotImplementedException();
if (req.Pawn == null || !req.Pawn.Spawned)
return false;
if (GeneUtility.HasGeneNullCheck(req.Pawn, GeneDefOf.rjw_genes_zealous_loyalty))
{
return HiveUtility.QueensOnMap() >= 2;
}
return false;
}
}
}

View file

@ -19,8 +19,15 @@ namespace RJW_Genes
public override bool Applies(StatRequest req)
{
//ModsConfig.BiotechActive && req.HasThing && req.Thing.Spawned && req.Thing.Position.InSunlight(req.Thing.Map);
throw new NotImplementedException();
if (req.Pawn == null || !req.Pawn.Spawned)
return false;
if (GeneUtility.HasGeneNullCheck(req.Pawn, GeneDefOf.rjw_genes_zealous_loyalty))
{
return HiveUtility.QueensOnMap() == 0;
}
return false;
}
}
}

View file

@ -17,12 +17,36 @@ namespace RJW_Genes
/// </summary>
public class ConditionalStatAffecter_QueenCloseBy : ConditionalStatAffecter
{
const float EFFECT_DISTANCE = 10.0f;
public override string Label => (string)"StatsReport_QueenCloseBy".Translate();
public override bool Applies(StatRequest req)
{
// => ModsConfig.BiotechActive && req.HasThing && req.Thing.Spawned && req.Thing.Position.InSunlight(req.Thing.Map);
throw new NotImplementedException();
}
if (req.Pawn == null || !req.Pawn.Spawned)
return false;
// Case A: Check for Loyal Pawns if their One Queen is nearby
if (GeneUtility.HasGeneNullCheck(req.Pawn, GeneDefOf.rjw_genes_zealous_loyalty) && HiveUtility.QueensOnMap() == 1)
{
Pawn queen = HiveUtility.GetQueensOnMap()[0];
return req.Pawn.Position.DistanceTo(queen.Position) <= EFFECT_DISTANCE;
}
// Case A: Check for Queen if another Queen is nearby
if (GeneUtility.HasGeneNullCheck(req.Pawn, GeneDefOf.rjw_genes_zealous_loyalty) && HiveUtility.QueensOnMap() >= 2)
{
foreach (Pawn queen in HiveUtility.GetQueensOnMap())
{
if (queen != req.Pawn && req.Pawn.Position.DistanceTo(queen.Position) <= EFFECT_DISTANCE)
return true;
}
}
return false;
}
}
}

View file

@ -0,0 +1,39 @@
using RimWorld;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
namespace RJW_Genes
{
internal class HiveUtility
{
public static bool IsAdultQueen(Pawn pawn)
{
if (pawn == null || !pawn.Spawned)
return false;
if (GeneUtility.HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_queen))
{
return pawn.ageTracker.Adult;
}
return false;
}
public static int QueensOnMap()
{
List<Pawn> playersPawns = Find.CurrentMap.mapPawns.SpawnedPawnsInFaction(Faction.OfPlayer);
return playersPawns.Count(pawn => pawn.Spawned && IsAdultQueen(pawn));
}
public static List<Pawn> GetQueensOnMap()
{
List<Pawn> playersPawns = Find.CurrentMap.mapPawns.SpawnedPawnsInFaction(Faction.OfPlayer);
return playersPawns.FindAll(pawn => pawn.Spawned && IsAdultQueen(pawn));
}
}
}

View file

@ -0,0 +1,38 @@
using RimWorld;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
namespace RJW_Genes
{
public class ThoughtWorker_QueenPresent_Social : ThoughtWorker
{
protected override ThoughtState CurrentSocialStateInternal(Pawn p, Pawn other)
{
if (!p.RaceProps.Humanlike)
return (ThoughtState) false;
if (!other.RaceProps.Humanlike)
return (ThoughtState) false;
if (!RelationsUtility.PawnsKnowEachOther(p, other))
return (ThoughtState) false;
// Only check if they are spawned
if (!p.Spawned || !other.Spawned)
{
return (ThoughtState)false;
}
if (GeneUtility.HasGeneNullCheck(p, GeneDefOf.rjw_genes_zealous_loyalty) && HiveUtility.QueensOnMap() == 1)
{
return (ThoughtState) HiveUtility.IsAdultQueen(other);
}
return (ThoughtState)false;
}
}
}

View file

@ -0,0 +1,36 @@
using RimWorld;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
namespace RJW_Genes
{
public class ThoughtWorker_RivalQueen_Social : ThoughtWorker
{
protected override ThoughtState CurrentSocialStateInternal(Pawn p, Pawn other)
{
if (!p.RaceProps.Humanlike)
return (ThoughtState)false;
if (!other.RaceProps.Humanlike)
return (ThoughtState)false;
if (!RelationsUtility.PawnsKnowEachOther(p, other))
return (ThoughtState)false;
// Only check if they are spawned
if (!p.Spawned || !other.Spawned)
{
return (ThoughtState)false;
}
if(HiveUtility.IsAdultQueen(p) && HiveUtility.IsAdultQueen(other))
{
return (ThoughtState)true;
}
return (ThoughtState)false;
}
}
}

View file

@ -0,0 +1,33 @@
using RimWorld;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
namespace RJW_Genes
{
public class Thoughtworker_MultipleQueens_Mood : ThoughtWorker
{
protected override ThoughtState CurrentStateInternal(Pawn p)
{
// Error Handling and Check for Pawn being on Map
if (p == null || !p.Spawned)
return (ThoughtState) false;
// Queens cannot have loyalty thoughts
if (GeneUtility.HasGeneNullCheck(p, GeneDefOf.rjw_genes_queen))
return (ThoughtState)false;
if (GeneUtility.HasGeneNullCheck(p, GeneDefOf.rjw_genes_zealous_loyalty) && HiveUtility.QueensOnMap() >= 2)
{
return (ThoughtState)true;
}
return (ThoughtState) false;
}
}
}

View file

@ -0,0 +1,33 @@
using RimWorld;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
namespace RJW_Genes
{
public class Thoughtworker_QueenAbsent_Mood : ThoughtWorker
{
protected override ThoughtState CurrentStateInternal(Pawn p)
{
// Error Handling and Check for Pawn being on Map
if (p == null || !p.Spawned)
return (ThoughtState) false;
// Queens cannot have loyalty thoughts
if (GeneUtility.HasGeneNullCheck(p, GeneDefOf.rjw_genes_queen))
return (ThoughtState)false;
if (GeneUtility.HasGeneNullCheck(p, GeneDefOf.rjw_genes_zealous_loyalty) && HiveUtility.QueensOnMap() == 0)
{
return (ThoughtState)true;
}
return (ThoughtState) false;
}
}
}

View file

@ -0,0 +1,33 @@
using RimWorld;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
namespace RJW_Genes
{
public class Thoughtworker_QueenPresent_Mood : ThoughtWorker
{
protected override ThoughtState CurrentStateInternal(Pawn p)
{
// Error Handling and Check for Pawn being on Map
if (p == null || !p.Spawned)
return (ThoughtState) false;
// Queens cannot have loyalty thoughts
if (GeneUtility.HasGeneNullCheck(p, GeneDefOf.rjw_genes_queen))
return (ThoughtState)false;
if (GeneUtility.HasGeneNullCheck(p, GeneDefOf.rjw_genes_zealous_loyalty) && HiveUtility.QueensOnMap() == 1)
{
return (ThoughtState)true;
}
return (ThoughtState) false;
}
}
}

View file

@ -0,0 +1,29 @@
using RimWorld;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
namespace RJW_Genes
{
public class Thoughtworker_RivalQueen_Mood : ThoughtWorker
{
protected override ThoughtState CurrentStateInternal(Pawn p)
{
if (p == null || !p.Spawned)
return (ThoughtState) false;
if (HiveUtility.IsAdultQueen(p) && HiveUtility.QueensOnMap() >= 2)
{
return (ThoughtState) true;
}
return (ThoughtState) false;
}
}
}

View file

@ -91,6 +91,16 @@
<Compile Include="Genes\Hive\Abilities\CompAbilityEffect_CocoonWeaver.cs" />
<Compile Include="Genes\Hive\Abilities\CompProperties_AbilitySpawnSpelopede.cs" />
<Compile Include="Genes\Hive\Abilities\CompProperties_AbilityCocoonWeaver.cs" />
<Compile Include="Genes\Hive\Genes\ConditionalStatAffecters\ConditionalStatAffecter_MultipleQueens.cs" />
<Compile Include="Genes\Hive\Genes\ConditionalStatAffecters\ConditionalStatAffecter_QueenCloseBy.cs" />
<Compile Include="Genes\Hive\Genes\ConditionalStatAffecters\ConditionalStatAffecter_QueenAbsent.cs" />
<Compile Include="Genes\Hive\Helpers\HiveUtility.cs" />
<Compile Include="Genes\Hive\Thoughts\Thoughtworker_QueenAbsent_Mood.cs" />
<Compile Include="Genes\Hive\Thoughts\Thoughtworker_MultipleQueens_Mood.cs" />
<Compile Include="Genes\Hive\Thoughts\Thoughtworker_QueenPresent_Mood.cs" />
<Compile Include="Genes\Hive\Thoughts\Thoughtworker_RivalQueen_Mood.cs" />
<Compile Include="Genes\Hive\Thoughts\ThoughtWorker_QueenPresent_Social.cs" />
<Compile Include="Genes\Hive\Thoughts\ThoughtWorker_RivalQueen_Social.cs" />
<Compile Include="Genes\Life_Force\Abilities\AbilityUtility.cs" />
<Compile Include="Genes\Life_Force\UI\Alert_LowFertilin.cs" />
<Compile Include="Genes\Life_Force\Abilities\CompAbilityEffect_CasterIsNaked.cs" />
@ -196,8 +206,6 @@
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Folder Include="Genes\Hive\Genes\" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>