<?xml version="1.0" encoding="utf-8" ?>
<ThinkTrees>


  <!--============= AI Duty ============-->
  <ThinkTreeDef>
    <defName>SquadBrainDuty</defName>
    <thinkRoot Class="ThinkNode_Priority">
      <subNodes>
        <li Class="ThinkNode_ConditionalHasSquadBrain">
          <subNodes>
            <li Class="ThinkNode_Duty">
              <dutyNodes>
                
                <!-- Travel -->
                <li>
                  <key>Travel</key>
                  <value Class="ThinkNode_Priority">
                    <subNodes>
                      <li Class="JobGiver_GotoTravelDestination" />

                      <!-- Note this exit node can happen at odd times
                      like if you block siegers from hitting their siege location before they arrive-->
                      <li Class="JobGiver_ExitMapWalkRandom" />
                    </subNodes>
                  </value>
                </li>

                <!-- Defend point -->
                <li>
                  <key>Defend</key>
                  <value Class="ThinkNode_Priority">
                    <subNodes>
                      <li Class="Decorator_UpdateEnemyTarget">
                        <targetAcquireRadius>65</targetAcquireRadius>
                        <targetKeepRadius>72</targetKeepRadius>
                      </li>
                      <li Class="JobGiver_AIDefendPoint" />
                      <li Class="ThinkNode_SatisfyNeeds">
                        <maxDistToSquadFlag>16</maxDistToSquadFlag>
                      </li>
                      <li Class="JobGiver_WanderNearDutyLocation">
                        <wanderRadius>8</wanderRadius>
                      </li>
                    </subNodes>
                  </value>
                </li>

                <!-- Build (sieger) -->
                <li>
                  <key>Build</key>
                  <value Class="ThinkNode_Priority">
                    <subNodes>
                      <li Class="JobGiver_FightFiresNearPoint">
                        <maxDistFromPoint>25</maxDistFromPoint>
                      </li>
                      <li Class="JobGiver_WorkRoot">
                        <onlyEmergencyWork>false</onlyEmergencyWork>
                      </li>
                      <li Class="JobGiver_AIDefendPoint" />
                      <li Class="ThinkNode_SatisfyNeeds">
                        <maxDistToSquadFlag>16</maxDistToSquadFlag>
                      </li>
                      <li Class="JobGiver_ManTurretsNearPoint">
                        <maxDistFromPoint>25</maxDistFromPoint>
                      </li>
                      <li Class="JobGiver_WanderNearDutyLocation">
                        <wanderRadius>8</wanderRadius>
                      </li>
                    </subNodes>
                  </value>
                </li>

                <!-- Assault colony -->
                <li>
                  <key>AssaultColony</key>
                  <value Class="ThinkNode_Priority">
                    <subNodes>
                      <li Class="Decorator_UpdateEnemyTarget">
                        <targetAcquireRadius>65</targetAcquireRadius>
                        <targetKeepRadius>72</targetKeepRadius>
                      </li>
                      <li Class="JobGiver_AIAttackTarget" />
                      <li Class="JobGiver_AITrashCloseBuildings" />
                      <li Class="JobGiver_AITrashBuildings" />
                    </subNodes>
                  </value>
                </li>

                <!-- Hunt enemies individual -->
                <li>
                  <key>HuntEnemiesIndividual</key>
                  <value Class="ThinkNode_Priority">
                    <subNodes>
                      <li Class="Decorator_UpdateEnemyTarget">
                        <targetAcquireRadius>9999</targetAcquireRadius>
                        <targetKeepRadius>9999</targetKeepRadius>
                      </li>
                      <li Class="JobGiver_AIAttackTarget" />
                      <li Class="JobGiver_AITrashCloseBuildings" />
                      <li Class="JobGiver_AITrashBuildings" />
                    </subNodes>
                  </value>
                </li>

                <!-- Kidnap and flee -->
                <li>
                  <key>Kidnap</key>
                  <value Class="ThinkNode_Priority">
                    <subNodes>
                      <li Class="JobGiver_Kidnap" />
                      <li Class="JobGiver_ExitMapWalkNearest">
                        <jobMaxDuration>200</jobMaxDuration>
                      </li> 
                    </subNodes>
                  </value>
                </li>

                <!-- Exit anywhere -->
                <li>
                  <key>ExitMapAnywhere</key>
                  <value Class="JobGiver_ExitMapWalkRandom" />
                </li>
                
                
                <!-- Exit nearest -->
                <li>
                  <key>ExitMapNearest</key>
                  <value Class="JobGiver_ExitMapWalkNearest" />
                </li>
              
            </dutyNodes>
            </li>

            <!-- If no duty issued a job -->
            <!-- Wander at fallback -->
            <li Class="ThinkNode_ConditionalHasFallbackLocation" >
              <subNodes>
                <li Class="JobGiver_WanderNearFallbackLocation" />
              </subNodes>
            </li>

            <li Class="JobGiver_WanderCurrentRoom" />
            <li Class="JobGiver_IdleError" />
          </subNodes>
        </li>
      </subNodes>
    </thinkRoot>
  </ThinkTreeDef>





</ThinkTrees>


