gstats{

: trait1-unlocktally
	0
	trait-specialist 0 > if 1 else 0 then +
	trait-travellight 0 > if 1 else 0 then +
	trait-grappler 0 > if 1 else 0 then +
	trait-herotype 0 > if 1 else 0 then +
	trait-animefan 0 > if 1 else 0 then +
	trait-soundsleep 0 > if 1 else 0 then +
	trait-cityseek 0 > if 1 else 0 then +
	trait-tinyeat 0 > if 1 else 0 then +
	trait-gourmand 0 > if 1 else 0 then +
	trait-phoenix 0 > if 1 else 0 then +
	trait-fireproof 0 > if 1 else 0 then +
;

: trait1-unlockcalc
	// Total number of perks, subtracted by total number of perks that are above 0
	11 trait1-unlocktally -
;

: trait1-remaining
	trait1-unlockcalc 0 > if ($ " UNLOCKS LEFT: " pbold .. trait1-unlockcalc $) +text then
;

: trait1-stockleft
	trait1-unlockcalc
;

}

(*
cyoa: trait1--buy
	"ooo" cyoa-title!
	"Specialist" "trait-" trait-buy! ;
cyoa-blank: trait1-specialist
	"Specialist" _COST ' trait1--buy ' trait1back trait-confirm! ;
*)
	
cyoa: trait1-specialist-buy
	"SPECIAL OPS MORE LIKE SPECIAL PLOPS" cyoa-title!
	"Specialist" "trait-specialist" trait-buy! ;
cyoa-blank: trait1-specialist
	"Specialist" SPECIALIST_COST ' trait1-specialist-buy ' trait1back trait-confirm! ;

cyoa: trait1-travellight-buy
	"LESS GUNNING MORE RUNNING" cyoa-title!
	"Travel Light" "trait-travellight" trait-buy! ;
cyoa-blank: trait1-travellight
	"Travel Light" TRAVELLIGHT_COST ' trait1-travellight-buy ' trait1back trait-confirm! ;
	
cyoa: trait1-herotype-buy
	"BODYGUARD OUTFIT NOT INCLUDED" cyoa-title!
	"Hero Type" "trait-herotype" trait-buy! ;
cyoa-blank: trait1-herotype
	"Hero Type" HEROTYPE_COST ' trait1-herotype-buy ' trait1back trait-confirm! ;
	
cyoa: trait1-grappler-buy
	"THROWING ZOMBIES LIKE THEY'RE CHAIRS" cyoa-title!
	"Grappler" "trait-grappler" trait-buy! ;
cyoa-blank: trait1-grappler
	"Grappler" GRAPPLER_COST ' trait1-grappler-buy ' trait1back trait-confirm! ;

cyoa: trait1-animefan-buy
	"ANIME IS THE ULTIMATE WEAPON" cyoa-title!
	"Anime Fan" "trait-animefan" trait-buy! ;
cyoa-blank: trait1-animefan
	"Anime Fan" ANIMEFAN_COST ' trait1-animefan-buy ' trait1back trait-confirm! ;
	
cyoa: trait1-soundsleep-buy
	"SLEEPING THROUGH THE APOCALYPSE" cyoa-title!
	"Sound Sleeper" "trait-soundsleep" trait-buy! ;
cyoa-blank: trait1-soundsleep
	"Sound Sleeper" SOUNDSLEEP_COST ' trait1-soundsleep-buy ' trait1back trait-confirm! ;
	
cyoa: trait1-gourmand-buy
	"A TASTE FOR THE FINER THINGS" cyoa-title!
	"Gourmand" "trait-gourmand" trait-buy! ;
cyoa-blank: trait1-gourmand
	"Gourmand" GOURMAND_COST ' trait1-gourmand-buy ' trait1back trait-confirm! ;
	
cyoa: trait1-cityseek-buy
	"GIVE ME THOSE RARE ENCOUNTERS" cyoa-title!
	"City Seeker" "trait-cityseek" trait-buy! ;
cyoa-blank: trait1-cityseek
	"City Seeker" CITYSEEK_COST ' trait1-cityseek-buy ' trait1back trait-confirm! ;
	
cyoa: trait1-tinyeat-buy
	"LITTLE BITS" cyoa-title!
	"Tiny Eater" "trait-tinyeat" trait-buy! ;
cyoa-blank: trait1-tinyeat
	"Tiny Eater" TINYEATER_COST ' trait1-tinyeat-buy ' trait1back trait-confirm! ;
	
cyoa: trait1-phoenix-buy
	"THE PHOENIX HATH ARISEN *nasal voice*" cyoa-title!
	"Phoenix" "trait-phoenix" trait-buy! ;
cyoa-blank: trait1-phoenix
	"Phoenix" PHOENIX_COST ' trait1-phoenix-buy ' trait1back trait-confirm! ;
	
cyoa: trait1-fireproof-buy
	"FRIEND OF THE FIRES" cyoa-title!
	"Fireproof" "trait-fireproof" trait-buy! ;
cyoa-blank: trait1-fireproof
	"Fireproof" PHOENIX_COST ' trait1-fireproof-buy ' trait1back trait-confirm! ;
	
cyoa: trait1-dingus gstats{
	"Trait Unlocking" cyoa-title!
		
	($ "I'm developing an amazing new product
	I call them... unlocks. Or 'uncks' for short
	Witness the magic of 'cheevos'!
	Wait, I meant to say 'unlocks'." pbold $) text!
	
	trait1-stockleft 8 < if
	
		($ "I'm no longer allowed to call them 'Uncks'. The gnomes got very upset that I was stealing their bit.
		Let's call them Trait Unlocks. Or 'Trunlocks'." pbold $) text!
	
	then
	
	trait1-stockleft 5 < if
	
		($ "Experiment with different traits and perks.
		You might find a new favorite combination!" pbold $) text!
	
	then
	
	trait1-stockleft 1 < if
	
		($ "I'm out of Trunlocks!
		Use these precious gifts wisely.
		Believe... in the Trunlocks." pbold $) text!
	
	
	then
	
	+cr zptally trait1-remaining
	
	choice( "Leave for now" )choice
	
	trait-soundsleep 1 < if 
		"Sound Sleeper" SOUNDSLEEP_COST ' trait1-soundsleep perk-view!
	then
	trait-gourmand 1 < if 
		"Gourmand" GOURMAND_COST ' trait1-gourmand perk-view!
	then
	trait-cityseek 1 < if 
		"City Seeker" CITYSEEK_COST ' trait1-cityseek perk-view!
	then
	trait-travellight 1 < if 
		"Travel Light" TRAVELLIGHT_COST ' trait1-travellight perk-view!
	then
	trait-herotype 1 < if 
		"Hero Type" HEROTYPE_COST ' trait1-herotype perk-view!
	then
	trait-tinyeat 1 < if 
		"Tiny Eater" TINYEATER_COST ' trait1-tinyeat perk-view!
	then
	trait-animefan 1 < if 
		"Anime Fan" ANIMEFAN_COST ' trait1-animefan perk-view!
	then
	trait-specialist 1 < if 
		"Specialist" SPECIALIST_COST ' trait1-specialist perk-view!
	then	
	trait-grappler 1 < if 
		"Grappler" GRAPPLER_COST ' trait1-grappler perk-view!
	then
	trait-phoenix 1 < if 
		"Phoenix" PHOENIX_COST ' trait1-phoenix perk-view!
	then
	trait-fireproof 1 < if 
		"Fireproof" PHOENIX_COST ' trait1-fireproof perk-view!
	then		
	
	(*
		
	trait- 3 < if 
		"" _COST ' trait1- perk-view!
	then	
	*)
	
} ;

' trait1-dingus to trait1back

