# Copyright (c) 2014 by Michael Zahniser
#
# Endless Sky is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later version.
#
# Endless Sky is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <https://www.gnu.org/licenses/>.

mission "FW Diplomacy 1"
	landing
	name "Free Worlds Diplomacy"
	description "Travel to <planet> to meet up with Alondo, who will explain more."
	source
		near "Sabik" 1 100
	destination "Longjump"
	to offer
		has "event: navy occupying the south"
	on fail
		dialog `You have failed an essential Free Worlds mission. If you want to complete the story line, revert to the autosave or another earlier snapshot of the game.`
	
	on offer
		event "joined the free worlds"
		event "fw abandoned Greenrock" 60
		event "Greenrock recovered" 420
		conversation
			`As you are landing, you receive a message from JJ, on behalf of the Council. The message reads:`
			branch suspended
				or
					has "FW Pirates 4.1: offered"
					has "event: fw stripped of service"
			`	Captain <last>, sorry that we have been out of contact. We need your help once again, to assist in a diplomatic mission. Please meet up with Alondo on <planet> as soon as possible. He will give you more information.`
				goto end
			
			label suspended
			`	Captain <last>. Your suspension from the Free Worlds has just ended. The Senate is still not happy with what you did, and has therefore not reinstated your pay, but they have allowed you to continue working for us. Don't cause any more issues and you'll regain your pay. Please meet up with Alondo on <planet> as soon as possible. He will give you more information.`
			label end
			`			Sincerely,`
			`				Jean-Jacques and Freya`
				accept
		event "catalytic ramscoop available"
	
	on complete
		dialog `As you are landing, Alondo contacts you and asks you to meet him in the spaceport as soon as you have a bunk prepared for him.`



mission "FW Diplomacy 1B"
	name "Free Worlds Diplomacy"
	description "Bring Alondo to <planet> to meet with Parliament. Your guarantee of safe passage will expire on <day>."
	autosave
	source "Longjump"
	destination "Earth"
	deadline 24
	to offer
		has "FW Diplomacy 1: done"
	passengers 1
	blocked "You do not have a bunk free for Alondo. Return here when you do."
	on fail
		dialog `You have failed an essential Free Worlds mission. If you want to complete the story line, revert to the autosave or another earlier snapshot of the game.`
	
	on offer
		conversation
			`You meet up with Alondo, who insists on not telling you anything until you are safely back aboard your own ship. Once you have brought him to his room, he says, "Here's the deal. The Senate has been secretly reaching out to other worlds, and four of them have decided to join us: Harmony, New Portland, Dancer, and New India."`
			choice
				`	"That's great news!"`
				`	"Why haven't I heard of this yet?"`
					goto heard
			`	"Indeed it is," says Alondo. "Any worlds joining us would be reason to celebrate, but these four are particularly important because they are on the trade route to Tarazed. If we control those systems, our supply convoys will be much safer."`
			`	"Why isn't this public knowledge yet?" you ask.`
			label heard
			`	"Well," says Alondo, "apparently the Senate was not being as secretive as they thought. Somehow word leaked out to the Republic that those worlds were defecting, and a massive Navy fleet moved to occupy those systems. Which means we're on the brink of another bloody battle."`
			choice
				`	"Don't worry, I'm sure we can defeat them."`
					goto defeat
				`	"Is there any way to avoid a fight?"`
					goto avoid
			label defeat
			`	"I'm sure we can," says Alondo, "but with heavy loss of life on both sides. We want to avoid that if at all possible. That's where you come in."`
				goto plan
			label avoid
			`	"That's what we're hoping," he says, "and that's where you come in."`
				goto plan
			label plan
			`	"How so?" you ask.`
			`	He says, "We've arranged for you to be granted safe passage through Republic space for the next three weeks. That's enough time to bring me to Earth and back. If I can meet with Parliament in person, maybe I will be able to work something out."`
			choice
				`	"Okay, let's go to Earth!"`
					accept
				`	"How do we know this isn't a trap? You're willing to risk your life for this?"`
			`	"If we can save thousands of lives from being lost in a needless battle, it's worth the risk," he says. "Now come on, the clock is ticking. We need to be safely back in Free space before your safe passage expires."`
				accept
	
	on accept
		event "fw safe passage starts"
		event "fw safe passage ends" 24
	on visit
		dialog `You land on <planet>, but realize that your escort carrying Alondo hasn't entered the system yet. Better depart and wait for it to arrive.`



mission "FW Diplomacy 1C"
	landing
	name "Free Worlds Diplomacy"
	description "Bring Alondo to <planet> to meet with the senior Navy officers. Take as direct a route as possible, because your safe passage expires soon."
	source "Earth"
	destination "New Wales"
	clearance
	to offer
		has "FW Diplomacy 1B: done"
	passengers 1
	on fail
		dialog `You have failed an essential Free Worlds mission. If you want to complete the story line, revert to the autosave or another earlier snapshot of the game.`
	
	on offer
		log "Stopped on Earth with Alondo to talk to Parliament and try to head off another bloody battle. But, they were not willing to negotiate."
		conversation
			`You drop off Alondo and wish him luck. Hours pass, and you begin to worry that he has been taken prisoner or killed. But finally he returns, looking very discouraged. "It makes no sense," he says. "The tax revenue they get from those four worlds doesn't come close to covering the cost of defending them. They should be glad to let them go."`
			choice
				`	"So, Parliament won't give up those worlds without a fight?"`
					goto fight
				`	"Maybe they're afraid of the precedent it would set if they give in to us."`
					goto precedent
			label fight
			`	"That's right," he says. "Amazing how heedless they can be, sitting in their comfy Parliament house deciding the fates of others."`
				goto next
			label precedent
			`	"Yes, that seems to be what's at stake," he says. "But by now they should see the writing on the wall. Amazing how callous they can be about the lives of the Navy crews who are following their orders."`
			label next
			`	"So, we just head home in defeat?" you ask.`
			`	"Not quite," he says. "While we have the chance, I want to talk with the Navy leadership directly. Landing near the secret base on New Austria would be way too provocative, so I've arranged to meet with them on their base on <planet> instead."`
			choice
				`	"Okay, if that's what it takes to avoid another bloody battle, I'll take you there."`
					accept
				`	"Are you insane? Flying straight into the largest Navy base in the sector?"`
			`	"Don't worry," he says. "The Navy takes honor very seriously. If they promise our safety, we'll be safe. At least until that grant of safe passage expires, that is." You have serious doubts, but you have no choice but to obey him.`
				accept
	on visit
		dialog `You land on <planet>, but realize that your escort carrying Alondo hasn't entered the system yet. Better depart and wait for it to arrive.`



mission "FW Diplomacy 1D"
	landing
	name "Free Worlds Diplomacy"
	description "Bring Alondo back to <destination>. Take as direct a route as possible, because your safe passage expires soon."
	source "New Wales"
	destination Longjump
	to offer
		has "FW Diplomacy 1C: done"
	passengers 1
	on fail
		dialog `You have failed an essential Free Worlds mission. If you want to complete the story line, revert to the autosave or another earlier snapshot of the game.`
	
	on offer
		conversation
			`When you land on <origin>, Alondo says, "You should join me for this meeting. You may find it eye-opening."`
			`	Four of the Navy admirals who are stationed here have agreed to meet with you. You discover that one of them is from the Dirt Belt. Another grew up in the Rim, and admits to you that if he were not serving the Navy, he would be fighting for the Free Worlds. All four of them seem sympathetic to your cause, and express genuine regret not just for the Navy lives that have been lost, but for the Free Worlds losses as well.`
			`	And all four of them state, without any hesitation or equivocation, that if Parliament orders them to continue to fight the Free Worlds, they will fight until all possibility of victory is gone.`
			`	Alondo thanks them for their time and their honesty, and you return to your ship. "Well, it was worth a try. Now we just have to get home safely," he says.`
				accept
	
	on visit
		dialog `You land on <planet>, but realize that your escort carrying Alondo hasn't entered the system yet. Better depart and wait for it to arrive.`
	on complete
		dialog `You are still finding it hard to believe that you made it to Earth and back in one piece. Alondo thanks you for transporting him and says, "Now I just have to break the bad news to the Senate. JJ and I will meet you in the spaceport bar in a few hours, once we've decided what our next steps will be."`
		event "navy using mark ii ships"



mission "FW Southern Recon 1"
	name "Reconnaissance"
	description "Fly through <waypoints> to get a sense of the Navy's strength in those systems, then report to <destination>."
	autosave
	source "Longjump"
	waypoint "Rastaban"
	waypoint "Delta Sagittarii"
	waypoint "Albaldah"
	destination "Trinket"
	to offer
		has "FW Diplomacy 1D: done"
	on fail
		dialog `You have failed an essential Free Worlds mission. If you want to complete the story line, revert to the autosave or another earlier snapshot of the game.`
	
	on offer
		event "fw safe passage ends"
		conversation
			`Alondo and JJ are in a somber mood when you meet up with them in the bar. You can't help remembering that Tomek always used to be a part of these gatherings, before he turned against the Senate. And now it looks like your next major battle will be fought without Tomek's expert guidance.`
			`	JJ says, "We've done all we can. Sooner or later we will have to fight the Navy for those star systems. So to start with, <first>, we'd like you to scout them out and report back to us on the Navy's presence there. Freya is on Trinket, gathering a fleet. Report to her there when you're done."`
				accept
	on visit
		dialog phrase "generic waypoint on visit"



mission "FW Southern Recon 1B"
	landing
	name "Electron Beam"
	description "Steal an Electron Beam from a Navy Gunboat and return it to <planet> for Freya to look at. She thought your best bet for finding lone Gunboats might be the Wei or Alnasl systems."
	autosave
	source "Trinket"
	destination "Trinket"
	to offer
		has "FW Southern Recon 1: done"
	
	on offer
		log "It looks like the Navy has begun using some more powerful beam weapons and torpedoes. Tasked with plundering one of the electron beam weapons so Freya can get a closer look at it."
		event "gunboats in Alnasl"
		conversation
			`Freya thanks you for performing the scouting mission, and you give her a copy of your ship's logs to analyze. As she looks through them, almost immediately something catches her eye. "Looks like the Navy is fielding some new weapons," she says. "Some higher-yield torpedoes, and a beam weapon even more powerful than Heavy Lasers. Those beam weapons in particular worry me."`
			choice
				`	"Yes, that kind of negates the advantage I was hoping we'd have due to our new plasma turrets."`
				`	"Does that mean we're not going to attack them after all?"`
					goto attack
			`	"Well," she says, "the Plasma Turrets weren't the only ace up our sleeve, but still, it's frustrating that the Navy still has such an advantage over us technologically."`
			`	"What should we do?" you ask.`
			label attack
			`	"We're going to have to fight them eventually, but first we need as much information as we can get on their new weapon systems. I'd like you to find one of their Gunboats that has the new electron beams installed, steal one of them, and bring it back here. I imagine one of them can't be much bigger than twenty or thirty tons, so you ought to be able to find space for it. Think you can do that?"`
			choice
				`	"How can I find a Gunboat that's all by itself? They're usually a part of a bigger fleet."`
			`	She thinks about that for a moment, then says, "The Navy has shifted most of their capital ships to the defecting systems in the south. That means that some of the systems up north will have lighter defenses. You might try Wei or Alnasl. Good luck, Captain."`
				accept
	npc
		government "Republic"
		system "Alnasl"
		personality heroic opportunistic staying
		fleet
			names "republic small"
			variant
				"Gunboat (Mark II)"
	to complete
		not "FW Southern Recon 1B (Turret): done"
	to fail
		has "FW Southern Recon 1B (Turret): done"
	on visit
		dialog `You've returned to <planet>, but you don't have an Electron Beam. Try finding lone Navy ships in Wei or Alnasl to disable and plunder from.`
	on complete
		fail "FW Southern Recon 1B (Turret)"
		outfit "Electron Beam" -1
		dialog `You hand off the Electron Beam to Freya's science team. They tell you that she's waiting for you in a cafe in the spaceport.`



mission "FW Southern Recon 1B (Turret)"
	landing
	invisible
	source Trinket
	destination Trinket
	to offer
		has "FW Southern Recon 1: done"
	to complete
		not "FW Southern Recon 1B: done"
	to fail
		has "FW Southern Recon 1B: done"
	on complete
		fail "FW Southern Recon 1B"
		outfit "Electron Turret" -1
		dialog `You hand off the Electron Turret to Freya's science team. They tell you that she's waiting for you in a cafe in the spaceport.`



mission "FW Southern Recon 1B: Alnasl Hint 1"
	landing
	source
		government "Free Worlds"
		near "Wei" 2
	to offer
		has "FW Southern Recon 1B: active"
	on offer
		conversation
			`While refueling on <planet>, a Free Worlds captain approaches you. "Captain <last>, I hear you're on the search for one of those new lasers the Navy is using."`
			choice
				`	"Yes I am."`
				`	"Do you have any information on them?"`
					goto information
			`	"Good, because we have some information that could help you.`
			label information
			`	"We've had to stop all scouting parties into Republic space because of the strength of these new weapons, so we're flying in the dark on where the Navy is, but luckily we have received word from sympathizers in the Dirt Belt. The Navy has gathered forces with these new weapons in Alioth and Seginus, frequently entering the Wei system.`
			`	"They haven't been coming into Kornephoros, so they're likely just patrolling the area to dissuade us from making any sudden moves. This means that Wei likely isn't your best bet for stealing a weapon given the traffic, but I hear that things aren't much better beyond Lesath. I wish we had some ships to spare to help you, but we just don't have that kind of freedom right now."`
			`	You thank the Captain for the information and he wishes you good luck.`
				decline



mission "FW Southern Recon 1B: Alnasl Hint 2"
	landing
	source "Hope"
	to offer
		has "FW Southern Recon 1B: active"
	on offer
		conversation
			`You decide to scan the Navy ships entering and exiting the system by tapping into the surveillance rigs that you helped Freya set up so long ago. Many of the Navy ships are armed with these new Electron Beams, but they are appearing in fleets too big to take on alone. You notice though that almost all Navy traffic is to and from Alioth and Seginus, while only lone Gunboats are traveling to and from Alnasl. Perhaps you may be able to ambush one of these smaller ships on its own in Alnasl.`
				decline



mission "FW Southern Battle 1"
	name "Escort Battle Fleet"
	description "Travel to <planet> to gather a fleet of experimental new warships, and escort them back to Trinket."
	source Trinket
	destination Zug
	to offer
		or
			has "FW Southern Recon 1B: done"
			has "FW Southern Recon 1B (Turret): done"
	on fail
		dialog `You have failed an essential Free Worlds mission. If you want to complete the story line, revert to the autosave or another earlier snapshot of the game.`
	
	on offer
		event "normal in Alnasl"
		conversation
			`Because this world is a tourist destination, there are innumerable fancy cafes in the spaceport. You meet up with Freya in one of the smaller ones. "Thank you for acquiring that weapon sample for us," she says. "It's typical Republic weaponry: far more efficient than anything we're able to make, and very well designed. My engineers were kind of in awe as they disassembled it."`
			choice
				`	"Do you have any tactical advice on fighting ships with one of those installed?"`
					goto advice
				`	"Is there any chance we can reverse engineer it and build our own?"`
					goto reverse
			label advice
			`	"Well," she says, "its range is very slightly shorter than our Plasma Turrets. You might be able to use that to your advantage if you can position your ship just right so that you can hit an enemy target but they can't hit you. You may find that useful in the upcoming battle."`
				goto battle
			label reverse
			`	"Maybe, although we haven't even mastered the art of building Heavy Lasers yet," she says. "We certainly won't have time before the upcoming battle."`
				goto battle
			label battle
			`	"So we're definitely going to attack the Navy?" you ask.`
			`	"We have no choice," she says. "We tried diplomacy. If we don't show a willingness to support new worlds that want to join us, or if we don't seem to have enough strength to defend them, some of those that have joined us already may start to return to the Republic."`
			choice
				`	"Okay, I'm ready to fight."`
				`	"I wish it hadn't come to this, but if you think it's our only option, I'll join the fight."`
			`	"Thank you," she says. "But there's one more thing we must do to prepare for battle. I mentioned before that we have an ace up our sleeve. It's a new warship designed by Southbound Shipyards, intended to be a match for a Cruiser. They've only finished building three of them. I'd like you to travel to Zug and escort them back here. Once you return, we'll prepare for battle."`
				accept



mission "FW Southern Battle 1B"
	landing
	name "Escort Battle Fleet"
	description "Escort a fleet of experimental warships to <destination>."
	autosave
	source Zug
	destination Trinket
	to offer
		has "FW Southern Battle 1: done"
	on fail
		dialog `You have failed an essential Free Worlds mission. If you want to complete the story line, revert to the autosave or another earlier snapshot of the game.`
	
	on offer
		event "flamethrower available" 10
		conversation
			`When you land on <origin>, a Southbound Shipyards executive leads you to a hangar. The hangar is huge, but it clearly was not meant to hold a ship as large as the one it now contains. There is barely enough space for the cranes and catwalks being used by the construction crews.`
			`	"The Dreadnought is a new design, the largest ship we've ever built. Only three of them have been completed so far." The size of the Dreadnought is impressive: as bulky as a Cruiser, it looks like a cross between a Bastion and an Argosy freighter. After giving you a moment to take in the view, he leads you out to a section of the spaceport where three Dreadnoughts are parked. Next to them, and looking tiny by comparison, are five Furies. You ask, "Are those Furies part of the battle fleet, too?"`
			branch untested
				not "FW Flamethrower 2: done"
			`	"Yes," he says, "equipped with some fancy new weapons from Barmy Edward up at Kraz Cybernetics that he said you helped test. I haven't seen them in action yet, but he's convinced they'll be useful against the Navy."`
				goto end
			label untested
			`	"Yes," he says, "equipped with some fancy new weapons from Barmy Edward up at Kraz Cybernetics that he recently finished working on. He said they should be entering mass production soon. Flamethrowers, the crazy bastard. I haven't seen them in action yet, but he's convinced they'll be useful against the Navy."`
			label end
			`	You thank him for his time, and meet up with the captains of the battle fleet, arranging for them to follow you back to Trinket.`
				accept
	
	npc accompany save
		government "Free Worlds"
		personality timid escort
		ship "Dreadnought" "F.S. Sequoia"
		ship "Dreadnought" "F.S. Sitka"
		ship "Dreadnought" "F.S. Rosewood"
		ship "Fury (Flamethrower)" "F.S. Montag"
		ship "Fury (Flamethrower)" "F.S. Faber"
		ship "Fury (Flamethrower)" "F.S. Beatty"
		ship "Fury (Flamethrower)" "F.S. Mildred"
		ship "Fury (Flamethrower)" "F.S. Clarisse"
	
	on visit
		dialog "You have reached <planet>, but you left part of your convoy behind! Better depart and wait for them to arrive in this star system."
	
	on complete
		dialog `You land on <planet> with the battle fleet. Time to meet up with Freya in the spaceport.`



event "battle for Rastaban"
	"reputation: Republic" = -1000
	system Rastaban
		fleet "Small Free Worlds" 10000
	system Lesath
		fleet "Small Southern Merchants" 800
		fleet "Large Southern Merchants" 1600
		fleet "Small Free Worlds" 800
		fleet "Large Free Worlds" 1100
	system Sargas
		fleet "Small Southern Merchants" 600
		fleet "Large Southern Merchants" 2500
		fleet "Small Free Worlds" 1000
		fleet "Large Free Worlds" 1500

mission "FW Southern Battle 2"
	name "Attack Rastaban"
	description "Travel directly to the <system> system, so that you will arrive on <day> and join the battle against the Navy. Disable or destroy all Navy ships in the system."
	source Trinket
	destination Dancer
	clearance
	to offer
		has "FW Southern Battle 1B: done"
	deadline 3
	on fail
		dialog `You have failed an essential Free Worlds mission. If you want to complete the story line, revert to the autosave or another earlier snapshot of the game.`
	
	on offer
		log "Preparing for another major battle with the Navy, this time in the Rastaban system, which just recently expressed an interest in joining the Free Worlds but has not been able to do so due to the Navy presence. The Free Worlds will be using a new model of warship, the Dreadnought, in this battle."
		event "battle for Rastaban"
		conversation
			`When you meet up with Freya in the cafe, she looks like she hasn't slept in several days. "I can't believe we're headed for another major battle," she says. "I keep hoping the Navy will just pull back and not force us to fight them."`
			choice
				`	"It doesn't seem likely that Parliament would allow that."`
				`	"Yes, their sense of honor can be inspiring at times, but right now it's annoying."`
			`	"Indeed," she says. "Although, based on what Alondo said, the Navy hinted that if we made such a show of force that there was no way they could win the battle, they could honorably choose to retreat. So, if they start trying to retreat, let them go. But I suspect it will be a difficult battle to win."`
			`	"What's the battle plan?" you ask.`
			`	"The fleet from Southbound Shipyards will be traveling with you," she says. "Other fleets with other commanders will be converging on Rastaban separately, at approximately the same time. So, you have no time to lose. You must travel directly to Rastaban from here, or else you will arrive too late to join in the fight. Good luck, captain."`
				accept
	
	npc
		government "Free Worlds"
		personality heroic disables escort
		ship "Dreadnought" "F.S. Sequoia"
		ship "Dreadnought" "F.S. Sitka"
		ship "Dreadnought" "F.S. Rosewood"
		ship "Fury (Flamethrower)" "F.S. Montag"
		ship "Fury (Flamethrower)" "F.S. Faber"
		ship "Fury (Flamethrower)" "F.S. Beatty"
		ship "Fury (Flamethrower)" "F.S. Mildred"
		ship "Fury (Flamethrower)" "F.S. Clarisse"
	
	npc
		system Rastaban
		personality heroic uninterested staying disables
		government "Free Worlds"
		fleet
			names "free worlds capital"
			variant
				"Falcon (Plasma)"
				"Osprey" 2
		fleet
			names "free worlds capital"
			variant
				"Falcon (Plasma)"
				"Osprey (Missile)" 2
		fleet
			names "free worlds capital"
			variant
				"Falcon (Heavy)"
				"Osprey (Laser)" 2
		fleet
			names "free worlds capital"
			variant
				"Falcon (Plasma)"
		fleet
			names "free worlds capital"
			variant
				"Bastion" 2
		fleet
			names "free worlds capital"
			fighters
				names "free worlds fighters"
			variant
				"Skein" 2
				"Finch" 12
		fleet
			names "free worlds capital"
			variant
				"Falcon" 2
	
	npc evade
		system Rastaban
		personality heroic uninterested staying
		government "Republic"
		fleet 2
			names "republic capital"
			fighters
				names "republic fighter"
			variant
				"Carrier (Mark II)"
				"Lance" 4
				"Combat Drone" 6
		fleet 3
			names "republic capital"
			fighters
				names "republic fighter"
			variant
				"Cruiser (Mark II)"
				"Combat Drone" 4
		fleet 3
			names "republic small"
			variant
				"Rainmaker (Mark II)" 2
		fleet 2
			names "republic small"
			variant
				"Gunboat (Mark II)" 3
		fleet 2
			names "republic small"
			variant
				"Gunboat (Mark II)" 2
	
	on visit
		dialog `You've landed on <planet>, but there are still Navy ships circling overhead. You should take off and help finish them off.`
	on complete
		event "fw southern expansion"



mission "FW Southern Battle 3"
	landing
	name "Sweep for Navy Ships"
	description "Travel through the systems near Rastaban and make sure that the remainder of the Navy occupation fleet is retreating. (If they are fleeing, let them flee.)"
	autosave
	source "Dancer"
	to offer
		has "FW Southern Battle 2: done"
	waypoint Girtab
	waypoint Albaldah
	waypoint "Delta Sagittarii"
	on fail
		dialog `You have failed an essential Free Worlds mission. If you want to complete the story line, revert to the autosave or another earlier snapshot of the game.`
	
	on offer
		log "The Navy has been driven out of the Rastaban system. That will allow the people on Harmony, Dancer, New Portland, and New India to join the Free Worlds."
		conversation
			`As soon as you land on <origin>, you contact Freya and let her know that the system is yours. "That's great news," she says. "Now we need to make sure they've pulled back from the neighboring systems, too. Take a few ships and sweep through Delta Sagittarii and Albaldah and make sure they're clear. Leave the rest of the fleet on Dancer to handle the prisoners and repairs."`
			choice
				`	"What should I do if I encounter Navy ships on my patrol?"`
					goto patrol
				`	"What are we going to do with the prisoners?"`
					goto prisoners
			label patrol
			`	"If they're fleeing, let them flee," she says, "but if you discover a strong Navy presence remaining in one of those systems, report back to Dancer before engaging them. Meanwhile, I'll ask Alondo to contact the Navy admirals and see if we can get Katya back in exchange for those prisoners."`
				goto katya
			label prisoners
			`	"Well," she says, "my hope is that we can trade them for any of our people who have been captured so far in this war. Including Katya."`
				goto katya
			label katya
			`	"You think she's still alive?" you ask.`
			`	"Certainly, and having this many Navy prisoners gives us a great bargaining chip for negotiating her freedom. Now, gather your patrol, and by the time you get back, I hope we will have arranged for her release."`
				accept
	
	npc
		government "Republic"
		personality fleeing uninterested
		system "Delta Sagittarii"
		fleet "Large Republic" 2
	npc
		government "Republic"
		personality fleeing uninterested
		system "Girtab"
		fleet "Large Republic" 2
	npc
		government "Republic"
		personality fleeing uninterested
		system "Albaldah"
		fleet "Large Republic" 2
	
	on visit
		dialog phrase "generic waypoint on visit"
	on complete
		dialog `You've finished patrolling the nearby systems. Now you can meet up with Freya in the spaceport, and hopefully she will have good news about Katya.`



mission "FW Southern Prisoners - Release"
	name "Return Navy Prisoners"
	description "As a goodwill gesture, return the Navy prisoners to <destination> rather than imprisoning them on Clink. Your safe passage ends on <day>."
	source Dancer
	clearance
	destination "New Iceland"
	to offer
		has "FW Southern Battle 3: done"
	to fail
		has "FW Southern Prisoners - Keep: done"
	deadline 7
	
	on offer
		conversation
			`You find Freya and Alondo watching over a large hangar where several hundred Navy crew and support staff are being kept under guard. Alondo says, "I contacted the Navy admirals. They say Katya is not under their control; she is a prisoner of the Intelligence bureau, and arranging her release could take weeks. But they promised that if we return their prisoners now, they will ensure Katya's release and return her to us soon."`
			choice
				`	"How do we know they won't break that promise?"`
				`	"Why not just keep the prisoners until we have Katya back safely?"`
			`	Freya sighs. "Alondo claims that the admirals value their honor so highly that we can trust their promise. I am not so sure. Even if the admirals do their best, what if Intelligence refuses to honor the deal we make?"`
			`	Alondo says, "On the other hand, if we release these prisoners on parole as a gesture of good faith, it could bring us much closer to a diplomatic end to this war. Which would be far preferable to another battle as bloody as this one."`
			`	Freya says, "And meanwhile, JJ is off on a top secret mission. And that means he's not available to consult with, and we need to make this decision now."`
			`	"And since we cannot agree," says Alondo, "we are giving you the deciding vote."`
			choice
				`	"What do you mean?"`
			`	"We will be putting you in charge of the prisoner convoy," says Alondo, "and arranging a week of safe passage for you. If you think we should return the prisoners as a gesture of goodwill to improve our chances of a diplomatic end to this war, bring the convoy to <planet>."`
			`	"But if you think we should hold on to the prisoners until we receive Katya safely back," says Freya, "bring the convoy to Clink. Understand?"`
			`	It's a serious choice facing you, with no clear right decision. You thank them for trusting you, and begin preparations to escort the prisoners.`
				accept
	
	on accept
		event "fw safe passage starts"
		event "fw safe passage ends" 7
	
	npc accompany save
		government "Escort"
		personality timid escort
		ship "Blackbird (Prisoner Transport)" "F.S. Charity"
		ship "Blackbird (Prisoner Transport)" "F.S. Good Hope"
		ship "Blackbird (Prisoner Transport)" "F.S. Stoutheart"
		ship "Blackbird (Prisoner Transport)" "F.S. Nightingale"
		ship "Blackbird (Prisoner Transport)" "F.S. Turtledove"
	npc
		government Republic
		personality staying uninterested
		system "Kaus Borealis"
		fleet "Large Republic" 4
	
	on visit
		dialog "You have reached <planet>, but you left part of your convoy behind! Better depart and wait for them to arrive in this star system."
	
	on complete
		karma ++
		log "Was given the choice of what to do with the Navy prisoners from the battle for Rastaban, and decided to parole and release them rather than imprisoning them. Hopefully that will earn some goodwill from the Navy in the future."



mission "FW Southern Prisoners - Keep"
	name "Keep Navy Prisoners"
	description "Rather than releasing the Navy prisoners, deliver them to the mines on Clink, to be held until Katya is returned to you."
	source Dancer
	destination Clink
	to offer
		has "FW Southern Battle 3: done"
	to fail
		has "FW Southern Prisoners - Release: done"
	
	on complete
		karma --
		event "fw prison on Clink"
		log "Was given the choice of what to do with the Navy prisoners from the battle for Rastaban, and decided to imprison them on Clink. Hopefully that will weaken the Navy, a little bit."



mission "FW Southern Prisoners - Released"
	landing
	name "Report to Dancer"
	description "Report back to Freya and Alondo on Dancer that you chose to release the prisoners."
	source "New Iceland"
	destination Dancer
	to offer
		has "FW Southern Prisoners - Release: done"
	on fail
		dialog `You have failed an essential Free Worlds mission. If you want to complete the story line, revert to the autosave or another earlier snapshot of the game.`
	
	on offer
		conversation
			`<origin> has become the home of a major Navy base almost overnight; the number of ships and people here is almost overwhelming. You return the prisoners, who have all taken an oath of parole to take no further part in the war against the Free Worlds. One of the four Navy admirals who you and Alondo met with earlier is here, and as you are unloading the prisoners, he says, "More volunteers for the 'Oathkeepers,' I see."`
			choice
				`	"Who are the 'Oathkeepers'?"`
			`	"The officers you granted parole to months ago. We reassigned them all to duty in the north, patrolling for pirates."`
			`	"You mean they really do honor their promise not to fight us?" you ask.`
			`	"Of course. They swore a vow, after all." You suspect it's not quite that simple, but decide that questioning this admiral's word would be pointless. As you are getting ready to leave, he says, "Don't worry, we will be returning Miss Reynolds to you shortly. The ship carrying her should arrive here in a week or two."`
			`	You hope he is telling the truth. Now, it is time to meet with Freya and Alondo and decide what should be done next.`
				launch
	
	npc accompany save
		government "Escort"
		personality timid escort
		ship "Blackbird" "F.S. Charity"
		ship "Blackbird" "F.S. Good Hope"
		ship "Blackbird" "F.S. Stoutheart"
		ship "Blackbird" "F.S. Nightingale"
		ship "Blackbird" "F.S. Turtledove"
	npc
		government Republic
		personality staying uninterested
		system "Kaus Borealis"
		fleet "Large Republic" 4
	
	on visit
		dialog "You have reached <planet>, but you left part of your convoy behind! Better depart and wait for them to arrive in this star system."
	on complete
		set "fw delivered prisoners"



mission "FW Southern Prisoners - Kept"
	landing
	name "Report to Dancer"
	description "Report back to Freya and Alondo on Dancer that you chose to keep the prisoners on Clink."
	source Clink
	destination Dancer
	to offer
		has "FW Southern Prisoners - Keep: done"
	on fail
		dialog `You have failed an essential Free Worlds mission. If you want to complete the story line, revert to the autosave or another earlier snapshot of the game.`
	
	on offer
		conversation
			`You drop off the prisoners at the mines of Clink, to be held until the Navy returns Katya to you. Now, it's time to meet with Freya and Alondo and decide what should be done next.`
				accept
	on complete
		set "fw delivered prisoners"



mission "FW Southern Break"
	landing
	source Dancer
	autosave
	to offer
		has "fw delivered prisoners"
	
	on offer
		log "Once again there is no immediate work to be done for the Free Worlds. This would be a good time to earn some money for an upgraded ship, if possible."
		event "fw occupying the north" 50
		"salary: Free Worlds" >?= 2100
		conversation
			`You land on Dancer and report to Alondo and Freya that the prisoner transfer is complete. "What do we do now?" you ask.`
			`	Freya says, "Well, I hope we're done with fighting for a while, now. We'll stay here to hold this system against any Navy retaliation. And, we'll keep hoping that Parliament might come to their senses and agree to a diplomatic end to this conflict. In the meantime I suggest you spend some time doing whatever it is you do to earn money on the side - carrying passengers or freight or hunting pirates. We'll contact you when things begin to move forward again."`
			choice
				`	"Sounds good. I'll hope to hear from you soon."`
					goto salary
				`	"You're sure there's nothing else I can do to help the Free Worlds right now?"`
			`	Alondo says, "You might hear from some other folks who could use your assistance, but as for the Council, I think it's a waiting game for us right now. Please don't think we aren't grateful for your help, Captain. All we're saying is that hopefully, for a few months at least, we'll all be able to take a break from fighting and go back to actually living our lives."`
			
			label salary
			branch end
				not "FW Pirates 4.1: offered"
				not "event: fw stripped of service"
			`	"Before you leave, Captain," Freya says. "The Senate has decided to reinstate your pay after these recent events. You should now have a salary of 2,100 credits, just like before."`
			
			label end
			`	Alondo gives you a nod. "We'll contact you as soon as things get interesting again."`
				decline



mission "FW Southern Break Ends"
	name "Return to <planet>"
	description "Travel as quickly as possible to <destination> to rejoin the main Free Worlds fleet."
	landing
	source
		near Rastaban 1 100
	destination Dancer
	to offer
		has "event: fw occupying the north"
		not "FW Northern 1: offered"
	
	on offer
		conversation
			`Soon after you land on <origin>, you receive a message from Freya: "Greetings, Captain <last>! I hope you've made good use of your time off, because we're about to be right in the thick of it once again. As soon as you're able, please come rejoin the fleet on Dancer. We have some urgent and sensitive work to do."`
				accept



mission "FW Northern 1"
	landing
	name "Northern Expansion"
	description "Take a fleet to <destination> (visiting <waypoints> along the way), securing those systems to allow them to defect to the Free Worlds."
	autosave
	source "Dancer"
	destination "New Tibet"
	waypoint "Alphecca"
	waypoint "Seginus"
	clearance
	to offer
		has "event: fw occupying the north"
	passengers 1
	blocked `You receive a message from Freya: "Captain, please meet up with us as soon as you have a bunk free for Alondo." You have no bunks free, so you should return here once you have made one available.`
	on fail
		dialog `You have failed an essential Free Worlds mission. If you want to complete the story line, revert to the autosave or another earlier snapshot of the game.`
	
	on offer
		log "Three more planets have decided to defect to the Free Worlds: Clark, New Tibet, and New Holland."
		conversation
			`When you land on Dancer, the Free Worlds fleet appears to be preparing for another battle: missiles and torpedoes are being loaded onto ships and crew members are running around. You eventually find Freya and Alondo, and ask them what is going on.`
			`	"Another three worlds have secretly told us they are ready to defect," says Alondo, "and this time around we want to get there before the Navy does."`
			`	Freya says, "We need you to take Alondo, along with the ships that we've been able to muster, and fly through the <waypoints> systems, then land on <destination>. If all goes well, you will get through to <planet> before the Republic can muster reinforcements. Drive off any Republic ships you encounter along the way."`
				accept
	
	npc
		government "Free Worlds"
		personality heroic escort
		fleet "Large Free Worlds" 3
	npc
		government "Republic"
		personality fleeing uninterested
		system "Wei"
		fleet "Large Republic" 2
	npc
		government "Republic"
		personality fleeing uninterested
		system "Seginus"
		fleet "Large Republic" 2
	npc
		government "Republic"
		personality fleeing uninterested
		system "Alphecca"
		fleet "Large Republic" 2
	
	on visit
		dialog phrase "generic waypoint on visit"
	on complete
		event "fw northern expansion"
		dialog
			`As soon as you land, Alondo rushes out of your ship to meet with the governor of <planet> and "get these papers signed before they change their minds." He tells you to meet him back in the spaceport in an hour.`



mission "FW Northern 2"
	name "Meet With Freya"
	description "Now that the northern star systems are secured, go back to <planet> to meet with Freya and work with her to remove any surveillance equipment the Navy installed in the Wei system or elsewhere."
	source "New Tibet"
	destination "Dancer"
	to offer
		has "FW Northern 1: done"
	on fail
		dialog `You have failed an essential Free Worlds mission. If you want to complete the story line, revert to the autosave or another earlier snapshot of the game.`
	
	on offer
		conversation
			`You wait in the spaceport bar for a while. Your Free Worlds uniform has drawn a good deal of attention from the locals: a few of them waved to you when you came in, or gave other subtle signs of approval, but no one is sitting with you. They probably want to avoid getting into trouble with the Republic if the Free Worlds is not able to hold this planet.`
			`	Finally Alondo arrives. "Come on," he says. "Let's talk outside." He seems tired, but not frightened.`
			choice
				`	"Is everything okay?"`
				`	"Did they agree to join us?"`
			`	"Yes, yes, of course," he says. "But taking on six more worlds all of a sudden - I just hope it's not more than we can handle. When the Navy recovers from the battle at Rastaban and strikes back, now we have much less idea where that strike will fall."`
			`	"So, what do we do next?" you ask.`
			`	"We need to move more of our fleet up here to the front," he says, "but I'd be willing to bet that the Navy has installed surveillance equipment on Hope, and maybe a few other planets in this sector too. Which I should have thought of before, because in order to be sure we've tracked every last one down, we need Freya's expertise in signals and sensors. So, I'm sending you to meet up with her on Dancer."`
			choice
				`	"No problem. Don't worry, we'll be able to handle this just fine."`
					accept
				`	"Aren't you afraid the Navy will strike while I'm off fetching her?"`
			`	"Of course," he says. "But I talked with JJ, and he thinks they're still recovering from the last battle. And if their sensors all go dark, that will be a big deterrent to keep them from attacking - certainly more of a deterrent than you could add by staying here with our fleet."`
			`	"Understood," you say. "I'll go get Freya."`
				accept



mission "FW Northern 2A"
	landing
	name "Sweep Hope"
	description "Bring Freya to <planet> and destroy any Navy sensor emplacements that she finds there."
	source "Dancer"
	destination "Hope"
	to offer
		has "FW Northern 2: done"
	passengers 1
	blocked "To continue this mission, you need a bunk free for Freya. Return here when you have made one available."
	on fail
		dialog `You have failed an essential Free Worlds mission. If you want to complete the story line, revert to the autosave or another earlier snapshot of the game.`
	
	on offer
		conversation
			`As soon as you land, Freya shows up at your ship with a small suitcase full of clothes. "No time to waste," she says. "Let's get going. Our first target will be <planet>, since we know for a fact that they were installing something there."`
				accept
	on visit
		dialog `You land on <planet>, but realize that your escort carrying Freya hasn't entered the system yet. Better depart and wait for it to arrive.`



mission "FW Northern 2B"
	landing
	name "Sweep Clark"
	description "Bring Freya to <planet> to check for any Navy surveillance stations."
	source "Hope"
	destination "Clark"
	to offer
		has "FW Northern 2A: done"
	passengers 1
	on fail
		dialog `You have failed an essential Free Worlds mission. If you want to complete the story line, revert to the autosave or another earlier snapshot of the game.`
	
	on offer
		conversation
			`As you approach the planet, Freya sits down at your ship's sensor console and begins fiddling with some settings that you didn't even know existed. She seems entirely focused, and clearly knows what she is doing. You recall being told that she is an engineer, not a politician or a military commander, which makes the fact that she has been able to step up as such a strong leader in the Council very impressive.`
			`	"Yup, eight different stations," she says finally, "including this one that I nearly overlooked, buried ten meters under the ice, that is acting as a relay for them." She points out each station on your map, and you fly by each one and destroy it. "Now," she says, "that was what had me most worried, but for the sake of completeness we should sweep the other new worlds, too. Let's go to <planet> next."`
				accept
	on visit
		dialog `You land on <planet>, but realize that your escort carrying Freya hasn't entered the system yet. Better depart and wait for it to arrive.`



mission "FW Northern 2C"
	landing
	name "Sweep New Holland"
	description "Bring Freya to <planet> to check for any Navy surveillance stations."
	source "Clark"
	destination "New Holland"
	to offer
		has "FW Northern 2B: done"
	passengers 1
	on fail
		dialog `You have failed an essential Free Worlds mission. If you want to complete the story line, revert to the autosave or another earlier snapshot of the game.`
	
	on offer
		conversation
			`Once again, Freya works some sort of magic with your ship's sensors and manages to locate another surveillance station. "Right in the middle of the city," she says. "We'll have to go there on foot and disable it."`
			choice
				`	"Are you worried that it might be guarded?"`
					goto guard
				`	"Okay, I'll grab my favorite guns and explosives!"`
					goto guns
			label guard
			`	"A little worried," she says. "We should be armed, just in case. But I'm not picking up any human heat signatures from the building, and it wouldn't be like the Navy to leave some of their own behind for us to capture."`
				goto destroy
			label guns
			`	"Now, now," she says, "we just convinced this world to join us, let's not go blowing up their whole factory district. I don't see any human heat signatures, but you can bring your weapons anyway just in case."`
			label destroy
			`	Warily, you approach the sensor installation, kicking down the door to an old abandoned warehouse. Freya is right - it's not guarded. She shuts down the transmitter, then asks for your help bringing some of the sensors and other equipment back to your ship. "I always love having a chance to look at Navy technology," she says. "Now, let's head to <planet>."`
				accept
	on visit
		dialog `You land on <planet>, but realize that your escort carrying Freya hasn't entered the system yet. Better depart and wait for it to arrive.`



mission "FW Northern 2D"
	landing
	name "Sweep New Tibet"
	description "Bring Freya to <planet> to check for any Navy surveillance stations."
	source "New Holland"
	destination "New Tibet"
	to offer
		has "FW Northern 2C: done"
	passengers 1
	on fail
		dialog `You have failed an essential Free Worlds mission. If you want to complete the story line, revert to the autosave or another earlier snapshot of the game.`
	
	on offer
		conversation
			`You spend quite a while flying back and forth above the surface of <origin>, but Freya is unable to locate any Navy signals originating from the surface. Finally she gives up. "It's an out-of-the-way planet," she says. "Any fleet coming here would pass through Alioth or Seginus first. So I guess they didn't bother to put anything here. Time to head to New Tibet and meet up with Alondo!"`
				accept
	on visit
		dialog `You land on <planet>, but realize that your escort carrying Freya hasn't entered the system yet. Better depart and wait for it to arrive.`



mission "FW Northern 3"
	landing
	name "Freya to Zug"
	description "Bring Freya to <destination> to help with ramping up Dreadnought production."
	source "New Tibet"
	destination "Zug"
	to offer
		has "FW Northern 2D: done"
	passengers 1
	on fail
		dialog `You have failed an essential Free Worlds mission. If you want to complete the story line, revert to the autosave or another earlier snapshot of the game.`
	
	on offer
		log "The shipyard on Zug is still trying to ramp up Dreadnought production. So far only a few ships have been built, but Freya will be helping to speed up the process."
		conversation
			`As you approach <origin>, Freya quickly locates two Navy surveillance stations and contacts Alondo, asking him to send some Free Worlds personnel to destroy them. Then you land, and Alondo comes aboard your ship to discuss your next steps in person.`
			`	"There's a good chance we've taken care of all the sensors in this sector," says Freya, "so we can start moving our fleets around here without tipping the Navy off. And I just heard from Southbound Shipyards that they've got two more Dreadnoughts ready for service."`
			choice
				`	"Only two? I was hoping to get a Dreadnought of my own soon!"`
					goto two
				`	"Don't we need to defend Rastaban and the other systems to the east, as well?"`
					goto east
			label two
			`	"Patience, Captain," says Freya. "Building prototypes is very different from doing mass production."`
				goto zug
			label east
			`	"Yes," says Freya. "Which means our fleets will be stretched thin. We really need them to ramp up Dreadnought production."`
			label zug
			`	Alondo asks Freya, "Do you think you could help them in the shipyards? After all, you were a superb fleet supply manager back in the Defense Pact days."`
			`	"I'll do what I can, if you think you're all set here," says Freya.`
			`	"I'm fine," says Alondo, "and JJ is on Rastaban now, guarding our other flank. So you can take a break from being on the front." He heads back outside, and you and Freya get ready to visit the shipyards on <planet>.`
				accept
	
	on visit
		dialog `You land on <planet>, but realize that your escort carrying Freya hasn't entered the system yet. Better depart and wait for it to arrive.`
	on complete
		log "Agreed to become a member of the Free Worlds Council, taking Tomek's spot."
		"salary: Free Worlds" = 6800
		conversation
			`As you are landing on <planet>, Freya says, "I miss Katya. It's hard being the only woman on the Council."`
			choice
				`	"Don't worry, the Navy said they're trying to find her and return her to us."`
				`	"Do you think the Navy reneged on their promise to free her?"`
			`	"I don't know," she says. "I hope the Navy will keep their promise. But in the meantime, three people on Council is too few. We didn't want to say anything to you until the Senate cleared it, but we've nominated you to take Tomek's spot on the Council. What do you say?"`
			choice
				`	"I'd be honored. Thank you."`
			`	She grins. "Don't mention it. You've been with us since the beginning, and we've all come to trust what you have to say. I wish we could throw you a big dinner or something to celebrate, but... well, we're all busy with the war right now. But Alondo and JJ both said to tell you they're glad to have you on board. And you'll get a salary increase, of course. Which you ought to celebrate by buying us both a few drinks in the spaceport bar before you leave. Okay?"`
			choice
				`	"Okay, I'll meet you back at the spaceport in a few hours."`
			`	"Great," she says, smiling. "See you then." She picks up her suitcase, and hurries over to the shipyard.`



mission "FW Northern 3B"
	name "Dreadnoughts to <planet>"
	description "Escort two more Dreadnoughts to <destination> to help defend the front against any Navy incursions."
	autosave
	source "Zug"
	destination "Clark"
	to offer
		has "FW Northern 3: done"
	on fail
		dialog `You have failed an essential Free Worlds mission. If you want to complete the story line, revert to the autosave or another earlier snapshot of the game.`
	
	on offer
		conversation
			`Freya turns out to be a whiskey drinker. By the time she has finished her first drink, she is chattering quite passionately about starship design: load balancing, stress lines, shield matrices, shipboard computers. Rather than dulling her intelligence, alcohol just seems to reduce her ability to explain things in ways a non-specialist can understand. You try to steer the conversation towards something less technical...`
			choice
				`	"So, why did you join the Council, initially?"`
					goto council
				`	"Where's your home planet?"`
					goto home
				`	"How long do you think it will be before they're mass-producing Dreadnoughts?"`
					goto dreadnoughts
			label council
			`	"Well," she says, "you know the Council. Visionaries, big picture people. They needed someone who could take care of the actual concrete details. Data crunching for our 'thousand eyes' program tracking pirate fleet movements. Supply chain management. This was back in the days of the Pact, of course, before we had officially separated from the Republic. And I had worked with JJ in the past, so he asked me to come with him and help out on a larger scale."`
				goto leave
			label home
			`	"I grew up on Earth," she says, "deep in the bowels of one of the major cities. Even as a kid I hated that dirty old planet and knew my only shot of leaving there was to be smarter than everyone else. It wasn't until years later, when I came back to visit with some money in my pocket and a bit more perspective, that I was able to travel to the few parts of Earth that are still pretty, and realize how precious our home world is."`
				goto leave
			label dreadnoughts
			`	"Ugh," she says, "let's not talk about work while we're busy relaxing." You refrain from commenting that all her talk about starship design sounded a lot more like work than like a fun relaxing topic of conversation.`
				goto leave
			label leave
			`	You hang out in the bar for another hour or so, and then she says to the bartender, "Two bottles of champagne to go, please." He gives her an odd look, but the Council is well enough respected that he does not question her.`
			`	You walk over to the shipyard, where the two newly completed Dreadnoughts are parked side by side. "Time to christen our new ships," she says, handing you one of the bottles. You each fling a bottle at one of the ships, and shout out...`
			choice
				`	"For victory!"`
				`	"For peace!"`
				`	"For justice!"`
			`	"May it come soon," echoes Freya. "Now, tomorrow morning the crews for these ships will be ready, and we'll need you to escort them to <planet>. I'll stay here and do my best to help manage the equipment supply chain and construction crews." She says goodnight, and wishes you a safe journey tomorrow.`
				accept
	
	npc accompany save
		government "Free Worlds"
		personality timid escort
		ship Dreadnought "F.S. Bartlett"
		ship Dreadnought "F.S. Magnolia"
	
	on visit
		dialog "You have reached <planet>, but without both the Dreadnoughts you were assigned to escort! Better depart and wait for them to arrive in this star system."



mission "FW Northern 4"
	landing
	name "Meet Convoy"
	description "Travel to <destination> to escort a convoy of medical supplies. Watch out for Republic attacks."
	autosave
	source "Clark"
	destination "New Kansas"
	to offer
		has "FW Northern 3B: done"
	clearance
	on fail
		dialog `You have failed an essential Free Worlds mission. If you want to complete the story line, revert to the autosave or another earlier snapshot of the game.`
	
	on offer
		conversation
			`Waiting for you on <origin> is a message from Alondo: "Hello Captain! We've got another minor crisis: a merchant fleet was supposed to bring us a shipment of medical supplies from up North, since many of our worlds are running short. But, the Republic is threatening to attack the convoy if they try to cross over into our space, so they're waiting on <planet>, just inside of the Republic's territory. Please go meet up with the fleet and bring it back to New Tibet."`
				accept



mission "FW Northern 4.1A"
	landing
	name "Medical Convoy"
	description "Escort a convoy carrying medical supplies safely to <planet>. Do not fire on the Navy Oathkeeper ship that is in orbit there."
	autosave
	source "New Kansas"
	destination "New Tibet"
	to offer
		has "FW Northern 4: done"
		not "FW Northern 4.2A: offered"
		karma >= 2
		"reputation: Navy (Oathkeeper)" >= 0
	on fail
		dialog `You have failed an essential Free Worlds mission. If you want to complete the story line, revert to the autosave or another earlier snapshot of the game.`
	
	on offer
		conversation
			`You land on <origin> and meet up with the fleet you will be escorting. A few minutes later, an urgent message comes in from Alondo: "We've got a crazy situation here. Return to New Tibet immediately with the convoy. You will find a Navy Oathkeeper ship in orbit. Do not attack them, just see to it that the convoy lands safely." The Oathkeepers are Navy officers who swore not to fight the Free Worlds, so you can't help wondering what they are doing on <planet>.`
				accept
	
	npc accompany save
		personality escort timid
		government Merchant
		fleet
			names "civilian"
			cargo 4
			variant
				Freighter 4
	
	on visit
		dialog "You have reached <planet>, but you left part of your convoy behind! Better depart and wait for them to arrive in this star system."
	
	npc save
		government "Navy (Oathkeeper)"
		personality heroic staying uninterested
		system Alioth
		ship "Cruiser (Mark II)" "N.S. Peacemaker"



mission "FW Northern 4.2A"
	landing
	name "Medical Convoy"
	description "Escort a convoy carrying medical supplies safely to <planet>."
	autosave
	source "New Kansas"
	destination "New Tibet"
	to offer
		has "FW Northern 4: done"
		not "FW Northern 4.1A: offered"
		or
			karma < 2
			"reputation: Navy (Oathkeeper)" < 0
	on fail
		dialog `You have failed an essential Free Worlds mission. If you want to complete the story line, revert to the autosave or another earlier snapshot of the game.`
	
	on offer
		conversation
			`You land on <origin> and meet up with the fleet you will be escorting. A few minutes later, an urgent message comes in from Alondo: "We've got a crazy situation here. Return to New Tibet immediately with the convoy." He provides no further information.`
				accept
	
	npc accompany save
		personality escort timid
		government Merchant
		fleet
			names "civilian"
			cargo 4
			variant
				Freighter 4
	npc
		government Republic
		personality heroic
		system Sarin
		fleet "Small Republic"
	
	on visit
		dialog "You have reached <planet>, but you left part of the convoy behind! Better depart and wait for them to arrive in this star system."



mission "FW Alphas 1.1"
	landing
	name "Liberate Poisonwood"
	description "Destroy the pirate ships occupying the <system> system with the help of the Navy Oathkeepers, then land on the planet and let the Navy troops eliminate the Alphas."
	autosave
	source "New Tibet"
	destination Poisonwood
	clearance
	to offer
		has "FW Northern 4.1A: done"
	on fail
		dialog `You have failed an essential Free Worlds mission. If you want to complete the story line, revert to the autosave or another earlier snapshot of the game.`
	
	on offer
		log "The Republic world of Poisonwood in the South has apparently been taken over by Alpha warlords. It is such a dire threat that despite the war, the Navy Oathkeepers have agreed to fight alongside the Free Worlds to liberate the planet."
		event "alphas capture Poisonwood"
		conversation
			`You land the convoy safely on <origin>, but everyone seems to be busy with whatever new crisis it is that Alondo alluded to; no one approaches you to help unload the ships. Eventually you track down Alondo and ask what is going on, and why there is a neutral Navy ship in orbit. "We just received word that Poisonwood has been captured by pirates, while all of our fleets were busy guarding the front," says Alondo. You recall that Poisonwood has remained loyal to the Republic, even though they are deep inside Free Worlds territory.`
			choice
				`	"If we liberate them, will they switch their loyalty to our side?"`
					goto loyalty
				`	"If they're not one of our worlds, why should we help them?"`
					goto help
			label loyalty
			`	"Possibly," says Alondo. "But that's not what is important. Before they were overrun by pirate troops, one of the colonists managed to take a photo of the pirate leader."`
				goto photo
			label help
			`	"Because one of the colonists took a picture of the leader of the pirates who attacked them," says Alondo.`
				goto photo
			label photo
			`	He hands you a small printout of a photograph. It is a somewhat blurry picture of a group of armed pirates running down a street in a desert town. What grabs your attention immediately is that several of the pirates appear to have green skin. You recognize that as the mark of the Alphas, the sociopathic, genetically engineered super-humans who enslaved entire planets during the Alpha Wars, five centuries ago.`
			choice
				`	"It must be a trick. There can't still be Alphas around. Maybe the pirates dyed their skin green to make people fear them."`
				`	"How is it possible that some of the Alphas are still alive?"`
			`	Alondo says, "This may be a trick, but we can't afford to take that risk. The Alphas were the greatest threat humanity has ever faced. And before they contacted us for help, Poisonwood reached out to the Navy." As he is speaking, a shadow passes overhead. You look up and see the unmistakable silhouette of a Navy Cruiser, coming in for a landing.`
			choice
				`	"Are you insane? You're letting the Navy come here?"`
				`	"We're going to work side by side with the Navy right after that awful battle?"`
			`	Alondo explains, "It's only one Cruiser, an 'Oathkeeper' ship, sworn to take no part in our war. The Free Worlds have almost no troops trained for ground combat, so without the Navy's help we would be unlikely to be able to eliminate the Alphas."`
			`	The Navy ship lands, and a man steps off who you recognize immediately: Admiral William Danforth, who is something of a folk hero throughout human space, and who you have heard is the commander of the entire Oathkeeper regiment. With him is a man who he introduces as Commander Aaron Nguyen of the Navy Humanitarian Corps. As Nguyen shakes your hand, you are struck by the fact that although he is your enemy, you see no trace of hostility in his eyes - in fact, his expression is surprisingly warm and affectionate.`
			`	"We have no room for error," says Danforth. "These Alphas must be eliminated, and they must not be allowed to escape. On that, at least, we can all agree."`
			`	Alondo says, "Captain <last> will lead the attack." He beckons to two of the Free Worlds captains. "Marco, Emily, you will join them with your Falcons. Destroy any pirate ships in orbit, then land and secure the facility. Understood?" You nod, and prepare to take off for the <system> system.`
				accept
	
	npc accompany save
		government "Navy (Oathkeeper)"
		personality escort heroic
		ship "Cruiser (Mark II)" "N.S. Peacemaker"
	npc
		government "Free Worlds"
		personality heroic escort
		ship "Falcon (Plasma)" "F.S. Alder"
		ship "Falcon" "F.S. Starry Warrior"
	npc kill
		government "Alpha"
		personality heroic staying target
		system Graffias
		ship "Leviathan (Heavy)" "Dread Lord"
		ship "Leviathan" "Dominator"
		ship "Firebird (Plasma)" "Vengeance"
		ship "Firebird (Missile)" "Revenant"
		ship "Firebird" "Draugbreath"
	
	on visit
		dialog "You have reached <planet>, but the battle is not over - you've either failed to kill one of the pirates, or left one of your ships behind in a different system."

	on complete
		event "liberation of Poisonwood"
		conversation
			`The ships in orbit are eliminated, but there are still the Alphas and their servants here on the ground to take care of. Danforth's ship unloads a squadron of troops in heavy battle suits. The Navy troops move with far more precision and purpose than you have ever seen among the poorly trained Free Worlds soldiers.`
			`	They sweep the city and quickly ascertain that the Alphas are holed up in a large factory. The troops encircle the building and burst through the doors, and soon you hear the sounds of explosions and gunfire within. You wait with Commander Nguyen in an alley facing the building. "I'm with the Humanitarian Corps," he explains. "Killing things is not in my job description."`
			`	Just then, one of the second floor windows shatters and a figure comes tumbling out, rolls, and starts running in your direction. Then it does something you would swear no human being is capable of: while still moving in your direction, it begins leaping from one wall of the alley to the other as easily as you would run up a staircase, gaining altitude with each jump so that soon it will pass two or three meters above your heads. Several Navy troops are running after it, but they hold their fire to avoid hitting you and Nguyen.`
			choice
				`	(Try to shoot it.)`
					goto shoot
				`	(Try to grab it.)`
					goto grab
			label shoot
			`	You open fire, but it is leaping back and forth so fast that it is almost impossible to hit. But then you see Commander Nguyen climb onto a nearby dumpster and leap into the air, managing to grab the creature by the leg as it flies by.`
				goto pin
			label grab
			`	Unfortunately, by now the creature is far outside your reach. But then you see Commander Nguyen climb onto a nearby dumpster and leap into the air, managing to grab the creature by the leg as it flies by.`
				goto pin
			label pin
			`	The two of them fall to the ground and roll over and over in a jumble of limbs. You and the Navy troops run after them, afraid to shoot for fear of hitting Nguyen. But somehow Nguyen gets the upper hand, pinning the creature in a full nelson hold, with his legs wrapped around its body to keep it from kicking him. "Kill it!" he shouts.`
			choice
				`	(Kill it.)`
					goto kill
				`	(Let the Navy troops deal with this.)`
					goto navy
			label kill
			`	While Nguyen holds the creature still, you put a gun to its head and pull the trigger. Not even an Alpha can survive that; the creature goes limp. Now that you can get a good look at it, you can see that it does indeed have green skin.`
				goto end
			label navy
			`	While Nguyen holds the creature still, one of the Navy troops puts a gun to its head and pulls the trigger. Not even an Alpha can survive that; the creature goes limp. Now that you can get a good look at it, you can see that it does indeed have green skin.`
				goto end
			label end
			`	Nguyen gets shakily to his feet; he looks stunned and very pale. "Thank you," he says. The sounds of gunfire within the factory eventually die down. "We'll continue to patrol the city," says Nguyen, "in case there are more of them. Then I'll meet you in the spaceport." He heads off back into the city.`



mission "FW Alphas 1.2"
	landing
	name "Liberate Poisonwood"
	description "Destroy any pirate ships in orbit around <planet>, then land and eliminate the Alphas and their servants who have occupied the city."
	autosave
	source "New Tibet"
	destination Poisonwood
	clearance
	to offer
		has "FW Northern 4.2A: done"
	on fail
		dialog `You have failed an essential Free Worlds mission. If you want to complete the story line, revert to the autosave or another earlier snapshot of the game.`
	
	on offer
		log "The Republic world of Poisonwood in the South has apparently been taken over by Alpha warlords. Hopefully the Free Worlds will be able to liberate the planet and capture or kill the Alpha leaders."
		event "alphas capture Poisonwood"
		conversation
			`You land the convoy safely on <origin>, but everyone seems to be busy with whatever new crisis it is that Alondo alluded to; no one approaches you to help unload the ships. Eventually you track down Alondo and ask what is going on. "We just received word that Poisonwood has been captured by pirates, while all of our fleets were busy elsewhere," says Alondo. You recall that Poisonwood has remained loyal to the Republic, even though they are deep inside Free Worlds territory.`
			choice
				`	"If we liberate them, will they switch their loyalty to our side?"`
					goto loyalty
				`	"If they're not one of our worlds, why should we help them?"`
					goto help
			label loyalty
			`	"Possibly," says Alondo. "But that's not what is important. Before they were overrun by pirate troops, one of the colonists managed to take a photo of the pirate leader."`
				goto photo
			label help
			`	"Because one of the colonists took a picture of the leader of the pirates who attacked them," says Alondo.`
				goto photo
			label photo
			`	He hands you a small printout of a photograph. It is a somewhat blurry picture of a group of armed pirates running down a street in a desert town. What grabs your attention immediately is that several of the pirates appear to have green skin. You recognize that as the mark of the Alphas, the sociopathic, genetically engineered super-humans who enslaved entire planets during the Alpha Wars, five centuries ago.`
			choice
				`	"It must be a trick. There can't still be Alphas around. Maybe the pirates dyed their skin green to make people fear them."`
				`	"How is it possible that some of the Alphas are still alive?"`
			`	Alondo says, "This may be a trick, but we can't afford to take that risk. The Alphas were the greatest threat humanity has ever faced. We have very few people trained in ground combat, but I've gathered some of our best and loaded them onto a fleet that will be accompanying you. Destroy any pirate ships in orbit, then land and secure the facility. Understood? And don't let any of your escorts die; they're carrying the troops you'll need for the ground battle." You nod, and prepare to take off for the <system> system.`
				accept
	
	npc accompany save
		government "Free Worlds"
		personality heroic escort
		ship "Falcon (Plasma)" "F.S. Oak"
		ship "Falcon (Plasma)" "F.S. Alder"
		ship "Falcon" "F.S. Starry Warrior"
	npc kill
		government "Alpha"
		personality heroic staying target
		system Graffias
		ship "Leviathan (Heavy)" "Dread Lord"
		ship "Leviathan" "Dominator"
		ship "Firebird (Plasma)" "Vengeance"
		ship "Firebird (Missile)" "Revenant"
		ship "Firebird" "Draugbreath"
	
	on visit
		dialog "You have reached <planet>, but the battle is not over - you've either failed to kill one of the pirates, or left one of your ships behind in a different system."



mission "FW Alphas 1.1A"
	name "Danforth to <planet>"
	description "Escort Admiral Danforth's ship to <destination> so that he can leave Free space without being accidentally attacked."
	autosave
	source Poisonwood
	destination "New Tibet"
	to offer
		has "FW Alphas 1.1: done"
	on fail
		dialog `You have failed an essential Free Worlds mission. If you want to complete the story line, revert to the autosave or another earlier snapshot of the game.`
	
	npc accompany save
		government "Navy (Oathkeeper)"
		personality escort heroic
		ship "Cruiser (Mark II)" "N.S. Peacemaker"
	
	on visit
		dialog phrase "generic arrived-without-npc dialog"
	
	on offer
		log "With the help of the Oathkeepers, liberated Poisonwood from the Alpha invaders."
		event "death of nguyen" 35
		conversation
			`When you meet up with Nguyen, he still looks very worried. "We think we killed them all," he says, "but we can't be sure. Also, we recovered some instruments for genetic manipulation from the factory. The Alphas can't breed normally, because if their offspring inherit some of the Alpha mutations but not others, the result is rarely viable, and even those that live long enough to be born don't have all the Alpha traits. So, they rely on artificial insemination instead."`
			choice
				`	"Well, it's good news that you recovered those instruments, then."`
			`	"It would be," says Nguyen, "except that we also discovered that several dozen of the women who were taken as slaves... are now pregnant. We'll have to ask them to terminate their pregnancies. It's the only safe decision, but I still don't like it." He sighs. "I'm a Buddhist, you know. Committed to doing harm to no living thing. That's why I joined the Humanitarian Corps. They promised me I'd never be asked to take a life."`
			choice
				`	"Is that why you didn't kill that Alpha yourself, on the street?"`
					goto street
				`	"That doesn't seem like a moral dilemma to me. We know those children will grow up to be monsters."`
					goto kill
				`	"Couldn't we let the children be born, if that's what the women want, then imprison them or something if they do turn out to be Alphas?"`
					goto live
			label street
			`	"Yes," he says. "Silly, isn't it? Anyway, this is my job to deal with; you need to go find Danforth."`
				goto end
			label kill
			`	"Well," he says, "I envy you for living in a universe where decisions like this are easy. But to me it's still a painful choice to make. Anyway, that's my problem to deal with, not yours; you need to go find Danforth."`
				goto end
			label live
			`	"The Alphas were originally bred to be super-soldiers," he says, "a weapon in the hands of a despotic government. As much as I hate to admit it, there are certain branches of the Republic who would love to get their hands on a small army of impressionable Alpha children. Far better for them to die than for that to happen. Anyway, that's my job to deal with; you need to go find Danforth."`
				goto end
			label end
			`	He leaves, and you return to Danforth's ship. Danforth says, "Hello there, temporary ally. It was an honor to fight alongside you, while it lasted."`
			choice
				`	"You too. I wish we could bring this war to an end."`
				`	"If the Republic would just leave us alone, we wouldn't need to be enemies."`
			`	"I know," he says. "But for now, I need to return to my fleet. Which means I'll be needing an escort out of your territory, just to make sure no one attacks me. Maybe you could take us by way of New Tibet? I'm sure Commander Nguyen would appreciate one last visit to the Buddhist monasteries there before that world becomes closed off to us completely." You agree, and he begins preparing his ship for takeoff.`
				accept
	
	on complete
		set "fw alphas done"



mission "FW Death of Nguyen"
	landing
	source
		near Sol 100
	to offer
		has "event: death of nguyen"
	
	on offer
		conversation
			`Soon after landing on <origin>, you receive an encoded message from Admiral Danforth, the leader of the Oathkeepers. "Captain <last>," he says, "I would like to thank you once again for allowing us to assist you on Poisonwood. Unfortunately, I have bad news that may concern you. Commander Nguyen, who was with you when one of the Alphas was apprehended, has been assassinated, shot in the head at point blank range. His attacker has not been found. We fear that this may be retribution for his part in the action on Poisonwood, and we urge you and your crew to be cautious. With deepest regards - Danforth."`
				decline



mission "FW Alphas 1.2A"
	landing
	name "Return to the Front"
	description "Travel to <destination> to bolster the defenses there."
	source Poisonwood
	destination "New Tibet"
	to offer
		has "FW Alphas 1.2: done"
	on fail
		dialog `You have failed an essential Free Worlds mission. If you want to complete the story line, revert to the autosave or another earlier snapshot of the game.`
	
	on offer
		log "Liberated Poisonwood from the Alpha invaders. Had to bombard them from orbit, and many civilians were killed in the process, but at least the planet is free again."
		event "Poisonwood reverts to Republic"
		conversation
			`The ships in orbit are eliminated, but there are still the Alphas and their servants here on the ground to take care of. Your escorts unload the troops, who spread throughout the city and quickly determine that, as far as the locals know, the Alphas are all holed up in a large factory on the outskirts of town. The locals also inform you that the Alphas have taken dozens of prisoners and are holding them in the factory.`
			`	As you are trying to prepare the Free Worlds troops to storm the building, suddenly one of your escorts, the Starry Warrior, takes off. You radio the captain, who responds, "Sorry, Captain, but I'm following orders. Alondo suspected you wouldn't like this." Then he opens fire on the factory, destroying everything within several blocks with blaster fire and torpedoes. He does not stop firing until there is nothing left but smoldering rubble in that entire section of the city.`
			`	The Alphas are presumably dead. So are their prisoners, and any of the locals who were unlucky enough to be close to the factory when it was destroyed. The governor of Poisonwood, unable to conceal her anger, asks you to take your troops and your ships and leave her world immediately.`
			`	You send a message to the Council asking what you should do, and they tell you to leave the planet and join Alondo on <planet>, to help bolster the defenses there. You leave <origin> with a heavy heart, glad that the Alphas are gone but wishing things here on <origin> had ended differently.`
				launch
	
	on complete
		set "fw alphas done"



mission "FW Bloodsea 1"
	landing
	name "Alondo to <planet>"
	description "Bring Alondo to <planet> to try to convince the locals to join the Free Worlds."
	source "New Tibet"
	destination "Bloodsea"
	clearance `Alondo manages to convince the spaceport to let you land "free of charge."`
	to offer
		has "fw alphas done"
	passengers 1
	blocked `Alondo contacts you and asks, "Do you have a bunk ready for me?" You do not, so you will need to free one up to continue this mission.`
	on fail
		dialog `You have failed an essential Free Worlds mission. If you want to complete the story line, revert to the autosave or another earlier snapshot of the game.`
	
	on offer
		conversation
			`You report in to Alondo, who listens to your description of the battle for Poisonwood with a grim expression on his face. "It's not the end, of course," he says. "It seems like no matter how many times we win a battle against the Alphas, there are more of them out there. But I'm glad that the immediate crisis has been dealt with."`
			choice
				`	"Isn't there any way we can track down the rest of the Alphas?"`
				`	"What is our next mission now?"`
					goto next
			`	"Not really," he says. "There are probably small enclaves throughout human space, and perhaps beyond our space as well. All we can do is make it harder for them to grow powerful."`
			`	"And how do we do that?" you ask.`
			label next
			`	"The Senate has authorized a diplomatic mission to Bloodsea," he says. "It's the smallest of the pirate worlds, and we're going to see what we need to offer them to get them to join the Free Worlds. The official settlements there only amount to a few thousand people, so it shouldn't be too hard to convince them that joining us is better than resisting us."`
			choice
				`	"Okay, sounds like fun!"`
					accept
				`	"Wait, didn't things go south rather quickly the last time we attempted this?"`
			`	Alondo grins. "Yes, but the Free Worlds is in a much stronger position now, and the pirate worlds know it's only a matter of time before they are forced to become civilized. And, the incident on Poisonwood proved that we can't afford to fight a war on two fronts. We need to eliminate the pirate threat, and a diplomatic solution with them is the only sort that will last. So, let's get going!"`
				accept
	on visit
		dialog `You land on <planet>, but realize that your escort carrying Alondo hasn't entered the system yet. Better depart and wait for it to arrive.`



mission "FW Bloodsea 1.1"
	landing
	name "Ships from <planet>"
	description "In order to work toward a peace treaty with Bloodsea, meet up with a convoy of heavily armed merchant ships on <planet>."
	autosave
	source Bloodsea
	destination Zug
	to offer
		has "FW Bloodsea 1: done"
	to fail
		has "FW Bloodsea 1.2: done"
	passengers 1
	
	on offer
		log "The local leaders on the lawless world of Bloodsea have said that they will join the Free Worlds, and stop supporting piracy, in exchange for the equipment to build a more modern spaceport. However, they may just be trying to steal the construction materials; it might be simpler to just attack and conquer them."
		conversation
			`The local leaders are unwilling to meet aboard your ship, and Alondo is afraid you will be ambushed if you venture too far away from it, so eventually they agree to set up a tent on the landing pad next to yours and meet there. Outside, a storm is raging, the rain mixing with salt spray from the blood-red ocean nearby.`
			branch peaceful
				not "FW Pirates: Attack 2: done"
			`	Most of the leaders grimace at the sight of you. "What is the invader doing here?" one of them asks to Alondo.`
			`	"Captain <last> was only following orders, but the officer responsible for giving those orders has been justly punished," Alondo says. "We come in peace this time." The leaders don't seem convinced with that answer, but they agree to continue.`
			label peaceful
			`	As you talk, it becomes clear that the inhabitants of Bloodsea are ashamed of how destitute and undeveloped their world is. Several of them have visited the island spaceport on Deep, and after dancing around the issue for a while, they make a request: if the Free Worlds builds them a real, modern island spaceport, they will join the Free Worlds.`
			`	One of them lays out a detailed list of amenities the port must have: concrete seawalls, raised landing pads, floating docks, sturdy hangars and warehouses, and various defense systems "for when the others learn that we've decided to join you." Also, the deal is off if you show up in orbit with a fleet that "looks like an invasion fleet rather than a construction fleet."`
			`	You thank them and return to your ship. Alondo asks, "What do you think?"`
			choice
				`	"Well, building a spaceport is probably cheaper than fighting a major battle."`
					goto port
				`	"They're asking a lot. Why don't we just invade them?"`
					goto invade
			label port
			`	"Yes," he says, "except that I can almost guarantee that when we show up on their doorstep with everything they asked for, some local warlord will attack our ships, steal our supplies, enslave our workers, and build himself a nice cozy island fortress."`
			`	"So, we attack them?" you ask.`
			label invade
			branch hostile
				not "FW Pirates: Attack 2: done"
			`	"They didn't seem very happy about you doing that the first time. But..." Alondo pauses for a moment.`
			label hostile
			`	"That's certainly the simpler option," he says. "Tomek may have been punished for disobeying the Senate's orders, but we're in a different situation now. Our numbers have swelled because of our victories and new territory, and we now have the Dreadnoughts at our disposal, so occupying Bloodsea is now a viable option.`
			`	"You're on the Council now," he says. "I'll leave it up to you. Option one is, we bring them the supplies and workers, in merchant ships, but use very heavily armed merchant ships in case they double cross us. Option two is, we go to Dancer and see if JJ can lend us an invasion fleet while I convince the Senate that attacking Bloodsea is the better decision."`
				accept
	on visit
		dialog `You land on <planet>, but realize that your escort carrying Alondo hasn't entered the system yet. Better depart and wait for it to arrive.`



mission "FW Bloodsea 1.1A"
	landing
	name "Supplies from <planet>"
	description "Stop on <planet> so that the ships you are escorting can pick up more supplies and workers, then bring them to Bloodsea to help build a new spaceport."
	autosave
	source Zug
	destination Deep
	to offer
		has "FW Bloodsea 1.1: done"
	passengers 1
	on fail
		dialog `You have failed an essential Free Worlds mission. If you want to complete the story line, revert to the autosave or another earlier snapshot of the game.`
	
	on offer
		conversation
			`Waiting for you in the spaceport on <origin> are two Behemoth heavy freighters, which will be carrying the equipment and workers to Bloodsea. You can't help notice that nearly a third of their cargo space has been converted into extra outfit space, and both ships have a pair of Plasma Turrets mounted on them, and what looks like Torpedo Launchers as well.`
			`	While you are on Zug, you and Alondo meet up with Freya and ask how the Dreadnought production is going. "We're nearly there," she says, "just one or two kinks left to work out. They've produced another two prototypes, but not enough to start selling them yet. I know, you're itching to pilot one of your own. Believe me, we're working as fast as possible."`
			`	Your next stop is to pick up more workers and construction supplies on <destination>.`
				accept
	
	npc accompany save
		government Merchant
		personality escort heroic
		ship "Behemoth (Heavy)" "F.S. Bungles"
		ship "Behemoth (Heavy)" "F.S. Humble"
	
	on visit
		dialog "You have reached <planet>, but you left the freighters behind! Better depart and wait for them to arrive in this star system."



mission "FW Bloodsea 1.1B"
	landing
	name "Supplies to <planet>"
	description "Escort these two freighters to <destination> to help build a new spaceport. This may just be an excuse for pirates to attack you."
	autosave
	source Deep
	destination Bloodsea
	clearance
	to offer
		has "FW Bloodsea 1.1A: done"
	passengers 1
	on fail
		dialog `You have failed an essential Free Worlds mission. If you want to complete the story line, revert to the autosave or another earlier snapshot of the game.`
	
	on offer
		conversation
			`You stop on <origin>, and wait as more supplies are loaded onto the two Behemoths you are escorting. Your final stop is <planet>. Alondo thought it likely that some pirates would try to intercept your convoy and steal its cargo, but as long as both freighters land on the planet without being captured or destroyed, you will be able to begin the construction project and thus meet the demands of the people on <planet> to convince them to join the Free Worlds.`
				accept
	
	npc accompany save
		government Merchant
		personality escort heroic
		ship "Behemoth (Heavy)" "F.S. Bungles"
		ship "Behemoth (Heavy)" "F.S. Humble"
	
	on visit
		dialog "You have reached <planet>, but you left the freighters behind! Better depart and wait for them to arrive in this star system."
	
	npc
		government Pirate
		personality plunders staying disables
		system Antares
		fleet
			names pirate
			variant
				"Raven (Afterburner)" 2
				Hawk 2
				"Fury (Flamethrower)" 3
				Sparrow 5
	
	on complete
		set "fw bloodsea done"
		event "dreadnoughts for sale"
		event "dreadnought deployment" 40
		event "bloodsea joins free worlds"
		event "bloodsea spaceport completed" 100
		log "Brought the construction supplies that the people of Bloodsea requested, and they have agreed to join the Free Worlds."
		conversation
			`A few of the locals on Bloodsea appear surprised that you actually brought the supplies for a new spaceport, and that you arrived with all the supplies intact. But after meeting up with Alondo, they agree to hold their side of the bargain: from now on, Bloodsea will be a part of the Free Worlds, with all the rights and responsibilities that implies. And that means that they will refuse to knowingly harbor any pirate fleets or other known criminals.`
			`	Alondo tells you that he will catch a ride back with the freighters when they return. "But, you'll probably want to head out sooner," he says, "because I've got some good news for you. Freya just contacted me, to say that they're now ready to start selling Dreadnoughts to certain select members of the Free Worlds, including you. That also means she's done with her work on Zug, so she'll need you to give her a lift from there."`
				accept



mission "Ijs catches another ride"
	landing
	to offer
		has "fw bloodsea done"
		has "FW Conservatory 1: active"
	on offer
		payment 10000
		event "fw conservatory founded" 30
		conversation
			`Ijs approaches you with his duffel as you're stepping off the <ship>.`
			`	"Thanks for getting me this close, but I really need to get to Winter as soon as possible. I hope you don't take offense that I've booked passage on another transport. Here's <payment> for getting me this far, anyway. I hope to see you again soon, Captain <last>."`
				decline
		fail "FW Conservatory 1"



mission "FW Bloodsea 1.2"
	landing
	name "Invasion Fleet"
	description "Rather than pursuing a diplomatic agreement, meet up with JJ on <planet> and gather a fleet to invade and subjugate Bloodsea."
	source Bloodsea
	destination Dancer
	to offer
		has "FW Bloodsea 1: done"
	to fail
		has "FW Bloodsea 1.1: done"



mission "FW Bloodsea 1.2A"
	landing
	name "Capture Bloodsea"
	description "Take a Free Worlds fleet to invade the <system> system and eliminate any pirate resistance, then land on <planet>."
	source "Dancer"
	destination "Bloodsea"
	clearance
	to offer
		has "FW Bloodsea 1.2: done"
	on fail
		dialog `You have failed an essential Free Worlds mission. If you want to complete the story line, revert to the autosave or another earlier snapshot of the game.`
	
	on offer
		event "battle for bloodsea"
		karma --
		conversation
			`When you meet up with JJ, Alondo explains that you're in need of an invasion fleet for Bloodsea. JJ looks confused at the request. "What? Whatever happened to diplomacy? I only heard that the Senate approved a diplomatic mission. Didn't Tomek get punished for this exact stunt?"`
			choice
				`	"Alondo convinced me that the Bloodsea natives were just planning to betray us."`
				`	"I don't think the pirates will understand any language except overwhelming force."`
			`	"You're starting to sound a lot like Tomek," JJ remarks.`
			`	"I also contacted the Senate on the way here," Alondo says, "and they approved the invasion. We're much more powerful now than before, making invasion a viable option."`
			`	"Perhaps," says JJ. "I'll provide you with some ships, but I'm not happy about this. I need to keep most of my fleet here, to defend against the Navy, but I'll select a few of the strongest ships to accompany you to Bloodsea. Make sure they make it home safe, though. We'll need every ship we can get for when the Navy attacks. Good luck, Captain."`
				accept
	
	npc
		government "Free Worlds"
		personality heroic escort
		ship "Dreadnought" "F.S. Bombastic"
		ship "Falcon (Plasma)" "F.S. Equalizer"
		ship "Falcon (Plasma)" "F.S. Enforcer"
	
	npc evade
		personality heroic staying
		government "Pirate"
		system "Antares"
		fleet
			names pirate
			variant
				"Firebird (Plasma)"
				"Raven (Afterburner)" 2
				"Hawk (Rocket)" 2
				"Fury (Flamethrower)" 3
				Sparrow 5
		ship "Leviathan" "Freedom"
		ship "Manta" "Lucifer"
		ship "Bastion (Heavy)" "Punisher"
	
	on visit
		dialog `You've landed on <planet>, but there are still pirates defending the system. All pirates in the system must be eliminated before <planet> can be taken.`
	on complete
		log "Conquered Bloodsea in the name of the Free Worlds. With enough militia ships patrolling their star system, they ought to think twice before returning to piracy."
		set "fw bloodsea done"
		event "dreadnoughts for sale"
		event "dreadnought deployment" 40
		event "bloodsea independent"
		conversation
			`You land at the main spaceport on Bloodsea with Free Worlds ships circling overhead, ready to bombard the locals if they show any sign of resistance. It is a tense atmosphere, and the leaders sullenly agree to give the Free Worlds access to their planet and to avoid knowingly supporting piracy or other criminal activity. You have won this world, but you have clearly not won the hearts of the locals.`
			`	A while later, you receive new orders from Alondo. "I've got some good news for you," he says. "Freya just contacted me, to say that they're now ready to start selling Dreadnoughts to certain select members of the Free Worlds, including you. That also means she's done with her work on Zug, so she'll need you to give her a lift from there."`
				accept




mission "Pirate Use Jousting Cutthroat"
	landing
	invisible
	to offer
		has "fw bloodsea done"
	on offer
		event "pirate use jousting cutthroat"
		fail

event "pirate use jousting cutthroat"
	fleet "Large Southern Pirate"
		add variant 2
			"Cutthroat" 2
			"Cutthroat (Jousting)"
		add variant 1
			"Modified Argosy (Blaster)"
			"Fury (Gatling)"
			"Cutthroat (Jousting)"




mission "FW Dreadnoughts Ready"
	landing
	name "Meet Freya on <planet>"
	description "Freya is done overseeing the initial production run of Dreadnoughts in the shipyard on Zug. Meet up with her there, to give her a ride to wherever she is assigned next."
	source Bloodsea
	destination Zug
	to offer
		has "fw bloodsea done"
	on fail
		dialog `You have failed an essential Free Worlds mission. If you want to complete the story line, revert to the autosave or another earlier snapshot of the game.`
	on offer
		log "Freya has announced that Dreadnoughts are now for sale on Zug. Finally the Free Worlds have a warship that can stand up to Navy capital ships."



mission "FW Albatross 1"
	landing
	name "Freya to <planet>"
	description "Bring Freya to <planet> to meet up with JJ and make plans for convincing Albatross to give up piracy and join the Free Worlds."
	autosave
	source "Zug"
	destination "Dancer"
	to offer
		has "FW Dreadnoughts Ready: done"
	passengers 1
	on fail
		dialog `You have failed an essential Free Worlds mission. If you want to complete the story line, revert to the autosave or another earlier snapshot of the game.`
	
	on offer
		conversation
			`Freya comes to your ship soon after you land. She is beaming, and looks more relaxed than you have seen her in months. "Southbound Shipyards is churning out Dreadnoughts now!" she says. "Still only at a rate of one a week or so, but for a ship this big that's quite impressive. And it means you can now buy one of your own, if you've got enough savings. Seriously, even if you can't afford one yet, be sure to stop by the shipyard and check them out." She is clearly very proud.`
			choice
				`	"Great job, Freya! I'm really glad to have a talented engineer on the Council to help get things done."`
				`	"Glad to hear it. Now, what is our next action against the pirates?"`
					goto pirates
			`	She smiles. "Thanks. It was actually really refreshing to be able to tackle a concrete, solvable problem for a change, instead of all this nebulous political stuff. Speaking of which, our next step will be to go visit JJ. He's going to be doing the diplomatic outreach to Albatross."`
				goto alondo
			label pirates
			`	"Right, right, back to work," she says. "Well, it sounds like the next order of business is for you to transport me to <planet> to take JJ's place there while he makes a diplomatic visit to Albatross."`
				goto alondo
			label alondo
			`	You ask, "Wait, doesn't Alondo usually handle the diplomacy?"`
			`	"Usually, yes," she says. "But the locals on Albatross specifically asked for JJ. They're a very traditional population, and JJ is well-known as both a family man and a brave soldier. Whereas Alondo is... Alondo."`
			choice
				`	"Fair enough. Let's head to <planet>!"`
					accept
				`	"Wait, I don't understand. Why don't they like Alondo?"`
			`	She looks genuinely surprised that you don't know. "Alondo is gay," she says. "There are few worlds here in the South where that would bother anyone, but Albatross is one of them. So Alondo is taking a break to go visit the Senate, while JJ deals with this particular diplomatic situation."`
			choice
				`	"Okay, I feel silly for even asking. Let's go meet up with JJ!"`
					accept
				`	"Actually, I'm gay too."`
					goto metoo
				`	"Ah. That certainly explains some things."`
				`	"It seems crazy that anyone would be bothered by that in this day and age."`
			`	"Yes," she says. "Yes, it does. Now, let's go meet up with JJ."`
				accept
			label metoo
			action
				set "gay"
			`	Freya raises an eyebrow. "I hadn't heard. We don't have time to find someone else for this mission, so you'll need to be the one to transport JJ. Stay safe."`
				accept
	on visit
		dialog `You land on <planet>, but realize that your escort carrying Freya hasn't entered the system yet. Better depart and wait for it to arrive.`


mission "FW Albatross 2"
	landing
	name "Visit Albatross"
	description "Bring JJ to Albatross to negotiate with the local leaders and perhaps convince them to join the Free Worlds and give up their support of piracy."
	autosave
	source Dancer
	destination Albatross
	clearance
	to offer
		has "FW Albatross 1: done"
	passengers 1
	on fail
		dialog `You have failed an essential Free Worlds mission. If you want to complete the story line, revert to the autosave or another earlier snapshot of the game.`
	
	on offer
		conversation
			`When you meet up with JJ, he looks exhausted. "Our scouts are reporting that the Navy is building a massive base on New Iceland," he says, "just a few jumps away from here. So every day I look up at the sky and wonder if today is the day when they will invade."`
			`	You talk for a while and agree that despite the threat from the Navy, dealing with the pirates is important. JJ explains that Albatross started out as a sort of farming commune: independent, but not associated with any illegal activity. But they were dominated by pirates, and since then, one pirate overlord after another has held sway over the planet. So in principle at least, the locals ought to welcome the idea of Free Worlds protection.`
			`	While you are traveling with JJ, Freya agrees to stay here and work on a better surveillance network, to give Dancer advance warning if the Navy decides to invade.`
				accept
	on visit
		dialog `You land on <planet>, but realize that your escort carrying JJ hasn't entered the system yet. Better depart and wait for it to arrive.`
	
	npc
		system Nunki
		government Pirate
		personality staying disables plunders
		fleet "Small Southern Pirates" 2



mission "FW Albatross 2A"
	landing
	name "Hunt Ryk Bartlett"
	description "Hunt down the pirate warlord Ryk Bartlett, who has been plundering merchant convoys in the vicinity of Zeta Aquilae. (Only his personal ship, the Dread, must be destroyed.) Then, return to Albatross."
	autosave
	source "Albatross"
	clearance
	to offer
		has "FW Albatross 2: done"
	passengers 1
	on fail
		dialog `You have failed an essential Free Worlds mission. If you want to complete the story line, revert to the autosave or another earlier snapshot of the game.`
	
	on offer
		conversation
			branch meeting
				not "gay"
			action
				clear "gay"
			`JJ puts a hand on your shoulder before leaving the ship. "Freya let me know. For safety reasons only, of course. You can stay here if you aren't comfortable."`
			choice
				`	"No, I'll come with you."`
				`	"Thank you. I'll stay."`
					goto alt
			label meeting
			`Your meeting with the elders of Albatross happens in secret, by night. They are afraid that if their current pirate overlord, Ryk Bartlett, finds out that they have met with you, they will face retribution. JJ begins by describing the Free Worlds' offer: all the benefits of the mutual defense pact, in exchange for an agreement to uphold human rights and the rule of law, plus offering financial support for the Free Worlds.`
			`	"Begging your pardon," says one of the elders, "but what makes you different from any pirate organization that comes in here, demanding our money in return for 'protection'?"`
			choice
				`	(Let JJ answer that.)`
					goto jj
				`	(Try to give an explanation myself.)`
			`	"We're a representative government," you say, "with open financial records and clear human rights guidelines that we uphold."`
				goto unconvinced
			label jj
			`	JJ explains about the Senate, that each world has a say in how the Free Worlds income is spent. "And," he says, "we will not take your children as slaves, or force you to work in factories producing illegal drugs."`
			label unconvinced
			`	The elder who spoke seems unconvinced. "Seems to me that you 'Council' folks are the real rulers, and your 'Senate' is a figurehead," he says. "So I don't call that true democracy."`
			`	"Maybe," says another of the elders, "but they're still better than Bartlett. I say, if the Free Worlds can free us from him, we'll at least give their new government a try." A few of the others nod in agreement.`
			`	They explain that to the best of their knowledge, Bartlett is spending most of his time near the Zeta Aquilae system, plundering merchant convoys of heavy metals coming out of Rand and Oblivion. If you can destroy Bartlett and his flagship, the Dread, his followers will probably disperse.`
				accept
			label alt
			`	The meeting with the elders of Albatross happens in secret, by night. They are afraid that if their current pirate overlord, Ryk Bartlett, finds out that they have met with you, they will face retribution. You wait in your ship while JJ attempts to convince the elders that they should join the Free Worlds. After some hours, JJ returns.`
			`	"They're interested," JJ says to you, "but they want the current warlord dead."`
			`	They explained that to the best of their knowledge, Bartlett is spending most of his time near the Zeta Aquilae system, plundering merchant convoys of heavy metals coming out of Rand and Oblivion. If you can destroy Bartlett and his flagship, the Dread, his followers will probably disperse.`
				accept
	on visit
		dialog `You land on <planet>, but realize that you either haven't destroyed Ryk Bartlett's ship, the Dread, or your escort carrying JJ hasn't entered the system yet. Better depart and make sure that you've done everything you need to do to complete this mission.`
	
	npc kill
		personality staying plunders disables heroic nemesis target
		system Orvala
		government Pirate
		ship "Bastion (Heavy)" "Dread"
		dialog "You have destroyed Ryk Bartlett's ship. Hopefully now the elders on Albatross will be more inclined to bargain with the Free Worlds."
	
	npc
		personality staying plunders disables
		system Orvala
		government Pirate
		fleet "Small Southern Pirates" 3



mission "FW Albatross 2B"
	landing
	name "Return to Dancer"
	description "Return to Dancer with JJ, and meet up with Freya."
	autosave
	source Albatross
	destination Dancer
	clearance
	to offer
		has "FW Albatross 2A: done"
	passengers 1
	on fail
		dialog `You have failed an essential Free Worlds mission. If you want to complete the story line, revert to the autosave or another earlier snapshot of the game.`
	
	on offer
		log "The people of Albatross, another anarchist world, have agreed to join the Free Worlds in gratitude for having been liberated from Ryk Bartlett, a warlord who was extorting them for protection money."
		event "albatross joins free worlds"
		conversation
			`When the elders on Albatross learn that you have destroyed Ryk Bartlett and freed them from his rule, they grudgingly agree to join the Free Worlds, "at least on a trial basis." You hope that you will be able to live up to the promises you have given them.`
			`	After you return to your ship, JJ says, "So far Freya says there have been no hints of a Navy attack against Dancer, and she has a new set of surveillance satellites up and running in Alpha Arae to monitor fleet activity. So, let's go meet up with her and decide what our next steps should be."`
				accept
	on visit
		dialog `You land on <planet>, but realize that your escort carrying JJ hasn't entered the system yet. Better depart and wait for it to arrive.`



event "battle for zeta aquilae"
	"reputation: Republic" = -1000
	system "Zeta Aquilae"
		fleet "Small Southern Merchants" 5000

mission "FW Rand 1"
	landing
	name "Occupy Zeta Aquilae"
	description "Take a Free Worlds fleet to Zeta Aquilae, drive away whatever Navy ships are there, and then land on Rand, which has decided to join the Free Worlds."
	autosave
	source "Dancer"
	destination "Rand"
	clearance
	passengers 2
	blocked "You need a bunk free for Freya (in addition to JJ) to continue this mission."
	to offer
		has "FW Albatross 2B: done"
	on fail
		dialog `You have failed an essential Free Worlds mission. If you want to complete the story line, revert to the autosave or another earlier snapshot of the game.`
	
	on offer
		log "Another two planets, Rand and Oblivion, have expressed an interest in joining the Free Worlds. They are rather far from the rest of Free Worlds territory, however, so JJ is worried that it would create an indefensible tactical position."
		event "battle for zeta aquilae"
		conversation
			`When you land on Dancer, Freya has just received some exciting news. "It turns out taking out Bartlett had some unexpected side effects," she says. "Bartlett has been hounding the systems on the northeastern fringe of the Dirt Belt for years, and had a lot of enemies. The governments of Rand and Oblivion are so grateful to you for eliminating him that they've reached out to us to begin the process of joining the Free Worlds! And several other worlds in that region are interested now, too."`
			`	JJ frowns. "That's really awful timing," he says, "and would put us in a really bad tactical position - spread out, and with the Navy right in the middle."`
			choice
				`	"Are you saying we shouldn't let them join, even though they want to?"`
				`	"Well, I say, if they want to join us, we should let them. Who knows if they'll be this enthusiastic about the Free Worlds later if we let them down now."`
			`	JJ thinks about that for a moment, then says, "Well, I guess we should let them join. It will mean we may need to launch an assault to drive the Navy off New Iceland. But if we do that, our tactical position shifts from one that's worse than what we have now, to something much better. Freya, did they say if there's any sign that the Navy has gotten word of this?"`
			`	"A few Carriers are in orbit around Rand," she says, "so they must suspect something. But the bulk of the Navy fleet is still to the north and east of here."`
			`	JJ says, "Okay Captain, here's what I propose. We'll leave the bulk of our fleet here to defend Dancer and New Portland, but take a few of our best ships to Zeta Aquilae and drive out the Navy. Freya and I will travel with you so that if we need to make any decisions, we'll have most of the Council there in person. How does that sound?"`
			choice
				`	"It sounds like a good plan. Let's do it!"`
					accept
				`	"I'm still worried we're over-extending ourselves."`
			`	"You may be right," he says. "Freya, what do you think?"`
			`	"I think we need to take this opportunity while it's available," she says. "Sorry, Captain, but I'm with JJ on this one." They both board your ship, and you get ready to travel to Zeta Aquilae.`
				accept
	
	npc
		government "Free Worlds"
		personality heroic disables escort
		ship "Dreadnought" "F.S. Elder"
		ship "Falcon (Plasma)" "F.S. Reliant"
		ship "Falcon (Heavy)" "F.S. Bismark"
		ship "Skein" "F.S. Lapwing"
		ship "Finch" "Bravo 8-4"
		ship "Finch" "Bravo 0-9"
		ship "Finch" "Bravo 6-2"
		ship "Finch" "Bravo 3-1"
		ship "Finch" "Bravo 1-5"
		ship "Finch" "Bravo 9-1"
		ship "Hawk (Rocket)" "F.S. Echo"
		ship "Hawk" "F.S. Shadow"
	npc
		government "Free Worlds"
		personality heroic disables
		system "Kochab"
		ship "Dreadnought" "F.S. Linden"
	
	npc evade
		government "Republic"
		system "Zeta Aquilae"
		personality staying heroic
		fleet 2
			names "republic capital"
			fighters
				names "republic fighter"
			variant
				"Carrier (Mark II)"
				"Lance" 4
				"Combat Drone" 6
				"Gunboat (Mark II)"
	
	on visit
		dialog `You've landed on <planet>, but there are still Navy ships circling overhead. You should take off and help finish them off.`
	on complete
		event "fw expanded and cut"



mission "FW Rand 1B"
	landing
	name "Regroup at Wayfarer"
	description "The Free Worlds fleet has been scattered by a Navy invasion. Regroup with the ships that fled to <destination>, and plan your next move."
	autosave
	source Rand
	destination Wayfarer
	passengers 2
	to offer
		has "FW Rand 1: done"
	on fail
		dialog `You have failed an essential Free Worlds mission. If you want to complete the story line, revert to the autosave or another earlier snapshot of the game.`
	
	on offer
		log "The Navy has invaded Rastaban and Delta Sagittarii, effectively slicing through Free Worlds territory and splitting up the Free Worlds fleet."
		conversation
			`You meet up with the governor of Rand, and sign the papers to make her planet a part of the Free Worlds. The nearby systems are reporting no Navy interference: they seem to have been allowed to switch allegiances without any attempt by the Republic to stop them. Of course, that might partly be because these are mining planets, not as necessary to the Republic's survival as the farming worlds on the other end of the Dirt Belt.`
			`	Freya leaves the meeting to check up on her surveillance network, and rushes back into the room a few minutes later. JJ takes one look at the expression on her face and quickly excuses himself from the table. You join him outside in the hallway, and he asks Freya what's going on.`
			`	"The Navy just invaded Delta Sagittarii and Rastaban," she says. "We're cut off from the rest of Free space. Our defense fleet was woefully outnumbered. Many ships were destroyed, and the rest fled back toward the Rim, or to Tarazed."`
			`	"I was afraid of this," says JJ, "but I didn't think it would happen so quickly. I wonder if they knew that these new worlds were joining us, and deliberately used them as a diversion."`
			choice
				`	"What do we do now?"`
			`	JJ says, "Freya, you said part of our fleet fled to Tarazed?"`
			`	"Yes," she says. "Probably not a strong enough fleet to drive them off, though."`
			`	"Well, I guess we should regroup with them," he says. "Hopefully then we can plan a coordinated strike. Or if necessary, we can abandon this sector and get our fleet back to the Rim without losing too many ships. Captain <last>, can you take us to <destination>?"`
			choice
				`	"Sure."`
					accept
				`	"What if the Navy follows the fleet to Wayfarer? We're three of the four Council members. Shouldn't we avoid a situation where we could all be killed?"`
			`	From JJ's expression, it's clear that he doesn't even want to dignify that question with a response. "If we die, the Free Worlds will live on," he says, "and there's no way we're abandoning a whole section of the fleet just to save our own skins. So, let's go to Wayfarer."`
				accept
	on visit
		dialog `You land on <planet>, but realize that your escort carrying JJ and Freya hasn't entered the system yet. Better depart and wait for it to arrive.`
	
	npc
		government "Free Worlds"
		personality staying timid
		system Tarazed
		ship "Dreadnought" "F.S. Holly"
		ship "Falcon (Plasma)" "F.S. Nebula"
		ship "Skein" "F.S. Larkspur"
		ship "Finch" "Charlie 6-2"
		ship "Finch" "Charlie 0-9"
		ship "Finch" "Charlie 3-1"
		ship "Finch" "Charlie 9-1"
		ship "Finch" "Charlie 1-5"
		ship "Finch" "Charlie 8-4"
		ship "Skein" "F.S. Ironwood"
		ship "Finch" "Echo 5-3"
		ship "Finch" "Echo 4-1"
		ship "Finch" "Echo 2-3"
		ship "Finch" "Echo 5-8"
		ship "Finch" "Echo 2-4"
		ship "Finch" "Echo 6-9"
		ship "Argosy" "F.S. Nightingale"



event "battle of alioth"
	system Rutilicus
		fleet "Small Southern Merchants" 600
		fleet "Large Southern Merchants" 2000
		fleet "Small Southern Pirates" 8000
		fleet "Small Republic" 1000
	system Cebalrai
		fleet "Small Southern Merchants" 600
		fleet "Large Southern Merchants" 2000
		fleet "Small Southern Pirates" 4000
		fleet "Small Republic" 1000
	system Alioth
		fleet "Small Southern Merchants" 400
		fleet "Large Northern Merchants" 600
		fleet "Small Southern Pirates" 1200
		fleet "Large Southern Pirates" 2400
		fleet "Small Republic" 3000
		
event "end battle of alioth"
	system Rutilicus
		fleet "Small Southern Merchants" 600
		fleet "Large Southern Merchants" 2000
		fleet "Small Southern Pirates" 8000
		fleet "Small Republic" 1000
		fleet "Large Republic" 2000
		fleet "Navy Surveillance" 1600
	system Cebalrai
		fleet "Small Southern Merchants" 600
		fleet "Large Southern Merchants" 2000
		fleet "Small Southern Pirates" 4000
		fleet "Small Republic" 1000
		fleet "Large Republic" 2000
		fleet "Navy Surveillance" 1600
	system Alioth
		fleet "Small Southern Merchants" 400
		fleet "Large Northern Merchants" 600
		fleet "Small Southern Pirates" 1200
		fleet "Large Southern Pirates" 2400
		fleet "Small Republic" 3000
		fleet "Large Republic" 4000
		fleet "Navy Surveillance" 1600



government "Syndicate (Hostile)"
	swizzle 4
	color 0 .41 .71
	"display name" "Syndicate"
	"player reputation" -1000
	"attitude toward"
		"Free Worlds" -.3
		"Pirate" -.01
		"Korath" -.01
	"friendly hail" "friendly syndicate"
	"hostile hail" "hostile syndicate"

mission "FW Defend New Tibet"
	landing
	name "The Defector"
	description "Travel to New Tibet to question the Syndicate about the defector supposedly carrying vital evidence and information that they are behind the bombings."
	source Wayfarer
	destination "New Tibet"
	passengers 2
	to offer
		has "FW Rand 1B: done"
	on fail
		dialog `You have failed an essential Free Worlds mission. If you want to complete the story line, revert to the autosave or another earlier snapshot of the game.`
	
	on offer
		log "As a member of the Council, must make the deciding vote on a difficult decision. A defector from the Syndicate is claiming to have proof that the Syndicate was behind the bombings of Martini and Geminus. If that is true, the Republic may agree to make peace with the Free Worlds. But, refusing to return the defector to the Syndicate would certainly earn their enmity."
		conversation
			`The fleet in orbit around Wayfarer is pitifully small, surely not enough to take on more than a couple of Navy capital ships. JJ orders one of their communication officers to try to establish a secure link to Bourne or to any Free Worlds post on the other side of the Navy blockade. After about ten minutes, the officer returns and says, "Sir, we've received communications from New Tibet sent earlier today. You need to talk to them."`
			`	"Our fleet is there?" asks JJ.`
			`	"No sir, it's the Syndicate. The Syndicate has a war fleet in Alioth."`
			`	"What?" says JJ. He rushes into the communication room, and you and Freya follow. "Play the communication," JJ says. On the video screen is a Buddhist monk in a maroon robe; behind him, you see other monks rushing about with none of the serenity you would usually expect of them.`
			`	The monk explains, "I pray that this communication reaches the Council. Yesterday a Syndicate ship landed near our monastery, and the pilot sought refuge with us. He claims to have evidence that the Syndicate, or some faction within the Syndicate, was behind the attacks on Geminus and Martini. Evidence that a certain faction within the Syndicate values economic growth above all else," says the monk, "and incited this war for that reason."`
			`	"That's insane," says Freya.`
			`	"But not completely implausible," says JJ.`
			choice
				`	(Continue watching the communication.)`
			`	The video of the monk continues, "He was unable to show us this evidence, but he made claims of having plans for a nuclear device. After arriving he hid his ship in a cave, just before a Syndicate fleet appeared in orbit. They do not know where the defector landed, so they have begun searching settlement to settlement under the assumption that one is harboring him. They are currently here, wrecking the monastery in their hunt."`
			`	After a moment, JJ says, "If these allegations are true, if we can prove that the Free Worlds was innocent of any involvement in those attacks, the Republic might make peace with us, or at least agree to a ceasefire. I vote that we try to shelter this defector and hear his story."`
			`	"And if it's a lie," says Freya, "and we refuse the Syndicate's request, we lose our only ally. Many more civilians will be killed if we continue to fight without their backing, and we don't even know what this supposed evidence actually is. I care about justice, but trading a definite ally for a slim possibility of peace: that is an unwise investment. I vote that we hand this man over to the Syndicate."`
			choice
				`	(Continue watching the communication.)`
			`	You look back at the video screen to see that the monk is gone, replaced by a man in a Syndicated Security uniform. "Greetings, Councilmembers. I'm sorry for the confusion, but please understand. We're hunting a terrorist. This man claiming that we are the ones that caused the bombings is, in fact, the leader of the extremist group that caused them. He developed the nukes with the help of a faction of pirates looking to profit from the instability, and now, when we're finally close to capturing him, he's attempting to frame us for his own crimes against humanity. Allow us to find him, and we'll-"`
			`	The feed cuts off. "The message ended there," the communications officer says. The room falls silent.`
			`	JJ breaks the silence. "I still say we rescue this defector. The Syndicate could be lying to us. They don't exactly have a reputation for upstanding morality, after all."`
			`	"Or this 'defector' could easily be the one lying," Freya says. "I say we let them have him while we focus on defending against the Navy. If the Syndicate gets their hands on the true terrorist, their support will surely clear our name. Parliament won't be able to ignore the Syndicate vindicating us."`
			`	As the third Council member present, you have the deciding vote, and the entire course of this war may rest on your decision.`
			choice
				`	"I say we rescue the defector, even if it means war with the Syndicate."`
					goto rescue
				`	"I say we let the Syndicate have the terrorist, and focus on winning the battle against the Republic."`
					goto surrender
			label rescue
			`	"Are you sure?" asks Freya. "The Syndicate has done a lot for us in the past."`
			choice
				`	"Yes, I'm sure. We rescue the defector."`
					goto "definitely rescue"
				`	"Fine, we'll hand him over. But I don't think it's the right thing to do."`
					goto "definitely surrender"
			label surrender
			`	"If Katya were here," says JJ, "she would tell us to choose justice over political expedience."`
			choice
				`	"Well, she's not here, and I say we can't afford to lose the Syndicate as an ally."`
					goto "definitely surrender"
				`	"I suppose you're right. Let's mount a rescue operation."`
					goto "definitely rescue"
			
			label "definitely surrender"
			action
				set "fw did not rescue defector"
			`	"Very well," says JJ. "In that case, we'll need to meet with the fleet captains and figure out how to take on the Navy. Let's meet in the spaceport bar in an hour."`
				decline
			
			label "definitely rescue"
			`	JJ seems very relieved at your choice. "I think that's the right choice, Captain," he says. "We can take the fleet we have here, sweep up north to avoid the thickest part of the Navy's occupying fleet, and cut over to New Tibet to question the Syndicate in person."`
				accept
	
	on accept
		event "battle of alioth"
	
	on enter "Alioth"
		"reputation: Syndicate" = -1000
		event "fw at war with Syndicate"
		dialog "You spot the Syndicate fleet orbiting above New Tibet when you enter the system, but to your surprise they begin targeting your ship. They don't seem very interested in answering any questions about the defector."
	
	npc evade
		government "Syndicate (Hostile)"
		personality heroic staying
		system Alioth
		fleet
			names "syndicate capital"
			variant
				"Splinter (Mark II)" 2
				"Manta (Mark II)" 3
				"Quicksilver (Mark II)" 5
	npc
		government "Free Worlds"
		personality heroic escort disables
		ship "Dreadnought" "F.S. Holly"
		ship "Falcon (Plasma)" "F.S. Nebula"
		ship "Skein" "F.S. Larkspur"
		ship "Finch" "Charlie 6-2"
		ship "Finch" "Charlie 0-9"
		ship "Finch" "Charlie 3-1"
		ship "Finch" "Charlie 9-1"
		ship "Finch" "Charlie 1-5"
		ship "Finch" "Charlie 8-4"
		ship "Skein" "F.S. Ironwood"
		ship "Finch" "Echo 5-3"
		ship "Finch" "Echo 4-1"
		ship "Finch" "Echo 2-3"
		ship "Finch" "Echo 5-8"
		ship "Finch" "Echo 2-4"
		ship "Finch" "Echo 6-9"
		ship "Argosy" "F.S. Nightingale"
	
	on visit
		dialog `You've landed on <planet>, but there are still Syndicate ships circling overhead. You should take off and help finish them off.`
	on complete
		"reputation: Republic" = 1
		event "fw armistice"
		event "fw tarazed republic"
		event "end battle of alioth"
		log "People" "Sawyer" `A defector of the Syndicate who decided to risk his life to stop the war between the Republic and the Free Worlds.`
		conversation
			`It doesn't take long to find the monastery that contacted you earlier; nothing is left of it but the burnt-out shells of buildings. You hurry to land and look around for survivors. You find several corpses dressed in maroon robes, some of them badly burnt, but no sign of the defector or the monk who sent the message.`
			choice
				`	(Wait to see if anyone approaches now that the Syndicate fleet is gone.)`
				`	(Give up and contact the rest of the Free Worlds fleet to figure out what to do next.)`
					goto leave
			`	You wait around for a while, but this mountain valley seems to be entirely desolate. Then finally, when you are about to give up hope, Freya spots the distant figures of a few dozen people coming down the side of one of the mountains.`
				goto gunboat
			label leave
			`	You are just about to leave when Freya spots something and points. "Look," she says, "someone is coming down the mountain slope toward us." Sure enough, it's a group of several dozen people wearing the distinctive robes of the monks.`
			label gunboat
			`	As you wait for them to approach, JJ receives a message from one of the militia crews. "Sir, you have incoming! A scout ship, with Republic markings. Apparently unarmed. Shall we intercept them?"`
			`	"Oathkeepers?" asks JJ. "Or ordinary Navy? Who are they?"`
			`	The voice on the other end pauses. "Neither. Navy Intelligence."`
			`	JJ thinks about that for a second, then says, "Let them land. But follow them down, and if you see so much as a hint of them powering up weapons, blow them out of the sky. Understand?" The officer acknowledges his order and signs off.`
			`	As the group of monks approaches from the mountainside, the scout ship comes in for a landing and skids to a halt in the dirt a few dozen meters away. A woman steps off it. She has dark skin, and is dressed entirely in black. Even the whites of her eyes are black: when she gets closer, you can see that it is actually a scleric tattoo, an intricate Celtic knotwork pattern inked into the whites of her eyes. She sees you staring at her, and winks at you with a friendly grin.`
			choice
				`	"I'm Captain <last> of the Free Worlds. What is your business here?"`
				`	"Who are you, and what gives you the right to land on our planet?"`
					goto hostile
			`	"My name is Raven," she says. "I'm here to question this defector. If he is telling the truth, our war with you will end today." She pauses, then adds, grimly, "And, another war will begin."`
				goto questioning
			label hostile
			`	She frowns. "My name is Raven," she says. "I am here to question this defector. If you are interested in knowing the truth, you will allow me to do so."`
			label questioning
			`	The monks approach, and you see that among them is a man in more ordinary attire, who must be the defector. "Now," says Raven, "I will question him alone, on my ship."`
			choice
				`	"No, we insist on being present for your interrogation."`
					goto present
				`	"Very well, we'll wait outside."`
			`	"No!" says JJ. "We're staying here."`
			label present
			`	She hesitates for a long moment. This is probably going against whatever orders she is following. But finally she says, "Very well." The monks step aside. She approaches the defector, and reaches out her hands to him. Hesitantly, he takes her hands. It's an oddly intimate scene, the two of them quietly holding hands and locking eyes - not like any interrogation you have seen before. "Now," she says, "tell me your story."`
			`	"My name is Sawyer," says the man. "I'm a physicist, a Syndicate employee. We had a secret project on Mutiny, a planet in a pirate system. We were developing nuclear weapons." He hesitates, and looks away for a second, then says, "They told me it was for fighting the pirates. I didn't realize otherwise until--"`
			`	"That is a lie," says Raven, calmly.`
			`	He seems flustered. "Okay, they didn't tell me what the weapons were for, and I didn't ask."`
			choice
				`	"Why would the Syndicate attack the Republic?"`
				`	"Why did you wait so long to report this?"`
					goto wait
			`	They both seem surprised at you asking a question. Sawyer says, "War is good for business, especially if you're in the business of making weapons. The Syndicate's profits have more than doubled since this conflict began."`
			`	"What led you to report this?" asks Raven.`
			label wait
			`	He says, "It was when I heard that there had been another major battle. Up until then I had been telling myself that the worst of the damage was done. But after that battle, I knew that millions more could die because of our crime, and that I had the power to stop it."`
			`	Raven continues to ask questions: who was involved, how the facility was hidden, where the raw materials came from. At one point, JJ pulls you aside and says, "She must be a Questioner. How they operate is a tightly kept secret. I'd always assumed their methods were... a bit more medieval."`
			`	Finally, Raven is satisfied, and radios her ship. "He's telling the truth," she tells them. "Send word to the admirals at once. And, release the captive."`
			`	The door of her ship slides open, and another woman steps out - shakily, hesitantly, shielding her eyes against the sunlight. It takes you a few seconds to realize that it's Katya.`
			`	As you all rush over to greet Katya, Raven taps your shoulder and says quietly, "Meet me in the main spaceport in a few hours and we'll figure out what's going to happen next." She returns to her ship.`



mission "FW Liberate Delta Sagittarii"
	name "Liberate Delta Sagittarii"
	description "Lead a Free Worlds fleet to drive the Navy out of Delta Sagittarii. Another fleet ought to be arriving from the Rim at about the same time."
	source Wayfarer
	destination "New Portland"
	clearance
	passengers 2
	to offer
		has "FW Rand 1B: done"
		not "FW Defend New Tibet: done"
	
	on offer
		event "fwc southern battle"
		conversation
			branch surrender
				has "fw did not rescue defector"
			`A few of the Free Worlds crew members are still milling around the spaceport in confusion. You help to gather them together and explain that you are headed out on a very important mission to New Tibet.`
				decline
			
			label surrender
			`When you and Freya enter the spaceport bar, JJ is talking with someone on his communicator. "The code word is 'havoc,'" he says. "Yes, I'm certain. It's the only option we have left. Good luck."`
			`	"What was that about?" asks Freya.`
			`	JJ says, "I was calling in some reinforcements," he says. "A group of ex-militia folks and bounty hunters who want to further the cause of the Free Worlds, but want to do it freelance instead of taking orders from us or the Senate. They call themselves the 'Wolf Pack.' Have you heard of them?"`
			branch know
				has "FW Wolf Pack 2: offered"
			choice
				`	"No, I haven't."`
			`	"Too bad," says JJ, "they've managed to get their hands on some technology I'd love to have access to. But anyway, they've agreed to make an initial strike and fade attack on the Navy fleet to soften them up, before our own fleet gets there."`
				goto plan
			label know
			choice
				`	"Yes, I helped them get access to some better ramscoop technology from the Deep."`
					goto yes
				`	"No, I haven't had any dealings with them."`
			`	"That's odd," says JJ, "I thought they said you helped them to get their hands on the Catalytic Ramscoop. But anyway, they've agreed to make an initial strike and fade attack on the Navy fleet to soften them up, before our own fleet gets there."`
				goto plan
			label yes
			`	"Ah yes," says JJ, "an excellent piece of corporate espionage. A little shady and underhanded, of course, which is why we let the Wolf Pack handle things like that rather than doing it through official channels. But anyway, they've agreed to make an initial strike and fade attack on the Navy fleet to soften them up, before our own fleet gets there."`
			
			label plan
			`	"That'll need to be one hell of a strike for it to make any difference," says Freya.`
			`	"Don't worry," says JJ, "it will be. They've been itching to get into the fray for months now. Captain <last>, we'd like you to fly along with the fleet and help to mop up whatever the Wolf Pack leaves behind in the Delta Sagittarii system. Then we'll land on New Portland and figure out what our next steps are. Freya and I will ride on your ship."`
				accept
	
	on visit
		dialog `You've landed on <planet>, but there are still Navy ships circling overhead. You should take off and help finish them off.`
	on complete
		event "fwc southern liberation"
	
	npc
		government "Free Worlds"
		personality heroic escort
		fleet
			names "free worlds capital"
			variant
				"Falcon (Plasma)"
				"Osprey"
		fleet
			names "free worlds capital"
			variant
				"Falcon (Heavy)"
		fleet
			names "free worlds capital"
			fighters
				names "free worlds fighters"
			variant
				"Skein" 2
				"Finch" 12
		fleet
			names "free worlds capital"
			variant
				"Dreadnought"
	
	npc evade
		personality staying heroic
		system "Delta Sagittarii"
		government "Republic"
		fleet
			names "republic capital"
			fighters
				names "republic fighter"
			variant
				"Carrier (Mark II)"
				"Lance" 4
				"Combat Drone" 6
				"Gunboat (Mark II)" 4
		fleet
			names "republic capital"
			fighters
				names "republic fighter"
			variant
				"Cruiser (Mark II)"
				"Combat Drone" 4
				"Rainmaker (Mark II)" 4
	
	npc
		personality staying derelict
		system "Delta Sagittarii"
		government "Republic"
		fleet
			names "republic capital"
			fighters
				names "republic fighter"
			variant
				"Carrier (Mark II)"
				"Frigate" 2
		fleet
			names "republic capital"
			fighters
				names "republic fighter"
			variant
				"Cruiser (Mark II)"
				"Frigate" 4
	
	npc
		personality staying heroic
		system "Rastaban"
		government "Free Worlds"
		fleet "Large Free Worlds" 4
	npc
		personality staying derelict
		system "Rastaban"
		government "Republic"
		fleet "Large Republic" 2
	npc
		personality staying heroic
		system "Rastaban"
		government "Republic"
		fleet "Large Republic" 2
