rjw-genes/Source/Genes/Life_Force/LordJob_SuccubusVisit.cs
Shabakur 7958f021b9 LordJob and LordToil Fininished
Succubus will not when spawned rape target, and afterward will follow target. Succubus will target someone else at random or when target is unreachable or sleeping
2023-01-16 17:16:25 +01:00

87 lines
3.2 KiB
C#

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;
namespace RJW_Genes
{
//Based on LordJob_VisitColony
public class LordJob_SuccubusVisit : LordJob
{
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_Message("SuccubusLeaving".Translate(), null, 1f));
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);
}
public Pawn target;
private int? durationTicks;
public StateGraph exitSubgraph;
}
}