[
  {
    "type": "npc",
    "id": "NPC_lighthouse_man",
    "gender": "male",
    "class": "NC_NONE",
    "name_unique": "Mikhail Frolov",
    "name_suffix": "Fisherman",
    "attitude": 0,
    "mission": 8,
    "chat": "TALK_lighthouse_man_1",
    "faction": "fisherman_family",
    "mission_offered": "MISSION_lighthouse_man_1"
  },
  {
    "type": "npc_class",
    "id": "NC_lighthouse_man",
    "common": false,
    "name": { "str": "Fisherman" },
    "job_description": "I'm just wandering.",
    "shopkeeper_item_group": "NPC_lighthouse_man_shop",
    "traits": [ { "group": "NPC_starting_traits" }, { "group": "Appearance_Caucasian" } ],
    "skills": [
      { "skill": "ALL", "level": { "mul": [ { "one_in": 3 }, { "sum": [ { "dice": [ 4, 2 ] }, { "rng": [ -4, -1 ] } ] } ] } }
    ]
  },
  {
    "type": "item_group",
    "id": "NPC_lighthouse_man_shop",
    "subtype": "collection",
    "items": [
      { "item": "fish_bait", "count": [ 15, 35 ] },
      { "item": "fish", "count": [ 5, 20 ] },
      { "item": "fish_smoked", "count": [ 1, 4 ] },
      { "item": "fish_cooked", "count": [ 4, 14 ] },
      { "item": "salted_fish", "count": [ 2, 6 ] },
      { "item": "fish_fried", "count": [ 2, 6 ] },
      { "item": "soup_fish", "count": [ 35, 50 ], "container-item": "bottle_plastic" },
      { "item": "fishspear", "prob": 20, "count": [ 4, 8 ] },
      [ "doublespeargun", 20 ],
      [ "fish_trap", 55 ],
      [ "fishing_hook_bone", 100 ],
      [ "fishing_rod_basic", 100 ]
    ]
  },
  {
    "type": "talk_topic",
    "id": [
      "TALK_lighthouse_man_1",
      "TALK_lighthouse_man_Background",
      "TALK_lighthouse_man_hay",
      "TALK_lighthouse_man_survivors_yes",
      "TALK_lighthouse_man_survivors_no"
    ],
    "dynamic_line": "<greet>",
    "responses": [
      { "text": "About that job…", "condition": "has_assigned_mission", "topic": "TALK_MISSION_INQUIRE" },
      { "text": "<BGSS_intro_question>", "topic": "TALK_lighthouse_man_Background" },
      {
        "text": "How are you doing?",
        "topic": "TALK_lighthouse_man_hay",
        "condition": { "npc_has_var": "helped_lighthouse_man", "type": "flag", "context": "help", "value": "yes" }
      },
      { "text": "Do you need any help?", "topic": "TALK_MISSION_LIST" },
      {
        "text": "Care to trade?",
        "topic": "TALK_lighthouse_man_1",
        "condition": { "npc_has_var": "helped_lighthouse_man", "type": "flag", "context": "help", "value": "yes" },
        "effect": "start_trade"
      },
      {
        "text": "Has anyone come recently?",
        "condition": { "u_has_var": "lighthouse_fixed", "type": "global", "context": "safe_space", "value": "yes" },
        "trial": {
          "type": "CONDITION",
          "condition": {
            "not": { "npc_compare_time_since_var": "wait", "type": "time", "context": "survivors", "op": "<", "time": "14 days" }
          }
        },
        "success": {
          "topic": "TALK_lighthouse_man_survivors_yes",
          "effect": [
            { "npc_add_var": "wait", "type": "time", "context": "survivors", "time": true },
            { "mapgen_update": "lighthouse_man_survivor", "om_terrain": "lighthouse_ground" }
          ]
        },
        "failure": { "topic": "TALK_lighthouse_man_survivors_no" }
      },
      { "text": "Goodbye.", "topic": "TALK_DONE" }
    ]
  },
  {
    "type": "talk_topic",
    "id": "TALK_lighthouse_man_Background",
    "dynamic_line": "I'm just a simple man from a simple family.  Before <the_cataclysm> I had a fishing boat, and I went to sea on it, to catch fish and other marine life.  This is how my grandfather lived, my father lived, and I began to live like that.  I had a large family, 7 children, but not many survived, only my wife and daughter remained…"
  },
  {
    "type": "talk_topic",
    "id": "TALK_lighthouse_man_hay",
    "dynamic_line": "You know, <very> good.  It is cozy here, there is a lot of space, and most importantly, it's safe.  We even started considering this place as our new home.  By the way, while I was fishing, a bottle with a piece of paper came to the shore of our island.  Here, take a look.\", he gave you a piece of paper, something was written on it: '0030045-0030045-35321700', with something similar to lightning scribbled nearby.  \"I wonder what it could mean…"
  },
  {
    "type": "talk_topic",
    "id": "TALK_lighthouse_man_survivors_yes",
    "dynamic_line": "Good news, <name_g>.  One survivor sailed to us recently."
  },
  {
    "type": "talk_topic",
    "id": "TALK_lighthouse_man_survivors_no",
    "dynamic_line": "Nobody came, <name_g>.  I'm beginning to doubt that anyone else has survived besides us…"
  },
  {
    "type": "talk_topic",
    "id": "TALK_lighthouse_man_lighthouse",
    "dynamic_line": "Are we there yet, <name_g>?",
    "responses": [
      { "text": "I want you to use this item.", "topic": "TALK_lighthouse_man_lighthouse", "effect": "npc_gets_item_to_use" },
      {
        "text": "We're here.",
        "topic": "TALK_MISSION_INQUIRE",
        "condition": "mission_complete",
        "effect": [ "stop_following", { "npc_first_topic": "TALK_lighthouse_man_1" } ]
      },
      { "text": "Almost.", "topic": "TALK_DONE" }
    ]
  },
  {
    "type": "talk_topic",
    "id": "TALK_lighthouse_man_cleaning",
    "dynamic_line": "Is it safe, my <name_g>?",
    "responses": [
      {
        "text": "Yes.  Ground floor is clear.",
        "topic": "TALK_lighthouse_man_cleaned",
        "condition": {
          "and": [
            { "npc_has_var": "lighthouse_man", "type": "count", "context": "cleaning", "value": "0" },
            "at_safe_space",
            { "npc_at_om_location": "lighthouse_ground" }
          ]
        },
        "effect": { "npc_adjust_var": "lighthouse_man", "type": "count", "context": "cleaning", "adjustment": 1 }
      },
      {
        "text": "Yes.  First floor is clear.",
        "topic": "TALK_lighthouse_man_cleaned",
        "condition": {
          "and": [
            { "npc_has_var": "lighthouse_man", "type": "count", "context": "cleaning", "value": "1" },
            "at_safe_space",
            { "npc_at_om_location": "lighthouse_z1" }
          ]
        },
        "effect": { "npc_adjust_var": "lighthouse_man", "type": "count", "context": "cleaning", "adjustment": 1 }
      },
      {
        "text": "Yes.  Second floor is clear.",
        "topic": "TALK_lighthouse_man_cleaned",
        "condition": {
          "and": [
            { "npc_has_var": "lighthouse_man", "type": "count", "context": "cleaning", "value": "2" },
            "at_safe_space",
            { "npc_at_om_location": "lighthouse_z2" }
          ]
        },
        "effect": { "npc_adjust_var": "lighthouse_man", "type": "count", "context": "cleaning", "adjustment": 1 }
      },
      {
        "text": "Yes.  Third floor is clear.",
        "topic": "TALK_lighthouse_man_cleaned",
        "condition": {
          "and": [
            { "npc_has_var": "lighthouse_man", "type": "count", "context": "cleaning", "value": "3" },
            "at_safe_space",
            { "npc_at_om_location": "lighthouse_z3" }
          ]
        },
        "effect": { "npc_adjust_var": "lighthouse_man", "type": "count", "context": "cleaning", "adjustment": 1 }
      },
      {
        "text": "Yes.  Fourth floor is clear.",
        "topic": "TALK_lighthouse_man_cleaned",
        "condition": {
          "and": [
            { "npc_has_var": "lighthouse_man", "type": "count", "context": "cleaning", "value": "4" },
            "at_safe_space",
            { "npc_at_om_location": "lighthouse_z4" }
          ]
        },
        "effect": { "npc_adjust_var": "lighthouse_man", "type": "count", "context": "cleaning", "adjustment": 1 }
      },
      {
        "text": "Yes.  Top floor is clear.",
        "condition": {
          "and": [
            { "npc_has_var": "lighthouse_man", "type": "count", "context": "cleaning", "value": "5" },
            "at_safe_space",
            { "npc_at_om_location": "lighthouse_z5" }
          ]
        },
        "effect": { "npc_adjust_var": "lighthouse_man", "type": "count", "context": "cleaning", "adjustment": 1 },
        "topic": "TALK_lighthouse_man_cleaned_done"
      },
      {
        "text": "Looks like that's over.",
        "condition": {
          "and": [
            { "npc_has_var": "lighthouse_man", "type": "count", "context": "cleaning", "value": "6" },
            "at_safe_space",
            { "npc_at_om_location": "lighthouse_ground" }
          ]
        },
        "effect": { "npc_adjust_var": "lighthouse_man", "type": "count", "context": "cleaning", "adjustment": 1 },
        "topic": "TALK_MISSION_INQUIRE"
      },
      { "text": "Not yet.", "topic": "TALK_DONE" }
    ]
  },
  {
    "type": "talk_topic",
    "id": "TALK_lighthouse_man_cleaned",
    "dynamic_line": "<its_safe>  Let's clean the next floor.",
    "responses": [ { "text": "…", "topic": "TALK_DONE" } ]
  },
  {
    "type": "talk_topic",
    "id": "TALK_lighthouse_man_cleaned_done",
    "dynamic_line": "<its_safe>  Let's return to the first floor.",
    "responses": [ { "text": "…", "topic": "TALK_DONE" } ]
  },
  {
    "type": "talk_topic",
    "id": "TALK_lighthouse_man_family",
    "dynamic_line": "Did you find them, <name_g>?",
    "responses": [
      {
        "text": "We did it.  All safe.",
        "topic": "TALK_MISSION_SUCCESS",
        "condition": {
          "and": [
            { "u_has_mission": "MISSION_lighthouse_man_3" },
            { "not": "mission_complete" },
            { "u_has_var": "lighthouse_woman", "type": "flag", "context": "safe", "value": "yes" },
            { "u_has_var": "lighthouse_girl", "type": "flag", "context": "safe", "value": "yes" }
          ]
        },
        "effect": [ "mission_success", { "npc_first_topic": "TALK_lighthouse_man_1" } ]
      },
      {
        "text": "I'm sorry, I failed you… I couldn't bring them alive…",
        "topic": "TALK_lighthouse_man_fail",
        "condition": {
          "and": [
            "mission_complete",
            { "not": { "u_has_var": "lighthouse_woman", "type": "flag", "context": "safe", "value": "yes" } },
            { "u_has_var": "lighthouse_girl_dead", "type": "flag", "context": "death", "value": "yes" }
          ]
        }
      },
      {
        "text": "I'm sorry, I failed you… I couldn't bring your wife alive…",
        "topic": "TALK_lighthouse_man_fail",
        "condition": { "and": [ "mission_complete", { "u_has_var": "lighthouse_girl", "type": "flag", "context": "safe", "value": "yes" } ] }
      },
      {
        "text": "I'm sorry, I failed you… I couldn't bring your daughter alive…",
        "topic": "TALK_lighthouse_man_fail",
        "condition": {
          "and": [
            { "not": "mission_complete" },
            { "u_has_var": "lighthouse_woman", "type": "flag", "context": "safe", "value": "yes" },
            { "u_has_var": "lighthouse_girl_dead", "type": "flag", "context": "death", "value": "yes" }
          ]
        }
      },
      { "text": "Nothing, really.", "topic": "TALK_DONE" }
    ]
  },
  {
    "type": "talk_topic",
    "id": "TALK_lighthouse_man_fail",
    "dynamic_line": "<name_g>… I entrusted you with the most valuable thing that I have left, and you…",
    "responses": [
      { "text": "I'm sorry…", "topic": "TALK_DONE", "effect": [ "mission_failure", "clear_mission", "end_conversation" ] }
    ]
  },
  {
    "id": "MISSION_lighthouse_man_1",
    "type": "mission_definition",
    "has_generic_rewards": false,
    "name": { "str": "Lighthouse" },
    "description": "Lead Mikhail to lighthouse.",
    "goal": "MGOAL_GO_TO",
    "difficulty": 0,
    "value": 5000,
    "start": {
      "assign_mission_target": {
        "om_terrain": "lighthouse_ground",
        "om_special": "Lighthouse Island",
        "reveal_radius": 10,
        "search_range": 360,
        "cant_see": true
      },
      "update_mapgen": [
        {
          "om_terrain": "lighthouse_ground",
          "place_monsters": [ { "monster": "GROUP_ZOMBIE", "x": [ 1, 22 ], "y": [ 1, 22 ], "density": 0.3 } ]
        },
        {
          "om_terrain": "lighthouse_z1",
          "place_monsters": [ { "monster": "GROUP_ZOMBIE", "x": [ 11, 16 ], "y": [ 8, 16 ], "density": 0.3 } ]
        },
        {
          "om_terrain": "lighthouse_z2",
          "place_monsters": [ { "monster": "GROUP_ZOMBIE", "x": [ 11, 16 ], "y": [ 8, 16 ], "density": 0.3 } ]
        },
        {
          "om_terrain": "lighthouse_z3",
          "place_monsters": [ { "monster": "GROUP_ZOMBIE", "x": [ 11, 16 ], "y": [ 8, 16 ], "density": 0.3 } ]
        },
        {
          "om_terrain": "lighthouse_z4",
          "place_monsters": [ { "monster": "GROUP_ZOMBIE", "x": [ 11, 16 ], "y": [ 8, 16 ], "density": 0.3 } ]
        },
        {
          "om_terrain": "lighthouse_z5",
          "place_monsters": [ { "monster": "GROUP_ZOMBIE", "x": [ 11, 16 ], "y": [ 8, 16 ], "density": 0.3 } ]
        }
      ],
      "effect": [ "follow_only", { "npc_first_topic": "TALK_lighthouse_man_lighthouse" } ]
    },
    "end": { "opinion": { "trust": 3, "value": 3 } },
    "origins": [ "ORIGIN_SECONDARY" ],
    "followup": "MISSION_lighthouse_man_2",
    "dialogue": {
      "describe": "-",
      "offer": "We've been wandering around the state with my family for a long time since <the_cataclysm>, and I realized that the safest hideout is the island.  I left my family in a shelter, and went to explore the area, looking for some island nearby, in a lake or in the ocean.  And you know, I found a sea map marked with navigational beacons near here.  If you want, you can help me get to one of these and take a good look at it.",
      "accepted": "Good.  I'll be right behind you.",
      "rejected": "Well, it's your choice.",
      "advice": "First we need to find a transport to get there.",
      "inquire": "We finally reached it.",
      "success": "Looks nice, <name_g>.  Now I need to clean it from <zombies> somehow…",
      "success_lie": "-",
      "failure": "-"
    }
  },
  {
    "id": "MISSION_lighthouse_man_2",
    "type": "mission_definition",
    "has_generic_rewards": false,
    "name": { "str": "House cleaning" },
    "description": "Clean lighthouse from <zombies> with Mikhail.",
    "goal": "MGOAL_CONDITION",
    "goal_condition": { "npc_has_var": "lighthouse_man", "type": "count", "context": "cleaning", "value": "7" },
    "difficulty": 0,
    "value": 5000,
    "start": {
      "effect": [
        "follow_only",
        { "npc_first_topic": "TALK_lighthouse_man_cleaning" },
        { "npc_add_var": "lighthouse_man", "type": "count", "context": "cleaning", "value": "0" }
      ]
    },
    "end": {
      "opinion": { "trust": 3, "value": 3 },
      "update_mapgen": {
        "om_terrain": "lighthouse_ground",
        "faction_owner": [ { "id": "fisherman_family", "x": [ 0, 23 ], "y": [ 0, 23 ] } ],
        "place_zones": [ { "type": "NPC_INVESTIGATE_ONLY", "faction": "fisherman_family", "x": [ 0, 23 ], "y": [ 0, 23 ] } ]
      },
      "effect": [
        "stop_following",
        { "npc_first_topic": "TALK_lighthouse_man_1" },
        { "npc_lose_var": "lighthouse_man", "type": "count", "context": "cleaning" }
      ]
    },
    "origins": [ "ORIGIN_SECONDARY" ],
    "followup": "MISSION_lighthouse_man_3",
    "dialogue": {
      "describe": "-",
      "offer": "So, we found the lighthouse.  Now, I need to clean it.  Want to help me with it?",
      "accepted": "Great.  Let's do it together.  I'll be right behind you.  We will clean floor by floor.  If you decide that the floor is clean, tell me about it, and we will move on to the next, and so on to the very top.",
      "rejected": "Well, it's your choice.",
      "advice": "Be <very> careful.  These <name_b>s are most dangerous in tight spaces.",
      "inquire": "<its_safe>",
      "success": "Great, <very> great.  All that remains is to wash all the floors…",
      "success_lie": "-",
      "failure": "-"
    }
  },
  {
    "id": "MISSION_lighthouse_man_3",
    "type": "mission_definition",
    "name": { "str": "Fisherman's family" },
    "description": "Mikhail asked you to bring back his family.",
    "goal": "MGOAL_ASSASSINATE",
    "difficulty": 0,
    "value": 25000,
    "start": {
      "effect": { "npc_first_topic": "TALK_lighthouse_man_family" },
      "assign_mission_target": { "om_terrain": "house_04_basement", "reveal_radius": 2 },
      "update_mapgen": {
        "place_npcs": [
          { "class": "NPC_lighthouse_woman", "x": 4, "y": 8, "target": true },
          { "class": "NPC_lighthouse_girl", "x": 3, "y": 8 }
        ]
      }
    },
    "end": {
      "opinion": { "trust": 6, "value": 6 },
      "effect": { "u_add_var": "lighthouse_family_safe", "type": "flag", "context": "help", "value": "yes" }
    },
    "origins": [ "ORIGIN_SECONDARY" ],
    "followup": "MISSION_lighthouse_man_4",
    "dialogue": {
      "describe": "-",
      "offer": "We found the lighthouse and cleared it of <zombies>.  Now, I need to bring my family here.  May I ask you for a favor?  Since you bring me here, can you go back, find my family and bring them here?",
      "accepted": "You are my savior!  I'll take a look around here for a while, prepare everything here for their arrival.",
      "rejected": "Well, it's your choice.",
      "advice": "Please be very careful.  I don't want to lose them…",
      "inquire": "-",
      "success": "I don't even know how to thank you, <name_g>.  I am in eternal debt to you.",
      "success_lie": "-",
      "failure": "-"
    }
  },
  {
    "id": "MISSION_lighthouse_man_4",
    "type": "mission_definition",
    "name": { "str": "Fisherman's boat" },
    "description": "Help Mikhail make a boat.  Bring 250 nails.",
    "goal": "MGOAL_FIND_ITEM",
    "item": "nail",
    "count": 250,
    "difficulty": 0,
    "value": 10000,
    "end": {
      "opinion": { "trust": 3, "value": 3 },
      "update_mapgen": {
        "om_terrain": "lighthouse_ground",
        "place_vehicles": [ { "vehicle": "canoe", "x": 3, "y": 3, "rotation": 0, "status": 0, "chance": 100 } ]
      },
      "effect": [ { "npc_add_var": "helped_lighthouse_man", "type": "flag", "context": "help", "value": "yes" } ]
    },
    "origins": [ "ORIGIN_SECONDARY" ],
    "followup": "MISSION_lighthouse_man_5",
    "dialogue": {
      "describe": "-",
      "offer": "The building has been cleared of <zombies>, my family is here, everything is going very well.  It remains only to provide ourselves with food, transport and we can not worry about the future.  You helped me and my family so much, can you help us with something else?  I need a boat for fishing, or just to explore the area.  Can you help me make a boat?",
      "accepted": "Thank you, <name_g>.  I need only 250 nails.  I'll find the planks, the rest of the tools too, but the main problem is the nails.  Too much for one boat, but I want to have resources in reserve, just in case.",
      "rejected": "Well, it's your choice.",
      "advice": "Please, if you can, don't disassemble furniture here.  It can still be useful.",
      "inquire": "Did you find it?",
      "success": "<very> good, <name_g>, thank you!  Now we are not afraid of hunger, rain, or other bad weather, he-he.  By the way, I have a small supply of fish, tackle, baits and rods.  If you are interested, I can share some with you.",
      "success_lie": "-",
      "failure": "-"
    }
  },
  {
    "id": "MISSION_lighthouse_man_5",
    "type": "mission_definition",
    "name": { "str": "Fixing lighthouse" },
    "description": "Mikhail asked you to find someone, who have enough expertise to fix the mechanism of lighthouse.",
    "goal": "MGOAL_CONDITION",
    "goal_condition": { "u_has_var": "lighthouse_fixed", "type": "global", "context": "safe_space", "value": "ready" },
    "difficulty": 0,
    "value": 100000,
    "end": {
      "opinion": { "trust": 3, "value": 3 },
      "update_mapgen": {
        "om_terrain": "lighthouse_z5",
        "place_terrain": [ { "ter": "t_floor_olight", "x": 11, "y": 12 }, { "ter": "t_floor_olight", "x": 13, "y": 13 } ]
      },
      "effect": [
        { "npc_add_var": "wait", "type": "time", "context": "survivors", "time": true },
        { "u_add_var": "lighthouse_fixed", "type": "global", "context": "safe_space", "value": "yes" }
      ]
    },
    "origins": [ "ORIGIN_SECONDARY" ],
    "dialogue": {
      "describe": "-",
      "offer": "My family is here, we have food, water, boat and a roof over our heads, all thanks to you, <name_g>.  Now, I also want to help other survivors.  Here's what I thought: if I can get this old lighthouse up and running, other survivors will see its light from afar.  If they see it, they will think that there are living people here, and will try to get here.  Can you help me fix it?",
      "accepted": "I knew you wouldn't refuse!  But there is one problem: I have no idea how to fix it.  Maybe if you met someone who have experience in electrical engineering, we can figure out how to start this old junk.",
      "rejected": "Well, it's your choice.",
      "advice": "I'm sure that not all burned in flames of <the_cataclysm> and you can find someone suitable.",
      "inquire": "Well, have you fixed it?",
      "success": "Splendid, <name_g>!  We can only wait now…",
      "success_lie": "-",
      "failure": "-"
    }
  },
  {
    "type": "mapgen",
    "update_mapgen_id": "lighthouse_man_survivor",
    "method": "json",
    "object": { "place_npcs": [ { "class": "NPC_survivor_lighthouse", "x": [ 7, 17 ], "y": [ 10, 15 ] } ] }
  }
]
