;;; Sierra Script 1.0 - (do not remove this comment)
(script# 95)
(include sci.sh)
(use Main)
(use Class_255_0)
(use Avoid)
(use Sound)
(use Cycle)
(use Game)
(use InvI)
(use Feature)
(use Obj)

(public
	Room95 0
)
(synonyms
	(gull gull bird)
)

(local
	local0
	local1
	local2
	local3
	newAct_2
	newAct
	[local6 2]
	newProp
	newProp_2
	newProp_3
	local11
	local12
)
(instance fisherTheme of Sound
	(properties
		number 14
		priority -1
	)
)

(instance fallSound of Sound
	(properties
		number 51
		priority 3
	)
)

(instance Room95 of Rm
	(properties
		picture 95
	)
	
	(method (init)
		(Load rsVIEW 2)
		(Load rsVIEW 8)
		(Load rsVIEW 19)
		(if (gEgo has: 17)
			(Load rsVIEW 12)
			(Load rsVIEW 13)
			(Load rsVIEW 14)
		)
		(Load rsVIEW 17)
		(Load rsVIEW 234)
		(Load rsVIEW 230)
		(Load rsVIEW 327)
		(super init:)
		(if global100 (gRoom overlay: 195))
		(self setRegions: 504)
		(= local1 0)
		(= south (= north 31))
		(= east 7)
		(= west 31)
		(= horizon 72)
		(gEgo edgeHit: 0)
		(= local0 0)
		(= global189 1)
		(= newProp (Prop new:))
		(newProp
			view: 650
			loop: 1
			cel: 1
			posn: 155 57
			setPri: 0
			ignoreActors:
			setCycle: Fwd
			isExtra: 1
			init:
		)
		(if global223
			(= newProp_2 (Prop new:))
			(= newProp_3 (Prop new:))
			(newProp_2
				view: 667
				loop: 3
				cel: 2
				posn: 216 178
				setPri: 0
				setCycle: Fwd
				ignoreActors:
				cycleSpeed: 2
				init:
			)
			(newProp_3
				view: 667
				loop: 6
				cel: 3
				posn: 209 169
				setPri: 0
				setCycle: Fwd
				ignoreActors:
				cycleSpeed: 2
				init:
			)
		)
		(if (== global116 0) (= global116 1))
		(switch gPrevRoomNum
			(0
				(gEgo loop: 1 setPri: 13)
				(= global105 0)
				(gEgo view: 2 posn: 317 144)
				(= global107 9)
			)
			(7
				(if (== global107 9)
					(gEgo x: 318 y: 144)
					(gEgo illegalBits: -16384)
					(gEgo setPri: 13)
				else
					(gEgo view: 8 setCycle: Fwd)
					(gEgo x: 318)
				)
			)
			(31
				(cond 
					((<= (gEgo y?) gHorizon) (gEgo posn: (gEgo x?) (+ horizon (gEgo yStep?) 1)))
					((>= (gEgo y?) 189) (gEgo y: 188))
					((>= (gEgo x?) 319) (gEgo x: 1))
				)
				(if (<= (gEgo y?) horizon) (gEgo y: (+ horizon 2)))
				(gEgo view: 8 setCycle: Fwd)
			)
		)
		(if (not global100)
			(= newAct (Act new:))
			(newAct
				posn: 278 124
				view: 327
				loop: 0
				cel: 0
				xStep: 8
				yStep: 6
				illegalBits: 0
				ignoreActors:
				ignoreHorizon:
				setPri: 13
				setAvoider: (Avoid new:)
				init:
			)
			(newAct setScript: gullActions)
		)
		(if (== global116 1)
			(= newAct_2 (Act new:))
			(fisherTheme play:)
			(newAct_2
				view: 233
				posn: 177 145
				setPri: 13
				loop: 0
				setCycle: Fwd
				xStep: 3
				yStep: 2
				setScript: manActions
				init:
			)
			(= local3 1)
		)
		(gEgo xStep: 3 yStep: 2 init:)
		(if (and (== global107 9) (== local3 1))
			(gEgo observeControl: 32)
		)
	)
	
	(method (doit)
		(super doit:)
		(if
			(and
				(or
					(and
						(gCast contains: newAct_2)
						(newAct_2 inRect: 249 138 305 148)
					)
					(and (== global107 9) (gEgo inRect: 249 138 305 148))
				)
				(== (gullActions state?) 0)
			)
			(gullActions changeState: 1)
		)
		(= local2 (gEgo onControl: 0))
		(if (and (== global107 9) (!= global105 15))
			(cond 
				((& local2 $0010) (gEgo setScript: fallNorth))
				((& local2 $0004) (gEgo setScript: fallSouth))
				((& local2 $0008) (gEgo setScript: fallWest))
			)
		)
		(if (or (== local3 0) (!= global107 9))
			(gEgo ignoreControl: 32)
		)
	)
	
	(method (handleEvent pEvent &tmp gInvSaidMe)
		(if (pEvent claimed?) (return 1))
		(return
			(if (== (pEvent type?) evSAID)
				(cond 
					((Said 'deliver>')
						(cond 
							((Said '/*/gull') (Print 95 0))
							((Said '/*[/fisherman,man,man,man,man]>')
								(if (= gInvSaidMe (gInv saidMe:))
									(if (gEgo has: (gInv indexOf: gInvSaidMe))
										(Print 95 1)
									else
										(Print 95 2)
									)
								else
									(Print 95 3)
									(pEvent claimed: 1)
								)
							)
						)
					)
					((Said 'look>')
						(cond 
							((Said '/fish')
								(if (gEgo has: 24)
									((Inv at: 24) showSelf:)
								else
									(Print 95 4)
								)
							)
							((Said '/dock') (Print 95 5))
							((Said '<under/dock') (Print 95 6))
							((Said '<under/water,ocean')
								(if (== (gEgo view?) 2)
									(Print 95 7)
								else
									(Print 95 8)
								)
							)
							((Said '/barrel') (Print 95 9))
							((Said '/ocean,water') (Print 95 10))
							((Said '/gull,gull,gull')
								(if (gCast contains: newAct)
									(Print 95 11)
								else
									(pEvent claimed: 0)
								)
							)
							((Said '/hemp') (Print 95 12))
							((Said '/fisherman,man,man,man,man')
								(if (== global116 1)
									(Print 95 13)
								else
									(Print 95 14)
								)
							)
							((Said '[<around][/room]')
								(if (== (gEgo view?) 2)
									(Print 95 15)
								else
									(Print 95 16)
								)
							)
						)
					)
				)
				(cond 
					((Said 'open/barrel') (Print 95 9))
					((or (Said 'drink') (Said 'get/drink'))
						(if (== (gEgo view?) 2)
							(Print 95 17)
						else
							(Print 95 18)
						)
					)
					((Said 'hop,(dive<in)')
						(if (== (gEgo view?) 2)
							(Print 95 19)
						else
							(Print 95 20)
						)
					)
					((Said 'dive,(bathe<under)[/ocean,water]') (Print 95 21))
					((Said 'bathe')
						(if (== (gEgo view?) 2)
							(Print 95 19)
						else
							(Print 95 22)
						)
					)
					((Said 'get/hemp') (Print 95 23))
					(
						(or
							(Said 'fish[<enter][/!*]')
							(Said 'capture,get/fish')
							(Said 'cast/pole')
						)
						(if (== global107 9)
							(gRoom setScript: fishing)
							(fishing changeState: 1)
						else
							(Print 95 24)
						)
					)
					((Said '/pole>')
						(cond 
							((gEgo has: 17)
								(cond 
									((Said 'bait') (pEvent claimed: 0))
									((Said 'get') (proc0_14))
									((Said 'use') (Print 95 25))
								)
							)
							((not (gCast contains: newAct_2)) (pEvent claimed: 1) (Print 95 26))
							((Said 'get') (Print 95 27))
							((Said 'rob') (Print 95 28))
						)
					)
					((Said '/gull>')
						(cond 
							((not (gCast contains: newAct)) 0)
							((Said 'feed') (Print 95 29))
							((Said 'kiss') (Print 95 30))
							((Said 'converse') (Print 95 31))
							((Said 'capture,get') (Print 95 32))
						)
					)
					((Said '[/fisherman,man,man,man,man]>')
						(cond 
							((Said 'get/*')
								(if (== global116 1)
									(Print 95 33)
								else
									(Print 95 34)
								)
							)
							((Said 'help') (Print 95 35))
							((Said 'kiss')
								(if (== global116 1)
									(Print 95 36)
								else
									(Print 95 34)
								)
							)
							((Said 'converse')
								(if (gCast contains: newAct_2)
									(Print 95 37)
								else
									(Print 95 38)
								)
							)
						)
					)
				)
			else
				0
			)
		)
	)
	
	(method (newRoom newRoomNumber)
		(= global189 0)
		(gEgo baseSetter: 0)
		(super newRoom: newRoomNumber)
	)
)

(instance fallSouth of Script
	(properties)
	
	(method (changeState newState)
		(switch (= state newState)
			(0
				(proc0_8)
				(= global189 1)
				(= global107 0)
				(fallSound play:)
				(gEgo
					illegalBits: 0
					yStep: 10
					setMotion: MoveTo (gEgo x?) (+ (gEgo y?) 34) self
					setPri: 15
					view: 17
					cel: 255
					setCycle: End
				)
			)
			(1
				(gEgo yStep: 2 setPri: -1)
				(gEgo
					view: 19
					loop: (& (gEgo loop?) $0001)
					illegalBits: -32768
					cel: 255
					setCycle: End self
				)
			)
			(2
				(gEgo
					view: 8
					setCycle: Fwd
					illegalBits: -32768
					setPri: -1
				)
				(proc0_9)
				(= global107 0)
				(gEgo setScript: 0)
			)
		)
	)
)

(instance fallNorth of Script
	(properties)
	
	(method (changeState newState)
		(switch (= state newState)
			(0
				(proc0_8)
				(= global107 0)
				(fallSound play:)
				(gEgo
					illegalBits: 0
					setPri: 11
					posn: (gEgo x?) (- (gEgo y?) 5)
					yStep: 10
					view: 17
					cel: 255
					setCycle: End
					setMotion: MoveTo (gEgo x?) (+ (gEgo y?) 20) self
				)
			)
			(1
				(gEgo
					view: 8
					setCycle: Fwd
					setStep: 3 2
					setPri: -1
					illegalBits: -32768
				)
				(proc0_9)
				(gEgo setScript: 0)
			)
		)
	)
)

(instance fallWest of Script
	(properties)
	
	(method (changeState newState)
		(switch (= state newState)
			(0
				(proc0_8)
				(= global107 0)
				(fallSound play:)
				(gEgo illegalBits: 0)
				(gEgo view: 17 setCycle: Fwd setStep: 10 8 cel: 0)
				(gEgo
					setMotion: MoveTo (- (gEgo x?) 30) (+ (gEgo y?) 20) self
				)
			)
			(1
				(gEgo
					view: 19
					loop: (& (gEgo loop?) $0001)
					illegalBits: -32768
					cel: 255
					setPri: -1
					setCycle: End self
				)
			)
			(2
				(gEgo view: 8 xStep: 3 yStep: 2 setCycle: Fwd)
				(proc0_9)
				(gEgo setScript: 0)
			)
		)
	)
)

(instance manActions of Script
	(properties)
	
	(method (changeState newState)
		(switch (= state newState)
			(0
				((ScriptID 0 4) setReal: self 15)
			)
			(1
				(newAct_2 view: 234 loop: 0 cel: 255 setCycle: End self)
			)
			(2
				(newAct_2 loop: 1 cel: 255 setCycle: End self)
			)
			(3
				(newAct_2
					view: 230
					setCycle: Walk
					setMotion: MoveTo 319 146 self
				)
				(= local3 0)
			)
			(4
				(= global197 global159)
				(= global198 global158)
				(= global199 global160)
				(= global116 2)
				(newAct_2 dispose:)
				(= newAct_2 0)
			)
		)
	)
)

(instance gullActions of Script
	(properties)
	
	(method (changeState newState)
		(switch (= state newState)
			(1
				(newAct view: 327 cel: 255 loop: 0 setCycle: End self)
			)
			(2
				(newAct loop: 1 cel: 0 setCycle: Fwd)
				(newAct setMotion: MoveTo -10 25 self)
			)
			(3 (newAct dispose:))
		)
	)
)

(instance fishing of Script
	(properties)
	
	(method (changeState newState)
		(switch (= state newState)
			(1
				(gEgo baseSetter: (ScriptID 0 1))
				(= global105 15)
				(cond 
					(
					(and (gEgo has: 17) ((Inv at: 19) ownedBy: 666)) (self changeState: 9))
					((gEgo has: 17) (self changeState: 19))
					(else
						(Print 95 39)
						(= global105 0)
						(fishing changeState: 0)
					)
				)
			)
			(9
				(proc0_8)
				(gEgo setMotion: MoveTo (gEgo x?) 144 self)
			)
			(10
				(gEgo setMotion: MoveTo 189 145 self)
			)
			(11
				(Print 95 40 67 -1 15)
				(gEgo
					view: 13
					loop: 2
					cel: 3
					cycleSpeed: 1
					setCycle: Beg self
				)
			)
			(12
				(gEgo view: 12 loop: 0 cycleSpeed: 0 setCycle: Fwd)
				((ScriptID 0 4) setReal: self 7)
			)
			(13
				(if (< (Random 1 100) 50)
					(gEgo loop: 1)
					(Print 95 41 67 -1 15)
					(self changeState: 14)
					((Inv at: 17) loop: 0)
				else
					(self changeState: 50)
				)
			)
			(14
				(gEgo
					view: 14
					loop: 1
					cel: 255
					cycleSpeed: 1
					setCycle: End
				)
				(= seconds 4)
			)
			(15
				(= global182 1)
				(gEgo
					view: 2
					setLoop: -1
					loop: 1
					cycleSpeed: 0
					setCycle: Walk
					baseSetter: 0
				)
				(= global105 0)
				(proc0_9)
				((Inv at: 24) moveTo: gEgo)
				(gGame changeScore: 3)
				((Inv at: 19) moveTo: 777)
				(gRoom setScript: 0)
			)
			(19
				(proc0_8)
				(if (and (<= (gEgo y?) 141) (>= (gEgo x?) 289))
					(gEgo setMotion: MoveTo (gEgo x?) 143 self)
				else
					(self changeState: 20)
				)
			)
			(20
				(proc0_8)
				(gEgo setMotion: MoveTo 189 145 self)
			)
			(21
				(Print 95 42 67 -1 15)
				(gEgo
					view: 13
					loop: 1
					cel: 3
					cycleSpeed: 1
					setCycle: Beg self
				)
			)
			(22
				(gEgo view: 12 loop: 0 cycleSpeed: 0 setCycle: Fwd)
				((ScriptID 0 4) setReal: self 7)
			)
			(23
				(if (and (< (Random 1 100) 50) (== local12 0))
					(gEgo loop: 1)
					(self changeState: 24)
				else
					(Print 95 43 67 -1 15)
					(self changeState: 30)
				)
			)
			(24
				(gEgo
					view: 14
					loop: 0
					cel: 255
					cycleSpeed: 1
					setCycle: End
				)
				(= seconds 4)
			)
			(25
				(Print 95 44 67 -1 15)
				(= local12 1)
				(gEgo
					view: 2
					setLoop: -1
					loop: 1
					cycleSpeed: 0
					setCycle: Walk
					baseSetter: 0
				)
				(= global105 0)
				(proc0_9)
				(gRoom setScript: 0)
			)
			(30
				(gEgo
					view: 13
					cel: 255
					loop: 1
					cycleSpeed: 2
					setCycle: End
				)
				(= seconds 3)
			)
			(31
				(gEgo
					view: 2
					setLoop: -1
					cycleSpeed: 0
					loop: 1
					setCycle: Walk
					baseSetter: 0
				)
				(= global105 0)
				(proc0_9)
				(gRoom setScript: 0)
			)
			(50
				(gEgo
					view: 13
					cel: 255
					loop: 2
					cycleSpeed: 2
					setCycle: End
				)
				((ScriptID 0 4) setReal: self 4)
			)
			(51
				(Print 95 45 67 -1 15)
				(gEgo
					view: 2
					loop: 1
					cycleSpeed: 0
					setCycle: Walk
					baseSetter: 0
				)
				(= global105 0)
				(proc0_9)
				(gRoom setScript: 0)
			)
		)
	)
)
