<?xml version="1.0" encoding="utf-8" ?>
<Defs>

  <QuestScriptDef>
    <defName>ShuttleCrash_Rescue</defName>
    <rootSelectionWeight>1.9</rootSelectionWeight>
    <rootMinPoints>150</rootMinPoints>
    <expireDaysRange>0.4~0.6</expireDaysRange>
    <defaultCharity>true</defaultCharity>
    <successHistoryEvent MayRequire="Ludeon.RimWorld.Ideology">CharityFulfilled_ShuttleCrashRescue</successHistoryEvent>
    <failedOrExpiredHistoryEvent MayRequire="Ludeon.RimWorld.Ideology">CharityRefused_ShuttleCrashRescue</failedOrExpiredHistoryEvent>
    <questNameRules>
      <rulesStrings>
        
        <!-- quest name -->
        <li>questName->[shuttle] [crash]</li>
        <li>questName->[asker_faction_pawnSingular] [shuttle] [crash]</li>
        <li>questName->[damaged] [shuttle]</li>
        <li>questName->[asker_nameDef]'s [damaged] [shuttle]</li>
        <li>questName->[emergency] [landing]</li>
        <li>questName->[asker_nameDef]'s [emergency] [landing]</li>

        <!-- pieces -->
        <li>shuttle->shuttle</li>
        <li>shuttle->transporter</li>
        <li>shuttle->ship</li>

        <li>crash->crash</li>
        <li>crash->down</li>
        
        <li>damaged->damaged</li>
        <li>damaged->busted</li>
        <li>damaged->failing</li>
        
        <li>emergency->emergency</li>
        <li>emergency->forced</li>
        
        <li>landing->landing</li>
        <li>landing->descent</li>
        <li>landing->approach</li>

      </rulesStrings>
    </questNameRules>
    <questDescriptionAndNameRules>
      <rulesStrings>
        <li>pawnLabel->civilian</li>
        <li>pawnLabelPlural->civilians</li>
      </rulesStrings>
    </questDescriptionAndNameRules>
    <questDescriptionRules>
      <rulesStrings> 

        <!-- misc -->
        <li>pawnLabelSingleOrPlural(civilians_count==1)->[pawnLabel]</li>
        <li>pawnLabelSingleOrPlural(civilians_count>=2)->[pawnLabelPlural]</li>

        <!-- quest description -->
        <li>questDescription->A shuttle of [asker_faction_name] has taken damage and is seeking a place to land. Its commander [asker_nameDef] wants to land at [map_definite].\n\n[enemyFaction_pawnsPlural] from [enemyFaction_name] will attack the crashed shuttle site in an attempt to kill its occupants. You must defend them.\n\nThe shuttle contains [asker_nameDef][andOtherCivilians] and [soldierCountKinds]. The commander [andCivilians] must be rescued, but the [soldiers0_kind]s may be sacrificed.\n\nAfter [rescueDelay_duration], a rescue shuttle will come to pick up the survivors. You'll need to get them all on board within [leaveDelay_duration].</li>
        
        <!-- snippets -->
        <li>andOtherCivilians(civilians_count==1)-></li>
        <li>andOtherCivilians(civilians_count==2)->, another [pawnLabel],</li>
        <li>andOtherCivilians(civilians_count>=3)->, [civilianCountMinusOne] other [pawnLabelSingleOrPlural],</li>
        
        <li>andCivilians(civilians_count==1)-></li>
        <li>andCivilians(civilians_count==2)->and [pawnLabel]</li>
        <li>andCivilians(civilians_count>=3)->and [pawnLabelPlural]</li>
        <li>soldierCountKinds(soldiers_count==1)->[soldiers_count] [soldiers0_kind]</li>
        <li>soldierCountKinds(soldiers_count>1)->[soldiers_count] [soldiers0_kind]s</li>

      </rulesStrings>
    </questDescriptionRules>
    <questContentRules>
      <rulesStrings>
        
        <!-- misc -->
        <li>failLetterEndingCommon->You have failed the quest '[resolvedQuestName]'.</li>
        <li>successLetterEndingCommon->You have succesfully completed the quest '[resolvedQuestName]'.</li>

        <li>goodwillSomeCiviliansLost->Not all the [asker_faction_pawnSingular] [pawnLabel] could be rescued. [goodwillNegativelyAffected]</li>
        <li>goodwillAllCiviliansLost->None of the [asker_faction_pawnSingular] [pawnLabelPlural] could be rescued. [goodwillNegativelyAffected]</li>
        <li>goodwillNegativelyAffected->Your goodwill with [asker_faction_name] has been negatively affected for every [pawnLabel] left.</li>

        <li>commanderLandingDesc->[asker_nameDef], the commander who asked to land [asker_possessive] shuttle at [map_definite]</li>

        <!-- raid arrived -->
        <li>raidArrivedLetterLabel->Raid: [enemyFaction_name]</li>
        <li>raidArrivedLetterText->[enemyFaction_pawnsPlural] from the [enemyFaction_name] have arrived. They will attack the [asker_faction_pawnsPlural] who crashed at [map_definite].\n\nDefend the [asker_faction_pawnsPlural] until their rescue shuttle arrives in [rescueShuttleAfterRaidDelay_duration].</li>

        <!-- rescue shuttle arrived -->
        <li>rescueShuttleArrivedLetterLabel->Rescue shuttle arrived</li>
        <li>rescueShuttleArrivedLetterText->The rescue shuttle has arrived to collect the [pawnLabelSingleOrPlural] who crashed landed. Make sure to have these people on the shuttle before it leaves in [leaveDelay_duration]:\n\n[civilians]</li>

        <!-- quest completed, all loaded -->
        <li>questCompletedSuccessLetterLabel->Quest completed: [resolvedQuestName]</li>
        <li>questCompletedSuccessLetterText->[commanderLandingDesc], has escaped. [asker_pronoun] is grateful for the help [asker_pronoun] received at [map_definite].\n\n[successLetterEndingCommon]</li>

        <!-- quest completed, some loaded (asker loaded implicitly) -->
        <li>questCompletedCiviliansLostSuccessLetterLabel->Quest completed: [resolvedQuestName]</li>
        <li>questCompletedCiviliansLostSuccessLetterText->[commanderLandingDesc], has escaped.\n\n[goodwillSomeCiviliansLost]\n\n[successLetterEndingCommon]</li>

        <!-- quest failed, asker not loaded -->
        <li>askerLostLetterLabel->Quest failed: [resolvedQuestName]</li>
        <li>askerLostLetterText->[commanderLandingDesc] was not on board when the shuttle departed.\n\n[goodwillSomeCiviliansLost]\n\n[failLetterEndingCommon]</li>

        <!-- quest failed, nobody loaded -->
        <li>allLostLetterLabel->Quest failed: [resolvedQuestName]</li>
        <li>allLostLetterText->The rescue shuttle for the crashed [asker_faction_pawnsPlural] has departed without anyone on board.\n\n[goodwillAllCiviliansLost]\n\n[failLetterEndingCommon]</li>

        <!-- quest failed, asker died -->
        <li>askerDiedLetterLabel->Quest failed: [resolvedQuestName]</li>
        <li>askerDiedLetterText->[commanderLandingDesc] has died.\n\n[failLetterEndingCommon]</li>
        
        <!-- quest failed, shuttle destroyed -->
        <li>shuttleDestroyedLetterLabel->Quest failed: [resolvedQuestName]</li>
        <li>shuttleDestroyedLetterText->The shuttle sent to collect the crashed [asker_faction_pawnsPlural] has been destroyed. The [asker_faction_pawnsPlural] will now leave on foot.\n\n[failLetterEndingCommon]</li>
      
      </rulesStrings>
    </questContentRules>
    <root Class="QuestNode_Root_ShuttleCrash_Rescue" />
  </QuestScriptDef>

</Defs>