예제 #1
0
        public override StateGraph CreateGraph()
        {
            StateGraph stateGraph = new StateGraph();
            LordToil_DefendAndExpandHive lordToil_DefendAndExpandHive = new LordToil_DefendAndExpandHive();

            lordToil_DefendAndExpandHive.distToHiveToAttack = 10f;
            stateGraph.StartingToil = lordToil_DefendAndExpandHive;
            LordToil_AssaultColony lordToil_AssaultColony = new LordToil_AssaultColony();

            stateGraph.AddToil(lordToil_AssaultColony);
            Transition transition = new Transition(lordToil_DefendAndExpandHive, lordToil_AssaultColony);

            transition.AddTrigger(new Trigger_PawnHarmed(0.5f, true));
            transition.AddTrigger(new Trigger_PawnLostViolently());
            transition.AddTrigger(new Trigger_Memo(Hive.MemoAttackedByEnemy));
            transition.AddTrigger(new Trigger_Memo(Hive.MemoBurnedBadly));
            transition.AddTrigger(new Trigger_Memo(Hive.MemoDestroyed));
            transition.AddTrigger(new Trigger_Memo(HediffGiver_Heat.MemoPawnBurnedByAir));
            transition.AddPostAction(new TransitionAction_EndAllJobs());
            stateGraph.AddTransition(transition);
            Transition transition2 = new Transition(lordToil_DefendAndExpandHive, lordToil_AssaultColony);

            transition2.canMoveToSameState = true;
            transition2.AddSource(lordToil_AssaultColony);
            transition2.AddTrigger(new Trigger_Memo(Hive.MemoDestroyed));
            stateGraph.AddTransition(transition2);
            Transition transition3 = new Transition(lordToil_AssaultColony, lordToil_DefendAndExpandHive);

            transition3.AddTrigger(new Trigger_TicksPassedWithoutHarmOrMemos(1200, Hive.MemoAttackedByEnemy, Hive.MemoBurnedBadly, Hive.MemoDestroyed, HediffGiver_Heat.MemoPawnBurnedByAir));
            transition3.AddPostAction(new TransitionAction_EndAttackBuildingJobs());
            stateGraph.AddTransition(transition3);
            return(stateGraph);
        }
        public override StateGraph CreateGraph()
        {
            StateGraph          stateGraph           = new StateGraph();
            LordToil_DefendBase lordToil_DefendBase  = (LordToil_DefendBase)(stateGraph.StartingToil = new LordToil_DefendBase(this.baseCenter));
            LordToil_DefendBase lordToil_DefendBase2 = new LordToil_DefendBase(this.baseCenter);

            stateGraph.AddToil(lordToil_DefendBase2);
            LordToil_AssaultColony lordToil_AssaultColony = new LordToil_AssaultColony();

            lordToil_AssaultColony.avoidGridMode = AvoidGridMode.Smart;
            stateGraph.AddToil(lordToil_AssaultColony);
            Transition transition = new Transition(lordToil_DefendBase, lordToil_DefendBase2);

            transition.AddSource(lordToil_AssaultColony);
            transition.AddTrigger(new Trigger_BecameColonyAlly());
            stateGraph.AddTransition(transition);
            Transition transition2 = new Transition(lordToil_DefendBase2, lordToil_DefendBase);

            transition2.AddTrigger(new Trigger_BecameColonyEnemy());
            stateGraph.AddTransition(transition2);
            Transition transition3 = new Transition(lordToil_DefendBase, lordToil_AssaultColony);

            transition3.AddTrigger(new Trigger_FractionPawnsLost(0.2f));
            transition3.AddTrigger(new Trigger_PawnHarmed(0.4f, false));
            transition3.AddTrigger(new Trigger_ChanceOnTickInteval(2500, 0.03f));
            transition3.AddTrigger(new Trigger_TicksPassed(251999));
            transition3.AddTrigger(new Trigger_UrgentlyHungry());
            transition3.AddTrigger(new Trigger_ChanceOnPlayerHarmNPCBuilding(0.4f));
            transition3.AddPostAction(new TransitionAction_WakeAll());
            string message = "MessageDefendersAttacking".Translate(this.faction.def.pawnsPlural, this.faction.Name, Faction.OfPlayer.def.pawnsPlural).CapitalizeFirst();

            transition3.AddPreAction(new TransitionAction_Message(message, MessageTypeDefOf.ThreatBig));
            stateGraph.AddTransition(transition3);
            return(stateGraph);
        }
예제 #3
0
        public override StateGraph CreateGraph()
        {
            StateGraph stateGraph = new StateGraph();
            LordToil_DefendAndExpandHive lordToil_DefendAndExpandHive = new LordToil_DefendAndExpandHive();

            lordToil_DefendAndExpandHive.distToHiveToAttack = 10f;
            stateGraph.StartingToil = lordToil_DefendAndExpandHive;
            LordToil_DefendHiveAggressively lordToil_DefendHiveAggressively = new LordToil_DefendHiveAggressively();

            lordToil_DefendHiveAggressively.distToHiveToAttack = 40f;
            stateGraph.AddToil(lordToil_DefendHiveAggressively);
            LordToil_AssaultColony lordToil_AssaultColony = new LordToil_AssaultColony(false);

            stateGraph.AddToil(lordToil_AssaultColony);
            Transition transition = new Transition(lordToil_DefendAndExpandHive, (!this.aggressive) ? lordToil_DefendHiveAggressively : lordToil_AssaultColony, false, true);

            transition.AddTrigger(new Trigger_PawnHarmed(0.5f, true, null));
            transition.AddTrigger(new Trigger_PawnLostViolently());
            transition.AddTrigger(new Trigger_Memo(Hive.MemoAttackedByEnemy));
            transition.AddTrigger(new Trigger_Memo(Hive.MemoBurnedBadly));
            transition.AddTrigger(new Trigger_Memo(Hive.MemoDestroyed));
            transition.AddTrigger(new Trigger_Memo(HediffGiver_Heat.MemoPawnBurnedByAir));
            transition.AddPostAction(new TransitionAction_EndAllJobs());
            stateGraph.AddTransition(transition);
            Transition transition2   = new Transition(lordToil_DefendAndExpandHive, lordToil_AssaultColony, false, true);
            Transition transition3   = transition2;
            float      chance        = 0.5f;
            Faction    parentFaction = base.Map.ParentFaction;

            transition3.AddTrigger(new Trigger_PawnHarmed(chance, false, parentFaction));
            transition2.AddPostAction(new TransitionAction_EndAllJobs());
            stateGraph.AddTransition(transition2);
            Transition transition4 = new Transition(lordToil_DefendHiveAggressively, lordToil_AssaultColony, false, true);
            Transition transition5 = transition4;

            chance        = 0.5f;
            parentFaction = base.Map.ParentFaction;
            transition5.AddTrigger(new Trigger_PawnHarmed(chance, false, parentFaction));
            transition4.AddPostAction(new TransitionAction_EndAllJobs());
            stateGraph.AddTransition(transition4);
            Transition transition6 = new Transition(lordToil_DefendAndExpandHive, (!this.aggressive) ? lordToil_DefendHiveAggressively : lordToil_AssaultColony, false, true);

            transition6.canMoveToSameState = true;
            transition6.AddSource(lordToil_AssaultColony);
            transition6.AddTrigger(new Trigger_Memo(Hive.MemoDestroyed));
            stateGraph.AddTransition(transition6);
            Transition transition7 = new Transition(lordToil_AssaultColony, lordToil_DefendAndExpandHive, false, true);

            transition7.AddSource(lordToil_DefendHiveAggressively);
            transition7.AddTrigger(new Trigger_TicksPassedWithoutHarmOrMemos(1200, new string[]
            {
                Hive.MemoAttackedByEnemy,
                Hive.MemoBurnedBadly,
                Hive.MemoDestroyed,
                HediffGiver_Heat.MemoPawnBurnedByAir
            }));
            transition7.AddPostAction(new TransitionAction_EndAttackBuildingJobs());
            stateGraph.AddTransition(transition7);
            return(stateGraph);
        }
예제 #4
0
        public override StateGraph CreateGraph()
        {
            StateGraph stateGraph = new StateGraph();
            LordToil_DefendAndExpandHive lordToil_DefendAndExpandHive = new LordToil_DefendAndExpandHive();

            lordToil_DefendAndExpandHive.distToHiveToAttack = 10f;
            stateGraph.StartingToil = lordToil_DefendAndExpandHive;
            LordToil_DefendHiveAggressively lordToil_DefendHiveAggressively = new LordToil_DefendHiveAggressively();

            lordToil_DefendHiveAggressively.distToHiveToAttack = 40f;
            stateGraph.AddToil(lordToil_DefendHiveAggressively);
            LordToil_AssaultColony lordToil_AssaultColony = new LordToil_AssaultColony();

            stateGraph.AddToil(lordToil_AssaultColony);
            Transition transition = new Transition(lordToil_DefendAndExpandHive, (!aggressive) ? ((LordToil)lordToil_DefendHiveAggressively) : ((LordToil)lordToil_AssaultColony));

            transition.AddTrigger(new Trigger_PawnHarmed(0.5f, requireInstigatorWithFaction: true));
            transition.AddTrigger(new Trigger_PawnLostViolently(allowRoofCollapse: false));
            transition.AddTrigger(new Trigger_Memo(Hive.MemoAttackedByEnemy));
            transition.AddTrigger(new Trigger_Memo(Hive.MemoBurnedBadly));
            transition.AddTrigger(new Trigger_Memo(Hive.MemoDestroyedNonRoofCollapse));
            transition.AddTrigger(new Trigger_Memo(HediffGiver_Heat.MemoPawnBurnedByAir));
            transition.AddPostAction(new TransitionAction_EndAllJobs());
            stateGraph.AddTransition(transition);
            Transition transition2   = new Transition(lordToil_DefendAndExpandHive, lordToil_AssaultColony);
            Transition transition3   = transition2;
            float      chance        = 0.5f;
            Faction    parentFaction = base.Map.ParentFaction;

            transition3.AddTrigger(new Trigger_PawnHarmed(chance, requireInstigatorWithFaction: false, parentFaction));
            transition2.AddPostAction(new TransitionAction_EndAllJobs());
            stateGraph.AddTransition(transition2);
            Transition transition4 = new Transition(lordToil_DefendHiveAggressively, lordToil_AssaultColony);
            Transition transition5 = transition4;

            chance        = 0.5f;
            parentFaction = base.Map.ParentFaction;
            transition5.AddTrigger(new Trigger_PawnHarmed(chance, requireInstigatorWithFaction: false, parentFaction));
            transition4.AddPostAction(new TransitionAction_EndAllJobs());
            stateGraph.AddTransition(transition4);
            Transition transition6 = new Transition(lordToil_DefendAndExpandHive, lordToil_DefendAndExpandHive, canMoveToSameState: true);

            transition6.AddTrigger(new Trigger_Memo(Hive.MemoDeSpawned));
            stateGraph.AddTransition(transition6);
            Transition transition7 = new Transition(lordToil_DefendHiveAggressively, lordToil_DefendHiveAggressively, canMoveToSameState: true);

            transition7.AddTrigger(new Trigger_Memo(Hive.MemoDeSpawned));
            stateGraph.AddTransition(transition7);
            Transition transition8 = new Transition(lordToil_AssaultColony, lordToil_DefendAndExpandHive);

            transition8.AddSource(lordToil_DefendHiveAggressively);
            transition8.AddTrigger(new Trigger_TicksPassedWithoutHarmOrMemos(1200, Hive.MemoAttackedByEnemy, Hive.MemoBurnedBadly, Hive.MemoDestroyedNonRoofCollapse, Hive.MemoDeSpawned, HediffGiver_Heat.MemoPawnBurnedByAir));
            transition8.AddPostAction(new TransitionAction_EndAttackBuildingJobs());
            stateGraph.AddTransition(transition8);
            return(stateGraph);
        }
        public override StateGraph CreateGraph()
        {
            StateGraph stateGraph = new StateGraph();

            if (!defSpot.IsValid)
            {
                Log.Warning("LordJob_MechanoidsDefendShip defSpot is invalid. Returning graph for LordJob_AssaultColony.");
                stateGraph.AttachSubgraph(new LordJob_AssaultColony(faction).CreateGraph());
                return(stateGraph);
            }
            LordToil_DefendPoint   lordToil_DefendPoint   = (LordToil_DefendPoint)(stateGraph.StartingToil = new LordToil_DefendPoint(defSpot, defendRadius));
            LordToil_AssaultColony lordToil_AssaultColony = new LordToil_AssaultColony();

            stateGraph.AddToil(lordToil_AssaultColony);
            if (canAssaultColony)
            {
                LordToil_AssaultColony lordToil_AssaultColony2 = new LordToil_AssaultColony();
                stateGraph.AddToil(lordToil_AssaultColony2);
                Transition transition = new Transition(lordToil_DefendPoint, lordToil_AssaultColony);
                transition.AddSource(lordToil_AssaultColony2);
                transition.AddTrigger(new Trigger_PawnCannotReachMapEdge());
                stateGraph.AddTransition(transition);
                Transition transition2 = new Transition(lordToil_DefendPoint, lordToil_AssaultColony2);
                transition2.AddTrigger(new Trigger_PawnHarmed(0.5f, requireInstigatorWithFaction: true));
                transition2.AddTrigger(new Trigger_PawnLostViolently());
                transition2.AddTrigger(new Trigger_Memo(MemoDamaged));
                transition2.AddPostAction(new TransitionAction_EndAllJobs());
                stateGraph.AddTransition(transition2);
                Transition transition3 = new Transition(lordToil_AssaultColony2, lordToil_DefendPoint);
                transition3.AddTrigger(new Trigger_TicksPassedWithoutHarmOrMemos(1380, MemoDamaged));
                transition3.AddPostAction(new TransitionAction_EndAttackBuildingJobs());
                stateGraph.AddTransition(transition3);
                Transition transition4 = new Transition(lordToil_DefendPoint, lordToil_AssaultColony);
                transition4.AddSource(lordToil_AssaultColony2);
                transition4.AddTrigger(new Trigger_AnyThingDamageTaken(things, 0.5f));
                transition4.AddTrigger(new Trigger_Memo(HediffGiver_Heat.MemoPawnBurnedByAir));
                stateGraph.AddTransition(transition4);
            }
            Transition transition5 = new Transition(lordToil_DefendPoint, lordToil_AssaultColony);

            transition5.AddTrigger(new Trigger_ChanceOnSignal(TriggerSignalType.MechClusterDefeated, 1f));
            stateGraph.AddTransition(transition5);
            if (!isMechCluster)
            {
                Transition transition6 = new Transition(lordToil_DefendPoint, lordToil_AssaultColony);
                transition6.AddTrigger(new Trigger_AnyThingDamageTaken(things, 1f));
                stateGraph.AddTransition(transition6);
            }
            return(stateGraph);
        }
예제 #6
0
        // Token: 0x060007C3 RID: 1987 RVA: 0x00043DC0 File Offset: 0x000421C0
        public override StateGraph CreateGraph()
        {
            StateGraph stateGraph = new StateGraph();

            if (!this.defSpot.IsValid)
            {
                Log.Warning("LordJob_PawnsDefendShip defSpot is invalid. Returning graph for LordJob_AssaultColony.", false);
                stateGraph.AttachSubgraph(new LordJob_AssaultColony(this.faction, true, true, false, false, true).CreateGraph());
                return(stateGraph);
            }
            LordToil_DefendPoint lordToil_DefendPoint = new LordToil_DefendPoint(this.defSpot, this.defendRadius);

            stateGraph.StartingToil = lordToil_DefendPoint;
            LordToil_AssaultColony lordToil_AssaultColony = new LordToil_AssaultColony(false);

            stateGraph.AddToil(lordToil_AssaultColony);
            LordToil_AssaultColony lordToil_AssaultColony2 = new LordToil_AssaultColony(false);

            stateGraph.AddToil(lordToil_AssaultColony2);
            Transition transition = new Transition(lordToil_DefendPoint, lordToil_AssaultColony2, false, true);

            transition.AddSource(lordToil_AssaultColony);
            transition.AddTrigger(new Trigger_PawnCannotReachMapEdge());
            stateGraph.AddTransition(transition, false);
            Transition transition2 = new Transition(lordToil_DefendPoint, lordToil_AssaultColony, false, true);

            transition2.AddTrigger(new Trigger_PawnHarmed(0.5f, true, null));
            transition2.AddTrigger(new Trigger_PawnLostViolently(true));
            transition2.AddTrigger(new Trigger_Memo(CompPawnSpawnerOnDamaged.MemoDamaged));
            transition2.AddPostAction(new TransitionAction_EndAllJobs());
            stateGraph.AddTransition(transition2, false);
            Transition transition3 = new Transition(lordToil_AssaultColony, lordToil_DefendPoint, false, true);

            transition3.AddTrigger(new Trigger_TicksPassedWithoutHarmOrMemos(1380, new string[]
            {
                CompPawnSpawnerOnDamaged.MemoDamaged
            }));
            transition3.AddPostAction(new TransitionAction_EndAttackBuildingJobs());
            stateGraph.AddTransition(transition3, false);
            Transition transition4 = new Transition(lordToil_DefendPoint, lordToil_AssaultColony2, false, true);

            transition4.AddSource(lordToil_AssaultColony);
            transition4.AddTrigger(new Trigger_ThingDamageTaken(this.shipPart, 0.5f));
            transition4.AddTrigger(new Trigger_Memo(HediffGiver_Heat.MemoPawnBurnedByAir));
            stateGraph.AddTransition(transition4, false);
            return(stateGraph);
        }
예제 #7
0
        public override StateGraph CreateGraph()
        {
            StateGraph          stateGraph           = new StateGraph();
            LordToil_DefendBase lordToil_DefendBase  = (LordToil_DefendBase)(stateGraph.StartingToil = new LordToil_DefendBase(baseCenter));
            LordToil_DefendBase lordToil_DefendBase2 = new LordToil_DefendBase(baseCenter);

            stateGraph.AddToil(lordToil_DefendBase2);
            LordToil_AssaultColony lordToil_AssaultColony = new LordToil_AssaultColony(attackDownedIfStarving: true)
            {
                useAvoidGrid = true
            };

            stateGraph.AddToil(lordToil_AssaultColony);
            Transition transition = new Transition(lordToil_DefendBase, lordToil_DefendBase2);

            transition.AddSource(lordToil_AssaultColony);
            transition.AddTrigger(new Trigger_BecameNonHostileToPlayer());
            stateGraph.AddTransition(transition);
            Transition transition2 = new Transition(lordToil_DefendBase2, lordToil_DefendBase);

            transition2.AddTrigger(new Trigger_BecamePlayerEnemy());
            stateGraph.AddTransition(transition2);
            Transition transition3 = new Transition(lordToil_DefendBase, lordToil_AssaultColony);

            transition3.AddTrigger(new Trigger_FractionPawnsLost(0.2f));
            transition3.AddTrigger(new Trigger_PawnHarmed(0.4f));
            transition3.AddTrigger(new Trigger_ChanceOnTickInteval(2500, 0.03f));
            transition3.AddTrigger(new Trigger_TicksPassed(251999));
            transition3.AddTrigger(new Trigger_UrgentlyHungry());
            transition3.AddTrigger(new Trigger_ChanceOnPlayerHarmNPCBuilding(0.4f));
            transition3.AddTrigger(new Trigger_OnClamor(ClamorDefOf.Ability));
            transition3.AddPostAction(new TransitionAction_WakeAll());
            TaggedString taggedString = "MessageDefendersAttacking".Translate(faction.def.pawnsPlural, faction.Name, Faction.OfPlayer.def.pawnsPlural).CapitalizeFirst();

            transition3.AddPreAction(new TransitionAction_Message(taggedString, MessageTypeDefOf.ThreatBig));
            stateGraph.AddTransition(transition3);
            return(stateGraph);
        }
        public override StateGraph CreateGraph()
        {
            StateGraph stateGraph = new StateGraph();
            LordToil   lordToil   = null;

            if (this.sappers)
            {
                lordToil = new LordToil_AssaultColonySappers();
                if (this.useAvoidGridSmart)
                {
                    lordToil.avoidGridMode = AvoidGridMode.Smart;
                }
                stateGraph.AddToil(lordToil);
                Transition transition = new Transition(lordToil, lordToil, true, true);
                transition.AddTrigger(new Trigger_PawnLost());
                stateGraph.AddTransition(transition);
                Transition transition2 = new Transition(lordToil, lordToil, true, false);
                transition2.AddTrigger(new Trigger_PawnHarmed(1f, false, null));
                transition2.AddPostAction(new TransitionAction_CheckForJobOverride());
                stateGraph.AddTransition(transition2);
            }
            LordToil lordToil2 = new LordToil_AssaultColony(false);

            if (this.useAvoidGridSmart)
            {
                lordToil2.avoidGridMode = AvoidGridMode.Smart;
            }
            stateGraph.AddToil(lordToil2);
            LordToil_ExitMap lordToil_ExitMap = new LordToil_ExitMap(LocomotionUrgency.Jog, false);

            lordToil_ExitMap.avoidGridMode = AvoidGridMode.Smart;
            stateGraph.AddToil(lordToil_ExitMap);
            if (this.sappers)
            {
                Transition transition3 = new Transition(lordToil, lordToil2, false, true);
                transition3.AddTrigger(new Trigger_NoFightingSappers());
                stateGraph.AddTransition(transition3);
            }
            if (this.assaulterFaction.def.humanlikeFaction)
            {
                if (this.canTimeoutOrFlee)
                {
                    Transition transition4 = new Transition(lordToil2, lordToil_ExitMap, false, true);
                    if (lordToil != null)
                    {
                        transition4.AddSource(lordToil);
                    }
                    transition4.AddTrigger(new Trigger_TicksPassed((!this.sappers) ? LordJob_AssaultColony.AssaultTimeBeforeGiveUp.RandomInRange : LordJob_AssaultColony.SapTimeBeforeGiveUp.RandomInRange));
                    transition4.AddPreAction(new TransitionAction_Message("MessageRaidersGivenUpLeaving".Translate(new object[]
                    {
                        this.assaulterFaction.def.pawnsPlural.CapitalizeFirst(),
                        this.assaulterFaction.Name
                    }), null, 1f));
                    stateGraph.AddTransition(transition4);
                    Transition transition5 = new Transition(lordToil2, lordToil_ExitMap, false, true);
                    if (lordToil != null)
                    {
                        transition5.AddSource(lordToil);
                    }
                    FloatRange floatRange    = new FloatRange(0.25f, 0.35f);
                    float      randomInRange = floatRange.RandomInRange;
                    transition5.AddTrigger(new Trigger_FractionColonyDamageTaken(randomInRange, 900f));
                    transition5.AddPreAction(new TransitionAction_Message("MessageRaidersSatisfiedLeaving".Translate(new object[]
                    {
                        this.assaulterFaction.def.pawnsPlural.CapitalizeFirst(),
                        this.assaulterFaction.Name
                    }), null, 1f));
                    stateGraph.AddTransition(transition5);
                }
                if (this.canKidnap)
                {
                    LordToil   startingToil = stateGraph.AttachSubgraph(new LordJob_Kidnap().CreateGraph()).StartingToil;
                    Transition transition6  = new Transition(lordToil2, startingToil, false, true);
                    if (lordToil != null)
                    {
                        transition6.AddSource(lordToil);
                    }
                    transition6.AddPreAction(new TransitionAction_Message("MessageRaidersKidnapping".Translate(new object[]
                    {
                        this.assaulterFaction.def.pawnsPlural.CapitalizeFirst(),
                        this.assaulterFaction.Name
                    }), null, 1f));
                    transition6.AddTrigger(new Trigger_KidnapVictimPresent());
                    stateGraph.AddTransition(transition6);
                }
                if (this.canSteal)
                {
                    LordToil   startingToil2 = stateGraph.AttachSubgraph(new LordJob_Steal().CreateGraph()).StartingToil;
                    Transition transition7   = new Transition(lordToil2, startingToil2, false, true);
                    if (lordToil != null)
                    {
                        transition7.AddSource(lordToil);
                    }
                    transition7.AddPreAction(new TransitionAction_Message("MessageRaidersStealing".Translate(new object[]
                    {
                        this.assaulterFaction.def.pawnsPlural.CapitalizeFirst(),
                        this.assaulterFaction.Name
                    }), null, 1f));
                    transition7.AddTrigger(new Trigger_HighValueThingsAround());
                    stateGraph.AddTransition(transition7);
                }
            }
            Transition transition8 = new Transition(lordToil2, lordToil_ExitMap, false, true);

            if (lordToil != null)
            {
                transition8.AddSource(lordToil);
            }
            transition8.AddTrigger(new Trigger_BecameNonHostileToPlayer());
            transition8.AddPreAction(new TransitionAction_Message("MessageRaidersLeaving".Translate(new object[]
            {
                this.assaulterFaction.def.pawnsPlural.CapitalizeFirst(),
                this.assaulterFaction.Name
            }), null, 1f));
            stateGraph.AddTransition(transition8);
            return(stateGraph);
        }
예제 #9
0
        public override StateGraph CreateGraph()
        {
            StateGraph stateGraph = new StateGraph();
            LordToil   lordToil   = null;

            if (sappers)
            {
                lordToil = new LordToil_AssaultColonySappers();
                if (useAvoidGridSmart)
                {
                    lordToil.useAvoidGrid = true;
                }
                stateGraph.AddToil(lordToil);
                Transition transition = new Transition(lordToil, lordToil, canMoveToSameState: true);
                transition.AddTrigger(new Trigger_PawnLost());
                stateGraph.AddTransition(transition);
            }
            LordToil lordToil2 = new LordToil_AssaultColony();

            if (useAvoidGridSmart)
            {
                lordToil2.useAvoidGrid = true;
            }
            stateGraph.AddToil(lordToil2);
            LordToil_ExitMap lordToil_ExitMap = new LordToil_ExitMap(LocomotionUrgency.Jog, canDig: false, interruptCurrentJob: true);

            lordToil_ExitMap.useAvoidGrid = true;
            stateGraph.AddToil(lordToil_ExitMap);
            if (sappers)
            {
                Transition transition2 = new Transition(lordToil, lordToil2);
                transition2.AddTrigger(new Trigger_NoFightingSappers());
                stateGraph.AddTransition(transition2);
            }
            if (assaulterFaction.def.humanlikeFaction)
            {
                if (canTimeoutOrFlee)
                {
                    Transition transition3 = new Transition(lordToil2, lordToil_ExitMap);
                    if (lordToil != null)
                    {
                        transition3.AddSource(lordToil);
                    }
                    transition3.AddTrigger(new Trigger_TicksPassed(sappers ? SapTimeBeforeGiveUp.RandomInRange : AssaultTimeBeforeGiveUp.RandomInRange));
                    transition3.AddPreAction(new TransitionAction_Message("MessageRaidersGivenUpLeaving".Translate(assaulterFaction.def.pawnsPlural.CapitalizeFirst(), assaulterFaction.Name)));
                    stateGraph.AddTransition(transition3);
                    Transition transition4 = new Transition(lordToil2, lordToil_ExitMap);
                    if (lordToil != null)
                    {
                        transition4.AddSource(lordToil);
                    }
                    float randomInRange = new FloatRange(0.25f, 0.35f).RandomInRange;
                    transition4.AddTrigger(new Trigger_FractionColonyDamageTaken(randomInRange, 900f));
                    transition4.AddPreAction(new TransitionAction_Message("MessageRaidersSatisfiedLeaving".Translate(assaulterFaction.def.pawnsPlural.CapitalizeFirst(), assaulterFaction.Name)));
                    stateGraph.AddTransition(transition4);
                }
                if (canKidnap)
                {
                    LordToil   startingToil = stateGraph.AttachSubgraph(new LordJob_Kidnap().CreateGraph()).StartingToil;
                    Transition transition5  = new Transition(lordToil2, startingToil);
                    if (lordToil != null)
                    {
                        transition5.AddSource(lordToil);
                    }
                    transition5.AddPreAction(new TransitionAction_Message("MessageRaidersKidnapping".Translate(assaulterFaction.def.pawnsPlural.CapitalizeFirst(), assaulterFaction.Name)));
                    transition5.AddTrigger(new Trigger_KidnapVictimPresent());
                    stateGraph.AddTransition(transition5);
                }
                if (canSteal)
                {
                    LordToil   startingToil2 = stateGraph.AttachSubgraph(new LordJob_Steal().CreateGraph()).StartingToil;
                    Transition transition6   = new Transition(lordToil2, startingToil2);
                    if (lordToil != null)
                    {
                        transition6.AddSource(lordToil);
                    }
                    transition6.AddPreAction(new TransitionAction_Message("MessageRaidersStealing".Translate(assaulterFaction.def.pawnsPlural.CapitalizeFirst(), assaulterFaction.Name)));
                    transition6.AddTrigger(new Trigger_HighValueThingsAround());
                    stateGraph.AddTransition(transition6);
                }
            }
            Transition transition7 = new Transition(lordToil2, lordToil_ExitMap);

            if (lordToil != null)
            {
                transition7.AddSource(lordToil);
            }
            transition7.AddTrigger(new Trigger_BecameNonHostileToPlayer());
            transition7.AddPreAction(new TransitionAction_Message("MessageRaidersLeaving".Translate(assaulterFaction.def.pawnsPlural.CapitalizeFirst(), assaulterFaction.Name)));
            stateGraph.AddTransition(transition7);
            return(stateGraph);
        }