public override StateGraph CreateGraph()
        {
            StateGraph     stateGraph     = new StateGraph();
            LordToil_Party lordToil_Party = new LordToil_Party(this.spot, 2200);

            stateGraph.AddToil(lordToil_Party);
            LordToil_MarriageCeremony lordToil_MarriageCeremony = new LordToil_MarriageCeremony(this.firstPawn, this.secondPawn, this.spot);

            stateGraph.AddToil(lordToil_MarriageCeremony);
            LordToil_Party lordToil_Party2 = new LordToil_Party(this.spot, 2200);

            stateGraph.AddToil(lordToil_Party2);
            LordToil_End lordToil_End = new LordToil_End();

            stateGraph.AddToil(lordToil_End);
            Transition transition = new Transition(lordToil_Party, lordToil_MarriageCeremony, false, true);

            transition.AddTrigger(new Trigger_TickCondition(() => this.lord.ticksInToil >= 5000 && this.AreFiancesInPartyArea(), 1));
            transition.AddPreAction(new TransitionAction_Message("MessageMarriageCeremonyStarts".Translate(this.firstPawn.LabelShort, this.secondPawn.LabelShort, this.firstPawn.Named("PAWN1"), this.secondPawn.Named("PAWN2")), MessageTypeDefOf.PositiveEvent, this.firstPawn, null, 1f));
            stateGraph.AddTransition(transition, false);
            Transition transition2 = new Transition(lordToil_MarriageCeremony, lordToil_Party2, false, true);

            transition2.AddTrigger(new Trigger_TickCondition(() => this.firstPawn.relations.DirectRelationExists(PawnRelationDefOf.Spouse, this.secondPawn), 1));
            transition2.AddPreAction(new TransitionAction_Message("MessageNewlyMarried".Translate(this.firstPawn.LabelShort, this.secondPawn.LabelShort, this.firstPawn.Named("PAWN1"), this.secondPawn.Named("PAWN2")), MessageTypeDefOf.PositiveEvent, new TargetInfo(this.spot, base.Map, false), null, 1f));
            transition2.AddPreAction(new TransitionAction_Custom(delegate
            {
                this.AddAttendedWeddingThoughts();
            }));
            stateGraph.AddTransition(transition2, false);
            Transition transition3 = new Transition(lordToil_Party2, lordToil_End, false, true);

            transition3.AddTrigger(new Trigger_TickCondition(() => this.ShouldAfterPartyBeCalledOff(), 1));
            transition3.AddTrigger(new Trigger_PawnKilled());
            transition3.AddPreAction(new TransitionAction_Message("MessageMarriageCeremonyCalledOff".Translate(this.firstPawn.LabelShort, this.secondPawn.LabelShort, this.firstPawn.Named("PAWN1"), this.secondPawn.Named("PAWN2")), MessageTypeDefOf.NegativeEvent, new TargetInfo(this.spot, base.Map, false), null, 1f));
            stateGraph.AddTransition(transition3, false);
            this.afterPartyTimeoutTrigger = new Trigger_TicksPassed(7500);
            Transition transition4 = new Transition(lordToil_Party2, lordToil_End, false, true);

            transition4.AddTrigger(this.afterPartyTimeoutTrigger);
            transition4.AddPreAction(new TransitionAction_Message("MessageMarriageCeremonyAfterPartyFinished".Translate(this.firstPawn.LabelShort, this.secondPawn.LabelShort, this.firstPawn.Named("PAWN1"), this.secondPawn.Named("PAWN2")), MessageTypeDefOf.PositiveEvent, this.firstPawn, null, 1f));
            stateGraph.AddTransition(transition4, false);
            Transition transition5 = new Transition(lordToil_MarriageCeremony, lordToil_End, false, true);

            transition5.AddSource(lordToil_Party);
            transition5.AddTrigger(new Trigger_TickCondition(() => this.lord.ticksInToil >= 120000 && (this.firstPawn.Drafted || this.secondPawn.Drafted || !this.firstPawn.Position.InHorDistOf(this.spot, 4f) || !this.secondPawn.Position.InHorDistOf(this.spot, 4f)), 1));
            transition5.AddPreAction(new TransitionAction_Message("MessageMarriageCeremonyCalledOff".Translate(this.firstPawn.LabelShort, this.secondPawn.LabelShort, this.firstPawn.Named("PAWN1"), this.secondPawn.Named("PAWN2")), MessageTypeDefOf.NegativeEvent, new TargetInfo(this.spot, base.Map, false), null, 1f));
            stateGraph.AddTransition(transition5, false);
            Transition transition6 = new Transition(lordToil_MarriageCeremony, lordToil_End, false, true);

            transition6.AddSource(lordToil_Party);
            transition6.AddTrigger(new Trigger_TickCondition(() => this.ShouldCeremonyBeCalledOff(), 1));
            transition6.AddTrigger(new Trigger_PawnKilled());
            transition6.AddPreAction(new TransitionAction_Message("MessageMarriageCeremonyCalledOff".Translate(this.firstPawn.LabelShort, this.secondPawn.LabelShort, this.firstPawn.Named("PAWN1"), this.secondPawn.Named("PAWN2")), MessageTypeDefOf.NegativeEvent, new TargetInfo(this.spot, base.Map, false), null, 1f));
            stateGraph.AddTransition(transition6, false);
            return(stateGraph);
        }
        public override StateGraph CreateGraph()
        {
            StateGraph     stateGraph     = new StateGraph();
            LordToil_Party lordToil_Party = new LordToil_Party(spot, GatheringDefOf.Party);

            stateGraph.AddToil(lordToil_Party);
            LordToil_MarriageCeremony lordToil_MarriageCeremony = new LordToil_MarriageCeremony(firstPawn, secondPawn, spot);

            stateGraph.AddToil(lordToil_MarriageCeremony);
            LordToil_Party lordToil_Party2 = new LordToil_Party(spot, GatheringDefOf.Party);

            stateGraph.AddToil(lordToil_Party2);
            LordToil_End lordToil_End = new LordToil_End();

            stateGraph.AddToil(lordToil_End);
            Transition transition = new Transition(lordToil_Party, lordToil_MarriageCeremony);

            transition.AddTrigger(new Trigger_TickCondition(() => lord.ticksInToil >= 5000 && AreFiancesInPartyArea()));
            transition.AddPreAction(new TransitionAction_Message("MessageMarriageCeremonyStarts".Translate(firstPawn.LabelShort, secondPawn.LabelShort, firstPawn.Named("PAWN1"), secondPawn.Named("PAWN2")), MessageTypeDefOf.PositiveEvent, firstPawn));
            stateGraph.AddTransition(transition);
            Transition transition2 = new Transition(lordToil_MarriageCeremony, lordToil_Party2);

            transition2.AddTrigger(new Trigger_TickCondition(() => firstPawn.relations.DirectRelationExists(PawnRelationDefOf.Spouse, secondPawn)));
            transition2.AddPreAction(new TransitionAction_Message("MessageNewlyMarried".Translate(firstPawn.LabelShort, secondPawn.LabelShort, firstPawn.Named("PAWN1"), secondPawn.Named("PAWN2")), MessageTypeDefOf.PositiveEvent, new TargetInfo(spot, base.Map)));
            transition2.AddPreAction(new TransitionAction_Custom((Action) delegate
            {
                AddAttendedWeddingThoughts();
            }));
            stateGraph.AddTransition(transition2);
            Transition transition3 = new Transition(lordToil_Party2, lordToil_End);

            transition3.AddTrigger(new Trigger_TickCondition(() => ShouldAfterPartyBeCalledOff()));
            transition3.AddTrigger(new Trigger_PawnKilled());
            stateGraph.AddTransition(transition3);
            afterPartyTimeoutTrigger = new Trigger_TicksPassed(7500);
            Transition transition4 = new Transition(lordToil_Party2, lordToil_End);

            transition4.AddTrigger(afterPartyTimeoutTrigger);
            transition4.AddPreAction(new TransitionAction_Message("MessageMarriageCeremonyAfterPartyFinished".Translate(firstPawn.LabelShort, secondPawn.LabelShort, firstPawn.Named("PAWN1"), secondPawn.Named("PAWN2")), MessageTypeDefOf.PositiveEvent, firstPawn));
            stateGraph.AddTransition(transition4);
            Transition transition5 = new Transition(lordToil_MarriageCeremony, lordToil_End);

            transition5.AddSource(lordToil_Party);
            transition5.AddTrigger(new Trigger_TickCondition(() => lord.ticksInToil >= 120000 && (firstPawn.Drafted || secondPawn.Drafted || !firstPawn.Position.InHorDistOf(spot, 4f) || !secondPawn.Position.InHorDistOf(spot, 4f))));
            transition5.AddPreAction(new TransitionAction_Message("MessageMarriageCeremonyCalledOff".Translate(firstPawn.LabelShort, secondPawn.LabelShort, firstPawn.Named("PAWN1"), secondPawn.Named("PAWN2")), MessageTypeDefOf.NegativeEvent, new TargetInfo(spot, base.Map)));
            stateGraph.AddTransition(transition5);
            Transition transition6 = new Transition(lordToil_MarriageCeremony, lordToil_End);

            transition6.AddSource(lordToil_Party);
            transition6.AddTrigger(new Trigger_TickCondition(() => ShouldCeremonyBeCalledOff()));
            transition6.AddTrigger(new Trigger_PawnKilled());
            transition6.AddPreAction(new TransitionAction_Message("MessageMarriageCeremonyCalledOff".Translate(firstPawn.LabelShort, secondPawn.LabelShort, firstPawn.Named("PAWN1"), secondPawn.Named("PAWN2")), MessageTypeDefOf.NegativeEvent, new TargetInfo(spot, base.Map)));
            stateGraph.AddTransition(transition6);
            return(stateGraph);
        }
        public override StateGraph CreateGraph()
        {
            StateGraph     stateGraph     = new StateGraph();
            LordToil_Party lordToil_Party = new LordToil_Party(this.spot, 600);

            stateGraph.AddToil(lordToil_Party);
            LordToil_End lordToil_End = new LordToil_End();

            stateGraph.AddToil(lordToil_End);
            Transition transition = new Transition(lordToil_Party, lordToil_End, false, true);

            transition.AddTrigger(new Trigger_TickCondition(() => this.ShouldBeCalledOff(), 1));
            transition.AddTrigger(new Trigger_PawnKilled());
            transition.AddPreAction(new TransitionAction_Message("MessagePartyCalledOff".Translate(), MessageTypeDefOf.NegativeEvent, new TargetInfo(this.spot, base.Map, false), null, 1f));
            stateGraph.AddTransition(transition);
            this.timeoutTrigger = new Trigger_TicksPassed(Rand.RangeInclusive(5000, 15000));
            Transition transition2 = new Transition(lordToil_Party, lordToil_End, false, true);

            transition2.AddTrigger(this.timeoutTrigger);
            transition2.AddPreAction(new TransitionAction_Message("MessagePartyFinished".Translate(), MessageTypeDefOf.SituationResolved, new TargetInfo(this.spot, base.Map, false), null, 1f));
            stateGraph.AddTransition(transition2);
            return(stateGraph);
        }
        private void ApplyOutcome(LordToil_Party toil)
        {
            List <Pawn>        ownedPawns         = lord.ownedPawns;
            LordToilData_Party lordToilData_Party = (LordToilData_Party)toil.data;

            for (int i = 0; i < ownedPawns.Count; i++)
            {
                Pawn pawn = ownedPawns[i];
                bool flag = pawn == organizer;
                if (lordToilData_Party.presentForTicks.TryGetValue(pawn, out int value) && value > 0)
                {
                    if (ownedPawns[i].needs.mood != null)
                    {
                        ThoughtDef     thoughtDef      = flag ? OrganizerThought : AttendeeThought;
                        float          num             = 0.5f / thoughtDef.stages[0].baseMoodEffect;
                        float          moodPowerFactor = Mathf.Min((float)value / (float)durationTicks + num, 1f);
                        Thought_Memory thought_Memory  = (Thought_Memory)ThoughtMaker.MakeThought(thoughtDef);
                        thought_Memory.moodPowerFactor = moodPowerFactor;
                        ownedPawns[i].needs.mood.thoughts.memories.TryGainMemory(thought_Memory);
                    }
                    TaleRecorder.RecordTale(flag ? OrganizerTale : AttendeeTale, ownedPawns[i], organizer);
                }
            }
        }