예제 #1
0
        // Token: 0x0600079D RID: 1949 RVA: 0x0004323C File Offset: 0x0004163C
        public override StateGraph CreateGraph()
        {
            StateGraph             stateGraph          = new StateGraph();
            LordToil_DefendHiveLoc lordToil_DefendBase = new LordToil_DefendHiveLoc(this.baseCenter);

            stateGraph.StartingToil = lordToil_DefendBase;
            LordToil_DefendHiveLoc lordToil_DefendBase2 = new LordToil_DefendHiveLoc(this.baseCenter);

            stateGraph.AddToil(lordToil_DefendBase2);
            LordToil_XenomrophAssaultColony lordToil_AssaultColony = new LordToil_XenomrophAssaultColony(true);

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

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

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

            transition3.AddTrigger(new Trigger_FractionPawnsLost(0.2f));
            transition3.AddTrigger(new Trigger_PawnHarmed(0.4f, true)); //, null));
            //    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, null, 1f));
            stateGraph.AddTransition(transition3, false);

            Transition transition4 = new Transition(lordToil_AssaultColony, lordToil_DefendBase2, false, true);

            transition4.AddTrigger(new Trigger_ChanceOnTickInteval(2500, 0.03f));
            transition4.AddTrigger(new Trigger_TicksPassedWithoutHarm(9000));
            transition4.AddPostAction(new TransitionAction_EndAllJobs());
            string message2 = "MessageDefendersAttacking".Translate(this.faction.def.pawnsPlural, this.faction.Name, Faction.OfPlayer.def.pawnsPlural).CapitalizeFirst();

            transition4.AddPreAction(new TransitionAction_Message(message2, MessageTypeDefOf.NeutralEvent, null, 1f));
            stateGraph.AddTransition(transition4, false);
            return(stateGraph);
        }
예제 #2
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_XenomrophAssaultColony lordToil_AssaultColony = new LordToil_XenomrophAssaultColony(false);

            stateGraph.AddToil(lordToil_AssaultColony);
            LordToil_XenomrophAssaultColony lordToil_AssaultColony2 = new LordToil_XenomrophAssaultColony(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(CompSpawnerPawnsOnDamaged.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[]
            {
                CompSpawnerPawnsOnDamaged.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);
        }
예제 #3
0
        // Token: 0x06000795 RID: 1941 RVA: 0x00042F44 File Offset: 0x00041344
        public override StateGraph CreateGraph()
        {
            StateGraph stateGraph = new StateGraph();
            LordToil_DefendAndExpandHiveLike lordToil_DefendAndExpandHiveLike = new LordToil_DefendAndExpandHiveLike
            {
                distToHiveToAttack = radius,
            };

            stateGraph.StartingToil = lordToil_DefendAndExpandHiveLike;

            LordToil_DefendHiveLikeAggressively lordToil_DefendHiveAggressively = new LordToil_DefendHiveLikeAggressively
            {
                distToHiveToAttack = radius
            };

            stateGraph.AddToil(lordToil_DefendHiveAggressively);

            LordToil_XenomrophAssaultColony lordToil_XenomrophAssaultColony = new LordToil_XenomrophAssaultColony(false);

            stateGraph.AddToil(lordToil_XenomrophAssaultColony);

            Transition transition = new Transition(lordToil_DefendAndExpandHiveLike, (!aggressive) ? (LordToil)lordToil_DefendHiveAggressively : (LordToil)lordToil_XenomrophAssaultColony, false, true);

            transition.AddTrigger(new Trigger_PawnHarmed(0.5f, true, null));
            transition.AddTrigger(new Trigger_PawnLostViolently(false));
            transition.AddTrigger(new Trigger_Memo(HiveLike.MemoAttackedByEnemy));
            transition.AddTrigger(new Trigger_Memo(HiveLike.MemoBurnedBadly));
            transition.AddTrigger(new Trigger_Memo(HiveLike.MemoDestroyedNonRoofCollapse));
            transition.AddTrigger(new Trigger_Memo(HediffGiver_Heat.MemoPawnBurnedByAir));
            transition.AddPostAction(new TransitionAction_EndAllJobs());
            stateGraph.AddTransition(transition, false);

            Transition transition2   = new Transition(lordToil_DefendAndExpandHiveLike, lordToil_XenomrophAssaultColony, false, true);
            Transition transition3   = transition2;
            float      chance        = 0.05f;
            Faction    parentFaction = base.Map.ParentFaction;

            transition3.AddTrigger(new Trigger_PawnHarmed(chance, false, parentFaction));
            transition2.AddPostAction(new TransitionAction_EndAllJobs());
            stateGraph.AddTransition(transition2, false);

            Transition transition4 = new Transition(lordToil_DefendHiveAggressively, lordToil_XenomrophAssaultColony, 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, false);

            Transition transition6 = new Transition(lordToil_DefendAndExpandHiveLike, lordToil_DefendAndExpandHiveLike, true, true);

            transition6.AddTrigger(new Trigger_Memo(HiveLike.MemoDeSpawned));
            stateGraph.AddTransition(transition6, false);

            Transition transition7 = new Transition(lordToil_DefendHiveAggressively, lordToil_DefendHiveAggressively, true, true);

            transition7.AddTrigger(new Trigger_Memo(HiveLike.MemoDeSpawned));
            stateGraph.AddTransition(transition7, false);

            Transition transition8 = new Transition(lordToil_XenomrophAssaultColony, lordToil_DefendAndExpandHiveLike, false, true);

            transition8.AddSource(lordToil_DefendHiveAggressively);
            transition8.AddTrigger(new Trigger_TicksPassedWithoutHarmOrMemos(1200, new string[]
            {
                HiveLike.MemoAttackedByEnemy,
                HiveLike.MemoBurnedBadly,
                HiveLike.MemoDestroyedNonRoofCollapse,
                HiveLike.MemoDeSpawned,
                HediffGiver_Heat.MemoPawnBurnedByAir
            }));
            transition8.AddPostAction(new TransitionAction_EndAttackBuildingJobs());
            stateGraph.AddTransition(transition8, false);
            return(stateGraph);
        }