# Copyright (c) 2014 by Michael Zahniser
#
# Endless Sky is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later version.
#
# Endless Sky is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.  See the GNU General Public License for more details.

mission "Immigrant Workers"
	description "This young couple wants to start a new life on <destination>."
	minor
	passengers 2
	cargo "luggage and furniture" 2
	to offer
		random < 50
	source "New Iceland"
	destination
		attributes core
		attributes factory textile
	on complete
		payment
		payment 10000
		dialog "The young couple from <origin> pays you and thanks you profusely as they gather up their goods and depart. You wish them the best of luck in their new life on <planet>."
	on offer
		conversation
			"As you leave your ship and walk toward the cafeteria at the center of the spaceport, you notice a young couple standing near the edge of the landing area next to a cart loaded high with a jumble of boxes and furniture. Like many of the locals, they are both wearing dust masks over their mouths, and the woman is also wearing goggles."
			choice
				"	(Talk to them.)"
				"	(Ignore them.)"
					decline
			"	The couple introduces themselves as George and Samantha. As you shake hands with them, you notice that Samatha's eyes under the goggles are rimmed in red, and she keeps coughing quietly: a dry, careful cough. George explains that they came here several years ago to take jobs in the factories, but the volcanic fumes have been giving Samantha trouble ever since they arrived. They will pay for transport for themselves and their household goods to <destination>."
			choice
				"	(Accept.)"
				"	(Decline.)"
					decline
			"	They thank you for your assistance, and you give them a hand pushing the heavy cart into your cargo bay."
				accept



mission "Pookie, Part 1"
	name "Pookie"
	description "Travel to <destination> and meet Pookie, who is staying with her aunt and may be scared of flying."
	minor
	to offer
		random < 50
	source "Hestia"
	destination "Shroud"
	passengers 1
	cargo "(reserved)" 1
	on offer
		conversation
			`As you walk through the spaceport, you hear a voice behind you, saying, "Excuse me, captain." You turn around and see a woman trying to flag you down. Her hairdo is tall and somewhat confusing; her high heels are also tall and are giving her considerable trouble as she walks towards you.`
			`	"You look like the sort of captain I can trust," she says. "My darling Pookie has been visiting her aunt on Shroud, and it's time for her to come home, but she's not used to space travel and it scares her. I would feel so much better if you could go pick her up and bring her back here. Can you do that for me?" You can't help noticing that the jewelry she's wearing probably costs as much as a small fighter craft. This job sounds easy, and has the potential to be quite lucrative.`
			choice
				"	(Accept.)"
				"	(Decline.)"
					decline
			"	You tell her that you would be glad to assist, and that you can personally assure her that no harm will come to Pookie while on board your ship. She thanks you, and gives you contact information for her aunt in the <system> system."
				accept



mission "Pookie, Part 2"
	name "Pookie"
	landing
	description "Return Pookie the poodle to <destination>."
	source "Shroud"
	destination "Hestia"
	passengers 1
	cargo "chew toys" 1
	to offer
		has "Pookie, Part 1: done"
	on offer
		conversation
			`You called ahead while your ship was landing and agreed to meet Pookie's aunt at the spaceport. She told you, "Meet me outside the shop with the ridiculous sheepskin coats." The shop is not hard to find; the mannequins in the window look like feral sheep with overgrown wool in bad need of grooming.`
			"	The only person standing outside the shop is a tall woman in a suit who is busy making furious marks on some sort of document with a red pen. She has a small poodle on a leash; it is busy nipping the heels of everyone who walks by."
			choice
				"	(Interrupt her.)"
					goto interrupt
				"	(Wait to see if someone else shows up.)"
					goto wait
		
			label interrupt
			`	"Excuse me," you say. She looks up at you with a withering glare. "I'm looking for someone named Pookie."`
				goto response
		
			label wait
			`	Eventually she looks up from the paper and sees you standing there. "Are you Captain <last>?" she asks. You nod.`
				goto response
		
			label response
			`	"Thank heavens," she says. "She's all yours." She hands you the leash and a large bag that appears to be full of chew toys. "Here are her toys, her food, and her... outfits. Which she hates. Feed her twice a day, or she will go berserk. Do not feed her more than twice a day, or she will throw up..."`
			`	As she continues rattling off instructions, you ask, "Wait, Pookie is the dog?"`
			`	"Short for 'Pocahontas,"' she explains. "Good luck, and I hope my sister pays you well." She walks away. There's nothing else you can do but bring Pookie back to your ship, where she immediately lifts her leg against the landing strut.`
				accept
	on complete
		payment 80000
		dialog "In the past few days, Pookie has barked incessantly and thrown up several times despite being fed perfectly on schedule, and the room you've been keeping her in will likely smell like dog urine for months. You are all too happy to return her to her owner, who pays you <payment>."



mission "Smuggler's Den, Part 1"
	name "Refugees to <planet>"
	description "You met Joe and Maria, a young couple with a newborn baby, on the Smuggler's Den station. They want to start a new life on <destination>."
	minor
	source "Smuggler's Den"
	destination "Arabia"
	passengers 2
	on offer
		conversation
			`You wander into one of several dimly lit, smoke-filled bars near your docking bay. Soon after you sit down, a pair of hooded figures stand up and begin moving toward you. They aren't carrying any visible weapons, but on a station like this one there's a good chance that everyone you meet has a concealed gun. One of them is carrying a bundle wrapped in cloth. You can't see their faces.`
			choice
				`	(Get out of here.)`
				`	(Wait and see what they want.)`
					goto meet
			
			`	You've heard too many stories of kidnappings and murders on this station to be willing to take any risks. You quickly get up and leave the bar, and walk down the passageway back toward your ship. Glancing behind you, you see that the hooded figures have decided not to follow you.`
				decline
			
			label meet
			`	The hooded figures turn out to be a boy and a girl, both perhaps thirteen or fourteen years old. The bundle in the girl's arms is a baby. "Are you a captain?" the boy asks.`
			`	"Yes," you say.`
			`	"We're looking for passage off-world," he says. "My cousin works in the refineries on Arabia, and I'm hoping he can get me a job there."`
			choice
				`	"I don't want to be involved in anything illegal. Are you in some sort of trouble with the law?"`
					goto legal
				`	"Well, how much would you be able to pay me?"`
					goto payment
			
			label legal
			`	The boy grins. "No, not at all. I mean, aside from the fact that we're pirates."`
			`	Seeing the incredulous look on your face, the girl says, "Members of a pirate gang. Crew on a pirate ship. Captains are usually older, but most of the pirate ships you see out there are crewed by kids like us. It's a hard place to grow up. We want something better for our daughter."`
				goto search
			
			label payment
			`	They are silent for a long moment, looking down at the table. Finally, the boy says, "We're crew on a pirate ship, hardly better than slaves. The captain keeps our wages. We don't get paid anything unless they agree to let us go. But if you help us start a new life, we'll work hard and some day we'll pay you back."`
			`	The girl adds, "You don't know what it's like for a little girl to grow up on a pirate ship. We want something better than that for our daughter."`
				goto search
			
			label search
			`	As you are conversing a bearded man and a rough-looking teenage boy enter the bar and begin looking around the room. "That's our captain," she says. "Please, you have to help us. There's a service tunnel that connects to the back entrance of the bar. We can escape through there."`
			`	You've heard of these service passageways: the most dangerous part of this lawless station, dimly lit and seldom travelled, except by drug addicts and prostitutes. This whole thing might just be a ruse to lure you into one, where they can attack you without anyone interfering. "No," says the boy, "if we head for the service tunnel, they'll be sure to notice us. Let's just stay at the table until they go away."`
			`	The baby begins to cry, softly, and she bounces it gently, trying desperately to quiet it. "Shh. Shh." For the moment, it falls silent.`
			choice
				`	(Try the service tunnel.)`
					goto tunnel
				`	(Wait.)`
					goto outside
				`	"I'm sorry, this isn't worth risking my life for. I'm leaving."`
	
			`	You stand up and leave. The men in the doorway make no effort to stop you.`
				decline
			
			label `tunnel`
			`	The boy stands up. "Wait ten seconds, then head to the tunnel," he says. He walks into the bathroom, which is right next to back entrance that she pointed out. You wait for a few seconds, then stand up. "Don't run," says the girl. "Walk slowly. Pretend. You've had a bit too much to drink. We're headed out back to find some privacy." You don't dare look behind you to see if the men in the doorway are watching you.`
			`	Finally, you reach the back entrance, and she spins the wheel to unlock it. The hinges squeal, but it opens enough for you to squeeze through. You find yourselves in a narrow corridor lit only by flickering sodium lamps. In the yellow lamplight her face and hands look pale, jaundiced. The floor of the corridor is littered with beer bottles and discarded hypodermic needles. To one side of the door are several over-stuffed trash cans. As you step into the corridor, a rat scurries away into the darkness.`
			`	A few second later, watching through the open airlock, you see the boy walk out of the bathroom. He can't help stealing a quick glance towards the men in the doorway, after which he quickly ducks through the airlock and slams the door shut. "Run!" he whispers.`
			`	You begin running down the corridor, in the direction of your ship. You pass a man, slumped over in a corner; there is no time to see if he is dead, or just sleeping. In places the lights have gone out, and it is so dim that you can barely see the floor beneath you. Your footsteps pounding on the metal decking ring terribly loud up and down the empty hallway.`
			`	Eventually the passageway widens out into a maintenance room, full of humming equipment and large tanks. You duck behind one of them and listen for sounds of pursuit. "I think we're safe," says the boy. He walks over to another airlock door on the opposite wall and tugs it open. Light pours in, almost blinding at first. You are looking out into the rimway, the main passage in this ring of the station. Crowds of people are walking past, paying no attention to you. He glances quickly in both directions, then gestures for you to follow.`
				goto ship
			
			label outside
			`	You wait at the table, pretending that you are busy placing a drink order. The men at the door do not leave. Instead, they step into the room and begin circling around the edge of it. "What berth is your ship in?" asks the boy. You tell him. "Wait ten seconds, then follow," he says. He stands up and walks through the door. The searchers glance at him as he leaves, but they must be looking for two people together, because they ignore him.`
			`	The searchers approach the bar and begin talking to one of the bartenders. You and the girl stand up. "Walk slowly," she hisses under her breath. "Saunter. Don't run." You put an arm around her shoulders and do your best to act like an ordinary bar patron headed home with a new friend after having a bit too much to drink. You don't dare to glance at the bar to see if you are being watched.`
			`	Finally you reach the door. You are in the rimway, the main passage in this ring of the station. It is crowded and brightly lit. You quicken your pace slightly and begin walking toward your ship, still afraid that if you break into a run, you will attract attention. The girl keeps glancing at the shop windows that you pass by: checking the reflection to see if anyone is following you. "They're leaving the bar," she says. And then, "They're walking in the other direction. I think we're safe."`
			`	You pass a narrow doorway, probably an entrance to one of the service tunnels. The boy is standing there, holding a gun by his side. His grim expression softens somewhat when he sees you approaching.`
				goto ship
			
			label ship
			`	You quickly make your way back to your ship. As soon as the door has closed behind you, all three of you breathe a sigh of relief. A second later, the baby begins to wail, loudly. As you show them to their bunks, they introduce themselves as Joe and Maria; the baby's name is Jesse. "I don't know how to thank you," says Maria.`
			`	"Please don't take too long leaving the station," adds Joe. "But, I think we'll be safe here until you're ready to leave. There's no way they can search all the ships at the dock."`
				accept



mission "Smuggler's Den, Part 2"
	landing
	name "Refugees to <planet>"
	description "Joe and Maria were unable to find work on <origin>. Take them to <destination> to see if they can get a job there."
	destination "Millrace"
	passengers 2
	to offer
		has "Smuggler's Den, Part 1: done"
	on offer
		conversation
			`As soon as you have landed, Joe finds a computer terminal and tries to look up his cousin who works here, but with no success. You go with him to the company office, where after a short wait you are ushered in to meet with a foreman. After Joe introduces himself, the man says, "I'm really sorry to tell you this, but Leroy died in a refinery fire several months ago."`
			`	Joe is crestfallen. After a long silence, you say, "Sir, do you have any work available for Joe? He and his family were hoping to be able to put down roots here."`
			`	"I'm sorry," says the foreman, "but we've had a ton of immigrants recently. The waiting list for new jobs is about five months long. They could stay here and hope for the best, but if they need work right away, they would be better off going to one of the Syndicate worlds, like <planet>."`
			choice
				`	(Volunteer to take them to <planet>.)`
				`	(Leave them here and hope for the best.)`
					decline
			
			`	Despite his shock and grief, Joe is quite grateful. "You know we can't pay you, right?"`
			`	"Don't worry about it," you say. You return to your ship and tell the bad news to Maria.`
				accept
	on complete
		event "smuggler's den: payment" 365
		conversation
			`You help Joe and Maria, and their daughter Jesse, to carry their few belongings down to the immigration desk, where a clerk lists the job openings available and asks them each to fill out a skill survey. Maria says, "Captain <last>, I don't know how to thank you, but I promise you that once we've got steady jobs, we'll save up and pay you our fare for transporting us here."`
			`	You wish them the best of luck, and return to your ship.`

event "smuggler's den: payment"



mission "Smuggler's Den: Payment"
	landing
	source
		government "Republic" "Free Worlds" "Syndicate" "Quarg" "Neutral"
	to offer
		has "event: smuggler's den: payment"
	
	on offer
		payment 35000
		conversation
			`When you land, you are surprised to find a message waiting for you from Joe and Maria, the young couple you transported from Smuggler's Den to Millrace a year ago to help them and their baby escape their lives as pirate crew members. "Dear Captain <last>," they write, "we promised you we would save up enough money to pay you back for transporting us. Attached is <payment>. Thank you for giving us a chance at a new life." They've also enclosed a picture of themselves and their baby Jesse, who is now more than a year old.`
				decline



mission "Smuggler's Den: Follow Up"
	landing
	source Millrace
	to offer
		has "Smuggler's Den: Payment: offered"
	
	on offer
		conversation
			`As you're coming in for a landing, you realize that Millrace is where Joe and Maria live, the couple you transported from Smuggler's Den. They recently wrote to you thanking you for helping them to begin a new life. Do you want to stop by and see how they are doing?`
			choice
				`	(Yes.)`
				`	(No.)`
					decline
			`	You contact Joe and Maria and they say they would definitely enjoy seeing you. On your way to the workers' barracks where they live, you stop by a small store and buy some chocolate, plus bread and fresh fruit and some canned goods you think they would be able to use. They thank you for coming and welcome you into their home. Jesse is continuing to grow up, and they have another baby too, now. Joe says the work in the factories is exhausting, and the hours are long, but they never need to worry about where their next meal will come from, or what they'll be required to do to earn it. You leave feeling very glad that you have been able to make such a difference in someone's life.`
				decline



mission "Expedition to Hope 1"
	name "Expedition to Hope"
	description "Transport a team of scientists to the abandoned world of <planet>, where they will be placing some meteorological equipment."
	minor
	source
		near Wei 2 8
		attributes "dirt belt"
	destination Hope
	to offer
		random < 40
	cargo "scientific equipment" 4
	passengers 4
	
	on offer
		conversation
			`A group of scientists approaches you and asks if you would be willing to take them to the abandoned planet of Hope, and then back home from there. "The transport we'd arranged for bailed out on us at the last moment," says their leader, a middle-aged man wearing thick-rimmed glasses.`
			choice
				`	"Sure, I'd be glad to help."`
					goto yes
				`	"What sort of research are you doing?"`
				`	"Sorry, I don't have space for you."`
					decline
			`	"You probably know about the supervolcano that forced the evacuation of Hope some decades ago," he says. "My family lived on Hope back then. We want to measure how much ash is still in the air, to see how long it will be before the glaciers recede and the planet is habitable again."`
			choice
				`	"That sounds like a worthy cause. I'd be glad to transport you."`
					goto yes
				`	"Sorry, I'm not going to be headed in that direction any time soon."`
					decline
			label yes
			`	"Thank you," he says. You help them to load their meteorological equipment onto your ship.`
				accept
	
	on complete
		payment 40000



mission "Expedition to Hope 2"
	landing
	name "Expedition to Hope"
	description "Transport the team of scientists home to <destination>."
	source
		Hope
	destination
		distance 2 5
		govenment Republic "Free Worlds" Neutral
	to offer
		has "Expedition to Hope 1: done"
	passengers 4
	
	on offer
		conversation
			`You fly around the planet to several different sites that the scientists have identified as good places for their equipment. They also make some deep radar scans of the glaciers. "That's my old house, down there," says one of the scientists, pointing to the radar picture of one of the buried villages. "Under thirty meters of ice, now."`
			`	The lead scientist hands you forty thousand credits, and says, "Here's the first part of your payment. Now we need to get home to <planet>. I'll pay you the rest once we get there."`
				accept
	
	on complete
		payment 40000
		dialog `You drop the team of scientists off on <planet>. They thank you for helping them out, and pay you <payment>.`



mission "Transport Workers A"
	name "Transport Family"
	description "Transport this family to <destination>, where they hope that steady work will be more easy to come by."
	minor
	source
		attributes "dirt belt"
	destination
		government "Syndicate"
		attributes "factory"
	to offer
		random < 5
	passengers 4
	cargo "household goods" 2
	
	on offer
		dialog `In one of the corners of the spaceport, you meet a family with two kids, and a pile of trunks and boxes spread out next to them. They tell you that they are trying to book passage to <planet>. "Work has gotten way too hard to come by here," explains the father. "I've had seven different jobs in the past year, and none of them lasted more than a month. So we thought we'd try our luck on a Syndicate world."`
	
	on complete
		payment
		payment 20000
		dialog `You drop off the family from <origin>, and wish them the best of luck on <planet>. They seem optimistic, and their kids are still quite excited about having taken their first ever space journey. You're sure that they will be remembering this trip for years to come. Their parents thank you, and pay you <payment>.`



mission "Transport Workers B"
	name "Transport Worker"
	description `This young man is headed to the factories on <destination>. He says he wants to save enough money to be able to ask his "true love" to marry him.`
	minor
	source
		attributes "dirt belt"
	destination
		government "Syndicate"
		attributes "factory"
	to offer
		random < 5
	passengers 1
	
	on offer
		conversation
			`As you are walking through the spaceport, a young man approaches you and says, "Excuse me, Captain. Is there any chance you're traveling towards the Core?" He's probably in his late teens, barely more than a kid.`
			choice
				`	"I'm sure I could work that into my plans. Where are you headed?"`
				`	"You're traveling all by yourself? You aren't in any trouble, I hope?"`
				`	"Sorry, I don't expect to be headed that way any time soon."`
					decline
			`	"Well, here's the story," he says. "My girlfriend's father won't let us get married until I have some money saved up. They say there's plenty of jobs to be had on <planet>. So I'm headed there to put down roots and get myself established, then in a year or two she can come and join me."`
			choice
				`	"I'd be glad to take you there."`
					goto thanks
				`	"Are you sure about that? I've heard some bad things about the Syndicate's company towns."`
					goto towns
				`	"Do you really think she's going to wait around for you?"`
					goto wait
			label towns
			`	"Me too," he says, "but it's a lifetime of steady work, and you know how hard that is to come by in this part of the galaxy. Can you help me out?"`
				goto choice
			label wait
			`	"She'll be true to me," he says, with absolute confidence.`
				goto choice
			label choice
			choice
				`	"Okay, I'll take you to <planet>."`
					goto thanks
				`	"Sorry, I'm not headed in that direction."`
					decline
			label thanks
			`	"Thank you, Captain," he says, shaking your hand. You bring him aboard your ship and show him to one of the empty bunks.`
				accept
	
	on complete
		payment
		payment 10000
		dialog `You drop off the young man from <origin> who is hoping to find work and save enough money for his girlfriend to join him. "Good luck," you say. "Be wise. Don't let yourself get into debt." He thanks you, and pays you <payment>.`



mission "Transport Workers C"
	name "Farming Family"
	description "Transport this family of farmers, and their livestock, to <destination>."
	minor
	source
		attributes "dirt belt"
		attributes "farming"
	destination
		government "Syndicate"
		attributes "farming"
	to offer
		random < 15
	passengers 5
	cargo "farm animals" 10
	
	on offer
		conversation
			`On the dirt near your landing pad is parked a large wagon, hitched to a draft horse and loaded down with furniture and various farming implements. A family is gathered in the shade of the cart, and several goats and sheep are tied up behind it. Do you approach them and find out where they are headed?`
			choice
				`	(Yes.)`
				`	(No, I'm not interested in carrying livestock in my shiny new space ship.)`
					defer
			`	The farmers introduce themselves as Cory and Annette Patterson; their kids are Erin, Kyle, and Sarah. "Any chance you've got space for some livestock?" asks Jim. "The droughts the last few years have been fierce, and we're hoping to start a new homestead on <planet>."`
			choice
				`	"Sure, I'd be glad to take you there."`
					accept
				`	"Sorry, that's way too far from here."`
					decline
	
	on complete
		payment
		payment 10000
		dialog `You drop off the Pattersons, the farm family from <origin>, and help them to unload their wagon and cattle from your cargo hold. They thank you, and Jim pays you <payment>.`



mission "WR Star 1"
	name "Star Research"
	description "Fly through the Ildaria system with this team of scientists, then return them to <destination>."
	minor
	source
		attributes deep
		attributes urban research
	waypoint Ildaria
	to offer
		random < 20
	passengers 3
	cargo "sensors" 2
	
	on offer
		dialog `A group of scientists approaches you and asks if you will be headed to the Rim any time soon. "We're doing research on Wolf-Rayet stars," they explain, "and we're hoping to find a captain who can do a fly-by of Ildaria." Scientific research in the Deep is notoriously well-funded, so they will probably pay you quite well.`
	
	on complete
		payment 250000
		dialog `The team of scientists thanks you for bringing them to Ildaria and back, and pays you <payment>. They seem eager to get back to their lab and start analyzing their measurements.`



mission "Deep Archaeology 1"
	name "Deep Archaeology"
	description "Drop this archaeologist off on <destination>, before making a trip to Midgard in the Deep to collect some samples."
	minor
	source
		attributes paradise north "near earth"
		near Miaplacidus 1 20
	destination Vinci
	to offer
		random < 15
		"combat rating" > 15
	passengers 1
	
	on offer
		conversation
			`As you are walking through the spaceport, a man in an expensive suit approaches you. "Pardon me, Captain," he says. "I wonder if you would be willing to talk privately about a very lucrative job opportunity."`
			choice
				`	"Is this something illegal?"`
				`	"Sure, let's return to my ship and talk there."`
					goto ship
			`	"Not illegal," he says, "but it could help to uncover a secret with enormous ramifications. A secret that certain people do not want known."`
			`	"Okay," you say, "let's return to my ship, and I'll hear you out."`
			label ship
			`	You lead him back to your ship. "I'm an archaeologist," he explains, "studying the early history of the space era. And in particular, a set of persistent folk tales about contact with alien species. Many of these tales have to do with the region of the galaxy we call the Deep. I need someone to travel to Midgard and retrieve some samples from an ancient site there."`
			choice
				`	"Why can't you travel there yourself?"`
				`	"What sort of samples? Will this get me in trouble?"`
					goto samples
			`	"Well, let's just say I've made myself somewhat unpopular in the Deep," he says. "Asking too many questions. If I were seen walking around on Midgard, they would probably ask me to leave immediately."`
			`	You say, "And, is the work you're asking me to do going to make me equally unpopular?"`
			label samples
			`	"Not if you are circumspect," he says. "I need two samples from a certain village. One is simple: wood from a living or recently deceased tree. Any tree will do."`
			`	He pauses for a minute, then continues. "The other is more... sensitive. There is a historical site on Midgard, an ancient church. Not something they publish in the official tourist guides, mind you. I need a small sample of the wood that the church is built with. A small splinter would suffice."`
			choice
				`	"Sure, if it's in the interest of science, I can do that."`
					goto yes
				`	"You're asking me to vandalize a historical site?"`
			`	"I need only the tiniest of samples," he says, "maybe a splinter of wood that is already peeling off, or from a place where the wood is worn and cracked. And what we discover from that sample could be of immense importance."`
			choice
				`	"Sorry, that sounds a bit too shady to me."`
					decline
				`	"Okay, I'm willing to do that."`
			label yes
			`	"Thank you," he says. "Trust me, this could give us some very important information. I'll need you to drop me off on Vinci first, to meet with some scientists. We can then meet up back on Vinci once you have the samples."`
				accept



mission "Deep Archaeology 2"
	landing
	name "Deep Archaeology"
	description "Travel to <destination> and take wood fiber samples from an ancient church and from the trees that grow nearby."
	source Vinci
	destination Midgard
	to offer
		has "Deep Archaeology 1: done"
	
	on offer
		conversation
			`You drop off the archaeologist (who still has not told you his name) on <origin>. "Remember," he says, "I only need a tiny splinter. Just make sure it really is from the building and not anything more recent."`
				accept



mission "Deep Archaeology 3"
	landing
	name "Deep Archaeology"
	description "Return to <destination> with the wood samples that you retrieved from the church on <origin>."
	source Midgard
	destination Vinci
	to offer
		has "Deep Archaeology 2: done"
	
	on offer
		conversation
			`Following the map that the archaeologist gave you, you make your way to a small village in the mountains on <origin>, with two envelopes in your pocket for samples. As you approach the church, you break a dead twig off one of the trees along the path, put it into the first envelope, and pocket it. One sample collected, one more to go.`
			`	The church itself is unlike any building you have seen before, clearly very ancient, build of roughly hewn wood, old and weathered. Surprisingly, the front doors are open, and you hear music coming from inside.`
			choice
				`	(Walk into the church.)`
					goto inside
				`	(Take a sample from the outside.)`
				`	(Give up on this mission and leave, before I get into trouble.)`
					decline
			`	You walk around the outside of the building until you find one corner where the wood has been recently scuffed, and a few hairs of it are hanging loose. You carefully pick the splinters off and put them in the second envelope. Then, you return to your ship. Although you see no one following you, you can't shake the feeling that you are being watched.`
				accept
			label inside
			`	This church must still be used for services: candles are lit up front, and a man in a white surplice is playing the organ. A few people sit in the pews with their heads bowed. Trying to be as unobtrusive as possible, you join them, and look around at the ornately carved pillars and wood panels. The air in here smells of incense and musty wood.`
			choice
				`	(Take a sample.)`
				`	(Give up on this mission, and leave.)`
					decline
			`	Pretending to pray, you kneel on the ground, take your pocket knife, and shave the tiniest sliver off the bottom corner of the pew in front of you. It leaves a small white scar in the dark weathered wood of the pew. You pocket the sample, wait a few more minutes, and then leave and walk back to the spaceport. Although you see no one following you, you cannot shake the feeling that you are being watched.`
				accept
	
	npc
		personality waiting
		government Republic
		ship "Raven (Afterburner)" "D.P.S. Wyrd"
	
	npc
		personality waiting
		system Aspidiske
		government Republic
		ship "Raven (Afterburner)" "D.P.S. Skuld"
	
	npc
		personality waiting
		system Gomeisa
		government Republic
		ship "Raven (Afterburner)" "D.P.S. Verthandi"
	
	on complete
		payment 200000
		conversation
			`You return to the lab where you dropped off the anonymous archaeologist. Soon after you arrive, he appears and eagerly collects the two samples, giving you a payment of <payment> for your troubles. "But please," he says, "stick around long enough to learn the results." He hands the two envelopes to a lab technologist, and says, "Here you go, John, Take a look and let us know what you find."`
			`	After the lab tech leaves, he explains, "You see, the ratio of Carbon 12 to Carbon 14 varies from world to world, so accurate dating can only be done if you have a control sample to compare against. Only a handful of archaeological studies have been done in the Deep, and those were sloppy - they used the standard tables of Earth's carbon ratios instead of determining the local concentrations."`
			choice
				`	(Wait and see what the results are.)`
			`	About thirty minutes later, John reappears, looking somewhat shaken. "Where did you get those samples?" he asks.`
			`	"Never mind that," says the archaeologist. "What are your results?"`
			`	"The second sample is infused with some sort of oil or tar," he says. "A varnish. And therefore it is from furniture or a building. A man-made artifact. The control sample has an isotopic ratio different from Earth, so unless you're playing games with me, these samples are not from Earth."`
			`	"Go on," says the archaeologist.`
			`	"However," says the lab tech, "again assuming the two samples are from the same planet, the second sample is between fifteen hundred and twenty-five hundred years old. Which means it predates the discovery of the hyperdrive by, at minimum, five centuries. So again I ask you, where did you get these samples?" His voice is raised.`
			`	"Intriguing, isn't it?" says the archaeologist. "Captain <last>, if you'd like to help us get to the bottom of this, make sure you've got space for us and some equipment, and meet us in the spaceport."`



mission "Deep Archaeology 4"
	name "Deep Archaeology"
	description "Return to <destination> with some specialized equipment for subterranean mapping."
	source Vinci
	destination Midgard
	to offer
		has "Deep Archaeology 3: done"
	cargo "mapping equipment" 4
	passengers 2
	
	on offer
		log "People" "Albert Foster" `An archaeologist who is famous for using dubious methods: he has been banned from Quarg space for trying to collect an alloy sample from their ringworld, and is rumored to have also been involved in a scheme involving dinosaur fossils and an illegal genetic resequencer. He is currently based on Vinci, on the edge of the Paradise sector.`
		conversation
			`You find John the lab tech in one of the spaceport bars, along with the archaeologist, who says, "I suppose I should introduce myself. Albert Foster. You may have heard of me." Indeed, you have: he made headlines about a decade ago by being driven out of Quarg space after trying unsuccessfully to collect an alloy sample from their ringworld.`
			`	"We've purchased some equipment for gravitational field mapping," he says, "in addition to a very sensitive radar array. We're hoping to map the area around the church, see if there are signs of any ancient settlements. Are you willing to help us?"`
			choice
				`	"Sure, I'd love to help solve this mystery."`
				`	"Sorry, I can't. I'm worried we're going to make people in the Deep angry."`
					decline
			`	"Excellent," says Albert. "We just need to do a flyover of <planet>, and see what our radar turns up."`
				accept



mission "Deep Archaeology 5"
	landing
	name "Deep Archaeology"
	description "Evade the ships that are chasing you and return to <destination>."
	source Midgard
	destination Vinci
	to offer
		has "Deep Archaeology 4: done"
	cargo "mapping equipment" 4
	passengers 2
	
	on offer
		conversation
			`You cruise high above the surface of <origin> as John calibrates his instruments. "Sorry it's taking so long," he says, "there's some sort of glitch in the gravitational sensors, messing up my measurements."`
			`	"What sort of glitch?" asks Albert.`
			`	"Just a sensor artifact," he says, "some sort of echo. No, wait..." He trails off and starts turning dials on the instrument, then turns very pale.`
			`	Albert looks over his shoulder at the monitor, but clearly doesn't understand what he's looking at. "What is it?" he asks.`
			`	"It's not a sensor glitch," says John. "It's an artificial singularity."`
			choice
				`	"Some sort of illegal research?"`
					goto illegal
				`	"A what?"`
					goto what
			label illegal
			`	"No, not illegal," says Albert. "No need to make laws against them, for the simple reason that no one knows how to make them. That's alien technology, very advanced."`
				goto attack
			label what
			`	"A miniature black hole," says John. "An alien power source. Far more sophisticated than anything human beings have ever created. That is, unless someone in the Deep has found a way to reverse engineer alien technology."`
			label attack
			`	Suddenly, a warning light flashes on your ship's radar. Three ships have taken off from the planet's surface and are headed straight towards you. "Let's get out of here," says Albert. "Head back to <planet>!"`
				launch
	
	npc
		personality heroic
		government Deep
		ship "Raven (Afterburner)" "D.P.S. Wyrd"
		ship "Raven (Afterburner)" "D.P.S. Skuld"
		ship "Raven (Afterburner)" "D.P.S. Verthandi"
	
	on complete
		payment 300000
		conversation
			`You breathe a sigh of relief as you land safely in the spaceport on <planet>. "Okay, what was that all about?" you ask.`
			`	"I honestly don't know," says Albert. "I can tell you what I suspect, though. The history books don't actually say when the Deep was first settled. The first documented expedition to the Deep was in the 24th century, and they found several human colonies already established in the region, claiming to date back to the very dawn of space flight. But I think the first settlers were brought there long before that. Brought there on alien ships."`
			choice
				`	"For what purpose?"`
					goto purpose
				`	"What aliens? The Quarg?"`
					goto aliens
			label purpose
			`	"I'm not sure," he says. "But I first became interested in the Deep while researching the Alpha Wars. I'm sure you know the history, how humanity was nearly enslaved by psychopathic 'super' humans that we ourselves had created by dabbling in genetic engineering. At that time, the Deep made a sudden, improbable technological leap that allowed them to construct weapons and ships far more powerful than what the Alphas had, and the war against them was won."`
				goto end
			label aliens
			`	"There are popular folks tales in the Deep about 'elves,'" says Albert. "Thin, pale, graceful creatures, with blue blood."`
			`	John frowns. "Hemocyanic blood. Not the Quarg, then. Their lungs are odd, but their blood uses hemoglobin for oxygen transport, just like ours."`
			label end
			`	Albert continues, "What I think is that an unknown alien species has been involved in events in the Deep since the beginning, and is perhaps still involved there today. I think this is known to at least some of the Deep's inhabitants."`
			choice
				`	"So, what do we do now?"`
				`	"How can we find out more information?"`
			`	"Well," he says, "unfortunately, Captain, they're going to be watching you. I'll have to seek out someone else for the next stages of my research. But I will keep you notified if I discover anything further."`
			`	It is an unsatisfactory conclusion to your work, with so many questions unanswered. But to make up for that, Albert gives you <payment> as payment for your services. "You will hear from me again," he promises.`



mission "There Might Be Riots 1"
	name "Transport band to <planet>"
	description `Give the band "There Might Be Riots" a ride to <destination>.`
	minor
	source
		near Tarazed 5 10
		government "Republic" "Free Worlds" "Neutral"
	destination "Wayfarer"
	cargo "musical equipment" 4
	passengers 8
	to offer
		random < 15
	
	on offer
		conversation
			`A woman in a well-tailored suit approaches you. "Captain <last>?" she asks. You nod. "My name is Becca," she says. "I'm a stage manager for a band, and the transport we had under contract bailed out on us. Any chance you could take us to <destination>? Given the circumstances, we can pay quite well."`
			choice
				`	"Sure!"`
				`	"Sorry, I'm not headed in that direction right now."`
					defer
			`	"Great," she says, "I'll tell the boys to start loading their gear into your ship." About a half an hour later the road crew begins carting instruments and amplifiers into your cargo hold. Soon after that, you hear the roar of a crowd in the distance and another group of men comes running into your ship. "We're with the band," they say. "Quick, shut the hatch." Half a minute later, a mob of people has surrounded your ship and a few of them are even climbing on top of it. It takes you a second to realize they're not angry or bent on destruction - they're just a group of crazy fans.`
			`	"Happens everywhere we go," says one of the musicians, calmly, as he watches a video feed of the mob on one of your monitors. He tells you that he's Ulrich, the lead singer. Then he introduces the rest of the singers and musicians.`
			choice
				`	"Pleased to meet you all. What's the name of your band?"`
			`	"Oh," Ulrich says, "we call ourselves, 'There Might Be Riots.'"`
			`	Eventually, the spaceport police arrive and disperse the crowd, and the band settles in for their trip to <destination>.`
				accept
	
	on complete
		payment
		payment 100000
		conversation
			`You drop off the band "There Might Be Riots" on <destination>. Along the way, you got to hear some of their music, which is mostly characterized by frenzied instrumentals, a very energetic brass section, and bizarre lyrics. One day while you were in transit, they nearly drove you insane by playing their catchy but nonsensical song "Henhouse In Your Soul" for four hours straight, but other than that they have been good passengers, and their stage manager gives you an incredibly generous payment of <payment>.`
			`	"We've already got a gig lined up for tonight," says Ulrich. "Want to come? We'll give you free tickets." Given how well they just paid you, it might be worth going just to build a relationship with the band, even if not for the music itself.`
			choice
				`	"Sure!"`
				`	"Sorry, I've got other things to do."`
					decline
			`	The band is even louder in concert than they were when practicing in the confines of your ship. About thirty minutes into the concert, the energy of the crowd and the surreal lyrics finally begin to soak in, and rather than seeming meaningless their music feels fraught with meaning that hovers just beyond your grasp.`
			`	Finally the band announces that their last song will be "Sad Archie." You've never heard of it, but the fans scream in approval. It's a slow, ballad-like song about a man named Archie who lives forever and is sad because the friends he makes all grow old and die. Archie has a pet dragon, and he builds a beautiful house for the dragon, but the dragon dies young. Archie is so sad seeing the dragon's house empty and gathering dust that he rents it out to some friends, but they fight with each other and trash the place. The story makes no sense, but some of the fans are wiping away tears as the song ends.`
			`	Becca, who is sitting next to you in the VIP section, says, "We learned years ago that we need to end every concert with a sad song. Otherwise the fans leave with way too much energy and start destroying public property."`
			`	The concert ends, and you say goodbye to the band. They say they'll be in touch if they ever need a ride again.`



mission "There Might Be Riots part 2"
	name "Transport band to <planet>"
	description `Give the band "There Might Be Riots" a ride to <destination>.`
	minor
	source
		government Syndicate
	destination "Prime"
	cargo "musical equipment" 4
	passengers 8
	to offer
		has "There Might Be Riots 1: done"
		has "Deep Archaeology 5: done"
		random < 30
	
	on offer
		conversation
			`As you walk through the spaceport, you see a large crowd gathered outside a small pub, and hear the unmistakable music of There Might Be Riots from inside. The concert seems to be just winding down. Do you want to wait around and say hello to them?`
			choice
				`	(Okay.)`
				`	(Not right now.)`
					defer
			`	"<first>!" says Ulrich, when they see you. "What luck! We're doing a concert tonight on landing pad ninety-four, part of our 'Trouble on the Tarmac Tour.' We're going to need a lift to <planet> right after the concert. Or possibly in the middle of it. Can you help us out?"`
			choice
				`	"Okay. But why the hurry to leave?"`
					goto okay
				`	"Sorry, I've got other plans."`
			`	"Please," he says, "I'm serious. You'll be saving our skins. Whatever else you've got, it's not this important."`
			choice
				`	"Okay, I'll do it. Why's it so urgent?"`
				`	"Sorry, I really don't want to work with you guys anymore."`
					decline
			label okay
			`	"You'll see," he says. "You should park your ship right behind us in case the natives get restless and we need to skedaddle."`
			`	With some trepidation, you sit by the hatchway of your ship and watch as the band sets up directly outside it and the concert begins. Nothing seems out of the ordinary until the band introduces a song called "Gluttony," and you can feel a sudden tension fill the air. The Syndicate security guards, who until now have been standing at the periphery of the landing pad, begin to disperse themselves throughout the crowd.`
			`	It's a song about a man who will die if he ever stops eating, so he eats more and more and grows bigger and bigger. A second after you realize that the whole thing is a thinly veiled critique of the Syndicate, a group up front unrolls a banner that reads "End Wage Slavery!" and begins shouting and chanting slogans. As the band plays on, there is some sort of scuffle at the back of the crowd, and then you see stun guns begin to flash, and rising plumes of what you would guess is tear gas.`
			`	As the demonstrators are driven away, a group of guards approach you. "What is your connection to these musicians?" they ask.`
			choice
				`	"I'm just their transport. They're paying me to carry them to their next destination."`
					goto transport
				`	"They're friends of mine. Why? They haven't done anything illegal, that I can see."`
			`	"Be careful what friends you choose," says the guard, "or you might find that no one in this sector will offer you any jobs. Now, get them packed up and get out of here." You have no choice but to leave the planet immediately...`
				launch
			label transport
			`	"Then I suggest you do your job and transport them. Immediately." The guards leave. As soon as the band is packed up, you leave the planet...`
				launch
	
	on complete
		payment
		payment 200000
		conversation
			`As generous as before, the band pays you generously: <payment>. "Where will you be going next, from here?" you ask.`
			`	"Who knows," says Ulrich. "Our music has taken us throughout human space, and beyond."`
			choice
				`	"What do you mean, 'beyond' human space?"`
				`	"Well, I'll look forward to the next time we meet."`
					accept
			`	Ulrich launches into a story. "Years ago when the band was young and we had a month off in between gigs, we found an old grey merchant captain with a glass eye and asked him to transport us to one of the Paradise worlds for an extended 'drug vacation,' if you know what I mean. He said, 'Boys, why don't you leave the drugs behind, and I'll take you on a real mind-altering trip,' and a few days later we were playing a concert on this world where the people were giant squirrels. They loved our music, too. Never did find anyone who could take us back there, though."`
			branch known
				has "First Contact: Hai: offered"
			`	You're tempted to laugh, but he sounds serious. "Well," you say, "if I ever find a planet of intelligent squirrels, I'll be glad to take you guys there." You help them to unload their stuff, and say goodbye for now.`
				accept
			label known
			apply
				set "met hai before TMBR"
			`	"It sounds like you were visiting Hai space," you say, and you describe the aliens who live beyond the wormhole. "Yeah, that would be them," says Ulrich. "I'd love to go back there some time, but for now we have commitments closer to home." You help them to unload their stuff, and say goodbye for now.`
				accept



mission "There Might Be Riots part 3A"
	name "Transport band to <planet>"
	description `Give the band "There Might Be Riots" a ride to <destination>.`
	minor
	source
		attributes "dirt belt" "south" "rim"
	destination "Pilot"
	clearance
	infiltrating
	cargo "musical equipment" 4
	passengers 8
	to offer
		has "There Might Be Riots part 2: done"
		has "First Contact: Hai: offered"
		random < 30
	
	on offer
		conversation
			`As you walk through the spaceport, you see a distinctive group of people lugging a collection of instruments: the band There Might Be Riots. Would you like to see if there is anything more you can do for them?`
			choice
				`	(Yes.)`
				`	(Not right now.)`
					defer
			`	They're very happy to see you. "You always seem to have amazing timing," says Ulrich. "We were just wondering who could transport us to a... gig of sorts... up north, and then you come along. Any chance you could take us to <destination>?"`
			`	You've heard of that planet. "The weapons testing world for Lovelace Labs?" you ask. "I'm surprised you'd be able to find a big audience there."`
			`	"Oh, we'll have an audience, all right," he says. "We've just put out a new album called 'Songs for the End of Civilization.' A war protest album. We want to film ourselves playing a concert right in the middle of the missile testing range. Of course we'll probably end up running out of there with Republic Intelligence nipping at our heels. What do you say?"`
			choice
				`	"Sorry, that's further than I'm willing to go for you guys."`
					goto no
				`	"Sounds like a worthy cause. Count me in!"`
					goto yes
				`	"You're going to do a concert on ground that could be littered with unexploded ordnance?"`
			`	"Yeah. What an adventure!" he says. "Come on, it will be worth it."`
			choice
				`	"Sorry, that's further than I'm willing to go for you guys."`
					goto no
				`	"Sounds like a worthy cause. Count me in!"`
					goto yes
			label no
			`	"Are you sure?" he asks. "We'll pay you with more than just money. Do this for us, and I'll share a story with you that very few have heard."`
			choice
				`	"Sorry, but it's still a 'no.'"`
					decline
				`	"Okay, I'm intrigued. But it still sounds risky."`
			label yes
			branch known
				has "met hai before TMBR"
			`	"Great," he says. "Now, the only question is where we'll go afterwards until the fuss dies down. Say, did you ever find that planet of squirrel people? We'd love to go back there."`
			`	"Yes," you say, "they're called the Hai. They live in a whole big region to the north."`
				goto end
			label known
			`	"Great," he says. "Now, the only question is where we'll go afterwards until the fuss dies down. I was thinking it'd be a great chance for our band to reconnect with the squirrel people - what did you call them?"`
			`	"The Hai," you say.`
			label end
			`	"Excellent," he says. "We go thumb our noses at the military industrial complex, then you take us to stay with the peaceful squirrel people where the government won't bother us."`
			`	Once more, they begin loading their stuff onto your ship, while you chart a course to <destination>.`
				accept



government "Team Red"
	swizzle 0
	"player reputation" -1000
	"attitude toward"
		"Team Blue" -.1

government "Team Blue"
	swizzle 5
	"player reputation" -1000
	"attitude toward"
		"Team Red" -.1

mission "There Might Be Riots part 3B"
	landing
	name "Transport band to <planet>"
	description `Avoid the Navy combat drones and give the band "There Might Be Riots" a ride to <destination>.`
	source "Pilot"
	destination "Allhome"
	cargo "musical equipment" 4
	passengers 8
	to offer
		has "There Might Be Riots part 3A: done"
	
	on offer
		conversation
			`You bring your ship to a gingerly landing in a section of the testing range that doesn't look too pockmarked with craters, and the band begins setting up their equipment and video cameras. "This is great," says Ulrich. "We'll be broadcasting live over the Net. It's time people started asking why the government thinks it needs all these weapons of war."`
			`	The band plays through about a third of their set without any evidence that the locals even know you are here, which is surprising for such a tightly secured planet. Then, right in the middle of a particularly crunchy anti-war song, your long range radar picks up something: a large number of ships approaching from a hundred kilometers away.`
			choice
				`	"Guys, I think we should get out of here."`
				`	"We've got ships incoming. Could be trouble."`
					goto ships
			`	The band stops playing. Ulrich turns to the cameras and says, "For all our fans out there, we'll be back after a brief intermission." Then he walks over to you and says, "What is it?"`
			`	"Ships incoming," you say.`
				goto bad
			label ships
			`	The band stops playing. Ulrich turns to the cameras and says, "For all our fans out there, we'll be back after a brief intermission." Then he walks over to you.`
			label bad
			`	"Did they hail us?" asks Ulrich.`
			`	"No," you say.`
			`	He swears, then shouts to the rest of the band, "Gentlemen, time to pack it up posthaste, before we get turned into a tragic industrial accident!"`
			`	The band has just packed the last of their equipment away when the ships come into view. It's a swarm of unpiloted combat drones, and they seem to be engaged in mock combat with each other. But, their flight path is taking them straight in your direction. You power up your shields just as the first of the drones decide that your ship is a valid target for their lasers...`
				launch
	
	npc
		government "Team Red"
		personality heroic nemesis
		fleet
			variant
				"Combat Drone" 15
	npc
		government "Team Red"
		personality waiting heroic
		fleet
			variant
				"Combat Drone" 20
	npc
		government "Team Blue"
		personality waiting heroic
		fleet
			variant
				"Combat Drone" 35
	
	on complete
		payment 500000
		conversation
			`You drop off There Might Be Riots on Allhome. Ulrich is looking around the spaceport in wide-eyed excitement. "This is it, guys!" he says. "We're back in the land of the peaceful squirrels. Captain <last>, I don't know how to thank you, but here's a start." He hands you <payment>.`
			`	As the rest of the band begins unloading their things, Ulrich adds speaking more quietly, "And, in good minstrel fashion I will pay you not just with money, but with a story.`
			`	"Back when the fame first became too much for me, I rented a shuttlecraft under an assumed name and went tooling around the galaxy just to get away from it all. I found some cloudy star out along the Rim, parked my ship where no one would bother me, shut down everything but life support, and just sat there meditating and enjoying the silence for two or three days.`
			`	"Then suddenly clear as day I heard a voice say, 'Are you okay? Do you need anything?' I was so shocked that without even thinking I said, 'I'm fine. How about you?' And the voice told me he was sad. Sad, because that part of space used to be the home of another species, and now they're all dead. He said we humans built our cities on the graveyards of a great civilization and didn't even know it. And if we didn't stop fighting each other, our species would die off too.`
			`	"That's when the band started to speak out against war."`
			choice
				`	"Do you think the voice was real, or just in your head?"`
				`	"It sounds like a good warning. I'll try to take it to heart."`
					goto end
			`	"It was in my head," he says, "And it was real. Very real. When it spoke I felt like the whole galaxy had just tipped sideways, or like I'd just stepped too close to the edge of a cliff and got vertigo. I've imagined some crazy things, but I tell you, this I did not imagine."`
			`	You wish him the best of luck in Hai space, and he heads off into the spaceport with the rest of the band.`
				accept
			label end
			`	"Then best of luck to you," he says, and he heads off into the spaceport with the rest of the band.`
				accept



ship "Timer Ship"
	attributes
		"hull" 1
		"hull repair rate" .0003
		"mass" 100
		"drag" 5
		"automaton" 1
		"thrust" 10
		"turn" 600
	outfits
		"Timer Weapon"
	gun 0 0

outfit "Timer Weapon"
	category "Guns"
	thumbnail "outfit/unknown"
	"gun ports" -1
	weapon
		"velocity" 10
		"lifetime" 20
		"reload" 100
		"trigger radius" 200
		"blast radius" 20
		"hull damage" .04

mission "Sad Archie"
	landing
	invisible
	to offer
		has "There Might Be Riots part 3B: done"
	destination "Zug"
	
	npc disable
		government "Test Dummy"
		system "Ildaria"
		personality unconstrained heroic nemesis
		ship "Timer Ship" "Timer"
		conversation
			`As your ship drifts through the cloud of dust that surrounds Ildaria, it occurs to you that this must be the "cloudy star out along the Rim" that Ulrich from There Might Be Riots told you about. Remembering his story, you shut your eyes and attempt to meditate. But instead, you just fall asleep.`
			scene "scene/eso0"
			`You dream that you leave this star system and return to Zug, but when you land there everything is different: the cities you remember are gone, and in their place are other cities with strange architecture, populated by gargantuan dragon-like creatures.`
			`	Time speeds up, and you watch as the dragon cities grow and spread out. You see one city buried under a massive lava flow, starships buzzing around it like a cloud of flies to carry people and goods to safety. Other cities are destroyed by war, and then abruptly the dragon-people are all gone and their cities lie vacant. Buildings crumble, and the forests reclaim the land.`
			`	Then you wake up and find yourself back in your ship, in the Ildaria system. Weird.`
	
	on complete
		conversation
			`On a whim, as you're landing on Zug you pull up a geological map of the planet and find that the geography you dreamt of while drifting in the Ildaria system was surprisingly close to the real thing. There's even a massive basalt outcropping right where you saw a lava flow burying a city. There's no way your ship's sensors can tell what's underneath it, though.`



mission "Rim Archaeology 1"
	landing
	name "Archaeology on <planet>"
	description "Bring the famous archaeologist Albert Foster to <destination> to look for signs of an ancient alien civilization."
	source "Vinci"
	destination "Zug"
	passengers 1
	to offer
		has "Sad Archie: done"
	
	on offer
		conversation
			`This planet is where the archaeologist Albert Foster has his lab, the one who sent you on a mission to collect samples from a planet in the Deep. Would you like to try to convince him to look for signs of an ancient alien civilization in the Rim systems?`
			choice
				`	(Of course!)`
				`	(Not right now.)`
					defer
			`Foster seems glad to see you. You do your best to pique his interest without saying anything that will make him think you're crazy, but he's clearly not buying it. "I'm sorry," he says, "but I'm not mounting an expedition just because you have a 'hunch.' So unless you're willing to tell me the source of your information, I'm not interested." He turns his attention back to the data pad that he was reading before you walked into his office.`
			choice
				`	"I'd rather not say."`
				`	"I had this dream about dragon-people on Zug."`
					goto dream
				`	"I think a telepathic space alien spoke to me."`
					goto telepath
			`	"Then I'd rather not help you," he says, without looking up from the data pad.`
			choice
				`	"I had this dream about dragon-people on Zug."`
				`	"I think a telepathic space alien spoke to me."`
					goto telepath
			label dream
			`	"You had a dream," he says. "Sorry, no. Oneirological archaeology is notoriously unreliable." From his tone of voice, you think he's being sarcastic.`
			choice
				`	"I think a telepathic space alien spoke to me."`
					goto telepath
			label telepath
			`	You expect him to laugh at you, but instead he's so shocked that he drops the data pad he's holding. "An Archon?" he says. "How the hell did you get tangled up with one of those?" You tell him the story, and he listens intently.`
			`	"It's feasible," he says. "We've heard rumors from the Quarg that an alien civilization used to exist in the Rim, a hundred thousand years ago. No signs of it, of course - any artifacts they left behind have been destroyed by the elements, or perhaps intentionally removed. But if a city were encased in lava, that could preserve signs of it even over such a long time frame."`
			`	Foster makes a few phone calls to cancel his upcoming plans, and then shows up at your ship with a large collection of geological surveying tools. "Let's go check it out," he says.`
				accept
	
	on complete
		conversation
			`You land your ship on the lava flow, and Albert Foster fires up his surveying equipment. "This will show me a density profile of different layers of rock beneath us," he says. As he gradually dials the instrument down to deeper and deeper layers, a few irregular white spots appear on the screen.`
			choice
				`	"What are those?"`
				`	(Be quiet and let him focus.)`
					goto scan
			`	"Air pockets," he says, "some of them filled in with ground water. Nothing out of the ordinary."`
			label scan
			`	When the scan reaches about thirty meters below the surface, suddenly the view changes...`
			scene "scene/geoscan"
			`	"Great burning suns!" says Foster. "There is something down there! Roads in a triangular grid. That ain't no human city." You both stare at the monitor for a minute, then Foster says, "I'm going to need to pull some permits. Meet me in the spaceport in an hour if you're willing to help pick up some of the other stuff we'll need."`



mission "Rim Archaeology 2A"
	name "Archaeological Equipment"
	description "Fetch some excavation equipment from <destination>, and return with it to the dig site on Zug."
	source "Zug"
	destination "Crossroads"
	to offer
		has "Rim Archaeology 1: done"
	
	on offer
		conversation
			`When you meet up with Foster, he tells you, "This is going to be tricky. We're going to have to dig through a twenty meter thick slab of solid basalt to get at those ruins. We have to work fast, or my competitors will catch wind of what we're doing and beat us to the punch. But we have to work delicately, too, or we'll damage what's underneath. Blasting won't work. I think some of the Syndicate's strip mining equipment could do the job, though. Would you be able to pick up maybe twenty or thirty tons of heavy machinery from <planet>?"`
			choice
				`	"Sure."`
					accept
				`	"Sorry, I don't have time to help out anymore."`
			`	He seems incredulous. "No time to participate in what could be one of the biggest discoveries of the last hundred years? You'll be well paid for your services too, if that's what's holding you back."`
			choice
				`	"Okay, I'll pick up your equipment from <planet>."`
					accept
				`	"Sorry, I'm just not interested."`
					decline



mission "Rim Archaeology 2B"
	landing
	name "Archaeological Equipment"
	description "Deliver this excavation equipment to <destination>."
	source "Crossroads"
	destination "Zug"
	cargo "Excavation equipment" 28
	to offer
		has "Rim Archaeology 2A: done"
	blocked "You do not have enough cargo space to carry the equipment for Albert Foster's archaeological dig. Return here when you have at least 28 tons of space free."
	
	on offer
		conversation
			`When you arrive on <origin>, the excavation machines requested by Albert Foster are already waiting for you at the spaceport. They are some of the largest terrestrial vehicles you have ever seen: a truck with enormous toothed grinding wheels for cutting through stone, and a front-end loader for carrying the loose stone away. You are barely able to fit them through the entrance of your cargo bay.`
				accept
	
	on complete
		payment 300000



mission "Rim Archaeology 3A"
	landing
	name "Archaeological Equipment"
	description "Fetch some excavation equipment from <destination>, and return with it to the dig site on Zug."
	source "Zug"
	destination "Asgard"
	to offer
		has "Rim Archaeology 2B: done"
	
	on offer
		conversation
			`You drop off the excavation machines at the dig site on Zug, and receive your payment of three hundred thousand credits. Foster has already marked out lines of where he wants to dig and has completed a much more detailed geological scan. "We'll be starting with a narrow trench," he tells you, "and expanding out from there. It'll need to be wide enough to include a ramp for the vehicles, of course, so we'll still need to move a lot of rock. And when we get within the last five meters or so, I'm worried that the vibration from the grinders may be too destructive. So, I need some laser excavation equipment from <planet>, next."`
			`	You agree to fetch the equipment, and he begins directing the work crews to get the digging started.`
				accept



mission "Rim Archaeology 3B"
	landing
	name "Archaeological Equipment"
	description `Deliver this excavation equipment to <destination>. Be sure that the ship "Oxyrhynchus" is not in the system when you land.`
	source "Asgard"
	destination "Zug"
	cargo "Laser excavation equipment" 17
	to offer
		has "Rim Archaeology 3A: done"
	blocked "You do not have enough cargo space to carry the equipment for Albert Foster's archaeological dig. Return here when you have at least 17 tons of space free."
	
	on offer
		conversation
			`Once again, the equipment that Foster needs is waiting for you when you land. It's a truck carrying a power generator and an articulated arm with a laser cannon mounted on the end. You can't help imagining what would happen if it malfunctioned and began firing while inside your cargo bay, but the engineer who delivers it assures you that it has many redundant safeties in place.`
			`	Also waiting for you is an encrypted message from Foster: "Hi there, <first>. I've been told that one of my competitors, Sibyl Greythatch, has been asking around trying to figure out where my dig site is. She's an antiquities thief - robs archaeological sites and sells the artifacts on the black market. I think my equipment purchase on <origin> may have caught her attention. If so, her ship, the Oxyrhynchus, will be following you. Don't return to the dig site until you're certain you've shaken her."`
				accept
	
	npc evade
		government Independent
		personality waiting
		ship "Marauder Falcon (Engines)" "Oxyrhynchus"
	
	on visit
		dialog
			`As you are approaching Zug, you notice on your radar that the ship Foster warned you about has been following you: the Oxyrhynchus. You land in the main spaceport to avoid leading her to the dig site. You will need to shake her pursuit before delivering the equipment.`
	
	on complete
		payment 300000



mission "Rim Archaeology 4A"
	landing
	name "Transport a Xenobiologist"
	description "Travel to the Quarg station <destination>, and meet a xenobiologist who will help interpret the findings at Albert Foster's dig site."
	source "Zug"
	destination "Lagrange"
	to offer
		has "Rim Archaeology 3B: done"
	
	on offer
		conversation
			`When you return to the dig, Foster's trench is already almost ten meters deep. You tell him that you saw the Oxyrhynchus on your scanners, but you were able to evade it. "Good job," he says. "Now, we need a xenobiologist who can help us make sense of what we find. A friend of mine, Amelia Lee, has been living on the Quarg ringworld for the last decade or so, and she agreed to come visit the dig, and also to see what the Quarg can tell us about this old alien civilization. Also, here's your pay for transporting the laser cutter." He hands you another three hundred thousand credits.`
			`	You agree to pick her up, and he returns to supervising the excavation.`
				accept



mission "Rim Archaeology 4B"
	landing
	name "Transport a Xenobiologist"
	description `Transport the xenobiologist Amelia Lee and her Quarg friend Yarthis to the dig site on Zug.`
	source "Lagrange"
	destination "Zug"
	passengers 2
	to offer
		has "Rim Archaeology 4A: done"
	blocked "You will need two bunks free to transport the xenobiologist that Albert Foster asked you to fetch. Return here when you have space available."
	
	on offer
		conversation
			`Amelia Lee meets you at the spaceport, along with a Quarg who is a bit shorter than normal, but still tall enough to tower over you. "Captain <last>?" she says. "Let me introduce my friend Yarthis Amorthee Dek-Farsook Nai," she says. "Yarthis will be accompanying us to the site."`
			choice
				`	"No problem. Welcome aboard!"`
					goto welcome
				`	"Do we really need to get the Quarg involved directly in this?"`
			`	To your human eyes, unused to reading their expressions, the Quarg almost always seem grim and serious. But Yarthis seems particularly grave as it says, "You are digging in a graveyard, Captain. Someone must be present to see that the dead are given their due respect."`
			label welcome
			`	As both of them board your ship, Amelia chats enthusiastically with you. "One ringworld can sustain a population in excess of a trillion," she says, "so the Quarg need long names in order to unambiguously identify themselves." She goes on to ask questions about the progress of the dig, using so much technical jargon that at times it almost sounds like she is speaking the Quarg language rather than your own. Clearly she is very knowledgeable about the study of alien societies, and you are surprised to learn that she was actually born in Hai space, as the granddaughter of some of the first humans who settled there.`
				accept
	
	npc
		government Merchant
		personality waiting
		system Dabih
		ship "Marauder Arrow (Engines)" "Naukratis"
	
	on complete
		payment 200000



mission "Rim Archaeology 5A"
	landing
	name "Defend Zug"
	description "Drive off the pirates who are attacking Zug, or at least distract them for long enough for reinforcements to arrive."
	source "Zug"
	to offer
		has "Rim Archaeology 4B: done"
	
	on offer
		conversation
			`Foster greets Amelia enthusiastically when you land, but seems less enthusiastic about having Yarthis here as well. The dig has nearly reached the target depth, and at the deepest part of the trench they are now slicing out blocks of stone with the laser and hoisting them out of the pit rather than just grinding through the rock. "Thanks again, Captain," he says, as he hands you a chip worth two hundred thousand credits.`
			`	As Foster is showing the three of you around the dig, one of the workers runs up. "Mister Foster," he says, "there's a ton of traffic on the emergency militia channel. I think the planet is under attack."`
			`	Foster swears and looks up at the sky as if expecting pirates to swoop down and steal his precious artifacts at any moment. "Captain <last>," he says, "We have to keep those pirates away from the dig at all costs, or they could destroy priceless information. Can you assist in defending the planet?"`
			choice
				`	"Of course."`
					goto end
				`	"My ship is not a warship."`
			`	"Then just get up there and lead them around in circles until reinforcements arrive," he says. "I don't care how you do it, just keep whoever is up there occupied."`
			label end
			`	As you run for your ship, you see Yarthis pull out some sort of communication device and speak into it. Perhaps the Quarg will be joining in this fight as well...`
				launch
	
	npc evade
		government Pirate
		personality heroic waiting
		ship "Marauder Falcon (Weapons)" "Akhetaten"
		ship "Marauder Splinter (Weapons)" "Itjtawy"
		ship "Marauder Firebird (Weapons)" "Tanis"
		ship "Marauder Leviathan (Weapons)" "Buhen"
		ship "Marauder Manta (Weapons)" "Athribis"
		ship "Marauder Quicksilver (Weapons)" "Philae"
		ship "Marauder Raven (Weapons)" "Esna"
		dialog `The last of the pirate raiders have been driven off. Time to land and check if any damage was done to the dig.`
	
	npc
		government Quarg
		system "Gamma Corvi"
		personality heroic
		ship "Quarg Wardragon" "Gloref Esa Kurayi"
	
	on visit
		dialog
			`You try to land near the dig, but pirate ships are still circling nearby. Better deal with them before returning to check in on Foster.`
	
	on complete
		payment 400000
		event "rim archaeology results" 97
		conversation
			`A plume of smoke is rising from the dig site. Fearing the worst, you land and find out that a missile fired by one of the pirates destroyed one of the huts where the workers were living, but fortunately no one was inside it at the time. Foster is shaken but still committed to finishing the work. "It will be months before we've excavated enough to be able to publish any findings," he says, "but Yarthis has told me that the Quarg will be stationing a Wardragon here for the remainder of the project, to prevent any further foul play." Foster gives you one last payment: four hundred thousand credits for your help driving off the pirates. "And I'll be sure to give you credit for your help when the news goes public," he says.`



mission "Rim Archaeology 5B"
	landing
	invisible
	source Zug
	to offer
		has "Rim Archaeology 5A: done"
	npc kill
		government Quarg
		personality heroic staying uninterested
		ship "Quarg Wardragon" "Gloref Esa Kurayi"



event "rim archaeology results"
	planet Zug
		attributes rim farming factory tourism
		description `Zug is a pleasant world of rolling hills, fertile fields, and a few small oceans. Hundreds of millions of people live here, with more immigrants arriving every day, almost faster than the construction industry can keep up with them. In addition to the larger cities, many people live in smaller farming villages, making this one of the few worlds in the region that is truly self-sufficient both in industry and in agriculture.`
		description `	The largest industry on Zug is Southbound Shipyards. However, in the wake of some extraordinary archaeological discoveries of a lost civilization, Zug has suddenly also become a popular destination for tourists.`



mission "Rim Archaeology 6"
	landing
	source
		government "Republic" "Free Worlds" "Syndicate" "Independent" "Neutral"
	to offer
		has "event: rim archaeology results"
	on offer
		log "Factions" "Sheragi" `Recent archaeological discoveries on Zug, a planet in the southern rim of human space, have turned up evidence of a lost alien civilization. The Quarg say that the ruins were left behind by a species called the Sheragi.`
		conversation
			`When you give your name to the spaceport traffic controller, he says, "Wait, you're Captain <first> <last>? You're all over the news right now!"`
			`	You land and find that Albert Foster has published an initial report on the dig on Zug. The ruins under the lava flow did indeed turn out to be an alien city. The houses are built on a gargantuan scale, with most of the doorways at least ten meters tall. What's more, some of the buildings have no exterior doors on the street level, just doors facing balconies or inner courtyards, which supports the theory that the inhabitants were capable of flight. Most of the artifacts left behind are just everyday items, and in fact the technology seems less advanced than present human society, but scientists are studying the artifacts eagerly to glean hints about how these aliens lived.`
			`	The Quarg, who at other times seem quite willing to share their knowledge with human beings, are being surprisingly reticent with information about this lost civilization. Aside from telling Foster that the aliens were known as the Sheragi, their only comments have been vague warnings that if human beings persist in developing weapons of war, they will end up like the Sheragi. From this, Foster has surmised that the alien civilization was most likely destroyed by a civil war, not by natural disaster or an attack by another species.`
			`	It may not yield any great advances in human technology, but the dig will be providing clues to the history of the galaxy for years to come, and you can be proud to have played a part in that.`
				decline



mission "Drug Running 1"
	name "Drug Running"
	description "Bring a shipment of illegal drugs to <destination>. If you are caught with this cargo, you may be fined."
	minor
	repeat
	source
		attributes "near earth" "dirt belt" "north"
	destination
		attributes paradise
		distance 1 100
	cargo "illegal drugs" 5 2 .1
		illegal 40000
	to offer
		random < 10
		"said no to drugs" < 4
	
	on offer
		dialog `As you are walking through the spaceport, a man pulls you aside and asks if you would like to help transport some "recreational pharmaceuticals" to <planet>. (This sounds like an illegal mission, so you'll need to avoid getting scanned or landing on planets with high security.)`
	
	on accept
		"said no to drugs" --
	on decline
		"said no to drugs" ++
	
	on complete
		payment
		payment 80000
		dialog `Some disreputable-looking locals unload the illegal drugs from your cargo bay, and hand you your payment of <payment>.`



mission "Drug Running 2"
	name "Drug Running"
	description "Bring a shipment of illegal drugs to <destination>. If you are caught with this cargo, you may be fined."
	minor
	repeat
	source
		attributes "near earth" "dirt belt" "north"
	destination
		attributes rich
		distance 1 100
	cargo "illegal drugs" 5 2 .1
		illegal 50000
	to offer
		random < 10
		has "Drug Running 1: done"
	
	on offer
		dialog `When you walk into the local bar, a man sitting in the corner waves you over and says in a hushed voice, "Captain, we've got a shipment of the good stuff that needs to get to <planet>. I promise you this will be a very lucrative operation. What do you say?"`
	
	on complete
		payment
		payment 100000
		dialog `Immediately after you land, some workers show up to unload the "stuff." They give you <payment>.`



mission "Drug Running 3"
	name "Drug Running"
	description "Bring a shipment of illegal drugs to <destination>. If you are caught with this cargo, you may be fined."
	minor
	repeat
	source
		attributes "near earth" "dirt belt" "north"
	destination
		attributes urban
		distance 1 100
	cargo "illegal drugs" 5 2 .1
		illegal 70000
	to offer
		random < 10
		has "Drug Running 2: done"
	
	on offer
		dialog `A well-dressed woman approaches you as you are walking through the spaceport and asks quietly if you would be willing to help facilitate the transport of some "naughty substances" to a certain individual on <planet>.`
	
	on complete
		payment
		payment 120000
		dialog `You hand off the illegal "substances" to your contact on <planet>, who pays you <payment>.`



government "Bad Trip"
	swizzle 0
	"player reputation" -1000

effect "puff"
	sprite "effect/puff"
		"no repeat"
		"frame rate" 10
	"lifetime" 20
	"random angle" 360
	"velocity scale" -.005

outfit "Imaginary Weapon"
	category "Missiles"
	"gun ports" -1
	weapon
		sprite "projectile/rainbow"
			"frame rate" 12
			"random start frame"
		"hit effect" "puff"
		"die effect" "puff"
		"inaccuracy" 20
		"velocity" 12
		"lifetime" 60
		"reload" 10
		"acceleration" 1.2
		"drag" .1
		"turn" 3
		"homing" 4

ship "Hallucination"
	sprite "ship/hallucination"
		"frame rate" 1
		"random start frame"
	"never disabled"
	attributes
		"hull" 1000
		"mass" 180
		"drag" 2.1
		"heat dissipation" .7
		"fuel capacity" 100000
		"jump fuel" 100
		"jump speed" 1
		"jump drive" 1
		"thrust" 30
		"turn" 500
		"energy generation" 1
	outfits
		"Imaginary Weapon" 1
	gun 0 0

mission "Hallucination"
	invisible
	landing
	to offer
		has "Drug Running 2: active"
		random < 50
	
	on offer
		conversation
			`During your brief stop on <origin>, it occurs to you that it really is a shame to have a cargo hold full of the finest of illegal drugs, and not to take even a small sample for yourself. There is no way the loss of a tiny bit of drugs could be noticed. Give it a try?`
			choice
				`	(No, I never touch that stuff.)`
					defer
				`	(Sure, sounds like fun!)`
			`	The room begins to spin, and strange things happen...`
				launch
	
	npc kill
		government "Bad Trip"
		personality nemesis heroic
		ship "Hallucination" "Love"
		ship "Hallucination" "Peace"
		ship "Hallucination" "Happy"
		ship "Hallucination" "Shiny"



mission "Rescue Miners 1"
	description "Participate in the medical evacuation of some miners injured in a recent accident on <planet>."
	name "Rescue Miners"
	minor
	source
		attributes core
		attributes urban
	destination
		attributes core
		attributes mining
	passengers 15
	cargo "emergency supplies" 15
	to offer
		random < 60
	
	on offer
		dialog `You've just sat down in the spaceport bar and ordered a drink when someone in uniform runs into the room and shouts, "There's been a mine explosion on <planet>! We need all available ships to carry relief workers and supplies and to evacuate the injured to a world where there are better medical facilities." Do you volunteer?`



mission "Rescue Miners 2"
	landing
	description "Participate in the medical evacuation of some miners injured in a recent accident on <origin>."
	name "Rescue Miners"
	minor
	destination
		attributes core
		attributes urban
		distance 2 10
	passengers 15
	to offer
		has "Rescue Miners 1: done"
	
	on offer
		dialog `You drop off the medical personnel on <origin>. There are nearly a hundred injured miners waiting for medical evacuation to <planet>. Do you volunteer to carry some of them?`
	
	on complete
		payment 80000
		dialog `You drop off the injured miners at one of the medical facilities on <planet> that has agreed to care for the survivors. It's a somewhat chaotic process, but eventually someone thanks you for your help and pays you <payment>.`



mission "Courier 1"
	name "Rush delivery to <planet>"
	repeat
	deadline
	description "Deliver <cargo> to <destination> by <date>. Payment is <payment>."
	minor
	cargo random 5 2 .1
	to offer
		random < 5
	source
		government "Republic" "Free Worlds" "Syndicate" "Quarg" "Neutral"
	destination
		distance 4 10
		government "Republic" "Free Worlds" "Syndicate" "Quarg" "Neutral"
	on offer
		dialog `As you are walking through the spaceport, a man approaches you and says, "Excuse me, Captain. I took on a rush delivery to <planet>, but my ship needs repairs and there's no way I can make it there before <day>. Can you take this job for me?"`
	on complete
		payment
		payment 30000
		dialog "You drop off your cargo of <commodity> and collect your payment of <payment>."



mission "Courier 2"
	name "Package to <planet>"
	repeat
	deadline
	description "Deliver a package to <destination> by <date>. Payment is <payment>."
	minor
	cargo package 2
	to offer
		random < 5
	source
		government "Republic" "Free Worlds" "Syndicate" "Quarg" "Neutral"
	destination
		distance 7 14
		government "Republic" "Free Worlds" "Syndicate" "Quarg" "Neutral"
	on offer
		dialog `A woman in the spaceport flags you down and asks, "Excuse me, Captain. I have small package that needs to get to <planet> by <day>. Can you carry it for me?"`
	on complete
		payment
		payment 50000
		dialog "You drop off the package and collect your payment of <payment>."



mission "Courier 3"
	name "Papers to <planet>"
	deadline
	description "Deliver some legal papers to <destination> by <date>. Payment is <payment>."
	minor
	cargo "legal papers" 1
	to offer
		random < 5
	source
		government "Republic" "Free Worlds" "Syndicate" "Quarg" "Neutral"
	destination
		distance 7 14
		government "Republic" "Free Worlds" "Syndicate" "Quarg" "Neutral"
	on offer
		dialog `A woman in a suit walks up to you and says, "Pardon me, Captain. I represent a recently deceased client here on <origin> whose legal papers need to be delivered to his next of kin on <destination>. Would you be willing to do some courier work? The papers must be delivered by <day>."`
	on complete
		payment 100000
		dialog "You drop off the legal papers and collect your payment of <payment>."



mission "Courier 4"
	name "Lizard to <planet>"
	deadline
	description "Deliver an exotic pet to <destination> by <date>. Payment is <payment>."
	minor
	cargo "exotic lizard" 3
	to offer
		random < 5
	source
		government "Republic" "Free Worlds" "Syndicate" "Quarg" "Neutral"
	destination
		distance 7 14
		government "Republic" "Free Worlds" "Syndicate" "Quarg" "Neutral"
		attributes rich
	on offer
		conversation
			`A man wearing a very complicated hat waves to you from the other side of a landing pad. "Yoo-hoo, Captain!" he says. "I have a courier mission for you if you're interested."`
			choice
				`	(Find out what he wants.)`
				`	(Ignore him.)`
					decline
			`	"My name is Alphonse," he says. "I am a breeder of exotic lizards. A new client on <planet> has just ordered one, and will pay you quite handsomely to transport it. Naturally, being a live animal, it's a rush delivery; it needs to be done by <day>. What do you say?"`
			choice
				`	"I'd be glad to."`
				`	"Sorry, I'm not interested in that sort of work."`
					decline
			`	"Excellent!" he says. "Come, let me introduce you to your cargo." He leads you to a supply shed where an enormous lizard, taller than you and probably weighing several tons, is being held in a cage that looks far too flimsy for it. "I'll have my men load her aboard your ship at once," says the man, "along with some meat for her to eat on the journey. Watch out for your fingers when you feed her, by the way. Thank you!"`
				accept
	
	on complete
		payment
		payment 100000
		dialog `Somehow, you have managed to bring the large lizard to <planet> without it breaking loose and eating you. You unload it and wait for its new owner to come. When he does, he pays you <payment>.`



mission "Migrant Workers 1"
	name "Migrant Workers"
	description "Bring this group of migrant workers to <planet>."
	minor
	passengers 6 7
	source
		attributes "dirt belt"
		attributes "farming"
	destination Rand
	to offer
		random < 5
	
	on offer
		conversation
			`In the spaceport, you can't help but notice a group of six or seven men in ragged farm clothing, sitting by the edge of one of the launch pads. They are probably migrant workers looking for a lift.`
			choice
				`	(Approach them.)`
				`	(Ignore them.)`
					defer
			`	You strike up a conversation with the workers. They say that they are tired of the seasonal fluctuations of farm work, and are looking for something a bit steadier and better paying. "We hear there's always work to be had in the mines on <planet>," they say. "Can you take us there?"`
			choice
				`	"Sure!"`
					accept
				`	"No, sorry, I'm not headed in that direction."`
					decline
	
	on complete
		payment
		payment 20000
		dialog `The migrant workers thank you for transporting them, and hand you <payment>. You hope that they will be able to find better work here than they had on <origin>.`



mission "Humanitarian 1"
	name "Vaccine to <planet>"
	description "Bring a shipment of flu vaccines to the lawless world of <planet>. Be sure the medicine gets into the right hands."
	minor
	cargo "vaccine" 20
	to offer
		random < 5
		"combat rating" > 0
	source
		government "Republic" "Free Worlds" "Syndicate" "Quarg" "Neutral"
	destination
		government "Pirate"
		distance 2 10
	clearance
	
	on offer
		conversation
			`While you are sitting at a table in a local cafe, a woman sits down across from you and says, "Pardon me, Captain. I wonder if you would be interested in helping with a humanitarian mission."`
			choice
				`	"Tell me more."`
				`	"Sorry, I'm too busy."`
					decline
			`	"There's a flu epidemic on <planet>," she says. "It's a lawless world, so they have not been able to find any merchants willing to bring them medicine. But if they don't get a shipment of vaccine soon, the epidemic could become much worse, and even spread to other worlds."`
			choice
				`	"I'd be glad to help."`
				`	"Sorry, I don't believe in helping pirates."`
					decline
			`	"Thank you," she says. "Your contact on <planet> will be a man named 'Raven Hunter.' Don't let anyone but him trick you into giving them the supplies."`
				accept
	
	on complete
		payment
		payment 50000
		dialog
			 `After several shady characters have offered to buy the vaccines off you, or threatened to rob you, "Raven Hunter" finally shows up and collects them. He thanks you, and pays you <payment>.`



mission "Humanitarian 2"
	name "Food to <planet>"
	description "Bring a shipment of food to the lawless world of <planet>, to help alleviate a famine."
	minor
	cargo "emergency rations" 50
	to offer
		random < 5
		"combat rating" > 0
	source
		government "Republic" "Free Worlds" "Syndicate" "Quarg" "Neutral"
	destination
		government "Pirate"
		distance 2 10
	clearance
	
	on offer
		conversation
			`As you are walking through the local market, a man says, "Captain, do you have room in your hold to bring food to a starving planet?"`
			choice
				`	"Yes, but I hadn't heard news of a famine recently."`
				`	"Sorry, not today."`
					decline
			`	"No, this one wouldn't be in the news," he says. "It's <planet>, a lawless world. They're desperately in need of food, although it's mostly due to corruption and mismanagement of resources."`
			choice
				`	"Well, it sounds like they're getting exactly what they deserve. And, I have no intention of risking my life to land on a pirate world."`
					decline
				`	"Well, even so, no one deserves to starve to death. I'll help them."`
			`	"Thank you," he says. "We'll load the food into your cargo hold immediately. The sooner you can drop it off on <planet>, the better."`
				accept
	
	on complete
		payment
		payment 50000
		dialog
			 `It takes a while to figure out who exactly is in charge here. You sell off parts of your shipment of food to a few different local leaders, receiving <payment> in exchange.`



mission "Terraforming 1"
	name "Terraforming Rand"
	description "Bring a delegation from Rand to the Academy of Planetary Sciences on Glory."
	minor
	source Rand
	destination Glory
	passengers 2
	
	on offer
		conversation
			`You stop in to the spaceport bar for a drink. The bar seems to be frequented mostly by the managers of the mining corporation; you suspect the workers don't earn enough to visit a bar very frequently. In one corner, two of the managers are having a very animated discussion. When they see you, they say, "Hello there, Captain! Interested in taking us on a business trip?"`
			choice
				`	"What sort of trip?"`
				`	"Sorry, I'm just in here for the drinks."`
					defer
			`	"To Glory, to the Academy of Planetary Sciences," he says. "This world is rich in resources, and we're thinking that if we could only cool down the deserts a bit and get more plants to grow here, it would be a decent place to live. We've been dreaming about this for years, and I think it's time to go pay a terraforming consultant to tell us whether it's actually possible or not."`
			choice
				`	"Sure, I'd be glad to take you there."`
					accept
				`	"Sorry, that's way too far away for me to travel right now."`
					decline



mission "Terraforming 2"
	landing
	name "Terraforming Rand"
	description "Return to Rand with a student who thinks she can terraform the planet cheaply."
	source Glory
	destination Rand
	passengers 2
	to offer
		has "Terraforming 1: done"
	
	on offer
		conversation
			`You drop off the two managers from Rand, whose names are Eric and Alaric, at the Academy. While you wait for their meeting to end, you look around the lobby. The students have apparently just had some sort of science symposium, and poster boards are on display all along the walls. One of them catches your eye: the title is "Affordable Terraforming through Equilibrium Mapping."`
			`	The basic concept of the poster seems to be that instead of altering the climate of a planet through brute force, it ought to instead be feasible to use a properly timed nudge in the right direction to cause the climate to shift toward a new equilibrium point that supports greater biological complexity. This student seems to think that planets naturally "want" to grow more complex and support more life, but that they sometimes get "stuck" in less optimum states.`
			`	It's an intriguing idea. On the other hand, at the bottom of the paper, the professor has written, "Very poor scholarship. Do not anthropomorphize planets."`
			`	Just then, Eric and Alaric return, looking disappointed.`
			choice
				`	"No luck?"`
			`	They shake their heads. "It would cost fifteen million just to bring a specialist out for an initial consultation," says Eric, "and besides, the cost of terraforming machinery and upkeep is prohibitive. I think this whole Academy is just a money-making racket."`
			choice
				`	"Have a look at this poster. Maybe this student would help us. We could bill it as a sort of internship for her."`
				`	"Indeed. They gave this student a failing grade just for suggesting it could be done more cheaply."`
			
			`	They look at the poster. "Sounds almost too good to be true," says Alaric. "Hang on, I'll look her up in the campus directory." A few minutes later, he is on the phone with the student who made the poster. Her name is Amy. It turns out she is about to flunk out anyway, and is more than willing to travel back to Rand with you when offered a tiny fraction of what the consultant would have received.`
			`	An hour later, you meet up with Amy, and arrange for her to join you on your ship before it takes off. Eric and Alaric are very excited, but you are a bit worried about the wisdom of entrusting their planet's future to someone so young and inexperienced.`
				accept
	
	on complete
		payment 140000
		dialog `On the entire return journey, Eric and Alaric have been busy showing Amy geological survey maps of Rand and asking her for ideas. The moment you land, they hurry out of the ship. "I'm going to show Amy around," says Eric, "but meet us in the spaceport bar later if you want to help out with whatever we do next." Alaric hands you <payment> as payment for your services, and then follows after them.`



mission "Terraforming 3"
	name "Terraforming Rand"
	description "Plant a thruster on an asteroid to guide it into a collision with the northern pole of Rand."
	blocked "You'll need more cargo space in order to take the next mission from Eric and Alaric. Return here when you have at least <capacity>."
	cargo "thruster equipment" 10
	source Rand
	to offer
		has "Terraforming 2: done"
	
	on offer
		conversation
			`Alaric, Eric, and Amy are having a heated conversation at a table in the bar. When they see you, Alaric says, "Okay, let's let Captain <last> be the tie breaker." He motions to you to join them.`
			`	Amy explains, "Based on my data, it appears that Rand once had a cooler, more moist climate. But the trouble is, it has almost no axial tilt."`
			`	"That means no changing seasons," explains Eric.`
			`	"The result is that much of the planet is very hot, but the poles are very cold. Nearly all the planet's water has migrated to the poles and ended up frozen into the ice caps. Because the weather is so unchanging here, nothing ever prompts that water to melt and rejoin the hydrological cycle."`
			choice
				`	"Well, that seems impossible to fix. It's not like you can rotate a planet's axis."`
					goto rotate
				`	"Are you suggesting melting the ice caps somehow?"`
					goto melting
			label rotate
			`	"Of course not," she says. But what we can do is introduce a sudden variation in the planet's climate that will allow water to be distributed more evenly across the surface again."`
				goto danger
			label melting
			`	"That would be the traditional terraforming approach," she says, "using orbital mirrors, or geothermal power, or something similar to evaporate the ice caps at a faster rate than new ice is being deposited. That approach would take a century or so."`
				goto danger
			label danger
			`	"This is where Amy's plan gets a bit scary," says Alaric.`
			`	"I'm proposing crashing a medium-sized asteroid into the ice cap," she says. "If we pick the right asteroid, we can control the amount of dust that is created. The result will be a sudden influx of variability, that may allow the planet to revert to a wetter, more biodiverse state."`
			choice
				`	"That is a stupid idea, and I want nothing to do with it."`
					decline
				`	"Well, if you think it will work, I'm willing to try it!"`
			`	"Great!" says Amy. "I'll mark the asteroid on your radar. You just need to board it, install a small ion thruster, and return here."`
			`	Eric contacts some spaceport workers and has them load a small thruster onto your ship, along with the equipment you will need to mount it on the asteroid.`
				accept
	
	npc assist
		government Uninhabited
		personality derelict fleeing uninterested waiting pacifist mute
		ship Asteroid
			name "Target Asteroid"
			sprite "asteroid/medium rock/spin"
				"frame rate" 10
			attributes
				"hull" 10000
				"mass" 1000
				"drag" 10
				"heat dissipation" .1
				"required crew" 0
				"automaton" 1
				"bunks" 0
				"thrust" 10
				"turn" 100
				"thrusting energy" 1
				"turning energy" 1
				"energy generation" 3
			explode "small explosion" 25
			explode "medium explosion" 35
			explode "large explosion" 45
			explode "huge explosion" 30
	
	on complete
		payment 20000
		dialog
			`When you land, the sky already seems noticeably darker than before. Eric runs up to your ship. "You did it!" he says, excited. "A perfect hit. Now we just have to wait and see what the results are. Meet us in the spaceport bar again in a few hours, and Amy will have her initial measurements ready." He hands you a credit chip for <payment>.`



mission "Terraforming 4"
	name "Terraforming Rand"
	description "Collect some hardy plants that can grow in a low-light environment from <destination>."
	source Rand
	destination "New Portland"
	to offer
		has "Terraforming 3: done"
	passengers 1
	
	on offer
		conversation
			`By the time you meet up with Eric, Alaric, and Amy, the cloud cover already seems to have visibly increased. Amy is very enthusiastic. "Atmospheric water vapor is on the rise," she says. "The impact vaporized enough ice to form a small ocean. I wouldn't be surprised if we get a rainstorm here in a day or two."`
			`	"What's next?" you ask.`
			`	She says, "I'd like to travel with you to <planet>, and collect some seeds and cuttings from plants that can handle a cooler world with dimmer light, since that's what we'll have here until the dust settles down. I'd say we'll need about ten tons of cargo space."`
			choice
				`	"I'd be glad to take you there."`
					accept
				`	"Sorry, I need to move on to some other work now."`
					decline
	
	on complete
		dialog `As soon as you land, Amy heads off to meet with some local biologists who she contacted during the trip over here. "We'll be back in the spaceport in two hours," she says. "Be sure to have ten tons of cargo space free."`



mission "Terraforming 5"
	name "Terraforming Rand"
	description "Bring some hardy plants that can grow in a low-light environment back to <destination>."
	source "New Portland"
	destination Rand
	to offer
		has "Terraforming 4: done"
	passengers 1
	cargo "seeds and plants" 10
	
	on offer
		conversation
			`You meet up with Amy, and load the seeds and plant cuttings onto your ship.`
			choice
				`	"Looks good, let's head back to Rand."`
					accept
				`	"So, how do you plan to seed the whole planet with these, anyway?"`
			`	She says, "My idea is to just disperse them in a few different locations, and trust that they will spread out over the next decade or so. We picked plants that are hardy and can spread very rapidly."`
			choice
				`	"Sounds good to me."`
					accept
				`	"What happens if the plants are too invasive, and choke out all the local wildlife?"`
			`	"Well," she says, "in order to keep the climate on <planet> dynamic, they're going to need regular asteroid impacts every few decades. If these plants are too invasive, they can just wait an extra decade or so in between impacts and let the desert creep back in and kill off the invasive plants."`
			choice
				`	"Okay, I guess that would work."`
					accept
				`	"Wait, they're going to have to keep smashing asteroids into their world in perpetuity to maintain the new environment?"`
			`	"For a century or so, yes," she says. "But that's a whole lot more economical than vaporizing the ice caps using traditional terraforming equipment. Come on, let's get back to <planet>."`
				accept
	
	on complete
		payment 60000
		conversation
			`When you get back to <planet>, Amy has you fly in a random path a few kilometers above the surface while she periodically dumps loads of seeds and plant material out the airlock. In the process, you fly through several rainstorms. This world's climate has indeed been altered. But you can't help wonder how a few tons of seed spread out over the entire surface of a planet is really going to help anything.`
			`	Then you meet up with Eric and Alaric. Eric is elated. "We just got a massive rainstorm here!" he says. "We haven't had that much precipitation in a decade!"`
			`	Alaric is less enthusiastic. "Flash floods washed out the road through the canyon," he says, "and very nearly flooded one of the mines, too."`
			`	Amy says, "It will take a year or two for things to begin to settle down. Then we can figure out what our next steps should be."`
			`	"I just hope we haven't made things worse than they were," says Alaric. He hands you your payment of <payment>. "Anyway, thanks for your help, <first>. It sounds like there's nothing more to be done here for the time being."`
		event "terraforming Rand"



mission "A wolf, a goat, and a cabbage"
	job
	description "Transport a wolf, a goat, and a cabbage to <destination>. Payment will be 100,000 credits."
	to offer
		"day" == 1
		"month" == 4
	source
		government "Republic" "Free Worlds" "Syndicate" "Neutral"
	destination
		distance 3 5
		government "Republic" "Free Worlds" "Syndicate" "Neutral"
	cargo "wolf" 1
	
	on enter
		dialog
			`As soon as you take off, you hear a worrisome munching sound from the cargo hold, followed by a horrific shrieking bleating noise and then an equally horrific silence. Turning on your cargo hold's security camera, you discover that there is nothing left of the goat and the cabbage that you were transporting except a few scraps of cabbage, some bones, and a lot of blood.`
			`	Meanwhile, the wolf is calmly gnawing on what you suspect is the goat's femur, with a rather self-satisfied look in its eyes. Apparently the goat ate the cabbage, and shortly after that the wolf ate the goat.`
	
	on complete
		payment 33000
		dialog
			`The man who collects the wolf from you on the landing pad is furious. "I told the shipping company not to put the goat in the same ship as the wolf or the cabbage," he says, "but I guess they tried to save money by subcontracting it all to the same captain."`
			`	Because you only delivered a third of the cargo safely, he only pays you 33,000 credits.`



mission "Terminus exploration"
	name "Missing drone"
	description "Travel to the Terminus system to see if you can find any sign of a probe drone that had been launched by a team of scientists before they were attacked by pirates and forced to flee."
	source Bounty
	waypoint Terminus
	to offer
		"combat rating" > 20
	on offer
		conversation
			`As you are exploring the marketplace, a man wearing comically thick glasses comes over to talk to you. "Captain <last>?" he asks. You nod. "I hear that you're not averse to taking on risks," he says. "I'm the lead scientist on a project studying a spatial anomaly in an uninhabited system nearby. We had just launched a probe to study the anomaly more closely when a band of pirates arrived and forced us to flee the system. Would you be willing to travel there and see if you can retrieve the drone's data?"`
			choice
				`	"Sure, I would be glad to."`
					goto end
				`	"How strong of a threat is the pirate fleet?"`
				`	"Sorry, I don't have time to help you."`
					decline
			`	"Just a couple of interceptors," he says. "We were in a scoutship, with no real weapons to speak of, and none of us on the ship have any combat experience. So, we felt it was safer to run away than to try to fight, even though we were leaving valuable equipment behind."`
			choice
				`	"That doesn't sound like much of a threat. I'd be glad to help."`
				`	"Sorry, I don't want to help with this."`
					decline
			label end
			`	"Thank you so much!" he says. "All I need you to do is board the drone and download its database. Unless the pirates have already stripped out the computer, of course. The drone is in the Terminus system, a few jumps away from here."`
				accept
	npc assist
		system Terminus
		government Uninhabited
		personality derelict target
		ship "Science Drone" "Beagle"
		dialog `You board the science drone and discover that the pirates have stripped just about everything of value from it: the engines, the sensors, and the fuel cell that powered it. But the computer system is either too deeply integrated into the drone, or too specialized, to be of any value to the pirates. You transfer enough power to the drone's batteries to reactivate it, and are able to retrieve the data that the scientist was looking for. But it's clear that this drone, or what's left of it, is not going anywhere. You'll have to leave it behind.`
	npc
		system Terminus
		government Pirate
		personality staying
		fleet "Small Southern Pirates"
		fleet "Small Southern Pirates"
	on complete
		payment 90000
		conversation
			`The scientist is overjoyed that you were able to retrieve the data from the drone. Almost in tears, he says, "We were worried that all our planning and fundraising had been for nothing. These measurements will help us to understand that spatial anomaly far better than we do right now." He hands you a credit chip worth <payment>.`
			choice
				`	"Can you tell me more about this anomaly you are studying?"`
				`	"I'm glad I was able to help."`
					decline
			`	He says, "It seems to be a partially collapsed wormhole, something that once linked this part of the galaxy to somewhere else. But, we haven't succeeded in sending anything through it. Maybe the wormhole is no longer passable. Or maybe there's some way to make it open more fully. Or maybe only ships that are specially attuned to its energy signature can travel through it. We don't even know if the wormhole is a natural phenomenon or some sort of alien artifact. Honestly, we aren't even sure if it's even a wormhole at all."`
			`	You thank him for the information, and return to your ship.`
				decline
	
ship "Science Drone"
	sprite "ship/science drone"
	attributes
		category "Drone"
		hull 200
		mass 30
		drag 2
		"heat dissipation" 1
	explode "tiny explosion" 5
	explode "small explosion" 2
