# atakM

menu_off = 1

if $ARGS[0] = 'atakVmana':
	cla
	!payment hit dodge
	poSp = speedV*20/100
	uvAg = pcs_agil*20/100
	poBox = reactV*20/100
	uvBox = pcs_react*20/100
	popad = RAND(reactV-poBox,reactV+poBox) + RAND(speedV-poSp,speedV+poSp)
	uvorot = RAND(pcs_react-uvBox,pcs_react+uvBox) + RAND(pcs_agil-uvAg,pcs_agil+uvAg)
	uvorKoef = uvorot*50/100
	popKoef = popad*50/100

	if popad > uvorot:
		if popad >= uvorot+uvorKoef:
			!Crete, very direct hit
			'<b><font color = red>Critical hits</font></b>'

			xgt'atakM','uronKritV'
		elseif popad < uvorot+uvorKoef:
			!Normal hit
			!He attacks the enemy
			'<b><font color = red>EYE</font></b>'

			xgt'atakM','uronV'
		end
	elseif popad <= uvorot:
		'<b><font color = green>LOST</font></b>'

		xgt'fight','sta'
	end
end

if $ARGS[0] = 'uronKritV':
	cla
	damage = RAND(1000,2000)
	damageM = RAND(1000,2000)

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

		'<b><font color = red>Your health harmed <<damage>> units</font></b>'
		'<b><font color = red>Your mana harmed <<damageM>> units</font></b>'

		if zerkalo > 0:
			zerkalo = zerkalo - 1
			healthV = healthV - damage

			'<b><font color = green>You are repelled and the damage <<$boydesc>> We received <<damage>> points of damage</font></b>'
		end

		xgt'fight','sta'
	end

	if defence > 0 and klon <= 0 and unmaterial <= 0:
		damSum = damage + damageM
		defence = defence - damSum

		'<b><font color = red>Your protection harmed <<damSum>> units</font></b>'

		xgt'fight','sta'
	end

	if klon > 0 and unmaterial <= 0:
		klon = klon - 1

		'<b><font color = red>It destroys your clone, Do you have more <<Klon>> Clones</font></b>'

		xgt'fight','sta'
	end

	if unmaterial > 0:
		unmaterial = unmaterial - 1

		'<b><font color = green>Beat the enemy flew right through your body. YOU are not material</font></b>'

		xgt'fight','sta'
	end

	if barier > 0:
		!imeniteta barrier for damage
		if barier >= damage:
			'<b><font color = green>You can easily withstand the impact of the enemy</font></b>'

			xgt'fight','sta'
		elseif barier < damage:
			pcs_mana = pcs_mana - damageM
			pcs_health = pcs_health - damage

			'<b><font color = red>You harmed <<damage>> units</font></b>'
			'<b><font color = red>Your mana harmed <<damageM>> units</font></b>'

			if zerkalo > 0:
				zerkalo = zerkalo - 1
				healthV = healthV - damage

				'<b><font color = green>You are repelled and the damage <<$boydesc>> We received <<damage>> points of damage</font></b>'
			end
		end

		xgt'fight','sta'
	end
end

if $ARGS[0] = 'uronV':
	cla
	damage = RAND(500,1000)
	damageM = RAND(500,1000)

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

		'<b><font color = red>Your health harmed <<damage>> units</font></b>'
		'<b><font color = red>Your mana harmed <<damageM>> units</font></b>'

		if zerkalo > 0:
			zerkalo = zerkalo - 1
			healthV = healthV - damage

			'<b><font color = green>You are repelled and the damage <<$boydesc>> We received <<damage>> points of damage</font></b>'
		end

		xgt'fight','sta'
	end

	if defence > 0 and klon <= 0 and unmaterial <= 0:
		damSum = damage + damageM
		defence = defence - damSum

		'<b><font color = red>Your protection harmed <<damSum>> units</font></b>'

		xgt'fight','sta'
	end

	if klon > 0 and unmaterial <= 0:
		klon = klon - 1

		'<b><font color = red>It destroys your clone, Do you have more <<Klon>> Clones</font></b>'

		xgt'fight','sta'
	end

	if unmaterial > 0:
		unmaterial = unmaterial - 1

		'<b><font color = green>Beat the enemy flew right through your body. YOU are not material</font></b>'

		xgt'fight','sta'
	end

	if barier > 0:
		!imeniteta barrier for damage
		if barier >= damage:
			'<b><font color = green>You can easily withstand the impact of the enemy</font></b>'

			xgt'fight','sta'
		elseif barier < damage:
			pcs_mana = pcs_mana - damageM
			pcs_health = pcs_health - damage

			'<b><font color = red>You harmed <<damage>> units</font></b>'
			'<b><font color = red>Your mana harmed <<damageM>> units</font></b>'

			if zerkalo > 0:
				zerkalo = zerkalo - 1
				healthV = healthV - damage

				'<b><font color = green>You are repelled and the damage <<$boydesc>> We received <<damage>> points of damage</font></b>'
			end
		end

		xgt'fight','sta'
	end
end

--- atakM ---------------------------------

