cyoa{ regiondef{

// if you have to do two things in a foreach-team-char word, use dup between each
// The above was wrong, I had to remove the second dup from everything
: trade-shoot-group! dup .shootingREV .shooting++ ;
: trade-strength-group! dup .strengthREV .strength++ ;
: trade-fitness-group! dup .fitnessREV .fitness++ ;
: trade-medical-group! dup .medicalREV .medical++ ;
: trade-mechanic-group! dup .mechanicREV .mechanic++ ;

: trade-train-amt team-count 3 * 3 + ; 
// tried to use numhums instead of team-count but it didn't work right. The option wouldn't appear for group training.
: trade-train-pay? trunk-food trade-train-amt 1 - > notsolo and ; // previously notsolo and
// numhums 1 > was tried for above but made it buggy
: trade-train-pay trade-train-amt -1 * trunk-food+ ;

0 value camp-charm

cyoa-choice: cyoa-fire-rest
	someicon clear-cyoa "A day passes in the trading camp." text!
	road{ dailyheal } 3 500 tone
	($ Thegroup .. " is able to get some much needed rest." $) +crtext
	team-count -2 *  LOOT_FOOD trunk.loot+ road{ 1 calendar-day+ } sleep 
	' .morale++ foreach-team-char o'clock@ 3 6 rnd + o'clock
;

cyoa: cyoa-fire
	"Trader's Campfire" cyoa-title!
	"The fire is very welcoming." text!
	($ Thegroup .. " could stay in this camp for a day to rest and check wounds, if you can spare the time and food." $) +crtext
	choice( "No time to rest" )choice
	trunk-food team-count 2 * 1 - > if
		choice( "Rest for a day" )choice: cyoa-fire-rest
	then
;

// NOTE: Do innkeeper here too

// Shooting

cyoa-choice: trade-shoot-charm 
	charmroll if
		($ cname .. " gets FREE training with firearms! " .. cHe .. " already feels like a steadier shot." $) cyoa-text! 
		cchar .shooting@ 5 > if 
			($ "It didn't actually help " .. chis .. " shooting, but it was FREE!" $) +crtext
		then 
		shootingREV shooting++ ' camp-charm ++ goodfx
	else
		($ cname .. " accidentally just comes off as creepy. 
		" .. gHe .. " is asked to leave." $) cyoa-text! badfx
	then clear-cyoa
;

cyoa-choice: trade-shoot-train
	cchar .shooting@ 6 < if
		($ cname .. " learns some new tricks with firearms! Zombies beware." $) goodfx
	else
		($ cname .. " didn't really learn anything new. " .. cHe .. " had already picked up these tricks on " .. chis .. " own." $) badfx
	then cyoa-text!
	-6 trunk-food+
	shootingREV shooting++
	clear-cyoa
;

cyoa-choice: trade-shoot-group
	($ "The entire group gets firearms training!" $) cyoa-text! goodfx
	trade-train-pay someicon
	' trade-shoot-group! foreach-human-char
	clear-cyoa
;

cyoa: trade-shoot-give
	solohuman if
		choosehuman trade-shoot-train
	then;
	"Who should get the training in firearms handling?" cyoa-text!
	' trade-shoot-train cyoa-human-choice
;

cyoa-choice: trade-shoot-coolit
	cpet? if
		($ cname .. " farts really loudly at the firearms coach, and then rolls around." $)
	else
		($ cname .. " quips " .. "SAY IT DON'T SPRAY IT" pbold .. " to the firearms coach." $) 
	then cyoa-text!
	cool-it-7 if
		($ "A miracle happens: she decides to not shoot!
		" .. "You seem like you need all the help you can get..." pbold .. "
		She teaches her secret gun tricks to " .. cname .. "!" $) +crtext goodfx
		3 for shooting++ next cooled-it clear-cyoa
	else cool-it++
		($ "Her reaction is brief disgust." .. "
		Oh. Yeah, ok. You're one of those types, huh?" pbold .. "
		She alerts the rest of the camp that " .. cname .. " is a huge dingus, and " .. ghe .. " is forced to leave." $) +crtext badfx quitmission
	then shootingREV
;

cyoa: trade-shoot
	"Firearms Coach" cyoa-title!
	($ "This rifle-wielding woman claims she used train others in competitive shooting. 
	She is selling tips for keeping your aim steady and multiple target trick shots. " .. "Zombies are slow moving targets. It's real easy!" pbold $) cyoa-text! 3 500 tone foodamt
	trunk-food 6 < if  
		($ "This isn't enough food to buy training." $) +cr +text
	else
		choice( "Give 6 food for training" )choice: trade-shoot-give
		trade-train-pay? if
			choice( "Give " .. trade-train-amt .. " food for group training" )choice: trade-shoot-group
		then
	then
		most-charming camp-charm 1 < and if
			charchoice( " uses charm" )choice: trade-shoot-charm
		then
		most-grating if 
			charchoice( ": SAY IT DON'T SPRAY IT" fcoolit )choice: trade-shoot-coolit
		then
		choice( "Leave for now" )choice
;

// Strength - Made this one a little different for Jon's request
// Can adjust it to cut out different things if you have all options available, currently you lose the option to just "Drive Away" in that case.

cyoa-choice: trade-strength-pose 
	cchar .strength 6 > if
		($ cname .. " flexes once, using only half effort. But the contest is already decided.
		" .. "IMPOSSIBLE! THIS IS IMPOSSIBLE!" fbold .. " shrieks the Strength Trainer, in a strangely high-pitched voice.
		" .. "ARE YOU 'THE SWOLE THAT WAS PROMISED'?" fbold .. " and then he turns into stone and, moments later, shatters into a million fragments." $) cyoa-text! goodfx
		morale2+
	then;
	strengthroll if
		($ cname .. " wins the pose-off!" $) cyoa-text! goodfx
		cpet? if
			"It was pretty hard to win a flexing competition as an animal!" +crtext
		then
		strengthREV strength++ morale++
	else
		($ cname .. " loses the pose-off. 
		" .. cHe .. " feels " .. "GREAT SHAME." rbold $) cyoa-text! badfx
		morale2-
	then clear-cyoa
;

cyoa-choice: trade-strength-charm 
	charmroll if
		($ cname .. " gets FREE strength training! " .. cHe .. " already clearly feels a 'pump', as the bodybuilders used to say before they were all wiped out." $) cyoa-text!
		cchar .strength@ 5 > if 
		($ "It didn't actually improve " .. chis .. " strength, but it was FREE!" $) +crtext
		then
		strengthREV strength++ ' camp-charm ++ goodfx
		
	else
		($ cname .. " accidentally just comes off as creepy. 
		" .. gHe .. " is asked to leave." $) cyoa-text! badfx
	then clear-cyoa
;

cyoa-choice: trade-strength-train
	cchar .strength@ 6 < if
		($ cname .. " gets all pumped up from the strength training regiment!" $) goodfx
	else
		($ cname .. " was not impressed with that dinky little workout. " .. cHe .. " needs to find a better routine!" $) badfx
	then cyoa-text!
	-6 trunk-food+
	strengthREV strength++ clear-cyoa
;

cyoa-choice: trade-strength-group
	($ "The entire group gets strength training!" $) cyoa-text! goodfx
	trade-train-pay someicon
	' trade-strength-group! foreach-human-char clear-cyoa
;

cyoa: trade-strength-give
	solohuman if
		choosehuman trade-strength-train
	then;
	"Who should get this INTENSE strength workout?" cyoa-text!
	' trade-strength-train cyoa-human-choice
;

cyoa-choice: trade-strength-coolit
	cpet? if
		($ cname .. " farts really loudly at the strength trainer." $)
	else
		($ cname .. " quips " .. "SAY IT DON'T SPRAY IT" pbold .. " to the strength trainer." $) 
	then cyoa-text!
	cool-it-7 if
		($ "YEAH! THAT'S THE ATTITUDE YOU NEED TO MAKE IT AS A TOP BODYBUILDER! WE WILL REBUILD THE SPORT! YEAH!" fbold .. "
		He takes " .. cname .. " on as his top student, to get HUGE at a mind destroying pace!" $) +crtext  goodfx 3 for strength++ next cooled-it clear-cyoa
	else cool-it++
		($ "He doesn't take this well." .. "
		GET OUT OF HERE YOU DWEEBUS! YOU DON'T DESERVE TO GET HUGE!" fbold .. "
		He continues yelling until " .. thegroup .. " leave the trading camp." $) +crtext badfx quitmission
	then strengthREV
;

cyoa: trade-strength
	"Strength Trainer" cyoa-title!
	($ "It's an old but fit man in matching gray sweatpants and sweatshirt. He screams something about " .. "BUILDING MASS AND BULK" fbold .. " with an " .. "INTENSE STRENGTH ROUTINE!" fbold .. "
	He flails towards some heavy objects lying around." $) cyoa-text! 3 500 tone foodamt
	trunk-food 6 < if
		($ "Sadly, this isn't enough food to get huge." $) +cr +text
	else
		choice( "Give 6 food for training" )choice: trade-strength-give
		trade-train-pay? if
			choice( "Give " .. trade-train-amt .. " food for group training" )choice: trade-strength-group
		then
	then
		most-charming camp-charm 1 < and if
			charchoice( " uses charm" )choice: trade-strength-charm
		then
		strongest .strength 3 > if
			strongest charchoice( " declares a pose off!" )choice: trade-strength-pose
		then
		most-grating if 
			charchoice( ": SAY IT DON'T SPRAY IT" fcoolit )choice: trade-strength-coolit
		then
		choice( "Leave for now" )choice
;

// Fitness

cyoa-choice: trade-fitness-charm 
	charmroll if
		($ cname .. " gets FREE fitness training! " .. cHe .. " sweats from the intense exercise!" $) cyoa-text! 
		cchar .fitness@ 5 > if 
			($ "It didn't actually improve " .. chis .. " fitness, but it was FREE!" $) +crtext
		then
		goodfx fitnessREV fitness++ ' camp-charm ++
	else
		($ cname .. " accidentally just comes off as creepy. 
		" .. gHe .. " is asked to leave." $) cyoa-text! badfx
	then clear-cyoa
;

cyoa-choice: trade-fitness-train
	cchar .fitness@ 6 < if
		($ cname .. " works up a huge sweat from the fitness routine!" $) goodfx
	else
		($ cname .. " didn't even break a sweat! The Fitness Instructor is confused, even she got a little tired." $) badfx
	then cyoa-text!
	-6 trunk-food+
	fitnessREV fitness++ clear-cyoa
;

cyoa-choice: trade-fitness-group
	($ "The entire group gets fitness training!" $) cyoa-text! goodfx
	trade-train-pay someicon
	' trade-fitness-group! foreach-human-char clear-cyoa
;

cyoa: trade-fitness-give
	solohuman if
		choosehuman trade-fitness-train
	then;
	"Who wants strenuous exercise for the sake of fitness?" cyoa-text!
	' trade-fitness-train cyoa-human-choice
;

cyoa-choice: trade-fitness-coolit
	cpet? if
		($ cname .. " farts in a high pitch at the fitness instructor." $)
	else
		($ cname .. " quips " .. "SAY IT DON'T SPRAY IT" pbold .. " to the fitness instructor." $) 
	then cyoa-text!
	cool-it-7 if
		($ "That's what I like to hear! You're ready for the MIRACLE FITNESS ROUTINE!" pbold .. "
		It's likely that she just heard " .. cname .. " wrong. An incredible, cutting edge series of calisthenics follows." $) +crtext goodfx 3 for fitness++ next cooled-it clear-cyoa
	else cool-it++
		($ "Her reaction is mostly disappointment." .. "
		Yeah, well, have fun getting eaten by zombies." pbold .. "
		She jogs backwards until she's out of sight. " .. Thegroup .. " is so embarassed by this that " .. gtheyare .. " forced to leave the camp." $) +crtext badfx quitmission
	then fitnessREV
;

cyoa: trade-fitness
	"Fitness Instructor" cyoa-title!
	($ "This woman is decked out in sweat bands, limb warmers, and garish exercise clothes.
	" .. "Only the fittest will survive in this zombie filled world! I can help you get fit, fast!" pbold .. "
	She's been continuously running in place this whole time." $) cyoa-text! 3 500 tone foodamt
	trunk-food 6 < if
		($ "Sadly, this isn't enough food for fitness." $) +cr +text
	else
		choice( "Give 6 food for training" )choice: trade-fitness-give
		trade-train-pay? if
			choice( "Give " .. trade-train-amt .. " food for group training" )choice:  trade-fitness-group
		then
	then
		most-charming camp-charm 1 < and if
			charchoice( " uses charm" )choice: trade-fitness-charm
		then
		most-grating if 
			charchoice( ": SAY IT DON'T SPRAY IT" fcoolit )choice: trade-fitness-coolit
		then
		choice( "Leave for now" )choice
;

// Medical

cyoa-choice: trade-medical-charm 
	charmroll if
		($ cname .. " gets FREE medical training!" $) cyoa-text! 
		cchar .medical@ 5 > if 
			($ "It didn't actually improve " .. chis .. " medical knowledge, but it was FREE!" $) +crtext
		then		
		goodfx medicalREV medical++ ' camp-charm ++
	else
		($ cname .. " accidentally just comes off as creepy, even by the standards of the EZ Medical College: Creepy Murder Van Campus. 
		" .. gHe .. " is asked to leave." $) cyoa-text! badfx
	then clear-cyoa
;

cyoa-choice: trade-medical-train
	cchar .medical@ 6 < if
		($ cname .. " learns new things about emergency medical care from the knowledgeable filth-man." $) goodfx
	else
		($ "Although the filthy professor was a great teacher, " .. cname .. " didn't learn anything new." $) badfx
	then cyoa-text!
	-6 trunk-food+
	medicalREV medical++ clear-cyoa
;

cyoa-choice: trade-medical-group
	($ "The entire group gets medical training!" $) cyoa-text! goodfx
	trade-train-pay someicon
	' trade-medical-group! foreach-human-char clear-cyoa
;

cyoa: trade-medical-give
	solohuman if
		choosehuman trade-medical-train
	then;
	"Who should get the medical training?" cyoa-text!
	' trade-medical-train cyoa-human-choice
;

cyoa-choice: trade-medical-coolit
	cpet? if
		($ cname .. " somehow manages to say something like SAY IT DON'T SPRAY IT in a weird animal voice." $)
	else
		($ cname .. " quips " .. "SAY IT DON'T SPRAY IT" pbold .. " to the overalls man." $) 
	then cyoa-text!
	cool-it-7 if
		($ "He nods with sage wisdom. Maybe he misheard " .. chim .. "? He proceeds to teach incredible zombie survival medical techniques the likes of which have never been seen." $) +crtext goodfx 3 for medical++ next cooled-it clear-cyoa
	else cool-it++
		($ "*YOU* DON'T SAY IT OR SPRAY IT! AAAAAAAARGH!" rbold .. "
		He is infuriated! " .. thegroup .. " is forced to leave the camp." $) +crtext badfx quitmission
	then medicalREV
;

cyoa: trade-medicalt
	"EZ Medical College" cyoa-title!
	($ Thegroup .. " discovers an unsettling and filthy van. It has a sign that says " .. "EZ MEDICAL COLLEGE" rbold .. " hanging crookedly on the back door.
	Inside is an unsettling and filthy dude in overalls. " .. "WELL? WHO WANTS TO LEARN ABOUT SURGERY?" pbold $) cyoa-text! 3 500 tone foodamt
	trunk-food 6 < if
		($ "This isn't enough food to learn about surgery." $) +cr +text
	else
		choice( "Give 6 food for training" )choice: trade-medical-give
		trade-train-pay? if
			choice( "Give " .. trade-train-amt .. " food for group training" )choice:  trade-medical-group
		then
	then
		most-charming camp-charm 1 < and if
			charchoice( " uses charm" )choice: trade-medical-charm
		then
		most-grating if 
			charchoice( ": SAY IT DON'T SPRAY IT" fcoolit )choice: trade-medical-coolit
		then
		choice( "Leave for now" )choice
;

// Mechanical

cyoa-choice: trade-mechanic-charm 
	charmroll if
		($ cname .. " gets FREE training in the art and science of anti-zombie engineering!" $) cyoa-text! 
		cchar .mechanical@ 5 > if 
			($ "It didn't actually improve " .. chis .. " mechanical skill, but it was FREE!" $) +crtext
		then		
		goodfx mechanicREV mechanic++ ' camp-charm ++
	else
		($ cname .. " accidentally just comes off as creepy. 
		" .. gHe .. " is asked to leave." $) cyoa-text! badfx
	then clear-cyoa
;

cyoa-choice: trade-mechanic-train
	cchar .mechanical@ 6 < if
		($ cname .. " gets a crash course in repair, effective barricades, and other anti-zombie engineering!" $) goodfx
	else
		($ cname .. " didn't learn anything new. " .. cHe .. " was already aware of all the stuff the mechanic could teach." $) badfx
	then cyoa-text!
	-6 trunk-food+
	mechanicREV mechanic++ clear-cyoa
;

cyoa-choice: trade-mechanic-group
	($ "The entire group gets mechanic training!" $) cyoa-text! goodfx
	trade-train-pay someicon
	' trade-mechanic-group! foreach-human-char clear-cyoa
;

cyoa-choice: trade-mechanic-coolit
	cpet? if
		($ cname .. " farts really loudly at the mechanic, in a low pitch." $)
	else
		($ cname .. " quips " .. "SAY IT DON'T SPRAY IT" pbold .. " to the mechanic." $) 
	then cyoa-text!
	cool-it-7 if
		($ "She finds this hilarious! Delighted, the mechanic pledges to give " .. cname .. " an intense crash course in absolutely everything she knows." $) +crtext 3 for medical++ next cooled-it clear-cyoa goodfx
	else cool-it++
		($ "She responds to this by digging into her pockets for a bolt, then throwing it at " .. cname .. ". She continues doing this, not saying a word, until " .. thegroup .. " is forced to leave the camp." $) +crtext badfx quitmission
	then mechanicREV
;

cyoa: trade-mechanic-give
	solohuman if
		choosehuman trade-mechanic-train
	then;
	"Who should get the mechanic's training?" cyoa-text!
	' trade-mechanic-train cyoa-human-choice
;

cyoa: trade-mechanic
	"Mechanic Savant" cyoa-title!
	($ Thegroup .. " meets a woman wearing oil stained coveralls.
	" .. "I can help you get better at repairing stuff. It's a real handy skill. Might save your life." pbold .. "
	A high mechanic skill lets you fix your car." $) cyoa-text! 3 500 tone foodamt
	trunk-food 6 < if
		($ "This isn't enough food to afford training." $) +cr +text
	else
		choice( "Give 6 food for training" )choice: trade-mechanic-give
		trade-train-pay? if
			choice( "Give " .. trade-train-amt .. " food for group training" )choice:  trade-mechanic-group
		then
	then
		most-charming camp-charm 1 < and if
			charchoice( " uses charm" )choice: trade-mechanic-charm
		then
		most-grating if 
			charchoice( ": SAY IT DON'T SPRAY IT" fcoolit )choice: trade-mechanic-coolit
		then
		choice( "Leave for now" )choice
;

} }


