mirror of
https://github.com/vegapnk/RJW-Genes.git
synced 2024-08-15 00:23:31 +00:00
Rescued Succubus Artifacts
This commit is contained in:
parent
51b988f18c
commit
eab2485787
12 changed files with 650 additions and 1 deletions
|
@ -0,0 +1,134 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse;
|
||||
using Verse.AI;
|
||||
using Verse.AI.Group;
|
||||
using RimWorld;
|
||||
using rjw;
|
||||
namespace RJW_Genes
|
||||
{
|
||||
public class IncidentWorker_SuccubusDreamVisit : IncidentWorker
|
||||
{
|
||||
//This incidint will only fire if there is a pawn asleep and sexneed is lower than 0.25
|
||||
protected override bool CanFireNowSub(IncidentParms parms)
|
||||
{
|
||||
if (!base.CanFireNowSub(parms))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
Map map = (Map)parms.target;
|
||||
if (!map.mapTemperature.SeasonAcceptableFor(ThingDefOf.Human))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!RJW_Genes_Settings.rjw_genes_sexdemon_visit_incubi && !RJW_Genes_Settings.rjw_genes_sexdemon_visit_succubi)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach (Pawn pawn in map.mapPawns.FreeColonistsAndPrisonersSpawned)
|
||||
{
|
||||
if (pawn.jobs.curDriver.asleep && xxx.need_some_sex(pawn) > 1f)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
protected override bool TryExecuteWorker(IncidentParms parms)
|
||||
{
|
||||
Map map = (Map)parms.target;
|
||||
List<Pawn> victims = ValidVictims(map).ToList();
|
||||
if (victims.NullOrEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
Faction faction;
|
||||
if (!this.TryFindFormerFaction(out faction))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
int pawn_amount = RJW_Genes_Settings.rjw_genes_sexdemon_visit_groups ? Rand.Range(1, victims.Count) : 1;
|
||||
List<Pawn> new_sexdemons = new List<Pawn>();
|
||||
for (int i = 0; i < pawn_amount; i++)
|
||||
{
|
||||
Pawn victim = victims.RandomElement();
|
||||
IntVec3 loc = victim.Position;
|
||||
|
||||
PawnKindDef pawnKindDef;
|
||||
Gender gender;
|
||||
if (victim.gender == Gender.Male || !RJW_Genes_Settings.rjw_genes_sexdemon_visit_incubi)
|
||||
{
|
||||
|
||||
}
|
||||
if ((Rand.Bool && RJW_Genes_Settings.rjw_genes_sexdemon_visit_succubi) || !RJW_Genes_Settings.rjw_genes_sexdemon_visit_incubi)
|
||||
{
|
||||
pawnKindDef = PawnKindDef.Named("rjw_genes_succubus");
|
||||
gender = Gender.Female;
|
||||
}
|
||||
else
|
||||
{
|
||||
pawnKindDef = PawnKindDef.Named("rjw_genes_incubus");
|
||||
gender = Gender.Male;
|
||||
}
|
||||
|
||||
//Spawn succubus at pawn
|
||||
Pawn sexdemon = PawnGenerator.GeneratePawn(new PawnGenerationRequest(pawnKindDef, faction, PawnGenerationContext.NonPlayer, -1,
|
||||
false, false, false, true, false, 1f, false, true, false, true, true, false, false, false, false, 0f, 0f, null, 1f, null, null,
|
||||
null, null, null, null, null, gender, null, null, null, null, false, false, false, false, null, null, null, null, null, 0f,
|
||||
DevelopmentalStage.Adult, null, null, null, false));
|
||||
sexdemon.SetFaction(null, null);
|
||||
GenSpawn.Spawn(sexdemon, loc, map, WipeMode.Vanish);
|
||||
List<Pawn> sexdemons = new List<Pawn> { sexdemon };
|
||||
new_sexdemons.Add(sexdemon);
|
||||
|
||||
|
||||
LordMaker.MakeNewLord(Faction.OfPlayer, this.CreateLordJob(parms, sexdemon, victim), map, sexdemons);
|
||||
|
||||
//Make succubus rape victim.
|
||||
if (RJWSettings.rape_enabled)
|
||||
{
|
||||
//follow rjw rules
|
||||
if (SexAppraiser.would_fuck(sexdemon, victim) > 0f)
|
||||
{
|
||||
sexdemon.pather.StopDead();
|
||||
sexdemon.jobs.StopAll();
|
||||
Job newJob = JobMaker.MakeJob(xxx.RapeRandom, victim);
|
||||
sexdemon.jobs.StartJob(newJob, JobCondition.InterruptForced, null, false, true, null, null, false, false, null, false, true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Find.LetterStack.ReceiveLetter("rjw_genes_sexdemon_visit_incident_label".Translate(), "rjw_genes_sexdemon_visit_incident_description".Translate(), RimWorld.LetterDefOf.PositiveEvent, new_sexdemons, null, null, null, null);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private IEnumerable<Pawn> ValidVictims(Map map)
|
||||
{
|
||||
foreach (Pawn pawn in map.mapPawns.FreeColonistsAndPrisonersSpawned)
|
||||
{
|
||||
if (pawn.jobs.curDriver.asleep && xxx.need_some_sex(pawn) > 1f)
|
||||
{
|
||||
yield return pawn;
|
||||
}
|
||||
}
|
||||
yield break;
|
||||
}
|
||||
|
||||
private bool TryFindFormerFaction(out Faction formerFaction)
|
||||
{
|
||||
return Find.FactionManager.TryGetRandomNonColonyHumanlikeFaction(out formerFaction, false, true, TechLevel.Undefined, false);
|
||||
}
|
||||
|
||||
protected virtual LordJob_SuccubusVisit CreateLordJob(IncidentParms parms, Pawn succubus, Pawn target)
|
||||
{
|
||||
return new LordJob_SuccubusVisit(target);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,102 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Verse;
|
||||
using Verse.AI.Group;
|
||||
using RimWorld;
|
||||
using rjw;
|
||||
namespace RJW_Genes
|
||||
{
|
||||
//Based on LordJob_VisitColony
|
||||
public class LordJob_SuccubusVisit : LordJob
|
||||
{
|
||||
public LordJob_SuccubusVisit() { }
|
||||
public LordJob_SuccubusVisit(Pawn target)
|
||||
{
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
//
|
||||
//Stategraph has lordtoils which say what a pawn should be doing
|
||||
//Transitions say when active lordtoil for pawn should change
|
||||
//
|
||||
public override StateGraph CreateGraph()
|
||||
{
|
||||
StateGraph stateGraph = new StateGraph();
|
||||
|
||||
//Flirt
|
||||
LordToil_Flirt lordToil_Flirt = new LordToil_Flirt(this.target, 7f);
|
||||
stateGraph.AddToil(lordToil_Flirt);
|
||||
stateGraph.StartingToil = lordToil_Flirt;
|
||||
|
||||
//Leave
|
||||
LordToil_ExitMapRandom lordToil_ExitMapRandom = new LordToil_ExitMapRandom();
|
||||
stateGraph.AddToil(lordToil_ExitMapRandom);
|
||||
LordToil_ExitMapAndDefendSelf lordToil_ExitMapAndDefendSelf = new LordToil_ExitMapAndDefendSelf();
|
||||
stateGraph.AddToil(lordToil_ExitMapAndDefendSelf);
|
||||
|
||||
//Leave after some time
|
||||
Transition transition1 = new Transition(lordToil_Flirt, lordToil_ExitMapRandom, false, true);
|
||||
int tickLimit;
|
||||
if (this.durationTicks != null)
|
||||
{
|
||||
tickLimit = this.durationTicks.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
tickLimit = Rand.Range(60000, 180000); //~1-3 days
|
||||
}
|
||||
transition1.AddTrigger(new Trigger_TicksPassed(tickLimit));
|
||||
transition1.AddPreAction(new TransitionAction_Custom(new Action(this.SuccubiLeave))); //Join or leave colony
|
||||
stateGraph.AddTransition(transition1);
|
||||
|
||||
//If they become hostile
|
||||
Transition transition3 = new Transition(lordToil_Flirt, lordToil_ExitMapAndDefendSelf, false, true);
|
||||
transition3.AddSource(lordToil_ExitMapRandom); //Not sure what this does
|
||||
transition3.AddTrigger(new Trigger_BecamePlayerEnemy());
|
||||
transition3.AddTrigger(new Trigger_PawnKilled());
|
||||
transition3.AddPostAction(new TransitionAction_EndAllJobs());
|
||||
stateGraph.AddTransition(transition3, false);
|
||||
|
||||
Transition transition4 = new Transition(lordToil_ExitMapRandom, lordToil_ExitMapAndDefendSelf, false, true);
|
||||
transition4.AddSource(lordToil_Flirt); //Not sure what this does
|
||||
transition4.AddTrigger(new Trigger_PawnHarmed(1f, true, Faction.OfPlayer));
|
||||
stateGraph.AddTransition(transition4, false);
|
||||
|
||||
return stateGraph;
|
||||
}
|
||||
|
||||
//add toggleable gizmo to allow playes to have colonists sex the succubus into joining your colony
|
||||
//comfort pawn? cooldown?
|
||||
public override IEnumerable<Gizmo> GetPawnGizmos(Pawn p)
|
||||
{
|
||||
return base.GetPawnGizmos(p);
|
||||
}
|
||||
|
||||
public override void ExposeData()
|
||||
{
|
||||
Scribe_Values.Look<int?>(ref this.durationTicks, "durationTicks", null, false);
|
||||
Scribe_References.Look<Pawn>(ref this.target, "target", false);
|
||||
}
|
||||
|
||||
public void SuccubiLeave()
|
||||
{
|
||||
foreach (Pawn pawn in this.lord.ownedPawns)
|
||||
{
|
||||
if (colonyJoiners.Contains(pawn))
|
||||
{
|
||||
RecruitUtility.Recruit(pawn, Faction.OfPlayer);
|
||||
Find.LetterStack.ReceiveLetter("rjw_genes_succubus_joins_letter_label".Translate(), string.Format("rjw_genes_succubus_joins_letter_description".Translate(), xxx.get_pawnname(pawn)), RimWorld.LetterDefOf.PositiveEvent, pawn, null, null, null, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
Messages.Message("SuccubusLeaving".Translate(xxx.get_pawnname(pawn)), pawn, MessageTypeDefOf.NeutralEvent, true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Pawn target;
|
||||
private int? durationTicks;
|
||||
public List<Pawn> colonyJoiners = new List<Pawn>();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue