"../deathforth/rooms/city.txt" $load-rooms
// "../deathforth/rooms/office.txt" $add-rooms
// "../deathforth/rooms/shop.txt" $add-rooms
// "../deathforth/rooms/restroom.txt" $add-rooms

cyoa{


}

: .bruceify
	48 over .specialtype!
	4 over .strength!
	6 over .fitness!
	4 over .vitality!
	4 over .health!
	0 over .female!
	WEAPON_KUNG over .weapon_default!
	drop
;

: bruceli
	map{ selected } . cr new-npc@ .bruceify
	1 lt .unseen! npc@rescue lt cyoa{ ' brucerescue cyoa! } drop ;

locdef{

location
		tags: trashed
		max-rooms: 2
		entry-tags: trashed
		
		room-choice: trashed
			room-weight: 10
			room-count: 2
			room-script: nad
			filter-only

location
		tags: canada-loot
		max-rooms: 2
		entry-tags: trashed

		: smallloot 
			looseloot looseloot LLweapon skelscat 2 for 50 %chance if skelscat then next
		;
		
		room-choice: trashed
			room-weight: 10
			room-count: 2
			room-script: nad
			room-post-script: smallloot
			filter-only
			
location
		tags: bruce-house
		max-rooms: 8
		entry-tags: open1
		
		: brucestart
			random-door "hall" only-with-door
			random-door "trashed" only-with-door
			10diff %zombs
		;
		
		: brucehall
			random-door "bedroom" only-with-door
			random-door "trashed" only-with-door
		;
		
		room-choice: open1
			room-weight: 10
			room-count: 1
			room-script: ndx
			room-post-script: brucestart 
			filter-only
		
		room-choice: hall
			room-weight: 10
			room-count: 1
			room-script: nad
			room-post-script: brucehall
			filter-only

		room-choice: bedroom
			room-weight: 10
			room-count: 1
			room-script: nad
			room-post-script: bruceli
			filter-only
			
		room-choice: trashed
			room-weight: 10
			room-count: 5
			room-script: nad
			
}

map{ regiondef{

	: pick-building

		' curbuild ++
		
		try-special-build if then;

		rowsleft 3 >= 40 %chance and if 0 else
			rowsleft 2 <= 75 %chance and if 0 else auto-picklocid then
		then
		
		dup if
			addloc last-loc-pick-script evaluate
		else drop
//			"trashed" $picklocid addloc	make-a-house
			"trashed" $picklocid addloc	make-apartments
			75 %chance if block-last-build-door then
		then
	;

	: pick-lots
		blocks-init
			6 to blockh
			5 to maxrows
			5 to streeth
			0.35 to greenspace
			1 3 rnd to grassylots
		blocks-start

		pavement

		begin canplot? while

			pick-building next-plot

			canplot? 0= if break then
			block-middle? if LOT_GRASS lastlot = if 1 else 0 then aplot then
		repeat

		street-junk
	;

	: building-pick-setup
		0 to curbuild
		5diff %zombs pavement pick-lots
	;
	
} }

regiondef{

	: runme
	//	special-lot-setup-example
		mission{ all-leaving }
		building-pick-setup
		10 15 rnd for skelscat next
		LLammo LLammo LLweapon
	;

	 region: new-locations-test
		w: 30
		h: 56
		script: timeofday o'clock

		loc-choice: bruce-house
			loc-weight: 40
			loc-count: 1

			loc-pick-script: make-apartments

		loc-choice: canada-loot
			loc-weight: 30
			loc-count: 2
			loc-pick-script: make-apartments

		post-script: runme
}
