# Copyright (c) 2017 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.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <https://www.gnu.org/licenses/>.

mission "Drought Relief"
	name `Drought relief to <planet>`
	job
	repeat
	description `The farming world of <destination> is currently experiencing a drought. Deliver <cargo> to the planet by <date> for <payment>.`
	cargo "drought relief supplies" 25 2 .05
	deadline
	to offer
		random < 10
	source
		government "Republic"
		not attributes "farming"
	destination
		distance 3 10
		attributes "dirt belt"
		attributes "farming"
	on visit
		dialog phrase "generic cargo on visit"
	on complete
		payment 10000 160
		dialog "You drop off your cargo of <commodity> and collect your payment of <payment>. A group of <planet> citizens thank you and bid you farewell."


mission "To Remembrance Day celebration [0]"
	name `Remembrance Day celebration`
	job
	repeat
	description `Bring <fare> to <destination> by <date> for the Remembrance Day celebration on February 19th. Payment is <payment>.`
	passengers 4 4 .5
	deadline
	to offer
		or
			and
				random < 20
				month == 12
				day >= 21
			and
				random < 30
				month == 1
			and
				random < 10
				month == 2
				day < 19
	to fail
		month * 100 + day >= 219
	source
		attributes "dirt belt"
	destination
		distance 3 15
		attributes "dirt belt"
	on visit
		dialog phrase "generic passenger on visit"
	on complete
		payment 1000 180
		dialog "You wish your <passengers> the best of luck on <planet>. The children run off your ship in green face paint, and the parents pay you <payment>."


mission "To Remembrance Day celebration [1]"
	name `Remembrance Day celebration`
	job
	repeat
	description `Deliver <cargo> to <destination> by <date> in preparation for the Remembrance Day celebration on February 19th. Payment is <payment>.`
	cargo random 5 2 .1
	deadline
	to offer
		or
			and
				random < 40
				month == 12
				day >= 21
			and
				random < 60
				month == 1
			and
				random < 20
				month == 2
				day < 19
	to fail
		month * 100 + day >= 219
	source
		attributes "dirt belt"
	destination
		distance 3 15
		attributes "dirt belt"
	on visit
		dialog phrase "generic cargo on visit"
	on complete
		payment 1000 180
		dialog `Spaceport workers already festively dressed for Remembrance Day remove the cargo of <commodity> from your ship and hand you your payment of <payment>.`

mission "To Remembrance Day celebration [2]"
	name `Remembrance Day celebration`
	job
	repeat
	description `Deliver <cargo> to <destination> by <date> in preparation for the Remembrance Day celebration on February 19th. Payment is <payment>.`
	cargo random 5 2 .1
	deadline
	to offer
		or
			and
				random < 40
				month == 12
				day >= 21
			and
				random < 60
				month == 1
			and
				random < 20
				month == 2
				day < 19
	to fail
		month * 100 + day >= 219
	source
		attributes "dirt belt"
	destination
		distance 3 15
		attributes "dirt belt"
	on visit
		dialog phrase "generic cargo on visit"
	on complete
		payment 1000 180
		dialog `Spaceport workers already festively dressed for Remembrance Day remove the cargo of <commodity> from your ship and hand you your payment of <payment>.`


mission "To Remembrance Day celebration [3]"
	name `Remembrance Day celebration`
	job
	repeat
	description `Bring <fare> to <destination> by <date> for the Remembrance Day celebration on February 19th. Payment is <payment>.`
	passengers 20 4 .15
	deadline
	to offer
		random < ( "passenger space" - 30 ) * 2
		or
			and
				random < 20
				month == 12
				day >= 21
			and
				random < 90
				month == 1
			and
				random < 30
				month == 2
				day < 19
	to fail
		month * 100 + day >= 219
	source
		attributes "dirt belt"
	destination
		distance 3 15
		attributes "dirt belt"
	on visit
		dialog phrase "generic passenger on visit"
	on complete
		payment 200000 120
		dialog "You wish your <passengers> the best of luck on <planet>. The children run off your ship in green face paint, and the parents pay you <payment>."


mission "From Remembrance Day celebration [0]"
	name `Return from Remembrance Day`
	job
	repeat
	description `Bring <fare> home to <destination> after the Remembrance Day celebration. Payment is <payment>.`
	passengers 4 4 .5
	to offer
		or
			and
				random < 25
				month == 2
				day > 19
			and
				random < 15
				month == 3
			and
				random < 10
				month == 4
				day < 20
	source
		attributes "dirt belt"
	destination
		distance 3 15
		attributes "dirt belt"
	on visit
		dialog phrase "generic passenger on visit"
	on complete
		payment
		payment 1000
		dialog `Your passengers thank you for returning them to <planet>, and you collect your payment of <payment>.`


mission "From Remembrance Day celebration [1]"
	name `Return from Remembrance Day`
	job
	repeat
	description `Bring <fare> home to <destination> after the Remembrance Day celebration. Payment is <payment>.`
	passengers 4 4 .3
	to offer
		or
			and
				random < 20
				month == 2
				day > 19
			and
				random < 10
				month == 3
			and
				random < 5
				month == 4
				day < 20
	source
		attributes "dirt belt"
	destination
		distance 3 15
		attributes "dirt belt"
	on visit
		dialog phrase "generic passenger on visit"
	on complete
		payment
		payment 1000
		dialog `Your passengers thank you for returning them to <planet>, and you collect your payment of <payment>.`


mission "From Remembrance Day celebration [2]"
	name `Return from Remembrance Day`
	job
	repeat
	description `Bring <fare> home to <destination> after the Remembrance Day celebration. Payment is <payment>.`
	passengers 20 4 .15
	to offer
		random < ( "passenger space" - 30 ) * 2
		or
			and
				random < 60
				month == 2
				day > 19
			and
				random < 30
				month == 3
			and
				random < 15
				month == 4
				day < 20
	source
		attributes "dirt belt"
	destination
		distance 3 15
		attributes "dirt belt"
	on visit
		dialog phrase "generic passenger on visit"
	on complete
		payment 120000 100
		dialog `Your passengers thank you for returning them to <planet>, and you collect your payment of <payment>.`


mission "Food Convoy [0]"
	name `Food convoy to <planet>`
	job
	repeat
	deadline
	description `The captain of the <npc>, leading a small convoy of ships carrying food, will pay you <payment> to escort them to <destination> by <date>.`
	to offer
		random < 30
		"combat rating" > 30
	source
		attributes "dirt belt"
	destination
		distance 2 8
		attributes "near earth" "paradise" "core"
	npc
		government "Pirate"
		personality nemesis harvests plunders
			confusion 20
		system destination
		fleet "Small Northern Pirates"
	npc
		government "Pirate"
		personality nemesis harvests plunders
			confusion 20
		system destination
		fleet "Small Northern Pirates"
	npc
		government "Pirate"
		personality nemesis entering harvests plunders
			confusion 20
		system destination
		fleet "Small Northern Pirates"
	npc
		government "Pirate"
		personality nemesis staying harvests plunders
			confusion 20
		system destination
		fleet "Small Northern Pirates" 2
	
	npc accompany save
		government "Merchant"
		personality escort timid
		"cargo settings"
			commodities "Food"
		fleet
			names "civilian"
			variant
				"Freighter" 3
	on complete
		payment 100000
		dialog "The captain of the <npc> thanks you for escorting their ships safely, and pays you <payment>."
	on visit
		dialog phrase "generic arrived-without-npc dialog"


mission "Food Convoy [1]"
	name `Food convoy to <planet>`
	job
	repeat
	deadline
	description `The captain of the <npc>, leading a convoy of ships carrying food, will pay you <payment> to escort them to <destination> by <date>.`
	to offer
		random < 25
		"combat rating" > 60
	source
		attributes "dirt belt"
	destination
		distance 3 9
		attributes "near earth" "paradise" "core"
	npc
		government "Pirate"
		personality nemesis harvests plunders
		system destination
		fleet "Large Northern Pirates"
	npc
		government "Pirate"
		personality nemesis entering harvests plunders
		system destination
		fleet "Small Northern Pirates"
	npc
		government "Pirate"
		personality nemesis staying harvests plunders
		system destination
		fleet "Large Northern Pirates"
	
	npc accompany save
		government "Merchant"
		personality escort timid
		"cargo settings"
			commodities "Food"
		fleet
			names "civilian"
			variant
				"Behemoth"
				"Freighter" 2
	on complete
		payment 160000
		dialog "The captain of the <npc> thanks you for escorting their ships safely, and pays you <payment>."
	on visit
		dialog phrase "generic arrived-without-npc dialog"


mission "Food Convoy [2]"
	name `Food convoy to <planet>`
	job
	repeat
	deadline
	description `The captain of the <npc>, leading a large convoy of ships carrying food, will pay you <payment> to escort them to <destination> by <date>.`
	to offer
		random < 15
		"combat rating" > 90
	source
		attributes "dirt belt"
	destination
		distance 4 10
		attributes "near earth" "paradise" "core"
	npc
		government "Pirate"
		personality nemesis harvests plunders
		system destination
		fleet "Small Northern Pirates"
		fleet "Large Northern Pirates"
	npc
		government "Pirate"
		personality nemesis entering harvests plunders
		system destination
		fleet "Large Northern Pirates"
	npc
		government "Pirate"
		personality nemesis staying harvests plunders
		system destination
		fleet "Small Northern Pirates"
		fleet "Large Northern Pirates"
	
	npc accompany save
		government "Merchant"
		personality escort timid
		"cargo settings"
			commodities "Food"
		fleet
			names "civilian"
			variant
				"Behemoth" 2
	on complete
		payment 220000
		dialog "The captain of the <npc> thanks you for escorting their ships safely, and pays you <payment>."
	on visit
		dialog phrase "generic arrived-without-npc dialog"
