<?xml version="1.0" encoding="utf-8" ?>
<Defs>

  <QuestScriptDef>
    <defName>Hospitality_Refugee</defName>
    <rootSelectionWeight>1.0</rootSelectionWeight>
    <rootSelectionWeightFactorFromPointsCurve> <!-- More common at lower points values -->
      <points>
        <li>(0,3)</li>
        <li>(200,3)</li>
        <li>(500,1)</li>
      </points>
    </rootSelectionWeightFactorFromPointsCurve>
    <rootMinPoints>0</rootMinPoints>
    <expireDaysRange>4~8</expireDaysRange>
    <hideInvolvedFactionsInfo>true</hideInvolvedFactionsInfo>
    <affectedByPopulation>true</affectedByPopulation>
    <affectedByPoints>false</affectedByPoints>
    <defaultCharity>true</defaultCharity>
    <successHistoryEvent MayRequire="Ludeon.RimWorld.Ideology">CharityFulfilled_HospitalityRefugees</successHistoryEvent>
    <failedOrExpiredHistoryEvent MayRequire="Ludeon.RimWorld.Ideology">CharityRefused_HospitalityRefugees</failedOrExpiredHistoryEvent>
    <questNameRules>
      <rulesStrings>
      
        <!-- single -->
        <li>questName(lodgerCount==1)->[asker_nameDef] the [lodgerAdj]</li>
        <li>questName(lodgerCount==1)->[athe] [lodgerAdj] [lodgerSingle]</li>

        <!-- multiple -->
        <li>questName(p=2,lodgerCount>=2)->[lodgerAdj] [lodgerPlural]</li>
        <li>questName(lodgerCount>=2)->[asker_nameDef]'s [lodgerAdj] [lodgerPlural]</li>
        <li>questName(lodgerCount>=2)->[asker_nameDef]'s [lodgerPlural]</li>

        <!-- pieces -->
        <li>athe->a</li>
        <li>athe->the</li>

        <li>lodgerAdj->tired</li>
        <li>lodgerAdj->lost</li>
        <li>lodgerAdj->destitute</li>
        <li>lodgerAdj->poor</li>
        <li>lodgerAdj->desperate</li>
        <li>lodgerAdj->sad</li>
        <li>lodgerAdj->dusty</li>
        <li>lodgerAdj->hopeless</li>
        <li>lodgerAdj->unknown</li>
        <li>lodgerAdj->forlorn</li>
        <li>lodgerAdj->forsaken</li>

        <li>lodgerSingle->traveler</li>
        <li>lodgerSingle->refugee</li>
        <li>lodgerSingle->drifter</li>
        <li>lodgerSingle->survivor</li>
        <li>lodgerSingle->nomad</li>
        <li>lodgerSingle->vagabond</li>
        <li>lodgerPlural->travelers</li>
        <li>lodgerPlural->refugees</li>
        <li>lodgerPlural->drifters</li>
        <li>lodgerPlural->survivors</li>
        <li>lodgerPlural->nomads</li>
        <li>lodgerPlural->vagabonds</li>

      </rulesStrings>
    </questNameRules>
    <questDescriptionAndNameRules>
      <rulesStrings>
        <li>lodgersLabel->refugee</li>
        <li>lodgersLabelPlural->refugees</li>
      </rulesStrings>
    </questDescriptionAndNameRules>
    <questDescriptionRules>
      <rulesStrings>

        <!-- Misc -->
        <li>offer(lodgerCount==1)->offers</li>
        <li>offer(lodgerCount>=2)->offer</li>
        
        <!-- General use -->
        <li>lodgersPronoun(lodgerCount==1)->[asker_pronoun]</li>
        <li>lodgersPronoun(lodgerCount>=2)->they</li>
        <li>lodgersPreposition(lodgerCount==1)->[asker_objective]self</li>
        <li>lodgersPreposition(lodgerCount>=2)->themselves</li>
        <li>lodgersObjective(lodgerCount==1)->[asker_objective]</li>
        <li>lodgersObjective(lodgerCount>=2)->them</li>
        <li>lodgersPossessive(lodgerCount==1)->[asker_possessive]</li>
        <li>lodgersPossessive(lodgerCount>=2)->their</li>
        <li>lodgersSingularOrPluralDef(lodgerCount==1)->[asker_nameDef]</li>
        <li>lodgersSingularOrPluralDef(lodgerCount>=2)->the [lodgersLabelPlural]</li>
        
        <!-- Quest description -->
        <li>questDescription->[approachInfo] [claimInfo] [asker_nameDef] begs you for permission to stay at [map_definite] for [questDurationTicks_duration] so [lodgersPronoun] can rest and regroup.\n\nIn return, [lodgersPronoun] [offer] to work and fight for free during that time.\n\n[joinInfo] [lodgersPronoun] may also reward you later for helping [lodgersObjective] - but there is no way to know [lodgersPossessive] true intentions.\n\n[travelerInfo] not part of any faction. If you wish, you can choose to kill, arrest, sell, or harvest [lodgersObjective], without diplomatic consequences.</li>
        <li>approachInfo(lodgerCount==1)->A desperate [faction_pawnSingular] named [asker_nameDef] is approaching.</li>
        <li>approachInfo(lodgerCount==2)->[asker_nameDef] and another desperate [faction_pawnSingular] are approaching.</li>
        <li>approachInfo(lodgerCount==2,childCount==1,priority=1)->[asker_nameDef] is approaching with a child in tow.</li>
        <li>approachInfo(lodgerCount>=3)->[lodgerCount] desperate [faction_pawnsPlural] are approaching. Their leader is called [asker_nameDef].</li>
        <li>approachInfo(lodgerCount>=3,childCount==1,priority=1)->[lodgerCount] desperate [faction_pawnsPlural] including a child are approaching. Their leader is called [asker_nameDef].</li>
        <li>approachInfo(lodgerCount>=3,childCount>=2,priority=1)->[lodgerCount] desperate [faction_pawnsPlural] including some children are approaching. Their leader is called [asker_nameDef].</li>
        <li>approachInfo(lodgerCount>=3,allButOneChildren==true,priority=2)->A group of [lodgerCount] desperate [faction_pawnsPlural] are approaching consisting of [asker_nameDef] and [lodgersCountMinusOne] children [asker_pronoun] has taken under [asker_possessive] wing.</li>
        <li>claimInfo(lodgerCount==1)->[asker_nameDef] claims to have lost [asker_possessive] home in a recent attack.</li>
        <li>claimInfo(lodgerCount==1)->[asker_nameDef] claims to woken up from cryptosleep all alone and friendless.</li>
        <li>claimInfo(lodgerCount==1)->[asker_nameDef] claims to have been chased from [asker_possessive] home by a vengeful ex-lover.</li>
        <li>claimInfo(lodgerCount==1)->[asker_nameDef] claims to have been banished after an argument with a village leader.</li>
        <li>claimInfo(lodgerCount>=2)->They claim to have lost their home in a recent attack.</li>
        <li>claimInfo(lodgerCount>=2)->They claim to have escaped an organ harvesting operation.</li>
        <li>claimInfo(lodgerCount>=2)->They say they escaped from a slave caravan.</li>
        <li>claimInfo(lodgerCount>=2)->They say that crop blights starved them out of their village.</li>
        <li>claimInfo(lodgerCount>=2)->They say a great flashstorm burned down their home.</li>
        <li>claimInfo(lodgerCount>=2)->They say their caravan was ambushed and everything was taken.</li>
        <li>claimInfo(lodgerCount>=2)->They say they were banished from their town due to moral disagreements.</li>
        <li>joinInfo(lodgerCount==1)->If you make [asker_objective] happy, [asker_pronoun] may offer to join you.</li>
        <li>joinInfo(lodgerCount>=2)->If you make them happy, some of them may offer to join you.</li>
        <li>travelerInfo(lodgerCount==1)->This [faction_pawnSingular] is</li>
        <li>travelerInfo(lodgerCount>=2)->These [faction_pawnsPlural] are</li>

      </rulesStrings>
    </questDescriptionRules>
    <questContentRules>
      <rulesStrings>
        
        <!-- Misc -->
        <li>lastOrNot(lodgerCount==1)-></li>
        <li>lastOrNot(lodgerCount>=2)->last</li>
        <li>lodgersLabelSingularOrPlural(lodgerCount==1)->[lodgersLabel]</li>
        <li>lodgersLabelSingularOrPlural(lodgerCount>=2)->[lodgersLabelPlural]</li>

        <!-- Arrived -->
        <li>lodgersArriveLetterLabel->[lodgersLabelSingularOrPlural] arrived</li>
        <li>lodgersArriveLetterText->[lodgersSingularOrPluralDef] [hasHave] arrived. [lodgersPronoun] will stay with you for [questDurationTicks_duration] so [lodgersPronoun] can rest and regroup.</li>
        <li>hasHave(lodgerCount==1)->has</li>
        <li>hasHave(lodgerCount>=2)->have</li>

        <!-- No lodger action -->
        <li>appalledButNoAction->The {PAWNSALIVECOUNT_multiple ? others seem : last [lodgersLabel] is} appalled at this, but {PAWNSALIVECOUNT_multiple ? are: is} not taking action against you.</li>

        <!-- Lodger action -->
        <li>othersWillNotAccept->The {PAWNSALIVECOUNT_multiple ? others are : last [lodgersLabel] is} not willing to accept this</li>
        <li>turnedViolent->[othersWillNotAccept], and {PAWNSALIVECOUNT_multiple ? have : has } turned violently against you.</li>
        <li>decidedToLeave->[othersWillNotAccept], and {PAWNSALIVECOUNT_multiple ? have : has } decided to leave.</li>
        
        <li>whoAskedToStay->who asked to stay with you</li>
        <li>oneOfThe->one of the desperate [faction_pawnsPlural] who asked to stay with you</li>
        <li>questOver->The quest '[resolvedQuestName]' is over.</li>

        <!-- Interaction response: Lodger death -->
        <li>letterIntroDeath->{SUBJECT_definite}, [oneOfThe] has died.</li>

        <li>lodgerDiedMemoryThoughtLetterLabel->[lodgersLabel] died: Anger</li>
        <li>lodgerDiedMemoryThoughtLetterText->[letterIntroDeath]\n\n[appalledButNoAction]</li>

        <li>lodgerDiedAttackPlayerLetterLabel->[lodgersLabel] died: Revenge</li>
        <li>lodgerDiedAttackPlayerLetterText->[letterIntroDeath]\n\n[turnedViolent]</li>

        <li>lodgerDiedLeaveMapLetterLabel->[lodgersLabel] died: Departure</li>
        <li>lodgerDiedLeaveMapLetterText->[letterIntroDeath]\n\n[decidedToLeave]</li>

        <li>lodgersAllDiedLetterLabel->Quest failed</li>
        <li>lodgersAllDiedLetterText->{SUBJECT_definite}, the [lastOrNot] desperate [faction_pawnSingular] [whoAskedToStay], has died.\n\n[questOver]</li>

        <!-- Interaction response: Lodger arrested -->
        <li>letterIntroArrested->You arrested {SUBJECT_definite}, [oneOfThe].</li>

        <li>lodgerArrestedMemoryThoughtLetterLabel->[lodgersLabel] arrested: Anger</li>
        <li>lodgerArrestedMemoryThoughtLetterText->[letterIntroArrested]\n\n[appalledButNoAction]</li>

        <li>lodgerArrestedAttackPlayerLetterLabel->[lodgersLabel] arrested: Revenge</li>
        <li>lodgerArrestedAttackPlayerLetterText->[letterIntroArrested]\n\n[turnedViolent]</li>

        <li>lodgerArrestedLeaveMapLetterLabel->[lodgersLabel] arrested: Departure</li>
        <li>lodgerArrestedLeaveMapLetterText->[letterIntroArrested]\n\n[decidedToLeave]</li>

        <li>lodgersAllArrestedLetterLabel->Quest failed</li>
        <li>lodgersAllArrestedLetterText->You arrested {SUBJECT_definite}, the [lastOrNot] desperate [faction_pawnSingular] [whoAskedToStay].\n\n[questOver]</li>

        <!-- Interaction response: Lodger violated by surgery -->
        <li>letterIntroViolated->{SUBJECT_definite}, [oneOfThe], was violated by surgery.</li>

        <li>lodgerViolatedMemoryThoughtLetterLabel->[lodgersLabel] violated: Anger</li>
        <li>lodgerViolatedMemoryThoughtLetterText->[letterIntroViolated]\n\n[appalledButNoAction]</li>

        <li>lodgerViolatedAttackPlayerLetterLabel->[lodgersLabel] violated: Revenge</li>
        <li>lodgerViolatedAttackPlayerLetterText->[letterIntroViolated]\n\n[turnedViolent]</li>

        <li>lodgerViolatedLeaveMapLetterLabel->[lodgersLabel] arrested: Departure</li>
        <li>lodgerViolatedLeaveMapLetterText->[letterIntroViolated]\n\n[decidedToLeave]</li>

        <!-- Mid-Events: Betrayal -->
        <li>mutinyLetterLabel->Betrayal</li>
        <li>mutinyLetterText->[lodgersSingularOrPluralDef] [whoAskedToStay] [areIs] turning against you!\n\nIt seems [lodgersPronoun] had this treachery planned all along.</li>
        <li>areIs(lodgerCount==1)->is</li>
        <li>areIs(lodgerCount>=2)->are</li>

        <!-- Quest completed -->
        <li>lodgersLeavingLetterLabel->[lodgersLabelSingularOrPlural] leaving</li>
        <li>lodgersLeavingLetterText->{FACTION_leaderNameDef} thanks you for allowing {FACTION_leaderObjective} to stay at [map_definite] for these [questDurationTicks_duration]. {FACTION_leaderPronoun} is now moving on with {FACTION_leaderPossessive} people.\n\n{FACTION_leaderNameDef} says {FACTION_leaderPronoun} won't forget what you've done.</li>

      </rulesStrings>
    </questContentRules>
    <root Class="QuestNode_Root_Hospitality_Refugee" />
  </QuestScriptDef>

  <QuestScriptDef>
    <defName>RefugeeDelayedReward</defName>
    <questNameRules>
      <rulesStrings>
        <li>questName->Refugee delayed reward</li>
      </rulesStrings>
    </questNameRules>
    <questDescriptionRules>
      <rulesStrings>
        <li>questDescription->a delayed reward for refugee quest</li>
      </rulesStrings>
    </questDescriptionRules>
    <questContentRules>
      <rulesStrings>
        <li>rewardLetterLabel->Hospitality reward</li>
        <li>rewardLetterText->[rewardGiver_nameDef] has contacted you. [rewardDelayTicks_duration] ago, you helped [rewardGiver_objective] in desperate circumstances.\n\nSince then, [rewardGiver_pronoun] has gotten back on [rewardGiver_possessive] feet, and now [rewardGiver_pronoun] wants to reward you properly for your help. [rewardGiver_pronoun] is sending you the following via drop pod:\n\n[listOfRewards]</li>
      </rulesStrings>
    </questContentRules>
    <defaultHidden>true</defaultHidden>
    <root Class="QuestNode_Root_RefugeeDelayedReward" />
  </QuestScriptDef>

  <QuestScriptDef>
    <defName>RefugeeBetrayal</defName>
    <questNameRules>
      <rulesStrings>
        <li>questName->Betrayal offer: [factionOpponent_nameDef]</li>
      </rulesStrings>
    </questNameRules>
    <questDescriptionRules>
      <rulesStrings>
        <li>questDescription->[factionOpponent_nameDef], a [factionOpponent_faction_pawnSingular] of [factionOpponent_faction_name], has learned that [asker_nameDef] [otherLodgers] [areIs] being hosted at [map_definite]. [factionOpponent_pronoun] is enemies with [asker_nameDef] and wants to see [asker_objective] dead.\n\n[factionOpponent_pronoun] will send you the following reward if you kill all members of [faction_name] (total value [betrayalRewardMarketValue_money]):\n\n[betrayalRewards]</li>
        
        <li>lodgersLabelSingularOrPlural(lodgerCount==1)->[lodgersLabel]</li>
        <li>lodgersLabelSingularOrPlural(lodgerCount>=2)->[lodgersLabelPlural]</li>
        
        <li>otherLodgers(lodgerCount==1)-></li>
        <li>otherLodgers(lodgerCount==2)->and another [lodgersLabel]</li>
        <li>otherLodgers(lodgerCount>=3)->and several [lodgersLabelPlural]</li>
        <li>otherMembers(lodgerCount==1)-></li>
        <li>otherMembers(lodgerCount>=2)-> and all other members of the [faction_name]</li>
        
        <li>areIs(lodgerCount==1)->is</li>
        <li>areIs(lodgerCount>=2)->are</li>

      </rulesStrings>
    </questDescriptionRules>
    <questDescriptionAndNameRules>
      <rulesStrings>
        <li>lodgersLabel->refugee</li>
        <li>lodgersLabelPlural->refugees</li>
      </rulesStrings>
    </questDescriptionAndNameRules>
    <questContentRules>
      <rulesStrings>
        
        <li>lodgersLabelSingularOrPlural(lodgerCount==1)->[lodgersLabel]</li>
        <li>lodgersLabelSingularOrPlural(lodgerCount>=2)->[lodgersLabelPlural]</li>

        <li>betrayalOfferRewardLetterLabel->Betrayal reward: [factionOpponent_nameDef]</li>
        <li>betrayalOfferRewardLetterText->[factionOpponent_nameDef] promised you a reward if you killed [asker_nameDef] [otherMembers]. [factionOpponent_pronoun] has heard news this has been done and is sending you the following via drop pod (total value [betrayalRewardMarketValue_money]):\n\n[betrayalRewards].\n\n[questOver]</li>

        <li>betrayalOfferFailedLetterLabel->Betrayal reward retracted</li>
        <li>betrayalOfferFailedLetterText->[factionOpponent_nameDef] has learned that one of the members of the [faction_name] is no longer at [map_definite]. [factionOpponent_nameDef] wanted all members of the [faction_name] to die and has therefore retracted [factionOpponent_possessive] offer.</li>
        
        <li>otherLodgers(lodgerCount==1)-></li>
        <li>otherLodgers(lodgerCount==2)->and another [lodgersLabel]</li>
        <li>otherLodgers(lodgerCount>=3)->and several [lodgersLabelPlural]</li>
        <li>otherMembers(lodgerCount==1)-></li>
        <li>otherMembers(lodgerCount>=2)-> and all other members of the [faction_name]</li>

        <li>questOver->The quest '[resolvedQuestName]' is over.</li>
        
      </rulesStrings>
    </questContentRules>
    <defaultHidden>false</defaultHidden>
    <rootSelectionWeight>0</rootSelectionWeight>
    <autoAccept>true</autoAccept>
    <root Class="QuestNode_Root_RefugeeBetrayal" />
  </QuestScriptDef>          

</Defs>