# volley
minut += 30
gs 'stat'

if volltime = 0:
	!! reset the scores
	volpoint = 0
	volpointv = 0

	'The teams take to the field and start playing.'

	!! reserve player or you were caught drinking by the coach and he forbid you from playing
	if trener_Speak < 9 or seealko = 1:
		volleysostav = 1
		poverkomand = 500
		'<center><img src="images/qwest/alter/volley/game3.jpg"></center>'
		'You sit on the bench watching your team play.'

	!! starter
	else
		volleysostav = 2
		poverkomand = 500 + ((volleyboll*2) + ((stren + vital + agil + react)/2))/2
		'<center><img src="images/qwest/alter/volley/game4.jpg"></center>'
		'After warming up you run out on the court to join your teammates.'
	end

	!! opponent skill
	poverkomandV = rand(300, 1300)

	if poverkomand > poverkomandV:
		volpoint = 1
		'Your team plays better than your opponents.'
	elseif poverkomand < poverkomandV:
		volpointv = 1
		'Your opponents play better than your team.'
	else
		'The scoring varies one way, then the other, obviously the teams are evenly matched.'
	end

	act 'Continue':volltime = 1 & gt $curloc

!! halftime
elseif volltime = 1:
	'During the break, both teams have a rest.'

	if volpointv = 0:
		'<center><img src="images/qwest/alter/volley/Tren/VolleyTrener6.jpg"></center>'
		'Coach tells the team that you can''t relax, though winning you still need to be focused and not let the opponents back into the game.'
	elseif volpoint = 0:
		'<center><img src="images/qwest/alter/volley/Tren/VolleyTrener2.jpg"></center>'
		'Coach tells the team that losing the first half is bad, but it''s not a disaster, you pick yourselves up and go out and kick their asses. You can still win this game in the second half.'
	else
		'<center><img src="images/qwest/alter/volley/Tren/VolleyTrener1.jpg"></center>'
		'Coach tells the team that there is no draws in volleyball, he expects you to keep doing the things that you are doing well, but increase pressure. With more discipline and toughness, you can win this game. '
	end

	if volleysostav = 1:
		'You are sitting on the bench.'

		act 'Ask to play':
			if seealko = 1:
				cls
				'The coach refuses to let you play because he caught you drinking.'
				act 'Continue':volltime = 2 & gt $curloc
			else
				cls
				gs 'stat'

				if trenerepa >= rand(0, 80):
					volleysostav = 2
					dom += 1
					poverkomand += ((volleyboll*2) + ((stren + vital + agil + react)/2))/2
					'The coach agrees to let you play the second half.'

					act 'Continue':volltime = 2 & gt $curloc
				else
					'You ask the coach to play, but he shakes his head and explains that it is not staigically right for the team.'

					act 'Continue':volltime = 2 & gt $curloc
				end
			end
		end
	end

	act 'Continue':volltime = 2 & gt $curloc

!! 2nd half
elseif volltime = 2:
	*clr
	cla
	'<center><img src="images/qwest/alter/volley/game5.jpg"></center>'
	'Break is over and the team start the second half.'

	if volleysostav = 1:'You sit on the bench watching your team play.'

	if poverkomand > poverkomandV:
		volpoint += 1
		'Your team plays better than your opponents.'

		!! you came in and your team scored when they would not have without you
		if volleysostav = 2 and volpointv = 1:trenerepa += 10
	elseif poverkomand < poverkomandV:
		volpointv += 1
		'Your opponents play better than your team.'

		!! you came in and your team gave up a point they would not have without you
		if volleysostav = 2 and volpoint = 1:trenerepa -= 10
	else
		'The scoring varies one way, then the other, obviously the teams are evenly matched.'

		!! you came in and your team tied when they would not lost without you
		if volleysostav = 2 and volpointv = 1:trenerepa += 5
	end

	act 'Continue':volltime = 3 & gt $curloc

!! end of game
elseif volltime = 3:
	*clr
	cla
	volsesongame += 1
	if rand (1, 100) < 3:
		if volpointv = 2:
			volpoint = 0
			volpointv = 2
		elseif volpoint = 2:
			volpoint = 2
			volpointv = 0
		end
	end

	'Final whistle.'
	seealko = 0
	if volpoint > volpointv:
		volsesonwin += 1
		'<center><img src="images/qwest/alter/volley/game6.jpg"></center>'
		'Your team won.'
	elseif volpoint < volpointv:
		volsesonloss += 1
		'<center><img src="images/qwest/alter/volley/game8.jpg"></center>'
		'Your team lost.'
	else
		if rand (0, 1) = 0:
			volsesonwin += 1
			'<center><img src="images/qwest/alter/volley/game7.jpg"></center>'
			'The match was very close, but in the end your team gets the win.'
		else
			volsesonloss += 1
			'<center><img src="images/qwest/alter/volley/game7.jpg"></center>'
			'The match was very close, but in the end your team losses.'
		end
	end

	act 'Leave':gt 'gdksport'
	act 'Go to coaching':gt 'Voltrener', 'start'
end

--- volley ---------------------------------
