# Copyright (c) 2016 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 "Coalition: First Contact"
	landing
	name "Register with the Heliarchs"
	description "You have been told to travel to the <planet> to register with the rulers of Coalition space and petition them for permission to do business here."
	source
		government "Coalition"
	destination "Ring of Friendship"
	on offer
		"reputation: Coalition" += 10
		"reputation: Heliarch" += 10
		log "Factions" "Coalition" `The Coalition is an alliance of three different alien species living in peace with each other: the Saryds, the Kimek, and the Arachi. On many Coalition worlds, all three species live together in harmony, which is made easier by the fact that each species prefers a very different climate and thus gravitates to different parts of a planet. They are ruled by individuals known as the Heliarchs.`
		conversation
			`This planet seems to be inhabited by at least three different sentient species. First are giant beetles, about a meter tall, who scurry quickly toward your ship and swarm around it, gawking at you, as soon as you land. The second species, even more disturbing than the beetles, are giant spiders. And the third species are centaurs. Not just something vaguely resembling centaurs; they look like they could have stepped right off the page of a story book from ancient Earth.`
			`	One of the spiders walks up to you, stretching its legs to raise its face and many eyes to the level of your own face, and says something to you in a gloopy sort of burbling language that you don't understand. The beetles, meanwhile, are talking to each other in a different language, all clicks and chittering. And the centaur stands quietly at a distance and keeps glancing back toward the spaceport as if waiting for someone.`
			`	And eventually, someone does arrive: a beetle, a spider, and a centaur all wearing yellow armbands and some sort of electric box hanging on a chain around each of their necks. They walk up to you, and the centaur speaks. After a brief delay, the box around its neck says, "In the name of the Heliarchs, who drove out the oppressors, who maintain peace, we the human visitor greet."`
			choice
				`	"Thank you."`
					goto next
				`	"How do you know my language?"`
			`	The spider speaks, and the box around its neck translates. "Our nearest and most recent neighbor you are. The Heliarchs in their great wisdom, all things that come to pass in our region of space, they are aware of."`
			label next
			`	Speaking through its own translation box, the beetle says, "To the seat of the Heliarch government must you go. Once to the Heliarchs you have become known, in many ways to our society, contribute you may."`
			`	The centaur pulls out a map printed on a thin sheet of plastic. You recognize it as a star map of this region. Lines mark out three different territories, and where they meet are three star systems colored yellow. The centaur points to the southernmost of the three. "Where you must go, here it is," it says.`
			choice
				`	"Thank you. I will go there."`
					goto end
				`	"Can you tell me more about yourselves, first?"`
			`	The spider says, "The wise Heliarchs, all your questions they will answer."`
			label end
			`	Eventually the crowd disperses and allows you to visit the spaceport, although no one offers you any jobs or the opportunity to buy anything but basic commodities. Perhaps you need to register with the "Heliarchs" first.`
				accept
	on complete
		"reputation: Coalition" += 10
		"reputation: Heliarch" += 10
		set "known to the heliarchs"
		log "Factions" "Heliarchs" `The Heliarchs are the rulers of Coalition space: apparently not elected, but instead selected by merit from among the citizens of the Coalition in such a way as to ensure that all three species are equally represented. Thousands of years ago, the Heliarchs led their three species to band together and drive the Quarg out of Coalition space. The Heliarch centers of government are the three Quarg ringworlds that they captured in that war. They are the only ones in Coalition space who are allowed to have weapons on their starships, and they act as a sort of police force, maintaining peace between the Coalition species.`
		conversation
			`Your first view of the landing area confirms beyond a doubt that this is a Quarg ringworld, not just an imitation of one. The interior architecture is unmistakable. But no Quarg are present here, only the three species of the Coalition. Soon after you land, a delegation approaches your ship: again, one of each species, but these are wearing golden circlets around their heads. The circlets are not merely decorative, but seem to contain some electronics as well.`
			`	Again, the centaur speaks first. "To our territory, to welcome you we are glad," it says.`
			`	The beetle says, "With our people you may mingle. The beauty of our culture, you may experience."`
			`	The spider adds, "Our people and yours perhaps one day may trade. Perhaps one day the humans our great and free Coalition may join."`
			choice
				`	"Tell me more about your Coalition."`
				`	"Is this a Quarg ringworld? Where are the Quarg?"`
			`	The centaur says, "Like you, our three species once, by the Quarg were ruled. But with each other, connections we made. An alliance we formed, and the oppressors we drove away. For six thousand Earth years now, in prosperity and freedom from Quarg constraint and in friendship with each other we have lived."`
			choice
				`	"The Quarg don't seem that oppressive to me."`
					goto oppressive
				`	"How did you defeat the Quarg?"`
			`	The spider says, "Alone, no species all skills or all knowledge possesses. But when our abilities we combine, powerful we may become. That, the reason is, that the Quarg all species in isolation keep."`
				goto next
			label oppressive
			`	The spider says, "In separate boxes, they each species keep. And in subtle ways, your development and discoveries they limit. And on your technology, restrictions they place."`
			`	The beetle says, "Or, wrong are we? And the jump drive that brought you here, a gift from the Quarg it is? They its secret no longer hoard?" You tell it that the Quarg do indeed refuse to give jump drives to humans, and it says, "Then, prisoners indeed you are."`
			label next
			branch hai
				has "First Contact: Hai: offered"
			choice
				`	"I suppose you may be right about the Quarg."`
					goto end
				`	"Perhaps the Quarg will change their minds in the future."`
			`	The giant beetle considers you gravely. "Hope, we can only," it says.`
					goto end
			label hai
			choice
				`	"I suppose you may be right about the Quarg."`
					goto end
				`	"But, the Quarg do let the humans and the Hai make contact with each other."`
			`	This, apparently, is news to them. You explain to them who the Hai are, and that some humans have made contact with them and are living in their territory. "A second Coalition you are forming!" says the centaur, tapping its hooves on the floor in excitement. "Once again, foiled the Quarg are. A secret way for species to work together, they have overlooked. Great things, from this may come."`
			label end
			`	You talk with them for a while longer, and learn that the centaurs are called "Saryds," and are the oldest of the three species. The beetles are the "Kimek," and come next, and the spiders are called "Arachi," and were the last of the three to discover spaceflight.`
			`	They tell you that the best way to learn more about them is to visit their worlds, and to see for yourself how the three species live in friendship and equality. They also offer to give you jobs to do in their territory, so that you may become a "valuable contributor" to their society.`

mission "Discovered Coalition Space"
	landing
	invisible
	source
		government "Heliarch"
	on offer
		event "label coalition space"
		fail

event "label coalition space"
	galaxy "label saryds"
		sprite "label/saryds"
	galaxy "label kimek"
		sprite "label/kimek"
	galaxy "label arachi"
		sprite "label/arachi"



mission "Coalition: Contributor"
	landing
	name "Return to the <planet>"
	description "Return to the <planet> to see if the Heliarchs will grant you a higher status in the Coalition now that you have been working among them for some time."
	to offer
		"coalition jobs" >= 30
	source
		government "Coalition"
	destination "Ring of Friendship"
	on offer
		conversation
			`A Heliarch agent contacts you soon after you land, and says, "In many useful ways, among us you have been working. The Heliarchs you should petition, and your rights and status among us they may elevate." The agent instructs you to return to the <planet> and petition the Heliarch rulers there.`
				accept
	on complete
		"reputation: Coalition" += 10
		"reputation: Heliarch" += 10
		set "license: Coalition"
		log "Completed a lot of Coalition jobs and received permission to purchase civilian technology and ships."
		log "Factions" "Saryds" `Saryds are an alien species who look suspiciously similar to the centaurs found in early human mythology. They prefer to live on worlds with as much green space as possible, and even their major cities are full of parks and gardens. Most Saryds live in small communes with up to a few dozen of them per house.`
		log "Factions" "Kimek" `The Kimek are large insectoid aliens, and are members of the Coalition. They discovered spaceflight after the Saryds, but before the Arachi. They are intensely social creatures, preferring to live together in massive buildings with thousands of inhabitants, and many of their worlds have populations in the tens of billions, far more than any human world.`
		log "Factions" "Arachi" `The spider-like Arachi were the last of the three Coalition species to discover interstellar travel. Most members of their society owe allegiance to one of the great Arachi "Houses," organizations that are somewhat similar to guilds and that each specialize in one particular form of industry or technology.`
		conversation
			`Once again, when you exit your ship you are met by a member of each of the three Coalition species, wearing the golden circlets that mark them as Heliarchs. "Told we have been," says the Saryd, "that among us with great diligence and commitment, small tasks you have performed."`
			`	The Kimek says, "Those who in our society's prosperity have invested, with our society's technology may be trusted."`
			`	"But," says the Arach, "like all civilians, even citizens, to you our weapons and warships we still cannot sell."`
			choice
				`	"Thank you."`
					goto end
				`	"Why don't you allow civilians to purchase weapons or warships?"`
			`	"For the sake of peace it is," says the Saryd. "The Heliarch military, well trained to use weapons only for defense and only for justice, they are. And to place the needs of the Coalition over the ambitions of their own native species, each one committed is. No such discipline do civilians have."`
			label end
			`	Apparently nothing is for sale here, but they assure you that many Coalition worlds will now grant you access to their shipyards and outfitters.`

#For pre-0.9.7 compatibility
mission "Coalition License Patch"
	invisible
	landing
	to offer
		has "Coalition: Contributor: done"
		not "license: Coalition"
	on offer
		set "license: Coalition"
		fail
