# init
!calculation initiatives
!Be sure to check for mills
!hod variable responsible for who will attack
!hod = 0 player attacks hod = 1 enemy attacks
!<font color=red><<$name>> </font>

if GedoMazo = 1 and stunV > 0:set stunV = 0&set mannaV = mannaV - 1000&'<font color=red><<$nameV>> with a deafening roar, emits large amounts of energy allows him to attack you again.</font>'

set initi = react*20/100
set initi = initi - dospehVes
if initi < 0:set initi = 0
set init = RAND (react-initi,react+initi) + initBonus
set initiV = reactV*20/100
set initiV = initiV - dospehVesV
if initiV < 0:set initiV = 0
set initV = RAND (reactV-initiV,reactV+initiV) + initBonusV

if hodtime >= 3 and stun = 0 and stunV = 0 and initBonus = 0:
!the player has already attacked three times
'<font color=red><<$nameV>> took the initiative</font>'
set hod = 1
set hodtime = 0
exit
end
if hodtimeV >= 3 and stun = 0 and stunV = 0 and initBonusV = 0:
!the enemy attacked three times already
'<font color=green>You took the initiative</font>'
set hod = 0
set hodtimeV = 0
exit
end


if stun = 0 and stunV = 0 and hodtime < 3 and hodtimeV < 3 or stun = 0 and stunV = 0 and initBonus > 0 or stun = 0 and stunV = 0 and initBonusV > 0:
!both are not in the camp
     if tuman = 0 and tumanV = 0:
     !no fog
         if init > initV:
         !initiative tackler
         '<font color=green>You took the initiative</font>'
         set hod = 0
         set hodtime = hodtime + 1
         exit
         end
         if init < initV:
         !initiative has captured the enemy
         '<font color=red><<$nameV>> seized the initiative</font>'
         set hod = 1
         set hodtimeV = hodtimeV + 1
         exit
         end
         if init = initV:
         set hod = RAND (0,1)
         if hod = 0:'<font color=green>You hardly took the initiative</font>'
         if hod = 1:'<font color=red><<$nameV>> hardly seized the initiative</font>'
         exit 
         end
     end
     if tuman > 0:
     !fog player
     set tuman = tuman - 1
     set initV = reactV-initiV
         if init > initV:
         !initiative tackler
         '<font color=green>In your fog <<$nameV>> does not have time for you</font>'
         set hod = 0
         set hodtime = hodtime + 1
         exit
         end
         if init < initV:
         !initiative has captured the enemy
         '<font color=red>In spite of your fog <<$nameV>> seized the initiative</font>'
         set hod = 1
         set hodtimeV = hodtimeV + 1
         exit
         end
         if init = initV:
         set hod = RAND (0,1) 
         if hod = 0:'<font color=green>You hardly seized the initiative in spite of your fog</font>'
         if hod = 1:'<font color=red><<$nameV>> despite your fog still seized the initiative</font>'
         exit
         end
     end
     if tumanV > 0:
     !fog enemy
     set tumanV = tumanV - 1
     set init = react-initi
         if init > initV:
         !initiative tackler
         '<font color=green>Despite the fog, You took the initiative</font>'
         set hod = 0
         set hodtime = hodtime + 1
         exit
         end
         if init < initV:
         !initiative has captured the enemy
         '<font color=red><<$nameV>> Use your fog easily captures initiative</font>'
         set hod = 1
         set hodtimeV = hodtimeV + 1
         exit
         end
         if init = initV:
         set hod = RAND (0,1) 
         if hod = 0:'<font color=green>You hardly seized the initiative despite the fog</font>'
         if hod = 1:'<font color=red><<$nameV>> Use your fog seized the initiative</font>'
         exit
         end
     end
end

if stun > 0:
!player in the camp
set stun = stun - 1
set hod = 1
if tuman > 0:set tuman = tuman - 1
if tumanV > 0:set tumanV = tumanV - 1
'<font color=red>You can not move and <<$nameV>> easily captures initiative</font>'
exit
end

if stunV > 0:
!the enemy in the camp
set stunV = stunV - 1
set hod = 0
if tuman > 0:set tuman = tuman - 1
if tumanV > 0:set tumanV = tumanV - 1
'<font color=green><<$nameV>> can not move and you can easily grab the initiative</font>'
exit
end

--- init ---------------------------------

