----------------------------------------------------------------------
 * This file is part of Freedroid
 *
 * Freedroid is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * Freedroid is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Freedroid; see the file COPYING. If not, write to the 
 * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 * MA 02111-1307 USA
----------------------------------------------------------------------


If you have questions concerning FreedroidRPG, please send an email to:

freedroid-discussion@lists.sourceforge.net


Beginning of new chat dialog for character="XXXXX"
----------------------------------------------------------------------

<FirstTime LuaCode>
	show(0) 
	John28to28_teleported = 0
	JohnPuzzlefalse = 0
	JohnPuzzlefalseA = 0
	JohnPuzzlefalseB = 0
	JohnPuzzlefalseC = 0
</LuaCode>

<EveryTime LuaCode>
	JohnPuzzleScore = JohnPuzzlefalseA + JohnPuzzlefalseB + JohnPuzzlefalseC

	if (has_cookie("john_dislike")) then
		tux_says(_"I am s-")
		npc_says(_"Go away please.")
		end_dialog()
	end

	if (has_cookie("JohnPuzzleStarted")) then

		-- if Tux ran into false teleporter of the storage room
		if (has_cookie("John28to28_teleported")) and
		   (not has_cookie("28to28_hide")) then
			tux_says(_"What was that?!")
			npc_says(_"See..?")
			npc_says(_"It's not as easy as you thought.")
			npc_says(_"Take a closer look at the storage room again...")
			tux_says(_"Okay.")
			add_cookie("28to28_hide")
		end

		-- Puzzle is neither solved nor locked:
		if (not has_cookie("JohnPuzzleLocked")) or
		   (not has_cookie("JohnPuzzleSolved")) then

			-- Tux walked through the false teleporter one time
			if (not has_cookie("JohnProblems1")) then
				if (JohnPuzzlefalseA == 1) or
				   (JohnPuzzlefalseB == 1) or
				   (JohnPuzzlefalseC == 1) then
					npc_says(_"Looks like you had some problems?")
					tux_says(_"Yes...")
					npc_says(_"Ok, I'll give you another chance.")
					npc_says(_"But it will be your last chance, so take care...")
					tux_says(_"Thanks.")
					add_cookie("JohnProblems1")
				end
			end

			--Tux walked through the same teleporter twice (wtf?!)

			if (JohnPuzzlefalseA == 2) or
			   (JohnPuzzlefalseB == 2) or
			   (JohnPuzzlefalseC == 2) then
				npc_says(_"Dude!")
				npc_says(_"You made the same mistake twice.")
				npc_says(_"You walked through the same teleporter twice!")
				npc_says(_"What's wrong with your mind?")
				tux_says(_"I-")
				npc_says(_"How is that ever going to work?")
				npc_says(_"I locked the puzzle.")
				npc_says(_"It doesn't seem like you'd ever be able to solve it.")
				add_cookie("JohnPuzzleLocked")
			end
			
			if (not has_cookie("JohnPuzzleLocked")) then
				-- Tux walked through a false teleporter second time
				if (JohnPuzzleScore >= 2) then
					npc_says(_"Sorry, seems like that puzzle was too hard for you.")
					tux_says(_"But I-")
					npc_says(_"It is locked now.")
					tux_says(_"I was very close to the solution.")
					npc_says(_"Well, why did you still fail if you were so close?")
					tux_says(_"Hmpf..")
					add_cookie("JohnPuzzleLocked")
				end
			end

		end		-- of  'if (not has_cookie("JohnPuzzleLocked")) or
				--  (not has_cookie("JohnPuzzleSolved")) then'

		-- if Tux solved the puzzle, went into the correct teleporter
		if (not has_cookie("JohnPuzzleLocked")) and
		   (has_cookie("JohnPuzzleSolved")) then
			if (has_cookie("John28to28_teleported")) or
			   (JohnPuzzleScore > 0 ) then
				npc_says(_"Congratulations, you solved my little puzzle.")
				npc_says(_"I give you this as a small reward.")
				add_item("Dexterity Pill", 1)
			else
				-- Tux solved the puzzle without retrying!
				npc_says(_"Wow... you solved it, and on your first time, too.")
				npc_says(_"That's pretty good.")
				npc_says(_"Here, take this as reward.")
				tux_says(_"Oh, thank you.")
				add_item("Dexterity Pill", 1)
				add_item("Strength Pill", 1)
			end
			add_cookie("JohnPuzzleLocked")
			set_bot_destination("JohnFreeLabel")
		end

	end -- of 'if (has_cookie("JohnPuzzleStarted")) then'

	set_rush_tux(0, "John")

show(99)
</LuaCode>
----------------------------------------------------------------------

Nr=0 Text=_"Hello."
<LuaCode>
	npc_says(_"Hello.")
	npc_says(_"Errr... How did you get in here?!")
	tux_says(_"I just walked through the door.")
	npc_says(_"And your name?")
	tux_says(_"I'm " .. get_player_name() .. _".")
	npc_says(_"And you were not slaughtered by the bots outside?")
	tux_says(_"Apparently, I am still alive.")
	tux_says(_"Does that answer your question?")
	npc_says(_"It does... smart aleck.")
	hide(0) show(1)
</LuaCode>
----------------------------------------------------------------------

Nr=1 Text=_"What do you do here?"
<LuaCode>
	npc_says(_"I'm living here.")
	npc_says(_"What did you expect?")
	tux_says(_"Okay, that question was a little stupid.")
	hide(1) show(2)
</LuaCode>
----------------------------------------------------------------------

Nr=2 Text=_"Are there any other people around here?"
<LuaCode>
	npc_says(_"Not that I know.")
	npc_says(_"Only you and me.")
	tux_says(_"Okay, that question was also a little stupid.")
	hide(2) show(3)
</LuaCode>
----------------------------------------------------------------------

Nr=3 Text=_"Isn't it a little boring in here, isolated from the outer world?"
<LuaCode>
	npc_says(_"I'm fine.")
	npc_says(_"When I'm bored, I try to make up some puzzles...")
	hide(3) show(4, 5)
</LuaCode>
----------------------------------------------------------------------

Nr=4 Text=_"'Puzzles'?"
<LuaCode>
	npc_says(_"Yeah, puzzles.")
	npc_says(_"Do you want to try one?")
	hide(4, 5) show(10, 11)
</LuaCode>
----------------------------------------------------------------------

Nr=5 Text=_"Sounds interesting."
<LuaCode>
	tux_says(_"Can you tell me more about it?")
	npc_says(_"No.")
	npc_says(_"But you can experience it for yourself.")
	npc_says(_"Interested?")
	hide(4, 5) show(10, 11)
</LuaCode>
----------------------------------------------------------------------

Nr=10 Text=_"Yeah, sure!"
<LuaCode>
	npc_says(_"Ok, so the entrance is in my storage room.")
	npc_says(_"Shouldn't be too difficult to find.")
	tux_says(_"Ok, let me take a look.")
	npc_says(_"Wait, wait. I'll give you a hint:")
	npc_says(_"'Looking from above hostiles may appear as salvation.'")
	tux_says(_"Uh, ok, thanks.")
	add_cookie("JohnPuzzleStarted")
	end_dialog()
	hide(10, 11)
</LuaCode>
----------------------------------------------------------------------

Nr=11 Text=_"Hmm... I don't trust you."
<LuaCode>
	tux_says(_"I think, it's a trap!")
	npc_says(_"Well, you can leave at any time.")
	npc_says(_"I wish you would!")
	add_cookie("john_dislike")
	hide(10, 11)
	end_dialog()
</LuaCode>
----------------------------------------------------------------------

Nr=99 Text=_"See you."
<LuaCode>
	if (has_cookie("john_dislike")) then
		npc_says(_"I don't think so...")
	else
		npc_says(_"See you later.")
	end
	end_dialog()
</LuaCode>
----------------------------------------------------------------------

End of chat dialog for character="XXXXX"
