# atak
if $ARGS[0] = 'player':
	cla
	tip = 0
	strenA = stren
	speedA = speed
	agilA = agil
	vitalA = vital
	!!skills
	boxingA = boxing
	!!parameters
	healthA = health
	BonusA = BonusAtak
	strenD = strenV
	speedD = speedV
	agilD = agilV
	vitalD = vitalV
	!!skills
	boxingD = boxingV
	!!parameters
	healthD = healthV
	initBonusA = initBonus
	initBonus = 0
	initBonusV = 0
	BonusD = BonusDefV

	if stunV <= 0:
		xgt 'atak', 'popad'
	else
		'<b><font color="green"><<$nameV>> can not move a critical hit</font></b>'
		xgt 'atak', 'uronKrit'
	end
end

if $ARGS[0] = 'enemy':
	cla
	tip = 1
	strenA = strenV
	speedA = speedV
	agilA = agilV
	vitalA = vitalV
	!!skills
	boxingA = boxingV
	!!parameters
	healthA = healthV
	BonusA = BonusAtakV
	strenD = stren
	speedD = speed
	agilD = agil
	vitalD = vital
	!!skills
	boxingD = boxing
	!!parameters
	healthD = health
	BonusD = BonusDef
	initBonusA = initBonusV
	initBonus = 0
	initBonusV = 0

	if stun <= 0:
		xgt 'atak', 'popad'
	else
		'<b><font color="red">You can not move a critical hit</font></b>'
		xgt 'atak', 'uronKritV'
	end
end

if $ARGS[0] = 'popad':
	cla
	!!payment hit dodge
	poSp = speedA * 20 / 100
	uvAg = agilD * 20 / 100
	poBox = boxingA * 20 / 100
	uvBox = boxingD * 20 / 100
	popad = rand(boxingA - poBox, boxingA + poBox) + rand(speedA - poSp, speedA + poSp) + BonusA + initBonusA
	uvorot = rand(boxingD - uvBox, boxingD + uvBox) + rand(agilD - uvAg, agilD + uvAg) + BonusD
	uvorKoef = uvorot * 50 / 100
	popKoef = popad * 50 / 100

	if popad > uvorot:
		if popad >= uvorot + uvorKoef:
			!!Crete, very direct hit
			if tip = 0:
				!!attack players
				'<b><font color="green">critical hits</font></b>'
				xgt 'atak', 'uronKrit'
			else
				!!attack the enemy
				'<b><font color="red">critical hits</font></b>'
				xgt 'atak', 'uronKritV'
			end
		elseif popad < uvorot + uvorKoef:
			!!normal hit
			if tip = 0:
				!!attack players
				'<b><font color="green">Contact</font></b>'
				xgt 'atak', 'uron'
			else
				!!attack the enemy
				'<b><font color="red">Contact</font></b>'
				xgt 'atak', 'uronV'
			end
		end
	elseif popad <= uvorot:
		if popad + popKoef <= uvorot:
			!!critical blunder
			if tip = 0:
				!!attack players
				'<b><font color="red">CRITICAL SLIP</font></b>'
				xgt 'atak', 'uronKritV'
			else
				!!attack the enemy
				'<b><font color="green">CRITICAL SLIP</font></b>'
				xgt 'atak', 'uronKrit'
			end
		elseif popad + popKoef > uvorot:
			!!bloomer
			if tip = 0:
				!!attack players
				'<b><font color="red">is washed</font></b>'
				xgt 'fight', 'sta'
			else
				!!attack the enemy
				'<b><font color="green">is washed</font></b>'
				xgt 'fight', 'sta'
			end
		end
	end
end

if $ARGS[0] = 'uronKrit':
	cla
	damage = rand(stren, stren * 2) + weapbonus + magweapbonus

	if knife > 0:
		knibon = knife + 1
		knife = 0
		damage = damage * knibon
		knibon = 0
		'<b><font color="green">your opponent flies throwing knife</font></b>'
	end

	if defenceV <= 0 and klonV <= 0 and unmaterialV <= 0 and barierV <= 0:
		if dospehV > 0:damage -= dospehDefV & dospehEnV -= 1
		if damage < 0:damage = 0

		healthV -= damage

		if weaponTipe = 1:bloodV += rand(weapon / 4, weapon / 2)
		if weaponTipe = 2:stun += rand(1, 2)
		if weaponTipe = 3:bloodV += rand(weapon / 4, weapon / 2)

		if stunner > 0:
			stunner = 0
			stunV = rand(3, 6)
			'<b><font color="green">You are paralyzed the enemy <<stunV>> moves.</font></b>'
		end

		'<b><font color="green">Apply Done <<damage>> units</font></b>'

		if zerkaloV > 0:
			zerkaloV -= 1
			health -= damage
			'<b><font color="red"><<$nameV>> reflected the damage and you got <<damage>> points of damage</font></b>'
		end

		xgt 'fight', 'sta'
	elseif defenceV > 0 and klonV <= 0 and unmaterialV <= 0:
		defenceV -= damage
		'<b><font color="green">Protection of the enemy harmed <<damage>> units</font></b>'
		xgt 'fight', 'sta'
	elseif klonV > 0 and unmaterialV <= 0:
		klonV -= 1
		'<b><font color="green">Destroyed clone enemy, he still had <<KlonV>> clones</font></b>'
		xgt 'fight', 'sta'
	elseif unmaterialV > 0:
		unmaterialV -= 1
		'<b><font color="red">Your shot went straight through the opponent''s body. <<$nameV>> is not material</font></b>'
		xgt 'fight', 'sta'
	elseif barierV > 0:
		!!imeniteta barrier for damage
		if barierV >= damage:
			'<b><font color="red"><<$nameV>> easily withstood your butt</font></b>'
			xgt 'fight', 'sta'
		elseif barierV < damage:
			healthV -= damage

			if weaponTipe = 1:bloodV += rand(weapon / 4, weapon / 2)
			if weaponTipe = 2:stun += rand(1, 2)
			if weaponTipe = 3:bloodV += rand(weapon / 4, weapon / 2)

			if stunner > 0:
				stunV = rand(3, 6)
				'<b><font color="green">You are paralyzed the enemy <<stunV>> moves.</font></b>'
			end

			'<b><font color="green">Apply Done <<damage>> units</font></b>'

			if zerkaloV > 0:
				zerkaloV -= 1
				health -= damage
				'<b><font color="red"><<$nameV>> reflected the damage and you got <<damage>> points of damage</font></b>'
			end
		end

		xgt 'fight', 'sta'
	end
end

if $ARGS[0] = 'uron':
	cla
	stKo = stren * 20 / 100
	damage = rand(stren - stKo, stren + stKo) + weapbonus + magweapbonus

	if knife > 0:
		knibon = knife + 1
		knife = 0
		damage = damage * knibon
		knibon = 0
		'<b><font color="green">your opponent flies throwing knife</font></b>'
	end

	if defenceV <= 0 and klonV <= 0 and unmaterialV <= 0 and barierV <= 0:
		if dospehV > 0:damage -= dospehDefV & dospehEnV -= 1
		if damage < 0:damage = 0

		healthV -= damage

		if stunner > 0:
			stunner = 0
			stunV = rand(1, 3)
			'<b><font color="green">You are paralyzed the enemy <<stunV>> moves.</font></b>'
		end

		'<b><font color="green">Apply Done <<damage>> units</font></b>'

		if zerkaloV > 0:
			zerkaloV -= 1
			health -= damage
			'<b><font color="red"><<$nameV>> reflected the damage and you got <<damage>> points of damage</font></b>'
		end

		xgt 'fight', 'sta'
	elseif defenceV > 0 and klonV <= 0 and unmaterialV <= 0:
		defenceV -= damage
		'<b><font color="green">Protection of the enemy harmed <<damage>> units</font></b>'
		xgt 'fight', 'sta'
	elseif klonV > 0 and unmaterialV <= 0:
		klonV -= 1
		'<b><font color="green">Destroyed clone enemy, he still had <<KlonV>> clones</font></b>'
		xgt 'fight', 'sta'
	elseif unmaterialV > 0:
		unmaterialV -= 1
		'<b><font color="red">Your shot went straight through the opponent''s body. <<$nameV>> is not material</font></b>'
		xgt 'fight', 'sta'
	elseif barierV > 0:
		!!imeniteta barrier for damage
		if barierV >= damage:
			'<b><font color="red"><<$nameV>> easily withstood your butt</font></b>'
			xgt 'fight', 'sta'
		elseif barierV < damage:
			healthV -= damage
			if stunner > 0:
				stunV = rand(1, 3)
				'<b><font color="green">You are paralyzed the enemy <<stunV>> moves.</font></b>'
			end

			'<b><font color="green">Apply Done <<damage>> units</font></b>'

			if zerkaloV > 0:
				zerkaloV -= 1
				health -= damage
				'<b><font color="red"><<$nameV>> reflected the damage and you got <<damage>> points of damage</font></b>'
			end
		end

		xgt 'fight', 'sta'
	end
end

if $ARGS[0] = 'uronKritV':
	cla
	damage = rand(strenV, strenV * 2) + weapbonusV + magweapbonusV

	if knifeV > 0:
		knibonV = knifeV + 1
		knifeV = 0
		damage = damage * knibonV
		knibonV = 0
		'<b><font color="red">you throwing knife flies</font></b>'
	end

	if defence <= 0 and klon <= 0 and unmaterial <= 0 and barier <= 0:
		if dospeh > 0:damage -= dospehDef & dospehEn -= 1
		if damage < 0:damage = 0

		health -= damage

		if weaponTipeV = 1:blood += rand(weaponV / 4, weaponV / 2)
		if weaponTipeV = 2:stunV += rand(1, 2)
		if weaponTipeV = 3:blood += rand(weaponV / 4, weaponV / 2)

		if stunnerV > 0:
			stunnerV = 0
			stun = rand(3, 6)
			'<b><font color="red"><<$nameV>> paralyzed you to <<stun>> moves.</font></b>'
		end

		'<b><font color="red">You harmed <<damage>> units</font></b>'

		if zerkalo > 0:
			zerkalo -= 1
			healthV -= damage
			'<b><font color="green">You are repelled damage and <<$nameV>> to give <<damage>> points of damage</font></b>'
		end

		xgt 'fight', 'sta'
	elseif defence > 0 and klon <= 0 and unmaterial <= 0:
		defence -= damage
		'<b><font color="red">Protection of your harmed <<damage>> units</font></b>'
		xgt 'fight', 'sta'
	elseif klon > 0 and unmaterial <= 0:
		klon -= 1
		'<b><font color="red">destroy your clone, you have more <<Klon>> clones</font></b>'
		xgt 'fight', 'sta'
	elseif unmaterial > 0:
		unmaterial -= 1
		'<b><font color="green">Strike the enemy flew right through your body. YOU is not material</font></b>'
		xgt 'fight', 'sta'
	elseif barier > 0:
		!!imeniteta barrier for damage
		if barier >= damage:
			'<b><font color="green">You can easily withstood the impact of the opponent</font></b>'
			xgt 'fight', 'sta'
		else
			health -= damage

			if weaponTipeV = 1:blood += rand(weaponV / 4, weaponV / 2)
			if weaponTipeV = 2:stunV += rand(1, 2)
			if weaponTipeV = 3:blood += rand(weaponV / 4, weaponV / 2)

			if stunnerV > 0:
				stun = rand(3, 6)
				'<b><font color="red"><<$nameV>> paralyzed you to <<stun>> moves.</font></b>'
			end

			'<b><font color="red">You harmed <<damage>> units</font></b>'

			if zerkalo > 0:
				zerkalo -= 1
				healthV -= damage
				'<b><font color="green">You are repelled damage and <<$nameV>> to give <<damage>> points of damage</font></b>'
			end
		end

		xgt 'fight', 'sta'
	end
end

if $ARGS[0] = 'uronV':
	cla
	stKo = strenV * 20/100
	damage = rand(strenV - stKo, strenV + stKo) + weapbonusV + magweapbonusV

	if knifeV > 0:
		knibonV = knifeV + 1
		knifeV = 0
		damage = damage * knibonV
		knibonV = 0
		'<b><font color="red">you throwing knife flies</font></b>'
	end

	if defence <= 0 and klon <= 0 and unmaterial <= 0 and barier <= 0:
		if dospeh > 0:damage -= dospehDef & dospehEn -= 1
		if damage < 0:damage = 0

		health -= damage

		if stunnerV > 0:
			stunnerV = 0
			stun = rand(3, 6)
			'<b><font color="red"><<$nameV>> paralyzed you to <<stun>> moves.</font></b>'
		end

		'<b><font color="red">You harmed <<damage>> units</font></b>'

		if zerkalo > 0:
			zerkalo -= 1
			healthV -= damage
			'<b><font color="green">You are repelled damage and <<$nameV>> to give <<damage>> points of damage</font></b>'
		end

		xgt 'fight', 'sta'
	elseif defence > 0 and klon <= 0 and unmaterial <= 0:
		defence -= damage
		'<b><font color="red">Protection of your harmed <<damage>> units</font></b>'
		xgt 'fight', 'sta'
	elseif klon > 0 and unmaterial <= 0:
		klon -= 1
		'<b><font color="red">destroy your clone, you have more <<Klon>> clones</font></b>'
		xgt 'fight', 'sta'
	elseif unmaterial > 0:
		unmaterial -= 1
		'<b><font color="green">Strike the enemy flew right through your body. YOU is not material</font></b>'
		xgt 'fight', 'sta'
	elseif barier > 0:
		!!imeniteta barrier for damage
		if barier >= damage:
			'<b><font color="green">You can easily withstood the impact of the opponent</font></b>'
			xgt 'fight', 'sta'
		else
			health -= damage

			if stunnerV > 0:
				stun = rand(3, 6)
				'<b><font color="red"><<$nameV>> paralyzed you to <<stun>> moves.</font></b>'
			end

			'<b><font color="red">You harmed <<damage>> units</font></b>'

			if zerkalo > 0:
				zerkalo -= 1
				healthV -= damage
				'<b><font color="green">You are repelled damage and <<$nameV>> to give <<damage>> points of damage</font></b>'
			end
		end

		xgt 'fight', 'sta'
	end
end

--- atak ---------------------------------
