[
  {
    "id": "MISSION_EXPLORE_SARCOPHAGUS",
    "type": "mission_definition",
    "name": { "str": "Follow Sarcophagus Team" },
    "goal": "MGOAL_GO_TO_TYPE",
    "difficulty": 2,
    "value": 50000,
    "start": {
      "effect": [ "follow", { "u_spawn_item": "sarcophagus_access_code" } ],
      "assign_mission_target": { "om_terrain": "haz_sar_b_4", "om_special": "Hazardous Waste Sarcophagus", "reveal_radius": 1, "min_distance": 60 }
    },
    "origins": [ "ORIGIN_SECONDARY" ],
    "destination": "haz_sar_b_4",
    "dialogue": {
      "describe": "You wouldn't believe what I found…",
      "offer": "Holy hell, the crash you recovered the black box from wasn't as old as I thought.  Check this out, it was on its approach to pick up a team sent to secure and destroy something called a 'Hazardous Waste Sarcophagus' in the middle of nowhere.  If the bird never picked up the team then we may still have a chance to meet up with them.  It includes an access code for the elevator and an encoded message for the team leader, I guess.  If we want to join up with what remains of the government then now may be our only chance.",
      "accepted": "Fuck ya, America!",
      "rejected": "Are you going to forfeit your duty when the country needs you the most?",
      "advice": "If there is a military team down there then we better go in prepared if we want to impress them.  Carry as much ammo as you can and prepare to ditch this place if they have a second bird coming to pick them up.",
      "inquire": "Having any trouble following the map?  Remember to search underground.",
      "success": "Maybe these things are what remains of the team we were searching for…",
      "success_lie": "What?!  I out'ta whip your ass.",
      "failure": "Damn, we were so close."
    }
  },
  {
    "id": "MISSION_GET_INHALER",
    "type": "mission_definition",
    "name": { "str": "Find Inhaler" },
    "goal": "MGOAL_CONDITION",
    "goal_condition": { "u_has_item": "inhaler" },
    "difficulty": 2,
    "value": 150000,
    "urgent": true,
    "origins": [ "ORIGIN_OPENER_NPC", "ORIGIN_ANY_NPC" ],
    "deadline": [ "2 days", "3 days" ],
    "dialogue": {
      "describe": "I'm… short… of breath…",
      "offer": "I'm asthmatic.  I need you to get an inhaler for me…",
      "accepted": "Oh, thank god, thank you so much!  I won't last more than a couple of days, so hurry…",
      "rejected": "What?!  Please, I'll be dead soon without your help!",
      "advice": "There's a town nearby.  Check pharmacies; it'll be in the back with the good stuff.",
      "inquire": "Find any inhaler yet?",
      "success": "Oh thank god!  I'll be right as rain in no time.",
      "success_lie": "What?!  You're lying, I can tell!  Ugh, forget it!",
      "failure": "How am I not dead already?!"
    },
    "start": {
      "effect": [
        { "npc_add_trait": "ASTHMA" },
        { "npc_remove_item_with": "inhaler" },
        "assign_guard",
        { "clear_npc_rule": "investigate_noises" }
      ]
    },
    "end": { "effect": [ "stop_guard", { "set_npc_rule": "investigate_noises" }, { "u_sell_item": "inhaler" }, "npc_thankful" ] },
    "fail": { "effect": "npc_die" }
  },
  {
    "id": "MISSION_GET_ANTIBIOTICS",
    "type": "mission_definition",
    "name": { "str": "Find Antibiotics" },
    "goal": "MGOAL_CONDITION",
    "difficulty": 2,
    "value": 150000,
    "urgent": true,
    "goal_condition": { "or": [ { "u_has_item": "antibiotics" }, { "u_has_item": "strong_antibiotic" }, { "u_has_item": "panacea" } ] },
    "origins": [ "ORIGIN_OPENER_NPC" ],
    "deadline": "1 day",
    "dialogue": {
      "describe": "This infection is bad, totally bad…",
      "offer": "I'm infected.  Badly.  I need you to get some good antibiotics for me…",
      "accepted": "Oh, thank god, thank you so much!  I won't last more than a couple of days, so hurry…",
      "rejected": "What?!  Please, I'll be dead soon without your help!",
      "advice": "There's a town nearby.  Check pharmacies; it'll be in the back, either antibiotics or broad-spectrum antibiotics will do.",
      "inquire": "Find any antibiotics yet?",
      "success": "Oh thank god!  I'll be right as rain in no time.",
      "success_lie": "What?!  You're lying, I can tell!  Ugh, forget it!",
      "failure": "How am I not dead already?!"
    },
    "start": {
      "effect": [
        { "npc_add_effect": "infection", "duration": "PERMANENT" },
        { "npc_remove_item_with": "antibiotics" },
        "assign_guard",
        { "clear_npc_rule": "investigate_noises" }
      ]
    },
    "end": {
      "effect": [
        { "npc_lose_effect": "infection" },
        "stop_guard",
        { "set_npc_rule": "investigate_noises" },
        "npc_thankful",
        {
          "if": { "u_has_item": "antibiotics" },
          "then": { "u_consume_item": "antibiotics", "popup": true },
          "else": {
            "if": { "u_has_item": "strong_antibiotic" },
            "then": { "u_consume_item": "strong_antibiotic", "popup": true },
            "else": { "u_consume_item": "panacea", "popup": true }
          }
        }
      ]
    },
    "fail": { "effect": "npc_die" }
  },
  {
    "id": "MISSION_GET_BLACK_BOX",
    "type": "mission_definition",
    "name": { "str": "Retrieve Military Black Box" },
    "goal": "MGOAL_FIND_ITEM",
    "difficulty": 2,
    "value": 100000,
    "item": "black_box",
    "origins": [ "ORIGIN_SECONDARY" ],
    "followup": "MISSION_GET_BLACK_BOX_TRANSCRIPT",
    "dialogue": {
      "describe": "We've got the flag, now we need to locate US forces.",
      "offer": "We have the flag but now we need to locate US troops to see what we can do to help.  I haven't seen any but I'm figurin' one of those choppers that were flyin' round during th' outbreak would have a good idea.  If you can get me a black box from one of the wrecks I'll look into where we might open 'er at.",
      "accepted": "Fuck yeah, America!",
      "rejected": "Do you have any better ideas?",
      "advice": "Survivors were talkin' 'bout seeing 'em falling out of the sky but I don't know where.  If I were a pilot I'd avoid crash landing in a city or forest though.  Black boxes are housed in the tail to survive the crash so check there when you do find one.  Now get to it!",
      "inquire": "How 'bout that black box?",
      "success": "America, fuck yeah!",
      "success_lie": "What?!  I oughta whip your ass.",
      "failure": "Damn, I'll have to find 'er myself."
    }
  },
  {
    "id": "MISSION_GET_BLACK_BOX_TRANSCRIPT",
    "type": "mission_definition",
    "name": { "str": "Retrieve Black Box Transcript" },
    "goal": "MGOAL_FIND_ITEM",
    "difficulty": 2,
    "value": 150000,
    "item": "black_box_transcript",
    "start": {
      "effect": { "u_spawn_item": "black_box" },
      "assign_mission_target": { "om_terrain": "lab_stairs", "om_special": "Lab", "reveal_radius": 3, "random": true, "z": 0 }
    },
    "origins": [ "ORIGIN_SECONDARY" ],
    "followup": "MISSION_EXPLORE_SARCOPHAGUS",
    "dialogue": {
      "describe": "With the black box in hand, we need to find a lab.",
      "offer": "Thanks to your searching we've got the black box but now we need to have a look inside her.  Now, most buildings don't have power anymore but there are a few that might be of use.  Have you ever seen one of those science labs that have popped up in the middle of nowhere?  Them suckers have a glowing terminal out front so I know they have power somewhere inside 'em.  If you can get inside and find a computer lab that still works you ought to be able to find out what's in the black box.",
      "accepted": "Fuck yeah, America!",
      "rejected": "Do you have any better ideas?",
      "advice": "When I was playin' with the terminal for the one I ran into it kept asking for an ID card.  Finding one would be the first order of business.",
      "inquire": "How 'bout that black box?",
      "success": "America, fuck yeah!  I was in the guard a few years back so I'm confident I can make heads-or-tails of these transmissions.",
      "success_lie": "What?!  I oughta whip your ass.",
      "failure": "Damn, I maybe we can find an egg-head to crack the terminal."
    }
  },
  {
    "id": "MISSION_GET_DEPUTY_BADGE",
    "type": "mission_definition",
    "name": { "str": "Find Deputy Badge" },
    "goal": "MGOAL_FIND_ITEM",
    "difficulty": 2,
    "value": 150000,
    "item": "badge_deputy",
    "origins": [ "ORIGIN_SECONDARY" ],
    "dialogue": {
      "describe": "Those twisted snakes…",
      "offer": "I hope you will find use from what you got out of the deposit box but I also have another job for you that might lead you to an opportunity to deal out justice for those who cannot.  First things first, we can't just look like ruffians.  Find us a deputy badge, easy enough?",
      "accepted": "I'd check the police station.",
      "rejected": "We're also official… just hang in there and I'll show you what we can really do.",
      "advice": "They shouldn't be that hard to find… should they?",
      "inquire": "Any luck?",
      "success": "Great work, Deputy.  We're in business.",
      "success_lie": "Thanks for trying… I guess.",
      "failure": "The day of reckoning will come for the criminals if it hasn't already."
    }
  },
  {
    "id": "MISSION_GET_FLAG",
    "type": "mission_definition",
    "name": { "str": "Find Flag" },
    "goal": "MGOAL_FIND_ITEM",
    "start": { "effect": [ { "npc_remove_item_with": "american_flag" } ] },
    "difficulty": 2,
    "value": 100000,
    "item": "american_flag",
    "origins": [ "ORIGIN_OPENER_NPC", "ORIGIN_ANY_NPC" ],
    "followup": "MISSION_GET_BLACK_BOX",
    "dialogue": {
      "describe": "Does our flag still yet wave?",
      "offer": "Does our flag still yet wave?  We're battered but not yet out of the fight, we need the old colors!",
      "accepted": "Hell ya!  Find me one of those big ol' American flags.",
      "rejected": "Seriously?  God damned commie…",
      "advice": "Find a large federal building or school, they must have one.",
      "inquire": "Rescued the standard yet?",
      "success": "America, fuck ya!",
      "success_lie": "What?!  You liar!",
      "failure": "You give up?  This country fell apart because no one could find a good man to rely on… might as well give up, I guess."
    }
  },
  {
    "id": "MISSION_GET_RECORD_ACCOUNTING",
    "type": "mission_definition",
    "name": { "str": "Find Corporate Accounts" },
    "goal": "MGOAL_FIND_ITEM",
    "difficulty": 2,
    "value": 140000,
    "item": "record_accounting",
    "start": { "reveal_om_ter": "office_tower" },
    "origins": [ "ORIGIN_OPENER_NPC", "ORIGIN_ANY_NPC" ],
    "followup": "MISSION_GET_SAFE_BOX",
    "dialogue": {
      "describe": "Those twisted snakes…",
      "offer": "Our world fell apart because our leaders were as crooked as the con-men that paid for their elections.  Just find me one of those corporate accounting books and I'll show you and the rest of the world just who is at fault.",
      "accepted": "You'll see, I know I'm right.",
      "rejected": "I know it isn't pressing but the big corporations didn't get a chance to destroy the evidence yet.",
      "advice": "Try a big corporate building of some sort, they're bound to have an accounting department.",
      "inquire": "Any luck?",
      "success": "Great, let's see… uh… hmmm….  Fine, I didn't even do my own taxes but I'm sure this will prove their guilt if we get an expert to examine it.",
      "success_lie": "Thanks for trying… I guess.",
      "failure": "The day of reckoning will come for the corporations if it hasn't already."
    }
  },
  {
    "id": "MISSION_GET_RECORD_PATIENT",
    "type": "mission_definition",
    "name": { "str": "Find Patient Records" },
    "goal": "MGOAL_FIND_ITEM",
    "difficulty": 2,
    "value": 60000,
    "item": "record_patient",
    "start": { "reveal_om_ter": [ "office_doctor", "hospital_2" ] },
    "origins": [ "ORIGIN_OPENER_NPC", "ORIGIN_ANY_NPC" ],
    "followup": "MISSION_REACH_FEMA_CAMP",
    "dialogue": {
      "describe": "I hope I don't see many names I know…",
      "offer": "I've lost so many friends… please find me a patient list from the regional hospital or doctor's office.  I just want to know who might still be out there.",
      "accepted": "Thank you, I suppose it won't change what has already happened but it will bring me closure.",
      "rejected": "Please, I just want to know what happened to everyone.",
      "advice": "I bet you'll run into a lot of those things in the hospital, please be careful.",
      "inquire": "Any luck?",
      "success": "Oh dear, I thought Timmy would have made it…",
      "success_lie": "Thanks for trying… I guess.",
      "failure": "I bet some of them are still out there…"
    }
  },
  {
    "id": "MISSION_GET_RECORD_WEATHER",
    "type": "mission_definition",
    "name": { "str": "Find Weather Log" },
    "goal": "MGOAL_FIND_ITEM",
    "difficulty": 2,
    "value": 50000,
    "item": "record_weather",
    "start": { "reveal_om_ter": "station_radio" },
    "origins": [ "ORIGIN_OPENER_NPC", "ORIGIN_ANY_NPC" ],
    "dialogue": {
      "describe": "I wonder if a retreat might exist…",
      "offer": "Everyone who dies gets back up, right?  Which means that whatever is causing this it must be airborne to have infected everyone.  I believe that if that is the case then there should be regions that were not downwind from where-ever the disease was released.  We need to find a record of all the weather patterns leading up to the outbreak.",
      "accepted": "Thanks so much, you may save both of us yet.",
      "rejected": "Ya, it was a long shot I admit.",
      "advice": "I'm not sure, maybe a news station would have what we are looking for?",
      "inquire": "Any luck?",
      "success": "These look more complicated than I thought, just give me some time.",
      "success_lie": "This isn't what we need.",
      "failure": "If only we could find a great valley or something."
    }
  },
  {
    "id": "MISSION_GET_HOLY_SYMBOL",
    "type": "mission_definition",
    "name": { "str": "Find a Holy Symbol" },
    "goal": "MGOAL_FIND_ITEM",
    "difficulty": 2,
    "value": 100000,
    "item": "holy_symbol",
    "start": { "effect": [ { "npc_remove_item_with": "holy_symbol" } ], "reveal_om_ter": [ "church_1" ] },
    "origins": [ "ORIGIN_OPENER_NPC", "ORIGIN_ANY_NPC" ],
    "followup": "MISSION_GET_RELIC",
    "dialogue": {
      "describe": "Any variant is fine, I am not that choosy…",
      "offer": "The sky has torn apart and creatures beyond our wildest imaginations lurk in the dark now.  I beg you, find me a holy symbol.  Maybe some faith can help me sleep better at night.",
      "accepted": "May whatever god or spirits that now reign the world protect you.",
      "rejected": "I guess the stress may just be getting to me…",
      "advice": "A church must be full of them and who knows, maybe some of those <zombies> carry some.  But please, do not waste your time making one yourself.",
      "inquire": "Any luck?  Please find me a holy symbol.  Any of them will do.",
      "success": "Thank the heavens.",
      "success_lie": "What good does this do me?",
      "failure": "It was a lost cause anyways…"
    }
  },
  {
    "id": "MISSION_GET_RELIC",
    "type": "mission_definition",
    "name": { "str": "Find Relic" },
    "description": "Find a relic of a forgotten saint.  Places like <color_yellow>cathedrals</color> or <color_yellow>museums</color> might have one.",
    "goal": "MGOAL_FIND_ITEM",
    "difficulty": 2,
    "value": 100000,
    "item": "small_relic",
    "start": { "reveal_om_ter": [ "cathedral_1", "museum" ] },
    "origins": [ "ORIGIN_SECONDARY" ],
    "followup": "MISSION_RECOVER_PRIEST_DIARY",
    "dialogue": {
      "describe": "St. Michael the archangel defend me in battle…",
      "offer": "As the world seems to abandon the reality that we once knew, it becomes plausible that the old superstitions that were cast aside may have had some truth to them.  Please go and find me a religious relic… I doubt it will be of much use but I've got to hope in something.",
      "accepted": "I wish you the best of luck, may whatever god you please guide your path.",
      "rejected": "Ya, I guess the stress may just be getting to me…",
      "advice": "I suppose a large church or cathedral may have something.",
      "inquire": "Any luck?  Please find me a small relic.  Any relic will do.",
      "success": "Thank you, I need some time alone now…",
      "success_lie": "What good does this do us?",
      "failure": "It was a lost cause anyways…"
    }
  },
  {
    "id": "MISSION_GET_SAFE_BOX",
    "type": "mission_definition",
    "name": { "str": "Retrieve Deposit Box" },
    "goal": "MGOAL_FIND_ITEM",
    "difficulty": 2,
    "value": 30000,
    "item": "safe_box",
    "start": {
      "update_mapgen": { "place_item": [ { "item": "safe_box", "x": [ 18, 21 ], "y": [ 4, 6 ], "amount": 1 } ] },
      "effect": "follow_only",
      "assign_mission_target": { "om_terrain": "bank", "om_terrain_match_type": "PREFIX", "om_special": "bank", "random": true, "z": 0 }
    },
    "end": {
      "effect": [
        "stop_following",
        { "weighted_list_eocs": [ [ "get_katana", 5 ], [ "get_deagle_44", 10 ], [ "get_m4_carbine", 6 ] ] }
      ]
    },
    "origins": [ "ORIGIN_SECONDARY" ],
    "followup": "MISSION_GET_DEPUTY_BADGE",
    "dialogue": {
      "describe": "Those twisted snakes…",
      "offer": "Now I don't mean to upset you but I'm not sure what I can do with the accounting ledger at the moment.  We do have a new lead though, the ledger has a safe deposit box under the regional manager's name.  Guess what, dumb sucker wrote down his combination.  Come with me to retrieve the box and you can keep any of the goodies in it that I can't use to press charges against these bastards.",
      "accepted": "You may make a tidy profit from this.",
      "rejected": "I know it isn't pressing but the world is going to be just as corrupt when we start rebuilding unless we take measure to stop those who seek to rule over us.",
      "advice": "This shouldn't be hard unless we run into a horde.",
      "inquire": "Any luck?",
      "success": "Great, anything I can't use to prosecute the bastards is yours, as promised.",
      "success_lie": "Thanks for trying… I guess.",
      "failure": "The day of reckoning will come for the corporations if it hasn't already."
    }
  },
  {
    "id": "MISSION_GET_SOFTWARE",
    "type": "mission_definition",
    "name": { "str": "Retrieve Software" },
    "description": "Retrieve the software in their computer marked on your map.",
    "goal": "MGOAL_FIND_ANY_ITEM",
    "difficulty": 2,
    "value": 80000,
    "place": "near_town",
    "start": "place_npc_software",
    "origins": [ "ORIGIN_OPENER_NPC", "ORIGIN_ANY_NPC" ],
    "dialogue": {
      "describe": "Oh man, I can't believe I forgot to download it…",
      "offer": "There's some important software on my computer that I need on USB.",
      "accepted": "Thanks!  Just pull the data onto this USB drive and bring it to me.",
      "rejected": "Seriously?  It's an easy job…",
      "advice": "Take this USB drive.  Use the console, and download the software.",
      "inquire": "So, do you have my software yet?",
      "success": "Excellent, thank you!",
      "success_lie": "What?!  You liar!",
      "failure": "Wow, you failed?  All that work, down the drain…"
    }
  },
  {
    "id": "MISSION_GET_ZOMBIE_BLOOD_ANAL",
    "type": "mission_definition",
    "name": { "str": "Analyze Zombie Blood" },
    "goal": "MGOAL_FIND_ITEM",
    "difficulty": 8,
    "value": 250000,
    "item": "software_blood_data",
    "start": {
      "effect": [ { "u_spawn_item": "vacutainer" }, { "u_spawn_item": "usb_drive" } ],
      "assign_mission_target": { "om_terrain": "hospital_2", "om_special": "hospital", "reveal_radius": 3 }
    },
    "origins": [ "ORIGIN_SECONDARY" ],
    "dialogue": {
      "describe": "It could be very informative to perform an analysis of zombie blood…",
      "offer": "I need someone to get a sample of zombie blood, take it to a hospital, and perform a centrifuge analysis of it.",
      "accepted": "Excellent.  Take this blood draw kit; once you've produced a zombie corpse, use it to extract blood from the body, then take it to a hospital for analysis.",
      "rejected": "Are you sure?  The scientific value of that blood data could be priceless…",
      "advice": "The centrifuge is a bit technical; you might want to study up on the usage of computers before completing that part.",
      "inquire": "Well, do you have the data yet?",
      "success": "Excellent!  This may be the key to removing the infection.",
      "success_lie": "Wait, you couldn't possibly have the data!  Liar!",
      "failure": "What a shame, that data could have proved invaluable…"
    }
  },
  {
    "id": "MISSION_INVESTIGATE_CULT",
    "type": "mission_definition",
    "name": { "str": "Investigate Cult" },
    "description": "Investigate the strange cabin in the woods and find an item that may clue you in about <color_yellow>a potential human sacrifice</color> the cult has performed, such as <color_yellow>human bones or other remains</color>.",
    "goal": "MGOAL_FIND_ITEM",
    "difficulty": 2,
    "value": 150000,
    "item": "etched_skull",
    "start": { "assign_mission_target": { "om_terrain": "cabin_strange", "om_special": "Strange Cabin", "reveal_radius": 3 } },
    "origins": [ "ORIGIN_SECONDARY" ],
    "followup": "MISSION_INVESTIGATE_PRISON_VISIONARY",
    "dialogue": {
      "describe": "St. Michael the archangel defend me in battle…",
      "offer": "You have no idea how interesting this diary is.  I have two very promising leads… first things first, the Catholic Church has been performing its own investigations into global cult phenomenon and it appears to have become very interested in a local cult as of recently.  Could you investigate a location for me?  I'm not sure what was going on here but the priest seemed fairly worried about it.",
      "accepted": "I wish you the best of luck, may whatever god you please guide your path… You may need it this time more than the past excursions you have gone on.  There is a note about potential human sacrifice in the days immediately before and after the outbreak.  The name of the cult is believed to be the Church of Starry Wisdom but it is noted that accounts differ.",
      "rejected": "Ya, I guess the stress may just be getting to me…",
      "advice": "I doubt the site is still occupied but I'd carry a firearm at least… I'm not sure what you might be looking for but I'm positive you'll find something out of the ordinary if you look long enough.",
      "inquire": "I'm positive there is something there… there has to be, any luck?",
      "success": "Thank you, your account of these… demonic creations proves the fears the churches had were well founded.  Our priority should be routing out any survivors of this cult… I don't known if they are responsible for the outbreak but they certainly know more about it than I do.",
      "success_lie": "What good does this do us?",
      "failure": "It was a lost cause anyways…"
    }
  },
  {
    "id": "MISSION_INVESTIGATE_PRISON_VISIONARY",
    "type": "mission_definition",
    "name": { "str": "Prison Visionary" },
    "goal": "MGOAL_FIND_ITEM",
    "difficulty": 2,
    "value": 150000,
    "item": "visions_solitude",
    "start": {
      "assign_mission_target": { "om_terrain": "prison_1_4", "om_special": "Prison", "reveal_radius": 3 },
      "update_mapgen": { "om_terrain": "prison_1_4", "place_item": [ { "item": "visions_solitude", "x": 15, "y": 22 } ] }
    },
    "origins": [ "ORIGIN_SECONDARY" ],
    "dialogue": {
      "describe": "St. Michael the archangel defend me in battle…",
      "offer": "I have another task if you are feeling up to it.  There is a prisoner that the priest made special mention of.  I was wondering if you could see what may have happened to him or if he left anything in his cell.  The priest admits the individual is rather unstable, to put it lightly, but the priest personally believed the man was some kind of repentant visionary.  I'm not in a position to cast out the account just yet… it seems the man has prophesied events accurately before concerning the Church of Starry Wisdom.",
      "accepted": "I wish you the best of luck, may whatever god you please guide your path… I can only imagine that the prison will be a little slice of hell.  I'm not sure what they would have decided to do with the inmates when they knew death was almost certain.",
      "rejected": "Ya, I guess the stress may just be getting to me…",
      "advice": "The worst case scenario will probably be that the prisoners have escaped their cells and turned the building into their own little fortress.  Best case, the building went into lock-down and secured the prisoners in their cells.  Either way, navigating the building will pose its own difficulties.",
      "inquire": "Any luck?",
      "success": "Thank you, I'm not sure what to make of this but I'll ponder your account.",
      "success_lie": "What good does this do us?",
      "failure": "It was a lost cause anyways…"
    }
  },
  {
    "id": "MISSION_JOIN_TRACKER",
    "type": "mission_definition",
    "name": { "str": "Find Deputy Badge" },
    "goal": "MGOAL_FIND_ITEM",
    "difficulty": 5,
    "value": 0,
    "urgent": true,
    "item": "badge_deputy",
    "start": { "effect": "follow" },
    "origins": [ "ORIGIN_SECONDARY" ],
    "dialogue": {
      "describe": "Well damn, you must be the guys here to pick me up…",
      "offer": "I got the brief so I know what I'm getting into.  Let me be upfront, treat me like shit and I'm going to cover my own hide.  However, you treat me well and give me something to believe in, even if it's just a shiny bit of metal, and I'll do you right.  Without a strong band a man doesn't stand a chance in this world.  You ready to take charge boss?  This world could use a Sheriff just about now.",
      "accepted": "Before we get into a major fight just make sure we have the gear we need, boss.",
      "rejected": "I don't think you're going to find many other survivors who haven't taken up a faction yet.",
      "advice": "I'm a pretty good shot with a rifle or pistol.",
      "inquire": "Any problems boss?",
      "success": "Wait… are you really making me a deputy?",
      "success_lie": "I don't think so…",
      "failure": "Quitting already?"
    }
  },
  {
    "id": "MISSION_KILL_100_Z",
    "type": "mission_definition",
    "name": { "str": "Kill 100 Zombies" },
    "goal": "MGOAL_KILL_MONSTER_SPEC",
    "monster_species": "ZOMBIE",
    "monster_kill_goal": 100,
    "difficulty": 5,
    "value": 250000,
    "start": { "effect": "follow_only" },
    "end": { "effect": "stop_following" },
    "origins": [ "ORIGIN_SECONDARY" ],
    "followup": "MISSION_KILL_HORDE_MASTER",
    "dialogue": {
      "describe": "You seem to know this new world better than most…",
      "offer": "You're kitted out better than most… would you be interested in making this world a little better for the rest of us?  The towns have enough supplies for us survivors to start securing a foothold but we don't have anyone with the skills and equipment to thin the masses of undead.  I'll lend you a hand to the best of my ability but you really showed promise taking out that other beast.  You, I, and a 100 zombies laid to rest, what do you say?",
      "accepted": "Hell ya, we may get ourselves killed but we'll be among the first legends of the apocalypse.",
      "rejected": "Hey, I know I wouldn't volunteer for it either… but then I remember that most of us survivors won't make it unless someone decides to take the initiative.",
      "advice": "I'd secure an ammo cache and try to sweep a town in multiple passes.",
      "inquire": "Got this knocked out?",
      "success": "Man… you're a goddamn machine.  It was a pleasure working with you.  You know, you may just change our little neck of the world if you keep this up.",
      "success_lie": "I don't think that was quite a hundred dead zeds.",
      "failure": "Quitting already?"
    }
  },
  {
    "id": "MISSION_KILL_HORDE_MASTER",
    "type": "mission_definition",
    "name": { "str": "Kill Horde Master" },
    "goal": "MGOAL_KILL_MONSTER",
    "difficulty": 5,
    "value": 250000,
    "urgent": true,
    "start": {
      "update_mapgen": {
        "place_monster": [
          { "monster": "mon_zombie_master", "x": [ 12, 15 ], "y": [ 12, 15 ], "target": true, "name": "Demonic Soul" },
          { "group": "GROUP_ZOMBIE", "x": [ 12, 15 ], "y": [ 12, 15 ], "repeat": [ 21, 29 ] }
        ]
      },
      "effect": "follow_only",
      "assign_mission_target": { "om_terrain": "house", "om_terrain_match_type": "CONTAINS", "min_distance": 10, "random": true, "z": 0 }
    },
    "end": { "effect": "stop_following" },
    "origins": [ "ORIGIN_SECONDARY" ],
    "followup": "MISSION_RECRUIT_TRACKER",
    "dialogue": {
      "describe": "I've heard some bad rumors so I hope you are up for another challenge…",
      "offer": "Apparently one of the other survivors picked up on an unusually dense horde of undead moving into the area.  At the center of this throng there was a 'leader' of some sort.  The short of it is, kill the son of a bitch.  We don't know what it is capable of or why it is surrounded by other zombies but this thing reeks of trouble.  Do whatever it takes but we can't risk it getting away.",
      "accepted": "I'll lend you a hand but I'd try and recruit another gunslinger if you can.",
      "rejected": "What's the use of walking away, they'll track you down eventually.",
      "advice": "Don't risk torching the building it may be hiding in if it has a basement.  The sucker may still be alive under the rubble and ash.",
      "inquire": "Got this knocked out?",
      "success": "May that bastard never get up again.",
      "success_lie": "I don't think we got it yet.",
      "failure": "Quitting already?"
    }
  },
  {
    "id": "MISSION_KILL_JABBERWOCK",
    "type": "mission_definition",
    "name": { "str": "Kill Jabberwock" },
    "goal": "MGOAL_KILL_MONSTER",
    "difficulty": 5,
    "value": 200000,
    "urgent": true,
    "start": {
      "assign_mission_target": {
        "om_terrain": "forest_thick",
        "om_terrain_replace": "forest",
        "reveal_radius": 1,
        "random": true,
        "min_distance": 5,
        "z": 0
      },
      "update_mapgen": { "place_monster": [ { "monster": "mon_jabberwock", "x": 11, "y": 11, "target": true } ] }
    },
    "end": { "effect": "npc_thankful" },
    "origins": [ "ORIGIN_OPENER_NPC", "ORIGIN_ANY_NPC" ],
    "followup": "MISSION_KILL_100_Z",
    "dialogue": {
      "describe": "The eater of the dead… something was ripping zombies to shreds and only leaving a few scattered limbs…",
      "offer": "A few days ago another survivor and I were trying to avoid the cities by staying in the woods during the day and foraging for gear at night.  It worked well against the normal zeds but one night something caught onto our trail and chased us for ten minutes or so until we decided to split up and meet-up back here.  My buddy never showed up and I don't have the means to kill whatever it was.  Can you lend a hand?",
      "accepted": "Thanks, make sure you're ready for whatever the beast is.",
      "rejected": "Hey, I know I wouldn't volunteer for it either.",
      "advice": "I'd carry a shotgun at least, it sounded pretty big.",
      "inquire": "Any luck?",
      "success": "You look a little shaken up, I can't tell you how glad I am that you killed it though.",
      "success_lie": "Something in the shadows still seems to stare at me when I look at the woods.",
      "failure": "I'm glad you came back alive… I wasn't sure if I had sent you to your death."
    }
  },
  {
    "id": "MISSION_KILL_ZOMBIE_MOM",
    "type": "mission_definition",
    "name": { "str": "Kill Zombie Mom" },
    "goal": "MGOAL_KILL_MONSTER",
    "difficulty": 5,
    "value": 120000,
    "urgent": true,
    "start": {
      "assign_mission_target": {
        "om_terrain": "house",
        "om_terrain_match_type": "PREFIX",
        "reveal_radius": 1,
        "random": true,
        "min_distance": 5,
        "z": 0
      },
      "update_mapgen": { "place_monster": [ { "monster": "mon_zombie", "x": 12, "y": 12, "target": true, "random_name": "female" } ] }
    },
    "end": { "effect": "npc_thankful" },
    "origins": [ "ORIGIN_OPENER_NPC", "ORIGIN_ANY_NPC" ],
    "dialogue": {
      "describe": "Oh god, I can't believe it happened…",
      "offer": "My mom… she's… she was killed, but then she just got back up… she's one of those things now.  Can you put her out of her misery for me?",
      "accepted": "Thank you… she would've wanted it this way.",
      "rejected": "Please reconsider, I know she's suffering…",
      "advice": "Find a gun if you can, make it quick…",
      "inquire": "Well…?  Did you… finish things for my mom?",
      "success": "Thank you.  I couldn't rest until I knew that was finished.",
      "success_lie": "What?!  You're lying, I can tell!  Ugh, forget it!",
      "failure": "Really… that's too bad."
    }
  },
  {
    "id": "MISSION_NULL",
    "type": "mission_definition",
    "name": { "str": "Null mission" },
    "goal": "MGOAL_NULL",
    "difficulty": 0,
    "value": 0,
    "place": "never"
  },
  {
    "id": "MISSION_REACH_FARM_HOUSE",
    "type": "mission_definition",
    "name": { "str": "Reach Farm House" },
    "goal": "MGOAL_GO_TO_TYPE",
    "difficulty": 2,
    "value": 60000,
    "start": { "effect": "follow_only" },
    "end": { "effect": "stop_following" },
    "origins": [ "ORIGIN_SECONDARY" ],
    "destination": "farm_2",
    "dialogue": {
      "describe": "I just need a place to start over…",
      "offer": "I've accepted that everyone I used to know is dead… one way or another.  I really wish I could have done something to save my brother but he was one of the first to go.  I'd like to start over, just rebuild at one of the farms in the countryside.  Can you help me secure one?",
      "accepted": "Thank you, let's find a remote one so we don't have to worry about many zombies.",
      "rejected": "Please, I just don't know what to do otherwise.",
      "advice": "Traveling the backroads would be a good way to search for one.",
      "inquire": "Shall we keep looking for a farm house?",
      "success": "Well, my adventuring days are over.  I can't thank you enough.  Trying to make this place self sustaining will take some work but the future is looking brighter.  At least it ought to be safe for now.  You'll always be welcome here.",
      "success_lie": "Thanks for trying… I guess.",
      "failure": "I guess it was just a pipe dream."
    }
  },
  {
    "id": "MISSION_REACH_FEMA_CAMP",
    "type": "mission_definition",
    "name": { "str": "Reach FEMA Camp" },
    "goal": "MGOAL_GO_TO_TYPE",
    "difficulty": 2,
    "value": 60000,
    "start": { "effect": "follow_only" },
    "origins": [ "ORIGIN_SECONDARY" ],
    "followup": "MISSION_REACH_FARM_HOUSE",
    "destination": "fema",
    "dialogue": {
      "describe": "Maybe they escaped to one of the camps…",
      "offer": "I can't thank you enough for bringing me the patient records but I do have another request.  You seem to know your way around… could you take me to one of the FEMA camps?  I know some were overrun but I don't want to believe all of them could have fallen.",
      "accepted": "Thank you, just bring me to the camp… I just want to see.",
      "rejected": "Please, I don't know what else to do.",
      "advice": "We should go at night, if it is overrun then we can quickly make our escape.",
      "inquire": "Any leads on where a camp might be?",
      "success": "I guess this wasn't as bright an idea as I thought.",
      "success_lie": "Thanks for trying… I guess.",
      "failure": "I bet some of them are still out there…"
    }
  },
  {
    "id": "MISSION_REACH_SAFETY",
    "type": "mission_definition",
    "name": { "str": "Reach Safety" },
    "goal": "MGOAL_GO_TO",
    "difficulty": 1,
    "value": 0,
    "start": "find_safety",
    "origins": [ "ORIGIN_NULL" ]
  },
  {
    "id": "MISSION_RECOVER_PRIEST_DIARY",
    "type": "mission_definition",
    "name": { "str": "Recover Priest's Diary" },
    "description": "Find something that may reveal what the church's stance is on these events.  Something like <color_yellow>a priest's diary</color> would suffice.",
    "goal": "MGOAL_FIND_ITEM",
    "difficulty": 2,
    "value": 70000,
    "item": "priest_diary",
    "start": {
      "update_mapgen": { "place_item": [ { "item": "priest_diary", "x": [ 3, 21 ], "y": [ 6, 21 ], "amount": 1 } ] },
      "assign_mission_target": { "om_terrain": "house", "om_terrain_match_type": "PREFIX", "min_distance": 5, "random": true, "z": 0 }
    },
    "origins": [ "ORIGIN_SECONDARY" ],
    "followup": "MISSION_INVESTIGATE_CULT",
    "dialogue": {
      "describe": "St. Michael the archangel defend me in battle…",
      "offer": "From what I understand, the creatures you encountered surrounding this relic were unlike anything I've heard of.  It is laughable that I now consider the living dead to be part of our ordinary reality.  Never-the-less, the church must have some explanation for these events.  I have located the residence of a local clergy man, could you go to this address and recover any items that may reveal what the church's stance is on these events?",
      "accepted": "I wish you the best of luck, may whatever god you please guide your path.",
      "rejected": "Ya, I guess the stress may just be getting to me…",
      "advice": "If the information is confidential the priest must have it hidden within his own home.",
      "inquire": "Any luck?",
      "success": "Thank you, a diary is exactly what I was looking for.",
      "success_lie": "What good does this do us?",
      "failure": "It was a lost cause anyways…"
    }
  },
  {
    "id": "MISSION_RECRUIT_TRACKER",
    "type": "mission_definition",
    "name": { "str": "Recruit Tracker" },
    "description": "Go to the cabin in the woods where the Tracker is camping and <color_yellow>recruit them</color>.",
    "goal": "MGOAL_RECRUIT_NPC",
    "difficulty": 5,
    "value": 70000,
    "start": {
      "assign_mission_target": { "om_terrain": "cabin", "om_special": "Cabin", "reveal_radius": 2 },
      "effect": "follow",
      "update_mapgen": { "place_npcs": [ { "class": "tracker_gunslinger", "x": 11, "y": 11, "target": true } ] }
    },
    "origins": [ "ORIGIN_SECONDARY" ],
    "dialogue": {
      "describe": "You seem to know this new world better than most…",
      "offer": "We've got another problem to deal with but I don't think we can handle it on our own.  So, I sent word out and found us a volunteer… of sorts.  He's vain as hell but has a little skill with firearms.  He was supposed to collect whatever he had of value and is going to meet us at a cabin in the woods.  Wasn't sure how long we were going to be so I told him to just camp there until we picked him up.",
      "accepted": "Roger, if he's a no-show then any other gunslinger will do… but I doubt he'll quit before we even begin.",
      "rejected": "Hey, I know I wouldn't volunteer for it either… but then I remember that most of us survivors won't make it unless someone decides to take the initiative.",
      "advice": "I hope the bastard is packing heat… else we'll need to grab him a gun before we hit our next target.",
      "inquire": "Found a gunslinger?",
      "success": "Great, just let me know when you are ready to wade knee-deep in an ocean of blood.",
      "success_lie": "I don't think so…",
      "failure": "Quitting already?"
    }
  },
  {
    "id": "MISSION_RESCUE_DOG",
    "type": "mission_definition",
    "name": { "str": "Find Lost Dog" },
    "goal": "MGOAL_FIND_MONSTER",
    "difficulty": 3,
    "value": 100000,
    "start": {
      "update_mapgen": { "place_monster": [ { "monster": "mon_dog", "x": [ 3, 21 ], "y": [ 6, 21 ], "friendly": true, "target": true } ] },
      "effect": [ { "u_spawn_item": "dog_whistle" } ],
      "assign_mission_target": { "om_terrain": "house", "om_terrain_replace": "field", "om_terrain_match_type": "PREFIX", "random": true, "z": 0 }
    },
    "origins": [ "ORIGIN_OPENER_NPC" ],
    "dialogue": {
      "describe": "Oh, my poor puppy…",
      "offer": "I left my poor dog in a house, not far from here.  Can you retrieve it?",
      "accepted": "Thank you!  Please hurry back!",
      "rejected": "Please, think of my poor little puppy!",
      "advice": "Take my dog whistle; if the dog starts running off, blow it and he'll return to your side.",
      "inquire": "Have you found my dog yet?",
      "success": "Thank you so much for finding him!",
      "success_lie": "What?!  You're lying, I can tell!  Ugh, forget it!",
      "failure": "Oh no!  My poor puppy…"
    }
  },
  {
    "id": "MISSION_GET_CITY_COP_MOMENTO",
    "type": "mission_definition",
    "name": { "str": "Break into armory to retrieve family photo" },
    "goal": "MGOAL_FIND_ITEM",
    "difficulty": 2,
    "value": 800,
    "item": "family_photo",
    "origins": [ "ORIGIN_SECONDARY" ],
    "dialogue": {
      "describe": "I need you to get my family photo from the armory safe.",
      "offer": "I left the only photo I have from my family in the armory.  I don't have the code, can you get in?",
      "accepted": "Thanks, it's great to see someone willing to help a out.",
      "rejected": "Well, I'll find someone else to do it for me, real shame with all those guns locked up too…",
      "advice": "You look like a resourceful sort, maybe you can hack it or something.",
      "inquire": "Got the photo?  Should've been in my gun safe.",
      "success": "Thanks!  I'll be sure to put in a good word for you around town.",
      "success_lie": "OK, then hand it over.",
      "failure": "Shit happens."
    }
  },
  {
    "id": "MISSION_PROVE_YOUR_WORTH",
    "type": "mission_definition",
    "name": { "str": "Prove your worth to Foodperson" },
    "description": "Prove your dedication to the Foodperson and Foodplace as a whole by finding <color_yellow>10 Foodplace loyalty cards</color>.",
    "goal": "MGOAL_FIND_ITEM",
    "item": "fp_loyalty_card",
    "count": 10,
    "difficulty": 1,
    "value": 0,
    "end": {
      "effect": [
        { "npc_add_var": "dialogue_foodperson_npc_foodperson_impressed", "value": "yes" },
        { "u_spawn_item": "badge_foodkid" }
      ]
    },
    "origins": [ "ORIGIN_SECONDARY" ],
    "dialogue": {
      "describe": "Prove your dedication to Foodplace.",
      "offer": "Show me the proof of your loyalty to the great Foodplace, and I'll consider you worthy of my friendship.  Ten loyalty cards should be enough, I'm sure you already have much more than that waiting for you at home, right?",
      "accepted": "That's the spirit!  Good luck kid.",
      "rejected": "That's alright not everyone is cutout for this.",
      "advice": "Those are very precious, people would probably keep them on their person or in bank vaults.  And definitely not throw them in the trash!",
      "inquire": "How is it going?  Do you have them?",
      "success": "YES!  I knew you could do it!  You proved your worth and I'm proud to call you a friend.",
      "success_lie": "Well… where are they?",
      "failure": "I'm so disappointed in you kid…"
    }
  },
  {
    "id": "MISSION_PROVE_YOU_ARE_A_SURVIVOR",
    "type": "mission_definition",
    "name": { "str": "Prove You're A Survivor" },
    "description": "Prove you're a survivor by surviving for 10 days after the Cataclysm, and then returning to the person who gave you this mission.",
    "goal": "MGOAL_CONDITION",
    "goal_condition": { "math": [ "time_since('cataclysm', 'unit':'days') >= 10" ] },
    "difficulty": 1,
    "value": 0,
    "origins": [ "ORIGIN_OPENER_NPC" ],
    "end": { "effect": "follow" },
    "dialogue": {
      "describe": "It's hard to tell who actually has the skills to survive these days…",
      "offer": "It's hard surviving out here on our own, and we'd probably have a better chance working together.  Problem is, I don't really know you and what you're capable of.  You might have what it takes, or you might not.  Either way, I'm going to need some proof.  Come back in a few days and I'll gladly follow you.  It's basically a win-win for me: either you come back and I'll know you've got what it takes, or you don't and I'll know that I was right not to follow you.",
      "accepted": "I'll see you then… or I won't, and then I'll know I made the right decision.",
      "rejected": "Ya, it was a long shot I admit.",
      "advice": "Don't die.  If you're asking me for advice, that doesn't bode well for you.",
      "inquire": "Well, you're not dead… yet.",
      "success": "I'll be honest, I wasn't really expecting to see you again.  A promise is a promise, I'll follow you now!",
      "success_lie": "I know time is relative and all that.",
      "failure": "I'm not quite sure how you failed to survive AND are talking to me."
    }
  },
  {
    "id": "MISSION_LEARN_ABOUT_CATTAIL_JELLY",
    "type": "mission_definition",
    "name": { "str": "Gather cattail stalks to create cattail jelly" },
    "description": "Gather <color_light_blue>60 cattail stalks</color> from the swamp and bring them back to <color_light_red>learn how to craft cattail jelly</color>.  Raise your <color_light_blue>survival skill to at least 1</color> by harvesting cattail stalks.  <color_light_blue>Bring back the provided bag with the 60 cattail stalks in them</color> as well.",
    "goal": "MGOAL_CONDITION",
    "goal_condition": {
      "and": [
        { "u_has_item": "swag_bag" },
        { "u_has_items": { "item": "cattail_stalk", "count": 60 } },
        { "math": [ "u_skill('survival') >= 1" ] }
      ]
    },
    "difficulty": 1,
    "value": 0,
    "has_generic_rewards": false,
    "origins": [ "ORIGIN_OPENER_NPC", "ORIGIN_ANY_NPC" ],
    "start": {
      "effect": [ { "u_spawn_item": "swag_bag" } ],
      "assign_mission_target": { "om_terrain": "forest_water", "reveal_radius": 3 }
    },
    "end": {
      "effect": [
        { "u_sell_item": "cattail_stalk", "count": 60 },
        { "u_sell_item": "swag_bag" },
        { "npc_consume_item": "cattail_stalk", "count": 60 },
        { "u_learn_recipe": "cattail_jelly" },
        { "u_message": "You learn how to craft cattail jelly.", "popup": true },
        { "u_spawn_item": "cattail_jelly", "container": "bag_zipper", "count": 5 }
      ]
    },
    "dialogue": {
      "describe": "Medical services are a little sparse following <the_cataclysm>, but people have been surviving using their wits and the bounty of Mother Nature for a long time.  Care to learn a little?",
      "offer": "Did you know that cattails are a source of a jelly that works as an antiseptic and analgesic?  Something like that is likely to be mighty helpful out here.  I want you to take this bag, head to the nearest swamp, collect 60 cattail stalks, and bring them back here.  In exchange, I'll show you how to harvest the jelly.",
      "accepted": "Great!  <color_yellow>This bag should be big enough to hold all of the stalks we'll need.  Don't forget to bring it back.</color>",
      "rejected": "Your loss.",
      "advice": "The cattails grow in the fresh water in swamps.  You can't miss them.",
      "inquire": "Got those cattail stalks yet?  Don't forget to <color_yellow>bring back my bag with the stalks in them</color> and to work on improving your survival skill as well.",
      "success": "Great!  Hand them over and I'll show you how this works.",
      "success_lie": "OK, then hand them over.",
      "failure": "Well, that's a shame."
    }
  },
  {
    "id": "MISSION_PYROMANIAC",
    "type": "mission_definition",
    "name": { "str": "Angry pyromaniac" },
    "description": "Bring the pyromaniac to <color_light_blue>their rival's house</color> and don't forget to <color_yellow>bring at least 200 units of gasoline</color>.  After you got there, talk to the pyromaniac to start burning the house.",
    "goal": "MGOAL_GO_TO",
    "difficulty": 0,
    "value": 0,
    "//": "NPC will ask player to burn tagged house. Will follow player after accepting mission.",
    "//2": "Change first topic to do proper checks. MGOAL_GO_TO to check if player stands on tagged tile.",
    "//3": "At the end of the mission, will place fire on tagged tile and NPC will join player faction.",
    "has_generic_rewards": false,
    "start": {
      "effect": [ "follow_only", { "npc_first_topic": "MISSION_PYROMANIAC" } ],
      "assign_mission_target": { "om_terrain": "house", "om_terrain_replace": "forest", "om_terrain_match_type": "PREFIX", "random": true, "z": 0 }
    },
    "end": {
      "effect": [ "follow", { "u_consume_item": "gasoline", "count": 200 }, { "mapgen_update": "MISSION_PYROMANIAC_BURN" } ]
    },
    "origins": [ "ORIGIN_OPENER_NPC" ],
    "dialogue": {
      "describe": "Oh man, I want to fucking burn it so bad…",
      "offer": "I'm so fucking infuriated!  I've got an enemy that ruined my life, and now I want to get revenge!  I don't care about <the_cataclysm>, I just want to burn his house!  Would you help me, <name_g>?",
      "accepted": "Good.  Let's go to his house and goddamn burn it down!  Oh, by the way, could you bring gasoline with you, <name_g>?  I was so angry I forgot to bring it with me…",
      "rejected": "Seriously?  It's such an easy job…",
      "advice": "Maybe we can find some gasoline at a gas station.",
      "inquire": "Are you ready, <name_g>?",
      "success": "Sweet, sweet revenge!  Ah, smells so nice!  Feels like the smell of napalm in the morning!  All his stuff, and probably even that <name_b>, will burn to ashes in a matter of minutes.  You helped me get my revenge, so I'll follow you to the end, <name_g>!",
      "success_lie": "What?!  You liar!",
      "failure": "Wow, you failed?  How…"
    }
  },
  {
    "//": "For MISSION_PYROMANIAC. Will spawn fire on tile where PC is standing.",
    "type": "mapgen",
    "update_mapgen_id": "MISSION_PYROMANIAC_BURN",
    "object": {
      "place_liquids": [ { "liquid": "gasoline", "x": [ 5, 20 ], "y": [ 5, 20 ], "amount": 5, "repeat": 40 } ],
      "place_fields": [ { "field": "fd_fire", "x": [ 5, 20 ], "y": [ 5, 20 ], "repeat": 40 } ]
    }
  },
  {
    "id": "MISSION_INVESTIGATE_PORTAL_DUNGEON",
    "type": "mission_definition",
    "name": { "str": "Investigate Strange Location" },
    "goal": "MGOAL_GO_TO",
    "description": "You could find this place upside down, dizzy and blindfolded.  Its presence is too altered to allow the mercy of ignorance.",
    "difficulty": 0,
    "value": 0,
    "invisible_on_complete": true,
    "start": { "assign_mission_target": { "var": { "global_val": "portal_dungeon" } } }
  },
  {
    "id": "MISSION_INVESTIGATE_PORTAL_STORM_CENTER",
    "type": "mission_definition",
    "name": { "str": "Center of the storm" },
    "goal": "MGOAL_CONDITION",
    "description": "This is the center of the portal storm, you could find it upside down, dizzy and blindfolded.  Its presence is too altered to allow the mercy of ignorance.",
    "difficulty": 0,
    "value": 0,
    "invisible_on_complete": true,
    "start": { "assign_mission_target": { "var": { "global_val": "portal_storm_center" } } }
  },
  {
    "id": "MISSION_CAMP_LEADERSHIP_CHANGE",
    "type": "mission_definition",
    "name": { "str": "Faction succession" },
    "goal": "MGOAL_CONDITION",
    "description": "You have some time left until you can transfer control to your companions, provided you have <color_yellow>established a Basecamp</color> and <color_yellow>have at least 1 NPC companion</color>.",
    "difficulty": 0,
    "value": 0,
    "deadline": { "math": [ "time_between_succession" ] },
    "invisible_on_complete": true,
    "start": {
      "effect": [ { "math": [ "u_timer_time_of_last_succession = time('now')" ] }, { "run_eocs": "EOC_FACTION_SUCCESSION_CHECK" } ]
    }
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_FACTION_SUCCESSION_CHECK",
    "recurrence": [ "5 minutes", "20 minutes" ],
    "global": true,
    "condition": { "math": [ "time_since(u_timer_time_of_last_succession) > time_between_succession" ] },
    "effect": [ { "remove_active_mission": "MISSION_CAMP_LEADERSHIP_CHANGE" }, { "u_lose_var": "time_of_last_succession" } ],
    "deactivate_condition": { "not": { "compare_string": [ "yes", { "u_val": "time_of_last_succession" } ] } }
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_FACTION_SUCCESSION_CHANGE_REINIT",
    "eoc_type": "EVENT",
    "required_event": "game_avatar_new",
    "effect": [
      { "remove_active_mission": "MISSION_CAMP_LEADERSHIP_CHANGE" },
      {
        "assign_mission": "MISSION_CAMP_LEADERSHIP_CHANGE",
        "deadline": { "math": [ "time('now') + time_between_succession" ] }
      }
    ]
  },
  {
    "//": "DUMB HACK ALERT! We need to check during both game_start and game_begin, because game_start runs first. If we only listen during game_begin then EOC_FACTION_SUCCESSION_CHANGE_INIT finds the variable doesn't exist when it runs during game_start, substituting a value of 0 turns. Double assigning the same value is harmless, just stupid. It shouldn't be necessary to make two EOCs for this. Oh well, what can you do",
    "type": "effect_on_condition",
    "id": "EOC_FACTION_SUCCESSION_COOLDOWN_GAMEBEGIN_CHECK",
    "eoc_type": "EVENT",
    "required_event": "game_begin",
    "effect": [ { "run_eocs": "EOC_FACTION_SUCCESSION_COOLDOWN" } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_FACTION_SUCCESSION_COOLDOWN",
    "effect": [ { "math": [ "time_between_succession = time(' 3 d')" ] } ]
  },
  {
    "type": "effect_on_condition",
    "id": "EOC_FACTION_SUCCESSION_IMMEDIATE",
    "eoc_type": "EVENT",
    "required_event": "broken_bone",
    "//1": "Only run EOC if character is currently on succession cooldown!",
    "condition": {
      "and": [
        "u_is_avatar",
        { "math": [ "has_var(u_timer_time_of_last_succession)" ] },
        { "math": [ "time_since(u_timer_time_of_last_succession) < time_between_succession" ] },
        { "math": [ "u_hp('torso') != 0" ] },
        { "math": [ "u_hp('head') != 0" ] }
      ]
    },
    "//2": "Remove the mission tracking that you can't change char, push the timer back by [cooldown length] so changing is immediately available.",
    "effect": [
      { "remove_active_mission": "MISSION_CAMP_LEADERSHIP_CHANGE" },
      {
        "u_message": "You've been badly wounded.  It might be better to rest for a while and let someone else scavenge.  (Changing characters is now available at any camp board.)",
        "type": "mixed"
      },
      { "math": [ "u_timer_time_of_last_succession", "-=", "time_between_succession" ] }
    ]
  }
]
