# atakB
if $ARGS[0] = 'atak':
cla
!расчет попадания уворота
set poSp = speed * 20/100
set uvAg = agilV * 20/100
set poBox = react * 20/100
set uvBox = reactV * 20/100
set popad = RAND(react - poBox, react + poBox) + RAND(speed-poSp, speed + poSp) + bonusSh
set uvorot = RAND(reactV - uvBox, reactV + uvBox) + RAND(agilV-uvAg, agilV + uvAg)
set uvorKoef = uvorot * 50/100
set popKoef = popad * 50/100
	if popad > uvorot:
		if popad >= uvorot + uvorKoef:
		!крит, очень точное попадание
		'<B><font color = green>critical hits</font></B>'
		gs 'atakB','uronKrit'
		end

		if popad < uvorot+uvorKoef:
		!нормальное попадание
		!атаковал противник
		'<B><font color = green>Contact</font></B>'
		gs 'atakB','uron'
		end
	end

	if popad <= uvorot:
	'<B><font color = red>is washed</font></B>'
	end
end


if $ARGS[0] = 'uronKrit':
cla
set damDef = defence/100
set damKoef = damDef * 20/100
set damage = RAND(damDef + damKoef, damDef + damKoef * 2)
gs 'atakB','damage'
end

if $ARGS[0] = 'uron':
cla
set damDef = defence/100
set damKoef = damDef * 20/100
set damage = RAND(damDef - damKoef, damDef + damKoef)
gs 'atakB','damage'
end

if $ARGS[0] = 'damage':
cla
	if defenceV <= 0 and klonV <= 0 and unmaterialV <= 0 and barierV <= 0:
	if dospehV > 0: set damageV -= dospehDefV & set dospehEn -= 1
	if damage < 0: set damage = 0
	Set healthV -= damage
	!Set manna -= damageM
		if eleSh > 0:
		set stunV = RAND(eleSh, eleSh * 3)
		'<B><font color = green><<$nameV>> paralyzed <<stunV>> rounds</font></B>'
		end
	'<B><font color = green>You have caused damage <<damage>> units</font></B>'
	!'<B><font color = red>caused damage your manna <<damageM>> units</font></B>'
		if zerkaloV > 0:
		set zerkaloV -= 1
		set defence -= damage
		'<B><font color = red><<$nameV>> reflected the damage and your defense has received <<damage>> points of damage</font></B>'
		end
	!xgt 'fight','sta'
	end

	if defenceV > 0 and klonV <= 0 and unmaterialV <= 0:
	!set damSum = damage + damageM
	!Set defence -= damSum
	Set defenceV -= damage
	'<B><font color = green>caused damage to your defense <<damage>> Protection of the enemy units</font></B>'
	!xgt 'fight','sta'
	end

	if klonV > 0 and unmaterialV <= 0:
	set klonV -= 1
	'<B><font color = green>Destroyed enemy clone</font></B>'
	!xgt 'fight','sta'
	end

	if unmaterialV > 0:
	set unmaterialV -= 1
	'<B><font color = red>Blow your protection passed through the body of the opponent. Opponents do not materials</font></B>'
	!xgt 'fight','sta'
	end

	if barierV > 0:
	!барьер именитета для урона
		if barierV >= damage:
		'<B><font color = red><<$nameV>> easily withstood kick your protection</font></B>'
		!xgt 'fight','sta'
		end
		if barierV < damage:
		!Set manna -= damageM
		!Set health -= damage
		Set healthV -= damage
			if eleSh > 0:
			set stunV = RAND(eleSh, eleSh * 3)
			'<B><font color = green><<$nameV>> paralyzed <<stunV>> rounds</font></B>'
			end
		'<B><font color = green>caused damage to your defense <<damage>> units</font></B>'
		!'<B><font color = red>caused damage your manna <<damageM>> units</font></B>'
			if zerkaloV > 0:
			set zerkaloV -= 1
			set defence -= damage
			'<B><font color = red>Enemy reflected damage and your defense received <<damage>> points of damage</font></B>'
			end
		end
	!xgt 'fight','sta'
	end

end
--- atakB ---------------------------------

