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); }
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_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); }