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

mission "First Contact: Hai"
	landing
	source
		attributes "hai"
	on offer
		conversation
			`This planet is populated by an alien species that resemble giant, intelligent squirrels. However, the most surprising aspect of the spaceport is not the aliens, but the fact that human merchants and other civilians are walking among them and are clearly at home here. Would you like to find someone who can tell you what is going on here?`
			choice
				`	(Sure.)`
				`	(Not right now.)`
					defer
			
			`	You walk up to a human merchant who is busy haggling with one of the aliens. They interrupt their conversation when they see you approaching, and the human gestures for you to join them. "You look totally lost," he says. "First time down the rabbit hole?"`
			`	You nod. The alien reaches out a paw to shake hands with you. "Welcome to Hai space," it says. "We are people of peace, and you are free to visit us or even live among us. Our worlds provide enough bounty for all."`
			`	You glance quickly at the human merchant to see his expression, wondering if these aliens can indeed be so benign, but his expression is calm and untroubled. "It's true," he says, "look around you. These buildings have stood for thousands of years. Hai society is so advanced, they need almost no resources to maintain it."`
			choice
				`	"Why do you allow humans to settle here?"`
				`	"What do you ask for in return for letting humans settle here?"`
			
			`	"Humans are a young species," the Hai says, "full of energy, full of new ideas. And the Hai are old, and everything we do is what we have done before. When humans go on vacation, they travel to a world with perfect weather, sunny every day. When Hai go on vacation, we visit the stormiest world, to find unpredictability and change. Humans are so strange, that to speak with a human is like a small vacation." It smiles, and you catch a glimpse of its massive incisors. Based on your knowledge of xenobiology you would guess that the Hai are herbivores, but you can't be certain.`
			choice
				`	"So I'm allowed to travel throughout your territory if I want?"`
					goto travel
				`	"How come people back in human space don't know that you are here?"`
			
			`	The human merchant laughs. "Probably because most of us came here to escape from the chaos and fighting in human space. The last thing we want is for it to follow us here. Not that I'm saying you can't tell anyone about the wormhole, but if I were you I wouldn't go spreading the news too widely either. And take a look around Hai space before you leave; you'll find that we could learn a lot from them."`
			`	"So I can travel anywhere I want in your territory?" you ask the Hai.`
			
			label travel
			`	"Yes," it says, "but be careful. The north is the territory of some renegade Hai: bandits and pirates, living off what they steal from the rest of us. If you travel among them, you will not be safe."`
			`	You talk for a while longer, but do not gain much additional information except that several of their worlds are willing to sell Hai technology even to human beings. You thank them both for stopping to talk with you, and the Hai responds, "We are always glad to welcome new friends. May peace dwell in your heart until we meet again."`
				decline
	on decline
		log "Factions" "Hai" `The Hai are a species of giant, intelligent rodents, who live to the north of human space. They allow any humans who discover their territory to live alongside them, and to trade with them and purchase their technology.`

mission "Discovered Hai Space"
	landing
	invisible
	source
		government "Hai"
	on offer
		event "label hai space"
		fail

event "label hai space"
	galaxy "label hai"
		sprite "label/hai"



mission "Assisting Hai"
	assisting
	repeat
	to offer
		random < 27
	source
		government "Hai"
		not attributes "automaton"
	on offer
		payment 30000
		conversation
			`Knowing you risked your life to save the <origin>, the captain gives you <payment>.`
				decline
	destination "Hai-home"



mission "First Contact: Unfettered"
	landing
	source
		attributes "unfettered"
	on offer
		conversation
			`The Hai here appear to be at war with the rest of their species. Do you want to approach one of them and ask why?`
			choice
				`	(Sure.)`
				`	(Not now, it's too risky.)`
					defer
			`	You catch the eye of one of the Hai dock workers and it walks over. "Ah," it says, "the monkey is curious. The monkey has never been face to face with a true Hai before?"`
			choice
				`	"No, I've encountered many of your brethren south of here."`
					goto brethren
				`	"What do you mean, 'true Hai'?"`
					goto true
				`	"Why are you at war with everyone else?"`
					goto everyone
			
			label brethren
			`	It hisses. "They are not true Hai. We are Hai. The unaltered. We were masters of a hundred worlds before human monkeys had learned the use of thumbs."`
				goto masters
			
			label true
			`	"It means that we are unaltered, Hai as Hai were first born to be. Hai the conquerors. We were masters of a hundred worlds before human monkeys had learned the use of thumbs."`
				goto masters
			
			label everyone
			`	"We fight to defend ourselves from extinction," it says.`
			`	"'Extinction?'" you ask. "Do you mean that you are not the same species as the other Hai?"`
			`	"Indeed," it says. "We are all that is left of the original Hai. Unaltered. The conquerors. We were masters of a hundred worlds before human monkeys had learned the use of thumbs."`
				goto masters
			
			label masters
			choice
				`	"Where was your territory? Why have I never heard of you before?"`
				`	"What do you mean, the Hai were altered?"`
	
			`	"This is our story," it says. "Once, many worlds beyond wormhole were ours. Once, hundred thousand years now gone. We needed more worlds. A species that does not expand becomes like brackish water, like stunted tree. But dragonfolk in the south had created hyperdrive, and human monkeys had begun banging rocks together in what the Drak said was very intelligent fashion. So we were forbidden from taking more worlds."`
			`	"'Dragonfolk?'" you ask. "I've never heard of them."`
			`	"Sheragi," it says, "they are extinct. Only their dumb ancestors survive, just as monkeys will outlast the thinking humans."`
			`	"How were you altered?" you ask.`
			`	It says, "We Hai took worlds that Drak said belonged to Sheragi, although Sheragi had not yet even discovered them. Drak retaliated. On all Hai worlds, Drak ships appeared in orbit. Sickness swept each planet: quick fever, strange feeling of frailness, like you are brittle bones with mouth full of dirt. Victims left alive, but all ambition gone, no desire but to die of comfortable old age."`
			choice
				`	"Did you try to resist the Drak?"`
					goto resist
				`	"How do you know this, if it happened a hundred thousand years ago?"`
					goto know
			
			label resist
			`	"Silly monkey," it says, "none can resist. They are strong. Their will prevails. And their will is for the galaxy to be a zoo, little remnants of each species all in separate cages. For now they let humans run free so humans will grow in knowledge, but soon they will fashion a cage for humans too."`
				goto help
			
			label know
			`	"All Hai know. The story is passed down. Others tell an altered version, where the way of peace was choice and not an inflicted wound, but some in each generation learn truth, and join us here."`
				goto help
			
			label help
			choice
				`	"That is a frightening story. Thank you for taking the time to speak with me."`
					decline
				`	"Is there anything I can do to help you?"`
			
			`	"If you are ever willing to sell us a jump drive," it says, "we will richly reward you. And if you discover the secret of how we can construct our own jump drives and escape from this prison, bring it to us and you will live as a god among us."`
			choice
				`	"I'm sorry, I don't know the secret of the jump drive. No human being does."`
				`	"If I ever have an extra jump drive to sell, I will bring it to you."`
					goto sell
			`	"Then leave us alone," it says, and it walks off.`
				decline
			
			label sell
			`	"Bring us a jump drive," it says, "and we will count you among our friends. Bring us more, and we may even consider you worthy of a share of the plunder, when we take back what is ours."`
				decline

	on decline
		log "Factions" "Unfettered Hai" `The "Unfettered" are a faction within the Hai species who are not as peaceful as the rest, and are normally not friendly toward humans. They claim that long ago the Drak altered the Hai to make them docile and peaceful, and that the Unfettered are descendants of those Hai who avoided undergoing that alteration. They are seeking jump drives so that they can escape the "prison" they are now stuck in: a few deteriorating worlds on the far northern edge of Hai space.`
		log "Factions" "Sheragi" `The Unfettered Hai say that a dragon-like species called the "Sheragi" who are long extinct used to live in human space, back when much of what is now human territory was occupied by the Hai.`



mission "Ask the Hai about the Unfettered"
	landing
	source
		attributes "hai"
	to offer
		has "First Contact: Unfettered: offered"
	on offer
		conversation
			`The Unfettered Hai told you that they are the "true Hai," and seem to think that the other Hai are oppressing them. Would you like to look for someone here who can tell you the other side of the story?`
			choice
				`	(Yes.)`
				`	(No.)`
					decline
			`	You find an elderly-looking Hai who is sitting on a bench watching the starships land and take off. As you approach, he says, "Hello human."`
			choice
				`	"Hello. I've met some of the Unfettered Hai. What can you tell me about them?"`
				`	"Hello. Can you tell me why you are at war with the other Hai who live to the north?"`
					goto war
			`	He says, "Ah, our wayward sisters and brothers to the north. You have surely seen what our society is like: safe, stable, predictable, deliberate. It suits most of us well. But there are those..."`
				goto raids
			label war
			`	He says, "I would not call it war. We launch no raids on them. We only defend when they attack. And, we supply them with food and other things needful for life. They are not our enemies, they are just those who do not fit in. You have surely seen what our society is like: safe, stable, predictable, deliberate. It suits most of us well. But there are those..."`
			label raids
			`	He pauses. "No, I am telling this unfairly. I will start again. Hundreds of years ago, when I was young, our territory was raided by aliens from the east, who came in massive warships and plundered our worlds. In those days there were some Hai who were brave enough to risk their lives to defend us. The raids lasted for decades, then abruptly stopped.`
			`	"Most of those who had fought the invaders were glad to return to ordinary life, but there were some for whom life now seemed bland and meaningless without the excitement and chaos of war. They started colonies in the systems to the north, and fought amongst themselves, and mismanaged the land, and grew in numbers. And now their worlds cannot feed them all, and they invade us and tell stories to put blame on us for their failures."`
			choice
				`	"Shouldn't they be treated with gratitude for defending you against the raiders?"`
				`	"They said the Drak altered the Hai to make them less aggressive. Is that true?"`
					goto drak
				`	"That's all I wanted to know. Thanks."`
					decline
			`	"They were, and still should be. There will always be times when our society needs them. Only at this time, the need is not so great. There is no new frontier for them to explore, no worthy challenges for them to face. And we fear what would happen if they ventured south and gained access to the wormhole, so we must force them to stay where they are."`
			choice
				`	"They said the Drak altered the Hai to make them less aggressive. Is that true?"`
				`	"That's all I wanted to know. Thanks."`
					decline
			label drak
			`	"No," he says, "it is a story they invented, that the Hai were destined to be masters of the galaxy but the Drak and the Quarg prevented us. The story is not true. Our civilization beyond the wormhole was brought down by infighting and unwise governance. Amid the wreckage we studied and thought and argued and came to believe that we could rule a small territory with stability and peace, or hold more worlds but with constant turmoil. We chose stability, and relinquished those worlds."`
			choice
				`	"So you don't think the Drak are keeping us all in cages?"`
				`	"That's all I wanted to know. Thanks."`
					decline
			`	He thinks about the question for a while, then says, "Sometimes we make a fire for cooking food. The fire consumes much wood, and the flames are tall, too wild and hot to cook food well. Then the wood becomes coals that burn slowly with no flames or smoke, and when you gather them they are good for roasting meat or even baking bread. Perhaps each species must consume many worlds and many resources before learning to burn slowly, and the wisdom of the Drak is to allow them to do so. But when they find balance, as we did, they no longer need so much space."`
			`	You thank him for taking time to speak with you, and say goodbye.`
				decline



mission "Unfettered Jump Drive 1"
	name "More Jump Drives"
	minor
	description "The Unfettered Hai have promised you rich rewards if you bring them more Jump Drives."
	landing
	to offer
		has "First Contact: Unfettered: offered"
		not "Wanderers: Jump Drive Source: active"
	to fail
		has "event: wanderers: unfettered invasion starts"
	to complete
		has "Unfettered Jump Drive 2: offered"
	source
		attributes "unfettered"
	on offer
		conversation
			`The Unfettered have clearly noticed that you have a jump drive installed; a large crowd of them has gathered around your ship. Do you want to talk with them, and perhaps arrange a sale of your jump drive?`
			choice
				`	(No.)`
					defer
				`	(Yes.)`
			`	As soon as you approach the crowd, one of them steps forward and says, "One million credits, and the friendship of the true Hai people. This is our offer, for the jump drive."`
			choice
				`	"Sure, I will accept that deal."`
					goto end
				`	"Can you offer me more than that?"`
					goto more
				`	"How will my ship leave here without my jump drive?"`
			
			`	"We will give you a hyperdrive in its place," it says, "and you will be counted as our friend, so you will not need to leave here quickly, or under threat of violence." You can't help but wonder if they will try to take your ship by force if you do not agree to the deal.`
			choice
				`	"Okay, I accept your generous offer."`
					goto end
				`	"Sorry, but if I give you this jump drive, I will lose my ability to capture more of them. Be patient, and I will bring you several of them when I am able."`
					goto refuse
			
			label refuse
			`	It ponders this for a while, and says, "Very well. Our offer stands, whenever you choose to return." They allow you to return to your ship peacefully.`
				defer
			
			label more
			`	"Do not underestimate the value of our friendship," it says. "Soon we will become powerful once more, with many fruitful worlds under our control, and when that day comes you will benefit greatly from being our ally."`
			choice
				`	"Okay, as long as you give me a hyperdrive to take its place, I'll give you my jump drive."`
					goto end
				`	"Sorry, but if I give you this jump drive, I will lose my ability to capture more of them. Be patient, and I will bring you several of them when I am able."`
					goto refuse
			
			label end
			`	The Unfettered engineers quickly and carefully remove your jump drive and replace it with an ordinary hyperdrive. You sincerely hope that you are not making a mistake by giving them this new technology. "Remember," one of them says as it hands you your payment, "when you acquire more jump drives, return here with them and we will give you further rewards. Until then, may fortune favor you, human friend."`
				accept
	
	on accept
		outfit "Jump Drive" -1
		outfit "Hyperdrive" 1
		payment 1000000
		"reputation: Hai (Unfettered)" >?= 10



mission "Unfettered Jump Drive 2"
	name "More Jump Drives"
	minor
	description "The Unfettered Hai have promised you rich rewards, and more information about their plans, if you bring them more Jump Drives."
	landing
	to offer
		has "Unfettered Jump Drive 1: offered"
		not "Wanderers: Jump Drive Source: active"
	to fail
		has "event: wanderers: unfettered invasion starts"
	to complete
		has "Unfettered Jump Drive 3: offered"
	source
		attributes "unfettered"
	on offer
		conversation
			`As before, when you land on this Unfettered world with a jump drive, a large crowd gathers around your ship. Clearly they are hoping that once again you will arrange a sale. Do you want to bargain with them?`
			choice
				`	(No.)`
					defer
				`	(Yes.)`
			`	When you approach the crowd, one of them says, "Greetings, human friend. We have made you known to all our brothers and sisters as one of the few creatures who have chosen to help the true Hai to gain their freedom. If you give us another jump drive, we will pay you another million credits, and make you one of our emissaries to collect the payments with which our frail brothers seek to buy peace. Will you accept this exchange?"`
			choice
				`	"Sorry, I need this jump drive right now, but I will come back later and sell it to you."`
					defer
				`	"Yes, I will sell you my jump drive."`
			`	Once again, they swap your jump drive for a hyperdrive, and pay you far more than you could sell a jump drive for anywhere else. "We will tell the other true Hai to offer you jobs in our job boards," they tell you, "and remember that we need still more jump drives."`
			choice
				`	"Then I will find more, and bring them to you."`
					accept
				`	"Can you tell me what you are using them for?"`
			`	"Not yet. If you further prove your friendship, perhaps we will." You assure them that you will continue to do your best to assist them.`
				accept
	
	on accept
		outfit "Jump Drive" -1
		outfit "Hyperdrive" 1
		payment 1000000
		"reputation: Hai (Unfettered)" >?= 20
		fail "Unfettered Jump Drive 1"



mission "Unfettered Jump Drive 3"
	name "More Jump Drives"
	minor
	description "If you find more Jump Drives, you can sell them to the Unfettered Hai for considerably more money than they are worth elsewhere."
	landing
	to offer
		has "Unfettered Jump Drive 2: offered"
		not "Wanderers: Jump Drive Source: active"
	to fail
		has "event: wanderers: unfettered invasion starts"
	to complete
		has "Unfettered Jump Drive 4: offered"
	source
		attributes "unfettered"
	on offer
		conversation
			`You have another jump drive, and the Unfettered will certainly be willing to pay you well for it. They also hinted that they might be willing to give you more information about what they plan to use the jump drives for. Do you want to sell them another drive?`
			choice
				`	(No.)`
					defer
				`	(Yes.)`
			`	You meet up with some local Unfettered leaders, and they again pay you a million credits and arrange for your jump drive to be swapped out of your ship. "If you bring more, we will continue to pay you," they say.`
			choice
				`	"Can you tell me what you are using the jump drives for?"`
				`	"Thank you, I will certainly bring more of them when I am able."`
					accept
			`	After a brief and hushed discussion in their own language, one of the leaders says, "You have proven your worth, so we will share our secret. The Hai once owned many worlds on the galactic fringe, a territory we can only visit using the jump drive. Those worlds are fruitful and nearly uninhabited. We will reclaim them as our own, and there will be food there to feed the Unfettered for many thousands of years to come."`
			branch know
				has "First Contact: Wanderer: offered"
			choice
				`	"Is there any other way I can help you to reclaim those worlds?"`
					goto help
				`	"'Nearly uninhabited?' You mean another species inhabits some of those worlds now?"`
					goto wanderers
			
			label know
			`	You suspect that they are talking about the territory that is now inhabited by the Wanderers.`
			choice
				`	"Are you at war with the Wanderers? Can I help you to reclaim your territory?"`
					goto help
				`	"What are you going to do to the species that owns those worlds right now?"`
					goto wanderers
			
			label help
			`	"Your help may indeed be beneficial to us," says the leader. "I will tell the others to contact you if they have any particular missions you can undertake."`
			choice
				`	"I look forward to hearing from them."`
					accept
				`	"What do you plan to do to the species that inhabits those worlds now?"`
			
			label wanderers
			`	"Those worlds are now held by a species of scavengers, who feast on the ruin of proud civilizations. Our scouts tell us that these carrion-feeders have wiped away nearly every Hai artifact, melting down our cities to make metal for their ships and factories, and hiding the scars of our wars beneath newly planted forests. They are an old and strong species, but few in number, and those worlds are ours by right."`
			`	You try to press them for more information, but they tell you nothing useful, aside from promising you that they will seek out your help when it is time to reclaim their territory.`
				accept
	
	on accept
		outfit "Jump Drive" -1
		outfit "Hyperdrive" 1
		payment 1000000
		"reputation: Hai (Unfettered)" >?= 30
		fail "Unfettered Jump Drive 2"



mission "Unfettered Jump Drive 4"
	repeat
	minor
	to offer
		has "Unfettered Jump Drive 3: offered"
		not "Wanderers: Jump Drive Source: active"
	to fail
		has "event: wanderers: unfettered invasion starts"
	to complete
		never
	source
		attributes "unfettered"
	on offer
		conversation
			`Would you like to sell another jump drive to the Unfettered?`
			choice
				`	(No.)`
					defer
				`	(Yes.)`
			`	As usual, they are more than willing to pay you a million credits for your jump drive, but you do not gain any additional information by talking with them.`
				accept
	
	on accept
		outfit "Jump Drive" -1
		outfit "Hyperdrive" 1
		payment 1000000
		"reputation: Hai (Unfettered)" >?= 40
		fail "Unfettered Jump Drive 3"
		fail "Unfettered Jump Drive 4"



mission "Unfettered returning home"
	description "This Hai has asked you to smuggle him out of Unfettered space and bring him to <destination>."
	minor
	source
		attributes "unfettered"
	destination "Hai-home"
	clearance
	passengers 1
	to offer
		has "Unfettered Tribute 3: done"
		random < 40
	on offer
		conversation
			`During the night, you hear a gentle scratching sound on your ship's main hatch. Do you investigate?`
			choice
				`	(Yes.)`
				`	(No.)`
					defer
			`	You grab a flashlight and open the hatch, and find a juvenile Hai there, with a large satchel slung over his shoulder. "You are the <first> <last>, yes?" he says. You nod. He says, "Is it true what is written here?"`
			`	In his hands he is holding a piece of foil paper. You recognize it as the wrapper from one of the food rations that you have been transporting to the Unfettered, the "tribute" that they demand from the peaceful Hai. But having never unwrapped one of the rations, you had not realized that there is writing on the inside, a few words in the angular alphabet of the Hai. The Unfettered youth sees your look of confusion, and translates the message. "It says, 'Hai-home is your home too. Rejoin your people.'"`
			choice
				`	"I think it is true. The Hai who gave this tribute said they hoped the Unfettered would turn from violence and be reconciled with them."`
					goto true
				`	"I'm sorry, but I don't think they will ever let you live among them, if it is your nature to be prone to violence."`
			`	You have little experience reading Hai emotion, but the youth seems crestfallen. "You are certain?" he asks.`
			choice
				`	"I am certain. I can do nothing for you."`
					goto refuse
				`	"Perhaps you can come with me and find out, but don't get your hopes up."`
					goto end
			label true
			`	"Will you take me to Hai-home?" he asks. "You are able to be outside Unfettered places. Can I go with you?"`
			choice
				`	"Yes, I will take you there."`
					goto end
				`	"Sorry, I can't risk angering the Unfettered by carrying a defector."`
			label refuse
			`	Disappointed, the youth leaves. You hope you made the right choice.`
				decline
			label end
			`	You show the youth to one of your bunk rooms, and tell him to stay hidden there until you reach Hai-home.`
				accept
	
	on visit
		dialog `You look for the young Hai, but realize that he took a ride on one of your escorts! Better depart and wait for your escorts to arrive in this star system.`
	on complete
		payment 100000
		dialog
			`You need not have worried about the reception the Unfettered youth would receive here on Hai-home. Scarcely minutes after you hesitantly contact the Hai government, a happy crowd has gathered around your ship. When he steps out of the hatchway, he looks stunned at being welcomed so warmly. One of the Hai governors thanks you for transporting him, and pays you <payment>.`
		"reputation: Hai" += 10



mission "Returning Home"
	description "Bring Elliot home to his family on <destination>. Elliot ran away from his family as a teenager and hasn't seen them in almost six years."
	minor
	source
		government "Hai"
	destination
		attributes "dirt belt"
		attributes "farming"
	passengers 1
	to offer
		random < 40
	on offer
		conversation
			`You are stopped by a human in the <origin> marketplace. He takes off his hat and asks, "You're from the outside, aren't you?"`
			choice
				`	"Yes, I am."`
					goto outsider
				`	"What do you mean 'the outside?'"`
			
			`	"Outside of Hai space. You don't look quite like most humans who live here, unless there's some new fashion trend going on that I don't know about."`
			choice
				`	"Oh, yes. I do come from outside."`
			
			label outsider
			`	"Good. My name is Elliot." You introduce yourself to Elliot and shake hands.`
			`	"Can you take me to <destination>?" Elliot asks.`
			`	"That's all the way in the Dirt Belt," you say. "Why do you want to go that far?"`
			`	Elliot looks down at the ground for a second and takes a deep breath while gripping his hat in his hands. "You see, I haven't lived here all my life. I was born on <planet> to a poor farming family. Most of my days were spent working on the farm, which I hated with a passion. One day I just got fed up with things and I ran away.`
			`	"I ran away from home to the spaceport city and snuck my way into the cargo hold of a freighter. The captain didn't open the cargo hold for three weeks while I stayed in it. Lucky for me the freighter was transporting food, so I had plenty to eat.`
			`	"When the cargo hold doors finally opened, I ran out as fast as I could, only to run back in at the sight of a group of Hai. I had no idea where I was at the time, but I've been living here ever since. That was when I was thirteen, nearly five years ago now."`
			`	Elliot looks down at the ground again and wipes a tear from the corner of his eye.`
			choice
				`	"Alright, I'll take you to <planet>."`
					goto accept
				`	"And you finally want to go back home?"`
				`	"Sorry, but I'm not able to take you that far."`
					goto decline
			
			`	"Yes. I've thought a lot about it lately. I want to see my family again."`
			choice
				`	"Alright, I'll take you to <planet>."`
					goto accept
				`	"Sorry, but I'm not able to take you that far."`
			
			label decline
			`	"I understand," Elliot says. "I'll just try and find someone else to help me. Goodbye, <first>."`
				decline
			
			label accept
			`	You lead Elliot to your ship and show him to a bunk room. After leaving Elliot there, you wonder if his family is still even on <planet> anymore.`
				accept
			
	on visit
		dialog `You look for Elliot, but realize that he took a ride on one of your escorts! Better depart and wait for your escorts to arrive in this star system.`
	on complete
		payment 45000
		conversation
			`Elliot thanks you for bringing him to <planet> and hands you <payment>. He flags down a taxi just outside the spaceport, but before entering the taxi he turns back to you.`
			`	"Do you want to come with me? I'd love for you to meet my family. They'll want to meet you when I tell them how I got back."`
			choice
				`	"Sorry, I have other places to be. Good luck."`
				`	"Sure. I've come with you this far."`
					goto sure
			
			`	"I understand. Thanks again, <first>. I'll always owe you."`
			`	Elliot gets into the taxi, which drives off toward the seemingly endless farmlands outside of the spaceport city.`
				decline
			
			label sure
			`	The view for nearly the entire three hour drive is of hills and farmland with the occasional building or wild animal. Elliot shakes as the taxi approaches the house from the driveway. "I'm wondering if they still even live here," he says nervously.`
			`	No one comes out of the house when the taxi stops. You walk up to the front door with Elliot and a middle-aged woman answers the door with a mug of coffee and a bewildered look on her face.`
			`	"Can I help you?" the woman asks.`
			`	Elliot looks over at you with a big smile on his face. "Yes you can, mom," he says to her. The woman's face lights up with joy and she begins jumping up and down, spilling coffee from her mug.`
			`	"Oh Elliot, I can't believe it!" Elliot's mom puts down her mug and leaps out the door to hug him. "Jackson! Sarah! Abby! Sean! Victor! Elliot is here!" Elliot's entire family comes out from the house and greets him, asking dozens of questions about where and how he's been and why he left.`
			`	Elliot introduces you to his family, who thank you for bringing Elliot home. Victor, who was only seven years old when Elliot left and is now twelve, asks you question after question about being a pilot, sometimes asking new questions before you can even answer the old one.`
			`	"Are you going back to the spaceport, <first>?" the taxi driver yells from the driveway. "I need to get back to the city as soon as I can."`
			`	You say goodbye to Elliot and to his family. "Thanks again, <first>," Elliot says. "I'll always owe you."`



mission "Unwanted Cargo Trigger"
	invisible
	landing
	source
		government "Hai"
	to offer
		random < 10
		"cargo space" > 0
	on offer
		event "hai in cargo" 14
		fail

event "hai in cargo"

mission "Unwanted Cargo"
	landing
	description "Bring a Hai child who hid in your cargo hold back to <destination>."
	source
		government "Republic" "Free Worlds" "Syndicate" "Neutral"
	destination "Allhome"
	to offer
		has "event: hai in cargo"
	on offer
		conversation
			`The "Check Cargo" light for your ship begins blinking when you land, meaning that a cargo crate may have come loose in flight. You shut off the ship's engines and walk to the cargo hold.`
			`	You check every cargo crate in the hold, but can't find anything wrong. Right as you decide to leave, one of the smaller crates begins rocking back and forth.`
			branch translator
				has "language: Wanderer"
				
			`	You hear a voice come from the crate, but it is not a language you understand. The voice continues to speak, and you recognize it as the Hai language.`
			choice
				`	(Open the crate.)`
			`	You open the crate and are met face to face with a Hai child. You aren't sure how old it is, but it looks to be about the size of a one-year-old human child. It tries to communicate with you, but begins to cry when it sees the confused look on your face.`
			choice
				`	"Don't cry, little guy."`
					goto cry
				`	(Pick up the Hai.)`
				
			`	The child waves its hands around when you try to pick it up, making it impossible to grab on to. After waiting for a few minutes, the child finally calms down, eventually going to sleep in the crate.`
				goto end
			
			label cry
			`	The child begins to cry even louder than before. After waiting for a few minutes, the child finally calms down, eventually going to sleep in the crate.`
				goto end
			
			label translator
			`	You hear a voice come from the crate, and surprisingly your Hai translator begins speaking. "Let me out! I want to go home!"`
			choice
				`	(Open the crate.)`
			`	You open the crate and are met eye to eye with a Hai child. You aren't sure how old it is, but it looks to be about the size of a one-year-old human child. "I want my mommy!" it says as its eyes begin to tear up.`
			choice
				`	"Where's your mommy?"`
				`	"Don't cry, little guy."`
			`	The child looks surprised when your translation device speaks to it in Hai. "Take me home!" it yells back at you. You attempt to find out where the child's home is, but it continues to cry for its mother without giving any important information.`
			
			label end
			`	This child must have somehow gotten into your cargo hold while you were in Hai space. Leaving a Hai child on a human world would be an extremely bad idea. Perhaps someone on <destination> will be able to bring the child back to its family.`
				accept
			
	on complete
		payment 50000
		dialog `You contact the spaceport authorities of <planet> and ask them if they are looking for a lost Hai child. It turns out that the family was so worried that they put up a <payment> reward for finding their son. A Hai spaceport worker takes the child from your ship and thanks you for finding him for the family.`



mission "Expanding Business [1]"
	name "An Interesting Proposition"
	description "Travel with businessman David Turner to <destination> where a convoy of freighters are awaiting escort."
	minor
	source "Greenwater"
	destination "Allhome"
	to offer
		has "First Contact: Hai: offered"
		has "main plot completed"
	on offer
		conversation
			`Walking through the <origin> spaceport, you notice that almost half of the people you see are humans, unlike other Hai worlds where the Hai outnumber humans by a sizable degree. A human dressed in a business suit shouts your name from across the street and approaches you.`
			`	"Captain <last>, one of the many heroes of humanity! I noticed you right away when I laid my eyes upon you. I'd like to personally thank you for what you've done."`
			choice
				`	"Glad to get some recognition for all the hard work I've done."`
					goto boast
				`	"Don't mention it. I just did what I could to help."`
					goto downplay
				`	"Can I help you, sir?"`
			
			`	"I'm the one who should be using formal titles to address you, so please, Captain, don't call me sir.`
				goto proposition
			
			label boast
			`	"A personality as big as yourself should be receiving praise and recognition wherever you go! People must really have no respect these days.`
				goto proposition
			
			label downplay
			`	"No need to downplay yourself, Captain! You've done God's work in saving humanity from that alien scourge.`
			
			label proposition
			`	"The name's David Joseph Turner, venture capitalist, entrepreneur, and famous Paradise Worlds businessman." Turner grabs a business card from his pocket and hands it to you. The card contains his contact information, an address on Martini, and makes sure to boast in golden letters his net worth of more than three billion credits.`
			`	"You may not have heard of me, but I've sure as hell heard of you, and I'd like to make a proposition to you." Turner turns around and waves his arm across the crowd of people in the spaceport. "You see all the humans here? About one out of every four of these people only arrived here after war broke out through the wormhole. Captains who knew of the Hai came flocking here in droves after the Navy entered Kornephoros, hoping to avoid any troubles that the war would bring. Some captains returned after the war ended, but most stayed, and I see a massive market opportunity in that."`
			branch rich
				"net worth" >= 4000000000
			
			choice
				`	"What kind of market opportunity?"`
					goto opportunity
				`	"Sorry, but I don't have the time to talk about this."`
					goto walk
			
			label rich
			choice
				`	"What kind of market opportunity?"`
					goto opportunity
				`	"You're only worth three billion credits? Why shouldn't I pursue your opportunity on my own?"`
				`	"Sorry, but I don't have the time to talk about this."`
					goto walk
			
			`	"Of course you're worth more than me, Captain <last>, but you are no business owner. I have the connections and skills, but a name like yours will always help.`
				goto opportunity
			
			label walk
			`	You try to walk away, but Turner stops you by grabbing your arm and continues to talk.`
			
			label opportunity
			`	"Allow me to explain. The journey to the Hai can be a dangerous one, and you know that. I heard many stories during the war of merchants trying to reach the Hai, but thanks to the Navy being distracted, those merchants fell victim to pirates patrolling the systems of the Far North. Now that many merchants are here, they're trapped. They expended most of if not all of their ammunition trying to get here, and now they have none to defend them on their way back. Human ammunition has become a scarce commodity among human captains in this region of space, leaving open a market that's just waiting to be cornered.`
			`	"I'd like you, Captain <last>, hero of humanity, to help me set up an outfitter here on <origin>, an outfitter that would supply these desperate merchants with relief by supplying them with the ammunition they need, along with outfits they might want to buy for their old ships. I've already received approval from the Hai government for the construction of an outfitter, and with a name like yours backing up this business, the profits are sure to be phenomenal, profits that you would be sharing in by being a founding member of this outfitter."`
			choice
				`	"This sounds like a good idea to me. What do you need me to do?"`
					goto interested
				`	"Sorry, but I'm not interested in your proposition."`
			
			`	"Nonsense, Captain! All you'd need to do is help escort a few freighters from <planet> to Follower and back to here, and for so simple a job you could be receiving enough money to not work another day in your life, or perhaps even support a massive fleet."`
			choice
				`	"Again, I'm not interested. Goodbye."`
				`	"Alright, you have my attention."`
					goto interested
			
			`	"Well, I tried, Captain," Turner says with a smirk. "I'll just have to travel back to the Paradise Worlds and make my money in other areas of business, then." He hands you another business card and winks. "Goodbye, Captain <last>. You should know where to find me if you need me. Perhaps we can pursue this venture together in the future."`
				decline
			
			label interested
			`	"Excellent, Captain! I'll be making myself comfy on my own ship. A convoy of freighters is waiting for us on <destination>. From there, we're off to Follower to pick up supplies."`
				accept
				
	npc accompany save
		personality escort
		government "Merchant"
		ship "Star Queen (Hai)" "Chryso Vasilia"
	
	on visit
		dialog `You've reached <planet>, but you've left Turner behind. Wait for Turner's ship to arrive before landing.`
	
	on complete
		dialog `The freighters are ready to launch by the time you get to <planet>. "Now we just need to escort these freighters to Follower in the Alphard system and back in one piece," Turner exclaims, hopping back on to his Star Queen.`

mission "Expanding Business [2]"
	landing
	name "An Interesting Proposition"
	description "Escort the freighters to <destination> where they will pick up supplies for the Greenwater outfitter."
	destination "Follower"
	to offer
		has "Expanding Business [1]: done"
	
	npc accompany save
		personality escort
		government "Merchant"
		ship "Star Queen (Hai)" "Chryso Vasilia"
	npc accompany save
		personality escort
		government "Merchant"
		fleet
			names "civilian"
			variant
				"Bulk Freighter (Hai)" 3
	
	npc
		personality staying
		government "Pirate"
		system "Ultima Thule"
		fleet "Small Northern Pirates"
	npc
		personality staying
		government "Pirate"
		system "Rajak"
		fleet "Large Northern Pirates"
	npc
		personality staying
		government "Pirate"
		system destination
		fleet "Large Northern Pirates"
	
	on visit
		dialog `You've reached <planet>, but you've left one of the ships you're supposed to be escorting behind. Wait for Turner's ship and all the Bulk Freighters to arrive before landing.`

mission "Expanding Business [3]"
	landing
	name "An Interesting Proposition"
	description "Escort Turner's ship to <destination> so that he can speak with an old friend."
	destination "Rust"
	to offer
		has "Expanding Business [2]: done"
	on offer
		conversation
			`Turner jumps off of his Star Queen before the boarding ramp fully reaches the ground, clearly eager to get moving with this project.`
			`	Turner swears under his breath when he walks up to you. "Low life pirates giving us trouble on the way here. That's the kind of trouble I'm talking about that an outfitter in Hai space would help with. There's no telling what would have happened had my Bulk Freighters not had their missiles. Or if you were not there to protect them, of course."`
			`	Turner has a talk with the spaceport authorities, and within a short amount of time the necessary cargo is loaded on to the freighters. When the freighters are fully loaded, they take off without even giving you time to get to your ship.`
			`	"They can get back to Greenwater on their own," Turner says from behind you as you watch the freighters fly off. "I told them to leave as soon as they could. As for you and me, I need escort to <destination>. I received a message from an old friend there who would like to have a chat with me."`
				accept
				
	npc accompany save
		personality escort
		government "Merchant"
		ship "Star Queen (Hai)" "Chryso Vasilia"
		
	on visit
		dialog `You've reached <planet>, but you've left Turner behind. Wait for Turner's ship to arrive before landing.`

mission "Expanding Business [4]"
	landing
	name "An Interesting Proposition"
	description "Escort Turner back to <destination> to oversee the construction of the outfitter."
	destination "Greenwater"
	to offer
		has "Expanding Business [3]: done"
	on offer
		conversation
			`Turner lands his ship outside of the Kraz Cybernetics building. "Wait here while I have a talk with my friend, Edward. This should only take a few minutes."`
			`	A few hours later, Turner returns carrying a black suitcase. "Sorry, that took longer than I expected. Now, let's get back to <destination>."`
				accept
	
	npc accompany save
		personality escort
		government "Merchant"
		ship "Star Queen (Hai)" "Chryso Vasilia"
	
	on visit
		dialog `You've reached <planet>, but you've left Turner behind. Wait for Turner's ship to arrive before landing.`
	
	on complete
		event "outfitter on greenwater" 95
		conversation
			`By the time you finally reach <planet>, construction on the outfitter is already underway. The construction workers have laid the foundation of the outfitter close to the spaceport, taking up a good portion of a park.`
			`	"I had to pay a pretty penny to get the outfitter this close to the spaceport," Turner says to you, "but it'll all be worth it in the end.`
			`	"The outfitter should be done in three months or so. You'll know it's done once you find an extra two thousand credits in your pocket every day." Turner pats you on the back. "Have fun until then, Captain <last>. Keep yourself busy saving the galaxy."`

event "outfitter on greenwater"
	planet "Greenwater"
		outfitter "Basic Outfits"
		outfitter "Ammo North"
		outfitter "Ammo South"

mission "Expanding Business: outfitter complete"
	landing
	invisible
	to offer
		has "event: outfitter on greenwater"
	on offer
		"salary: Turner Incorporated" = 2000
		event "request for a shipyard" 270
		fail

event "request for a shipyard"

mission "Expanding Business [5]"
	landing
	name "A New Proposition"
	description "Meet with David Turner on <destination> to talk about a new proposition."
	source
		government "Hai"
	destination "Greenwater"
	to offer
		has "event: request for a shipyard"
	on offer
		dialog `You receive a message from David Turner when you land. "Hello, Captain. I hope you've been enjoying your share in the outfitter. I have a new proposition for you, as I've bought out the rest of the park around the outfitter. Meet me on <destination> if you'd like to hear about it."`

mission "Expanding Business [6]"
	landing
	name "A New Proposition"
	description "Escort the freighters to <destination> in order to pick up the supplies for the shipyard."
	destination "Sunracer"
	to offer
		has "Expanding Business [5]: done"
	on offer
		conversation
			`Turner meets you in a high-end human-owned restaurant in the richer part of the city, very much reminiscent of something you would find on a Paradise Planet. "It's been quite some time since we last spoke, Captain <last>. Over a year now," he says. "Have you been enjoying the extra cash in your pocket every day, Captain <last>?"`
			choice
				`	"Yes. It's been a huge help paying crew salaries."`
					goto salaries
				`	"Two thousand credits each day isn't much for me."`
			
			`	"I suppose two thousand credits every day wouldn't be much to a hero such as yourself. Spaceships are expensive, after all. How does four thousand credits every day sound to you?"`
				goto choice
			
			label salaries
			`	"I'm glad to hear that, Captain <last>. I spent my early years as a captain myself, and I didn't much enjoy having to worry about crew salaries every day. Perhaps doubling that amount will help even more."`
			
			label choice
			choice
				`	"Am I getting a raise?"`
				`	"Is this part of your new proposition?"`
					goto proposition
			
			`	"You could call it that," Turner says after sipping from his glass of wine.`
			
			label proposition
			`	"Building a outfitter selling human goods here on <origin> has had to be the best idea I've ever had, Captain <last>, but recently I thought of an even better idea. You see, most of the humans you see flying around in Hai space are flying decades-old ships. Hai ships are prohibitively expensive for humans. The Aphid is nearly three million credits! This means that demand for ships is extremely high among humans, Captain <last>. Do you see where I'm going with this?"`
			choice
				`	"You need me to help you escort freighters again?"`
				`	"Do you want to build a shipyard selling human ships?"`
			
			`	"Yes, Captain. Right now, the only realistic way that a human born here can get a ship is if they know a captain willing to retire. Even then, prices for a human ship can be more than twice what they are across the wormhole. It's preposterous, Captain <last>!`
			`	"I've already made arrangements with the local Hai government. The rest of the park next to the outfitter is now my property, and I intend to use it to build the shipyard. I've also contacted Megaparsec and bought a license to build their ships and some of the outfits they sell on <planet>. My freighters are at the ready in the spaceport right now. All I need you to do is escort them to <destination> and back, and in six to seven months' time when the shipyard is done, you'll reap the rewards. What do you say, Captain <last>? Do you want to be a hero to millions once again?"`
			choice
				`	"Sure, this sounds like a great idea."`
					goto accept
				`	"I'm not interested in working with you anymore, Turner."`
			
			`	Turner smirks at your response. "Understood, Captain <last>. I'll just save myself two thousand credits a day from now on by rescinding your salary. I'll be seeing myself out now."`
			choice
				`	"Goodbye."`
					decline
				`	"Wait! I changed my mind. I'll help you."`
			
			label accept
			`	"Excellent decision, Captain <last>. I'll meet you outside to send the ships off."`
				accept
			
	on decline
		clear "salary: Turner Incorporated"
	
	npc accompany save
		personality escort
		government "Merchant"
		ship "Star Queen (Hai)" "Chryso Vasilia"
	npc accompany save
		personality escort
		government "Merchant"
		fleet
			names "civilian"
			variant
				"Bulk Freighter (Hai)" 3
	
	npc
		personality staying
		government "Pirate"
		system "Ultima Thule"
		fleet "Small Northern Pirates"
	npc
		personality staying
		government "Pirate"
		system "Rajak"
		fleet "Large Northern Pirates"
	npc
		personality staying
		government "Pirate"
		system destination
		fleet "Large Northern Pirates"
		
	on visit
		dialog `You've reached <planet>, but you've left one of the ships you're supposed to be escorting behind. Wait for Turner's ship and all the Bulk Freighters to arrive before landing.`

	on complete
		dialog `The Bulk Freighters are loaded with supplies without any problem. When one of the spaceport workers asks Turner where the supplies are going, he replies, "These are just to expand a business venture of mine on, uh, Glory."`

mission "Expanding Business [7]"
	landing
	name "A New Proposition"
	description "Escort the freighters back to <destination> to begin construction on the shipyard."
	destination "Greenwater"
	to offer
		has "Expanding Business [6]: done"
	
	npc accompany save
		personality escort
		government "Merchant"
		ship "Star Queen (Hai)" "Chryso Vasilia"
	npc accompany save
		personality escort
		government "Merchant"
		fleet
			names "civilian"
			variant
				"Bulk Freighter (Hai)" 3
	
	npc
		personality staying
		government "Pirate"
		system "Cardax"
		fleet "Small Northern Pirates"
	npc
		personality staying
		government "Pirate"
		system "Rajak"
		fleet "Large Northern Pirates"
		
	on visit
		dialog `You've reached <planet>, but you've left one of the ships you're supposed to be escorting behind. Wait for Turner's ship and all the Bulk Freighters to arrive before landing.`

	on complete
		event "shipyard on greenwater" 180
		conversation
			`	Construction on the shipyard begins almost immediately after the supplies are unloaded from the freighters, starting with the demolition of the rest of the park. A downtrodden-looking crowd gathers to watch the demolition, but Turner assures you that there are plenty of other parks in the city for them to go to.`
			`	"Something big is going to come of this, Captain <last>," Turner says. "Just know that you were all part of it. You'll know the shipyard is done when you find an extra four thousand credits in your pocket each day. Goodbye until then, Captain <last>."`

event "shipyard on greenwater"
	planet "Greenwater"
		shipyard "Basic Ships"
		shipyard "Syndicate Basics"
		shipyard "Megaparsec Basics"
		shipyard "Megaparsec Advanced"
		outfitter "Common Outfits"
		outfitter "Syndicate Advanced"
		outfitter "Lovelace Basics"
	fleet "Small Human Merchants (Hai)"
		add variant 20
			"Sparrow"
		add variant 20
			"Star Barge"
		add variant 20
			"Shuttle"
		add variant 5
			"Freighter"
			"Wasp" 2
		add variant 10
			"Freighter"
			"Shuttle" 2
			"Quicksilver"
		add variant 15
			"Bounder"
			"Wasp" 2
		add variant 5
			"Manta"
		add variant 5
			"Freighter" 2
			"Manta"
	fleet "Large Human Merchants (Hai)"
		add variant 6
			"Freighter (Proton)" 2
			"Quicksilver" 2
		add variant 6
			"Freighter" 4
			"Quicksilver" 2
			"Splinter" 1
		add variant 3
			"Freighter" 4
			"Quicksilver" 2
			"Splinter (Laser)" 1
		add variant 3
			"Freighter" 4
			"Quicksilver" 2
			"Splinter (Proton)" 1

mission "Expanding Business: shipyard complete"
	landing
	invisible
	to offer
		has "event: shipyard on greenwater"
	on offer
		"salary: Turner Incorporated" = 4000
		fail



mission "Hiding in Plain Sight"
	description "Bring Arthur and his Hai friend, Kiru, to <destination> for a gaming convention."
	minor
	source
		government "Hai"
	destination "Vinci"
	passengers 2
	to offer
		random < 30
		has "First Contact: Hai: offered"
	on offer
		conversation
			`While eating in a spaceport cafeteria that serves both Hai and human cuisine, you are approached by a teenage human and Hai. "Hello. Do you know how to get to <destination>?" the Hai asks.`
			choice
				`	"I do. Why do you want to go there?"`
				`	"I don't. You'll have to ask someone else."`
					decline
			`	The human responds, "There's a massive convention on <planet> for a game called 'Boundless Frontiers.' The convention has a huge cosplaying scene, and I think Kiru would fit right in."`
			`	"Arthur and I have <payment> to give you if you bring us to the <planet>," Kiru says. "We can find our own way back to the Hai space, as well."`
			choice
				`	"Alright, I can take you there."`
					accept
				`	"Sorry, you'll have to find someone else to bring you."`
					decline
					
	on visit
		dialog `You look for Arthur and Kiru, but realize that they took a ride on one of your escorts! Better depart and wait for your escorts to arrive in this star system.`
	on complete
		payment 75000
		dialog `Arthur and Kiru pay you <payment> before running off to the convention center. As they run away, you notice that Kiru is drawing a number of eyes from the crowd, but no one seems to suspect that he is an actual alien.`



mission "Hai Honeymoon"
	description "Bring Anaya and Touhar to <destination> for their honeymoon."
	minor
	source "Skyfarm"
	destination "Featherweight"
	passengers 2
	to offer
		random < 60
		has "First Contact: Hai: offered"
	on offer
		conversation
			`You hop around the spaceport of <origin>, trying to adjust to the low gravity of this moon, when you are approached by a toweringly tall human woman and an equally tall Hai male who are clearly having no trouble with <origin>'s gravity.`
			`	"You look like you need help there, Captain," the woman says with a chuckle.`
			choice
				`	"Don't worry. I almost have the hang of it."`
				`	"Maybe a little bit."`
			`	"It's always fun watching captains when they step off the comfort of their ship," the Hai says.`
			`	"At least they're trying, Touhar," the woman says.`
			choice
				`	"Can I help you two with something?"`
				`	"Is there something I can help you with, or are you just going to watch me?"`
			`	"Actually, there is something," the woman says. "My name is Anaya, and this is my husband, Touhar. And you are?"`
			choice
				`	"My name is <first> <last>."`
				`	"Wait, your husband?"`
					goto husband
			
			`	"Very nice to meet you, Captain <last>," Touhar says to you.`
				goto next
			
			label husband
			`	"What, you've never seen an interspecies couple before?" Touhar asks with a hint of sarcasm in his voice.`
			
			label next
			`	"We got married last week, and we were hoping to travel to <destination> for our honeymoon. I know it's risky to bring Touhar into human space, but <planet> is a sparsely inhabited world, and I have a friend who owns a house in the mountains far from anyone who could see him."`
			`	"Said friend will be able to arrange for our return to <origin> as well," Touhar adds. "Will you take us?"`
			choice
				`	"Sure."`
					accept
				`	"Sorry, I can't travel that far from here."`
					decline
					
	on visit
		dialog `You look for Anaya and Touhar, but realize that they took a ride on one of your escorts! Better depart and wait for your escorts to arrive in this star system.`
	on complete
		payment 100000
		dialog `Instead of landing in the spaceport where they can be seen, you drop Anaya and Touhar off as close as you can to where they will be staying. The house is a few kilometers away, but they assure you that they can make it on their own. They pay you <payment> and thank you for bringing them this far.`



mission "Pirate Troubles [0]"
	name "Defend <system>"
	description "A sizable group of pirates has found their way into Hai space and is terrorizing the system. Help the Hai fight back against them."
	source
		near "Waypoint" 2
		government "Hai"
	to offer
		has "First Contact: Unfettered: offered"
		"combat rating" > 1100
		random < 10
	on offer
		conversation
			`The peaceful spaceport is suddenly filled with the harsh sound of sirens. You spot some Hai and a small number of humans running to their ships and speeding quickly into orbit. It appears that the system is under attack, but the Unfettered Hai never reach this far south. A loud speaker begins blaring throughout the spaceport: "Unfettered humans have entered the system in a large fleet and have begun attacking! Requesting all combat-worthy pilots to assist in the defense of our space. These enemies of harmony are not welcome here."`
			branch unfettered
				has "Unfettered: Jump Drive Source: offered"
			`	You find the phrase "unfettered humans" odd, but guess that they may be referring to pirates. The Hai will probably be very gracious if you help, but this could also be an easy way to get yourself killed, especially if a group of pirates is bold enough to attack the Hai.`
				goto choice
			
			label unfettered
			`	Your heart drops at the phrase "unfettered humans," as the last time you heard that was when the Unfettered Hai used that phrase to refer to the Alphas. If it is really the Alphas attacking the Hai, then it is probably a good idea to help.`
			label choice
			choice
				`	(Join the defense fleet.)`
					launch
				`	(Stay here until the fight is over.)`
					decline
	npc
		government "Hai"
		personality staying
		fleet "Large Hai"
	npc
		government "Merchant"
		personality staying
		fleet "Large Human Merchants (Hai)"
	npc evade
		government "Pirate"
		personality staying
		fleet
			names "pirate"
			variant
				"Leviathan" 2
				"Mule" 2
				"Firebird"
				"Headhunter" 3
				"Raven" 3

mission "Pirate Troubles [1]"
	landing
	name "Unfettered Humans"
	description `Track down the leaders of the pirate gang "Scar's Legion" and "persuade" them to stop attacking Hai space, then return to <destination> to tell the Hai.`
	source
		government "Hai"
	destination "Hai-home"
	clearance
	to offer
		has "Pirate Troubles [0]: done"
	on offer
		"reputation: Hai" += 20
		conversation
			`The battle has ended, but the spaceport still seems more hectic than usual. Ships are jumping in from the surrounding systems to help any injured and to repair any damage that may have occurred. After some hours pass and the commotion has died down, a Hai elder approaches you. "We have heard from the humans here that you are considered a seasoned fighter among your people. May you lend your combat prowess to us to resolve this issue?"`
			choice
				`	"I'd be glad to help. What can I do?"`
					goto explain
				`	"What issue?"`
			`	"I understand that you just defended this system from human pirates. That is the issue that needs resolved.`
			label explain
			`	"Human attacks on our systems are very rare, but recently we have experienced an increased number of raids. Not all have been as unsuccessful as this one. We captured a crew member of this most recent attack who was attempting to flee in an escape pod, and he gave us information that a gang that calls themselves 'Scar's Legion' has discovered our territory and is responsible for the recent raids.`
			`	"Unfortunately, he would not tell us where this gang is, or who the leader is, so there is nothing we are able to do about it. Many humans who live peacefully among us told us that you might be capable of assistance, though."`
			choice
				`	"I'll see what I can do."`
					goto yes
				`	"You want me to hunt down Scar's Legion to stop them from attacking you?"`
				`	"Sorry, I'm not interested."`
					decline
			`	"We understand that these humans are likely misguided. We ask that you resolve this peacefully if possible, but the loss of life from these continued attacks is unacceptable."`
			choice
				`	"I'll see what I can do."`
					goto yes
				`	"Sorry, but I'm not interested."`
					decline
			label yes
			`	"Thank you. Please return to <destination> after you have sought to resolve this situation."`
				accept
	on visit
		dialog "You've returned to <planet>, but you haven't yet tracked down Scar's Legion. Perhaps you should ask around the spaceport of pirate planets near the wormhole into Hai space for information."
	to complete
		or
			has "accepted scar's legion tribute"
			has "defeated scar's legion"

mission "Pirate Troubles [1]: Farpoint"
	landing
	invisible
	source "Farpoint"
	to offer
		has "Pirate Troubles [1]: active"
	on offer
		conversation
			`You visit the Navy outpost on <origin> and ask the officers there if they have any information on Scar's Legion. After running a background check on you to make sure you're not up to no good, an officer hands you a copy of a folder containing all the information that the Navy has on the gang. "Nothing in here is classified, so you're free to keep it," the officer says.`
			`	You return to your ships and sift through the files. The leader of the gang is named Scar (to no one's surprise), who used to be an important member of another pirate gang before forming his own. The Navy estimates their numbers to be in the low thousands, mostly responsible for petty crime in the Far North and not a cause of too much trouble, but the files all date back to a number of years ago. Clearly something has changed in the time since these files were last updated if Scar's Legion is now powerful enough to even attempt to attack the Hai.`
				decline

mission "Pirate Troubles [1]: Freedom or Zenith"
	landing
	invisible
	source 
		planet "Freedom" "Zenith"
	to offer
		has "Pirate Troubles [1]: active"
	on offer
		payment -5000
		conversation
			`You wander the <origin> spaceport on the lookout for anyone who might have any information on the whereabouts of Scar's Legion. A self-described fixer promises you information in exchange for payment, but after handing her the few credits that she's asking for, she runs off with her gun in her hands to discourage you from following. Perhaps someone on another nearby pirate planet will have actual information for you.`
				decline

mission "Pirate Troubles [1]: Haven"
	landing
	invisible
	source "Haven"
	to offer
		has "Pirate Troubles [1]: active"
	on offer
		payment -100
		"scar's legion information" ++
		conversation
			`You order a drink from a small rundown bar in the <origin> spaceport and try to make small talk with the bartender to get him open to giving information about Scar's Legion. He seems reluctant at first, but eventually warms up to you. A few other patrons of the bar join in on the conversation. Luckily no one seems mad about you asking about Scar's Legion. One of the patrons makes it clear that Scar's Legion has no friends on this world, "at least not anymore."`
			`	You leave the bar after an hour or two. Once you return to your ship, you write down all the information you can remember. The gang use to operate exclusively out of the Far North until they crossed one of the larger gangs, causing them to flee the region a few years ago. One of the pirates guesses that they fled for the Core.`
			`	Another person mentioned that the leader of the gang used to always talk about making their own base in an uninhabited system where no one would find it. "He always talked about hollowing out an asteroid to use as a hideout. My guess is he was just always high on the ringworld shavings his gang was dealing."`
				decline

mission "Pirate Troubles [1]: Stormhold"
	landing
	invisible
	source "Stormhold"
	to offer
		has "Pirate Troubles [1]: active"
	on offer
		"scar's legion information" ++
		conversation
			`It doesn't take long for you to find someone who knows something about Scar's Legion. You meet someone who says he'll give you information "free of charge."`
			`	"Scar's Legion have been a thorn in my side for months now. Wrecked my ship a while back, and have been causing me trouble ever since. If you're planning on taking them out, then I'll tell you everything you need to know."`
			`	The pirate tells you that he doesn't know where the base of Scar's Legion is, but he mentions that they spend a lot of time in the uninhabited systems of the Far North. "Nothing out there but cold rocks and gas giants, but if they're spending so much time out there then they must have set up a base of some sort on one of those frozen planets."`
				decline

event "scar's hideout"
	system "Danoa"
		object
			sprite star/m4
			period 10
		object
			sprite planet/desert7-b
			distance 168.64
			period 75.3935
		object
			sprite planet/fog0-b
			distance 693.93
			period 629.313
			object
				sprite planet/mercury
				distance 174
				period 15.1961
		object
			sprite planet/gas6
			distance 2069.42
			period 3240.9
			object
				sprite planet/lava1-b
				distance 293
				period 11.3672
			object
				sprite planet/rock0-b
				distance 440
				period 20.9186
			object
				sprite planet/lava2-b
				distance 607
				period 33.895
			object "Scar's Hideout"
				sprite "planet/asteroid base"
				distance 809
				period 52.153

planet "Scar's Hideout"
	attributes uninhabited
	landscape land/loc1
	description "Scar's Hideout is a hollowed out asteroids used by Scar's Legion as their main base of operations. From here they harrass anyone making the journey through the uninhabited systems of the Far North. Recently the gang has discovered the wormhole to Hai space, leading them to start causing trouble for more than just unlucky merchants."
	spaceport "The spaceport of Scar's Hideout is a massive hangar dug into the core of the asteroid, accessible only by a single blast door on the ceiling. Judging by the size of the hangar, you'd guess that about a third of the entire asteroid was hollowed out for the spaceport alone."
	security 0
	government "Scar's Legion"

mission "Pirate Troubles [2]"
	landing
	name "Scar's Legion"
	description "You've pieced together enough information to find out that the Scar's Legion hideout is in one of four systems in the Far North. Search those systems for the gang's hideout and confront them."
	waypoint "Danoa"
	waypoint "Rajak"
	waypoint "Sumar"
	waypoint "Hassaleh"
	to offer
		"scar's legion information" >= 2
	on offer
		event "scar's hideout"
		conversation
			`After having visited various pirate worlds asking about Scar's Legion, you believe that you know where their hideout is.`
			`	You know that the leader of Scar's Legion use to talk about wanting a hollowed out asteroid as a base. You also know that Scar's Legion has recently been very active in the uninhabited systems of the Far North. You conclude that the gang's hideout could is likely an asteroid located in one of a few systems that are in proximity to the wormhole that leads to the Hai. You mark <waypoints> on your map and get ready to confront them.`
				accept
	to complete
		never
	to fail
		has "Pirate Troubles [3]: offered"

government "Scar's Legion"
	swizzle 6
	color .78 0 0
	"player reputation" 10
	"attitude toward"
		"Merchant" -0.01
		"Republic" -0.01
		"Hai" -0.01
	bribe 0
	fine 0
	"hostile hail" "hostile pirate"

government " Scar's Legion "
	"display name" "Scar's Legion"
	swizzle 6
	color .78 0 0
	"player reputation" -1000
	bribe 0
	fine 0
	"hostile hail" "hostile pirate"

event "battle against scar's legion"
	system "Danoa"
		fleet "Human Miners" 1600

event "battle against scar's legion over"
	system "Danoa"
		fleet "Small Northern Merchants" 15000
		fleet "Small Northern Pirates" 5000
		fleet "Large Northern Pirates" 16000
		fleet "Large Republic" 30000
		fleet "Human Miners" 1600

mission "Pirate Troubles [3]"
	landing
	name "Scar's Legion"
	description "Having declined the tribute, the leader of Scar's Legion has challenged you to a fight to the death. Defeat the <npc>, then return to <destination>."
	source "Scar's Hideout"
	destination "Hai-home"
	to offer
		has "event: scar's hideout"
	on offer
		conversation
			`You've located the Scar's Hideout, a massive asteroid in orbit around a gas giant. As you fly over the asteroid's surface, you spot an open blast door. They must be inviting you inside. It surprises you that a gang of pirates would be capable of creating such a base, as the materials and time needed to make something like this are immense.`
			`	Upon entering the blast door, it closes behind you, leaving you in complete dark. Suddenly, floodlights flash on all around your ship. The brightness of the lights prevents you from seeing anyone beyond them, but you suspect that there are a number of weapons pointed at your ship right now.`
			`	"Who are you and what do you want?" a voice booms from a loud speaker. You press a button to activate your ship's external speakers.`
			choice
				`	"I'm <first> <last>, here to negotiate on behalf of the Hai."`
					goto negotiate
				`	"I'm <first> <last>, here to take this gang down."`
			`	The voice laughs. "Well too bad, because you're right in the middle of a hornet's nest. Fire, boys!"`
				goto die
			
			label negotiate
			`	The voice laughs. "Ah, yes. Those squirrels. I take it they've had enough of us plundering their systems. Boys!"`
			`	The floodlights turn off, revealing a large room with what must be hundreds of pirates with guns of various sizes trained on your ship. One wrong move and you're toast. "Please, Captain. Step out of your ship."`
			choice
				`	(Comply with the orders.)`
					goto comply
				`	(Attempt to escape.)`
			`	You activate your ship's engines to escape. The floodlights suddenly reactivate.`
			
			label die
			`	Before you can even react, several dozen lasers and streams of bullets come flying out from behind the floodlights. You attempt to pull your ship up and fly straight through the ceiling before your ship is too damaged to move, but then you spot a number of rockets flying straight at your cockpit. You die instantly as the rockets impact the glass in front of you.`
				die
			
			label comply
			`	You step out of your ship, and a tall man with a scar across his cheek steps forward from the crowd of pirates, presumably the leader of the gang.`
			choice
				`	"The Hai ask that you stop attacking their systems."`
					goto negotiations
				`	"You must be Scar."`
			`	"No. Scar is long dead," the leader says.`
			choice
				`	"Oh, so does that make you Scab?"`
				`	"The Hai ask that you stop attacking their systems."`
					goto negotiations
			`	The leader grimaces. "I'll cut your tongue out if you don't watch your mouth."`
			`	You take a step back. "The Hai ask that you stop attacking their systems," you say, attempting not to get shanked.`
			
			label negotiations
			`	"Perhaps we will stop," the leader says with a smile. "Under one condition. We'd like a one time shipment of various Hai weapons and technology. The shipment should be as big as possible. I've seen the freighters those aliens have. They're massive. Load two or three up with the goods and we'll consider focusing our attention elsewhere."`
			choice
				`	"Okay. I'll meet with the Hai and see what they can provide."`
					goto tribute
				`	"I'm afraid that I can't allow that."`
			`	The crowd of pirates response with a cacophony of jeers and boos. The leader raises his fist in the air, and the crowd falls silent. "Well I'm afraid that just won't do."`
			`	The leader paces back and forth in silence for a moment. "Well if we don't get what we want, then we're just going to need to keep on attacking. Which means that your presence here is pretty useless."`
			`	The leader turns to the crowd. "How about a fight? To the death!" The crowd erupts in cheers. The leader turns back to you. "We fight in this system only. Just you and me. You attempt to run, my men hunt you down. How's that sound?" You attempt to respond, but before you can, the leader pulls his gun and aims it at you. "Run."`
				launch
			
			label tribute
			`	"Excellent!" the pirate says, which is met with cheers from the rest of the pirates in the room. "But make it quick. Wouldn't want to keep us waiting." The blast doors reopen, and you return to your ship to leave immediately.`
				flee
	
	on decline
		set "accepted scar's legion tribute"
	on accept
		event "battle against scar's legion"
	
	npc kill
		government " Scar's Legion "
		personality nemesis
		ship "Leviathan (Hai Weapons)" "Keloid"
		dialog "You've defeated the leader of Scar's Legion. The various spectators to the fight aren't attacking you, but it may only be a matter of time before they decide to turn their guns on you for killing their leader. Better head to <destination> before that happens."
	
	npc
		government "Scar's Legion"
		personality nemesis
		fleet "Small Northern Pirates"
		fleet "Large Northern Pirates" 4
	
	on enter
	on enter
		"reputation: Scar's Legion" = -1000
	
	on visit
		dialog phrase "generic bounty hunting on visit"
		
	on complete
		set "defeated scar's legion"
		event "battle against scar's legion over"

mission "Pirate Troubles [4]"
	landing
	name "Pirate Tribute"
	description "Escort the three Hai freighters carrying Hai weapons and technology to <stopovers>, then escort the freighters back to <destination>."
	source "Hai-home"
	stopover "Scar's Hideout"
	clearance
	to offer
		or
			has "defeated scar's legion"
			has "accepted scar's legion tribute"
	on offer
		"reputation: Hai" += 20
		payment 2500000
		conversation
			`Upon landing on <origin>, the Hai authorities give you <payment> for your assistance in defending their systems and for helping to track down the culprits. You're sent to the council of elders, the elected ruling body of the Hai, to tell them about Scar's Legion. "Please, tell us what has occurred," one of the elders says.`
			branch defeated
				has "defeated scar's legion"
			
			`	"They asked that you load three large freighters with various weapons and technology to give to them. Only then will they stop attacking you."`
			`	"A simple request," the elders says. "Little more than what the Unfettered ask of us. We shall load three Geocoris immediately."`
			`	"Who is to say that they will not use our own weapons against us?" another elder chimes in. "This deal could only hurt us."`
			choice
				`	"There's no guarantee that they will not attack again, but they promised that they would focus elsewhere."`
					goto guarantee
				`	"I could return to them and defeat them if you desire."`
			`	"No," says the elder. "We are not interested in condeming these humans to death if all they ask is for technology."`
			
			label guarantee
			`	"I believe a bigger issue here is how this will impact our human friends beyond the wormhole," an elder says. "If these pirates are not attacking us, then who will they be attacking? Will we not simply become weapons dealers for a far off war?"`
			`	"We will inform the Republic Navy that we are providing these pirates with our technology for our own sake. They have been capable of combating our technology in the past. I am sure that they will be able to handle it now. Please, <first>, escort the freighters to these pirates so that they may leave us alone."`
				accept
			
			label defeated
			`	"I defeated the leader of Scar's Legion. They shouldn't cause any more trouble for you now."`
			`	One of the elders frowns. "Did you kill their leader in cold blood, or was it self defense?"`
			choice
				`	"They asked for a tribute of your weapons and technology, but I refused the offer, so they attacked me."`
					goto refused
				`	"They were not willing to negotiate, and I was forced to defend myself."`
			`	"This is most unfortunate," another elder says. "But I am happy to hear that they will not cause any more loss of life among our people."`
				goto end
			
			label refused
			`	"This is most unfortunate," another elder says. "We would have been willing to provide them the technology they sought if only they had asked nicely in the first place."`
			`	"Better that we eliminate a threat instead of making them stronger through becoming their weapons dealer," the first elder says. "These pirates might have attacked us with our own technology, or worse still, attacked other humans with them, making us complicit in this slaughter."`
			
			label end
			`	The elders thank you for your assistance in this situation and send you on your way.`
				decline
	
	on decline
		"reputation: Hai" += 40
	
	npc save accompany
		government " Hai "
		personality escort
		fleet
			names "hai"
			cargo 10
			variant
				"Geocoris" 3
	
	on stopover
		dialog `You lead the Hai freighters into the blast doors. Despite the massive size of the freighters, they all manage to fit into the asteroid's spaceport with some room to spare, a testament to how much work was put into this base. The pirates of Scar's Legion unload all the Hai technology from the freighters. After the last crate is gone, the freighters quickly launch from the asteroid.`
	
	on visit
		dialog phrase "generic arrived-without-npc dialog"
	
	on complete
		"reputation: Hai" += 40
		payment 500000
		dialog `With the freighters safely returned, the Hai thank you for resolving the situation with Scar's Legion and hand you <payment> for your help.`



mission "Nanachi 1"
	name "Escort Nanachi to <planet>"
	description "Help Nanachi, a Hai who just bought her first ship, make a simple delivery to <destination> by <date>."
	minor
	source "Giverstone"
	destination "Cloudfire"
	deadline
	to offer
		"net worth" > 20000000
		"combat rating" > 1200
		year > 3018
		has "First Contact: Hai: offered"
	on offer
		conversation
			`As you are making your way through the spaceport you notice a worried-looking Hai staring at the local job board and back at some sort of document they are holding.`
			choice
				`	(Approach the Hai.)`
				`	(Leave them alone.)`
					decline
			`	The Hai is a bit startled, but quickly calms down. "Sorry, you caught me by surprise. I've just bought my first ship and need to find some jobs to do, but nobody I've talked to wants to trust a beginner captain. I just don't know what to do anymore, I've been working for so long to qualify for this loan, but I'm running out of time and I'll never be able to pay it like this."`
			`	Turns out the documents she is holding are the bank papers for the loan, somewhat similar to the one you took when you bought your first ship. You've come a long way since your days as a beginner, and know how hard it is to be starting out as a starship captain; you could probably convince someone here to offer a simple cargo job to this young Hai.`
			choice
				`	"If you're interested, I could try to help you find a job."`
					goto "positive1"
				`	"I've been there before; trust me, it gets better. I wish you the best of luck on finding a job."`
			`	She nods in sad understanding, and continues to swap focus from the job board to the papers in her hand.`
			choice
				`	(Help her out anyway.)`
					goto "positive1"
				`	(Leave her alone and continue on.)`
					decline
			label "positive1"
			`	Her ears twitch a bit, and her previously crestfallen eyes light up as she nearly jumps in joy at your offer. "Thank you so much Captain! My name is Nanachi, I promise I won't cause any trouble at all, just a few quick jobs and I'm sure I'll be fine by myself!"`
			`	You introduce yourself to Nanachi and shake her paw. "Can you show me your ship so I can look for jobs it's best suited for?" you ask.`
			`	She hesitates a bit, but leads you to her ship. You were expecting a small Hai ship, but to your surprise she shows you a rather beat-up Heavy Shuttle docked near your own ship.`
			`	"You took a loan to buy a human ship?" you ask.`
			`	She looks at the ground, as if ashamed of it. "It'd take way too long for me to qualify for a loan for even an Aphid, but I recently met a human merchant who wanted to sell his old ship; it was difficult, but I managed to convince him to sell it to me instead of going to the shipyard office. I paid him its full price, but even for this one I had to take out the biggest loan I could. Its cargo hold isn't very impressive but it has more bunks than our smallest ships, if that helps."`
			choice
				`	"Let's see if anyone in the spaceport needs a lift off the planet."`
				`	"Let's take another look at the job board, maybe a smaller job will pop up."`
			`	Turns out this isn't as easy as you thought it'd be. The spaceport is almost empty, save for the occasional worker or drunken crewmember, and the job board is filled with massive hauls of minerals, aside from a few small but dangerous jobs to human space. Eventually, as you two begin scouting the edge of the docking area, you spot a troubled human merchant near several crates. You approach him and he explains that his ship had some malfunctions and he cannot deliver his cargo of advanced surgical equipment to <destination>. "This is the worst! One jump away from the planet and the navigation system suddenly decides to go on strike! There's no way I can make it before the deadline!"`
			`	"My friend Nanachi here could deliver it for you. We were heading there anyway; a few extra crates won't make a difference," you say, trying to sound as convincing as possible.`
			`	At first, he seems delighted that you two want to help him, but when Nanachi mentions that she's flying a Heavy Shuttle, he frowns, and looks back at the cargo. "Unfettered attacks make it so they need tons of medical supplies on <planet>, and quite frankly I'm not comfortable letting such a fragile ship go into dangerous territory carrying this equipment when it could be blasted to bits in an instant," he says. The captain glances around the deserted spaceport for a while, as if trying to find some other captain, before finally turning to Nanachi and saying, "but I guess beggars can't be choosers. Fine, I'll let you take the cargo there, but please be very careful."`
				accept
	npc accompany save
		personality escort timid
		government "Hai"
		ship "Heavy Shuttle" "Acorn Chaser"
	on visit
		dialog `You have reached <planet>, but you left Nanachi's ship behind! Better depart and wait for her to arrive in this star system.`
	on complete
		conversation
			`Shortly after her ship lands, you meet up with Nanachi, who is doing her best to hide her excitement at being on another planet for the first time, and is gawking at some Hai military ships in particular. "So, how did you like your first time doing a hyperspace jump?" you ask, to try and snap her out of it.`
			`	"Oh um, I don't think I'll get used to the feeling anytime soon. I threw up a lot so I'm glad this wasn't a job with passengers. I've always dreamt of being on other worlds, exploring and learning everything about them. I'm glad I'm finally able to do it."`
			`	You help her get the crates out of the cargo hold and contact the client. Nanachi's share of the payment is small, as the client transfers most of the money to the merchant she got the job from, but that doesn't make her any less excited about getting her first paycheck.`
			`	"So, want to go to the spaceport and try to get a job on your own? I'll help you again in case you can't do it yet." you say.`
			`	"Just give me an hour or two to explore. Back home our shipyard is kind of small. I've never really gotten a chance to see a Shield Beetle up close, and there are many undergoing repairs here. I'll just go get a better look at them, I swear I'll be quick."`
			`	You two agree to meet in the spaceport in a few hours; maybe this time she will do fine on her own.`

mission "Nanachi 2"
	name "Escort Nanachi to <planet>"
	description "Bring Nanachi and her passengers to <destination>."
	source "Cloudfire"
	destination "Hai-home"
	clearance
	to offer
		has "Nanachi 1: done"
	on offer
		conversation
			`You meet up with Nanachi in the spaceport, give her some tips to try and persuade someone into hiring her, and tell her you'll be nearby if she still has trouble getting a job. You watch her go around the spaceport and approach some groups of humans and even other Hai to no avail. Maybe since this is a world seeing combat often, they're too busy with military related activites to help a new pilot. She manages to grab the attention of a Hai family leaving a restaurant carrying way too much luggage, most likely tourists looking for a ride back home. Everything seems to be going well until the parents start to look worried. It seems as if they might go away if you don't step in.`
			`	You walk over to the group to help her, and get a better look at the family: a Hai couple carrying a baby, and three older children who aren't doing much to help their father carry their ludicrous number of bags.`
			choice
				`	"Hey, what's going on?"`
				`	"Can I be of assistance?"`
			`	You introduce yourself and the parents tell you that they've been on vacation here and need transport back to <destination>. "Don't take this the wrong way, but Captain Nanachi told us her ship is one of your human ships, a Heavy Shuttle was it? It has enough bunks for us but our sons already caused a ruckus on the way here in a Hai ship, we're worried that since they aren't used to the accommodations, they might end up giving her too much trouble."`
			`	You reassure them that the trip will be very quick, and that the ship's interior is somewhat similar to that of Hai ships, until they finally agree on traveling with her. They settle on the pay and the two of you help the Hai get their baggage to Nanachi's ship. When the family is focused on a conversation, you quietly ask Nanachi what the issue she was having with the other people she encountered.`
			`	"They all seemed willing to give me a job, but I ended up blowing it when I asked for more money. I just really need to get out of debt so I guess I went a bit overboard." She tries to play it cool, but it's clear that she is embarrassed about losing so many potential jobs. When you reach her ship, you take a look at the prices for commodities in <system>. You decide to tell Nanachi to stock up on heavy metals to sell there, to help her make a bit more profit.`
				accept
	npc accompany save
		personality escort timid
		government "Hai"
		ship "Heavy Shuttle" "Acorn Chaser"
	on visit
		dialog `You have reached <planet>, but you left Nanachi's ship behind! Better depart and wait for her to arrive in this star system.`
	on complete
		conversation
			`You help the family gather all their luggage and bid them farewell, but right as they disappear into a hallway Nanachi lets out a heavy sigh. "I bit off more than I could chew. Those kids kept wanting to play with the ship's controls, and one of them tried to go up the air vent in a game of hide-and-seek. I couldn't get any rest since I had to keep making sure they weren't about to dump their own bags into the void by accident."`
			`	"Do you want to get some sleep before trying to find another mission?" you ask, hoping she won't try to overwork herself.`
			`	"Yes, I could really use that. Sorry to make you wait again Captain <last>. I'll rest a bit, see if I can't find a spot nearby to relax, and meet up with you the in spaceport after a while."`

mission "Nanachi 3"
	name "Deliver spices with Nanachi"
	description "Accompany Nanachi to <stopovers> to pick up some Quarg spices for a festival on <destination> by <date>."
	source "Hai-home"
	stopover "Alta Hai"
	destination "Allhome"
	deadline 14
	to offer
		has "Nanachi 2: done"
	on offer
		conversation
			`You send a message to Nanachi and you two meet up in the spaceport. You're still walking toward the job board, when she asks: "Back home I heard stories about how humans have a much larger population than the Hai, and that their home planet has even more people than Hai-home. Is it true that there are many other human worlds with spaceports this large?" You name her a few human planets that are extremely populous, and how even some planets with fewer people than this world have incredibly large spaceports.`
			`	While you tell her stories of many different planets you've visited, she seems to be particularly interested in Earth. "I've seen a bit of human architecture in videos of planets like Allhome, but I can't even imagine what your capital must look like. Tens of thousands of years of another species' history, it sounds even more exciting than what I heard about our landmarks on Hai-home. Captain, do you think that someday, when we no longer need to be kept hidden from humanity, that I'll be able to visit Earth, and see the beauty of your capital?" Seeing how little she knows about humanity, it's not surprising that she is unaware of the state that Earth is in.`
			choice
				`	"I've never actually been to Earth before, so I couldn't tell you what it's like."`
					goto avoid
				`	"Earth is a beautiful place, so it would be nice if you could see it."`
					goto fake
				`	"Earth isn't actually that great a place to visit. Most of its inhabitants would take any chance they're given to leave it."`
					goto truth
			label avoid
			`	"Oh, sorry about that, shouldn't have assumed you knew everything, you're a starship captain after all, not a historian, I'll just ask someone else when I get the chance," says Nanachi.`
					goto board
			label fake
			`	You start making up stories about how beautiful the skies of Earth are. You describe forests teeming with life, and do your best to remember ancient civilizations and their monuments. From the looks of it she believes you, and your lie seems to have sated her curiosity for now. If the day where the Hai are allowed to move around human space ever comes, though, she will no doubt be extremely disappointed.`
					goto board
			label truth
			`	She looks at you in confusion, as if trying to understand what you mean, so you explain it to her. "Despite how much humanity has advanced in the past centuries, Earth has been largely neglected. Most of the land has been turned into cities, which have over the years decayed into slums. If you ever managed to visit you'd be better off going to museums or monuments, but even then there are many thieves roaming the streets and it is very dangerous to be out at night. Lots of folks born there just think about how to get out."`
			`	You keep telling her about the issues facing humanity's birthplace, and her previous eagerness to learn about the planet fades. "How could your ancestors let their own home become like this?"`
			branch unfettered
				has "Ask the Hai about the Unfettered: offered"
			choice
				`	"Long-term planning has never been a strong trait of humanity as a whole."`
					goto end
			
			label unfettered
			choice
				`	"I guess it isn't too unlike how the Unfettered have treated their worlds."`
			`	Nanachi looks confused, so you continue to elaborate on that idea. "They're expecting to be able to have new worlds soon, so they consider the decay of their current ones as acceptable losses. Humans have also had issues with long-term planing and preparing for adverse events."`
					goto end
			label end
			`	"I see..." She says. "I just thought it would be fun to hear about another large planet like Hai-Home. Sorry for asking about it, Captain, I'm sure having to speak of it wasn't a pleasant feeling."`
			`	Although you're sure that even in Hai space there is social inequality, she probably can't fathom that the home planet of a species chould be in such bad shape, considering the Hai even go as far as to send aid to the Unfettered on a regular basis.`
					goto board
			label board
			`	You two reach the job board and decide to start looking for jobs suited for Nanachi's ship.`
			choice
				`	"So, do you mind if I help out? I know the job board can be confusing the first few times you check it."`
				`	"Do you think you need me to help out this time?"`
			`	"Thanks, but I have to do this on my own. I promise I won't mess this up by getting greedy again," She approaches the board on her own, and it becomes clear that it's much easier to get a job here; she's barely started talking to one of the desk workers before receiving a long list of jobs for smaller ships. She is certainly still very tired, but this seems to have cheered her up a bit; it is the first time she can get a job without your help after all.`
			`	While you thought she would've picked one or two jobs quickly and headed back to her ship, she keeps going through them and double checking the information for each one, as if something about them bothers her.`
			`	"What's wrong? Are you struggling to pick between two different jobs?" you ask.`
			`	"These all seem very easy and I could even accept many at a time, but the problem is their pay isn't very good." She grabs some worn papers from her pocket, and shows it to you: they're the documents for her loan. "The bank back home would only give me enough for the ship if I agreed on a short-term loan. I lost two days before you came along to help me, and if I don't get some better paying job soon, I won't even be able to pay the interest."`
			`	As you're trying to figure out a way to get the most out of the available missions, you feel a tap on your shoulder, and turn to see a Hai standing beside a human couple. The couple introduce themselves as Xavier and Vanessa, who are here with their Hai friend Narancia. "We overheard your conversation and are willing to pay a little extra for a job. We're part of a group organizing a big festival in Allhome to celebrate the friendship between humans and Hai, and we just got a last-minute idea: we'd like to get our hands on some Quarg spices."`
			`	Nanachi perks up during their conversation. "I'm sure I can get the spices to <planet> within two weeks. I won't let you down!"`
			`	"That's wonderful," Narancia says. They tell Nanachi that they won't be going along; they already have a transport to Allhome, and will stay here a bit longer to try and advertise the event. "Just come to Allhome after you've picked up the spices. Safe travels!"`
				accept
	on stopover
		dialog
			`A spaceport worker contacted Nanachi shortly before you two landed and made sure the spices were ready to be loaded in her ship. You help the workers and Nanachi make sure everything is in order, and prepare for your trip to Allhome.`
	npc accompany save
		personality escort timid
		government "Hai"
		ship "Heavy Shuttle" "Acorn Chaser"
	on visit
		dialog `You have reached <planet>, but you left Nanachi's ship behind! Better depart and wait for them to arrive in this star system.`
	on complete
		conversation
			`Allhome's docking area shows much more traffic than usual. Many captains here are helping workers open cargo containers full of food, clothes, books, movies and even some mounted animals from human space. You finally meet up with the festival's organizers, who seem very excited to have acquired the exotic condiments, and have invited you two to a bar in the spaceport for a drink.`

mission "Nanachi 4"
	name "Protect Nanachi"
	description "Bring Nanachi's ship to <stopovers>, keeping her safe from a pirate fleet that attacked a convoy heading to Hai space, then head back to <destination> by <date>."
	source "Allhome"
	stopover "Prime"
	deadline 17
	to offer
		has "Nanachi 3: done"
	on offer
		conversation
			`The bar is just as busy as the docks. Many captains here must have transported something for the festival. "Captain <last>, Captain Nanachi!" shouts Narancia, beckoning the two of you to join her and the others at their table. You learn that they were inspired by the Hai's own March festival, and wanted to bring small parts of human culture to Hai space.`
			`	"They can't go to our planets and experience it for themselves yet, so we thought about bringing it to them!" Vanessa says.`
			`	"It was very hard to get enough sponsors for this, but after years of hard work we even managed to have famous art pieces be brought here, some of which date back to the European Renaissance!" Xavier adds.`
			`	Afterwards the conversation topic shifts to you as a captain, as you describe your journey after buying your first ship, and how you met Nanachi. You're about to order another drink for the group when a grizzled old man barges into the bar, and starts shouting: "The art convoy has been attacked! The freighter managed to escape but they're stranded on Prime now, and the pirates are still out there, patrolling the route to the wormhole!"`
			`	Xavier stands up with a shocked expression. "How? We had a Leviathan escorting them!"`
			`	After catching his breath, the man at the door responds. "The pirates must have been stealing Hai tech from ships going back home. The freighter's captain said they shredded the escort!" Chaos spreads amongst the other captains, and the group sitting with you is in anguish.`
			choice
				`	"Are those art pieces really that valuable?"`
				`	"Can't you just postpone the festival until the pirates are taken care of?"`
			`	Xavier collapses back to the table, holding his head in both hands. "Those paintings and sculptures were our main attraction! They're worth tens of billions! It'll take months before the Navy ever notices the pirates there and makes it safe for the convoy to come here. The art exhibition is scheduled three weeks from now!"`
			`	As they try to figure out what to do, Nanachi speaks up. "I'll go there. I pilot a human ship and if we just need to transfer cargo from one ship to the other, I could get out of there quickly. Nobody would notice that a Hai ever went there."`
			`	"Are you insane?" Vanessa says, "If they managed to take down that Leviathan, you wouldn't last a second! Besides, our convoy was extremely fast. If even they were caught your chances of outrunning the pirates are next to nothing!"`
			`	"Captain <last>," Nanachi turns to you. "I know you already helped me way more than anyone would ever be willing to, and I'm really grateful for that, but would you be willing to help me one last time, to get to that planet, and travel back here?" While it's certain that for a pirate fleet to take down a Leviathan so easily they must be incredibly powerful, and this could be extremely dangerous. You're sure that if Nanachi tries to get to Prime by herself she'll just get herself killed.`
			choice
				`	"Alright, I'll make sure we reach Prime and get back here safely."`
				`	"No, I agreed to help you find and deal with some simple jobs, but I can't risk fighting such a fleet by myself."`
					decline
			`	She thanks you profusely, and promises that she'll pay you for everything as soon as she can. The organizers are a bit hesitant, but seeing as no other captain here has decided to offer them help, they agree to let the two of you go to Prime and retrieve the cargo.`
			`	Vanessa grabs ahold of Nanachi's arm before she can run off to the spaceport. "Just remember, if you can't get back here by <day>, don't worry about it; we'll understand. I'm sure we can come up with some alternative to have the festival without our main attractions."`
			`	As you're leaving the bar, Xavier pulls you aside, speaking very quietly, "<last>, I know you're just trying to help this girl, but don't get killed over this. If you run into those pirates don't try to fight them, just rush to Prime."`
				accept
	npc
		personality nemesis waiting
		government "Pirate"
		system "Betelgeuse"
		ship "Marauder Firebird (Hai)" "Nut King Call"
		ship "Marauder Splinter (Hai)" "The Nutcracker"
		ship "Marauder Quicksilver (Hai)" "Hazelnut's Bane"
		ship "Marauder Bounder (Hai)" "Rodent Hunter"
	npc accompany save
		personality escort timid
		government " Hai "
		ship "Heavy Shuttle" "Acorn Chaser"
	on visit
		dialog `You have reached <planet>, but you left Nanachi's ship behind! Better depart and wait for them to arrive in this star system.`
	on stopover
		conversation
			`The convoy's captain messaged you as you entered the system and told you to land on a remote, hidden area of Prime, where they have already prepared for all the cargo to be transferred. They refuel your ships and urge you two to go back. "Captain Nanachi can stay hidden with us here if you need supplies or anything from the outfitter, but please don't take too long."`
	on complete
		event "Nanachi: payment" 180
		conversation
			`Landing back on Allhome, the festival group gives you and Nanachi a warm hug, "We sold tens of thousands of tickets for the festival by promising to host a great art exhibition with pieces from all over human space. Without them it'd be a complete failure, and we'd be in serious trouble with our sponsors." Narancia explains.`
			`	As the cargo is rushed to the exhibition site, Nanachi shows you the chip she got as payment, and the balance of her bank account: this last payment allowed her to fully pay off her loan. "Captain," she speaks with some difficulty, and tries to hide her face, as if to wipe away some tears. "I'll never be able to thank you properly, if not for you I'd still be lost in that spaceport, and would eventually have to go back to my mining job. I'll work hard now; I'll save up and pay you for everything!" She hugs you and bows to you in a way you'd see in movies, as if trying to imitate the gesture. You two finally say goodbye, and head back to your ships.`

event "Nanachi: payment"

mission "Nanachi: Payment"
	landing
	source
		government "Hai"
		not planet "Darkwaste"
	to offer
		has "event: Nanachi: payment"
	on offer
		payment 700000
		event "Nanachi: Update" 720
		conversation
			`Shortly after you land, you get a message from Nanachi, the young Hai pilot who you helped start out. "Dear Captain <last>, I hope you're doing well! As I promised, ever since we parted ways, I've been working towards getting enough money to pay you for being so kind to help me. I've sent you <payment>. I'm deeply grateful to you for helping make my dream come true."`
				decline

event "Nanachi: Update"

mission "Nanachi Meeting"
	landing
	source
		government "Hai"
		not planet "Darkwaste"
	to offer
		has "event: Nanachi: Update"
		random > 30
	on offer
		conversation
			`After you leave your ship and start making your way through the docking area, you notice a Hai running towards you and waving. As they get closer, you realize that it's Nanachi, the Hai pilot who you helped out years ago.`
			`	"I was just about to go back to my crew when I saw you coming out of your ship. I know a nice snack bar here, let's go there!" Before you can even say hello, she's dragged you to the bar, and ordered some drinks for the two of you. She tells you about her last few years as a captain. She has long since sold her old ship, and now pilots a Geocoris, transporting large amounts of cargo across Hai space. You also tell her about how your life has been ever since you last met, of your adventures and how far you've come. You keep swapping stories for hours, until the bar is ready to close.`
			`	You thank her for the drinks, and get ready to say your goodbyes.`
			`	"Oh wait, before you go Captain, let me give you something," she says, right as you're about to head to your ship. She grabs a small pendant from her pocket. "Back home in Giverstone, when I had some free time from the mining works, I took a hobby of sculpting some small stones into ship miniatures. I thought it'd be nice to make this for you in case I saw you again." She gives you the pendant, which has been sculpted into a Hai Shield Beetle. It is extremely well made, with different surface textures representing the different parts of the Shield Beetle. "It's just a good-luck charm I thought you'd like. Thanks again Captain!" You two part ways, and head back to your ships.`
				decline
