"../deathforth/rooms/tutorial.txt" $load-rooms
"../deathforth/rooms/city.txt" $add-rooms

cyoa{

cyoa-choice: tutorchat-1
	pchar choosechar
	($ pname .. " 对 " .. bname .. " 喊 " .. "冷静点吧你!" pbold $) text!
	($ bname .. " 被这句话激怒了！ " .. bHe .. " 变得 " .. "非常的狂暴!" rbold $) +crtext
	($ "我不认为对任何人说 " .. "'冷静点吧你!'" pbold .. " 有任何的用处, 至少在人类历史上重来没有过好下场" $) +crtext
	1 cchar .wits! 1 cchar .attitude!
	witsattREV badfx clear-cyoa morale2-all
;

cyoa-choice: tutorchat-2
	pchar choosechar
	($ pname .. " 尝试动用人格魅力来让 " .. bname .. " 来帮助对抗蜂拥而至的尸群
	" .. bname .. " 明显在流汗." $) text!
	($ "我很忙! 我正忙着收拾行李! 你!赶紧过来帮我弄好！" pbold $) +crtext
	"好吧, 这至少是值得一试的. 没准我们帮的这个家伙并不是个真正的混蛋呢？." +crtext
	6 cchar .wits! 6 cchar .attitude!
	witsattREV badfx clear-cyoa
;

cyoa-choice: tutorchat-3 
	pchar choosechar
	($ pname .. " 说 " .. bname .. " 就是个 " .. "丁克." pbold $) text!
	($ bname .. " 非常震惊! 并觉得这么被称呼还挺有趣的 " .. bhim .. " 啥是丁克呀 " .. bhe .. " 问道." $) +crtext
	goodfx clear-cyoa morale++all
;

cyoa: tutorchat
	rescue choosechar cicon
	cchar to bully
	dead? if npc-died then;
	($ pname .. " 发现了 " .. cname .. ", 他是个真正的单身贵族.
	" .. "之前有丧尸闯进我家里来了! 就是你们把他们引来的吧! 反正不是我的错!" pbold .. "
	当团队发现了这个反丧尸掩体的时候, " .. bname .. " 出现并在任何人说话之前对这栋房子宣布了主权." $) text!
	
	choice( "离 " .. chim .. " 远点" )choice
	choice( "对 " .. chim .. " 喊 '冷静点吧你！'" )choice: tutorchat-1
	choice( "试着说服 " .. chim .. " 来一起战斗" )choice: tutorchat-2
	choice( "称 " .. chim .. " 为'丁克'" )choice: tutorchat-3
;

cyoa: tutorrecruit
	recruitee choosechar cicon
	dead? if npc-died then;
	($ pname .. " 问候了 " .. rname .. ".
	" .. "我觉得我们在不久之后就不得不离开这栋安全屋了. 至少我们在这里安顿了一段时间.
	我们应该试着去加拿大! 你希望和我一同踏上旅途么？" pbold .. "
	你的队友越多，能和你并肩战斗的人就越多，并且你将有更多的人手去获取战利品. 但同时也意味着有更多的人在你的车上, 吃更多的食物, 有着更多的争论." $) text!
	0.25 cchar .ai.wander_chance! clear-cyoa
	recruit-yesno
	
;

}

: tutorial-npc1 
	new-npc@ 0 over .ai.wander_chance! 180 lt .aim_angle! lt .character@ to rescue
	cyoa{ ' tutorchat cyoa! } drop
;

: tutorial-npc2
	// new-rescue-npc 0 lt .character@ .ai.wander_chance!
	new-npc@ rescue-weapon over .weapona! 0 over .ai.wander_chance! 180 lt .aim_angle! lt .character@ to recruitee
	cyoa{ ' tutorrecruit cyoa! } drop
;

mission{ 

: door-tutorial-escape
	cyoa-start
	beep "door-no-escape" print
	"无法离开" cyoa-title!
	($ "你无法从这个位置离开!
	这扇门只能通往 " .. "垃圾房" rbold .. ", 并且几乎已经被丧尸填满了. 不管是谁想的用这个房间来锁住丧尸  他肯定没考虑到丧尸瘟疫会持续这么久.
	你必须找到另一条出路. " $) cyoa-text!
	"或者，如果你愿意的话，你也可以跳过教程." rbold +text
		choice( "回到教程 " )choice
		cyoa-add-choice
		"跳过教程!" cyoa-choice-text!
			cyoa{ ' tutorial-ladder-end cyoa-choice-handler! }
;

: tutortopmsg
	eventid THING_EVENT_TIMER <> if drop then;
	( beep ) // Good for debugging timers
	me .retrigger_timer
	curmapview me .mapid@ <> if then;
	WHITE swap $cat 60 view_w 0.5 * 16 msgtickxy
;

: attackbtn CMD_ATTACK p1_btn_name ;
: swapbtn CMD_SWAP p1_btn_name ;
: usebtn CMD_USE p1_btn_name ;
: startbtn CMD_START p1_btn_name ;

: upbtn CMD_UP p1_btn_name ;
: downbtn CMD_DOWN p1_btn_name ;
: leftbtn CMD_LEFT p1_btn_name ;
: rightbtn CMD_RIGHT p1_btn_name ;

: usebtns 0 usebtn
	// .. 0 usebtn $len 1 usebtn $len and if "OR " else "" then .. 1 usebtn
;
: attackbtns 0 attackbtn 
	// .. 0 attackbtn $len 1 attackbtn $len and if "OR " else "" then .. 1 attackbtn
;
: swapbtns 0 swapbtn
	// .. 0 swapbtn $len 1 swapbtn $len and if "OR " else "" then .. 1 swapbtn 
;
: startbtns 0 startbtn 
	// .. 0 startbtn $len 1 startbtn $len and if "OR " else "" then .. 1 startbtn 
;

: arrowbtns
	0 upbtn .. ", " .. 0 downbtn .. ", " .. 0 leftbtn .. ", " .. 0 rightbtn
;

thing-event: tutormsg1
	($ arrowbtns .. " 来移动
	" .. usebtns .. " 来打开或使用" $) tutortopmsg ;
thing-event: tutormsg2 
	($ usebtns .. " 来拾起武器
	" .. swapbtns .. " 来更换武器
	按住 " .. 0 usebtn .. " 来扔掉武器" $) tutortopmsg ;
thing-event: tutormsg3 
	($ usebtns .. " 来举起椅子
	" .. attackbtns .. " 来扔出椅子
	" .. swapbtns .. " 来放下椅子" $) tutortopmsg ;
thing-event: tutormsg4 
	($ attackbtns .. " 来攻击
	试着自己走一走" $) tutortopmsg ;
thing-event: tutormsg5 
	"注意那些大群的丧尸
	逃跑常常好过战斗" tutortopmsg ;
thing-event: tutormsg6 
	"梯子通向外面
	祝你好运" tutortopmsg ;

thing-event: tutormsg7 
	($ usebtns .. " 来谈话或者互动" $) tutortopmsg ;
thing-event: tutormsg8 
	"明智地选择你的朋友" tutortopmsg ;
thing-event: tutormsg9 
	"浴室里常常会有医疗物资" tutortopmsg ;
thing-event: tutormsg10 
	"总是被洗劫一空" tutortopmsg ;
thing-event: tutormsg11
	($ startbtns .. " 在团队交换界面或者信息界面
	你可以更换领队" $) tutortopmsg ;

}

map{ roomgen{

: tutorialbars
	spawn special_objects64_base_id 0x 9 + lt .spriteid!
	bbox immovable as-metal
;

: tutormsg lt .events! 1 sec>tick lt .repeating_timer invisible ;

: tutor1msg spawn mission{ ' tutormsg1 } tutormsg ;
: tutor2msg spawn mission{ ' tutormsg2 } tutormsg ;
: tutor3msg spawn mission{ ' tutormsg3 } tutormsg ;
: tutor4msg spawn mission{ ' tutormsg4 } tutormsg ;
: tutor5msg spawn mission{ ' tutormsg5 } tutormsg ;
: tutor6msg spawn mission{ ' tutormsg6 } tutormsg ;

: tutorbedmsg spawn mission{ ' tutormsg7 } tutormsg ;
: tutorkitchmsg spawn mission{ ' tutormsg8 } tutormsg ;
: tutorbathmsg spawn mission{ ' tutormsg9 } tutormsg ;
: tutorstormsg spawn mission{ ' tutormsg10 } tutormsg ;

: tutor11msg spawn mission{ ' tutormsg11 } tutormsg ;

} }

locdef{

location: tutorial
		max-rooms: 11
		entry-tags: tutor1
		script: set-theme-house
		pre-script: set-theme-house
		post-script: nad

		: tutor1script
			e random-edge-door "tutor2" only-with-door
			tutor1msg
		;

		: tutor2script
			e random-edge-door "tutor3" only-with-door
			s random-edge-door "tutorbath" only-with-door
			n random-edge-door "bedroom" only-with-door
			tutor2msg
			baseball .scatter wrench .scatter
		;
		
		: tutor3script
			e random-edge-door "tutor4" only-with-door
			n random-edge-door "kitchen" only-with-door
			tutor3msg
		;
		
		: tutor4script
			e random-edge-door "tutor5" only-with-door
			s random-edge-door "tutorstorage" only-with-door
			tutor4msg
		;
		
		: tutor5script
			e random-edge-door "tutor6" only-with-door
			tutor5msg
		;
		
		: tutor6script
			e random-edge-door "tutorend" only-with-door
			tutor11msg
		;

		room-choice: tutor1
			room-weight: 300
			room-count: 1
			room-script:
			room-post-script: tutor1script
			filter-only

		room-choice: tutor2
			room-weight: 300
			room-count: 1
			room-post-script: tutor2script
			filter-only

		room-choice: tutor3
			room-weight: 300
			room-count: 1
			room-post-script: tutor3script
			filter-only
		
		room-choice: tutor4
			room-weight: 300
			room-count: 1
			room-script: gcloset-theme
			room-post-script: tutor4script
			filter-only

		room-choice: tutorstorage
			room-weight: 300
			room-count: 1
			room-script: gcloset-theme
			room-post-script: tutorstormsg
			filter-only
		
		room-choice: tutor5
			room-weight: 300
			room-count: 1
			room-script: gcloset-theme
			room-post-script: tutor5script
			filter-only		
			
		room-choice: tutor6
			room-weight: 300
			room-count: 1
			room-script: gcloset-theme
			room-post-script: tutor6script
			filter-only		
		
		room-choice: tutorend
			room-weight: 300
			room-count: 1
			room-script: gcloset-theme
			// gcloset-theme gbath-theme
			room-post-script: tutor6msg
			filter-only

		room-choice: tutorbath
			room-weight: 1
			room-count: 1
			room-script: floor-bath
			room-post-script: tutorbathmsg

		room-choice: bedroom
			room-weight: 10
			room-count: 1
			room-post-script: tutorbedmsg tutorial-npc1

		room-choice: kitchen
			room-weight: 10
			room-count: 1
			room-script: floor-kitchen
			room-post-script: tutorial-npc2 tutorkitchmsg
}
			
regiondef{			

	: tutorial-setup
		mission{ ' door-tutorial-escape to main-event-mission-location-leave }
		easy-music-fade inspawn
	;

	region: tutorial
		script: timeofday o'clock

		inside
					
		loc-choice: tutorial
			loc-weight: 99
			loc-count: 1

		post-script: tutorial-setup
}
