# 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.

mission "FWC Scouting 1"
	landing
	name "Scout Kaus Borealis"
	description "Travel through the Kaus Borealis system to determine how strong the Navy presence is there, while JJ works to gather a fleet to attack it."
	autosave
	source "New Portland"
	waypoint "Kaus Borealis"
	to offer
		has "FW Liberate Delta Sagittarii: 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 `Drove the Navy out of Delta Sagittarii with the help of the "Wolf Pack," a militia group in favor of more extreme measures who launched a preemptive strike before the main Free Worlds force arrived. The Free Worlds are now committed to fighting the Republic to a standstill rather than proving their innocence; the defector has been recaptured by the Syndicate and whatever information he had to share is now lost.`
		conversation
			`It was a close battle, and could have gone very differently if it were not for the Wolf Pack strike that happened before you arrived and that disabled or destroyed the majority of the Navy fleet. You can't help but wonder how the Wolf Pack managed to assemble a large enough fleet to do that sort of damage.`
			`	"Well," says JJ, "the die is cast. It's too late now to wonder what that business with the Syndicate was about; now we're in a fight to the finish with the Republic. And that means we must strike soon, before they have time to bring in more reinforcements. Captain <last>, I'd like you to perform a scouting mission while I'm working on gathering a new fleet. Our next target has to be the Navy base on New Iceland. If we can drive them out of that system, our position will be much better. So, I'd like you to fly through Kaus Borealis and return here to report on their fleet strength. Understood?"`
			choice
				`	"No problem."`
					goto freya
				`	"Sure, but first, can you tell me how the Wolf Pack was able to do so much damage to the Navy?"`
			`	"As I said," says JJ, "they've gathered a surprising number of bounty hunters and others who operate on the fringes of society, and who are sympathetic to our cause."`
			label freya
			`	"One more thing," says Freya, "while you're traveling up North, I wonder if you could help to escort a convoy from the Rand system. There's no huge rush, but they're carrying supplies we need for a new reactor core for the Dreadnoughts, so the sooner you can meet up with them, the sooner the new reactors will be available."`
				accept
	
	npc
		personality staying heroic
		system "Kaus Borealis"
		government "Republic"
		fleet "Large Republic"
		fleet "Large Republic"
		fleet "Large Republic"
		fleet "Large Republic"
		fleet "Large Republic"



mission "FWC Attack Kaus Borealis"
	landing
	name "Attack Kaus Borealis"
	description "Destroy the Navy fleet defending Kaus Borealis. The Wolf Pack will attack them first to soften them up."
	autosave
	source "New Portland"
	destination "New Iceland"
	clearance
	to offer
		has "FWC Scouting 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 "fwc attack kaus borealis"
		conversation
			`When you return to New Portland, a sizeable Free Worlds fleet is already parked on the landing pads surrounding the spaceport. JJ explains to you, "When the Navy struck and cut out territory in half, a lot of these ships were cut off from their chain of command and just went and sheltered wherever they could. So it took a bit of doing to gather them all together. And now what we need is another stirring victory, or they'll begin to scatter again."`
			choice
				`	"Are you saying we risk having members of our militia desert?"`
					goto desert
				`	"Well, the fact that they all returned to fight is a good sign."`
					goto fight
			label desert
			`	"Yes," says JJ, "some of them already have. Think of it from the perspective of a militia member: you signed up to defend one planet against occasional pirates, not to spend years traveling from system to system battling the Navy. Some people have just had enough. This war needs to end, and end soon."`
				goto battle
			label fight
			`	"Well," says JJ, "at least some of them returned to fight. But many of them didn't. Think of it from the perspective of a militia member: you signed up to defend one planet against occasional pirates, not to spend years traveling from system to system battling the Navy. Some people have just had enough. This war needs to end, and end soon."`
				goto battle
			label battle
			choice
				`	"Well, we can't exactly conquer the Republic. Shouldn't we try diplomacy?"`
					goto diplomacy
				`	"It sounds to me like we need to make a convincing enough show of strength that Parliament will agree to a ceasefire."`
					goto strength
			label diplomacy
			`	"Yes," says JJ, "it will have to be a diplomatic solution in the end. But we must negotiate that solution from a position of strength, not weakness. And that means driving the Navy out of our territory."`
				goto plan
			label strength
			`	"Precisely," says JJ, "and the only way to do that is to drive the Navy out of our territory. And if that isn't enough... we have plans for that contingency as well."`
				goto plan
			label plan
			`	"So, now we attack Kaus Borealis?" you ask.`
			`	"That's right," he says. "Once again, the Wolf Pack will go in first and soften them up, then you and your ships will clean up. I've already given the Wolf Pack orders to attack, so please head straight to Kaus Borealis so you can join the fray before they have time to recover."`
				accept
	
	on complete
		event "fwc capture kaus borealis"
	
	npc
		personality heroic
		fleet
			names "free worlds capital"
			fighters "free worlds fighters"
			variant
				"Dreadnought"
				"Skein"
				"Finch" 6
		fleet
			names "free worlds capital"
			variant
				"Dreadnought"
				"Falcon (Heavy)"
		fleet
			names "free worlds capital"
			variant
				"Dreadnought"
				"Falcon (Plasma)"
		fleet
			names "free worlds capital"
			variant
				"Dreadnought"
				"Osprey"
	
	npc evade
		personality staying heroic
		system "Kaus Borealis"
		government "Republic"
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Carrier (Mark II)"
				"Lance" 4
				"Combat Drone" 6
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Carrier (Mark II)"
				"Lance" 4
				"Combat Drone" 6
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Cruiser (Mark II)"
				"Combat Drone" 4
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Cruiser (Mark II)"
				"Combat Drone" 4
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Cruiser (Mark II)"
				"Combat Drone" 4
	
	npc
		personality staying derelict
		system "Kaus Borealis"
		government "Republic"
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Carrier (Mark II)"
				"Frigate" 2
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Cruiser (Mark II)"
				"Frigate" 2



mission "FWC Cebalrai 1"
	landing
	name "Scout out Cebalrai"
	description "Scout out the Navy presence in the Cebalrai system, then report back to Tomek on <planet>."
	autosave
	source "New Iceland"
	waypoint "Cebalrai"
	to offer
		has "FWC Attack Kaus Borealis: 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 "Captured the Kaus Borealis system from the Navy, even though the locals are still loyal to the Republic. Also, learned that the Wolf Pack ships have been using nuclear missiles, and that is why they were so effective in decimating the Navy fleet."
		conversation
			`As you bring your ship in for a landing, it occurs to you that this is the first time that you have fought a battle for a star system that had not voluntarily decided to join the Free Worlds, and you are not sure what to do next. Fortunately, soon more Free Worlds ships begin arriving, and one of them is carrying Alondo. Tomek is with him. "Hi there, <first>," says Tomek. "Bet you didn't expect to see me again, huh?"`
			`	Alondo says, "<first>, I'll leave you and Tomek to catch up. I should go talk to the governor immediately. There's no way the locals will have failed to notice the nuclear explosions happening in space right over their heads."`
			choice
				`	"What? We weren't using nukes, just conventional weapons."`
					goto conventional
				`	"Wait, is that what the Wolf Pack was using?"`
					goto wolf
			label conventional
			`	"Yes," says Tomek, "but the Wolf Pack was using nukes." Seeing the incredulous look on your face, he says, "Well, how did you think they were doing all that damage? You thought they had some massive battle fleet hidden somewhere that no one knows about?"`
				goto next
			label wolf
			`	"That's right," says Tomek. He doesn't seem terribly happy about it. "How else would they be doing so much damage to the Navy? It's not like they've got a massive battle fleet stashed away somewhere."`
				goto next
			label next
			`	Alondo hurries off to the city hall to try to meet with the governor, and Tomek explains, "All the Wolf Pack has is a handful of very fast ships armed with nukes. They jump into the system, unload the missiles at whatever targets they can find, and then hightail it out of there before the Navy has a chance to respond. This is quite a mess you all have gotten into while I was gone, by the way."`
			choice
				`	"Weren't you under house arrest?"`
				`	"So, does the fact that you're here mean the Senate pardoned you?"`
			`	"Yes," he says. "After that incident with the Alphas on Poisonwood, some folks in the Senate started thinking that I was right to view the pirates as a threat. And when the Navy went on the offensive, they decided I was needed for the war effort. So I've been reinstated. Glad to hear you're on Council now too."`
			choice
				`	"So, what's our next step?"`
					goto end
				`	"I'm still really confused about why we're using nukes. Or where we got them from."`
			`	Tomek frowns. "I'm not too happy about that, myself. The Wolf Pack is buying them from a warlord on Greenrock. And the way they're paying him is with uranium, so every nuke he gives to us means another one or two he can build for himself. Not a good situation, if you ask me, but I guess the Wolf Pack thought it was the only way to turn the tide of the war."`
			`	"So, what do we do now?" you ask.`
			label end
			`	"Well," he says, "if we can take Cebalrai, our entire territory will be behind just two choke points, which will allow us to defend ourselves against the Navy without spreading the fleet too thin. So next, I'd like you to go scout out the Cebalrai system and report on the Navy's position there."`
				accept
	
	on enter Cebalrai
		dialog
			`There are a few Navy ships here, but nowhere near as many as were in the Kaus Borealis system before your last attack. Perhaps the Navy has decided to pull back their forces.`
	
	npc
		personality staying heroic
		system "Cebalrai"
		government "Republic"
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Carrier (Mark II)"
				"Lance" 4
				"Combat Drone" 6
				"Gunboat (Mark II)" 2



mission "FWC Cebalrai 1B"
	landing
	name "Capture Cebalrai"
	description "Lead an attack on the Cebalrai system and drive out or destroy any Navy ships that you find there."
	autosave
	source "New Iceland"
	destination "Tundra"
	clearance
	passengers 1
	to offer
		has "FWC Cebalrai 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 "fwc attack cebalrai"
		conversation
			`You meet up with Tomek and Alondo and tell them that the defenses in the Cebalrai system did not seem particularly strong. "They must've seen the writing on the wall and pulled back the rest of their fleet," says Alondo.`
			`	"Either that," says Tomek, "or they're wary of engaging us again now that they know we're willing to use nukes. Which I'm still not happy about, by the way. It's only a matter of time until they respond in kind. But in any case, our next move is clear: bring a fleet to Cebalrai and capture the system. <first>, you'll be in charge of that fleet. Alondo can travel with you to handle the diplomatic aftermath."`
				accept
	
	on complete
		event "fwc capture cebalrai"
	
	npc
		personality heroic
		fleet
			names "free worlds capital"
			variant
				"Dreadnought"
				"Bastion"
				"Fury (Flamethrower)" 4
		fleet
			names "free worlds capital"
			variant
				"Dreadnought"
				"Falcon (Heavy)"
				"Hawk" 2
		fleet
			names "free worlds capital"
			variant
				"Osprey"
				"Argosy (Blaster)" 2
	
	npc evade
		personality staying heroic
		system "Cebalrai"
		government "Republic"
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Carrier (Mark II)"
				"Lance" 4
				"Combat Drone" 6
				"Frigate (Mark II)" 2
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Frigate (Mark II)"
				"Gunboat (Mark II)" 2
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Frigate"
				"Gunboat" 2
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Cruiser"
				"Lance" 4
				"Frigate" 2



mission "FWC Nuke Supply 1"
	landing
	name "Uranium Convoy"
	description "Travel to Oblivion to escort a freighter that is delivering uranium to a warlord on Greenrock."
	autosave
	source Tundra
	destination Oblivion
	to offer
		has "FWC Cebalrai 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
		conversation
			`As you are bringing your ship in for a landing, you hear an odd plinking sound from the hull, similar to the sound of flying through a swarm of micrometeorites. After a few seconds, you realize that it's the sound of your ship being hit by small arms fire from the town below. Your hull is far too strong to be damaged by bullets, but the message is clear: you are not welcome here.`
			`	The spaceport is apparently deserted, and no one seems eager to come out and greet you. A few bullets continue to plink harmlessly off your hull, from snipers in the nearby buildings. "I think it would be best for me to just contact the governor via radio," says Alondo.`
			choice
				`	"Don't they know our fleet could easily destroy them if we wanted?"`
					goto destroy
				`	"Do you think we have any chance at a peace settlement?"`
					goto peace
			label destroy
			`	"That would be an awful precedent," says Alondo, "perhaps worse than the fact we're using nukes. If civilian populations become a legitimate target, any of our worlds could be attacked at any time. And it's not like there's any way to defend a world from orbital bombardment. No one would ever be able to feel safe in their own homes again."`
				goto next
			label peace
			`	"I hope so," says Alondo. "We'll let them keep shooting at us for a while, to vent their anger and let them prove their point. Then once they see the Navy isn't going to rescue them, we'll negotiate. That's really our only alternative. I do not want to be the person who authorizes the first attack on civilian targets since the dawn of the Republic."`
				goto next
			label next
			`	You wait for about an hour. Meanwhile, more Free Worlds ships continue to enter the system, one of which is carrying Tomek. He radios you and says, "I think we've got things under control here, which means there's a new mission for you. You probably aren't going to like this, but we need you to escort a freighter from Oblivion. Part of our ongoing deal with the Devil: a shipment of uranium headed for Greenrock."`
			`	A Free Worlds ship lands close enough to your own ship that Alondo can transfer over to it without being in sight of the snipers. "Good luck," he says as he departs. "I hope when you return we will have negotiated some sort of meeting with Parliament."`
				accept



mission "FWC Nuke Supply: Enemies"
	landing
	invisible
	to offer
		has "FWC Nuke Supply 1: done"
	
	to fail
		has "FWC Nuke Supply 1C: done"
	
	npc kill
		government Republic
		personality nemesis heroic
		system Cebalrai
		fleet
			names "republic capital"
			variant
				"Gunboat (Mark II)" 3	
	npc kill
		government Republic
		personality nemesis heroic
		system Castor
		fleet
			names "republic capital"
			variant
				"Gunboat (Mark II)" 3
	npc kill
		government Republic
		personality nemesis heroic
		system Betelgeuse
		fleet
			names "republic capital"
			variant
				"Gunboat (Mark II)" 3



mission "FWC Nuke Supply 1B"
	landing
	name "Uranium Convoy"
	description "Escort a freighter that is delivering uranium to a warlord on Greenrock."
	autosave
	source Oblivion
	destination Greenrock
	clearance
	to offer
		has "FWC Nuke Supply 1: done"
	on fail
		dialog `You have failed an essential Free Worlds mission. If you want to complete the story line, revert to the autosave or another earlier snapshot of the game.`
	
	on offer
		conversation
			`You land on <origin> and meet up with the grim-faced captain of a Bulk Freighter named the Blue Yonder. "The cargo is already loaded up," he says, "and I'm ready to go. The sooner we get this stuff out of my cargo hold and I can get back to shipping food and medicine, the better. I really hope you folks on Council know what you're doing."`
				accept
	
	npc accompany save
		personality escort timid
		government Merchant
		ship "Bulk Freighter" "F.S. Blue Yonder"
	
	on visit
		dialog "You have reached <planet>, but the Blue Yonder is not here yet! Better depart and wait for them to arrive in this star system."



mission "FWC Nuke Supply 1C"
	landing
	name "Warhead Convoy"
	description "Escort a freighter carrying nuclear warheads to Solace."
	source Greenrock
	destination Solace
	to offer
		has "FWC Nuke Supply 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 "Delivered a load of enriched uranium to a warlord's fortress on Greenrock, in exchange for warheads for the Free Worlds to use against the Navy. Hopefully forming such a friendly relationship with dangerous criminals will not cause trouble for the Free Worlds in the future."
		conversation
			`You land at one of the many private fortresses on Greenrock owned by various competing warlords. Some workers unload the cargo from the Blue Yonder, and load it up with some lead-lined, well-padded crates that must contain nuclear warheads. You're not sure you like being a part of this, but it may be true that this is the only way you will stand a chance against the Navy.`
				accept
	
	npc accompany save
		personality escort timid
		government Merchant
		ship "Bulk Freighter" "F.S. Blue Yonder"



mission "FWC Diplomacy 1"
	landing
	name "Let's Try Diplomacy"
	description "Return to Tundra to meet up with Alondo and take him on another visit to Parliament. Maybe this time they will be willing to negotiate a truce."
	autosave
	source Solace
	destination Tundra
	to offer
		has "FWC Nuke Supply 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
		conversation
			`A member of the Wolf Pack who identifies himself as "Odie" oversees the unloading of the warheads from your ship. "Excellent," he says. "It will take a while to install these in missiles. But once we do, in recognition of how much you have assisted us, Fifi has authorized us to sell them to you if you want."`
			choice
				`	"Great! I think I'd like a dozen of them."`
					goto yes
				`	"Sorry, I'm following orders by bringing this convoy here, but I want no part in the use of nuclear weapons, even for the sake of winning this war."`
					goto no
				`	"Wait, 'Fifi'? Is that your leader?"`
					goto fifi
			label yes
			`	He laughs. "I'm afraid that's not possible. Unlike most missile systems, we haven't yet developed any sort of feed system that would let you fire multiple missiles from the same gun port. So, it's a weapon you can only fire once from a given port. But on the plus side, two of them are enough to bring down the shields on even the largest Navy vessel."`
				goto next
			label no
			`	"That's understandable," he says. "And also foolish and shortsighted. But, I can understand why some people want to cling to the belief that war is some sort of noble endeavor rather than a no holds barred struggle for survival."`
				goto next
			label fifi
			`	"Yes," he says, "Fifi is the leader of the Wolf Pack. And she is an absolutely ferocious individual. I assure you that you do not want to be responsible for crossing her. Not that you'll ever have to, of course, because we're all on the same side here." He grins.`
				goto next
			label next
			`	Soon after he is done unloading the cargo, you receive a message from Alondo: "Good news, <first>! The Republic has agreed to allow us to make a diplomatic visit to Parliament. Hurry back here to <planet> before they change their minds."`
				accept



mission "FWC Diplomacy 1B"
	landing
	name "Let's Try Diplomacy"
	description "Travel to Earth with Alondo and meet with Parliament to try to negotiate terms of a truce."
	autosave
	source Tundra
	destination Earth
	clearance
	to offer
		has "FWC Diplomacy 1: done"
	passengers 2
	blocked "You have reached <origin>, but you don't have a bunk free for Alondo! You should return to <origin> once you have freed one up."
	on fail
		dialog `You have failed an essential Free Worlds mission. If you want to complete the story line, revert to the autosave or another earlier snapshot of the game.`
	
	on offer
		event "fw safe passage starts"
		event "fw safe passage ends" 7
		conversation
			`When you meet up with Alondo, he seems excited and optimistic. "The Republic has agreed to one week of safe passage," he says, "just enough time to get us to Earth and back. And what's more, I told them that one of our terms would be a mutual release of all prisoners of war, including Katya, and they agreed."`
			choice
				`	"That's great news! Let's get going!"`
					goto escort
				`	"Wait, isn't this the third time they've promised to give Katya back to us? I'm starting to think she isn't even alive anymore."`
			`	"Well, I sincerely hope you're wrong," says Alondo. "I miss her. We might never have gotten into such dire straits if she had been leading us."`
				goto escort
			label escort
			`	As you are returning to your ship, Alondo points out an Argosy parked next to you and says, "By the way, this ship will be escorting us on this mission. Providing a bit of extra defense."`
			choice
				`	"Um, I don't think an Argosy is strong enough to tip the scales in a battle against the Navy."`
				`	"Please tell me that thing isn't armed with nukes. Because that would cause a major diplomatic incident."`
					goto nukes
			`	Alondo sighs. "Yes, but the Senate thought if we brought anything bigger, it might look like an attack fleet rather than an escort. And of course, it's not carrying nukes, because if the Navy picked those up on their sensors, they'd blast us out of the sky long before we could land on Earth. Anyway, let's get going and hope for the best."`
				accept
			label nukes
			`	"No, no, of course not," sys Alondo. "If the Navy picked those up on their sensors, they'd blast us out of the sky long before we could land on Earth. Anyway, let's get going and hope for the best."`
				accept
	
	npc accompany save
		personality timid
		ship "Argosy" "F.S. Big Brother"

	on visit
		dialog "You have reached <planet>, but the Big Brother is not here yet! Better depart and wait for them to arrive in this star system."



mission "FWC Diplomacy 1C"
	landing
	name "Return to <planet>"
	description "The peace negotiations with Parliament failed. Return to <planet> without being destroyed by the Navy."
	source Earth
	destination Tundra
	to offer
		has "FWC Diplomacy 1B: 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.`
	
	on offer
		log "Visited Earth with Alondo to try to pressure Parliament into agreeing to a peace deal. The negotiations failed. Only escaped the planet safely because a Free Worlds ship in orbit threatened to bombard the Parliament building."
		log "Rescued Katya from the Republic's custody. She is not happy about the extreme measures the Free Worlds are taking to win this war."
		event "fw safe passage ends" 1
		conversation
			`When you land on Earth, the Big Brother flies down to the spaceport with you to see that you arrive safely, then takes off immediately. You and Alondo are escorted to the House of Parliament. As you wait to be called in to speak to Parliament, Alondo seems very nervous, pacing back and forth and fiddling with his watch every few minutes.`
			`	Finally you are invited into the Parliament chambers, and Douglas Xao, the Speaker, says, "Representatives of the Free Worlds, we are prepared to hear your demands."`
			`	Alondo says, "We're not here to make demands. We're here to work together to negotiate a peace settlement. The Free Worlds are prepared to return all our prisoners of war, to cede control of the Cebalrai and Kaus Borealis systems back to the Republic, and to promise not to expand our territory north into the so-called 'breadbasket' worlds, even if those worlds want to join us. All we ask in return is autonomy, and peace, and a return of the prisoners you have taken, including Katya Reynolds."`
			`	Xao gestures to the guards, and they escort in a third person to stand beside the two of you. It takes you a moment to realize that it's Katya, looking rather worn-out and bedraggled. She whispers to you, "So, you're using nukes now? Whose damn fool idea was that?"`
			choice
				`	"It was the only way we could resist the Navy."`
				`	"I didn't find out that's what they were doing until afterwards. I don't like it any more than you do."`
			`	"Fair enough," she says, "but I hope it doesn't wreck our chances at negotiation."`
			`	Xao addresses the three of you. "We have heard your demands," he says, "and now, here is our response. Katerina Reynolds, Alondo Gruyere, and <first> <last>, you are hereby charged with treason and insurrection. Your trial will begin immediately."`
			choice
				`	"What? We were guaranteed safe passage!"`
				`	"You will regret this! If you arrest us, the Free Worlds will retaliate against you."`
			`	As you try to protest, Alondo speaks up. He is not shouting, but his voice carries over the murmur of other voices. "We have a ship in orbit. If we do not return--"`
			`	Xao cuts him off. "Your ship is no threat to us. We have already verified that it carries no nuclear weapons, and this building's shielding and anti-missile systems are quite sufficient to defend against conventional weapons. And there is nothing in its cargo hold but ordinary, non-radioactive metals."`
			`	Alondo says, "That's right. Tungsten, to be exact. Aerodynamic tungsten rods, each the size of a tree trunk, with a simple guidance system on one end. Our ship is in low earth orbit, traveling at a velocity of roughly eight kilometers per second." As he speaks, the Parliament chamber gradually grows very quiet. "So we will be returning to our ship," says Alondo, "with Miss Reynolds. If the ship in orbit does not hear from me every two minutes, it will jettison its cargo, and there will be nothing left of this building but a crater." He points to the watch he is wearing, and you realize that it must be some sort of communicator.`
			`	After a brief whispered consultation with a few of the other members of Parliament, Xao says, "You will lose this war, and you will pay dearly for it. Guards, let them return to their ship." You hurry back to your ship and take off immediately, aware that as soon as you are out of range of Earth, the Navy will probably be more than willing to attack you.`
				launch
	
	npc
		personality timid
		ship "Argosy" "F.S. Big Brother"

	npc
		personality staying heroic
		system "Vega"
		government "Republic"
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Carrier (Mark II)"
				"Lance" 4
				"Combat Drone" 6
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Carrier (Mark II)"
				"Lance" 4
				"Combat Drone" 6
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Cruiser (Mark II)"
				"Combat Drone" 4
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Cruiser (Mark II)"
				"Combat Drone" 4
	
	npc
		personality staying heroic
		system "Denebola"
		government "Republic"
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Carrier (Mark II)"
				"Lance" 4
				"Combat Drone" 6
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Carrier (Mark II)"
				"Lance" 4
				"Combat Drone" 6
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Cruiser (Mark II)"
				"Combat Drone" 4
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Cruiser (Mark II)"
				"Combat Drone" 4



mission "FWC Checkmate 1"
	landing
	name "Defend Cebalrai"
	description "Destroy the Republic ships that are attacking this system, then land and decide what to do next. Free Worlds reinforcements should be on their way."
	autosave
	source Tundra
	to offer
		has "FWC Diplomacy 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
		event "fwc defend cebalrai"
		conversation
			`When you land on Tundra, Tomek seems glad to see Katya back, but you sense that he's also a little wary of how she will respond to the choices the Free Worlds have been making. "Using nukes, threatening orbital bombardment," says Katya, "treating the Syndicate as an ally. Anything else I missed while I was gone?"`
			choice
				`	"We only want this war to be over as soon as possible."`
				`	"We've just been trying to avoid being destroyed by the Navy, and things have gotten a bit out of hand."`
			`	"I see," she says. "Did you have a plan for what comes next, or are we just winging it now?"`
			`	Alondo says, "Unfortunately, we do have a plan. Our very last contingency plan. We call it the 'checkmate' option. Our fleet will push north--"`
			`	He is interrupted by one of Tomek's men running into the room. "Sir, we have a major Navy fleet incoming. We need all ships in the air immediately to repulse them. Reinforcements are on their way, but they may not get here for a while."`
			`	Tomek says, "So, it begins. Captain <last>, get back to your ship and aid in the defenses."`
				launch
	
	npc
		personality heroic
		fleet
			names "free worlds capital"
			fighters "free worlds fighters"
			variant
				"Dreadnought"
				"Skein"
				"Finch" 6
				"Fury (Flamethrower)" 4
		fleet
			names "free worlds capital"
			variant
				"Dreadnought"
				"Falcon (Heavy)"
				"Hawk" 2
		fleet
			names "free worlds capital"
			variant
				"Osprey"
				"Argosy (Blaster)" 2
	
	npc
		personality heroic waiting
		government "Free Worlds"
		fleet
			names "free worlds capital"
			variant
				"Dreadnought"
				"Bastion (Laser)"
		fleet
			names "free worlds capital"
			variant
				"Dreadnought"
				"Falcon (Laser)"
	
	npc evade
		personality staying heroic
		government "Republic"
		fleet
			names "republic small"
			fighters "republic fighter"
			variant
				"Frigate (Mark II)"
				"Gunboat (Mark II)" 2
				"Rainmaker (Mark II)" 2
		fleet
			names "republic small"
			fighters "republic fighter"
			variant
				"Frigate (Mark II)"
				"Gunboat (Mark II)" 2
				"Rainmaker (Mark II)" 2
		fleet
			names "republic small"
			fighters "republic fighter"
			variant
				"Frigate (Mark II)"
				"Gunboat (Mark II)" 2
				"Rainmaker (Mark II)" 2
	
	npc evade
		personality heroic
		government "Republic"
		system Menkent
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Carrier (Mark II)"
				"Lance" 4
				"Combat Drone" 6
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Cruiser (Mark II)"
				"Combat Drone" 4
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Cruiser (Mark II)"
				"Combat Drone" 4
	
	npc evade
		personality heroic
		government "Republic"
		system Sol
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Carrier (Mark II)"
				"Lance" 4
				"Combat Drone" 6
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Cruiser (Mark II)"
				"Combat Drone" 4
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Cruiser (Mark II)"
				"Combat Drone" 4
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Cruiser (Mark II)"
				"Combat Drone" 4
	
	npc evade
		personality heroic
		government "Republic"
		system Pollux
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Carrier (Mark II)"
				"Lance" 4
				"Combat Drone" 6
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Cruiser (Mark II)"
				"Combat Drone" 4
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Carrier (Mark II)"
				"Lance" 4
				"Combat Drone" 6
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Cruiser (Mark II)"
				"Combat Drone" 4
	
	npc
		personality heroic
		system Rastaban
		government "Free Worlds"
		fleet
			names "free worlds capital"
			variant
				"Dreadnought"
				"Bastion"
		fleet
			names "free worlds capital"
			variant
				"Dreadnought"
				"Falcon"
		fleet
			names "free worlds capital"
			variant
				"Dreadnought"
				"Falcon (Plasma)"
	
	npc
		personality heroic
		system Pherkad
		government "Free Worlds"
		fleet
			names "free worlds capital"
			fighters "free worlds fighters"
			variant
				"Dreadnought"
				"Skein"
				"Finch" 6
		fleet
			names "free worlds capital"
			variant
				"Dreadnought"
				"Falcon (Heavy)"
		fleet
			names "free worlds capital"
			variant
				"Dreadnought"
				"Falcon (Plasma)"
		fleet
			names "free worlds capital"
			variant
				"Dreadnought"
				"Osprey (Missile)"
	
	on complete
		log "Defended Tundra against a major Navy counter-offensive. From here, the only recourse available to the Free Worlds seems to be to push deep into Republic territory and capture the Sol system, forcing the Navy to surrender. Nuclear weapons are now for sale on Solace to aid in the final assault."
		event "fwc defended cebalrai"
		event "fwc solace has nukes"
		"salary: Free Worlds" = 6000
		conversation
			`Tomek and Alondo meet you when you land. Tomek says, "Good work aiding in the defense. Now we need to move before the Navy has time to regroup. And the Senate has decided that you will be in charge of the fleet that makes our counterattack."`
			`	Alondo says, "They have also approved a salary increase for you, to six thousand credits per diem. I know that's probably still not enough, but we are running a bit low on cash."`
			`	"One other thing," says Tomek. "I don't know how you'll feel about this, but I received word from Solace that they have nukes for sale if you want any. I'd advise against it, but it's up to you. Also, since you will be the flagship of our assault, you should make any improvements you feel are necessary to your ship. Then meet us back here, in the spaceport. Of course, if you're ready to go immediately that's fine, too."`



mission "FWC Checkmate 1: Equipment"
	landing
	name "Upgrade Your Ship"
	description "If you want, travel to <destination> to install nuclear missiles in your ship. You may also want to invest in some other upgrades. Then meet Tomek and the others in the spaceport on Tundra."
	source Tundra
	destination Solace
	to offer
		has "FWC Checkmate 1: done"
	
	to fail
		has "FWC Checkmate 1B: offered"



mission "FWC Checkmate 1: Equipment 2"
	landing
	name "Upgrade Your Ship"
	description "Make any further upgrades to your ship that you consider necessary. Then meet Tomek and the others in the spaceport on Tundra."
	source Solace
	destination Tundra
	to offer
		has "FWC Checkmate 1: Equipment: done"
	
	to fail
		has "FWC Checkmate 1B: offered"



mission "FWC Checkmate 1B"
	name "Attack Menkent"
	description "The Wolf Pack has launched an initial attack on the Menkent system. Follow up with your fleet and finish off the Navy defenses. Katya will ride with you."
	autosave
	source Tundra
	destination "New Austria"
	clearance
	to offer
		has "FWC Checkmate 1: done"
	passengers 1
	blocked "You have returned to <origin>, but you do not have a bunk free for Katya. You should return here once you have a bunk free."
	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 "fwc attack menkent"
		conversation
			`You meet up with Tomek in the spaceport. He is talking with the captain of one of a group of four Clippers that have landed next to each other some distance away from the rest of the Free Worlds fleet. The Clippers appear to have unusually large engines and afterburners, and in place of guns they are each carrying four missiles. Tomek sees you approaching and says, "And here's Captain <last>. Captain, are you ready to lead the attack?"`
			choice
				`	"Yes, I'm ready."`
					goto ready
				`	"Are these the Wolf Pack ships?"`
			`	"Yes indeed," says Tomek. "I know, you probably have mixed feelings about this, but they really are the quickest way to win this war."`
			label ready
			`	Tomek tells the Wolf Pack captain, "Okay, we're ready to go. Launch immediately, and Captain <last> will follow behind you. <first>, Katya has asked to travel with you; she wants to get back into the action, and I thought she might have the best chance of anyone at dealing with the folks on the ground on <planet>. Once again, you'll need to drive off any Navy ships before landing there. Good luck."`
				accept
	
	on complete
		event "fwc capture menkent"

	npc
		personality heroic
		fleet
			names "free worlds capital"
			fighters "free worlds fighters"
			variant
				"Dreadnought"
				"Skein"
				"Finch" 6
		fleet
			names "free worlds capital"
			variant
				"Dreadnought"
				"Falcon (Plasma)"
		fleet
			names "free worlds capital"
			variant
				"Dreadnought"
				"Osprey (Missile)"
	
	npc
		personality staying heroic uninterested disables
		government "Free Worlds"
		system Menkent
		ship "Clipper (Nuclear)" "F.S. Warmaker"
		ship "Clipper (Nuclear)" "F.S. Pestilence"
		ship "Clipper (Nuclear)" "F.S. Disease"
		ship "Clipper (Nuclear)" "F.S. Famine"
	
	npc evade
		personality heroic staying
		government "Republic"
		system Menkent
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Carrier (Mark II)"
				"Lance" 4
				"Combat Drone" 6
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Cruiser (Mark II)"
				"Combat Drone" 4
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Carrier (Mark II)"
				"Lance" 4
				"Combat Drone" 6
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Cruiser (Mark II)"
				"Combat Drone" 4
	npc
		personality derelict
		government "Republic"
		system Menkent
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Carrier (Mark II)"
				"Frigate (Mark II)" 2
				"Gunboat (Mark II)" 1
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Cruiser (Mark II)"
				"Frigate (Mark II)" 1
				"Gunboat (Mark II)" 2



mission "FWC Checkmate 1C"
	landing
	name "Capture <planet>"
	description "Bring a fleet to <destination>, driving off any Republic ships in the system."
	autosave
	source "New Austria"
	destination "Silver"
	clearance
	to offer
		has "FWC Checkmate 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
		event "fwc attack vega"
		conversation
			`As soon as you land, you and Katya contact Tomek and inform him that the system is yours. "Excellent," he says. "Press on with your fleet and take Vega before they have time to regroup. Another Wolf Pack fleet will meet you there for the final assault on the Sol system."`
			choice
				`	"Understood. We will depart immediately."`
					accept
				`	"Are we really sure we want to attack Earth?"`
			`	"Have they given us any other choice?" asks Tomek. "We tried diplomacy. And we cannot hope to defeat the entire Navy. So, unless we wish to surrender and all be put on trial as war criminals, we need to press on and gain the upper hand in the only way we can. The Senate and the Council are agreed on this." You have no choice but to follow his orders and to begin getting your fleet ready for the next attack.`
			``
			`[Take good care of this fleet, because it will have to last you for the rest of this campaign: 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
	
	on complete
		log "The Free Worlds have captured the Vega system, only one hyperjump away from Earth. Nuclear-armed Wolf Pack ships will be arriving shortly to spearhead the assault, but the Navy fleet defending Earth will be massive. Casualties on both sides are likely to be extremely high."
		conversation
			`The Vega system is eerily deserted. You suspect that the Navy must have pulled back all available ships to defend Earth, rather than trying to fight you here. You try not to think about how massive the fleet there must be, and how slim your chances are of destroying it.`
			`	Katya says, "Well, this is it, the final assault. Meet me in the spaceport when you're ready for the attack on Earth."`



mission "FWC Checkmate Escorts"
	landing
	invisible
	to offer
		has "FWC Checkmate 1B: done"
	to fail
		has "FWC Pug 4: done"
	
	npc kill
		personality heroic disables
		fleet
			names "free worlds capital"
			variant
				"Dreadnought"
				"Bastion (Laser)"
				"Argosy (Blaster)"
				"Argosy (Laser)"
		fleet
			names "free worlds capital"
			fighters "free worlds fighters"
			variant
				"Skein"
				"Finch" 6
				"Dreadnought"
				"Falcon (Plasma)"
		fleet
			names "free worlds capital"
			variant
				"Dreadnought"
				"Falcon (Laser)"
				"Osprey (Laser)"
		fleet
			names "free worlds capital"
			variant
				"Falcon (Heavy)"
				"Osprey (Laser)"
				"Argosy (Turret)"



mission "FWC Pug 1"
	name "Defend <planet>"
	description "<planet> is under attack by ships of an unknown type. Drive them off, and then return to the planet to figure out what to do next."
	source "Silver"
	to offer
		has "FWC Checkmate 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
		event "fwc pug invasion"
		conversation
			`Once you have gathered in the spaceport with the captains in charge of your fleet, Katya contacts Tomek and asks for instructions. He says, "A Wolf Pack fleet should arrive there shortly. They're carrying all the nukes we had left. They will go in first and--"`
			`	Abruptly, his voice cuts off in a burst of static. "What the hell?" says Katya. She tries to reestablish a connection to Tomek, but is unable to. Confused, she says, "What's going on? Is the Navy destroying the hyperspace communications relays, now? Or jamming them somehow?"`
			`	One of the communications technicians says, "They must've taken out the relays. I can't get a signal from Earth, or Tundra, or Bourne, or, well, anywhere else, for that matter, except the Altair system, right next to this one."`
			choice
				`	"How do the hyperspace relays work? Is there any way around them?"`
					goto around
				`	"Are you sure the signal has been cut, and not just jammed?"`
					goto jam
			
			label around
			`	"Only if you want to communicate at the speed of light," says the technician, "and in that case you'd need to wait a few years to get a message out to Tomek. So no, there is not any way around the relays. They're essential to the galactic communications network, which is why even at the worst parts of this war we've never seriously considered destroying them."`
				goto attack
			
			label jam
			`	"I don't know of any technology that could jam them," says the technician. "It's possible, but I think the more likely explanation is that they've been destroyed. Which is crazy, because the entire galactic communications network depends on them. Even at the worst parts of this war we've never seriously considered destroying them."`
				goto attack
			
			label attack
			`	Just then, another militia officer runs into the room. "We're under attack!" he says. "We need every ship in our fleet in orbit, right now!"`
			choice
				`	"Who is attacking us? The Navy?"`
				`	"Have the Wolf Pack reinforcements arrived yet?"`
					goto reinforcements
			
			`	"No," he says. "I've never seen ships like these before in my life. The Wolf Pack reinforcements just arrived in orbit, and a second later, these ships appeared and started slicing them to ribbons. If you don't get your fleet up there, there won't be anything left of them."`
				goto end
			
			label reinforcements
			`	"Yes," he says, "and a second after they arrived in system, this other fleet of ships appeared, unlike any ships I've ever seen before. They're tearing the Wolf Pack fleet to ribbons. If you don't get up there immediately, none of them will be left alive."`
			label end
			`	You and hurry to your ship and fire it up for a hasty launch...`
				launch
	
	npc
		personality waiting heroic
		government "Free Worlds"
		fleet
			names "free worlds small"
			fighters "free worlds fighters"
			variant
				"Skein"
				"Finch" 6
				"Clipper"
				"Clipper (Heavy)"
				"Clipper (Speedy)"
		fleet
			names "free worlds small"
			variant
				"Clipper (Nuclear)"
		fleet
			names "free worlds small"
			variant
				"Clipper (Nuclear)"
		fleet
			names "free worlds small"
			variant
				"Clipper (Nuclear)"
		fleet
			names "free worlds small"
			variant
				"Clipper (Nuclear)"
		fleet
			names "free worlds small"
			variant
				"Bastion (Laser)"
				"Argosy"
				"Argosy (Blaster)"
				"Argosy (Laser)"
				"Argosy (Missile)"
				"Argosy (Turret)"
	
	npc evade
		personality staying disables heroic
		government Pug
		fleet
			names "pug"
			variant
				"Pug Maboro"
				"Pug Enfolta"
				"Pug Zibruka" 2
		fleet
			names "pug"
			variant
				"Pug Maboro"
				"Pug Enfolta"
				"Pug Zibruka" 2
		fleet
			names "pug"
			variant
				"Pug Enfolta"
				"Pug Zibruka" 2
	
	npc evade
		personality entering disables heroic
		government Pug
		fleet
			names "pug"
			variant
				"Pug Maboro"
				"Pug Enfolta"
				"Pug Zibruka" 2
		fleet
			names "pug"
			variant
				"Pug Maboro"
				"Pug Enfolta"
				"Pug Zibruka" 2
		fleet
			names "pug"
			variant
				"Pug Enfolta"
				"Pug Zibruka" 2
		fleet
			names "pug"
			variant
				"Pug Enfolta"
				"Pug Zibruka" 2
		fleet
			names "pug"
			variant
				"Pug Enfolta"
				"Pug Zibruka" 2
	
	npc evade
		personality disables heroic
		government Pug
		system "Delta Capricorni"
		fleet
			names "pug"
			variant
				"Pug Maboro"
				"Pug Enfolta"
				"Pug Zibruka" 2
		fleet
			names "pug"
			variant
				"Pug Maboro"
				"Pug Enfolta"
				"Pug Zibruka" 2
		fleet
			names "pug"
			variant
				"Pug Enfolta"
				"Pug Zibruka" 2



mission "FWC Pug 1B"
	landing
	name "Investigate <system>"
	description "This area of space has somehow been cut off from the rest of the galaxy. Visit <planet> to see if they, too, have been invaded by the aliens."
	source "Silver"
	destination "Shiver"
	to offer
		has "FWC Pug 1: done"
	on fail
		dialog `You have failed an essential Free Worlds mission. If you want to complete the story line, revert to the autosave or another earlier snapshot of the game.`
	
	on offer
		log "The moment the nuclear-armed Wolf Pack ships arrived in-system to prepare for the assault on Earth, a fleet of alien ships appeared and attacked them. In addition, the aliens somehow cut off the Vega system from the rest of human space."
		event "fwc pug peaceful"
		conversation
			`The spaceport is in chaos. You eventually find Katya and report that the alien invasion fleet has been destroyed, but at a steep cost. "I'm sure we'll come to regret those losses deeply," she says. "The Wolf Pack nukes were all spent to repel that assault. And based on what we've found out here, we aren't going to be receiving reinforcements any time soon. We've somehow been cut off from the rest of human space."`
			choice
				`	"How is that possible?"`
					goto possible
				`	"Do we have any idea who these aliens are?"`
					goto aliens
			
			label possible
			`	"I have no idea," she says, "but the aliens must have the ability to collapse hyperspace links. That's why our communications were cut. It wasn't the relays that were destroyed, it was the hyperspace pathways themselves. And meanwhile, some new links have appeared, to here." She points on your map to a star that, until now, had been completely inaccessible via hyperspace. "Deneb. That must be where the aliens came from."`
				goto next
			
			label aliens
			`	"We have no idea," she says. "But, they appear to have the ability to destroy hyperspace links. That's why our communications went dead; it wasn't the relays we lost, it was the pathways themselves. And, they are apparently able to create new links as well." She points to a galactic map that she had been examining when you came in; several links have been scribbled out and new ones have been drawn in. "This is the star we call Deneb," she says, pointing to a star that, until now, had been inaccessible via hyperspace. "This must be where they came from."`
				goto next
			
			label next
			`	"What do we do now?" you ask.`
			`	"Well," she says, "to start out with, we need more information. I'm hoping you can somehow get past the aliens and land on <planet>, and see if they were attacked too and if so, whether anyone is still alive there. I'll stay here with the rest of the Wolf Pack in case we need to repel another attack."`
				accept



mission "FWC Pug 2"
	landing
	name "Report to Katya"
	description "You met someone on Shiver who was able to give you more information about the aliens and their intentions. Report back to Katya with what you discovered."
	source "Shiver"
	destination "Silver"
	to offer
		has "FWC Pug 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 "Found out that the aliens who attacked the Wolf Pack fleet call themselves the Pug. After destroying that fleet, the aliens have not attacked anyone else except a few merchants who tried to resist them. They came from a nearby star system that did not previously have any hyperspace connections to human space, and seem intent on controlling and perhaps enslaving the local human population."
		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 that looks like some sort of weapon, but none of them move to attack you.`
			`	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.)`
					goto board
				`	(Take off before I draw the Pug's attention.)`
			
			`	You start to get ready to take off, but he gestures urgently to you. Reluctantly, you decide to wait and hear what he has to say.`
			label board
			`	You open your ship's hatch and allow him to come on board. "What's going on here?" you ask. "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
			`	You thank him for the information, and prepare to return to the <system> system to talk with Katya. Perhaps the fact that the aliens are no longer attacking you means you can negotiate some sort of truce.`
				accept



mission "FWC Pug 2B"
	landing
	name "Visit the Pug"
	description "Locate the Pug homeworld, which is presumably in the <system> system, and see if you can negotiate with them."
	source "Silver"
	destination "Pugglemug"
	clearance
	to offer
		has "FWC Pug 2: done"
	passengers 1
	blocked "You need to have a bunk free for Katya to continue with the next mission. Complete or abort whatever mission is using up all your passenger space, then return here to <origin>."
	on fail
		dialog `You have failed an essential Free Worlds mission. If you want to complete the story line, revert to the autosave or another earlier snapshot of the game.`
	
	on offer
		conversation
			`You report to Katya that the alien ships did not attack you on your trip to Shiver and back, and that the locals there seem to have consented to be governed by the aliens in exchange for peace. "We haven't had any further attacks here," she says. "Do you think it's safe to try to visit the alien home world?"`
			choice
				`	"I think as long as we don't attack them, they won't attack us."`
					goto yes
				`	"No, but I do want to get answers from them, and that may be the only way."`
					goto no
			
			label yes
			`	"I'm not so sure," she says. "After all, they did attack us once before. And from what I hear from the Wolf Pack captains, the aliens were the ones who fired first. On the other hand, I don't think we have much choice, unless we want to settle down and spend the rest of our lives as alien vassals, cut off from all our friends in the rest of the galaxy."`
				goto end
			
			label no
			`	"Agreed," she says. "They may choose to destroy us, but it's not like we have any other options. I don't particularly want to settle down and spend the rest of our lives as alien vassals, cut off from all our friends in the rest of the galaxy."`
				goto end
			
			label end
			`	Katya boards your ship, and you get ready for a diplomatic visit to the alien homeworld.`
				accept



mission "FWC Pug 2B: Pugglequat"
	landing
	source Pugglequat
	to offer
		has "FWC Pug 2B: active"
		not "FWC Pug 2C: done"
	
	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 "FWC Pug 2C"
	name "Visit <planet>"
	description "Visit <destination>, which was part of Free Worlds territory before the alien invasion, and see if any military equipment is still available there."
	landing
	source Pugglemug
	destination Oblivion
	to offer
		has "FWC Pug 2B: done"
	passengers 1
	on fail
		dialog `You have failed an essential Free Worlds mission. If you want to complete the story line, revert to the autosave or another earlier snapshot of the game.`
	
	on offer
		log `Visited the homeworld of the Pug, the aliens who have taken over this region of space. They claim that when the Free Worlds fleet was threatening to invade Earth, they had no choice but to interfere to prevent humanity from destroying itself. They say that their plan is to slowly bring more and more human worlds under their "protection," but what they are talking about sounds more like slavery.`
		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 are the ones who resisted us," 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 our 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? They chose violence, and so they perished by violence. That is justice."`
			`	Katya 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 Katya.`
			`	"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. Now, are you prepared to pledge your loyalty?"`
			choice
				`	"I'm sorry, but you have no right to govern us."`
					goto no
				`	"Very well, we pledge our loyalty."`
					goto yes
			
			label no
			`	"Very well, if you are not yet ready to consent to be governed by us, we will give you more time," says the alien. "In the meantime, please do not attack our ships, or we will be forced to destroy you. Which we would regret deeply." It makes an odd gesture similar to a bow, and walks off.`
				goto end
			
			label yes
			`	"I am pleased to hear that," it says. "In time you will come to be thankful that you were present at the beginning of this new era of peace and prosperity for your species. And do not fear for your friends in other parts of human space who are, for a time, cut off from you. You will be reunited soon, under our protection." It makes an odd gesture similar to a bow, and walks off.`
				goto end
			
			label end
			`	"I don't like this at all," says Katya. "Let's head to <planet> and see if any of our equipment is left there from back when it was part of the front in the war against the Republic. Maybe we can find something useful there."`
				accept



mission "FWC Pug 2D"
	landing
	name "Escape Pug Space"
	description "Disable one of the Pug ships, steal its jump drive, and use it to escape from their territory and report to the Free Worlds that an alien invasion is imminent."
	source "Oblivion"
	destination "New Iceland"
	clearance "The locals are terrified by the fact that you have decided to fight the Pug, but eventually they agree to let you land."
		planet Oblivion
	to offer
		has "FWC 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
		event "fwc navy retakes cebalrai"
		conversation
			`Just like Shiver, the spaceport on Oblivion is being patrolled by the Pug, and the locals seem to be resigned to their fate. Not surprisingly, you find that there are not many supplies left from when the main Free Worlds fleet was located here for a few days. But, at least the spaceport has a working repair shop and outfitter.`
			`	While you are exploring the spaceport, a group of men in one of the local pubs see you walking past and gesture to you. "Hey, get in here," whispers one of them. They recognize you as a Council member, and tell you that they are leaders of a local resistance movement, biding their time and waiting for the right moment to strike back against the Pug. "Do you have a plan?" they ask.`
			choice
				`	"Sorry, not yet."`
				`	"We'll let you know when it's time."`
			`	They seem disappointed that you aren't here to liberate them immediately, but you tell them to wait and not do anything foolish, for now, and they tell you how to contact them when you are ready. Back inside your ship, you and Katya talk. "It sounds like the aliens are planning to invade more systems," she says. "We need to get a warning out somehow. And the only way to do that is with a jump drive. We'll need to disable one of the alien ships, take out its jump drive, and install it on your ship. Then we can take your ship to <planet> and contact the Senate and the rest of the Council."`
			choice
				`	"Sounds risky, but let's give it a try!"`
					accept
				`	"Um, do we really want to risk getting the aliens mad at us?"`
			
			`	"I don't think we have any other choice," she says. "Our friends out there need to know what is happening here. And maybe this, at last, will give the Navy a reason to stop fighting us and to begin working together for peace." Reluctantly, you agree.`
				accept



mission "FWC Pug 3"
	landing
	name "Talk to the Navy"
	description "Freya is on <planet>, presumably in Navy custody. Travel there and see if, given the current circumstances, the Navy is willing to talk with you."
	source "New Iceland"
	destination "New Austria"
	clearance
	to offer
		has "FWC Pug 2D: done"
	passengers 1
	on fail
		dialog `You have failed an essential Free Worlds mission. If you want to complete the story line, revert to the autosave or another earlier snapshot of the game.`
	
	on offer
		log "Escaped from the territory captured by the Pug by using a jump drive. Found out that Freya has been captured by the Navy while she was trying to figure out the reason for the hyperspace links disappearing. The Navy thinks that the Free Worlds are behind the hyperspace disruptions. But, making peace with the Navy may be the only way to defeat the Pug."
		event "fwc peace with the navy"
		set "event: fw armistice"
		conversation
			`Your ship creates quite a stir when it enters the system via jump drive, and the moment you've landed Alondo is waiting outside your hatch to speak with you. "What the heck is going on?" he says. "What happened to your fleet? And how in the world did you get access to a jump drive? We asked the Quarg to sell us one, but they gave us some vague response about 'not meddling in the affairs of other species.'"`
			`	Katya says, "We were attacked by aliens. They cut the hyperspace links. And they're likely to invade more systems. We need to warn everyone. Including the Republic and the Navy." She explains more of the situation to him, and hands him a copy of your sensor scans of the alien ships.`
			`	Alondo says, "What do you think we should do next?"`
			choice
				`	"We should negotiate a ceasefire with the Navy."`
					goto navy
				`	"We should find a way to restore those hyperspace links."`
					goto links
			
			label navy
			`	Alondo says, "If they believe your story about an alien invasion, that might work. After all, if humanity is threatened by aliens, surely that take precedence over fighting us. Only trouble is, most of the Republic seems to think that when those systems disappeared, it was some new weapon the Free Worlds had discovered. They're blaming us for it. They just captured Cebalrai and Menkent back from us, and captured Freya in the process."`
			`	"Freya?" asks Katya. "How did they manage to capture her?"`
			`	"She was on <planet>," he says, "setting up something she called a 'graviton detector' to analyze the collapsed hyperspace link. When the Navy arrived, we told her to get out of there, but she had just had a breakthrough in her research, and all she said was, 'To hell with your war, this is more important.'" If she's still there, she may be our best hope for figuring this out.`
				goto next
			
			label links
			`	Alondo says, "That's what Freya was working on. As soon as your fleet disappeared, she began investigating, and she went to <planet> to set up something she called a 'graviton detector' pointed towards Vega. Right before that system was taken, she sent us a message that she had found some sort of residual trace of the link, maybe a way to reopen it."`
			`	"Wait," says Katya, "what do you mean, 'right before the system was taken'? By whom?"`
			`	"The Navy," says Alondo. "They think the Free Worlds is behind the disappearance of those systems. And with your fleet gone, we didn't have enough ships left to resist them. Freya could have evacuated, but she stayed behind to finish her research. I believe her exact words were, 'To hell with your war, this is more important.'" If she's still there, she may be our best hope for figuring this out.`
				goto next
			
			label next
			choice
				`	"Do you think the Navy is letting her continue her research?"`
					goto research
				`	"Can you contact the Navy and ask them for a ceasefire?"`
					goto ceasefire
			
			label research
			`	"Or maybe interrogating her," says Alondo, "in which case they've at least discovered that we're as confused as they are about the hyperspace links being cut. I think whatever we do next, we'll need Freya, and we'll need the Navy. I'll contact them and ask them not to fire on your ship. But I can't guarantee they'll let you leave once you're in their control."`
				goto end
			
			label ceasefire
			`	"I'll contact the Navy and tell them you're coming to negotiate, and to please not fire on your ship. That's the best I can do," says Alondo.`
				goto end
			
			label end
			`	You and Katya return to your ship and prepare to make a visit to <planet>. Hopefully Freya will still be there, and the Navy will let you talk to her.`
				accept



mission "FWC Pug 3A"
	landing
	name "Bring Freya to <planet>"
	description "Freya thinks that if she can locate the equipment the Pug used to disrupt the hyperspace links, she may be able to restore them. Take her to <planet>, while Katya stays behind in the Navy's custody."
	source "New Austria"
	destination "Oblivion"
	clearance
	to offer
		has "FWC 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
		log "Convinced the Navy that the disappearing hyperspace links really are an alien attack and not some sort of Free Worlds super-weapon. Freya thinks that she might be able to undo the hyperspace disruption and allow the Navy to enter the captured territory and begin to drive the Pug back."
		conversation
			branch know
				has "FW Alphas 1.1: done"
			`Surprisingly, the Navy lets you land without firing on you; the fact that you entered the system via jump drive probably made a big impression on them. But when your ship lands, it is immediately surrounded by Navy troops. Hesitantly, you and Katya disembark. You are greeted by a Navy admiral who you recognize as William Danforth, the leader of the Navy Oathkeepers. 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
			`Surprisingly, the Navy lets you land without firing on you; the fact that you entered the system via jump drive probably made a big impression on them. But when your ship lands, it is immediately surrounded by Navy troops. Hesitantly, you and Katya disembark. You are greeted by Admiral Danforth, the leader of the Oathkeepers who previously assisted you to drive the Alphas and their mercenary fleet away from Poisonwood.`
				goto introductions
			label introductions
			`	Standing next to Danforth is someone you think might be his bodyguard: a dark-skinned woman dressed entirely in black. Even the whites of her eyes are black: when she gets closer, you can see that it is actually a scleric tattoo, an intricate Celtic knotwork pattern inked into the whites of her eyes. Surprisingly, Katya recognizes her. "Raven!" says Katya. You aren't sure if Katya sounds happy to see her, or scared.`
			`	"Hello Councilor," says the woman.`
			`	Danforth says, "We hear you have come from the disconnected territory, and that you bring word of a potential alien invasion. Come with us, please." He ushers you into one of the Navy cruisers that are parked nearby, and into a room you assume is his private office; the guards check you and Katya for weapons and then leave you alone with Danforth and Raven. "Now," says Danforth, "you will answer our questions."`
			`	He gestures to Raven, who walks up to you and holds out her hands. "Take my hands, please, Captain," she says.`
			choice
				`	(Take her hands.)`
					goto hands
				`	"Um, why? What are you going to do to me?"`
			`	"She's a Questioner, <first>," says Katya, quietly. "One of the ones who interrogated me when I was their prisoner. Just take her hands, and tell her nothing but the truth."`
			label hands
			`	Reluctantly, you take her hands, and she begins asking you questions about the aliens. You answer as truthfully as you can. Holding hands with a total stranger while she stares unblinkingly into your eyes and questions you is an uncomfortably invasive and intimate experience, heightened by your suspicion that if you tell a lie, she will somehow know. By the time she is done questioning you, you are soaked in sweat and your hands are shaking. Raven turns to Danforth and says, "They're telling the truth."`
			`	You and Katya both breath a sign of relief, and Danforth says, "Very well. Let's take them to see Miss Winters."`
			`	He leads you back out of his ship and to a warehouse where people in overalls and lab coats are busy working on one of the strangest machines you have ever seen. Freya is one of them. "Katya!" she says. "<first>! Glad you could join us."`
			choice
				`	"Are you working for the Navy now?"`
				`	"We heard you might have a way to reopen the hyperspace links."`
					goto reopen
			
			`	"Well," she says, "technically I'm a prisoner. But they're helping me with my research."`
			`	Katya asks, "Have you figured out how to restore the hyperspace links?"`
			
			label reopen
			`	"No," says Freya, "but I at least discovered it might be possible. The links aren't severed completely, you see. There's some sort of distortion signal, actively interfering with them. If we can eliminate the interference, the links might come back. But the interference is coming from the other end."`
			`	Danforth says, "Captain <last>, we will release Miss Winters to travel with you, provided that Councilor Reynolds remains here in her place. If you succeed in restoring a hyperspace link to the disconnected systems, we will release both of them. Is that an acceptable deal?"`
			choice
				`	"Okay, we will agree to that."`
					goto end
				`	"What if Freya can't restore the link?"`
			
			`	"Then Councilor Reynolds will remain here as our prisoner," he says.`
			`	"Go, <first>," says Katya. "It's our best chance."`
			label end
			`	You return to your ship with Freya, who is carrying a large collection of sensors and equipment. "Let's try <planet> first," she says, "and see if there's any alien technology there that we can use. I hope you still have some ships left in your battle fleet to help defend us."`
				accept



mission "FWC Pug 3B"
	landing
	name "Defend <planet>"
	description "Freya found a piece of alien technology that she believes can be used to restore the hyperspace link. Hold off the Pug for long enough for her to figure out how it works."
	source Oblivion
	destination Oblivion
	clearance
	to offer
		has "FWC Pug 3A: 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
		"reputation: Pug" = -10
		conversation
			`Flying low over <planet> and hoping the Pug are not tracking you, you contact the resistance group you met earlier. Meanwhile, Freya says, "I've got an energy signal. Looks like the graviton pulses that are disrupting the hyperspace link." She gives you the coordinates, and you forward them to the resistance group. With some help from your ship's weapons, they are able to eliminate the Pug guards that are nearby.`
			`	You land your ship, meet up with the resistance fighters, and approach the facility cautiously. "That was way too easy," says Freya. "Maybe they just didn't expect anyone to fight back against them?" The building looks vaguely like a radio transmitter, and as you get closer to it the ground seems to roll and pitch beneath your feet like the deck of a boat. "Graviton waves," says Freya. "This is it, all right. Captain, do you think you can hold off the Pug for long enough for me to figure out how this thing works?"`
			choice
				`	"I'll do my best."`
					goto end
				`	"You aren't afraid that their ground troops will attack you?"`
		
			`	"We can handle them," says one of the men. "As far as we know the only weapon they have is those stun sticks. Hardly a match for real bullets. Their ships are a much bigger threat."`
			label end
			branch alone
				has "FWC Checkmate Escorts: done"
			`	The resistance fighters tell you their own fleet will be launching shortly. You return to your ship and fire up the engines. Hopefully the ships that are left over from your attack fleet will be enough to hold off the Pug until Freya finishes her work down here...`
				launch
			label alone
			`	The resistance fighters tell you their own fleet will be launching shortly. You return to your ship and fire up the engines, wishing that you had managed to keep some of the ships from your attack fleet alive, and hoping you will be able to hold off the Pug until Freya finishes her work down here...`
				launch
	
	npc
		personality heroic
		fleet
			names "free worlds capital"
			fighters "free worlds fighters"
			variant
				"Skein"
				"Finch" 6
				"Argosy (Blaster)"
				"Argosy (Laser)"
				"Argosy (Turret)"
	
	npc disable
		personality entering disables heroic
		government Pug
		fleet
			names "pug"
			variant
				"Pug Maboro"
				"Pug Enfolta"
				"Pug Zibruka" 2
		fleet
			names "pug"
			variant
				"Pug Enfolta"
				"Pug Zibruka" 2
		dialog `You receive a message from Freya: "Captain, we need you back down here. I think I discovered a way to restore the link, but we're going to have to go back to New Austria to do it, and quickly before the Pug have time to send more ships to this system. And, I hope you have space in your cargo bay for a bunch of equipment."`



mission "FWC Pug 3C"
	landing
	name "Return to <planet>"
	description `Return to <planet> with Freya, carrying a "graviton reflector" that Freya thinks can be used to restore the hyperspace link.`
	source Oblivion
	destination Tundra
	on enter Cebalrai
		dialog
			"As soon as you reenter human space, you contact the Navy and tell them to send an attack fleet to the Cebalrai system. Then, just for good measure, you contact the Free Worlds and ask them to do the same."
	to offer
		has "FWC Pug 3B: done"
	passengers 1
	cargo "graviton reflector" 10
	blocked `As you are landing, Freya contacts you and says, "You're going to need ten tons of cargo space for this next mission, and a bunk for me, as well." That means you have to free up <capacity>.`
	on fail
		dialog `You have failed an essential Free Worlds mission. If you want to complete the story line, revert to the autosave or another earlier snapshot of the game.`
	
	on offer
		conversation
			`You land near the alien facility, and Freya meets you outside, with a large piece of alien machinery loaded onto a flatbed truck. "I hope you have room for this in your cargo hold," she says. You notice that the ground no longer seems to be rocking irregularly like before, but you still feel slightly dizzy, like the horizon will not quite stay level.`
			choice
				`	"What did you figure out?"`
				`	"Is the link restored yet?"`
			
			`	She says, "I couldn't figure out exactly how this technology works, but it's some sort of graviton transmitter. I was able to switch it from sending a chaotic signal, to a coherent one. In theory, that will slowly strengthen the link. But it could take years for it to reopen, and we probably only have a few days before the Pug learn what happened here and overrun this system. So, we need to go back to <planet>, the other end of the link, and set up this thing. I think it's some sort of graviton reflector." She points to the alien equipment on the truck. "With it in place, we can set up a harmonic resonance between this star system and <system>, and in theory the link will regenerate much more quickly."`
			choice
				`	"Okay, let's give it a try!"`
					accept
				`	"Do you actually have any idea what you're doing?"`
			`	"None whatsoever," she says. "I'm just making this up as I go along, based on what I know of hyperspace physics. And for all I know the Pug ships carry the same hyperspace disruption capabilities as this facility, and this is all for nought. But let's give it a try, okay?"`
				accept



mission "FWC Pug 3D"
	landing
	name "Liberate <system>"
	description "Travel to the <system> system with a combined fleet of Navy and Free Worlds ships, drive off the Pug, and occupy the system so that the Pug cannot return and sever the hyperspace link again."
	source Tundra
	destination Oblivion
	clearance
	to offer
		has "FWC 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
		log "Succeeded in restoring the hyperspace link to the Rasalhague system. With the Navy's help, it might now be possible to turn the tide against the Pug."
		event "fwc battle for rasalhague"
		conversation
			`Although <origin> is now back under Navy control, they gladly allow your ship to land. You help Freya to set up the alien equipment and power it on. Once again you begin to feel dizzy, and the feeling slowly builds in intensity as Freya adjusts the controls. "It's working," she says. "I've got a positive feedback loop. See if you can contact Oblivion."`
			`	You try to establish a communications link to the resistance fighters, and brief snatches of conversation come through, interspersed with static. After a few minutes the static begins to die down, and you can hear their voices more clearly. "It's working!" says Freya.`
			`	Meanwhile, Navy and Free Worlds ships have begun pouring into the system. You suspect that the battle ahead will be a fierce one, but with a Navy war fleet on your side, it no longer feels like a hopeless cause. "The link should be strong enough for us to travel through it soon," says Freya. "Time to get back to <system>."`
				accept
	
	npc evade
		personality disables heroic staying
		government Pug
		system Rasalhague
		fleet
			names "pug"
			variant
				"Pug Maboro"
				"Pug Enfolta"
				"Pug Zibruka" 2
		fleet
			names "pug"
			variant
				"Pug Enfolta"
				"Pug Zibruka" 2
		fleet
			names "pug"
			variant
				"Pug Enfolta"
				"Pug Zibruka" 2



mission "FWC Pug 3D: Reinforcements"
	landing
	invisible
	to offer
		has "FWC Pug 3C: done"
	to fail
		has "FWC Pug 4: done"
	
	npc kill
		government "Navy (Oathkeeper)"
		personality heroic waiting
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Cruiser (Mark II)"
				"Combat Drone" 4
				"Frigate (Mark II)" 2
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Carrier (Mark II)"
				"Lance" 4
				"Combat Drone" 6
				"Gunboat (Mark II)" 3
	npc kill
		government Republic
		personality heroic waiting
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Cruiser"
				"Combat Drone" 4
				"Frigate" 2
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Carrier"
				"Lance" 4
				"Combat Drone" 6
				"Gunboat" 2
	npc kill
		personality heroic waiting
		fleet
			names "free worlds capital"
			variant
				"Dreadnought"
				"Bastion (Laser)"
				"Argosy (Laser)"
		fleet
			names "free worlds capital"
			fighters "free worlds fighters"
			variant
				"Dreadnought"
				"Falcon (Plasma)"
				"Skein" 
				"Finch" 6
		fleet
			names "free worlds capital"
			variant
				"Falcon (Heavy)"
				"Osprey (Laser)"
				"Argosy (Turret)"



mission "FWC Pug 4"
	landing
	name "Defend <system>"
	description "Drive off the Pug fleet that is invading <system>"
	source Oblivion
	destination Oblivion
	clearance
	to offer
		has "FWC Pug 3D: 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 fleet lands on <planet>, and to your surprise the locals say that soon before your fleet arrived, all the Pug who were present on the planet departed; clearly they expected your arrival and had no desire to become your prisoners. You only have a few hours to take stock of the situation before the Navy informs you that they have detected another Pug fleet incoming...`
				launch
	
	on complete
		event "fwc liberation of rasalhague"
	
	npc disable
		personality disables heroic entering
		government Pug
		system Rasalhague
		fleet
			names "pug"
			variant
				"Pug Maboro"
				"Pug Enfolta"
				"Pug Zibruka" 2
		fleet
			names "pug"
			variant
				"Pug Enfolta"
				"Pug Zibruka" 2
		fleet
			names "pug"
			variant
				"Pug Enfolta"
				"Pug Zibruka" 2
	
	npc disable
		personality disables heroic
		government Pug
		system Alderamin
		fleet
			names "pug"
			variant
				"Pug Maboro"
				"Pug Enfolta"
				"Pug Zibruka" 2
		fleet
			names "pug"
			variant
				"Pug Maboro"
				"Pug Enfolta"
				"Pug Zibruka" 2
		fleet
			names "pug"
			variant
				"Pug Enfolta"
				"Pug Zibruka" 2
		fleet
			names "pug"
			variant
				"Pug Enfolta"
				"Pug Zibruka" 2
	
	npc disable
		personality disables heroic
		government Pug
		system Markab
		fleet
			names "pug"
			variant
				"Pug Maboro"
				"Pug Enfolta"
				"Pug Zibruka" 2
		fleet
			names "pug"
			variant
				"Pug Maboro"
				"Pug Enfolta"
				"Pug Zibruka" 2
		fleet
			names "pug"
			variant
				"Pug Maboro"
				"Pug Enfolta"
				"Pug Zibruka" 2
		fleet
			names "pug"
			variant
				"Pug Maboro"
				"Pug Enfolta"
				"Pug Zibruka" 2
	
	npc disable
		personality disables heroic
		government Pug
		system Alpheratz
		fleet
			names "pug"
			variant
				"Pug Maboro"
				"Pug Enfolta"
				"Pug Zibruka" 2
		fleet
			names "pug"
			variant
				"Pug Maboro"
				"Pug Enfolta"
				"Pug Zibruka" 2
		fleet
			names "pug"
			variant
				"Pug Enfolta"
				"Pug Zibruka" 2
		fleet
			names "pug"
			variant
				"Pug Enfolta"
				"Pug Zibruka" 2
		fleet
			names "pug"
			variant
				"Pug Enfolta"
				"Pug Zibruka" 2



mission "FWC Pug 4A"
	landing
	name "Equipment from <planet>"
	description "Travel with Freya to pick up the alien equipment that you installed on <planet> and bring it to Arabia to reopen another of the hyperspace links."
	autosave
	source Oblivion
	destination Tundra
	to offer
		has "FWC Pug 4: 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 "Drove off another Pug attack. Fighting side by side together is beginning to build some camaraderie between the Free Worlds and the Navy, even though they were enemies so recently."
		conversation
			`When you land on <origin>, the Navy and Free Worlds crews are congratulating each other on having succeeded in resisting the alien attack. Freya says, "I guess nothing creates camaraderie faster than fighting side by side against a common enemy."`
			choice
				`	"Yes, I hope our people don't get too comfortable viewing the Navy as allies."`
					goto negative
				`	"I don't think we could have won that battle without the Navy's help. Perhaps we were wrong to think we had no need for the Republic at all."`
					goto positive
			
			label negative
			`	"Indeed," she says. "Still, it will be hard going back to fighting them once all this is over."`
				goto plan
			
			label positive
			`	"You might be right," she says. "I wonder if instead of aiming for complete independence from the Republic, all along we should have tried for something closer to what the Syndicate has: relative autonomy, but within the framework of the Republic."`
				goto plan
			
			label plan
			`	You meet up with Danforth, and he says, "Well, we have a beachhead now, but it's a fragile one. Miss Winters, do you think you can open up more of the hyperspace links?"`
			`	Freya says, "Sure, if we retrieve the equipment from Tundra. But, the transmitter station wasn't exactly portable, so if we want to open up other systems not linked to this one, we'll have to find transmitters already installed there, too."`
			`	Danforth says, "Let's start by trying to reestablish the connection from here to the Ascella system. If that works, I'll send part of my fleet to take Zeta Aquilae and see if they can secure another transmitter station. That would give us two routes into Pug space instead of the single bottleneck we have now. Captain <last>, would you be willing to travel back with Freya to <planet>?"`
			choice
				`	"Sure, we can leave immediately."`
					accept
				`	"What if the Pug attack here in the meantime?"`
					goto defend
				`	"Shouldn't we just attack the Pug homeworld while we have such a big fleet here?"`
					goto attack
			
			label defend
			`	"Don't worry," he says, "Navy reinforcements are arriving constantly. Soon our fleet here will be twice as strong as the one we committed to yesterday's attack." Reluctantly, you agree to trust the defenses to him while you bring Freya back into Free space to help open more of the hyperlinks.`
				accept
			label attack
			`	"'Such a big fleet'?" he says. "This is not even a twentieth of the Navy's current fighting power. And I think we'll need many more ships before we're ready to take on the alien homeworld. But don't worry, reinforcements are arriving here constantly. You go do your part, and we'll see to ours."`
				accept



mission "FWC Pug 4B"
	landing
	name "Equipment to <planet>"
	description "Travel with Freya to <planet> to set up the alien equipment and see if you can reopen another one of the disrupted hyperspace links."
	source Tundra
	destination Arabia
	to offer
		has "FWC Pug 4A: done"
	cargo "graviton reflector" 10
	passengers 1
	blocked `When you land on <origin>, Freya says, "Captain, it looks like you're going to need <capacity> to continue with this mission." You should free up more space, then return here.`
	on fail
		dialog `You have failed an essential Free Worlds mission. If you want to complete the story line, revert to the autosave or another earlier snapshot of the game.`
	
	on offer
		conversation
			`You land on <origin> and quickly begin packing up the alien equipment that you left here earlier. Quite a few of the locals are watching you from a distance, but they seem friendly despite the fact that their world was so recently occupied by the Free Worlds against their will. Clearly your success in opening a path for the Navy to enter the disconnected region of space has become known.`
			`	As you are setting up the alien equipment, Freya says, "Doesn't this all seem a little too... neat, to you? I mean, that the aliens close off the hyperlinks but then for some reason leave behind the exact equipment that we need to gradually reopen them? And that the requisite technology is so simple, a transmitter and a reflector? It all fits together way too well."`
			choice
				`	"Are you suggesting that the aliens intended for us to do exactly what we're doing?"`
				`	"It does all seem odd, that we could have any success at all fighting a species that is apparently so sophisticated."`
			`	She nods. "I have the uncomfortable feeling that we're caught up in a game we don't understand," she says. "And before we make the next move, we should get more information."`
			`	"From whom?" you ask.`
			`	"The Quarg," she says. "We're just a few jumps away from their space, and they claim to know what's going on throughout the galaxy. And when this crisis started and we asked them for a jump drive, they said they didn't want to meddle in the affairs of other species, which means maybe they knew another species was involved here."`
			choice
				`	"Our mission is urgent. We should just continue to Arabia."`
				`	"Okay, let's take a detour to talk with the Quarg."`
					goto detour
			
			`	"Well," she says, "you're the captain, I'll leave that choice up to you."`
				accept
			label detour
			`	"Trust me," she says, "it's worth it, if we can get some real answers."`
			`	"Straight answers from the Quarg?" you say. "Not likely, but it can't hurt to try."`
				accept



mission "FWC Pug 4B: Quarg"
	landing
	name "Visit the Quarg"
	description "If you want, visit the Quarg to see what they can tell you about the Pug, before you continue fighting them."
	source Tundra
	destination Lagrange
	to offer
		has "FWC Pug 4: done"
	to fail
		has "FWC Pug 5: 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 are powerful enough that they could defeat the Quarg, or even the Drak, if they chose to. But 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
			`You land on the Quarg station, but neither of you knows what to do next. How do you locate a Quarg diplomat? Do they even have such a thing? As you and Freya stand in the hangar looking somewhat lost, one of the Quarg approaches you and says, "These ones have questions?"`
			`	Freya says, "We've been attacked by aliens who call themselves the Pug. We're wondering what you know about them."`
			`	Quarg skin is normally entirely grey, as is their clothing, but several patches of skin on the Quarg's face turn red at the word "Pug." You've heard theories that this is a sign of emotion in the Quarg, but no one knows what emotion precisely. Anger? Embarrassment? The Quarg you are speaking with simply says, "Come," 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? Is this the governor of the station, or just an expert in 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. "Long ago we tried to resist the Pug. 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 Freya. "You know about them?"`
			
			label info
			`	"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 are either entirely illogical, or operating on a logic so far above ours that it appears as nonsense to us. They claim it is the latter: that they operate on some special knowledge of time and future."`
			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."`
			`	Freya is confused. "What do you mean?" she says.`
				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 Freya, "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 Freya. "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 Freya.`
			`	"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."`
			`	You talk for a while longer, but gain no more information of value.`



mission "FWC Pug 4C"
	landing
	name "Liberate <planet>"
	description "Travel to the <system> system to assist the Navy in driving out the Pug and reestablishing a direct hyperspace link to the Ascella system."
	autosave
	source Arabia
	destination Rand
	clearance
	to offer
		has "FWC Pug 4B: 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 "fwc reconnect ascella"
		conversation
			`You help Freya to unload and set up the reflector equipment, then contact the Navy on Oblivion and instruct them to point the transmitter in your direction. A few minutes later Admiral Danforth contacts you. "This link appears to be returning too," he says. "So, let's move on. We're going to make an attack on the <system> system, now, and we would welcome your assistance in this battle." You leave the equipment on <origin> and return to your ship with Freya.`
				accept
	
	on complete
		log "Succeeded in restoring a few more hyperspace connections, and in driving back the Pug (with the help of the Navy). But, Freya thinks it is way too coincidental that the aliens have left behind the exact technology needed to fix the hyperspace disruptions; it feels like the Pug are playing a game rather than fighting a serious war."
		event "fwc reconnect zeta aquilae"
		dialog `After a few minutes of scanning the surface of <planet>, Freya locates another transmitter station that matches the one you found on Oblivion. You contact Admiral Danforth to tell him its location, and he dispatches a crew to take control of it. He also reports to you that once again, apparently all the Pug left the planet during the course of the battle. "A pity," he says. "If we had taken prisoners, maybe we could have gotten some answers from them. Anyway, meet me in the spaceport whenever you're ready to help with our next mission."`
	
	npc evade
		personality disables heroic staying
		government Pug
		system "Zeta Aquilae"
		fleet
			names "pug"
			variant
				"Pug Maboro"
				"Pug Enfolta" 2
		fleet
			names "pug"
			variant
				"Pug Maboro"
				"Pug Enfolta" 2
		fleet
			names "pug"
			variant
				"Pug Maboro"
				"Pug Enfolta" 2
		fleet
			names "pug"
			variant
				"Pug Maboro"
				"Pug Enfolta" 2
		fleet
			names "pug"
			variant
				"Pug Maboro"
				"Pug Enfolta" 2
		fleet
			names "pug"
			variant
				"Pug Maboro"
				"Pug Enfolta" 2

	npc
		government "Navy (Oathkeeper)"
		system "Zeta Aquilae"
		personality heroic staying
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Cruiser (Mark II)"
				"Combat Drone" 4
				"Frigate (Mark II)" 2
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Cruiser (Mark II)"
				"Combat Drone" 4
				"Gunboat (Mark II)" 2
	npc
		government Republic
		system "Zeta Aquilae"
		personality heroic staying uninterested
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Cruiser (Mark II)"
				"Combat Drone" 4
				"Frigate (Mark II)" 2
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Cruiser (Mark II)"
				"Combat Drone" 4
				"Gunboat (Mark II)" 2
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Cruiser (Mark II)"
				"Combat Drone" 4
				"Frigate (Mark II)" 2



mission "FWC Pug 5"
	name "Liberate <system>"
	description "Some of the Navy ships have been outfitted with jump drives. Travel with them to the <system> system, avoiding the main Pug fleet in their home system, and reclaim control of the planet."
	autosave
	source Rand
	destination Silver
	clearance
	to offer
		has "FWC Pug 4C: done"
	passengers 1
	on fail
		dialog `You have failed an essential Free Worlds mission. If you want to complete the story line, revert to the autosave or another earlier snapshot of the game.`
	
	on offer
		conversation
			`You find Admiral Danforth supervising the repairs of the damaged Navy ships. "Glad you survived that battle!" he says. "These alien ships are much more advanced than ours, but we outnumber them, so now that we've established a strong beachhead I think we actually have a chance at defeating them. The only problem is, the majority of our fleet is still up north. With the Vega system cut off, our supply lines are having to go all the way around through the dirt belt. So I'd like to propose liberating Vega next."`
			choice
				`	"That does sound like a good strategic choice."`
				`	"How will your fleet get to Vega without traveling through the Pug home system? That system is swarming with their ships."`
			`	Danforth says, "During the battle, we managed to salvage jump drives from a few of the Pug ships. We've installed them in three of our carriers. Hopefully, with your help, that will be enough to overcome any resistance in the Vega system. Then Miss Winters can work her magic with the hyperlinks again, and we'll be able to bring a massive reinforcement fleet from Sol."`
			`	"Sounds good to me," says Freya. "I wish more of our own ships had jump drives, so we could assist you."`
			`	"Indeed," says Danforth. "That's why it's so important for Captain <last>'s ship to be part of this battle. When it's all over, I want to be able to tell Parliament that this war was won by the Free Worlds and the Navy fighting side by side every step of the way. And I hope you will be able to tell your Senate the same thing, so that they will be more amenable to a compromise between us."`
			choice
				`	"I'm glad to hear you say that. Your fleet is so much stronger than ours that you could easily take all the credit."`
					goto navy
				`	"We were the ones who discovered the aliens and the way to restore the hyperspace links. The Free Worlds deserve the real credit here."`
					goto free
			label navy
			`	"I don't want the credit," he says, "I want peace." He wishes you the best of luck in your attack on Vega, and says to contact him as soon as the link is restored and the reinforcements are ready.`
				accept
			label free
			`	"Captain," he says, "the point isn't who deserves more credit. The point is, how do we tell this story in a way that makes people on my side and on yours more willing to make peace with each other? That's all I care about." He wishes you the best of luck in your attack on Vega, and says to contact him as soon as the link is restored and the reinforcements are ready.`
				accept
	
	on complete
		event "fwc liberation of vega"
	
	npc
		government "Navy (Oathkeeper)"
		personality heroic escort
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Carrier (Jump)"
				"Combat Drone" 6
				"Dagger" 4
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Carrier (Jump)"
				"Combat Drone" 6
				"Dagger" 4
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Carrier (Jump)"
				"Combat Drone" 6
				"Dagger" 4
	
	npc evade
		personality disables heroic staying
		government Pug
		system Vega
		fleet
			names "pug"
			variant
				"Pug Enfolta"
				"Pug Zibruka" 4
		fleet
			names "pug"
			variant
				"Pug Enfolta"
				"Pug Zibruka" 3
		fleet
			names "pug"
			variant
				"Pug Enfolta"
				"Pug Zibruka" 4
		fleet
			names "pug"
			variant
				"Pug Enfolta"
				"Pug Zibruka" 3



mission "FWC Pug 5B"
	landing
	name "Travel to <planet>"
	description `Travel with Freya to <planet>, where you can set up the "graviton reflector" to restore the hyperspace link from Sol to the Pug territory. (She thinks Mars is a better option than a heavily populated planet like Earth.)`
	autosave
	source Silver
	destination Mars
	to offer
		has "FWC Pug 5: done"
	passengers 1
	cargo "graviton reflector" 10
	blocked `When you land on <origin>, Freya says, "Captain, it looks like you're going to need <capacity> to continue with this mission." You should free up more space, then return here.`
	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 "Drove the Pug out of the Vega system with the help of some Navy ships equipped with jump drives. Once again, the Pug somehow managed to evacuate all their people from the planet before the Navy arrived, as if they were already expecting to lose this system."
		conversation
			`Once again, the Pug seem to have anticipated your attack and evacuated all their personnel from the planet before your arrival. It's a little disconcerting that they seem to have planned for events to unfold in exactly this way. Once again, you find one of the transmitter stations, abandoned on <origin> but still in working order, and inside the station Freya locates another one of the "reflectors" that she needs in order to complete the link. "I don't get it," she says. "They should've destroyed all this before they left."`
			choice
				`	"Yes, I hope we're not playing into some sort of trap."`
					goto trap
				`	"Well, let's just be thankful they didn't."`
			`	"I suppose," she says. "I just don't like not understanding things, and I do not understand these aliens at all."`
				goto next
			label trap
			`	"Indeed," she says. "It's hard to imagine that a species so advanced could be making so many tactical errors."`
			label next
			`	You load the equipment onto your ship, and Freya says, "Let's set it up on <planet>, rather than Earth. I don't think the graviton radiation is harmful to human beings, but there's no point in placing it on such a densely populated planet."`
				accept
	
	npc
		government Republic
		system Sol
		personality heroic staying uninterested
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Carrier (Mark II)"
				"Lance" 4
				"Combat Drone" 6
				"Cruiser (Mark II)"
				"Combat Drone" 4
				"Frigate (Mark II)" 2
				"Gunboat (Mark II)" 2
				"Rainmaker (Mark II)" 2
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Carrier (Mark II)"
				"Lance" 4
				"Combat Drone" 6
				"Cruiser (Mark II)"
				"Combat Drone" 4
				"Frigate (Mark II)" 2
				"Gunboat (Mark II)" 2
				"Rainmaker (Mark II)" 2
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Carrier (Mark II)"
				"Lance" 4
				"Combat Drone" 6
				"Cruiser (Mark II)"
				"Combat Drone" 4
				"Frigate (Mark II)" 2
				"Gunboat (Mark II)" 2
				"Rainmaker (Mark II)" 2



mission "FWC Pug 5C"
	landing
	name "Return to <planet>"
	description "Return to <planet>, and join the Navy fleet in preparing for an attack on the Pug home system. A Free Worlds fleet will be attacking from the south at the same time."
	autosave
	source Mars
	destination Silver
	to offer
		has "FWC Pug 5B: 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 "fwc reconnect vega"
		conversation
			`As soon as Freya has set up her equipment and verified that it is working, you contact Admiral Danforth. "We're on Mars," you tell him, "and we should have the hyperspace link to Vega restored soon."`
			`	"Excellent," he says. "Please contact your Council and arrange for your fleet to strike from the south at the same time as the fleet from Vega jumps in from the north."`
			`	You contact Tomek and tell him the Navy is ready for a final assault, and he agrees to send as many ships as he can spare to join you. Now it's time to return to <planet> and await the attack signal.`
				accept
	
	npc
		government Republic
		system Sol
		personality heroic waiting
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Carrier (Mark II)"
				"Lance" 4
				"Combat Drone" 6
				"Cruiser (Mark II)"
				"Combat Drone" 4
				"Frigate (Mark II)" 2
				"Gunboat (Mark II)" 2
				"Rainmaker (Mark II)" 2
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Carrier (Mark II)"
				"Lance" 4
				"Combat Drone" 6
				"Cruiser (Mark II)"
				"Combat Drone" 4
				"Frigate (Mark II)" 2
				"Gunboat (Mark II)" 2
				"Rainmaker (Mark II)" 2
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Carrier (Mark II)"
				"Lance" 4
				"Combat Drone" 6
				"Cruiser (Mark II)"
				"Combat Drone" 4
				"Frigate (Mark II)" 2
				"Gunboat (Mark II)" 2
				"Rainmaker (Mark II)" 2



mission "FWC Pug 6"
	landing
	name "Defeat the Pug"
	description "Join the Navy fleet in attacking the Pug home system. Once their fleet is eliminated, land on their home world of <planet> to attempt to negotiate for peace."
	autosave
	source Silver
	destination Pugglemug
	clearance
	to offer
		has "FWC Pug 5C: done"
	passengers 1
	blocked "You need at least one bunk free for Freya in order 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 Silver 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 stars and the drifting sand 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 Republic
		personality heroic
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Carrier (Mark II)"
				"Lance" 4
				"Combat Drone" 6
				"Cruiser (Mark II)"
				"Combat Drone" 4
				"Frigate (Mark II)" 2
				"Gunboat (Mark II)" 2
				"Rainmaker (Mark II)" 2
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Carrier (Mark II)"
				"Lance" 4
				"Combat Drone" 6
				"Cruiser (Mark II)"
				"Combat Drone" 4
				"Frigate (Mark II)" 2
				"Gunboat (Mark II)" 2
				"Rainmaker (Mark II)" 2
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Carrier (Mark II)"
				"Lance" 4
				"Combat Drone" 6
				"Cruiser (Mark II)"
				"Combat Drone" 4
				"Frigate (Mark II)" 2
				"Gunboat (Mark II)" 2
				"Rainmaker (Mark II)" 2
	npc
		government "Navy (Oathkeeper)"
		personality heroic
		system Cebalrai
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Cruiser (Mark II)"
				"Combat Drone" 4
				"Frigate (Mark II)" 2
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Carrier (Mark II)"
				"Lance" 4
				"Combat Drone" 6
				"Gunboat (Mark II)" 3
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Cruiser (Mark II)"
				"Combat Drone" 4
				"Frigate (Mark II)" 2
		fleet
			names "republic capital"
			fighters "republic fighter"
			variant
				"Carrier (Mark II)"
				"Lance" 4
				"Combat Drone" 6
				"Gunboat (Mark II)" 3
	npc
		personality heroic
		system Cebalrai
		government "Free Worlds"
		fleet
			names "free worlds capital"
			variant
				"Dreadnought"
				"Bastion (Laser)"
				"Argosy (Blaster)"
				"Argosy (Laser)"
		fleet
			names "free worlds capital"
			fighters "free worlds fighters"
			variant
				"Dreadnought"
				"Falcon (Plasma)"
				"Skein"
				"Finch" 6
		fleet
			names "free worlds capital"
			variant
				"Dreadnought"
				"Falcon (Laser)"
				"Osprey (Laser)"
		fleet
			names "free worlds capital"
			variant
				"Falcon (Heavy)"
				"Osprey (Laser)"
				"Argosy (Turret)"
	
	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 "fwc pug defeated"
		event "fwc link restoration 1" 10
		event "fwc link restoration 2" 18
		event "fwc link restoration 3" 29
		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 "FWC End"
	name "Talk to Parliament"
	description "Travel to Earth for another meeting with Parliament. Alondo and Katya will meet you there. (Hopefully it will go better than your last visit.)"
	autosave
	source Pugglemug
	destination Earth
	to offer
		has "FWC Pug 6: 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 "Parliament has agreed to a peace treaty, because the threat of alien invasion now seems much more pressing than the civil war with the Free Worlds. Whatever the true intention of the Pug was, the result of their interference is that humanity is at peace once more. There has been great loss of life, but nothing compared to what would have happened if the Free Worlds had tried to conquer Earth."
		log "It may be a while before members of the Free Worlds manage to re-earn the trust of the rest of humanity, however."
		"reputation: Republic" += 20
		conversation
			`You find Admiral Danforth inspecting the Pug spaceport. "This is all very odd," he says. "I'm glad the aliens appear to have left, but I wish we knew where they came from and whether they're likely to return."`
			`	Freya says, "What should we do now?"`
			`	"I've contacted New Austria and told them that Councilor Reynolds is free to leave," he says. "She told me that your Senate has agreed to the Free Worlds being a semi-autonomous district of the Republic, similar to the Syndicate systems. She also asked that you and Captain <last> meet up with her and Alondo Gruyere on Earth, where they will be meeting with Parliament. I sent a report to Earth that places a very heavy emphasis on the role that the Free Worlds played in this victory, so Parliament ought to be quite willing to negotiate with you."`
			choice
				`	"Thank you. It's been an honor to fight alongside you."`
					goto honor
				`	"Last time we visited Parliament, they violated our safe passage agreement and put us on trial."`
					goto trial
			label honor
			`	"No, the honor has been mine," he says. "Feel free to drop by and visit me on Farpoint any time you're in the area."`
				accept
			label trial
			`	"Trust me," he says, "you won't need to worry about that this time around. Having an alien attack so close to Earth be thwarted through the assistance of the Free Worlds has put Parliament in a very... receptive mood. Good luck, Captain <last>, and I hope our paths will cross again."`
				accept
	
	on complete
		event "deep sky tech available"
		event "syndicate tech available"
		set "main plot completed"
		set "free worlds plot completed"
		conversation
			`You arrive in the Parliament building just as Alondo and Katya have finished meeting with them. "Good news," says Katya. "We're all officially pardoned. And you, Captain <last>, have become something of a hero."`
			`	"Better yet," says Alondo, "the war with the Republic is over. We agreed to limiting our territory to its current size, and to a very minor tax to cover the cost of Navy protection if the aliens attack again or some other major catastrophe strikes. In return, the Free Worlds have been granted autonomy from the Republic."`
			`	"Also," says Katya, "as their own expression of gratitude, the Syndicate members of Parliament have offered to make some of their new technology, developed during the war, available to us at an affordable price."`
			choice
				`	"That's very generous of them."`
				`	"I wonder if that's their way of buying our support and keeping us quiet about the supposed defector."`
			`	"Maybe so," says Alondo. "Now, Captain, your salary will continue to be paid in gratitude for your service, but you are free to return to civilian life. 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 won this war 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...`
