cyoa{ regiondef{

: trade-flee
	choosehuman alive? if
		($ Thegroup .. " is forced to flee the trader camp!" $) +crtext quitmission
	else quit-to-title then
;

// Trading gas for food

0 value gas-to-food-bought

cyoa-choice: trade-gas-food-rob 
	($ cname .. " knocks the man over, grabs a sack of food, and then runs. " $) cyoa-text! badfx
	notsolo if
		($ Theothersare .. " dragged into it." $) +text
	then
	6 10 rnd trunk-food+ rob-guilt
	aholeREV trade-flee
;

cyoa-choice: trade-gas-food-2
	($ Thegroup .. " trades 25 units of gas for 2 food." $) cyoa-text! 3 500 tone
	-25 trunk-gas+ 2 trunk-food+ 2 ' gas-to-food-bought +!
;

cyoa-choice: trade-gas-food-4
	($ Thegroup .. " trades 50 units of gas for 4 food." $) cyoa-text! 3 500 tone
	-50 trunk-gas+ 4 trunk-food+ 4 ' gas-to-food-bought +!
;

cyoa-choice: trade-gas-food-8
	($ Thegroup .. " trades 100 units of gas for 8 food." $) cyoa-text! 3 500 tone
	-100 trunk-gas+ 8 trunk-food+ 8 ' gas-to-food-bought +!
;

cyoa: trade-gas-food
	"Gas to Snacks Conversion" cyoa-title!
	picon	
	($ Thegroup .. " sees a man standing near an SUV." $) cyoa-text!
	gas-to-food-bought 20 < if
		($ "Do you have any spare gas? I'm running out!
		" pbold .. "He offers to give you 2 cans of food for every 25 units of gas." $)
		+crtext gasamt
		choice( "No thanks" )choice
		most-ahole if
			charchoice( " robs him" )choice: trade-gas-food-rob
		then
	else
		clear-cyoa ($ "Thanks for all the gas!" pbold $) +crtext
	then 3 500 tone 
	trunk-gas 25 < if
		($ "Not enough to spare." $) +text
	else
		trunk-gas 99 > gas-to-food-bought 13 < and if
			choice( "Trade 100 gas" )choice: trade-gas-food-8
		then
		trunk-gas 49 > gas-to-food-bought 17 < and if
			choice( "Trade 50 gas" )choice: trade-gas-food-4
		then
		trunk-gas 24 > gas-to-food-bought 19 < and if
			choice( "Trade 25 gas" )choice: trade-gas-food-2
		then
	then
;

// Gas

0 value gas-bought

cyoa-choice: trade-gas-rob 
	($ cname .. " grabs a couple of gas canisters and runs. " $) cyoa-text! badfx
	notsolo if
		($ Theothersare .. " dragged into it." $) +text
	then
	40 70 rnd trunk-gas+ rob-guilt
	aholeREV trade-flee
;

cyoa-choice: trade-gas-5
	($ Thegroup .. " trades 5 food for 50 units of gas." $) cyoa-text! 3 500 tone
	food-5-to-gas 5 ' gas-bought +!
;

cyoa-choice: trade-gas-10
	($ Thegroup .. " trades 10 food for 100 units of gas." $) cyoa-text! 3 500 tone
	food-10-to-gas 10 ' gas-bought +!
;

cyoa-choice: trade-gas-15
	($ Thegroup .. " trades 15 food for 150 units of gas." $) cyoa-text! 3 500 tone
	food-15-to-gas 15 ' gas-bought +!
;

cyoa-choice: trade-gas-all
	($ Thegroup .. " trades " .. ghis .. " remaining food for gas." $) cyoa-text! 3 500 tone
	food-all-to-gas 5 ' gas-bought +!
;

cyoa: trade-gas
	"Gas For Sale" cyoa-title!
	picon	
	($ Thegroup .. " finds a man near a rusted truck. The truck is full of gas tanks and oily rags. Both the man and truck reek of gasoline." $) cyoa-text!
	gas-bought 15 < if
		"He offers to sell 10 units of gas in exchange for every food item he gets." +crtext 
		foodamt
		choice( "No thanks" )choice
		most-ahole if
			charchoice( " robs the trader" )choice: trade-gas-rob
		then
	else
		clear-cyoa "He's all out of gas." +crtext 
	then 3 500 tone 
	// Possibly replace some with weaselest-pass if weaselest
	trunk-food 0 > if
		trunk-food 14 > gas-bought 5 < and if
			choice( "Trade 15 food" )choice: trade-gas-15
		then
		trunk-food 9 > gas-bought 10 < and if
			choice( "Trade 10 food" )choice: trade-gas-10
		then
		gas-bought 15 < if
			trunk-food 4 > if
				choice( "Trade 5 food" )choice: trade-gas-5
			else	
				choice( "Trade " .. trunk-food .. " food" )choice: trade-gas-all
			then
		then
	then
;

// Bullets

0 value bullet-bought

cyoa-choice: trade-bullet-rob 
	($ cname .. " grabs a few boxes of bullets, then runs. The scavenger was lying about not using firearms, and sends some extra bullets towards " .. thegroup .. "." $) cyoa-text! bitefx 50 80 rnd trunk-bullet+
		rob-fail
	aholeREV trade-flee
;

cyoa-choice: trade-bullet-5
	($ Thegroup .. " trades 5 food for 40 bullets." $) cyoa-text! 3 500 tone
	food-5-to-bullet 5 ' bullet-bought +!
;

cyoa-choice: trade-bullet-10
	($ Thegroup .. " trades 10 food for 80 bullets." $) cyoa-text! 3 500 tone
	food-10-to-bullet 10 ' bullet-bought +!
;

cyoa-choice: trade-bullet-15
	($ Thegroup .. " trades 15 food for 120 bullets." $) cyoa-text! 3 500 tone
	food-15-to-bullet 15 ' bullet-bought +!
;

cyoa-choice: trade-bullet-all
	($ Thegroup .. " trades " .. ghis .. " remaining food for bullets." $) cyoa-text! 3 500 tone
	food-all-to-bullet 5 ' bullet-bought +!
;

cyoa: trade-bullet
	"Bullet Surplus" cyoa-title! picon
	($ Thegroup .. " talks to a friendly scavenger who is selling extra bullets. She claims to not use pistols due to how gunshots rile up zombies." $) text!
	bullet-bought 15 < if 
		"She offers 8 bullets for every food item she gets." +crtext foodamt
		choice( "No thanks" )choice
		most-ahole if
			charchoice( " robs the trader" )choice: trade-bullet-rob
		then		
	else
		clear-cyoa "She's fresh out of bullets." +crtext
	then 3 500 tone
	trunk-food 0 > if
		trunk-food 14 > bullet-bought 5 < and if
			choice( "Trade 15 food" )choice: trade-bullet-15
		then
		trunk-food 9 > bullet-bought 10 < and if
			choice( "Trade 10 food" )choice: trade-bullet-10
		then
		bullet-bought 15 < if
			trunk-food 4 > if
				choice( "Trade 5 food" )choice: trade-bullet-5
			else	
				choice( "Trade " .. trunk-food .. " food" )choice: trade-bullet-all
			then
		then
	then
;

// Shotgun Shells

0 value shotgun-shell-bought

cyoa-choice: trade-shotgun-shell-rob 
	($ cname .. " takes a big box of shotgun shells and walks away with it. In a calm and fluid motion, the shell merchant whips out a shotgun and starts blasting." $) cyoa-text! bitefx
		30 40 rnd trunk-shotgun-shell+ rob-fail	aholeREV trade-flee
;

cyoa-choice: trade-shotgun-shell-5
	($ Thegroup .. " trades 5 food for 25 shotgun shells." $) cyoa-text! 3 500 tone
	food-5-to-shotgun-shell 5 ' shotgun-shell-bought +!
;

cyoa-choice: trade-shotgun-shell-10
	($ Thegroup .. " trades 10 food for 50 shotgun shells." $) cyoa-text! 3 500 tone
	food-10-to-shotgun-shell 10 ' shotgun-shell-bought +!
;

cyoa-choice: trade-shotgun-shell-15
	($ Thegroup .. " trades 15 food for 75 shotgun shells." $) cyoa-text! 3 500 tone
	food-15-to-shotgun-shell 15 ' shotgun-shell-bought +!
;

cyoa-choice: trade-shotgun-shell-all
	($ Thegroup .. " trades " .. ghis .. " remaining food for shotgun shells." $) cyoa-text! 3 500 tone
	food-all-to-shotgun-shell 5 ' shotgun-shell-bought +!
;

cyoa: trade-shotgun-shell
	"Shotgun Shell Stand" cyoa-title! picon
	($ Thegroup .. " sees a gruff man near an ice cream truck. The words " .. "ICE CREAM" pbold .. " have been crossed off its sign with " .. "SHOTGUN SHELLS" rbold .. " written in." $) cyoa-text!
	shotgun-shell-bought 15 < if
		"He offers to sell 5 shotgun shells for every food item you give him." +crtext foodamt
		choice( "No thanks" )choice
		most-ahole if
			charchoice( " robs the trader" )choice: trade-shotgun-shell-rob
		then
	else
		clear-cyoa "He's all out of shotgun shells." +crtext
	then 3 500 tone
	trunk-food 0 > if
		trunk-food 14 > shotgun-shell-bought 5 < and if
			choice( "Trade 15 food" )choice: trade-shotgun-shell-15
		then
		trunk-food 9 > shotgun-shell-bought 10 < and if
			choice( "Trade 10 food" )choice: trade-shotgun-shell-10
		then
		shotgun-shell-bought 15 < if
			trunk-food 4 > if
				choice( "Trade 5 food" )choice: trade-shotgun-shell-5
			else	
				choice( "Trade " .. trunk-food .. " food" )choice: trade-shotgun-shell-all
			then
		then
	then
;

// Rifle Shells

0 value rifle-shell-bought

cyoa-choice: trade-rifle-shell-rob 
	($ Thegroup .. "'s robbery attempt ends up messy. The seller has two loaded assault rifles. She fires them wildly, one in each hand, spraying ammo everywhere." $) cyoa-text! bitefx
		40 65 rnd trunk-rifle-shell+ rob-fail aholeREV trade-flee
;

cyoa-choice: trade-rifle-shell-5
	($ Thegroup .. " trades 5 food for 30 rifle ammo." $) cyoa-text! 3 500 tone
	food-5-to-rifle-shell 5 ' rifle-shell-bought +!
;

cyoa-choice: trade-rifle-shell-10
	($ Thegroup .. " trades 10 food for 60 rifle ammo." $) cyoa-text! 3 500 tone
	food-10-to-rifle-shell 10 ' rifle-shell-bought +!
;
cyoa-choice: trade-rifle-shell-15
	($ Thegroup .. " trades 15 food for 90 rifle ammo." $) cyoa-text! 3 500 tone
	food-15-to-rifle-shell 15 ' rifle-shell-bought +!
;

cyoa-choice: trade-rifle-shell-all
	($ Thegroup .. " trades " .. ghis .. " remaining food for rifle ammo." $) cyoa-text! 3 500 tone
	food-all-to-rifle-shell 5 ' rifle-shell-bought +!
;

cyoa: trade-rifle-shell
	"Rifle Ammo Seller" cyoa-title! picon
	($ Thegroup .. " runs into someone selling extra rifle ammo. She says she's frugal with ammo, often killing multiple zombies in one shot." $) text!
	rifle-shell-bought 15 < if
		"She offers to give 6 rifle ammo per food item she gets." +crtext foodamt
		choice( "No thanks" )choice
		most-ahole if
			charchoice( " robs the trader" )choice: trade-rifle-shell-rob
		then
	else
		clear-cyoa "She's run out of rifle ammo." +crtext 
	then 3 500 tone
	trunk-food 0 > if
		trunk-food 14 > rifle-shell-bought 5 < and if
			choice( "Trade 15 food" )choice: trade-rifle-shell-15
		then
		trunk-food 9 > rifle-shell-bought 10 < and trunk-food and if
			choice( "Trade 10 food" )choice: trade-rifle-shell-10
		then
		rifle-shell-bought 15 < if
			trunk-food 4 > if
				choice( "Trade 5 food" )choice: trade-rifle-shell-5
			else	
				choice( "Trade " .. trunk-food .. " food" )choice: trade-rifle-shell-all
			then
		then
	then
;

// Medicine

0 value medical-bought

cyoa-choice: trade-medical-rob 
	($ Thegroup .. " robs the trader but later realizes that everything was just poop medicine for cats. This still has some value, but just barely." $) cyoa-text! badfx
		3 4 rnd trunk-medical+ ' .morale2- foreach-team-char aholeREV trade-flee
;

cyoa-choice: trade-medical-5
	($ Thegroup .. " trades 5 food for 5 medical supplies." $) cyoa-text! 3 500 tone
	food-5-to-medical 5 ' medical-bought +!
;

cyoa-choice: trade-medical-10
	($ Thegroup .. " trades 10 food for 10 medical supplies." $) cyoa-text! 3 500 tone
	food-10-to-medical 10 ' medical-bought +!
;

cyoa-choice: trade-medical-15
	($ Thegroup .. " trades 15 food for 15 medical supplies." $) cyoa-text! 3 500 tone
	food-15-to-medical 15 ' medical-bought +!
;

cyoa-choice: trade-medical-all
	($ Thegroup .. " trades their remaining food for medical supplies." $) cyoa-text! 3 500 tone
	food-all-to-medical 5 ' medical-bought +!
;

cyoa: trade-medical
	"Medicine Salesman" cyoa-title! picon
	($ Thegroup .. " finds a man claiming to be a travelling medicine salesman. He's carrying two suitcases of medical supplies." $) cyoa-text! 
	medical-bought 15 < if
		"He offers one medical item for each item of food." +crtext foodamt
		choice( "No thanks" )choice
		most-ahole if
			charchoice( " robs the trader" )choice: trade-medical-rob
		then
	else
		clear-cyoa "He's now out of medicine to sell." +crtext
	then 3 500 tone
	trunk-food 0 > if
		trunk-food 14 > medical-bought 5 < and if
			choice( "Trade 15 food" )choice: trade-medical-15
		then
		trunk-food 9 > medical-bought 10 < and if
			choice( "Trade 10 food" )choice: trade-medical-10
		then
		 medical-bought 15 < if
			trunk-food 4 > if
				choice( "Trade 5 food" )choice: trade-medical-5
			else	
				choice( "Trade " .. trunk-food .. " food" )choice: trade-medical-all
			then
		then
	then
;

// Healing

cyoa-choice: trade-groupheal-rob 
	($ Thegroup .. " robs the doctor of supplies. The other people in the trading camp swoop in to defend her." $) cyoa-text! bitefx 6 10 rnd trunk-medical+ rob-fail rob-guilt2
		aholeREV trade-flee
;

: trade-groupheal-guy
	cchar damage 0 = if
		($ cname .. " gets a check-up, but there's nothing wrong with " .. chim .. "." $)
	else
		($ cname .. " gets treatment for " .. chis .. " wounds." $) 
	then cchar .fullheal
;

cyoa-choice: trade-groupheal-heal
	trade-groupheal-guy
	cyoa-text! goodfx
	-6 trunk-food+
	clear-cyoa
;

cyoa-choice: trade-groupheal-group
	
	team-damage 0 = if
		($ Thegroup .. " gets a check-up, but there's nothing wrong with them." $) cyoa-text!
	else
		7 groupheal
		($ Thegroup .. " gets treatment for " $) cyoa-text!
		team-damage 1 < if 
			"all" +text 
		else
			"most" +text
		then
			" of their wounds." +text
	then
	goodfx
	trade-train-pay
	clear-cyoa
;

: trade-groupheal-give
	cyoa-start
	solo if
		soloer choosechar trade-groupheal-heal
	then;
	"Who should get the treatment?" cyoa-text!
	' trade-groupheal-heal cyoa-team-choice
;

cyoa-choice: trade-groupheal-charm 
	charmroll if
		($ cname .. " convinces the doctor to offer her services for free!
		" .. cHe .. "'s just that charming." $) cyoa-text! ' camp-charm ++ goodfx
		trade-groupheal-guy +crtext
	else
		($ cname .. " accidentally just comes off as creepy. 
		" .. gHe .. " is asked to leave and never return." $) cyoa-text! badfx
	then clear-cyoa
;

cyoa: trade-groupheal
	"Medical Attention" cyoa-title! picon
	($ Thegroup .. " finds a woman surrounded by medical equipment. She claims to be a skilled doctor!
	She offers to provide health care in exchange for food." $) cyoa-text! 3 500 tone foodamt
	trunk-food 6 < if
		($ "There's not enough food to afford treatment." $) +cr +text
	else
		choice( "Give 6 food for treatment" )choice: trade-groupheal-give
		trunk-food 14 > notsolo and if
			choice( "Give " .. trade-train-amt .. " food for group care" )choice: trade-groupheal-group
		then
	then
		most-charming camp-charm 1 < and if
			charchoice( " uses charm" )choice: trade-groupheal-charm
		then
		most-ahole if
			charchoice( " robs the doctor" )choice: trade-groupheal-rob
		then
		choice( "Leave for now" )choice
;

// All Ammo

0 value allammo-bought

cyoa-choice: trade-allammo-rob 
	($ Thegroup .. " attempts to steal from the big ammo cache. The dog is not happy with this, and it goes" .. " COMPLETELY NUTS" fbold $) cyoa-text! bitefx 50 75 rnd trunk-bullet+ 20 40 rnd trunk-shotgun-shell+ 30 60 rnd trunk-rifle-shell+
		rob-megafail aholeREV trade-flee
;

cyoa-choice: trade-allammo-5
	($ Thegroup .. " trades 5 food for a bit of ammo." $) cyoa-text! 3 500 tone
	food-5-to-allammo 5 ' allammo-bought +!
;

cyoa-choice: trade-allammo-10
	($ Thegroup .. " trades 10 food for a bunch of ammo." $) cyoa-text! 3 500 tone
	food-10-to-allammo 10 ' allammo-bought +!
;

cyoa-choice: trade-allammo-15
	($ Thegroup .. " trades 15 food for an assortment of ammo." $) cyoa-text! 3 500 tone
	food-15-to-allammo 15 ' allammo-bought +!
;

cyoa-choice: trade-allammo-all
	($ Thegroup .. " trades " .. ghis .. " remaining food for some ammo." $) cyoa-text! 3 500 tone
	food-all-to-allammo 5 ' allammo-bought +!
;

cyoa: trade-allammo
	"Ammo Emporium" cyoa-title! picon
	($ Thegroup .. " finds a dog surrounded by a bunch of ammo. The dog speaks:" .. "
	WELCOME TO AMMO EMPORIUM! EVERYTHING MUST GO!" pbold $) cyoa-text!
	allammo-bought 15 < if
		"It offers 5 bullets, 4 rifle ammo, and 3 shotgun shells per food item." +crtext foodamt
		choice( "No thanks" )choice
		most-ahole if
			charchoice( " robs the dog" )choice: trade-allammo-rob
		then
	else
		clear-cyoa "The dog's out of supplies after selling you a heap of ammo!" +crtext
	then 3 500 tone
	trunk-food 0 > if
		trunk-food 14 > allammo-bought 5 < and if
			choice( "Trade 15 food" )choice: trade-allammo-15
		then
		trunk-food 9 > allammo-bought 10 < and trunk-food and if
			choice( "Trade 10 food" )choice: trade-allammo-10
		then
		allammo-bought 15 < if
			trunk-food 4 > if
				choice( "Trade 5 food" )choice: trade-allammo-5
			else	
				choice( "Trade " .. trunk-food .. " food" )choice: trade-allammo-all
			then
		then
	then
;

} }


