// ======================
// DOG TIME
// ======================

: ispet? .pet@ 0 > ;
: cpet? cchar ispet? ;
: dog? .pet@ 1 = ;
: cat? .pet@ 2 = ;
: cdog? cchar dog? ;
: ccat? cchar cat? ;
: notpet? .pet@ 0= ;
: cnotpet? cchar notpet? ;
: pet? .pet@ ;
: superpet? statmod{ .superdog? } ;
: isdogpal? statmod{ .dogpal? } ;
: csuperpet? cchar superpet? ;
: petcheck checkchar ispet? ;
: dogpalcheck checkchar isdogpal? ;
: nondogcheck checkchar superpet? checkchar notpet? or ;
: chumany? cchar superpet? cchar notpet? or ;

: numdogpal team-stack ' isdogpal? stack-filter ;
: dogpal? numdogpal 0 > ;

: somehuman
 ' nondogcheck pick-team-char
 0= if false then;
 pickchar true
;

: somepet
 ' petcheck pick-team-char
 0= if false then;
 pickchar true
;

: somedogpal
 ' dogpalcheck pick-team-char
 0= if false then;
 pickchar true
;

: choosepet somepet if choosechar then ;
: choosedogpal somedogpal if choosechar then ;
: choosehuman
	somehuman if choosechar then
;


// : .dogpal MOD_DOGPAL swap .setmod ;
// : .dogpal? MOD_DOGPAL swap .ismod? ;

: numhumfilt dup superpet? swap notpet? or ; 
: numhums team-stack ' numhumfilt stack-filter ;



: solohuman numhums 2 < ;

: .dogtosuperdog 
	statmod{ dup .superdog .undog }
;

: dog-me-up
	soloer notpet? if
		soloer .doggify beep
	then;
	soloer statmod{ .superdog? } if "ALREADY SUPERDOG" print bitefx then;
	soloer ispet? if
		soloer statmod{ dup .superdog .undog } goodfx
	then

;

: humany? dup superpet? swap notpet? or ;

: pets ' pet? stack-filter drop ;
: humanfilt ' humany? stack-filter drop ; 

: cyoa-human-choice team-stack humanfilt cyoa-char-stack-choice ;

: foreach-human-char ( ' word -- ) team-stack humanfilt swap popeach ;



cyoa{

: cpetderp
	cdog? if 
		($ cname .. " sits there, panting, not understanding what to do, at all." $)
	else
		($ cname .. " horks something up and otherwise does nothing of value." $)
	then
;

: fingspaws
	superpet? if "paws" else "fingers" then
;

: growlhiss
	dog? if "growl" else "hiss" then
;

: snarlhiss
	dog? if "growl" else "hiss" then
;

: petbite
	dog? if "bite" else "claw" then
;

: barkmeow
	dog? if "bark" else "meow" then
;

: dogcat
	dog? if "dog" else "cat" then
;

: teethclaws
	dog? if "teeth" else "claws" then
;

: Dogcat
	dog? if "Dog" else "Cat" then
;

: cDogcat cchar Dogcat ;
: cdogcat cchar dogcat ;

: cdogcat cchar dogcat ;
: cgrowlhiss cchar growlhiss ;
: csnarlhiss cchar snarlhiss ;
: cpetbite cchar petbite ;
: cbarkmeow cchar barkmeow ;
: cfingspaws cchar fingspaws ;
: cteethclaws cchar teethclaws ;

 cyoa-choice: testtest
  "TESTY Night" cyoa-title!
  ($ cname .. ", HI!" $) cyoa-text!
	' .morale++ foreach-human-char
 ;

 cyoa: test
 "TEST" cyoa-title!
 "TEST" cyoa-text!

  ' testtest cyoa-human-choice
;

}
