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

  <QuestScriptDef>
    <defName>WMH_Fleder_MonsterEncounterQuest</defName>
    <rootSelectionWeight>0.1</rootSelectionWeight>
    <rootMinPoints>0</rootMinPoints>
    <autoAccept>true</autoAccept>
    <canGiveRoyalFavor>true</canGiveRoyalFavor>
	<defaultChallengeRating>2</defaultChallengeRating>
    <questNameRules>
      <rulesStrings>
        <li>questName->[asker_nameDef]'s [monster] [contract]</li>
		<li>monster->monster</li>
        <li>monster->monster hunt</li>
        <li>monster->beast hunting</li>
        <li>monster->creature</li>
        <li>contract->contract</li>
        <li>contract->mission</li>
        <li>contract->arrangement</li>
        <li>contract->undertaking</li>
        <li>contract->holy task</li>
        
      </rulesStrings>
    </questNameRules>
    <questDescriptionRules>
      <rulesStrings>
        <li>questDescription->[asker_nameFull], [asker_faction_leaderTitle] of [asker_faction_name], has been struggling with a small pack of Fleders, hunting at night for anything that moves in the area.\n\nFleders are lesser vampires, weaker than the rest of their ilk in almost every aspect. These vampires mainly fight with their teeth and claws, flailing them blindly and not stopping even when their victim is already dead.Their claws can rip through armour and flesh alike.\n\nMonster class traits: Being a Cursed One, Fleder bite infection leads to full transformation and should be treated as soon as possible.\n\n
		\nIf we succeed, [allRewardsDescriptions]</li>
      </rulesStrings>
    </questDescriptionRules>
    <root Class="QuestNode_Sequence">
      <nodes>
        
       
        <li Class="QuestNode_GetMap" />

        <li Class="QuestNode_GetPawn">
          <storeAs>asker</storeAs>
          <mustBeFactionLeader>true</mustBeFactionLeader>
          <allowPermanentEnemyFaction>false</allowPermanentEnemyFaction>
        </li>

        <li Class="QuestNode_GetSiteTile">
          <storeAs>siteTile</storeAs>
          <preferCloserTiles>true</preferCloserTiles>
        </li>

        <li Class="QuestNode_GetSitePartDefsByTagsAndFaction">
          <storeAs>sitePartDefs</storeAs>
          <storeFactionAs>siteFaction</storeFactionAs>
          <sitePartsTags>
            <li><tag>WMH_Fleder_MonsterEncounterCore</tag></li>
          </sitePartsTags>
          
        </li>

        <li Class="QuestNode_GetDefaultSitePartsParams">
          <tile>$siteTile</tile>
          <faction>$faction</faction>
          <sitePartDefs>$sitePartDefs</sitePartDefs>
          <storeSitePartsParamsAs>sitePartsParams</storeSitePartsParamsAs>
        </li>
        
        <li Class="QuestNode_GetSiteThreatPoints">
          <storeAs>sitePoints</storeAs>
          <sitePartsParams>$sitePartsParams</sitePartsParams>
        </li>
        <li Class="QuestNode_SubScript">
          <def>Util_GetDefaultRewardValueFromPoints</def>
          <parms>
            <!-- Use the actual threat points generated (some site parts define a minimum threshold) -->
            <points>$sitePoints</points>
          </parms>
        </li>

        <li Class="QuestNode_SubScript">
          <def>Util_GenerateSite</def>
        </li>
        
        <li Class="QuestNode_SpawnWorldObjects">
          <worldObjects>$site</worldObjects>
        </li>

        <li Class="QuestNode_WorldObjectTimeout">
          <worldObject>$site</worldObject>
          <isQuestTimeout>true</isQuestTimeout>
          <delayTicks>$(randInt(12,28)*60000)</delayTicks>
          <inSignalDisable>site.MapGenerated</inSignalDisable>
          <node Class="QuestNode_Sequence">
            <nodes>
              <li Class="QuestNode_Letter">
                <label>Quest expired: [resolvedQuestName]</label>
                <text>The monsters have left this area, and you won't hear from them until they have claimed their next victims. The quest [resolvedQuestName] has expired.</text>
              </li>
              <li Class="QuestNode_End">
                <outcome>Fail</outcome>
              </li>
            </nodes>
          </node>
        </li>

        <li Class="QuestNode_Signal">
          <inSignal>site.AllEnemiesDefeated</inSignal>
          <node Class="QuestNode_GiveRewards">
            <parms>
              <allowGoodwill>true</allowGoodwill>
              <allowRoyalFavor>true</allowRoyalFavor>
              <chosenPawnSignal>ChosenPawnForReward</chosenPawnSignal>
            </parms>
            <customLetterLabel>Payment arrived</customLetterLabel>
            <customLetterText>You have defeated the monsters!\n\nThe payment from [asker_faction_name] has arrived.</customLetterText>
            <nodeIfChosenPawnSignalUsed Class="QuestNode_Letter">
              <letterDef>ChoosePawn</letterDef>
              <label>[asker_faction_royalFavorLabel]</label>
              <text>These colonists participated in the epic hunt for the quest [resolvedQuestName]. [asker_definite] wants to know who should receive the [royalFavorReward_amount] [asker_faction_royalFavorLabel] favor for this service.</text>
              <useColonistsOnMap>$site</useColonistsOnMap>
              <chosenPawnSignal>ChosenPawnForReward</chosenPawnSignal>
            </nodeIfChosenPawnSignalUsed>
          </node>
        </li>
        <li Class="QuestNode_End">
          <inSignal>site.AllEnemiesDefeated</inSignal>
          <outcome>Success</outcome>
        </li>
      </nodes>
    </root>
  </QuestScriptDef>
</Defs>