# Copyright (c) 2015 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 Reconciliation 1"
	name "Pick up Ijs from <planet>"
	description "Bring Katya and Sawyer to <destination>, along with Raven's ship (the Eye of Horus), and pick up Ijs and his equipment for detecting atomic testing."
	autosave
	source "New Tibet"
	destination "Winter"
	to offer
		has "FW Defend New Tibet: done"
	passengers 2
	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
		personality escort timid
		government "Navy Intelligence"
		ship "Gunboat (Mark II)" "Eye of Horus"
	
	on visit
		dialog "You have reached <planet>, but you left Raven's ship behind! Better depart and wait for them to arrive in this star system."
	
	on offer
		log "Decided to rescue the Syndicate defector rather than turning him over to the Syndicate. A Questioner who works with Navy Intelligence has confirmed that he is telling the truth, and a ceasefire has been declared. Also, the Navy has agreed to release Katya now that there is evidence proving her innocence."
		log "People" "Raven" `Raven, whose full name is unknown, is a Questioner who works for Navy Intelligence. Through some combination of training and natural ability, she is able to reliably detect whether or not someone is telling the truth.`
		log "Factions" "Navy Intelligence" `It is unclear why the Navy needs their own intelligence force, since the Republic already has a Department of Intelligence that is incredibly powerful and well-funded. Rumors say that one of the main purposes of Navy Intelligence is to watch for human rights abuses being committed by the Republic itself and for other questionable activities that the Department of Intelligence might turn a blind eye toward or even collude with.`
		event "fw conservatory founded"
		conversation
			`On your way to the spaceport, you fill Katya in on the state of the war. She says that Intelligence has been keeping her in a relatively comfortable but totally isolated cell; she's not even sure what world it was on. From the fact that her questioners seemed to be growing increasingly frustrated about the Free Worlds, she knew that you were still managing to resist the Navy, but they did not share any details with her.`
			`	You meet up with Raven in a small tea shop, close enough to the spaceport that the tables shake each time another Free Worlds capital ship arrives in response to the Syndicate attack. "Thank you for allowing me to land here," says Raven. "Now, what questions do you have for me?"`
			choice
				`	"Are we at peace with the Republic now?"`
					goto peace
				`	"Are you some sort of mind reader?"`
					goto read
				`	"What exactly is the job of Navy Intelligence?"`
					goto intelligence
			
			label peace
			`	"Well," she says, "only Parliament can decide that. But the Navy has been ordered not to attack Free Worlds ships, and the news that Sawyer brought has become public knowledge, so you'll find that most Republic worlds will be willing to welcome you, now."`
			choice
				`	"Are you some sort of mind reader?"`
					goto read2
				`	"What exactly is the job of Navy Intelligence?"`
					goto intelligence2
			
			label read
			`	She laughs, and says, "No, I'm just a really good listener." When she sees that you're not satisfied with that answer, she elaborates. "The official term for us is 'empaths.' We have a heightened ability to absorb the emotional state of those around us. That, combined with extensive training, makes us better lie detectors than any machine. But if you're asking whether my abilities work through body language and vocal cues, or through some sort of mystical powers, honestly none of us knows that for sure."`
			choice
				`	"Are we at peace with the Republic now?"`
					goto peace2
				`	"What exactly is the job of Navy Intelligence?"`
					goto intelligence2
			
			label intelligence
			`	She says, "I assume your real question is, why does Navy Intelligence exist at all, since the Republic already has a very powerful, well-funded, and nearly omniscient Department of Intelligence that exists independent of the Navy? The short answer is, we don't trust them. Someone needs to watch the watchers."`
			choice
				`	"Are we at peace with the Republic now?"`
					goto peace2
				`	"Are you some sort of mind reader?"`
					goto read2
			
			label peace2
			`	"Well," she says, "only Parliament can decide that. But the Navy has been ordered not to attack Free Worlds ships, and the news that Sawyer brought has become public knowledge, so you'll find that most Republic worlds will be willing to welcome you, now."`
				goto next
			
			label read2
			`	She laughs, and says, "No, I'm just a really good listener." When she sees that you're not satisfied with that answer, she elaborates. "The official term for us is 'empaths.' We have a heightened ability to absorb the emotional state of those around us. That, combined with extensive training, makes us better lie detectors than any machine. But if you're asking whether my abilities work through body language and vocal cues, or through some sort of mystical powers, honestly none of us knows that for sure."`
				goto next
			
			label intelligence2
			`	She says, "I assume your real question is, why does Navy Intelligence exist at all, since the Republic already has a very powerful, well-funded, and nearly omniscient Department of Intelligence that exists independent of the Navy? The short answer is, we don't trust them. Someone needs to watch the watchers."`
				goto next
			
			label next
			`	Katya asks, "What do we do now? Will Sawyer's evidence be enough to end this war?"`
			`	Raven says, "Possibly. Especially because the Syndicate incriminated themselves by chasing after him. But the Syndicate has so much power in Parliament that the more evidence we can collect, the better. And that means we should visit the world where he said the development was done, and look for more evidence there."`
			`	Katya says, "Captain <last>, is Ijs Springborn still working for the Free Worlds?"`
			`	You tell her that the last you heard, Ijs was helping to found a new university on <planet>. She says, "We should bring him with us. Raven, will you be traveling with us too?"`
			`	"Yes," she says. "I'll tell my ship and crew to get ready."`
				accept
	on visit
		dialog `You land on <planet>, but realize that your escort carrying Katya and Sawyer hasn't entered the system yet. Better depart and wait for it to arrive.`



event "fw empty gienah"
	system Gienah
		fleet "Small Core Pirates" 5000

event "fw restore gienah"
	system Gienah
		fleet "Small Core Pirates" 500
		fleet "Large Core Pirates" 800
		fleet "Large Syndicate" 5000

mission "FW Reconciliation 1B"
	name "Travel to <planet>"
	description "Bring Ijs, Sawyer, and Katya to <system>. Destroy any Syndicate ships that are watching you, then land on <planet>. Make sure Raven's ship arrives there as well. You may need to bribe Syndicate worlds to let you refuel."
	autosave
	landing
	source Winter
	destination Mutiny
	clearance
	passengers 3
	blocked "You need another bunk free (for Ijs) in order to continue this mission."
	to offer
		has "FW Reconciliation 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 "fw empty gienah"
		conversation
			`The moment you land Katya is eager to visit the Conservatory and find Ijs. In the time that he has been here, it has grown into a small but bustling community, with crowds of students walking from building to building carrying backpacks and wrapped in thick coats. You find Ijs' office; Katya knocks and says, "Professor Springborn, are you having office hours right now?"`
			`	He recognizes her voice immediately and comes running out of the office to hug her. "Katya! You're free! Is the war over?"`
			`	"Not quite," she says, "but we've found the bombers. Apparently the whole thing was sponsored by the Syndicate. Do you still have those isotopic fingerprints we collected back when this whole thing began?"`
			`	Ijs quickly finds the data and collects his equipment. "I'll just have to let them know I need a substitute for a while," he says.`
			`	Back at the spaceport, you meet up with Raven. "Here's the deal," she says. "We need to get to <planet>, destroy any Syndicate ships that are watching, and then land and hope we have time to collect evidence before more of them arrive. Unless you've got a ramscoop, we may need to bribe our way onto a few Syndicate worlds to refuel. And of course, I'll be counting on you to help keep my ship safe. Any questions?"`
			choice
				`	"No, I'm ready to go!"`
					accept
				`	"Won't they have destroyed any evidence long before we get there?"`
			`	"Probably," she says, "but if they did any testing there, we should be able to pick up the residue. Or at least, my people will be able to, because they've got military grade Navy equipment."`
			`	"So do we," says Ijs, sheepishly.`
			`	Raven looks surprised for a moment, then says, "Never mind, I'm sure there's a good story of how you got your hands on that equipment, but it can wait for another time. Let's get moving."`
				accept
	
	npc accompany save
		personality escort timid
		government "Navy Intelligence"
		ship "Gunboat (Mark II)" "Eye of Horus"
	
	on visit
		dialog "You have reached <planet>, but you've either left Raven's ship behind, or failed to destroy some of the Syndicate ships watching you."
	
	npc evade
		personality heroic staying nemesis
		system Gienah
		government Syndicate
		ship "Splinter (Mark II)" "Silence"
		ship "Quicksilver (Mark II)" "Light-Bearer"
		ship "Manta (Mark II)" "Morning Star"
	
	on complete
		event "fw restore gienah"



mission "FW Reconciliation 1C"
	name "Bring evidence to <planet>"
	description "Travel to <planet>, without you or Raven being killed by the Syndicate, to present your evidence and Sawyer's confession to Parliament."
	landing
	source Mutiny
	destination Earth
	clearance
	passengers 3
	to offer
		has "FW Reconciliation 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 "Collected atmospheric samples from Mutiny, a planet deep in Syndicate space, and verified that a nuclear test has been performed here using isotopes that match those from the attacks on Geminus and Martini. Also found carefully hidden signs of an underground test site."
		conversation
			`You skim low over the surface of <origin>, with the airlock slightly open to allow Ijs to collect atmospheric samples. He's dressed in a pressure suit, and over the suit's radio he says, "Any residue that's here will be very faint. Just a few more minutes."`
			`	Sawyer directs you to the site where the secret development took place. Nothing is left but a wide and slightly overgrown clearing. After checking your radar and seeing no incoming ships, you risk landing. Sawyer says that there were buildings here a few years ago, but now not even their foundations remain, and a sensor sweep for metallic objects turns up nothing, not even as small as a single nail.`
			`	However, Ijs points out a few subtle signs of human habitation. "A clearing like this would normally form in a fire," he says, "but notice, no fire scars on the trees on the edges of the clearing."`
			`	Raven says, "And our geophysical radar is picking up structures underground. Several deep shafts, and rock that's been stressed and fractured by a large explosion. They did a good job of hiding everything else, but if you scar a planet that badly, it doesn't go away. The stones speak."`
			`	As you continue inspecting the site, suddenly Raven's copilot shouts out the door of her Gunboat at you. "Syndicate ships have entered the system! We need to get back to Earth with the evidence, quickly!"`
				launch
	
	npc accompany save
		personality escort timid
		government "Navy Intelligence"
		ship "Gunboat (Mark II)" "Eye of Horus"
	
	on visit
		dialog "You have reached <planet>, but you left Raven's ship behind! Better depart and wait for them to arrive in this star system."
	
	npc
		personality heroic nemesis waiting
		government Syndicate
		fleet "Small Syndicate"
	
	npc
		personality heroic nemesis entering
		government Syndicate
		fleet "Small Syndicate"
	
	npc
		personality heroic nemesis waiting
		government Syndicate
		fleet "Large Syndicate"
		system Markab
	
	npc
		personality heroic nemesis waiting
		government Syndicate
		fleet "Large Syndicate"
		system Alnair



mission "FW Reconciliation 2"
	name "Visit to the Deep"
	description "One of the representatives from the Deep gave you a note requesting that you visit them on <destination>. Travel there with Katya, Ijs, Sawyer, and Raven."
	autosave
	landing
	source Earth
	destination Valhalla
	passengers 3
	to offer
		has "FW Reconciliation 1C: 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
		personality escort timid
		government "Navy Intelligence"
		ship "Gunboat (Mark II)" "Eye of Horus"
	
	on visit
		dialog "You have reached <planet>, but you left Raven's ship behind! Better depart and wait for them to arrive in this star system."
	
	on offer
		"reputation: Deep Security" >?= 1
		log "Parliament still refuses to believe that the Syndicate could have been behind the attacks; the Syndicate has far too much power and influence in the government of the Republic. But, the people of the Deep might be more open to the defector's story."
		event "deep sky tech available"
		conversation
			`As you came fleeing out of Syndicate space with their ships in hot pursuit, you couldn't help noticing that no Republic ships moved to help you or attack your pursuers. Apparently, they are not ready to strike the Syndicate until Parliament has made a decision. As you are waiting for Parliament to hear your evidence, Katya asks you quietly, "So, how are you feeling about our chances here?"`
			choice
				`	"I think our evidence is undeniable. There's no way we could fail to convince them."`
					goto optimism
				`	"I'm worried about how much power the Syndicate has in Parliament. What if they refuse to believe us?"`
					goto pessimism
			
			label optimism
			`	You continue to feel optimistic as Sawyer presents his story and his evidence, corroborated by the additional data collected by Ijs and by Raven's team. But as the members of Parliament begin questioning Sawyer, nearly all their questions sound more like an attack on him than an attempt to learn more about the Syndicate's involvement in the terrorist attacks.`
				goto why
			
			label pessimism
			`	Your pessimism turns out to be justified. The hearing begins well enough, with Sawyer's testimony and the additional evidence collected by Ijs and by Raven's team. But when the floor is opened for questions, nearly every question the members of Parliament ask seems intended not to get to the bottom of the terrorist plot, but to attack or discredit Sawyer.`
				goto why
			
			label why
			`	You can't help but realize how many people here represent Syndicate worlds. One of them, an older man, asks, "What possible reason would the Syndicate have to launch such an attack?"`
			`	Sawyer says, "They have complex mathematical models of the galactic economy, and those models predicted a coming recession, the worst in centuries. This war forestalled that recession. From the perspective of someone who values economic growth above all else, war was a better alternative than recession."`
			`	"That's utter nonsense," says the man. "That's the sort of absurd conspiracy theory that someone with no understanding of business would invent."`
			`	The rest of the hearing is little better, but as you are leaving one of the representatives from the Deep shakes your hand, and you feel a piece of paper being pressed into your palm. You pocket it quietly and open it once you have returned to your ship. It says, "Visit us on Valhalla."`
				accept



mission "FW Navy Out Of Rastaban"
	landing
	destination "Dancer"
	to offer
		has "FW Reconciliation 2: offered"
		karma > 0
	
	on offer
		event "navy out of rastaban" 5
		conversation
			`You receive a brief message from Alondo: "Good news, Captain! As a gesture of good faith the Navy is beginning to pull out of Rastaban and Delta Sagittarii. Those worlds will revert to our control soon. Be sure to tell the others. And, tell Katya I'm very glad she's free and am looking forward to seeing her." You pass on his message to Katya and Ijs.`
				decline



mission "fw tarazed joins"
	landing
	invisible
	to offer
		has "FW Reconciliation 2: done"
		not "FW Reconciliation 2A: done"
		karma > 0
	on offer
		event "fw tarazed joins"
		fail



mission "FW Reconciliation 2A"
	name "Oathkeepers on Farpoint"
	description "Travel to <destination> to meet with the Navy Oathkeepers. Raven's ship will continue to travel with you."
	autosave
	landing
	source Valhalla
	destination Farpoint
	clearance
	passengers 2
	to offer
		has "FW Reconciliation 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 `The governor of Valhalla, in the Deep, has proposed a "police action" to arrest one or more of the Syndicate leaders and bring them to justice. It will be a secret joint operation between the Free Worlds, the Deep, and the Oathkeepers.`
		conversation
			`When you land on Valhalla, a man shows up at your ship and introduces himself as Edrick Flint, the governor of Valhalla. He invites all of you to join him for dinner at his home, which turns out to be an apartment on the twenty-third floor of one of the downtown skyscrapers. There, he introduces you to several other regional governors and authorities.`
			`	"You may be aware," Edrick says, "that the Deep was self-governing before the formation of the Republic. Indeed, during some of the darkest centuries of the space age, the Deep stood out as a beacon of civilization, a place where piracy was not tolerated and all travelers were safe. When we joined the Republic, we retained the authority to police our own territory, and that authority includes the right to track down fugitives who have fled beyond our usual jurisdiction."`
			choice
				`	"You're suggesting a 'police action' against the Syndicate?"`
					goto police
				`	"Wait, before we talk details, are you saying that you believe Sawyer's testimony against the Syndicate?"`
			`	"Everyone believes him," says one of the other governors, "throughout human space, and in Parliament too. We can all see that the evidence is undeniable. What people don't agree on is how to respond to that evidence."`
			label police
			`	"We want to see justice done," says Edrick. "Our proposal is that a fleet under our jurisdiction, but joined by Free Worlds and Oathkeeper vessels, will travel into the Core and arrest at least one of the Syndicate masterminds behind the terrorist attacks. Such an action would satisfy the technical requirements of legality provided that immediately prior to the arrest, one of our courts hears Sawyer's testimony and pronounces that Syndicate individual guilty."`
			choice
				`	"'Technically legal' sounds to me like a euphemism for 'something we know full well is going to get us into trouble.'"`
				`	"How exactly is a fleet of warships going to travel through Syndicate space without a massive battle?"`
					goto travel
			
			`	Ijs laughs at that. "Relax, Captain. I've been doing 'technically legal' stuff for years. It only occasionally goes disastrously wrong. But governor, if the Syndicate sees you coming, you'll need a full-scale war fleet, not just a handful of ships."`
			label travel
			`	"That's why the fleet will be composed of ships from three different organizations," says Edrick. "You will find a reason to travel to Earth with perhaps one of your fancy new Dreadnoughts as an escort. When you arrive, there will just happen to be an Oathkeeper patrol passing through the same system. And a merchant convoy from the Deep. With its own set of escorts, of course."`
			`	"We'd need to know exactly where and on what planet our target lives, prior to entering Syndicate space," says Katya. "And, if you want to have a court trial immediately prior to the arrest, it sounds like Sawyer will need to stay here."`
			`	"Indeed," says Edrick, "but I assure you, he is safer from the Syndicate here than anywhere else in human space, your own territory included. As for locating a target, that's why the Oathkeepers have requested that you visit them on Farpoint."`
			branch tarazed
				karma > 0
			`	The rest of the evening is a more casual time for conversation, with plenty of good food and wine.`
				goto end
			
			label tarazed
			`	The rest of the evening is a more casual time for conversation, with plenty of good food and wine. Alondo sends you a message to inform you that Tarazed has decided to officially join the Free Worlds after having received word of the Parliament hearing, news that brings joy to Katya and Ijs.`
			label end
			`	At one point, Edrick pulls you aside and says, "I've requested that you be granted access to some of the new technology that was developed here during the course of the war. In particular, please find space on your ship for a ramscoop; you will need it for your next mission. And also, here." He hands you a data card. "This is a copy of Sawyer's evidence, in case something happens here. Keep it very, very safe."`
				accept
	
	npc accompany save
		personality escort timid
		government "Navy Intelligence"
		ship "Gunboat (Mark II)" "Eye of Horus"
	
	on visit
		dialog "You have reached <planet>, but you left Raven's ship behind! Better depart and wait for them to arrive in this star system."



mission "FW Reconciliation 2B"
	name "Travel to Stormhold"
	description "Sawyer has named several Syndicate executives who were definitely part of the plot. Travel to the lawless world of Stormhold, where you will be able to purchase information about where those executives live."
	autosave
	landing
	source Farpoint
	destination Stormhold
	clearance
	passengers 2
	to offer
		has "FW Reconciliation 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
		conversation
			branch know
				has "FW Alphas 1.1: done"
			`On Farpoint, you are met by none other than the famous leader of the Oathkeepers, Admiral William Danforth. Even among the Free Worlds Danforth is spoken of with respect due to his courage and levelheadedness in battle and his leadership of countless humanitarian missions.`
				goto introductions
			label know
			`On Farpoint, you are met by Admiral Danforth, the leader of the Oathkeepers who previously assisted you to drive the Alphas and their mercenary fleet away from Poisonwood. He is glad to see you again, and you express your sympathy over the loss of Commander Nguyen; Danforth tells you that his killer was never found.`
			label introductions
			`	Ijs and Katya introduce themselves to Danforth, and Katya says, "Sir, I was a child on Hope when the colony was evacuated. Your ship carried my family to safety, and I've never forgotten how every night during our journey, you would walk through the cargo bay where we were staying and check to make sure all our needs were met. I've never had a chance before now to thank you in person."`
			`	Danforth is surprised. "Councilor Reynolds," he says, "thank you. I followed your career in Parliament with some interest, but it is a shame that we never met in person until now. But I am glad we have this chance to work together at last."`
			`	Raven says, "Governor Edrick mentioned a plan for tracking down the Syndicate executives who were behind the attacks in the Castor and Pollux systems."`
			`	"Indeed," says Danforth. "Southeast of here is a region of uninhabited star systems, a sort of back entrance into Syndicate space. Few ships travel through there, because there is nowhere to refuel, but with a ramscoop or enough fuel capacity, travel is possible. One of the first inhabited worlds on the other side is the lawless world of Stormhold. There, you can surely find a contact who knows enough about the inner workings of the Syndicate to tell you the home of at least a few of our targets... for a price." He hands Katya a large stack of credit chips.`
			`	Raven says, "I'm going to stay here with the Oathkeepers. Captain <last>, it's been a pleasure working with you. We're counting on you to fetch us this information and return here as quickly as possible."`
				accept
	on visit
		dialog `You land on <planet>, but realize that your escort carrying Katya and Mr. Eyes hasn't entered the system yet. Better depart and wait for it to arrive.`



mission "FW Reconciliation 2C"
	name "Return to Farpoint"
	description "Return to <planet> with information about the whereabouts of certain Syndicate executives. Travel via the back route so that the Syndicate is not alerted to your presence."
	autosave
	landing
	source Stormhold
	destination Farpoint
	clearance
	passengers 2
	to offer
		has "FW Reconciliation 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 "Visited a village on a lawless world in northern Syndicate space, and purchased information on the whereabouts of several of the Syndicate executives who were implicated in the terrorist attacks."
		conversation
			`You land near one of the small villages on Stormhold, and after handing out a few small bribes from the money Danforth gave you, finally one of the villagers recalls that a local gang of pirates is led by a former Syndicate manager. With some trepidation, you fly to his stronghold, and he agrees to "do business" with you.`
			`	Katya shows him Sawyer's list of names. "So, these are the bad boys, huh?" he says. Clearly the news of Sawyer's revelations has spread even to this remote world. He looks through the list, and is able to tell you where three of the five men live. "I'd love to see all these bastards taken down," he says.`
			`	You give him the rest of Danforth's money and thank him for helping you - and ask that he keep your visit secret. "No problem," he says. As you are leaving, he adds, "Also, Mister Springborn... you're my hero, man. Glad you're still finding ways to pester the Syndicate." Ijs seems pleasantly surprised to be recognized.`
				accept
	on visit
		dialog `You land on <planet>, but realize that your escort carrying Katya and Mr. Eyes hasn't entered the system yet. Better depart and wait for it to arrive.`



mission "FW Defend Farpoint"
	landing
	name "Defend Farpoint"
	description "Assist the Oathkeepers in defending <planet> from a pirate attack, then land back on the planet."
	autosave
	source Farpoint
	clearance
	passengers 2
	to offer
		has "FW Reconciliation 2C: 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
			`When you land back on Farpoint, Danforth eagerly meets you and asks what information you were able to obtain. You tell him. "So," he says, "one executive on Foundry, and one on Hephaestus. Both of those are core Syndicate planets, with billions of people on them. No way that would work. But this financial guy, Alexander Soylent... your contact says he lives on a giant yacht that sails around the ocean on Nimbus. Now, that's a much more inviting target. And from what Sawyer says, the Syndicate's financial arm were the ones who decided war would be beneficial in the first place."`
			`	As you're talking, one of Danforth's officers runs into the room. "Sir," he says, "we're detecting a pirate fleet incoming."`
			`	Danforth swears. "This is my real job, of course," he explains, "defending the North from pirate invasion. This isn't the first attack we've had to repulse, and lately Parliament has been finding reasons to reassign my best ships elsewhere. Captain <last>, would you be willing to join the defense fleet? We'll finish this conversation once they've been driven off."`
			`	You hurry to your ship and join the defenders...`
				launch
	
	npc
		government "Navy (Oathkeeper)"
		personality heroic
		fleet
			names "republic capital"
			fighters
				names "republic fighter"
			variant
				"Carrier"
				"Lance" 4
				"Combat Drone" 6
				"Cruiser"
				"Combat Drone" 4
				"Rainmaker" 2
		fleet
			names "republic capital"
			fighters
				names "republic fighter"
			variant
				"Cruiser (Mark II)"
				"Combat Drone" 4
				"Rainmaker (Mark II)" 2
				"Gunboat (Mark II)" 2
	
	npc disable
		government Pirate
		system Mintaka
		personality heroic
		fleet
			names "pirate"
			variant
				"Leviathan (Heavy)"
				"Firebird (Plasma)" 2
				"Hawk (Rocket)" 2
		fleet
			names "pirate"
			variant
				"Leviathan"
				"Raven (Afterburner)" 2
		fleet
			names "pirate"
			variant
				"Leviathan (Laser)"
				"Firebird" 3
		fleet
			names "pirate"
			variant
				"Splinter (Laser)"
				"Manta" 2
				"Quicksilver" 5
	
	on visit
		dialog `You've landed on <planet>, but there are still Pirate ships circling overhead. You should take off and help finish them off.`
	on complete
		payment 1000000



mission "FW Embassy 1"
	name "Ambassadors from Earth"
	description "The Republic has agreed to set up an embassy to the Free Worlds. Travel to Earth to meet the ambassadors and escort them to Free space."
	autosave
	landing
	source Farpoint
	destination Earth
	clearance
	passengers 2
	to offer
		has "FW Defend Farpoint: 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
			`As you are landing, Katya tells you, "<first>, we just received a message from the Free Worlds Senate. They've arranged for a Republic embassy to be set up on Bourne, and a Free Worlds embassy on Earth. We've been asked to meet the ambassadors on Earth and escort them to Bourne."`
			`	A few minutes later, Admiral Danforth arrives at your ship. "Captain <last>," he says, "I'd like to thank you for your assistance." He hands you a million-credit chip.`
			choice
				`	"Thank you, sir."`
					goto next
				`	"Wow, this is the biggest planetary defense bounty I've ever heard of."`
			`	"That's purely for you as a private captain, to compensate you for your assistance," he says. "I wouldn't want you to think that I am in any way giving financial support to the Free Worlds, since that would be illegal."`
			`	"Of course not, sir," you say. "Thank you."`
			label next
			`	"Don't mention it," he says, with a wink. "And now, I think it's best that you head to Earth and pick up those ambassadors. From what I hear, now that Raven is not traveling with you, people are beginning to ask questions about what this Free Worlds captain is doing flying all around Republic space unescorted."`
				accept
	on visit
		dialog `You land on <planet>, but realize that your escort carrying Katya and Mr. Eyes hasn't entered the system yet. Better depart and wait for it to arrive.`



mission "FW Embassy 1B"
	landing
	name "Ambassadors to Bourne"
	description "Escort this luxury vessel carrying Republic ambassadors to the Free Worlds capital of <destination>."
	autosave
	source Earth
	destination Bourne
	passengers 2
	to offer
		has "FW Embassy 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
			`Unfortunately, the Republic ambassadors turn out to match all your worst stereotypes of Republic diplomats: dressed in gaudy, impractical clothing, and carrying an absurd amount of luggage. At first you are worried about whether you have enough space for them, but one of them explains that they would not dream of traveling in your dirty old ship; they will be traveling in style, in a Star Queen luxury liner, and your only duty is to ensure their safety. You have little choice but to acquiesce, even though you think they would be far safer on your own ship.`
				accept
	
	npc accompany save
		personality escort timid
		government Republic
		ship "Star Queen" "Lady of the Lake"
	
	on visit
		dialog phrase "generic arrived-without-npc dialog"



event "fw reconciliation break"

mission "FW Reconciliation Break"
	name "Katya and Ijs to <planet>"
	description "Bring Katya and Ijs to <destination> for a well-deserved sabbatical. Then you will be free to spend some time upgrading your ship while you wait for the Senate to select a team of ambassadors."
	autosave
	landing
	source Bourne
	destination Skymoot
	to offer
		has "FW Embassy 1B: done"
	passengers 2
	
	on offer
		log "Dropped off a team of Republic diplomats on Bourne. It seems like for now, the ceasefire is holding, and public opinion is slowly turning to favor the Free Worlds rather than the Syndicate. But the Syndicate leaders must still be brought to justice. The Council will be in touch when they are ready to help launch an attack on the Syndicate."
		conversation
			`From the way Alondo's eyes light up when he sees Katya, you can tell that all he wants to do right now is to get caught up with her and celebrate her freedom. But he plays the part of a good diplomat, escorting the Republic ambassadors to their new quarters. Along the way he makes pleasant small talk with them, complimenting their style and sophistication. Knowing him as well as you do, you can tell he is saving up his more scathing comments about them until they are out of earshot.`
			`	The moment they are dealt with he gives Katya a hug and says, "Katya! So good to have you back with us. The Council has five members once more. I assume you've been told about Tomek's... departure, and <first>'s promotion?" She nods.`
			`	Alondo says, "Unfortunately, we don't have any ambassadors of our own picked out yet. The Senate insists on selecting them, and you wouldn't believe how slowly Senate deliberations move. They've interviewed half a dozen candidates so far, and found none to their liking. It pains me to say this, but we may have succeeded in creating a bureaucracy every bit as inefficient as the one we rebelled against."`
			choice
				`	"No problem. The important thing is, we're at peace, so their decisions can take as long as they need to."`
					goto peace
				`	"Have you volunteered to be one of the ambassadors? You're an obvious choice."`
					goto volunteer
				`	"What do we do while we're waiting?"`
					goto wait
			
			label peace
			`	"At peace for now," says Ijs, "but so far a peace without justice. When the time is ripe, we will strike against the Syndicate."`
				goto wait
			
			label volunteer
			`	Alondo laughs. "No, that's no work for me," he says. "The ambassadors, as prestigious as their role may seem, are little more than a symbolic gesture. And being cooped up in an embassy on a single planet while things of importance are taking place elsewhere is hardly a job I aspire to."`
			`	"So, what will we do while we're waiting for the Senate to pick the ambassadors?" you ask.`
				goto wait
			
			label wait
			`	Alondo says, "We should use this time of peace well, to prepare for another battle ahead. Those Syndicate ships on New Tibet had equipment I've never seen before, and who knows what else the Syndicate has up their sleeves - especially if they've begun producing nuclear weapons. Captain <last>, you should take this time to make sure your ship is as well armed as possible for our next strike. Ijs and Katya, what will you do with this time?"`
			`	Katya glances at Ijs and then says, "I would certainly welcome a small sabbatical, and a chance to spend time together and catch up on all we've missed. Professor Springborn, do you think the Conservatory would extend your leave of absence long enough for us to make a trip to <planet>?"`
			`	Ijs laughs. "That sounds wonderful, Councilor," he says. "<first>, do you think you could bring us there on your way to wherever you go next?"`
			`	You tell him you would be glad to, and you all get ready for yet another journey together.`
				accept
	
	on visit
		dialog `You land on <planet>, but realize that your escort carrying Katya and Mr. Eyes hasn't entered the system yet. Better depart and wait for it to arrive.`
	on complete
		event "fw reconciliation break" 30
		conversation
			`You drop Ijs and Katya off on Skymoot, and wish them well. They both seem eager for a chance to relax, enjoy one another's company, and forget about matters of galactic importance for a while. "We'll see you soon, <first>," says Katya. "Just be sure your ship is in good fighting shape when the time comes to bring the Syndicate to justice."`



mission "FW Reconciliation Break Ends"
	name "Return to <planet>"
	description "Rejoin Ijs, Katya, and Alondo on <destination>."
	landing
	source
		near "Gamma Corvi" 1 100
	destination Bourne
	to offer
		has "event: fw reconciliation break"
		not "FW Embassy 1C: offered"
	
	on offer
		conversation
			`You receive a coded message from Alondo: "The Senate has finished selecting the ambassadors, and all is in readiness for our other work as well. Please meet us back on <planet> as soon as you can."`
				accept



mission "FW Embassy 1C"
	landing
	name "Ambassadors to Earth"
	description `Escort a Dreadnought carrying Free Worlds ambassadors to Earth. This Dreadnought will then take part in your combined "police action" against the Syndicate.`
	autosave
	source Bourne
	destination Earth
	clearance
	passengers 2
	blocked "You do not have bunks available for Ijs and Katya. Return here when you do."
	to offer
		has "event: fw reconciliation break"
	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 Bourne you discover that Katya and Ijs have already been back there for a week. Alondo is with them, too. "We just couldn't stay away from the action for long," says Ijs.`
			`	The Star Queen luxury liner that brought the Earth ambassadors to Bourne is still parked in a somewhat out-of-the-way hangar. "Don't worry, Captain," says Katya, "there's no way our ambassadors would travel in something as gaudy as that. They've requisitioned a Dreadnought instead. A good ship to remind the people of Earth that we have a strong fleet of our own."`
			`	"Not to mention," says Ijs, "a good ship to take part in our strike against the Syndicate."`
			`	Alondo introduces you to the Free Worlds ambassadors who will be returning to Earth. "I've already contacted Governor Flint and Admiral Danforth," he says. "Their ships will be arriving in the Sol system about the same time as yours. Good luck, Captain." You help Ijs and Katya load their luggage onto your ship, and tell the Dreadnought carrying the ambassadors to be ready to follow you.`
				accept
	
	npc accompany save
		government "Free Worlds"
		personality escort heroic
		ship "Dreadnought" "F.S. Gibraltar"
	
	on visit
		dialog "You have reached <planet>, but you left the ambassadors behind! Better depart and wait for them to arrive in this star system."
	
	npc
		government Pirate
		system Wei
		personality heroic nemesis
		fleet
			names "pirate"
			variant
				"Raven (Afterburner)" 6
	
	npc
		government Pirate
		system Hintar
		personality heroic nemesis
		fleet
			names "pirate"
			variant
				"Leviathan (Heavy)"
				"Firebird (Plasma)" 2
		fleet
			names "pirate"
			variant
				"Leviathan"
				"Firebird" 2
	
	npc
		government Pirate
		system Markab
		personality heroic nemesis
		fleet
			names "pirate"
			variant
				"Splinter (Laser)" 2
				"Manta" 3
				"Quicksilver" 6



mission "FW Syndicate Capture 1"
	landing
	name "Raid on Nimbus"
	description "Travel to <destination> along with ships from the Oathkeepers, the Deep, and the Free Worlds, to capture Alexander Soylent, a Syndicate executive. Do not allow your escorts to be destroyed."
	autosave
	source Earth
	destination Nimbus
	clearance
	passengers 2
	to offer
		has "FW Embassy 1C: 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 "Preparing to invade Syndicate space with a joint strike force made up of Free Worlds, Deep security, and Oathkeeper ships. The plan is to capture one of the Syndicate executives and bring him to trial."
		conversation
			`You land on Earth and make a show of being very busy ensuring that the Free Worlds ambassadors are comfortable and well cared for, until finally you receive a secure message from Edrick. He tells you that the convoy from the Deep is landing on Mars right now, and an Oathkeeper Cruiser is visiting the shipyard on Luna. As soon as you are ready, you can take off, and travel together into the heart of Syndicate space.`
			`	You make an excuse to depart, and return to your ship. "Well," says Ijs, "this is it. If we're lucky, they won't see us coming, but no matter what, getting back out of Syndicate space will be a nightmare. Good luck, all."`
				accept
	on visit
		dialog `You have reached <planet>, but you left one of your escorts! Better depart and wait for them to arrive in this star system.`
	
	npc accompany save
		personality escort heroic
		ship "Dreadnought" "F.S. Gibraltar"
		government "Free Worlds"
	
	npc accompany save
		planet "Luna"
		personality escort heroic waiting
		government "Navy (Oathkeeper)"
		ship "Cruiser (Mark II)" "N.S. Hand of Justice"
	
	npc accompany save
		planet "Mars"
		personality escort heroic waiting
		government "Deep Security"
		ship "Bactrian" "Unbreakable"
		ship "Aerie" "Eagle's Eye"



event "fw begin syndicate capture"
	"reputation: Syndicate" <?= -100
	government "Syndicate"
		"attitude toward"
			"Deep Security" -.01
			"Navy (Oathkeeper)" -.01

event "fw end syndicate capture"
	government "Syndicate"
		"attitude toward"
			"Deep Security" 0
			"Navy (Oathkeeper)" 0

mission "FW Syndicate Capture 1B"
	landing
	name "Escape to <planet>"
	description "You have captured the Syndicate executive Alexander Soylent. Now, bring him safely to <planet>, where he will face trial."
	source Nimbus
	destination Valhalla
	passengers 2
	to offer
		has "FW Syndicate Capture 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 "fw begin syndicate capture"
		conversation
			`As you approach the planet, your ships spread out and begin scanning the ocean surface for a yacht matching the description you were given. After a few tense moments of wondering if Soylent is off-world at the moment, you find the ship.`
			`	With neither deflector shields nor any weaponry that you can see, the yacht clearly poses no threat to an armed starship. The Aerie that Edrick sent launches its two fighters; when they land on the yacht's deck, armed police officers emerge. Meanwhile your fleet is ready to open fire at the first sign of resistance.`
			`	The officers soon radio you that they have found Soylent, and they bring him aboard your ship. Amid all the confusion, you notice a figure in diving gear who jumps off the rear of the yacht and disappears beneath the waves - one of Soylent's men, trying to escape. But since his leader is now in your custody, and your mission is accomplished, you see no reason to chase after him.`
			`	The Oathkeeper captain sends you a brief message: "Your first priority is to reach the Deep with the prisoner. Our crew is prepared to serve as a rearguard, staying behind if necessary to ensure that you survive. Good luck, Captain."`
				accept
	on visit
		dialog `You land on <planet>, but realize that your escort carrying Katya and Mr. Eyes hasn't entered the system yet. Better depart and wait for it to arrive.`
	on complete
		event "fw end syndicate capture"
	
	npc
		personality escort heroic
		ship "Dreadnought" "F.S. Gibraltar"
		government "Free Worlds"
	npc
		personality escort heroic waiting
		government "Navy (Oathkeeper)"
		ship "Cruiser (Mark II)" "N.S. Hand of Justice"
		ship "Combat Drone" "Red One"
		ship "Combat Drone" "Red Two"
		ship "Combat Drone" "Red Three"
		ship "Combat Drone" "Red Four"
	npc
		personality escort heroic waiting
		government "Deep Security"
		ship "Bactrian" "Unbreakable"
		ship "Aerie" "Eagle's Eye"
		ship "Dagger" "Alpha One"
		ship "Dagger" "Alpha Two"
		ship "Dagger" "Alpha Three"
		ship "Dagger" "Alpha Four"
		ship "Dagger" "Alpha Five"
	
	npc
		government Syndicate
		personality heroic nemesis entering
		fleet
			names "syndicate capital"
			variant
				"Splinter (Mark II)" 2
				"Manta (Mark II)" 3
				"Quicksilver (Mark II)" 4
	npc
		system Ruchbah
		government Syndicate
		personality heroic staying nemesis
		fleet
			names "syndicate capital"
			variant
				"Protector (Laser)"
				"Protector" 3
				"Wasp" 12
	
	npc
		system Ankaa
		government Syndicate
		personality heroic nemesis staying
		fleet
			names "syndicate capital"
			variant
				"Manta (Nuclear)"
	npc
		system Ankaa
		government Syndicate
		personality heroic nemesis staying
		fleet
			names "syndicate capital"
			variant
				"Manta (Nuclear)"
	npc
		system Ankaa
		government Syndicate
		personality heroic nemesis staying
		fleet
			names "syndicate capital"
			variant
				"Manta (Nuclear)"
	npc
		system Scheat
		government Syndicate
		personality heroic nemesis staying
		fleet
			names "syndicate capital"
			variant
				"Manta (Nuclear)"
	npc
		system Scheat
		government Syndicate
		personality heroic nemesis staying
		fleet
			names "syndicate capital"
			variant
				"Manta (Nuclear)"
	npc
		system Scheat
		government Syndicate
		personality heroic nemesis staying
		fleet
			names "syndicate capital"
			variant
				"Manta (Nuclear)"
	npc
		system Sheratan
		government Syndicate
		personality heroic nemesis staying
		fleet
			names "syndicate capital"
			variant
				"Manta (Nuclear)"
	npc
		system Sheratan
		government Syndicate
		personality heroic nemesis staying
		fleet
			names "syndicate capital"
			variant
				"Manta (Nuclear)"
	npc
		system Sheratan
		government Syndicate
		personality heroic nemesis staying
		fleet
			names "syndicate capital"
			variant
				"Manta (Nuclear)"
	
	on enter Ankaa
		dialog
			`There is a warning light on your ship's main control panel that has never turned on. It is a relic of the dark age of galactic travel, part of a sensor system that is built into every starship, to detect incoming nuclear warheads. You had almost forgotten it even existed, because you have never seen it flash.`
			`	It begins flashing now.`
	on enter Scheat
		dialog
			`There is a warning light on your ship's main control panel that has never turned on. It is a relic of the dark age of galactic travel, part of a sensor system that is built into every starship, to detect incoming nuclear warheads. You had almost forgotten it even existed, because you have never seen it flash.`
			`	It begins flashing now.`
	on enter Sheratan
		dialog
			`There is a warning light on your ship's main control panel that has never turned on. It is a relic of the dark age of galactic travel, part of a sensor system that is built into every starship, to detect incoming nuclear warheads. You had almost forgotten it even existed, because you have never seen it flash.`
			`	It begins flashing now.`



mission "FW Syndicate Capture 1C"
	landing
	name "Return to <planet>"
	description "The Syndicate is massing a fleet in the Sol system. Return to <planet> to rendezvous with the Free Worlds fleet in order to be ready to defend Earth if it is attacked."
	autosave
	source Valhalla
	destination "New Tibet"
	passengers 2
	to offer
		has "FW Syndicate Capture 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 `Succeeded in capturing a Syndicate executive named Alexander Soylent, but the Syndicate has responded by sending a massive fleet to Sol, supposedly to "protect" Earth but more likely to put pressure on Parliament and the people of Earth to side with the Syndicate.`
		event "syndicate occupies sol"
		conversation
			`Edrick meets you soon after you land, and oversees the transfer of your captive to a local, well-defended jail. You tell him about your narrow escape from Syndicate space, and the fact that the Syndicate used nuclear weapons against your fleet, in violation of the rules of war that humankind has abided by for centuries.`
			`	"Unfortunately," says Edrick, "all the other witnesses to that event were allied with the Syndicate, so people will believe whatever they want to believe. Already the Syndicate is spreading stories about a renegade fleet of rebels and extremists that attacked one of their worlds in an assassination attempt on one of their leaders. Worse, they've taken this as an excuse to send a massive Syndicate fleet to the Sol system - to defend Earth from attack, they say."`
			choice
				`	"Sounds more like the goal is to intimidate Parliament into siding with the Syndicate."`
					goto intimidate
				`	"Are they attacking the Republic ships, or are they still technically at peace?"`
					goto peace
				`	"We should attack them immediately, before they are able to harm anyone on Earth."`
					goto attack
			
			label intimidate
			`	"Indeed," he says.`
				goto katya
			label peace
			`	"Apparently no one is shooting at anyone else," says Edrick, "but that could change at any minute. You may be aware that there is very little love for the Syndicate among Navy admirals. The only thing keeping the Navy from attacking the Syndicate now is the Navy's devotion to order and obedience; they won't start a new war without Parliament's approval, and of course that approval is unlikely with Syndicate warships circling overhead."`
				goto katya
			label attack
			`	"That would be a terrible idea," he says. "First, it would play right into their narrative. And second, humanity is on the very brink now of shattering into half a dozen different splinters: the Deep, the Free Worlds, the Navy, the Syndicate each on their own against the rest. I don't want to be the one who gives the order that causes that to happen."`
				goto katya
			
			label katya
			`	Katya says, "It sounds like if the Free Worlds enters Sol, we'll be the spark that sets off an explosion. So, we'll have to trust the Deep, or the Navy, or someone else to try to defuse the situation. Meanwhile, I suggest we return to Free space and muster our entire fleet, to assist the Navy against the Syndicate if it comes to that. JJ ought to be on <planet>; we can meet up with him there."`
				accept
	on visit
		dialog `You land on <planet>, but realize that your escort carrying Katya and Mr. Eyes hasn't entered the system yet. Better depart and wait for it to arrive.`



mission "FW Pug 1"
	landing
	name "What happened to Rand?"
	description "Try to determine why communications with Rand in the Zeta Aquilae system were cut off. If you cannot reach Rand, at least look for anything odd in the neighboring systems."
	autosave
	source "New Tibet"
	waypoint "Cebalrai"
	waypoint "Ascella"
	to offer
		has "FW Syndicate Capture 1C: 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 "All communications with Rand, which recently joined the Free Worlds but is close to Syndicate territory, have been cut off. It is possible that this is the beginning of a Syndicate invasion."
		event "pug invasion"
		event "pug invasion 2" 6
		event "pug invasion 3" 10
		event "pug invasion 4" 14
		"reputation: Pug" >?= 1
		conversation
			`As soon as you land on <origin>, JJ comes running up to your ship. "<first>," he says, "we have serious trouble. A few minutes ago I received a distress call from Rand, then their transmission was cut off. I'm afraid the Syndicate may be expanding into our space."`
			choice
				`	"Is our fleet ready to respond?"`
				`	"What should we do?"`
			`	"Our fleet is still scattered throughout this quadrant," he says, "and I'll need Katya to command a part of it. Right now I just need you to travel to Rand, if possible, and find out what's going on. It could just be a communications malfunction, but I seriously doubt it. Meanwhile, Katya and Ijs can help me with organizing the fleet."`
				accept
	on visit
		dialog phrase "generic waypoint on visit"
	
	on enter "Cebalrai"
		dialog
			`Based on your previous maps of this sector, there should be a hyperspace link from here to the Rasalhague system. But your sensors show nothing. Something has severed the link.`
	on enter "Ascella"
		dialog
			`The Ascella system used to be linked to Rasalhague and Zeta Aquilae, but no longer. Either the Syndicate has discovered the ability to alter hyperspace links, and is using it to block the Free Worlds from interfering with them, or you have a much stranger problem on your hands...`
	on waypoint
		set "fw pug 1: visited waypoints"



mission "FW Pug 1 Tundra"
	landing
	source "Tundra"
	to offer
		has "FW Pug 1: active"
	
	on offer
		log "No one on Tundra, which is one of Rand's neighbors, has any idea how the hyperspace link was cut off. They wonder if this might have something to do with a star system near Rand that was inaccessible by hyperdrive."
		conversation
			`You land on Tundra and ask around to see if anyone knows why the hyperspace link to Rasalhague is gone. Everyone is talking about it, but no one seems to have a believable theory. "Maybe that odd star out past Rasalhague, the one you can't jump to, went nova," suggests one captain.`
			`	You also talk with several people who mention that the northern lights have been spectacular the last few days, unlike anything they had ever seen before.`
				decline



mission "FW Pug 1 Arabia"
	landing
	source Arabia
	to offer
		has "FW Pug 1: active"
	
	on offer
		log "No one on Arabia knows what has caused hyperspace links in this region of space to suddenly disappear. There are stories of graviton surges and an alien ship, but they may all just be rumors."
		conversation
			`You land on Arabia and try to find someone who knows what is going on, but everyone seems just as confused as you are. The spaceport authorities say that their sensors picked up a massive graviton surge when the hyperlinks collapsed, but they are not sure whether the surge caused the collapse, or was a result of it.`
			`	One merchant captain claims that he was in orbit at the time, and he saw a ship unlike anything he'd ever seen before, that appeared and then disappeared in a flash "just like those Quarg ships do." You aren't sure whether or not to believe him.`
				decline



mission "FW Pug 1 Return"
	landing
	to offer
		has "FW Pug 1: active"
		has "event: pug invasion 4"
		has "fw pug 1: visited waypoints"
	
	on offer
		conversation
			`You receive an urgent message from JJ: "Captain <last>, return to New Tibet at once! We've received word that the Syndicate is somehow severing their hyperspace connections to the rest of human space. We're calling an emergency Council meeting, to convene as soon as you arrive here."`
				decline



mission "FW Pug 2"
	landing
	name "Meet with Parliament"
	description "Travel with Alondo to Earth to meet with Parliament. They are now much more willing to meet with you given how real the Syndicate threat seems."
	autosave
	source "New Tibet"
	destination "Earth"
	clearance
	to offer
		has "FW Pug 1: done"
	passengers 1
	blocked `As you are landing, Alondo contacts you and says, "Do you have a bunk free for me?" You do not, so you will need to free one up in order 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
		log "The Syndicate may be cutting off the hyperspace links that join their territory to the rest of human space, in order to escape being punished for their crimes. People are worried that they will try to take over even more territory, including Earth itself."
		conversation
			`By the time you arrive, Alondo and Freya have joined JJ and Katya on New Tibet; the entire Council is present. "Here's the story," says JJ. "A few weeks ago, hyperspace links on the edge of Syndicate space began collapsing. We weren't sure why. Then, more recently, the Syndicate fleet that had been occupying the Sol system retreated to Syndicate space - and the moment the last of their ships left, the hyperspace link disappeared behind them. We think the Syndicate has found a way to alter hyperspace links and is using it to wall themselves in, to escape retribution from the rest of humanity now that their guilt is so conclusively proven."`
			choice
				`	"Why don't we just let them go, then?"`
					goto go
				`	"What is the Republic planning to do in response?"`
					goto republic
			
			label go
			`	Freya says, "Somehow, they managed to annex several of our systems in the process of walling themselves off - our two best suppliers of heavy metals. That suggests that any of our systems on the border with the Syndicate may be taken over, and made completely inaccessible to us, at any time. That's not a risk we can take."`
			`	"And it's not just that," says Katya. "Think of how many workers are on Syndicate worlds right now, having left their families on a different planet in order to go earn money in a Syndicate factory for a few years. Imagine a future where those families are forever divided."`
				goto communications
			
			label republic
			`	"They're in a panic," says Katya. "Earth is on the very boundary of the area that was cut off, and that means at any moment, they could choose to cut off humanity's homeworld from the rest of human space. And we don't even know if it is possible to restore the links once they have been cut."`
				goto communications
			
			label communications
			`	"According to our embassy," says Alondo, "all communications links with Syndicate space have been cut. The Net relies on hyperspace links to transmit messages, and there are no transmitter relays in the uninhabited systems that now form the only remaining link to Syndicate space."`
			`	JJ says, "The Senate has agreed that we must put our differences with the Republic aside, and meet with Parliament immediately to deal with this crisis. <first>, we're asking you and Alondo to go to Earth, and lend your assistance as you see fit. Any questions?"`
			choice
				`	"No, I'm ready to go."`
					accept
				`	"How do we know the Syndicate is really behind this?"`
			
			`	"We don't," says JJ, "but this all certainly plays out very well for them; their section of the galaxy has suddenly become a very defensible enclave. And the timing of that fleet leaving, and then the link closing - it's too much to be a coincidence. But we can't learn anything for sure by staying here talking; you must go to Earth."`
				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.`
	
	npc
		system "Sol"
		personality heroic uninterested staying
		government "Republic"
		fleet "Large Republic" 5
		fleet "Small Republic" 5



mission "FW Pug 2A"
	landing
	name "Reason with the Syndicate"
	description "Travel with Alondo to meet with the Syndicate leaders on Foundry, determine their intentions, and convince them not to completely seal themselves off from human space. Hurry, before they cut the last link."
	autosave
	source "Earth"
	destination "Foundry"
	clearance
	passengers 1
	to offer
		has "FW Pug 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 "Agreed to travel to Syndicate space through the one remaining hyperspace path that is still open, through the uninhabited star systems to the north."
		conversation
			`A palpable sense of fear and near-panic hangs over the spaceport on Earth. At any minute, this system that serves as the very hub of human government could disappear into the same unknown abyss that has swallowed up its neighbors.`
			`	Parliament is eager now to meet with you and to receive whatever assistance you may be able to offer. As Alondo stands in front of the chamber asking the members of Parliament for more information, they answer him with respect and deference, far different from how you have been treated here in the past. You learn that although one link remains open to Syndicate space, no one has dared to travel through it. Given the pace at which the other links were cut, they fear that the one remaining link will disappear any day now.`
			`	As the conversation continues, it eventually becomes clear why you have been called here: the Republic wants you to take on the risk none of them is willing to face, and travel through to Syndicate space to reason with their leaders.`
			choice
				`	"If this is what it takes to keep human space from being torn into fragments, I will risk my ship to go meet with the Syndicate."`
					goto yes
				`	"This sounds like a job for the Navy, not for me. I can't risk being trapped in hostile Syndicate space forever."`
					goto no
				`	"Did the Syndicate communicate anything to you before the links were cut, that might help us guess at their intentions?"`
			
			`	One of the members of Parliament says, "It's all terribly confusing. Our sources in Syndicate space were reporting massive fleet movements just before it happened. We also heard rumors of Syndicate fleets fighting each other, some sort of internal power struggle."`
			`	Another man speaks up and adds, "We had also been aware for some time that the Syndicate had gained access to alien technology, through encounters with a nomadic alien species currently inhabiting the galactic core. They may have found a way to use that technology to alter the links." From the surprised expressions on the faces of many of the other members of Parliament, it's clear that this information is new to them.`
			choice
				`	"Very well, we will accept this mission."`
					goto yes
				`	"Sorry, I'm not willing to risk my ship over this."`
					goto no
			
			label no
			`	Alondo says, quietly but firmly, "Captain <last>, the Senate has asked you to assist the Republic in this matter, and the Council agrees. I know the risk is great, but you swore to serve the Free Worlds, and the Free Worlds are now commanding you to take this mission."`
			`	"Very well," you say, "I accept. But I'm afraid of what will happen when we reach Syndicate space."`
			
			label yes
			`	Parliament thanks you for your willingness to serve, and you and Alondo hurry back to your ship. "There's no telling how long the link will remain open," he says. "So, we must hurry to the Syndicate headquarters on <planet> immediately."`
				accept
	on enter
		system
			government "Syndicate"
		"reputation: Syndicate" = 1
		event "fw syndicate welcoming"
	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.`
	
	npc
		system "Sol"
		personality heroic uninterested staying
		government "Republic"
		fleet "Large Republic" 5
		fleet "Small Republic" 5



mission "FW Pug 2A Visit"
	landing
	source
		near "Achernar" 1 100
		government "Syndicate"
	to offer
		has "FW Pug 2A: active"
	
	on offer
		conversation
			`Oddly, when you land on <origin> you find that the people here are in as much of a state of confusion and fear as back on Earth. Either no one knows what is going on and why they have been nearly cut off from the rest of human space, or every single person you talk to is united in a conspiracy to feign ignorance. They urge you to continue your journey to meet with the Syndicate executives on Foundry. "Maybe you can talk some sense into them," says one merchant captain. "First the nukes, and now this. The extremist faction within the Syndicate is getting out of hand."`
				decline



mission "FW Pug 2B"
	landing
	name "Install a Jump Drive"
	description "Travel to the Syndicate world of Hephaestus, where the Syndicate Systems personnel have been instructed to install a jump drive on your ship, so that you can investigate the systems that the Pug has cut off."
	autosave
	source "Foundry"
	destination "Hephaestus"
	to offer
		has "FW Pug 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 Syndicate CEO claims that the disappearing hyperspace links are not their doing, and that in fact they are under attack by aliens. In fact, they say that the Syndicate has had contact with two different alien species in this region - raiders and scavengers known as the Korath coming from the galactic core, and an enigmatic and irrational species named the Pug who occupy the system adjacent to the ones that recently got cut off from human space."
		log "By plundering the Korath raiders, the Syndicate has acquired some jump drives, which allow a ship to travel between systems that are not connected by hyperspace links. They are willing to part with one of these jump drives in order to prove the truth of their story to the rest of humanity."
		conversation
			`As you are coming in for a landing you announce yourselves to the spaceport authorities as diplomatic representatives of the Free Worlds and the Republic. The moment you have landed, a Syndicate employee meets you and escorts you to their headquarters, to the incredibly fancy corner office of Alastair Korban, the CEO of the entire Syndicate Corporation. "I'm very glad you've come," says Alastair. "It seems unlikely that we can defeat this attack unless we work together."`
			`	"Wait," says Alondo, "you're saying this whole thing is not the Syndicate's doing?"`
			`	Alastair seems taken aback. "Of course not. Seal off valuable trade routes? Why would we do that?"`
			choice
				`	"We thought you were walling yourselves off to escape prosecution for your acts of terrorism."`
				`	"If it isn't you, then who is it?"`
					goto who
			
			`	Alastair says, "That terrorism was the action of a certain extremist faction that we have since purged from our ranks, and we were in the process of hunting down the perpetrators. Your raid on Nimbus interrupted those plans and gave the others a chance to go into hiding, but we will see to it that they, too, are brought to justice. But now, we need to put the past behind us and figure out how to work together against our common foe."`
			choice
				`	"I think you're lying. You had years to turn over those extremists, and you did not."`
				`	"Very well. Who is this common foe? You seem to know more than we do."`
					goto who
			
			`	"We are deeply, deeply sorry for the actions of these extremists," says Alastair, "and for our own inaction in turning them in. We had hoped that we could deal with them internally, without it becoming public knowledge that we were connected with them. That was a foolish choice for us to make, and we are more than willing to make whatever reparations you demand."`
			choice
				`	"You are aware that you started a war, right? Every Navy or Free Worlds militia member who died fighting each other is your responsibility."`
				`	"Okay, we'll deal with that later. For now, tell us everything you know about whoever is attacking you."`
					goto who
			
			`	"<first>, enough," says Alondo. "We'll sort out the reparations later. For now, we need to know who is severing the hyperspace links."`
			
			label who
			`	"They are called the Pug," says Alastair, "an irrational alien species that previously inhabited a single star system in between Syndicate and Republic space. They have since expanded their territory to include all the human systems neighboring their own star, and have essentially made those human worlds into their slaves."`
			`	"How do you know this?" asks Alondo.`
			`	Alastair pauses for a minute as if trying to figure out the best way to explain himself, then says, "One of our ships traveled to the occupied systems, using a jump drive that we... acquired... from another alien species." He seems to realize how unlikely that sounds, and backpedals. "For years we've been dealing with occasional raids from a species called the Korath. As best we can tell, they're nomadic scavengers and pirates who currently inhabit the galactic core. Over the years we have disabled several of their ships and stolen their jump drives."`
			choice
				`	"Did it not occur to you that attacking the Korath might anger other alien species?"`
					goto anger
				`	"Wait, now there are two different alien species involved? Your story is getting even more convoluted and unbelievable."`
					goto convoluted
			
			label anger
			`	"That is unlikely. The equipment we stole from the Korath is most likely something they stole from someone else."`
				goto help
			
			label convoluted
			`	"Yes," he says, "it is a very convoluted mess. Which is why we need your help."`
				goto help
			
			label help
			`	"Assuming you're telling the truth," says Alondo, "what sort of help do you need from us?"`
			`	Alastair says, "We have only seven jump drives, so whatever fleet attacks the Pug can only contain seven ships. Unless the Quarg or someone else will give you more drives, I suppose. So those ships must be stronger than any ship we have here in Syndicate space, because the Pug are very strong. They obliterated our fleet that had been occupying the Sol system, even though that fleet was armed with the majority of our nuclear arsenal."`
			choice
				`	"You're saying you'll provide the jump drives, and we'll provide the ships? Sounds fair enough."`
					goto deal
				`	"Wait, you're saying that your fleet that was in orbit around Earth... was armed with nuclear weapons? Are you genocidal?"`
			
			`	Alastair seems like the kind of person who seldom admits he is wrong, but your question definitely flusters him. "Okay, okay, I admit, we've been making one bad decision after another ever since... well, since that first bad decision. It just got out of control. We thought the Navy was going to raid us and put us all behind bars. We thought we needed a deterrent. It was stupid. I admit it, okay? Now please, let's just move on. We need your capital ships, and you need our jump drives."`
			
			label deal
			`	"Hold on," says Alondo, "I have one condition to add. You will give us one of your jump drives immediately. We will install it in our ship and verify that you are telling the truth about the Pug. If you are, we will work together until this threat is dealt with... and once it is dealt with, we will return our attention to bringing every member of the Syndicate who had a hand in those terrorist attacks to justice. That is our best and final offer." You nod in agreement.`
			`	It's clear that Alastair is none too happy about that deal, but he accepts it. "The jump drives are all being kept on Hephaestus," he says. "Our Systems division was trying to discover the secret behind them, with little success. If you travel there, I'll tell them to install one of the drives in your ship."`
				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 Pug 2C: Hyperdrive"
	landing
	name "Investigate the Pug"
	description "Travel to the Deneb system to investigate the Pug; if possible, make contact with them and determine what their goals and desires are."
	source Hephaestus
	destination Pugglemug
	clearance
	to offer
		has "FW Pug 2B: done"
		not "fw given jump drive"
		not "outfit (flagship installed): Jump Drive"
	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
		outfit "Hyperdrive" -1
		conversation
			`You are directed to land in a hangar some distance away from the spaceport, in a cluster of buildings owned by Syndicated Systems. A team of engineers meets you and quickly and efficiently removes your hyperdrive and replaces it with a strange, alien-looking device that you assume must be a jump drive. "Now, be careful with your fuel gauge," one of them tells you. "This thing guzzles twice as much fuel per jump as an ordinary hyperdrive, and you don't want to become stranded while outside human space."`
				accept
	
	on accept
		outfit "Jump Drive" 1
		set "fw given jump drive"
	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
		set "FW Pug 2C: done"



mission "FW Pug 2C: Scram Drive"
	landing
	name "Investigate the Pug"
	description "Travel to the Deneb system to investigate the Pug; if possible, make contact with them and determine what their goals and desires are."
	source Hephaestus
	destination Pugglemug
	clearance
	to offer
		has "FW Pug 2B: done"
		not "fw given jump drive"
		not "outfit (flagship installed): Jump Drive"
	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
		outfit "Scram Drive" -1
		conversation
			`You are directed to land in a hangar some distance away from the spaceport, in a cluster of buildings owned by Syndicated Systems. A team of engineers meets you and quickly and efficiently removes your scram drive and replaces it with a strange, alien-looking device that you assume must be a jump drive. "Now, be careful with your fuel gauge," one of them tells you. "This thing guzzles twice as much fuel per jump as an ordinary hyperdrive, and you don't want to become stranded while outside human space."`
				accept
	
	on accept
		outfit "Jump Drive" 1
		set "fw given jump drive"
	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
		set "FW Pug 2C: done"



mission "FW Pug 2C: Jump Drive"
	landing
	name "Investigate the Pug"
	description "Travel to the Deneb system to investigate the Pug; if possible, make contact with them and determine what their goals and desires are."
	source Hephaestus
	destination Pugglemug
	clearance
	to offer
		has "FW Pug 2B: done"
		not "fw given jump drive"
		has "outfit (flagship installed): Jump Drive"
	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 are directed to land in a hangar some distance away from the spaceport, in a cluster of buildings owned by Syndicated Systems. A team of engineers meets you and asks if they can look over your ship; a few minutes later, one of them says in surprise, "You've already got a jump drive! How did you manage that?" Since you don't need their equipment, they urge you to head directly for Pug space and continue your mission.`
				accept
	
	on accept
		set "fw given jump drive"
		set "already had jump drive"
	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
		set "FW Pug 2C: done"



mission "FW Pug Jump Drive Check"
	landing
	to offer
		has "fw given jump drive"
		not "outfit (all): Jump Drive"
		not "event: reconnected delta capricorni"
	on offer
		conversation
			`Somehow, you've misplaced or lost the jump drive needed to continue the Free Worlds story! If you are unable to find your jump drive, you should revert to the autosave or another earlier snapshot of the game.`
				decline



mission "FW Pug 2C: Side"
	landing
	source
		government Pug
		near Deneb 1 100
	to offer
		has "fw given jump drive"
		not "FW Pug 3: offered"
	
	on offer
		log "Visited one of the human worlds that has been captured by the Pug. The Pug do not seem to be mistreating the people here, but they have stationed armed guards throughout the spaceport."
		conversation
			`When you land at the spaceport on <origin>, you find no evidence of violent struggle; merchant captains are walking around freely, haggling for commodities, and conversing with each other just like in any other spaceport you have visited. However, the spaceport is also being patrolled by small groups of slender, bipedal, pale-skinned aliens who you assume are the Pug. Each one is holding a metal staff: probably some sort of weapon.`
			`	Soon after you land, you spot a man making his way towards your ship, ducking behind other ships and crates every time a group of Pug look in his direction. If he is some sort of fugitive from them, it might be unwise to throw your lot in with him. On the other hand, he could have valuable information for you.`
			choice
				`	(Stay around and talk to him.)`
				`	(Take off before I draw the Pug's attention.)`
					flee
		
			`You open your ship's hatch and allow him to come on board. "You came from outside, didn't you?" he says. "Outside of occupied space, I mean." You nod.`
			`	"What's going on here?" asks Alondo. "Who are these aliens?"`
			`	"I'm a planet-dweller," he says, "so the first I heard of it was when these ships unlike anything I'd ever seen before came down out of the sky, and hovered over the spaceport. Then they began transmitting radio messages on all frequencies, saying that this world is now a part of the Pug Protectorate, and that we must refrain from violence and give them a portion of the goods our world produces."`
			choice
				`	"Did anyone try to resist them?"`
					goto resist
				`	"What do you think their intentions are?"`
					goto intentions
				`	"Did they explain why they cut you off from the rest of the galaxy?"`
					goto cut
		
			label resist
			`	"A few. Their ships aren't invulnerable; a merchant in an Argosy managed to take out one of their smaller ships when it was landed with its shields down, before they blew his ship out of the air in retaliation. And those staffs they're carrying shoot some kind of stun ray, but if you cut them, they bleed, same as any other creature." He pauses, then taps the knife that is holstered at his belt and says, "Except, they bleed blue. Pale milky blue."`
			choice
				`	"What do you think their intentions are?"`
					goto intentions2
				`	"Did they explain why they cut you off from the rest of the galaxy?"`
					goto cut2
		
			label intentions
			`	"Well, they want our resources, of course. And, they say they have come to bring a new era of peace and an end to all violence and conflict. I don't buy it, though; they saw that humanity was too divided to resist them, and they seized the opportunity to invade and plunder us. It's that simple."`
			choice
				`	"Did anyone try to resist them?"`
					goto resist2
				`	"Did they explain why they cut you off from the rest of the galaxy?"`
					goto cut2
		
			label cut
			`	"I'd think that would be obvious. With the hyperspace links cut, there's no way for anyone from outside to assist us. And they struck at a part of human space without much in the way of militias or bounty hunters or Navy protection. And the few half-decent warships that happened to be in system when they attacked have already been destroyed trying to fight them."`
			choice
				`	"Did anyone try to resist them?"`
					goto resist2
				`	"What do you think their intentions are?"`
					goto intentions2
		
			label resist2
			`	"A few. Their ships aren't invulnerable; a merchant in an Argosy managed to take out one of their smaller ships when it was landed with its shields down, before they blew his ship out of the air in retaliation. And those staffs they're carrying shoot some kind of stun ray, but if you cut them, they bleed, same as any other creature." He pauses, then taps the knife that is holstered at his belt and says, "Except, they bleed blue. Pale milky blue."`
				goto end
		
			label intentions2
			`	"Well, they want our resources, of course. And, they say they have come to bring a new era of peace and an end to all violence and conflict. I don't buy it, though; they saw that humanity was too divided to resist them, and they seized the opportunity to invade and plunder us. It's that simple."`
				goto end
		
			label cut2
			`	"I'd think that would be obvious. With the hyperspace links cut, there's no way for anyone from outside to assist us. And they struck at a part of human space without much in the way of militias or bounty hunters or Navy protection. And the few half-decent warships that happened to be in system when they attacked have already been destroyed trying to fight them."`
				goto end
		
			label end
			`	"Where did they come from originally?" asks Alondo.`
			`	"From a star system that was always a neighbor of ours, but wasn't linked to us or to any other part of human space. We always just assumed it was an uninhabited system, but it turns out they were there all along, biding their time, waiting for a good opportunity to attack us."`
			`	"Well," says Alondo, "they didn't attack us when we jumped into this system. Perhaps we should go to their home system and see what they have to say for themselves."`
				decline



mission "FW Pug 2C: Pugglequat"
	landing
	source Pugglequat
	to offer
		has "fw given jump drive"
		not "FW Pug 3: offered"
	
	on offer
		conversation
			`This planet is clearly one of the native Pug worlds, and not a human world that has been occupied. The architecture is entirely alien, and you see no human ships or people here, only the aliens. But, it appears to be mostly a world for mining and factories; all the aliens are busy with their work, and none seem to speak your language or have any interest in talking with you; instead they gesture towards the sky, perhaps as a way of indicating that you should visit the other Pug planet in this system.`
				decline



mission "FW Pug 3"
	name "Bring news to Earth"
	description "Now that you have met with the Pug, travel to Earth and explain the situation to Parliament, and send word to the Free Worlds as well, so you can decide how to respond."
	autosave
	landing
	source Pugglemug
	destination Earth
	clearance
	to offer
		has "fw given jump drive"
		has "FW Pug 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
		log "Located the Pug homeworld, and met with some of them. They say that they have annexed the neighboring systems into the Pug Protectorate in order to stop the human civil war. However, their idea of bringing peace seems to involve conquering human space and replacing the Republic with their own government."
		log "Factions" "Pug" `The Pug are aliens with barrel-shaped bodies, spindly legs, and milky blue blood. They claim to have intervened in the human civil war purely for the sake of preventing more bloodshed and helping humans to live together in peace.`
		conversation
			`This is an entirely alien world. The buildings have strangely flowing, tapered shapes not unlike the Pug starships, and from orbit you count dozens of large cities covering a large portion of the land mass. If this were a human world, you would estimate its population at over a billion. You follow one of the Pug ships that is landing, and discover a large spaceport where a surprising number of human merchant ships are parked, in addition to the aliens.`
			`	Elsewhere they have mostly ignored you, but here your ship is quickly approached by a small group of the pale-skinned, delicate aliens. The Pug are oddly proportioned, with long arms and legs but short, barrel-shaped torsos and large heads, and although they only have two legs, their gait is vaguely insectoid. "You came from outside," one of them says. "You are not pledged to the Protectorate. Do you wish to make your vow of loyalty and peacefulness at this time?"`
			choice
				`	"No, we are here to find out why you attacked us, and to demand that you leave us alone."`
				`	"We are willing to make peace, but only if you give us back control of our star systems."`
			`	"We have no wish to harm you," says the alien. "In time you will come to recognize that. We intervened in your war only to bring peace and to keep your species from doing great harm to itself. And we must maintain control of these systems until we are certain that you will not continue fighting if the links are restored."`
			choice
				`	"If you wish us no harm, why did you slaughter the Syndicate fleet?"`
				`	"You have no business invading our space and interfering in our affairs, regardless of your intentions."`
					goto interfere
		
			`	"The fleet that was carrying nuclear weapons, weapons of genocide? The fleet that, when we demanded their surrender, instead attacked us with those weapons? We offered them a place in the Protectorate, but they chose violence instead, and so they perished by violence. That is justice."`
			`	Alondo says, "I still don't understand what makes you think you have the right to interfere in human affairs."`
		
			label interfere
			`	"'Interfere'?" says the alien. "We have 'interfered' many times before, and always you have benefited. If you do not believe us, ask those who live in the place you call the Deep. We helped them defeat the twisted half-human beings that you created in your foolish attempts to improve your race's genetic code. We have helped keep those creatures in check in the centuries since then. And we have helped in many other ways."`
			choice
				`	"What do you want from us in return?"`
				`	"What are you planning to do with these systems you have occupied?"`
			`	"We have brought peace to this region," says the alien, "and we will continue to spread peace until violence has come to an end throughout human space. That is our only desire. All that we ask in return is a portion of the goods your worlds produce, to help offset the cost of watching over and protecting so many human worlds. And after some time, we will again allow human beings autonomous control of certain parts of your territory, when you show yourselves capable of living peacefully."`
			`	"By 'spreading peace,' do you mean occupying more systems?" asks Alondo.`
			`	"We mean bringing an end to your war and your divisions," the alien says. "Those of your worlds and your people who have shown themselves unable to live peacefully, we must govern, to teach them peace. Any who attack us, we must destroy, because we are the bringers of peace, and whoever attacks us is not on the side of peace. And so we will send you back to your people now, to tell them that they have nothing to fear, and that they should await our peace and our protection."`
			`	The aliens appear to think the conversation is over; they walk away and leave you puzzling over what they said. "We should report back to Earth," says Alondo. "This situation is far beyond what we can handle alone."`
				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 Pug 3: Deep"
	landing
	name "Visit the Deep (optional)"
	description "The Pug hinted that they have helped the people of the Deep in the past. Talk to Edrick, the governor of Valhalla, to see what he knows about the Pug. (This mission is optional.)"
	source Earth
	destination Valhalla
	to offer
		has "FW Pug 3: done"
	to fail
		has "FW Pug 3A: done"
	
	on complete
		log "The governor of Valhalla, in the Deep, says that the Pug secretly assisted the people of the Deep to fight against the Alphas centuries ago, during the Alpha Wars. He thinks that the Pug have humanity's best interests at heart, but agrees that they can't be allowed to overthrow the Republic."
		log "Factions" "Pug" `It is possible that the Pug secretly assisted the humans of the Deep centuries ago by providing them with weapons that helped to turn the tide of the Alpha Wars.`
		conversation
			`As you are coming in for a landing, you contact Edrick Flint and see if he's available to talk. A few minutes later, you and Alondo are sitting with him in his office in the government center. "I assume you've heard about the alien invasion?" says Alondo. Edrick nods. "The aliens claimed that they had dealt with the Deep in the past. Do you know anything about that?"`
			`	Edrick says, "Can you describe what these aliens look like?"`
			`	"Pale skin, delicate physique, most of them a little under two meters tall," says Alondo. "Long legs, short torsos. And they probably have blue blood."`
			`	Edrick pauses for several seconds, then says, "Yes, we had contact with a species that matches that description, back during the Alpha Wars. Some of the folk traditions about 'elves' that still persist here in the Deep are a result of those encounters."`
			choice
				`	"Do you know what they wanted from humanity, back then?"`
				`	"What strengths and weaknesses do their ships have?"`
					goto strengths
			
			`	"If the stories are true, all they wanted was to help us win the war against the Alphas," says Edrick. "They never asked for any payment, except that they borrowed some of our ships, packed them full of alien technology, and fought alongside our ships, masquerading as human ships. They also gave us beam weapon technology; five centuries later, we've only just reached the point where we understand that technology well enough to improve on it."`
			`	"What do you know about their warships?" asks Alondo.`
			
			label strengths
			`	"I know that they had a technology that allowed their shields to recharge very quickly," says Edrick. "So to destroy one of their ships would require a considerable amount of concentrated firepower. But are you sure we need to fight them? My people have believed for generations that the 'elven folk' were a friendly species, not a hostile one."`
			choice
				`	"They seem intent on taking over all of human space and forcing us to submit to their authority. So we must fight them."`
				`	"It's possible that they think they are helping us right now, by interrupting our civil war, but all the same we must fight back."`
			`	Edrick looks disappointed at that. "I understand. I believe that they honestly think they are doing what is best for us, but clearly we cannot tolerate this invasion. Good luck, Captain." He dismisses you.`



mission "FW Pug 3: Quarg"
	landing
	name "Visit the Quarg (optional)"
	description "Visit the Quarg on <planet> to see if they know anything about the Pug or are willing to help you fight them. (This mission is optional.)"
	source Earth
	destination Lagrange
	to offer
		has "FW Pug 3: done"
	to fail
		has "FW Pug 3A: done"
	
	on complete
		log "Learned from the Quarg that they have long been aware of the presence of the Pug in the Deneb system. Apparently the Pug are from another galaxy and possess such advanced technology that even the Quarg do not dare to interfere with them."
		log "However, the Pug are known to treat warfare like a game, intentionally using weaker technology when fighting less advanced species in order to give them a fair chance at winning the battle. So, fighting them will not be a lost cause, but the Quarg are unwilling to provide any assistance."
		log "Factions" "Pug" `The Quarg claim that the Pug treat warfare like a game. When battling another species, the Pug will limit themselves to ships and weapons that are weak enough that the other species has a chance of defeating them.`
		conversation
			`When you land on the station, Alondo says, "From what I understand of Quarg diplomacy, we're just supposed to ask any one of them to direct us to someone who can answer our questions." He walks up to a Quarg who is standing near your docking bay and says, "Excuse me, can you lead us to someone we can talk to?"`
			`	It nods and gestures for you to follow, and leads you to a nook in one of the main hallways, where another Quarg stands behind a desk. You are struck by how little you know about this species: are you speaking to a tour guide, or to a diplomat? Were you led to this individual because this is the governor of the station, or just because this is one who speaks human languages? The Quarg behind the desk says, "Do you have questions for me?"`
			choice
				`	"Can you help us to fight the Pug?"`
				`	"Can you give us information about the Pug?"`
					goto info
			
			`	"No," it says. Several stripes of skin on its gray face turn a dull red; you have heard that this might indicate sadness, or embarrassment, or possibly anger - one more thing about the Quarg that no one understands well. "Long ago we tried to resist the Pug," it says. "In retribution, they broke one of our rings." It points out the window of the station at the half-finished ringworld. "This ring is half complete, and it has taken a thousand of your years to build. The rings are our most precious creations, nearly impossible to destroy, but the Pug know how to twist and cut the fabric of space itself."`
			`	"So you've encountered the Pug before?" asks Alondo.`
			
			label info
			`	The Quarg is silent for a long moment. "The Pug have meddled with the affairs of many species in this galaxy," it says, "but they are not native to it. They came here through artificial wormholes: a technology that not even the Drak possess. Their actions are unpredictable. They claim to be acting on a special knowledge of future events, but we do not know if that knowledge is genuine or only an excuse to play tricks on other species."`
			choice
				`	"If they're so advanced, do we have any chance of defeating them?"`
					goto defeat
				`	"Do you think the Drak would join us in fighting them?"`
					goto drak
			
			label defeat
			`	"Yes," it says. "In battle the Pug always respond with just enough force that their opponent has a fair chance at victory."`
			`	Alondo is confused. "What do you mean?" he asks.`
				goto balance
			
			label drak
			`	"No," it says. "The Drak do not interfere in a war unless their rules are broken. And, it would not help you anyway; the Pug always adjust the strength of their fleet to give their opponent what they consider to be fair odds."`
			`	"Wait," says Alondo, "you're saying they would intentionally attack us with a weaker force instead of using all their strength and guaranteeing victory?"`
				goto balance
			
			label balance
			`	"War is a game to the Pug," the Quarg says. "They are a strange species. Even if they start a war, their goal may not be to win it, but to lose in a certain way. We have seen them lose battles against species far less advanced than your own, even though they had weapons that would have guaranteed them victory. If they want war, you must play their game, and if you play their game, they may allow you to win."`
			`	"That makes no sense," says Alondo. "They would die for the sake of a game?"`
			`	The Quarg pauses for a moment as if struggling for words. "I am myself, and also I am Quarg. You are yourselves, and also you are human. But we think perhaps a Pug is Pug first, and then also itself."`
			`	"Their identity is communal, rather than individual?" says Alondo.`
			`	"Indeed. And because they are so deeply connected, they perceive all things as being connected to them. At least, that is the best understanding we have been able to gain of their species."`
			choice
				`	"Thank you for your time."`
					decline
				`	"Is there any chance you could give us some jump drives, so we can bring a bigger fleet against the Pug?"`
			
			`	"No, I apologize," it says. "We see that you have somehow gained access to a jump drive, and we will not take it away from you, but we also cannot give your species more of them."`
				decline



mission "FW Pug 3A"
	landing
	name "Gather the fleet"
	description "Travel to <destination> and requisition two Free Worlds Dreadnoughts to join in the battle against the Pug. (But if you want to visit the Quarg or the Deep, do that first.)"
	autosave
	source Earth
	destination Zug
	to offer
		has "FW Pug 3: 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
			`Your ship caused quite a stir when it entered the Sol system via jump drive. Fortunately Parliament allowed you to land in one of their private hangars, but even so a few press drones managed to follow your ship into the hangar and have cameras pointed at you from the moment you and Alondo disembark.`
			`	You report to Parliament that the hyperspace links are being cut not by the Syndicate, but by an alien species, and that the Syndicate has offered to supply jump drives for an attack fleet if the Republic and the Free Worlds will supply the ships. You also report that the aliens' intention is to spread out to occupy more of human space and to demand a fraction of the resource production of all human planets, supposedly in the name of bringing "peace."`
			`	One of the senators asks, "Do you think we have any chance of defeating the aliens?"`
			choice
				`	"It's possible. They all live in a single star system, so we outnumber them."`
					goto questions
				`	"It's unlikely. If we have any options other than fighting them, we should explore those options."`
			`	"I think we have no choice," says one of the older members. "Even if it is a losing battle, we can't let the human race be enslaved without a fight."`
			label questions
			`	They have many other questions after that; you answer them as best you can, and leave them with full copies of your sensor logs of the alien ships and planets. Parliament agrees that the next step is for you to convince the Free Worlds to contribute two Dreadnoughts to the attack fleet. "Also," one of the members of Parliament says, "maybe you could talk to those aliens who live down in your part of space, see if they can help us out in any way. It sure would be handy if the Pug turn out to be an enemy of theirs."`
			`	During the hearing, you refrained from mentioning that the Pug claimed to have assisted the Deep in the past, but once you are back in your ship Alondo says, "Maybe we should also visit Valhalla and see if Governor Flint has any information for us."`
				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 Pug 3B"
	landing
	name "Escort to <planet>"
	description "Travel to <planet> with two Free Worlds Dreadnoughts that will be joining the fight against the Pug."
	autosave
	source Zug
	destination Geminus
	clearance
	to offer
		has "FW Pug 3A: 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
		"salary: Free Worlds" = 17000
		conversation
			`Freya meets you soon after you land. "I've heard the news," she says. "I talked to the Senate, and they think that I should travel with you during your assault on the Pug, in case I can help figure out their technology, maybe even how to restore the hyperspace links. And they say they need Alondo back here to do diplomatic visits and help keep people from panicking."`
			`	"I guess that makes sense," says Alondo.`
			`	"Also," says Freya, "the Senate approved a raise for you, <first>. Your new salary will be seventeen thousand credits a day. I hope that means you'll be able to go into battle against the Pug with the strongest ship possible, because I suspect we'll need all the firepower we can get."`
			`	Alondo wishes you the best of luck and leaves to catch a transport to Bourne, while Freya takes you to the spaceport and introduces you to the captains of the two Dreadnoughts that have volunteered to fight the Pug. She also asks you all sorts of technical questions: what sort of propulsion and energy sources the Pug seem to use, what their weapon capabilities are, and whether you saw any sign of the technology that was used to destroy the hyperspace links. You have a hard time answering her, but are glad that she will be with you this time to see the aliens firsthand.`
				accept
	
	npc accompany save
		government "Free Worlds"
		personality escort disables
		ship "Dreadnought" "F.S. Independence"
		ship "Dreadnought" "F.S. Freedom"
	
	on visit
		dialog "You have reached <planet>, but the dreadnoughts are lagging behind you because they are using ordinary hyperdrives. Better depart and wait for them to arrive in this star system."



conversation "fw pug"
	`You land at the Republic Navy Yard on Geminus escorting the two Dreadnoughts that are the Free Worlds contribution to the war against the Pug. You are met by the shipyard supervisor and a team of engineers who are preparing the Navy ships to join you. "So, these are your Dreadnoughts," one of them says. "I'm glad to finally have the chance to see one up close. I don't suppose one of the captains would be willing to give me a tour."`
	choice
		`	"Um, we're right in the middle of resisting an alien invasion, here."`
		`	"Sorry, we aren't authorized to share military secrets with you."`
		`	"Sure, I'm sure we could arrange something."`
			goto yes

	`	Freya laughs. "Give him a break, <first>. He's just thinking like an engineer, rather than a tactician. I mean, I'd certainly jump at the chance to tour a Cruiser even at a time like this."`

	label yes
	`	The supervisor seems irked that his engineers are more interested in exploring nifty new ship technology than in the task at hand, but he grudgingly offers to give you a tour of the Navy Yard in exchange for letting his engineers take a closer look at the Dreadnoughts. Freya whispers to you, "Just think of this as another step toward peace and reconciliation."`
	`	The new shipyard is some distance away from the old one, which is still in ruins, a radioactive crater a few kilometers away from the spaceport. "The attack happened at night," says the supervisor. "Three hundred and forty-seven people were killed. If the attack had been during working hours, that number would have been in the thousands. We're recovering some metal from the old shipyard, but other than that it's a total loss. The radiation is slowly dying down, though."`
	`	There is deep anger in his voice as he speaks. You are glad that the Free Worlds have been proved innocent of involvement in the attack, but you suspect that on the worlds that were bombed, most people will not accept peace with the Syndicate on any terms except the full surrender of all the Syndicate personnel who were responsible.`
	`	When they're done giving you the tour, you return to the spaceport. The supervisor and the team of engineers wish you the best of luck, and depart.`
		accept



mission "FW Pug 3C"
	landing
	name "Escort to Hephaestus"
	description "Escort the combined Free Worlds and Navy fleet to <destination>, where the Syndicate will fit all the ships with jump drives."
	autosave
	source Geminus
	destination Hephaestus
	to offer
		has "FW Pug 3B: done"
		not "already had jump drive"
	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 Free Worlds and Republic Navy are sending a joint fleet into Syndicate space, where they will be fitted with jump drives to make an assault on Pug territory. The Syndicate only has six jump drives available, so this fleet will have to survive without reinforcements until a way is found to reopen the connection to the rest of human space."
		conversation "fw pug"
	
	npc accompany save
		government "Free Worlds"
		personality escort
		ship "Dreadnought" "F.S. Independence"
		ship "Dreadnought" "F.S. Freedom"
	npc accompany save
		personality escort
		government "Republic"
		ship "Cruiser (Mark II)" "R.N.S. Everest"
		ship "Cruiser (Mark II)" "R.N.S. Denali"
		ship "Carrier (Mark II)" "R.N.S. Vesuvius"
		ship "Carrier (Mark II)" "R.N.S. Haleakala"
	
	on visit
		dialog "You have reached <planet>, but part of your fleet is not here yet. Better depart and wait for them to arrive in this star system."



mission "FW Pug 3C (Extra)"
	landing
	name "Escort to Hephaestus"
	description "Escort the combined Free Worlds and Navy fleet to <destination>, where the Syndicate will fit all the ships with jump drives."
	autosave
	source Geminus
	destination Hephaestus
	to offer
		has "FW Pug 3B: done"
		has "already had jump drive"
	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 Free Worlds and Republic Navy are sending a joint fleet into Syndicate space, where they will be fitted with jump drives to make an assault on Pug territory. The Syndicate only has seven jump drives available, so this fleet will have to survive without reinforcements until a way is found to reopen the connection to the rest of human space."
		conversation "fw pug"
	
	npc accompany save
		government "Free Worlds"
		personality escort
		ship "Dreadnought" "F.S. Independence"
		ship "Dreadnought" "F.S. Freedom"
	npc accompany save
		personality escort
		government "Republic"
		ship "Cruiser (Mark II)" "R.N.S. Everest"
		ship "Cruiser (Mark II)" "R.N.S. Denali"
		ship "Carrier (Mark II)" "R.N.S. Vesuvius"
		ship "Carrier (Mark II)" "R.N.S. Haleakala"
		ship "Cruiser (Mark II)" "R.N.S. Matterhorn"
	
	on visit
		dialog "You have reached <planet>, but part of your fleet is not here yet. Better depart and wait for them to arrive in this star system."
	on complete
		set "FW Pug 3C: done"



mission "FW Pug 4: Escorts"
	landing
	invisible
	source Hephaestus
	to offer
		has "FW Pug 3C: done"
	to fail
		has "FW Pug 6: done"
	
	npc kill
		government "Free Worlds"
		personality escort heroic disables
		ship "Dreadnought (Jump)" "F.S. Independence"
		ship "Dreadnought (Jump)" "F.S. Freedom"
	npc kill
		personality escort heroic disables
		government "Republic"
		ship "Cruiser (Jump)" "R.N.S. Everest"
		ship "Cruiser (Jump)" "R.N.S. Denali"
		ship "Carrier (Jump)" "R.N.S. Vesuvius"
		ship "Carrier (Jump)" "R.N.S. Haleakala"
		ship "Dagger" "Red One"
		ship "Dagger" "Red Two"
		ship "Dagger" "Red Three"
		ship "Dagger" "Red Four"
		ship "Dagger" "Red Five"
		ship "Dagger" "Red Six"
		ship "Dagger" "Red Seven"
		ship "Dagger" "Red Eight"
		ship "Combat Drone" "Orange One"
		ship "Combat Drone" "Orange Two"
		ship "Combat Drone" "Orange Three"
		ship "Combat Drone" "Orange Four"
		ship "Combat Drone" "Orange Five"
		ship "Combat Drone" "Orange Six"
		ship "Combat Drone" "Orange Seven"
		ship "Combat Drone" "Orange Eight"
		ship "Combat Drone" "Yellow One"
		ship "Combat Drone" "Yellow Two"
		ship "Combat Drone" "Yellow Three"
		ship "Combat Drone" "Yellow Four"
		ship "Combat Drone" "Yellow Five"
		ship "Combat Drone" "Yellow Six"
		ship "Combat Drone" "Yellow Seven"
		ship "Combat Drone" "Yellow Eight"
		ship "Combat Drone" "Yellow Nine"
		ship "Combat Drone" "Yellow Ten"
		ship "Combat Drone" "Yellow Eleven"
		ship "Combat Drone" "Yellow Twelve"

mission "FW Pug 4: Escorts (Extra)"
	landing
	invisible
	source Hephaestus
	to offer
		has "FW Pug 3C: done"
		has "already had jump drive"
	to fail
		has "FW Pug 6: done"
	npc kill
		personality escort heroic disables
		government "Republic"
		ship "Cruiser (Jump)" "R.N.S. Matterhorn"
		ship "Combat Drone" "Green One"
		ship "Combat Drone" "Green Two"
		ship "Combat Drone" "Green Three"
		ship "Combat Drone" "Green Four"



mission "FW Pug 4"
	landing
	name "Liberate <system>"
	description "Attempt to drive the Pug out of the <system> system, then land on <planet>."
	autosave
	source Hephaestus
	destination Maker
	clearance
	to offer
		has "FW Pug 3C: 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
		event "at war with the pug"
		conversation
			`The Syndicate directs you to land your ships in the private hangars for Syndicated Systems. Once you have landed, they quickly work to install jump drives in the Navy and Free Worlds ships. As they work, you hear one of the workers saying to another, "Golly, I'd forgotten how big those Navy ships are. Makes a Protector look puny by comparison, doesn't it?"`
			branch extra
				has "already had jump drive"
			`	Once the work is done, you meet with a senior Syndicate executive named Marco Bugati. "I really hope this works," he says, "because these are the only jump drives we've been able to acquire. If your fleet is destroyed, we will have lost access to the occupied territory entirely."`
				goto end
			label extra
			`	Once the work is done, you meet with a senior Syndicate executive named Marco Bugati. "I really hope this works," he says, "because these are the only jump drives we've been able to acquire, though you seem to have picked one up yourself; I'd like to have a chat with you and find out how, if we all survive this. I can tell you, that extra ship we've got thanks to the spare jump drive may be pivotal. But if your fleet is destroyed, we will have lost access to the occupied territory entirely."`
			label end
			`	You gather your fleet and prepare for an assault on Delta Capricorni, which is the occupied star system closest to Syndicate space.`
			``
			`[Take good care of this fleet: if ships are disabled, board them to "repair" them once the battle is over. And, when jumping into battle, remember that you can hold down the jump key to get all your ships ready to jump simultaneously, so no single ship enters the system first and bears the brunt of the enemy fire.]`
				accept
	
	npc evade
		personality disables staying
		system "Delta Capricorni"
		government Pug
		fleet 2
			names "pug"
			variant
				"Pug Maboro"
				"Pug Enfolta"
				"Pug Zibruka" 2
		fleet 4
			names "pug"
			variant
				"Pug Enfolta"
				"Pug Zibruka" 2
	
	on visit
		dialog `You've landed on <planet>, but there are either still Pug ships circling overhead, or you've left Freya behind. You should take off and help finish off the Pug or wait for your escort carrying Freya to arrive.`
	on complete
		event "battle for delta capricorni"



mission "FW Pug 4A"
	landing
	name "Defend Maker"
	description "Keep the Pug from regaining control of Maker for long enough for Freya to figure out whether it is possible to restore the hyperspace link back to the Markab system."
	source Maker
	to offer
		has "FW Pug 4: 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 "Succeeded in driving the Pug out of the Delta Capricorni system for long enough to land on Maker and explore the technology that the Pug left behind. Freya thinks that she has discovered the device that is used for creating or destroying hyperspace links, but it will take time for her to figure out how to operate it."
		conversation
			branch lost
				has "FW Pug 4: Escorts: done"
			`Along with the remaining ships from the combined attack fleet, you land at the main spaceport on <origin>. The other ships are carrying trained soldiers and equipment for planetary defense: ground-based laser turrets, surface to air missiles, and tracking radar for incoming ships. The soldiers have come armed and ready to fight the Pug on the ground if necessary, but it turns out that all the Pug who were here took off in one of the ships that were trying to repulse your attack.`
				goto generator
			
			label lost
			`You have liberated this planet, but with your entire fleet destroyed your victory may be short-lived. Still, you have no option but to continue on and try your best. Fortunately, it turns out that none of the Pug are left on the ground here on Maker; they all left the planet to join in the fleet that you just destroyed. So at least you don't have a land war to worry about.`
				goto generator
			
			label generator
			`	Freya has some good news: she is picking up very faint, intermittent signals from the hyperspace communications relay back in the Markab system. "That means the link may not be closed completely," she says, "or at least, there's some residue remaining."`
			`	Freya directs you to fly over the planet and survey the buildings and equipment that the Pug left behind, and after searching for a while you discover an alien building that vaguely resembles a radio transmitter. You land nearby, and as you approach the building on foot, you feel as if the ground beneath you is heaving and rolling like the deck of a ship on choppy seas. "Graviton distortions," she says. "This may be it, the equipment they used to disrupt the hyperspace links. It will take me a while to figure out how it works, though."`
			`	You agree that she will stay here to try to figure out the alien technology, while you do your best to defend the planet and to keep the Pug from retaking it.`
				accept
	on visit
		dialog `You've landed on <planet>, but there are still Pug ships circling overhead. You should take off and help finish them off.`
	
	npc
		system Deneb
		government Pug
		personality disables
		fleet
			names "pug"
			variant
				"Pug Maboro"
				"Pug Enfolta"
				"Pug Zibruka" 2
		fleet
			names "pug"
			variant
				"Pug Enfolta"
				"Pug Zibruka" 2
	
	npc disable
		system Rasalhague
		government Pug
		personality disables
		dialog `You receive a message from Freya: "Captain, I think I've figured out the transmitter, and there is indeed a chance that we can reopen the hyperspace links. Meet me back down on the planet as soon as possible - I'll need you to take some equipment back to Hephaestus and set it up there."`
		fleet
			names "pug"
			variant
				"Pug Maboro"
				"Pug Enfolta"
				"Pug Zibruka" 2
		fleet 3
			names "pug"
			variant
				"Pug Enfolta"
				"Pug Zibruka" 2



mission "FW Pug 4B"
	landing
	name "Reflector to Hephaestus"
	description `Freya found a device that she believes is a "graviton reflector," which can somehow be set up in the <system> system to re-establish the hyperspace link between there and Delta Capricorni. Bring the transmitter to the Syndicate officials on <planet>.`
	source Maker
	destination Hephaestus
	to offer
		has "FW Pug 4A: done"
	cargo "graviton reflector" 10
	blocked `Freya contacts you and says, "Captain, you're going to need ten tons of cargo space." You do not have that much available, so you should 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
			`Freya meets you soon after you land. She has brought with her a large piece of alien machinery, mounted on a flat-bed truck for easy transportation. "I shut down the transmitter," she says, "and sure enough, the signal from Markab started to gradually become stronger. I think it was somehow jamming or suppressing the hyperspace link, rather than completely severing it. So then I found that the transmitter has a different setting, where instead of sending random graviton noise, it sends a steady, harmonic pulse. And that accelerated the process of reopening the link."`
			choice
				`	"Great! How soon until the link is open again?"`
					goto time
				`	"Are you sure we should be playing with alien technology we don't understand?"`
			
			`	"Do we really have any better options?" she asks. "Without reinforcements, how many more Pug attacks do you really think you can survive? Besides, there's a certain logic and balance to the rules of physics, so even when dealing with something we can't understand, sometimes intuition can guide us." She pauses for a second, and says, "And sometimes intuition steers us terribly wrong, but let's not think about that right now."`
			`	"So, you succeeded in opening the link?" you say.`
			label time
			`	"Well, that's the bad news," she says. "At this rate, it will take several years to reopen the connection. And I doubt this method would work at all if there weren't still the residual link in place. But that's where this equipment comes in."`
			`	She points to the alien machine. "This machine is like the transmitter, but much simpler. The transmitter somehow redirects a planet's gravity spaceward; what this machine does is reflect a graviton beam back where it comes from. If we can mount the reflector on Hephaestus, and align them both very precisely, we can set up a standing wave between the two that will regenerate the hyperspace link much more quickly. Or for all I know it might create an artificial singularity that destroys us all. I'm mostly flying blind here."`
			choice
				`	"Well, I guess we should give it a try."`
					goto load
				`	"Sounds risky. Are there any other options we could try?"`
			
			`	"No," she says, "no, there are not. Sorry."`
			label load
			`	You load the reflector onto your ship, and get ready to travel to Hephaestus. You suspect that the Pug are going to try to stop you, once they realize what is happening...`
				accept
	on visit
		dialog `You land on <planet>, but realize that your escort carrying the graviton reflector hasn't entered the system yet. Better depart and wait for it to arrive.`



mission "FW Pug 4B: Enemies"
	landing
	invisible
	source Maker
	to offer
		has "FW Pug 4A: done"
	to fail
		has "FW Pug 6: done"
	
	npc kill
		personality waiting disables
		system Deneb
		government Pug
		fleet 4
			names "pug"
			variant
				"Pug Maboro"
				"Pug Enfolta"
				"Pug Zibruka" 2



mission "FW Pug 4B: Reinforcements"
	landing
	invisible
	source Maker
	to offer
		has "FW Pug 4A: done"
	to fail
		has "FW Pug 6: done"
	
	npc kill
		personality disables
		system Markab
		government Syndicate
		fleet
			names "syndicate capital"
			variant
				"Splinter (Mark II)"
				"Manta (Mark II)" 2
				"Quicksilver (Mark II)" 4
		fleet
			names "syndicate capital"
			variant
				"Protector" 2



mission "FW Pug 4C"
	landing
	name "Return to <system>"
	description "Return to <destination>, accompanied by your new reinforcement fleet supplied by the Syndicate, and talk with Freya to decide on what your next steps should be now that you have the ability to restore the links to human space."
	source Hephaestus
	destination Maker
	to offer
		has "FW Pug 4B: 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 "reconnected delta capricorni"
		conversation
			`Freya sent detailed instructions with the reflector for where it should be set up and how it should be adjusted to interface with the transmitter back in Pug space. You hand it over to a team of Syndicate engineers, who seem quite capable and confident that they can make it work; you suspect that these are the same engineers who have been playing with equipment stolen from the Korath, so they are no strangers to alien technology.`
			`	You also meet with Marco Bugati, the Syndicate executive who oversaw the installation of your jump drives, and tell him that you may soon be able to reopen one of the connections to Republic space, as well. You ask if he can send a courier ship to Earth to inform them of the new situation, to have them begin massing a fleet there. He agrees. He also tells you that a few of the Syndicate ships that met you in orbit have been designated as additions to your attack fleet, so they will be traveling back to Maker with you if the reflector succeeds in reopening the link.`
			`	A few hours later, the engineers tell you that they think the link is beginning to reopen. Bugati says, "You should take off and return as soon as possible, in case Maker has been attacked in your absence."`
				accept



mission "FW Pug 5"
	landing
	name "Liberate <planet>"
	description "If you can drive the Pug away from <destination>, you will be able to re-establish the hyperspace link between Altair and the Sol system, and immediately bring in Navy ships as reinforcements."
	source Maker
	destination Shiver
	clearance
	to offer
		has "FW Pug 4C: done"
	cargo "graviton reflector" 10
	passengers 1
	blocked `Freya contacts you and says, "<first>, we're going to need space for me, plus ten tons of cargo, on your ship. Think you can do that?" You tell her you will contact her here on <origin> as soon as you have made the space 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 "Freya succeeded in reopening the hyperspace link to one of the Syndicate systems. If the same can be done for the link to Sol, the entire Navy will be able to join the battle against the Pug."
		event "battle for altair"
		conversation
			branch extra
				has "already had jump drive"
			`Freya is overjoyed that she has found a way to reverse the Pug technology and restore a hyperspace connection to human space. "Now we actually have a chance," she says. "Before, with just you and six other ships, victory seemed unlikely."`
				goto choice
			label extra
			`Freya is overjoyed that she has found a way to reverse the Pug technology and restore a hyperspace connection to human space. "Now we actually have a chance," she says. "Before, with just you and seven other ships, victory seemed unlikely."`
			label choice
			choice
				`	"What should we do next?"`
					goto next
				`	"Are you sure that generating these graviton waves is safe?"`
			
			`	"I'm sure of nothing," she says, "but it seemed to work, and without any catastrophic side effects so far, so that's something."`
			label next
			`	Freya leads you to a warehouse in the spaceport where another one of the "graviton reflectors" is stored. "This should work the same as the one you brought to Hephaestus," she says. "If there's a transmitter on Shiver, we can bring the reflector to Sol and open a link back to the very heart of human space. And at that point, we may even have the Pug outgunned. But first, we need to drive them away from that star system for long enough for me to work the transmitter."`
				accept
	on visit
		dialog `You've landed on <planet>, but there are still Pug ships circling overhead. You should take off and help finish them off.`
	
	npc evade
		personality staying disables
		system Altair
		government Pug
		fleet 3
			names "pug"
			variant
				"Pug Maboro"
				"Pug Enfolta"
				"Pug Zibruka" 2
		fleet
			names "pug"
			variant
				"Pug Enfolta"
				"Pug Zibruka" 2



mission "FW Pug 5A: Enemies"
	landing
	invisible
	source Shiver
	to offer
		has "FW Pug 5: done"
	to fail
		has "FW Pug 6: done"
	
	npc kill
		personality waiting disables
		system Deneb
		government Pug
		fleet 4
			names "pug"
			variant
				"Pug Maboro"
				"Pug Enfolta"
				"Pug Zibruka" 2



mission "FW Pug 5A"
	landing
	name "Reflector to <planet>"
	description `Bring this "graviton reflector" to <planet> and set it up there, in order to restore the hyperspace link between the Sol and Altair systems.`
	source Shiver
	destination Earth
	clearance
	to offer
		has "FW Pug 5: done"
	cargo "graviton reflector" 10
	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 "liberation of altair"
		conversation
			`Sure enough, Freya finds a graviton wave transmitter on <origin>, set up to broadcast incoherent graviton noise in the direction of the Sol system. "This is it," she says. "If you can reach <planet> with the reflector before we are overrun by the Pug here, we can reopen the hyperspace link and the entire Navy will be at our backs. Hopefully the Syndicate got a message through and they'll have a fleet waiting for you when you arrive."`
			choice
				`	"You really think you can hold off the Pug if I make a run for <planet>?"`
				`	"I'm worried that you won't survive if I leave this system undefended."`
			`	"Don't worry about us here," she says. "We have a fair number of ships here on the ground, if it comes to that. But the most important thing is that you rendezvous with the Navy reinforcements in the <system> system, and if you can draw the Pug fleet to pursue you, all the better. Good luck, <first>."`
				accept
	on visit
		dialog `You land on <planet>, but realize that your escort carrying the graviton reflector hasn't entered the system yet. Better depart and wait for it to arrive.`
	
	npc
		government Republic
		personality staying
		system Sol
		fleet
			names "republic capital"
			fighters
				names "republic fighter"
			variant
				"Cruiser (Mark II)"
				"Combat Drone" 4
				"Frigate (Mark II)" 2
		fleet
			names "republic capital"
			fighters
				names "republic fighter"
			variant
				"Carrier (Mark II)"
				"Lance" 4
				"Combat Drone" 6
				"Gunboat (Mark II)" 3



mission "FW Pug 5B"
	landing
	name "Defend Altair"
	description "Freya sent you a message that the <system> system is under attack. Return there, accompanied by your new Navy reinforcements, and drive off the Pug."
	source Earth
	destination Shiver
	clearance
	to offer
		has "FW Pug 5A: 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 "Succeeded in rendezvousing with the Navy in the Sol system and reopening a link to the Pug territory. But now Shiver is under attack by a massive Pug fleet."
		event "reconnected altair"
		conversation
			`You help some Navy engineers on Earth to set up the graviton reflector according to Freya's instructions. As before, soon after the reflector is operational the ground seems to tilt and roll as Freya's beam homes in on the reflector and sets up a harmonic oscillation between the two. "The link is reopening!" says one of the engineers. "We're beginning to receive hyperspace communications from Altair again, and from the Syndicate too."`
			`	A second later your own communicator beeps. It's Freya. "Get back here quickly," she says. "Bring whatever reinforcements you can. A massive Pug fleet just appeared in orbit."`
				accept
	on visit
		dialog `You've landed on <planet>, but there are still Pug ships circling overhead. You should take off and help finish them off.`
	
	npc
		government Republic
		personality escort disables waiting
		fleet 2
			names "republic capital"
			fighters
				names "republic fighter"
			variant
				"Cruiser (Mark II)"
				"Combat Drone" 4
				"Frigate (Mark II)" 2
		fleet
			names "republic capital"
			fighters
				names "republic fighter"
			variant
				"Carrier (Mark II)"
				"Lance" 4
				"Combat Drone" 6
				"Gunboat (Mark II)" 3
	
	npc evade
		government Pug
		personality staying disables
		system Altair
		fleet 5
			names "pug"
			variant
				"Pug Maboro"
				"Pug Enfolta" 2



mission "FW Pug 6"
	landing
	name "Defeat the Pug"
	description "Now that the Navy has joined you, it is time to take the battle directly to the Pug home system. Once their fleet is eliminated, land on their home world of <planet> to attempt to negotiate for peace."
	autosave
	source Shiver
	destination Pugglemug
	clearance
	to offer
		has "FW Pug 5B: done"
	passengers 1
	blocked "You need a bunk free for Freya to continue this mission."
	on enter Deneb
		dialog
			`You enter the Deneb system expecting a massive Pug battle fleet to be waiting for you. Instead, it is entirely deserted. Also, your sensors are picking up some sort of anomaly outside the orbit of the outermost planet.`
	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 the final assault on the Pug homeworld. There seems to be no other option but to force them to surrender, but with the help of the Navy that no longer seems like an impossible task."
		event "pug flee"
		conversation
			`The tiny spaceport on Shiver is packed with people as more and more Navy ships come in for a landing. The Navy admirals have decided that there is no sense in delaying: you will be launching an attack on the Pug homeworld in the morning. Despite your success so far in battling the Pug, you know that if their entire fleet opposes you, even the Navy may not be strong enough to defeat them. This may be the last time you see many of these officers and crew members alive.`
			`	Everyone prepares for death in different ways. The spaceport's pub is packed, with the crowd spilling out into the hallway and loud music blasting. The chapel is equally full, and the sound of whispered prayers and chanting clashes with the dance music from the pub. Through the doorway of the chapel you see some people sitting cross-legged on the floor and others kneeling on prayer rugs, as the various cultures that make up the Republic do their best to share the space.`
			`	You find Freya sitting in a secluded nook on the upper floor of the spaceport building, watching the drifting snow out the window. "Ready for the last battle, Captain?" she asks.`
			choice
				`	"Sure, with the Navy at our backs I think we've got a good chance."`
				`	"As ready as I'll ever be, I guess."`
			`	She laughs. "I suppose that's the best we can hope for. Do you mind if I ride in your ship tomorrow, rather than one of the others? If this is the end, I'd rather face it with people I know." You agree. She turns back to look out the window.`
			`	Since Freya seems to want to be alone, you return downstairs, and discover that a sizeable Oathkeeper fleet has arrived. In the main vestibule of the spaceport, an Oathkeeper officer is leading a group in qigong meditation. And surprisingly, you spot Admiral Danforth sitting with the Muslim prayer group and chanting in fluent Arabic. Meanwhile, the party outside the pub continues.`
			`	Eventually morning comes, and you prepare your ship for the assault on the Pug homeworld...`
				accept
	
	npc
		government "Navy (Oathkeeper)"
		personality disables waiting
		fleet 2
			names "republic capital"
			fighters
				names "republic fighter"
			variant
				"Cruiser (Mark II)"
				"Combat Drone" 4
				"Frigate (Mark II)" 2
		fleet 2
			names "republic capital"
			fighters
				names "republic fighter"
			variant
				"Carrier (Mark II)"
				"Lance" 4
				"Combat Drone" 6
				"Gunboat (Mark II)" 3
	npc
		government Republic
		personality disables
		fleet 2
			names "republic capital"
			fighters
				names "republic fighter"
			variant
				"Cruiser"
				"Combat Drone" 4
				"Frigate" 2
		fleet 2
			names "republic capital"
			fighters
				names "republic fighter"
			variant
				"Carrier"
				"Lance" 4
				"Combat Drone" 6
				"Gunboat" 3
	npc
		personality disables waiting
		government Syndicate
		fleet 2
			names "syndicate capital"
			variant
				"Splinter (Mark II)"
				"Manta (Mark II)" 2
				"Quicksilver (Mark II)" 4
		fleet 2
			names "syndicate capital"
			variant
				"Protector" 2
	
	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 `The Pug have fled, apparently traveling through an artificial wormhole back to whatever galaxy they came from. And, it turns out that many of their cities on "Pugglemug" were only for show: buildings with no inhabitants, and with holograms creating the appearance of a heavily populated world. They left no advanced technology behind, and no sign of what their true intentions were, but it turns out that the fake cities here were designed for human habitation. They must have been planning this departure for a very long time.`
		log `Now that the Pug are gone, the Navy will be able to use the "graviton reflectors" to repair the broken hyperspace links and to reconnect all of human space.`
		log "Factions" "Pug" `The Pug disappeared from human space, and left behind more questions than answers. It is possible that the true purpose of their attack was to give human beings a common enemy that would force them to band together and forget their internal struggles.`
		event "pug territory liberated"
		event "pug link restoration 1" 10
		event "pug link restoration 2" 25
		event "pug link restoration 3" 45
		event "pug link restoration 4" 60
		conversation
			`As you bring your fleet in for a landing, you find that the main Pug spaceport is surprisingly empty. However, a group of Pug children are gathered in a loose circle on one of the landing pads. They appear to be playing some sort of game; they ignore your fleet overhead.`
			choice
				`	(Attack them.)`
				`	(Avoid harming them and land.)`
					goto avoid
			
			`	You fire a single shot into the center of the circle, leaving a dark scar on the landing pad and sending a plume of dust and smoke into the air. The children continue their game, as if nothing has happened.`
			label avoid
			`	You land your ship near the circle of Pug children. They are bouncing a ball back and forth between them, and studiously ignoring your presence. Aside from the sound of the ball striking the pavement, the entire city is eerily quiet. "This is really weird," says Freya.`
			choice
				`	(Explore the city.)`
					goto city
				`	(Join the game.)`
					goto join
			
			label join
			`	You step into the circle and make a grab for the ball, but it passes straight through your fingers. Freya reaches out to touch one of the children, and her hand, too, passes through them. "Some sort of holographic projection," she says.`
			`	The Navy ships are beginning to land and send crew out to explore. You and Freya walk into the city, passing by a pair of adult Pug who sit at a table outside what looks like some sort of cafe, playing a board game with black and white stones on a hexagonal grid. You check and find that they, too, are a holographic illusion.`
				goto house
			
			label city
			`	The Navy ships are beginning to land and send crew out to explore. You and Freya walk into the city. The streets are mostly deserted, but on one of them you pass by a pair of adult Pug who sit at a table outside what looks like some sort of cafe, playing a board game with black and white stones on a hexagonal grid.`
			choice
				`	(Attack them.)`
					goto attack
				`	(Try to talk to them.)`
					goto talk
			
			label attack
			`	You throw a punch at one of the Pug at the table, but your fist passes right through its head as if nothing is there. Surprised, Freya reaches out to touch the other one, and again her hand passes through them. "Some sort of holographic projection," she says. You continue exploring.`
				goto house
			
			label talk
			`	You try to talk to the Pug, but they, like the children, are ignoring you completely; they do not even seem to be aware of your existence. Finally, Freya reaches out to shake one of them by the shoulder, and her hand passes straight through it. Surprised, she waves her hands back and forth through both of them. "Some sort of holographic projection," she says.`
				goto house
			
			label house
			`	You continue to explore for a while. Aside from the illusions, the city seems to be deserted. "Let's check inside one of the houses," Freya says at last. You climb up the steps to what looks like an apartment building and find that all the doors are unlocked. Inside one of the living spaces, you explore the different rooms and find that the water fixtures and electricity are working, but a thick layer of dust covers everything. Freya, meanwhile, is staring at one of the electrical outlets. "<first>," she says, "do you see anything odd about this?"`
			choice
				`	"No, it's just an ordinary electric outlet."`
				`	"Everything here is odd. The city, the holograms, all of it."`
			`	She says, "It's an ordinary, human style electrical outlet. Human. In an alien city. And the steps we came up to get here: the Pug have legs half again as long as ours. But the tread spacing was at the normal human height. This building wasn't made for the Pug. It was made for us."`
			`	Reports begin coming in as the Navy explores the rest of the planet, and they are all finding the same thing: the cities are abandoned, many of them with signs that they were never inhabited in the first place. The first time you visited this planet, you thought it must have a billion inhabitants, but now it seems that its true population was less than a million - all of whom have apparently departed to somewhere beyond the wormhole.`
			`	Freya says, "Let's get back to the spaceport and meet up with the admirals."`



mission "FW Syndicate Extremists 1"
	name "Deal with the Syndicate"
	description "Now that the Pug appear to have been driven off, it's time to get some answers from the Syndicate. Travel with Admiral Danforth back to <destination> for another meeting with the CEO of the Syndicate."
	autosave
	source Pugglemug
	destination Foundry
	to offer
		has "FW Pug 6: 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 and Freya get back to the spaceport, Danforth pulls you aside. "We should talk," he says. He leads you to a private room aboard his ship, and says, "It seems that we've reached the end of whatever game these aliens were playing with us. And that means we need to get back to what we were doing before they interrupted us: bringing the Syndicate to justice."`
			choice
				`	"Sounds good. What's your plan?"`
					goto plan
				`	"We just fought a major battle, and the Syndicate helped us. Do we really want to be at war with them again?"`
			
			`	Danforth sighs. "No, I don't want more war. But I also don't think we can go back to trusting the Syndicate. Especially now that we know they've got nuclear weapons."`
			`	"What's your plan, then?" asks Freya.`
			label plan
			`	"From what I've heard of your conversation with their CEO, Korban," says Danforth, "I think the Syndicate leadership might be willing to surrender these extremists to us. Especially if it helps the leaders to clear their own names. I'm thinking we should stop by the Syndicate headquarters while the rest of their fleet is still occupied here. If just my ship and yours leave, it won't attract too much attention."`
				accept
	
	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"



mission "FW Syndicate Extremists 1A"
	landing
	name "Cloaking Device"
	description "Alastair Korban has agreed to give you a cloaking device that will allow you to evade missile attacks. Travel to Hephaestus, where they will install the device on your ship."
	autosave
	source Foundry
	destination Hephaestus
	to offer
		has "FW Syndicate Extremists 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
		log "With the Pug defeated, it is finally time to deal with the Syndicate extremists and the Alphas that they allied with. The extremists are armed with nuclear missiles, but the Syndicate CEO has agreed to provide a cloaking device that will make it possible to dodge the missiles."
		conversation
			`The presence of a Navy Cruiser in orbit seldom goes unnoticed, especially a Cruiser captained by someone as famous as William Danforth. As soon as you land, a Syndicate employee meets you and escorts you, Freya, and Danforth to the office of Alastair Korban, the CEO. He does not seem very happy to see you. "I only just got word that the aliens were defeated a few days ago," he says. "I'm surprised you're back here already."`
			`	Danforth says, "I've got a whole Navy fleet just a few jumps away from here who are itching to destroy something. So here's the deal. You name me some targets: the men who were responsible for the terrorist attack. Then I will do you a favor and take them off your hands. Fair enough?"`
			`	Korban sighs, and then opens his desk and pulls out a sheet of paper. "This is my resignation letter," he says. "I've been working on it since my first meeting with Captain <last>. I've failed in my leadership of this company. But you have no idea how deep that failure goes."`
			choice
				`	"What do you mean?"`
			
			`	"Years ago," he says, "some leaders of our financial division were approached by some... consultants. Some very intelligent and knowledgeable individuals. These consultants had built a powerful quantum computer, running a model of the galactic economy. They called it the 'Oracle.' As you may know, business is all about taking risks, for uncertain payoffs. But the Oracle gave us a way to predict the future, for everything from supply chain management to stock trading to the commodities market."`
			`	"These consultants," says Freya, "were they human?"`
			`	Alastair looks very uncomfortable. "Yes... and no," he says.`
			`	Danforth swears. "Alphas. You were dealing with the Alphas. What did you give them in return?"`
			`	"The Korath raids had just begun," says Alastair, "so we suddenly had access to alien technology. They were interested in all of it, but particularly the jump drives. So they could spread beyond human space."`
			choice
				`	"Was the information from the Oracle accurate?"`
					goto information
				`	"Why would you ever agree to work with the Alphas?"`
			
			`	"They have power. And knowledge. To some of us, that was enough," he says.`
			`	"Was that knowledge accurate?" asks Freya.`
			label information
			`	"Very accurate," he says. "Our business flourished like never before. But then a month came when instead, the Oracle's predictions were bleak. A massive recession was coming, an end to the golden days of the Republic. We tried altering the model in every way we could: changing our production, our wages. We even asked the Oracle if dissolving the Syndicate would avert the recession. But its predictions remained the same. Then we learned from our contacts in Parliament about the Southern Defense Pact, and the fear that they were about to declare independence. So we asked the Oracle what would happen if war broke out."`
			`	"You started a war... to save the economy?" says Danforth. He sounds disgusted. "Do you know how many lives have been lost because of your sick greed?"`
			`	Alastair snaps at Danforth. "Do you think we made this decision lightly? Do you know how many lives would have been lost had such a recession actually occurred? The last time the economy fell as hard as the Oracle predicted, humanity entered a dark age where millions died of starvation and billions more suffered from the resulting chaos!`
			`	"But... the Alphas were only too glad to help. Especially with the nuclear research. Which, incidentally, is why I'm telling you all this, because if your fleet tries to take out the Alphas, they'll strike back with nukes."`
			choice
				`	"Do you have an alternative to attacking them?"`
				`	"Is there any way we could disable the nukes?"`
			
			`	"We gave the Alphas most of the alien technology we recovered," he says, "but one device, we managed to keep secret from them. We found it in a Korath cargo hold, and it took us a long time to even figure out how to activate it. But when we did, we discovered that it's a cloaking device. It obscures a ship not just from the visible spectrum, but from radar as well, and every other sensor we've tested except for gravitational ones. I'm certain it would hide you from the tracking systems on the nukes."`
			`	Freya says, "But it would only hide one ship. That doesn't sound like it would do much good."`
			`	Alastair says, "They have a limited number of nukes. Our plan was to send a ship in cloaked, have it uncloak long enough to draw their fire, and then cloak to avoid the missiles. Basically, see how many missiles we can get them to spend before the main attack fleet arrives."`
			`	Danforth says, "That's not a bad idea. Captain <last>, would you be willing to serve as the decoy?"`
			choice
				`	"It sounds risky, but I'll do it."`
					goto end
				`	"Do I get to keep the cloaking device when I'm done?"`
			
			`	"I don't see why not," says Danforth, fixing Alastair with a piercing gaze. "It's certainly better than leaving it in Syndicate hands."`
			label end
			`	Alastair tells you that the device is being kept on Hephaestus, and the engineers there can install it in your ship. Meanwhile, Danforth will call in the rest of his Oathkeeper fleet. "And when we're through with this, I'll be seeing to it that this Oracle is destroyed so that this can never happen again," says Danforth. Alastair gives a meek nod in agreement. "Now, where are the Alphas."`
			`	"The Alphas are holed up on Buccaneer Bay," says Alastair, "an old pirate world. Good luck in defeating them."`
				accept
	
	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"



mission "FW Syndicate Extremists 1B"
	landing
	name "Final Battle"
	description "A fleet of nuclear-armed Syndicate extremists controlled by the Alphas is occupying the <system> system. Travel there and use the cloaking device to draw their fire; the Oathkeeper fleet will be right behind you."
	source Hephaestus
	destination "Buccaneer Bay"
	clearance
	to offer
		has "FW Syndicate Extremists 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
		"reputation: Syndicate (Extremist)" <?= -1000
		event "battle of algenib"
		outfit "Cloaking Device" 1
		conversation
			`You land in the same private hangar that you visited previously to have the jump drive installed, and you think these engineers are the same crew that met you back then. "This thing is almost as bizarre as the jump drive itself," one of them says. "We have no clue how it works, and we weren't done studying it when Korban ordered us to give it to you, so please don't get yourself blown up. Okay?"`
			`	Meanwhile, Danforth is on his way back to Deneb to rally the Oathkeepers. You should head directly for the <system> system, so that you arrive there far enough in advance of the Oathkeeper fleet.`
				accept
	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.`
	
	npc evade
		government "Syndicate (Extremist)"
		system Algenib
		personality staying heroic
		fleet
			names "syndicate capital"
			variant
				"Manta (Nuclear)" 2
	npc evade
		government "Syndicate (Extremist)"
		system Algenib
		personality staying heroic
		fleet
			names "syndicate capital"
			variant
				"Manta (Nuclear)" 2
	npc evade
		government "Syndicate (Extremist)"
		system Algenib
		personality staying heroic
		fleet
			names "syndicate capital"
			variant
				"Manta (Nuclear)" 2
	npc evade
		government "Syndicate (Extremist)"
		system Algenib
		personality staying heroic
		fleet
			names "syndicate capital"
			variant
				"Manta (Nuclear)" 2
	npc evade
		government "Syndicate (Extremist)"
		system Algenib
		personality staying heroic
		fleet 3
			names "syndicate capital"
			variant
				"Protector" 2
		fleet 2
			names "syndicate capital"
			variant
				"Splinter"
				"Quicksilver" 3
	
	npc
		government "Navy (Oathkeeper)"
		system Deneb
		personality heroic escort
		fleet
			names "republic capital"
			fighters
				names "republic fighter"
			variant
				"Carrier (Mark II)" 3
				"Lance" 12
				"Combat Drone" 18
				"Cruiser (Mark II)" 3
				"Combat Drone" 12



mission "FW Syndicate Extremists 1C"
	landing
	name "Report to Parliament"
	description "Return to Earth to report to Parliament on the resolution of the conflicts with the Pug and with the Syndicate extremists."
	autosave
	source "Buccaneer Bay"
	destination Earth
	clearance
	to offer
		has "FW Syndicate Extremists 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 "Succeeded in drawing the fire of the Syndicate extremists for long enough for a Navy fleet to safely arrive in-system and assist in destroying them. This cloaking device will come in very handy in the future."
		event "navy occupies algenib"
		event "navy done with algenib" 50
		conversation
			`Soon after you land, more Navy ships begin pouring into the system, including Admiral Danforth's own Cruiser. Navy soldiers and ships are scouring the whole surface of the planet; there is very little chance that any of the Alphas who remain here will be able to escape their detection. Admiral Danforth meets with you and Freya and thanks you for providing the decoy that kept his own ships from bearing the brunt of the Alphas' nuclear arsenal.`
			`	"Do you need us to do anything more here?" asks Freya.`
			`	"No," he says, "and I hear that Parliament wants to speak with you, Captain <last>. Something about an official commendation for your part in the battle against the Pug, I think. Meanwhile, this may not be the end of our trouble with the Syndicate, but at least it's a good start. It's been an honor to fight alongside you."`
			choice
				`	"You too, sir."`
					goto end
				`	"You mean this is the end? No more battles to fight?"`
			
			`	"What, does peace and reconciliation sound boring to you?" he says. "Don't worry about that. With that jump drive installed in your ship, the whole galaxy is open to you. Who knows what you might discover beyond the boundaries of human space?"`
			label end
			`	You return to your ship, and prepare for the journey back to Earth, hopeful that at last Parliament will be willing to negotiate a permanent peace with the Free Worlds.`
				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 "Received an official commendation from Parliament and a promise that the war with the Free Worlds is officially over. Humanity is at peace once more, but new challenges may await in the star systems out beyond human space that are accessible only by jump drive."
		log "Factions" "Free Worlds" `Tensions between the Free Worlds and the Republic mounted when additional systems decided to leave the Republic and join the Free Worlds, culminating in a series of military confrontations that ended when the Free Worlds were able to present credible evidence denying any involvement in the terrorist attacks. After the Free Worlds joined the effort to drive out the Pug invaders, the Republic officially recognized the Free Worlds and diplomatic relations were established.`
		log "Factions" "Syndicate" `It was exposed that the bombings of Geminus and Martini that helped cause the war between the Republic and Free Worlds were the doing of the Syndicate, designed by top executives with the help of a group of Alphas. Despite the claims that all the extremists responsible have been purged and handed over to the Navy, the reputation of the Syndicate will be damaged for years to come.`
		payment 5000000
		event "stack core for sale"
		"salary: Free Worlds" = 8900
		set "main plot completed"
		set "free worlds plot completed"
		set "free worlds reconciliation"
		conversation
			`On Earth, you return to something of a hero's welcome, far different from the first time you were here on a diplomatic mission. A crowd of locals gathers in the spaceport to watch your ship land. With the Free Worlds having been instrumental in defeating the aliens, and absolved of any guilt in the terrorist attacks, it seems that most people here are ready to see you as a hero rather than a criminal.`
			`	Your meeting with Parliament is long and grueling, as they press you and Freya for every detail you can give them about the enigmatic Pug and their apparent motivation in invading human space. The questions about the Syndicate are equally hard to answer. But at the end of the session, one of the members of Parliament informs you that they have authorized an official commendation for you, along with a reward of five million credits "to cover any of your expenses from fighting the aliens."`
			`	As you walk out, you find Alondo, JJ, and Katya sitting in the courtyard of Parliament. When they spot you walking towards them, JJ waves and says, "<first> and Freya! Am I glad to see the two of you still in one piece! What brings you to Earth?"`
			choice
				`	"I received a commendation from Parliament."`
				`	"Parliament wanted to interrogate us on what happened with the Pug and the Syndicate."`
					goto know
				`	"We just needed to deal with some boring administrative stuff."`
					goto bureaucratic
			`	"And I'm sure that it was very well deserved," says Katya with a smirk.`
				goto next
			
			label know
			`	"I hope that they were nicer questioning you than they were to me," Katya says with a grin.`
				goto next
			
			label bureaucratic
			`	"Well," Katya says while smirking, "You'll be glad to know that you aren't alone in grappling with the bureaucracy."`
			
			label next
			`	"What have you three been doing?" Freya asks.`
			
			branch good
				has "event: navy out of rastaban"
			`	Alondo says, "We've been talking to Parliament, and they're finally beginning to let off of us. They have signed a treaty with the Free Worlds, agreeing that the Navy will begin pulling out of any occupied systems, and that the Free Worlds will be allowed autonomy in the region they currently control as long as they do not seek to expand their territory further. As of now, our war against the Republic is officially over."`
				goto end
			
			label good
			`	Alondo says, "We've been talking to Parliament, and they're finally beginning to let off of us. They have signed a treaty with the Free Worlds, agreeing that the Free Worlds will be allowed autonomy in the region they currently control as long as they do not seek to expand their territory further. As of now, our war against the Republic is officially over."`
			
			label end
			`	"What about you two?" says JJ. "How did fighting the Pug go?"`
			`	You and Freya explain to the rest of the Council how the Pug were defeated, as well as the truth behind the Syndicate starting the war. When you finish, Katya says, "Vanishing aliens, prophetic supercomputers starting wars, Alphas pulling strings in the Syndicate's ranks; if I hadn't seen events just as unbelievable over the last few months, I would write what you're saying off as a bad conspiracy theory."`
			`	"Well, it looks like the Council is all together again," says JJ, "for the last time, as it so happens. Now that the war has ended, and the Pug have been defeated, the Senate has voted to dissolve the Council, leaving us free to return to civilian life. However, they've also agreed to pay you, <first>, a reduced salary in gratitude of your service. So, what do you think you will do next?"`
			choice
				`	"Build a merchant fleet and live a safe, quiet life."`
				`	"See if folks in the fringe worlds need any help against the pirates."`
				`	"Use my jump drive to explore beyond human space."`
			`	"Well, we all wish you the best of luck," says Freya. "We would never have gotten this far without you. Be sure to stay in touch." You hug each of them goodbye, and return to your ship. What you do next is up to you...`



mission "FW Navy Out Of Rastaban (Bad Karma)"
	landing
	invisible
	to offer
		has "FW Syndicate Extremists 1C: done"
		not "event: navy out of rastaban"
	on offer
		event "navy out of rastaban" 30
		fail
