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



mission "FW Conservatory 1"
	name "Take Ijs to Winter"
	description "Transport Mr. Eyes and the Andersons to <destination>, where he will be helping to set up a public university."
	source Bourne
	destination Winter
	passengers 3
	to offer
		has "FW Senate 1B: done"
		not "fw conservatory founded"
		not "fw bloodsea done"
	blocked "You meet up with Ijs in the spaceport, but he tells you that you will need three bunks for him and some friends. Return here once you have space available."
	
	on offer
		conversation
			branch "not met andersons"
				not "FW Katya 1: done"
 
			label "met andersons"
			`When you meet Ijs in the spaceport, he has Lynn and Henry Anderson with him, the friends of Katya who you transported from Glory months ago. Ijs is beaming - his meeting must have gone really well. "Guess what, Captain?" he says. "We've got a location for the Conservatory! The government of Winter has offered a community center for our use."`
				goto continue

			label "not met andersons"
			`When you meet Ijs in the spaceport, he has a man and a woman with him which he introduces as Lynn and Henry Anderson. Ijs is beaming - his meeting must have gone really well. "Guess what, Captain?" he says. "We've got a location for the Conservatory! The government of Winter has offered a community center for our use."`
				goto continue

			label continue
			`	"A somewhat run-down community center," adds Henry.`
			`	Ijs laughs. "True. Anyway, we were hoping you could give us a lift over there, and maybe help out with securing some equipment, too."`
			choice
				`	"Sure, I'd definitely like to help make this a reality!"`
					accept
				`	"Sorry, I've got more important business to attend to."`
			`	Ijs seems really dejected. "Are you sure?" he asks. "This could make a big difference for the Free Worlds, as much as any military victory."`
			choice
				`	"Okay, I'll help you."`
					accept
				`	"Sorry, I'm just not interested."`
					decline
	
	on complete
		payment 50000
		dialog `Ijs thanks you for the lift and gives you a credit chip for <payment>. He says, "Next we need to pick up some equipment from Tarazed Corporation. Meet me in the spaceport if you're willing to help out as an escort."`



mission "FW Conservatory 2"
	name "Escort to Wayfarer"
	description "Escort this Free Worlds convoy to Wayfarer, to trade for terraforming equipment provided by Tarazed and the Syndicate."
	source Winter
	destination Wayfarer
	to offer
		has "FW Conservatory 1: done"
		not "fw bloodsea done"
	
	on offer
		conversation
			`In the spaceport, it does not take long to locate Ijs; he is supervising a crew that is loading trade goods onto several Free Worlds ships. "Glad to see you, <first>," he says. "These three ships need to get to Tarazed and back without being destroyed by pirates... or by the Republic. Think you can tag along and protect them?"`
			choice
				`	"Sure thing!"`
					accept
				`	"I've got another pressing mission. Can I come back and do this later?"`
			`	"Sure," he says. "But the longer we wait, the longer it will be until the Conservatory is up and running, so come back soon."`
				defer
	
	npc accompany save
		government Merchant
		personality escort timid
		ship "Argosy" "F.M.S. Daybreak"
		ship "Argosy" "F.M.S. Monsoon"
		ship "Argosy" "F.M.S. Summer"
	
	on visit
		dialog "You have reached <planet>, but you left part of your convoy behind! Better depart and wait for them to arrive in this star system."
	
	npc
		government Pirate
		personality plunders
		system Tarazed
		fleet "Small Southern Pirates"
		fleet "Large Southern Pirates"



mission "FW Conservatory 2B"
	landing
	name "Escort to Winter"
	description "Escort this Free Worlds convoy of terraforming equipment back to Winter."
	source Wayfarer
	destination Winter
	to offer
		has "FW Conservatory 2: done"
		not "fw bloodsea done"
	
	on offer
		conversation
			`Your three escorts land safely on Tarazed. Their cargo is quickly offloaded and exchanged for the terraforming equipment that the Conservatory needs.`
				accept
	
	npc accompany save
		government Merchant
		personality escort timid
		ship "Argosy" "F.M.S. Daybreak"
		ship "Argosy" "F.M.S. Monsoon"
		ship "Argosy" "F.M.S. Summer"
	
	on visit
		dialog "You have reached <planet>, but you left part of your convoy behind! Better depart and wait for them to arrive in this star system."
	
	npc
		government Pirate
		personality plunders
		system "Yed Prior"
		fleet "Small Southern Pirates"
		fleet "Small Southern Pirates"
		fleet "Large Southern Pirates"
		fleet "Large Southern Pirates"
	
	npc
		government Pirate
		personality plunders
		system "Pherkad"
		fleet "Small Southern Pirates"
		fleet "Small Southern Pirates"
		fleet "Large Southern Pirates"
		fleet "Large Southern Pirates"
	
	on complete
		payment 300000
		conversation
			`Ijs meets your convoy as it lands, and checks off each item on a clipboard as it is unloaded. Lynn is with him, looking over the various machines to make sure they are all in working order. "I hope you didn't have any trouble," says Ijs, as he hands you your payment of <payment>.`
			choice
				`	"No, none at all."`
				`	"A few pirates, nothing I couldn't handle."`
				`	"Actually, we were lucky to make it back alive."`
					goto lucky
			`	"Glad to hear it," he says.`
				goto next
			label lucky
			`	"That's too bad," he says. "This war must be making the Dirt Belt even more unstable than usual. Hopefully we'll be able to do something about that soon."`
			label next
			`	"Is there anything else you need me to do?" you ask.`
			`	"Not at the moment," he says. "I'll send you a message when we do. Thanks for your help, and if you hear any more news about Katya, please let me know."`
		event "fw conservatory founded" 30
		log "Helped to transport some items for building a public university and terraforming research center on Winter. Ijs Springborn will be one of the professors."



mission "FW Wolf Pack 1"
	name "Ramscoop Technology"
	description "Travel to <planet> in the Deep, where Free Worlds sympathizers will share details of a new ramscoop technology. (You may have to bribe planets along the way to get permission to refuel.)"
	destination Memory
	clearance
	minor
	to offer
		has "event: catalytic ramscoop available"
		random < 30
		not "event: fw armistice"
	to fail
		has "event: fw armistice"
	source
		government "Free Worlds"
	
	on offer
		conversation
			`When you stop by the spaceport bar, a militia officer who you don't recognize gestures for you to join him. "Captain <last>!" he says. "I'd be honored if you'd let me buy you a drink."`
			choice
				`	"Thank you!"`
					goto drink
				`	"Sorry, I don't drink."`
			`	"Then what are you doing in a bar?" he asks. "Never mind, don't answer that. I assume you're here looking for valuable work to do, and if that's the case, I could really use your help."`
				goto mission
			label drink
			`	He buys you a drink, and you sit down at his table. After making small talk for a few minutes, he says, "By the way, I could really use your help with a mission for the Free Worlds."`
			label mission
			`	"Okay," you say, "tell me more."`
			`	He says, "You probably know that we have a network of Free Worlds sympathizers throughout much of Republic space. One of our contacts recently sent us word of a new technology that is for sale in the Deep, which could be very useful to us. But they have no way to ship it to us, so I need someone who can travel up to the Deep and retrieve it."`
			choice
				`	"Will your contacts also provide me with planets to refuel on along the way?"`
				`	"The Deep is farther away than my fuel tanks can take me."`
			`	"You'll have to bribe some Dirt Belt worlds into letting you land, to get there," he says. "Or, you could wait for the next time there's a ceasefire. But here's the great part: if this works, you won't need to pay any bribes on the way back, because the new technology we're after is a super efficient ramscoop. What do you say?"`
			choice
				`	"Okay, I'll give it a try."`
					accept
				`	"Sorry, this sounds way too risky to me."`
					decline



mission "FW Wolf Pack 1B"
	landing
	name "Ramscoop Technology"
	description "Return to Free space with the plans for a new, more efficient ramscoop, and deliver them to Delta V Corporation on <destination>."
	destination Solace
	to offer
		has "FW Wolf Pack 1: done"
		not "event: fw armistice"
	to fail
		has "event: fw armistice"
	cargo "Ramscoop Data Card" 0
	
	on offer
		conversation
			`You land your ship by night in a private hangar that you assume is owned by one of the elite families on <origin>. Your contact is wearing a black mask over his face. That seems unnecessary to you, but perhaps he is just really enjoying the thrill of being involved in something illegal. He hands you a data card and says, "This contains all the information you will need to build your own catalytic ramscoop. And before you leave, you may also visit our private outfitter and purchase one of your own, if you wish."`
			choice
				`	"Thank you."`
					goto leave
				`	"May I ask who you are and why you sympathize with us?"`
			`	"You can call me... Agent Falco. As to my true identity, naturally you will understand that I cannot divulge it."`
			`	"Of course," you say.`
			label leave
			`	"I wish you the best of luck in your struggle against the evil plutocrats," he says. "May we yet live to see the day when all people live in prosperity and freedom. Farewell, brave insurgent." It is an overly dramatic speech, and sounds like he's been rehearsing it for a while. You respond with what you hope is a properly elegant salute, and he leaves.`
				accept
	
	on complete
		payment 250000
		dialog
			`You deliver the data card with the details of the catalytic ramscoop to the contact you were given in Delta V corporation. "Excellent," she says. "We have been trying to duplicate their work for months, but this will make it much easier." She hands you a credit chip worth <payment>, and says, "We'll contact you when we've begun mass producing the new ramscoops. I hope they will be useful in the conflict ahead."`
		event "fw gets catalytic ramscoop" 24
		log "Helped the Free Worlds gain access to new ramscoop technology that has been developed in the Deep. This should make it significantly easier to travel long distances through unfriendly systems."



mission "FW Wolf Pack 2"
	landing
	name `"Wolf Pack" Recruiting`
	description `A group identifying themselves as the "Free Worlds Wolf Pack" has asked you to visit them on <planet> if you want to aid their work against the Republic.`
	source
		government "Free Worlds"
	destination Solace
	to offer
		has "FW Wolf Pack 1B: done"
		has "event: fw gets catalytic ramscoop"
		not "event: fw armistice"
	to fail
		has "event: fw armistice"
	
	on offer
		conversation
			`Soon after you land on <origin>, you receive an anonymous message. It reads:`
			``
			`Dear Captain <last>,`
			`	Thanks to your assistance, the Delta V engineers have succeeded in duplicating Deep Sky's new ramscoop technology. The ramscoop is one piece in a larger plan we have to shift the tide of this war in favor of the Free Worlds, and to bring about an end to the conflict more quickly. If you are interested in hearing more, please visit <planet>, and our representatives will contact you promptly.`
			`	Sincerely,`
			`		The Free Worlds Wolf Pack`
			``
			`You have never heard of this organization before, but you know that "wolf pack" is pirate slang for a temporary alliance formed for the sake of taking on a target larger than any one band of pirates could handle alone.`
				accept



mission "FW Wolf Pack 2A"
	landing
	name "Attack Food Convoy"
	description "Destroy three Republic freighters in the Sarin system that are carrying food, then report back to <planet> for payment."
	source Solace
	waypoint Sarin
	to offer
		has "FW Wolf Pack 2: done"
		not "event: fw armistice"
	to fail
		has "event: fw armistice"
	
	on offer
		conversation
			`Soon after you land, two men in militia uniforms approach your ship, and tell you they represent the "Wolf Pack." They introduce themselves as Rex and Fido; you're pretty sure those are not their real names.`
			`	Once you are in a private room inside your ship, Rex, who is the younger one, says, "With ramscoop technology, our ships will be able to venture deep into the Dirt Belt. Now, Captain, why do you think the Republic is so determined to hold on to the Dirt Belt, even if it means fighting bloody battles? It's clear that the tax revenue isn't worth it."`
			choice
				`	"Maybe it's just the principle of not ceding territory without a fight."`
				`	"Maybe they want the resources that the Dirt Belt produces?"`
					goto resources
				`	"Maybe to keep a buffer in between our territory and the worlds that really matter to them, like Earth and the Paradise Planets?"`
			`	"That might be part of it," says Rex, "but there is a larger reason."`
				goto map
			label resources
			`	"Precisely," says Rex, "and one resource in particular is more important to them than all the rest combined."`
			label map
			`	The man named Fido, who is older and has a thick beard, spreads out a map on the table. You recognize it as a chart of food prices throughout human space. "Food," says Rex. "The Dirt Belt is the breadbasket of the galaxy. And the Republic is full of teeming, overpopulated worlds that could never hope to feed themselves. If we cut off the supply of food, the Republic will be forced to make peace with us."`
			`	Fido says, "We are proposing a concentrated effort to destroy the freighter convoys that bring food to the richest, most densely populated Republic worlds. When their citizens find themselves lacking basic supplies, they will demand an end to the war."`
			choice
				`	"I'd be glad to join you. That does sound like a much quicker solution than our current policies that the Senate and the Council support."`
					goto join
				`	"You're trying to starve the Republic into submission? Won't that just just add more brutality to a war that has already been far too bloody?"`
			`	"In the short run, perhaps," says Rex. "But think how many lives will be saved - how many bloody battles will be averted - by forcing them to end this war quickly rather than dragging it out across years of time."`
			choice
				`	"I don't buy your argument. If we use such reprehensible tactics to build our new society, the society we build will be as corrupt as the old one."`
				`	"Okay, you've convinced me. What do you want me to do?"`
					goto join
			`	"Very well," says Rex. "Sorry for wasting your time." They leave.`
				decline
			label join
			`	"First, you should buy a ramscoop here, if you haven't got one already," says Rex. "Then, your first target is a convoy of three freighters that will be departing from Big Sky in the Sarin system shortly. There may be escorts, but only the freighters themselves need to be destroyed."`
				accept
	
	npc kill
		government Republic
		system Sarin
		personality timid staying target
		ship "Freighter" "Horn of Plenty"
		ship "Freighter" "Autumn Twilight"
		ship "Freighter" "Bounty Harvest"
		dialog "You have destroyed all the target freighters. Time to report back to the Wolf Pack on Solace."
	
	npc
		government Republic
		system Sarin
		personality heroic staying
		ship "Gunboat (Mark II)" "R.N.S. Atherstone"
		ship "Gunboat (Mark II)" "R.N.S. Tyndale"
	
	on complete
		event "wolf pack 3 ready" 10
		karma --
		payment 200000
		dialog
			`Rex, one of the "Wolf Pack" men you spoke with earlier, meets you in the spaceport and hands you a credit chip for <payment>. "Good work," he says. "We'll contact you when we have another target selected."`
		log "Destroyed a convoy of Republic freighters that was carrying food from the Dirt Belt. The Paradise Worlds cannot grow all the food that they need to feed their populations, so cutting off the flow of supplies from the Dirt Belt will put pressure on them to make peace with the Free Worlds."



event "wolf pack 3 ready"

event "wolf pack gacrux start"
	system Gacrux
		fleet "Small Southern Merchants" 2000
		fleet "Large Southern Merchants" 5000
		fleet "Small Southern Pirates" 2000
		fleet "Large Southern Pirates" 4000
		fleet "Small Republic" 8000

event "wolf pack gacrux end"
	system Gacrux
		fleet "Small Southern Merchants" 2000
		fleet "Large Southern Merchants" 5000
		fleet "Small Southern Pirates" 2000
		fleet "Large Southern Pirates" 4000
		fleet "Small Republic" 2000
		fleet "Large Republic" 3000
		fleet "Navy Surveillance" 1600



mission "FW Wolf Pack 3"
	landing
	name "Attack Food Convoy"
	description "Destroy two Republic bulk freighters in the Gacrux system that are carrying food, then report back to <planet> for payment."
	source
		government "Free Worlds"
	destination Solace
	waypoint Gacrux
	to offer
		has "FW Wolf Pack 2A: done"
		has "event: wolf pack 3 ready"
		not "event: fw armistice"
	to fail
		has "event: fw armistice"
	
	on offer
		dialog
			`You receive another message from the Wolf Pack: "Great work with those freighters, Captain! We've got another target for you, if you're interested: a pair of bulk freighters, which you ought to be able to intercept in the Gacrux system. It's an uninhabited system, so you shouldn't have much interference from the Navy. As before, you only need to destroy the freighters, not any other ships you encounter."`
			`	Every one of these missions you complete will create more animosity between the Republic and the Free Worlds. But on the other hand, they may be right that it's the fastest way to bring this war to a close.`
	
	on accept
		event "wolf pack gacrux start"
	on fail
		event "wolf pack gacrux end"

	npc kill
		government Republic
		system Gacrux
		personality timid staying target
		ship "Bulk Freighter" "Dew of the Morning"
		ship "Bulk Freighter" "Heaven's Blessing"
		dialog "The food convoy has been destroyed. You can now return to Solace."
	
	npc
		government Republic
		system Gacrux
		personality heroic staying
		ship "Protector (Laser)" "R.N.S. Bulwark"
		ship "Protector" "R.N.S. Citadel"
		ship "Protector" "R.N.S. Rampart"
	
	on complete
		event "wolf pack gacrux end"
		event "wolf pack 4 ready" 20
		karma --
		payment 300000
		dialog
			`Once again, Rex from the Wolf Pack meets you soon after your ship lands. This time, he pays you <payment>. "I hope they didn't give you any trouble," he says. "We'll be in touch when there's another target to strike."`
		log "Destroyed an even larger Republic food convoy. They are probably beginning to feel the pressure now, because they have clearly started to divert warships from the front to defend these convoys."



event "wolf pack 4 ready"

event "wolf pack mizar start"
	system Mizar
		fleet "Small Southern Merchants" 1400
		fleet "Large Southern Merchants" 4500
		fleet "Small Republic" 5000
		fleet "Small Southern Pirates" 9000

event "wolf pack mizar end"
	system Mizar
		fleet "Small Southern Merchants" 1400
		fleet "Large Southern Merchants" 4500
		fleet "Small Republic" 1000
		fleet "Large Republic" 1400
		fleet "Small Southern Pirates" 9000
		fleet "Navy Surveillance" 2000



mission "FW Wolf Pack 4"
	landing
	name "Attack Food Convoy"
	description "Destroy a Republic Bactrian freighter in the Mizar system that is carrying food, then report back to <planet> for payment."
	source
		government "Free Worlds"
	destination Solace
	waypoint Mizar
	to offer
		has "FW Wolf Pack 3: done"
		has "event: wolf pack 4 ready"
		not "event: fw armistice"
	to fail
		has "event: fw armistice"
	
	on offer
		dialog
			`You receive another message from the Wolf Pack: "Hello Captain. If nothing else, we've certainly succeeded in getting some of the Navy's ships diverted from the front, to serve as escorts! Your next target, if you're willing to help us again, will be a bit tougher: a Bactrian freighter, probably with Navy escorts. The freighter is passing through the Mizar system. Interested?`
	
	on accept
		event "wolf pack mizar start"
	on fail
		event "wolf pack mizar end"

	npc kill
		government Republic
		system Mizar
		personality timid staying target
		ship "Bactrian" "Golden Fleece"
		dialog "You have eliminated the Bactrian that was carrying food to the Republic. Time to report back to the Wolf Pack and receive your reward."
	
	npc
		government Republic
		system Mizar
		personality heroic staying
		fleet "Large Republic"
			names "republic capital"
			fighters "republic fighter"
			cargo 0
			variant
				"Carrier"
				"Lance" 4
				"Combat Drone" 6
	
	on complete
		event "wolf pack mizar end"
		karma --
		payment 400000
		dialog
			`Rex meets up with you and thanks you for your continued service to the Free Worlds. "If we had a dozen captains as brave as you are," he says, "the war would be over tomorrow." He hands you <payment>, and walks away. You still don't know his real name or who the leaders of the Wolf Pack are, but you are glad to have been able to do something extra to assist the war effort.`
		log "Destroyed a third food convoy. These attacks seem to have succeeded in forcing the Navy to assign capital ships to defend their supply convoys."



mission "FW Stack Core 1"
	name "Escort convoy from Rand"
	description "Freya asked you to stop by Rand if you are able, to help escort a freighter convoy carrying vital supplies for building some exciting new equipment."
	landing
	destination Rand
	to offer
		has "FW Reconciliation Break: offered"
	
	on offer
		conversation
			`You receive a short, encoded message from Freya: "Hi there, Captain! If you happen to be passing by <planet> any time soon, would you mind swinging by there to help escort a freighter convoy? We're working on the development of some exciting new equipment, and the convoy is carrying the supplies we need to complete the project."`
				accept



mission "FWC Stack Core 1"
	name "Escort convoy from Rand"
	description "Freya asked you to stop by Rand if you are able, to help escort a freighter convoy carrying vital supplies for building some exciting new equipment."
	landing
	destination Rand
	to offer
		has "FW Liberate Delta Sagittarii: done"
	
	on complete
		set "FW Stack Core 1: done"



mission "FW Stack Core 1B"
	landing
	name "Escort convoy from Rand"
	description "Freya asked you to escort this convoy carrying vital supplies for building some exciting new equipment, to <destination>."
	source Rand
	destination Solace
	to offer
		has "FW Stack Core 1: done"
	
	on offer
		conversation
			`Following Freya's instructions, you land on <origin> and tell the spaceport quartermaster that you've been assigned to escort a convoy to <planet>. "Ah yes," he says, "the last of their cargo was just made ready yesterday." He leads you to a cluster of landing pads where three Bulk Freighters are parked. "The pirates have not been much trouble lately," he says, "but the cargo is important enough that they wanted an escort anyway." He leaves before you have a chance to ask any questions about what the freighters are carrying.`
				accept
	
	npc accompany save
		fleet
			names "civilian"
			cargo 3
			variant
				"Bulk Freighter" 3
	
	on visit
		dialog "You have reached <planet>, but you left part of your convoy behind! Better depart and wait for them to arrive in this star system."
	
	npc
		government "Republic"
		system Menkent
		personality surveillance
		fleet
			names "republic capital"
			cargo 0
			variant
				"Gunboat" 2
	
	on complete
		event "stack core for sale" 25
		payment 200000
		dialog `You have escorted the convoy safely to its destination. The workers begin unloading some very heavy crates, and one of the freighter captains hands you <payment> and thanks you for your protection.`
		log "The Free Worlds will soon have a new reactor core of their own design available for sale. It probably will not be as advanced as Navy technology, however."



mission "FW Stack Core 1C"
	landing
	minor
	to offer
		has "event: stack core for sale"
	
	on offer
		conversation
			`You receive a message from Freya: "Hello again, Captain! Thanks for your help escorting the materials to Solace. Ever since we developed the Dreadnoughts people have been talking about how badly we need a generator that can meet their energy needs, and that's what Delta V Corporation has been working on. So, take a look next time you're on Solace or one of our other major manufacturing centers. Sorry for the mystery surrounding the cargo, but we didn't exactly want to advertise that a huge shipment of fissionable material was headed for Free Worlds space."`
				decline
