<?
session_start();
?>

<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ru">
<title>Мрак Подземелья:Восстание зла</title>
<head><meta http-equiv='content-type' content='application/xhtml+xml; charset=windows-1251'/>
<link rel='icon' href='ico1.ico' type='image/x-icon'>
<link rel='shortcut icon' href='ico1.ico' type='image/x-icon'>
<link rel="stylesheet" href="styleN.css" type="text/css" />
  
<?
include("db.php");
$db->openDB();
//проверяем имеется ли у игрока книга заклинаний
$prb = mysql_query("SELECT * FROM inv WHERE IL_KEY=\"i.magebook\" AND ID_USERS=\"$_SESSION[s]\"");
$nnick=mysql_query("SELECT * FROM users WHERE NICK=\"$_SESSION[s]\"");
$nnick2=mysql_fetch_assoc($nnick);
$vremya=time();
$src = $_GET['src'];
$a = $_GET['a'];
$ski = $_GET['ski'];
$usvrag = mysql_query("SELECT * FROM users WHERE NICK=\"$src\"");
$usvrag2 = mysql_fetch_assoc($usvrag);
$mob1 = mysql_query("SET NAMES cp1251");
$mob1=mysql_query("SELECT * FROM mobs_world WHERE MOBSid=\"$src\"");
$mob2=mysql_fetch_assoc($mob1);

$pers = mysql_query("SET NAMES cp1251");
$pers=mysql_query("SELECT * FROM mobs_world WHERE MOBSid=\"$src\"");
$pers2=mysql_fetch_assoc($pers);

$magA = mysql_query("SELECT * FROM magic_slots WHERE S_KEY_MAGIC=\"$ski\" AND S_NICK=\"$_SESSION[s]\"");
$magA2 = mysql_fetch_assoc($magA);
$dmg = rand($magA2[S_MIN_DMG],$magA2[S_MAX_DMG]);
$dmg2 = $dmg+($nnick2[SKILL_INT])/2;

if($nnick2[statys]==1){
echo"<div class=\"top\" style=\"color:white;text-align:center\">БИТВА</div><div class=\"line\"></div><div class=\"main\"><div style=\"padding:5px\"><center><img src=\"img/prizr.png\"></center><font color=\"black\"> <div style=\"padding-top:5px\"><b>
Вы призрак,вы не можете нападать на игроков или монстров</b></div><br/>";
echo"<div class=\"menu\" style=\"border:1px black dotted;\"><li><a href=\"game.php\"><font color=\"#A23232\"><img src=\"img/clan.png\"> покинуть бой</font></a></font></li></div>";
echo"</div>";
include("footer.php");
die;}
if(mysql_num_rows($mob1)<1 AND substr($src,0,4)=='n_c_'){echo"<div class=\"main_title\"><a href=\"game.php\">в игру</a><center>неверная цель,либо такого монстра не существует</center></div>";die;}
if($mob2[loc_mob]!=$nnick2[loc] AND substr($src,0,4)=='n_c_'){echo"<div class=\"main_title\"><a href=\"game.php\">в игру</a><center>этого монстра рядом с вами нет!</center></div>";die;}

if($vremya-$nnick2[gametime]>600){
include ("accaunt.php");
$AC->ACCAUNT();//Проверка Аккаунта
}

?>

<div class="main_foot"><font color="white">
<?
echo "<img src=\"img/hp.png\"> $nnick2[MINhp]/$nnick2[MAXhp] <img src=\"img/mp.png\">$nnick2[MINmp]/$nnick2[MAXmp] <img src=\"img/LVL.png\"> $nnick2[LVL_USERS]";
?></font>
</div>

<div class="line"></div>
<div class='main' style='word-wrap:break-word;'>

<?if($mob2[mb_MINhp]>0 AND substr($src,0,4)=='n_c_'){echo"<div class=\"top\">";}?>
<?if($mob2[mb_MINhp]<1 AND substr($src,0,4)=='n_c_'){
echo"<div class=\"top\" style=\"color:white;text-align:center\">БИТВА</div><div class=\"line\"></div><div class=\"main\"><div style=\"padding:5px\"><center><img src=\"img/monde.png\"></center><font color=\"black\"> <div style=\"padding-top:5px\"><b>
Монстр мертв!</b></div><br/>";
echo"<div class=\"menu\" style=\"border:1px black dotted;\"><li><a href=\"game.php\"><font color=\"#A23232\"><img src=\"img/clan.png\"> покинуть бой</font></a></font></li></div>";
echo"</div>";
include("footer.php");
die;}
?>
<center><b>
<?
###Определяем человек это или моб
$mob_A = rand($mob2[MNdmg],$mob2[MAXdmg]);//удар моба
$mob_D = rand(0,$mob2[MD_DEFENCE]);//броня моба
$usvr_D = rand(0,$usvrag2[DEFENCE]);//броня игрока(ВРАГА)
$usvr_U = rand(0,100);//уклон игрока(ВРАГА)
$usvr_B = rand(0,100);//блок игрока(ВРАГА)
$mob_MD = rand(0,$mob2[MD_MAGIC]);//маг.броня моба
$mob_U = rand(0,100);//уворот моба
$mob_B = rand(0,100);//блок моба
$mob_T = $mob2[M_TOCH];//точность моба
$mob_T1 = rand(0,100);//точность моба
$mob_K = $mob2[M_KRIT];//крит моба
$mob_K1 = rand(0,200);//крит моба
$use_AM = rand($nnick2[MG_DMGmin],$nnick2[MG_DMGmax]);//удар игрока(магией)
$use_A = rand($nnick2[DAMAGEmin],$nnick2[DAMAGEmax]);//удар игрока(физой)
$use_T = $nnick2[U_TOCH];//точность игрока
$use_T1 = rand(0,100);//точность игрока
$use_K = $nnick2[SHANS_KRIT];//крит игрока
$use_K1 = rand(0,200);//крит игрока
$use_U = rand(0,100);//уклон игрока
$use_B = rand(0,100);//блок игрока
$use_D = rand(0,$nnick2[DEFENCE]);//броня игрока


$tud = time();
$usmd = ($use_A-$mob_D);
$mobd = ($mob_A-$use_D);
$usmagic = ($use_AM-$mob_MD);
$ttm = time()+$mob2[m_timeOD];
$ttt = time()+$nnick2[time_otdix];

if(substr($src,0,4)=="n_c_"){
	echo"<font color=\"white\">БИТВА</font>";

if($mob2[mb_MINhp]>0 AND $nnick2[MINhp]>0 AND !isset($ski)){
//проверяем одет ли у игрока луки
$bowp = mysql_query("SELECT * FROM inv WHERE IL_CLASS=\"bow\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$arrp = mysql_query("SELECT * FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$arrp2 = mysql_fetch_assoc($arrp);
if(mysql_num_rows($bowp)>0 AND mysql_num_rows($arrp)<1){
echo"</div><font color=\"red\"><center> <div class=\"main_title\">у вас нету стрел,либо оружие не одето</div></center>
<div class=\"menu\"><li><a href=\"game.php\">в игру</a></li></div></font>";
include("footer.php");
die;
}


if($nnick2[timer_od]-$tud>0){
$tvm = $nnick2[timer_od]-$tud;
$lU = mysql_query("INSERT INTO logs (L_CONT,COU_DMG,POPAL_ILI_NET,NAPADENIE,DEFENDER,L_TIME,L_LOC,L_KEY) VALUES (' нужно отдохнуть ','$tvm',' <font color=\"brown\">( сек.)</font>','$_SESSION[s]','','$vremya','$nnick2[loc]','$mob2[MOBSid]')");
$timUS = mysql_query("UPDATE users SET need_otdix=\"$tvm\" WHERE NICK=\"$_SESSION[s]\"");
}
#############################################ПОПАЛ ИГРОК АТАКУЕТ МОБА
if($use_A>$mob_D AND $a=='attck' AND $use_T>=$use_T1 AND $nnick2[DAMAGEmax]>0 AND $mob2[M_UKLON]<$mob_U AND $mob2[M_BLOCK]<$mob_B AND $use_K<$use_K1 AND $mob2[mb_MINhp]>$usmd AND $nnick2[timer_od]-$tud<1 AND !isset($ski)){

$minmh = $mob2[mb_MINhp]-$usmd;//отнимаем здоровье у моба
$lU = mysql_query("INSERT INTO logs (COU_DMG,POPAL_ILI_NET,NAPADENIE,DEFENDER,L_TIME,L_LOC,L_KEY) VALUES (' - $usmd',' <font color=\"brown\">(ФИЗ)</font>','$_SESSION[s]','$mob2[MOBSname]','$vremya','$nnick2[loc]','$mob2[MOBSid]')");
$timUS = mysql_query("UPDATE users SET need_otdix=\"$nnick2[time_otdix]\",timer_od=\"$ttt\" WHERE NICK=\"$_SESSION[s]\"");
$minmb = mysql_query("UPDATE mobs_world SET mb_MINhp=\"$minmh\" WHERE MOBSid=\"$src\"");//создаем запрос на отнимание здоровья у моба

if(mysql_num_rows($bowp)>0 AND mysql_num_rows($arrp)>0){
$arrp = mysql_query("SELECT * FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$arrp2 = mysql_fetch_assoc($arrp);
if($arrp2[IL_COUNT]>0){
$armi = $arrp2[IL_COUNT]-1;
$updar = mysql_query("UPDATE inv SET IL_COUNT=\"$armi\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");}
if($arrp2[IL_COUNT]<=1){
$updari = mysql_query("UPDATE inv SET IL_NO=\"0\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$updar = mysql_query("DELETE FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
}

}
}//тут физический урон, если попал,не уворот,не блок,не крит,здоровье моба больше чем удар игрока,урон больше 0


if($use_AM>$mob_MD AND $a=='attck' AND $use_T>=$use_T1 AND $nnick2[MG_DMGmax]>0 AND $use_K<$use_K1 AND $mob2[mb_MINhp]>$usmagic AND $nnick2[timer_od]-$tud<1 AND !isset($ski)){

$minmh = $mob2[mb_MINhp]-$usmagic;//отнимаем здоровье у моба
$lU = mysql_query("INSERT INTO logs (COU_DMG,POPAL_ILI_NET,NAPADENIE,DEFENDER,L_TIME,L_LOC,L_KEY) VALUES (' - $usmagic',' <font color=\"darkblue\">(МАГ)</font>','$_SESSION[s]','$mob2[MOBSname]','$vremya','$nnick2[loc]','$mob2[MOBSid]')");
$timUS = mysql_query("UPDATE users SET need_otdix=\"$nnick2[time_otdix]\",timer_od=\"$ttt\" WHERE NICK=\"$_SESSION[s]\"");
$minmb = mysql_query("UPDATE mobs_world SET mb_MINhp=\"$minmh\" WHERE MOBSid=\"$src\"");//создаем запрос на отнимание здоровья у моба

if(mysql_num_rows($bowp)>0 AND mysql_num_rows($arrp)>0){
$arrp = mysql_query("SELECT * FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$arrp2 = mysql_fetch_assoc($arrp);
if($arrp2[IL_COUNT]>0){
$armi = $arrp2[IL_COUNT]-1;
$updar = mysql_query("UPDATE inv SET IL_COUNT=\"$armi\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");}
if($arrp2[IL_COUNT]<=1){
$updari = mysql_query("UPDATE inv SET IL_NO=\"0\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$updar = mysql_query("DELETE FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
}

}
}//тут магический урон, если попал,не крит,здоровье моба больше чем удар игрока,урон больше 0





if($use_A<=$mob_D AND $a=='attck' AND $use_T>=$use_T1 AND $nnick2[DAMAGEmax]>0 AND $mob2[M_UKLON]<$mob_U AND $mob2[M_BLOCK]<$mob_B AND $use_K<$use_K1 AND $mob2[mb_MINhp]>$usmd AND $nnick2[timer_od]-$tud<1 AND !isset($ski)){
$lU = mysql_query("INSERT INTO logs (COU_DMG,POPAL_ILI_NET,NAPADENIE,DEFENDER,L_TIME,L_LOC,L_KEY) VALUES ('0',' <font color=\"browm\">(ФИЗ)</font>','$_SESSION[s]','$mob2[MOBSname]','$vremya','$nnick2[loc]','$mob2[MOBSid]')");
$timUS = mysql_query("UPDATE users SET need_otdix=\"$nnick2[time_otdix]\",timer_od=\"$ttt\" WHERE NICK=\"$_SESSION[s]\"");
if(mysql_num_rows($bowp)>0 AND mysql_num_rows($arrp)>0){
$arrp = mysql_query("SELECT * FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$arrp2 = mysql_fetch_assoc($arrp);
if($arrp2[IL_COUNT]>0){
$armi = $arrp2[IL_COUNT]-1;
$updar = mysql_query("UPDATE inv SET IL_COUNT=\"$armi\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");}
if($arrp2[IL_COUNT]<=1){
$updari = mysql_query("UPDATE inv SET IL_NO=\"0\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$updar = mysql_query("DELETE FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
}

}
}//тут физический урон, если попал,не уворот,не блок,не крит,здоровье моба больше чем удар игрока,урон меньше 1


if($use_AM<=$mob_MD AND $a=='attck' AND $use_T>=$use_T1 AND $nnick2[MG_DMGmax]>0 AND $use_K<$use_K1 AND $mob2[mb_MINhp]>$usmagic AND $nnick2[timer_od]-$tud<1 AND !isset($ski)){
$lU = mysql_query("INSERT INTO logs (COU_DMG,POPAL_ILI_NET,NAPADENIE,DEFENDER,L_TIME,L_LOC,L_KEY) VALUES ('0',' <font color=\"darkblue\">(МАГ)</font>','$_SESSION[s]','$mob2[MOBSname]','$vremya','$nnick2[loc]','$mob2[MOBSid]')");
$timUS = mysql_query("UPDATE users SET need_otdix=\"$nnick2[time_otdix]\",timer_od=\"$ttt\" WHERE NICK=\"$_SESSION[s]\"");
if(mysql_num_rows($bowp)>0 AND mysql_num_rows($arrp)>0){
$arrp = mysql_query("SELECT * FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$arrp2 = mysql_fetch_assoc($arrp);
if($arrp2[IL_COUNT]>0){
$armi = $arrp2[IL_COUNT]-1;
$updar = mysql_query("UPDATE inv SET IL_COUNT=\"$armi\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");}
if($arrp2[IL_COUNT]<=1){
$updari = mysql_query("UPDATE inv SET IL_NO=\"0\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$updar = mysql_query("DELETE FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
}

}
}//тут магический урон, если попал,не крит,здоровье моба больше чем удар игрока,урон меньше 1





if($use_A>$mob_D AND $a=='attck' AND $use_T>=$use_T1 AND $nnick2[DAMAGEmax]>0 
AND $mob2[M_UKLON]<$mob_U AND $mob2[M_BLOCK]<$mob_B AND $use_K<$use_K1 
AND $mb2[mb_MINhp]<=$usmd AND $nnick2[timer_od]-$tud<1 
AND !isset($ski)){

echo"</div>";
?>
<table><tr>

</tr>
<tr>
<td height="164" align="center" valign="top" bgcolor="#FFE7BA"><b><font color="#a23232"><img src="img/4.png" width="160" height="160"></font></b></td>
</tr>
<tr>
<td height="10" align="left" valign="top" bgcolor="#a23232" width="550" style="border:2px #FFE7BA dotted"><b><font color="#FFE7BA">
<div style="padding:5px">
<img src="img/necr.png" width="18" height="18">1 БОЙ ЗАВЕРШЕН. ТЫ ПОБЕДИЛ!</font></b></div></td>
</tr>
<tr>
<td height="10" align="left" valign="top" bgcolor="#a23232" width="550" style="border:2px #FFE7BA dotted">
<div style="padding:5px">
<b><font color="#FFE7BA"><img src="img/star.png" width="18" height="18"> ОПЫТ +<?echo $mob2[EXP_p];?></font></b></div></td>
</tr>

    <td height="10" align="left" valign="top" bgcolor="#a23232" width="550" style="border:2px #FFE7BA dotted"><div class="menu"><li><a href="game.php"><b><font color="#FFE7BA"> <img src="img/win.png" alt="" width="18" height="18"> ПОКИНУТЬ БОЙ</font></b></a></li></div></td>
</tr>
</table>
<?include("footer.php");?>
<?
$moexp2 = $nnick2[EXPnow]+$mob2[EXP_p];
$t = time();

$users = mysql_query("SET NAMES cp1251");
$users = mysql_query("SELECT * FROM mobs_drop WHERE DI_IDENTIFIKATOR=\"$mob2[ALL_KEY]\"");
$users2 = mysql_fetch_assoc($users);
$rnd = rand($users2[DI_RANDOM_MIN],$users2[DI_RANDOM_MAX]);




$letters = 'abcdefghijklmnopqrstuvwxyz0123456789_';
$word_lenght = 6;
$size_letters = strlen($letters)-1;
for($i=0;$i<6;$i++){
while($word_lenght--){
$pass.=$letters[rand(0,$size_letters)];
}
$word_lenght = 6;
$password.=$pass.'-';
$pass = '';
}
$password = substr($password,0,strlen($password)-1);


$tdr = time()+600;
$dob_trup = mysql_query("INSERT INTO died (D_NAME,D_KEY,IDENTIFIKATOR,D_LOC,TIMER) 
VALUES ('$mob2[MOBSname]','$src','$password','$nnick2[loc]','$tdr')");//добавляем трупа
$mobdr = mysql_query("SET NAMES cp1251");
$mobdr = mysql_query("SELECT * FROM mobs_drop WHERE DI_IDENTIFIKATOR=\"$mob2[ALL_KEY]\"");
while($mobdrop = mysql_fetch_assoc($mobdr)){
$rnd = rand($mobdrop[DI_RANDOM_MIN],$mobdrop[DI_RANDOM_MAX]);
if($rnd<=$mobdrop[DI_IL_SHS]){
$dropcount = rand($mobdrop[IL_COUNT_MIN],$mobdrop[IL_COUNT_MAX]);
$dob_trup = mysql_query("INSERT INTO died_items 
(DI_IT_LVL,DI_IT_CLASS,ID_ALL_CLASS,DI_IL_SUBCLASS,
DI_IL_NAME,DI_IL_COST,DI_IL_KEY,DI_IL_MIN_DMG,
DI_IL_MAX_DMG,DI_IL_MAGD_MIN,DI_IL_MAGD_MAX,
DI_IL_BLOCK,DI_IL_DEF,DI_IL_MDEF,DI_IL_STR,
DI_IL_DEX,DI_IL_INT,DI_IL_SPD,DI_IL_MIN_PROCH,DI_IL_MAX_PROCH,DI_IL_TREBUET,DI_IL_IMAGE,
DI_IL_SRC,DI_IL_NO,DI_IL_SHANS_BLOCK,DI_IL_FIRE,DI_IL_WIND,DI_IL_EARTH,DI_IL_DARK,
DI_BONUS_HP,DI_BONUS_MP,DI_BONUS_MDEF,DI_BONUS_DAM,DI_BONUS_KRIT,BONUS_UKL,
BONUS_VES,IL_UPGRADE,IL_COUNT,IL_VREME,IL_TVRE,IL_DESC,DI_IDENTIFIKATOR,
TIME) 
VALUES ('$mobdrop[DI_IT_LVL]','$mobdrop[DI_IT_CLASS]',
'$mobdrop[ID_ALL_CLASS]','$mobdrop[DI_IL_SUBCLASS]',
'$mobdrop[DI_IL_NAME]','$mobdrop[DI_IL_COST]',
'$mobdrop[DI_IL_KEY]','$mobdrop[DI_IL_MIN_DMG]',
'$mobdrop[DI_IL_MAX_DMG]','$mobdrop[DI_IL_MAGD_MIN]',
'$mobdrop[DI_IL_MAGD_MAX]','$mobdrop[DI_IL_BLOCK]',
'$mobdrop[DI_IL_DEF]','$mobdrop[DI_IL_MDEF]','$mobdrop[DI_IL_STR]',
'$mobdrop[DI_IL_DEX]','$mobdrop[DI_IL_INT]','$mobdrop[DI_IL_SPD]',
'$mobdrop[DI_IL_MIN_PROCH]','$mobdrop[DI_IL_MAX_PROCH]',
'$mobdrop[DI_IL_TREBUET]','$mobdrop[DI_IL_IMAGE]',
'$mobdrop[DI_IL_SRC]','0','$mobdrop[DI_IL_SHANS_BLOCK]',
'$mobdrop[DI_IL_FIRE]','$mobdrop[DI_IL_WIND]',
'$mobdrop[DI_IL_EARTH]','$mobdrop[DI_IL_DARK]',
'$mobdrop[DI_BONUS_HP]','$mobdrop[DI_BONUS_MP]',
'$mobdrop[DI_BONUS_MDEF]','$mobdrop[DI_BONUS_DAM]',
'$mobdrop[DI_BONUS_KRIT]','$mobdrop[BONUS_UKL]',
'$mobdrop[DI_BONUS_VES]','$mobdrop[IL_UPGRADE]',
'$dropcount','$mobdrop[IL_VREME]',
'$mobdrop[IL_TVRE]','$mobdrop[IL_DESC]','$password','$tdr')");//добавляем трупу вещи

}

}
$moexp = mysql_query("UPDATE users SET EXPnow=\"$moexp2\" WHERE NICK=\"$_SESSION[s]\"");//добавляем золото и опыт игроку
$lU = mysql_query("INSERT INTO logs (COU_DMG,POPAL_ILI_NET,NAPADENIE,DEFENDER,L_TIME,L_LOC,L_KEY) VALUES ('$usmd',' <font color=\"brown\">(ФИЗ)</font>','$_SESSION[s]','$mob2[MOBSname]','$vremya','$nnick2[loc]','$mob2[MOBSid]')");
$timUS = mysql_query("UPDATE users SET need_otdix=\"$nnick2[time_otdix]\",timer_od=\"$ttt\" WHERE NICK=\"$_SESSION[s]\"");
$ress = time()+$mob2[MNTM];
$minmb = mysql_query("UPDATE mobs_world SET mb_MINhp=\"0\",M_TIME=\"$ress\" WHERE MOBSid=\"$src\"");//создаем запрос на отнимание здоровья у моба
if(mysql_num_rows($bowp)>0 AND mysql_num_rows($arrp)>0){
$arrp = mysql_query("SELECT * FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$arrp2 = mysql_fetch_assoc($arrp);
if($arrp2[IL_COUNT]>0){
$armi = $arrp2[IL_COUNT]-1;
$updar = mysql_query("UPDATE inv SET IL_COUNT=\"$armi\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");}
if($arrp2[IL_COUNT]<=1){
$updari = mysql_query("UPDATE inv SET IL_NO=\"0\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$updar = mysql_query("DELETE FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
}

}
die;
}//тут физический урон, если попал,не уворот,не блок,не крит,здоровье моба меньше чем чем удар игрока,урон больше 0



if($use_AM>$mob_MD AND $a=='attck' AND $use_T>=$use_T1 AND $nnick2[MG_DMGmax]>0 AND $use_K<$use_K1 AND $mob2[mb_MINhp]<=$usmagic AND $nnick2[timer_od]-$tud<1 AND !isset($ski)){

echo"</div>";
?>
<table><tr>

</tr>
<tr>
<td height="164" align="center" valign="top" bgcolor="#FFE7BA"><b><font color="#a23232"><img src="img/4.png" width="160" height="160"></font></b></td>
</tr>
<tr>
<td height="10" align="left" valign="top" bgcolor="#a23232" width="550" style="border:2px #FFE7BA dotted"><b><font color="#FFE7BA">
<div style="padding:5px">
<img src="img/necr.png" width="18" height="18">2 БОЙ ЗАВЕРШЕН. ТЫ ПОБЕДИЛ!</font></b></div></td>
</tr>
<tr>
<td height="10" align="left" valign="top" bgcolor="#a23232" width="550" style="border:2px #FFE7BA dotted">
<div style="padding:5px">
<b><font color="#FFE7BA"><img src="img/star.png" width="18" height="18"> ОПЫТ +<?echo $mob2[EXP_p];?></font></b></div></td>
</tr>
    <td height="10" align="left" valign="top" bgcolor="#a23232" width="550" style="border:2px #FFE7BA dotted"><div class="menu"><li><a href="game.php"><b><font color="#FFE7BA"> <img src="img/win.png" alt="" width="18" height="18"> ПОКИНУТЬ БОЙ</font></b></a></li></div></td>
</tr>
</table>
<?include("footer.php");?>
<?
$moexp2 = $nnick2[EXPnow]+$mob2[EXP_p];
$t = time();
$users = mysql_query("SET NAMES cp1251");
$users = mysql_query("SELECT * FROM mobs_drop WHERE DI_IDENTIFIKATOR=\"$mob2[ALL_KEY]\"");
$users2 = mysql_fetch_assoc($users);
$rnd = rand($users2[DI_RANDOM_MIN],$users2[DI_RANDOM_MAX]);




$letters = 'abcdefghijklmnopqrstuvwxyz0123456789_';
$word_lenght = 6;
$size_letters = strlen($letters)-1;
for($i=0;$i<6;$i++){
while($word_lenght--){
$pass.=$letters[rand(0,$size_letters)];
}
$word_lenght = 6;
$password.=$pass.'-';
$pass = '';
}
$password = substr($password,0,strlen($password)-1);
$tdr = time()+600;

$dob_trup = mysql_query("INSERT INTO died (D_NAME,D_KEY,IDENTIFIKATOR,D_LOC,TIMER) VALUES ('$mob2[MOBSname]','$src','$password','$nnick2[loc]','$tdr')");//добавляем трупа
$mobdr = mysql_query("SET NAMES cp1251");
$mobdr = mysql_query("SELECT * FROM mobs_drop WHERE DI_IDENTIFIKATOR=\"$mob2[ALL_KEY]\"");
while($mobdrop = mysql_fetch_assoc($mobdr)){
$rnd = rand($mobdrop[DI_RANDOM_MIN],$mobdrop[DI_RANDOM_MAX]);
if($rnd<=$mobdrop[DI_IL_SHS]){
$dropcount = rand($mobdrop[IL_COUNT_MIN],$mobdrop[IL_COUNT_MAX]);
$dob_trup = mysql_query("INSERT INTO died_items 
(DI_IT_LVL,DI_IT_CLASS,ID_ALL_CLASS,DI_IL_SUBCLASS,
DI_IL_NAME,DI_IL_COST,DI_IL_KEY,DI_IL_MIN_DMG,
DI_IL_MAX_DMG,DI_IL_MAGD_MIN,DI_IL_MAGD_MAX,
DI_IL_BLOCK,DI_IL_DEF,DI_IL_MDEF,DI_IL_STR,
DI_IL_DEX,DI_IL_INT,DI_IL_SPD,DI_IL_MIN_PROCH,DI_IL_MAX_PROCH,DI_IL_TREBUET,DI_IL_IMAGE,
DI_IL_SRC,DI_IL_NO,DI_IL_SHANS_BLOCK,DI_IL_FIRE,DI_IL_WIND,DI_IL_EARTH,DI_IL_DARK,
DI_BONUS_HP,DI_BONUS_MP,DI_BONUS_MDEF,DI_BONUS_DAM,DI_BONUS_KRIT,BONUS_UKL,
BONUS_VES,IL_UPGRADE,IL_COUNT,IL_VREME,IL_TVRE,IL_DESC,DI_IDENTIFIKATOR,
TIME) 
VALUES ('$mobdrop[DI_IT_LVL]','$mobdrop[DI_IT_CLASS]',
'$mobdrop[ID_ALL_CLASS]','$mobdrop[DI_IL_SUBCLASS]',
'$mobdrop[DI_IL_NAME]','$mobdrop[DI_IL_COST]',
'$mobdrop[DI_IL_KEY]','$mobdrop[DI_IL_MIN_DMG]',
'$mobdrop[DI_IL_MAX_DMG]','$mobdrop[DI_IL_MAGD_MIN]',
'$mobdrop[DI_IL_MAGD_MAX]','$mobdrop[DI_IL_BLOCK]',
'$mobdrop[DI_IL_DEF]','$mobdrop[DI_IL_MDEF]','$mobdrop[DI_IL_STR]',
'$mobdrop[DI_IL_DEX]','$mobdrop[DI_IL_INT]','$mobdrop[DI_IL_SPD]',
'$mobdrop[DI_IL_MIN_PROCH]','$mobdrop[DI_IL_MAX_PROCH]',
'$mobdrop[DI_IL_TREBUET]','$mobdrop[DI_IL_IMAGE]',
'$mobdrop[DI_IL_SRC]','0','$mobdrop[DI_IL_SHANS_BLOCK]',
'$mobdrop[DI_IL_FIRE]','$mobdrop[DI_IL_WIND]',
'$mobdrop[DI_IL_EARTH]','$mobdrop[DI_IL_DARK]',
'$mobdrop[DI_BONUS_HP]','$mobdrop[DI_BONUS_MP]',
'$mobdrop[DI_BONUS_MDEF]','$mobdrop[DI_BONUS_DAM]',
'$mobdrop[DI_BONUS_KRIT]','$mobdrop[BONUS_UKL]',
'$mobdrop[DI_BONUS_VES]','$mobdrop[IL_UPGRADE]',
'$dropcount','$mobdrop[IL_VREME]',
'$mobdrop[IL_TVRE]','$mobdrop[IL_DESC]','$password','$tdr')");//добавляем трупу вещи

}

}
$moexp = mysql_query("UPDATE users SET EXPnow=\"$moexp2\" WHERE NICK=\"$_SESSION[s]\"");//добавляем золото и опыт игроку
$lU = mysql_query("INSERT INTO logs (COU_DMG,POPAL_ILI_NET,NAPADENIE,DEFENDER,L_TIME,L_LOC,L_KEY) VALUES ('$usmagic',' <font color=\"darkblue\">(МАГ)</font>','$_SESSION[s]','$mob2[MOBSname]','$vremya','$nnick2[loc]','$mob2[MOBSid]')");
$timUS = mysql_query("UPDATE users SET need_otdix=\"$nnick2[time_otdix]\",timer_od=\"$ttt\" WHERE NICK=\"$_SESSION[s]\"");
$ress = time()+$mob2[MNTM];
$minmb = mysql_query("UPDATE mobs_world SET mb_MINhp=\"0\",M_TIME=\"$ress\" WHERE MOBSid=\"$src\"");//создаем запрос на отнимание здоровья у моба
include("footer.php");
if(mysql_num_rows($bowp)>0 AND mysql_num_rows($arrp)>0){
$arrp = mysql_query("SELECT * FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$arrp2 = mysql_fetch_assoc($arrp);
if($arrp2[IL_COUNT]>0){
$armi = $arrp2[IL_COUNT]-1;
$updar = mysql_query("UPDATE inv SET IL_COUNT=\"$armi\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");}
if($arrp2[IL_COUNT]<=1){
$updari = mysql_query("UPDATE inv SET IL_NO=\"0\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$updar = mysql_query("DELETE FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
}

}
die;
}//тут магический урон, если попал,не крит,здоровье моба меньше чем чем удар игрока,урон больше 0


if($use_A<=$mob_D AND $a=='attck' AND $use_T>=$use_T1 AND $nnick2[DAMAGEmax]>0 AND $mob2[M_UKLON]<$mob_U AND $mob2[M_BLOCK]<$mob_B AND $use_K<$use_K1 AND $mob2[mb_MINhp]<=$usmd AND $nnick2[timer_od]-$tud<1 AND !isset($ski)){
$lU = mysql_query("INSERT INTO logs (COU_DMG,POPAL_ILI_NET,NAPADENIE,DEFENDER,L_TIME,L_LOC,L_KEY) VALUES ('0',' <font color=\"browm\">(ФИЗ)</font>','$_SESSION[s]','$mob2[MOBSname]','$vremya','$nnick2[loc]','$mob2[MOBSid]')");
$timUS = mysql_query("UPDATE users SET need_otdix=\"$nnick2[time_otdix]\",timer_od=\"$ttt\" WHERE NICK=\"$_SESSION[s]\"");
if(mysql_num_rows($bowp)>0 AND mysql_num_rows($arrp)>0){
$arrp = mysql_query("SELECT * FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$arrp2 = mysql_fetch_assoc($arrp);
if($arrp2[IL_COUNT]>0){
$armi = $arrp2[IL_COUNT]-1;
$updar = mysql_query("UPDATE inv SET IL_COUNT=\"$armi\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");}
if($arrp2[IL_COUNT]<=1){
$updari = mysql_query("UPDATE inv SET IL_NO=\"0\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$updar = mysql_query("DELETE FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
}

}
}//тут физический урон, если попал,не уворот,не блок,не крит,здоровье моба меньше чем удар игрока,урон меньше 1


if($use_AM<=$mob_MD AND $a=='attck' AND $use_T>=$use_T1 AND $nnick2[MG_DMGmax]>0 AND $use_K<$use_K1 AND $mob2[mb_MINhp]<=$usmagic AND $nnick2[timer_od]-$tud<1 AND !isset($ski)){
$lU = mysql_query("INSERT INTO logs (COU_DMG,POPAL_ILI_NET,NAPADENIE,DEFENDER,L_TIME,L_LOC,L_KEY) VALUES ('GHJ0',' <font color=\"darkblue\">(МАГ)</font>','$_SESSION[s]','$mob2[MOBSname]','$vremya','$nnick2[loc]','$mob2[MOBSid]')");
$timUS = mysql_query("UPDATE users SET need_otdix=\"$nnick2[time_otdix]\",timer_od=\"$ttt\" WHERE NICK=\"$_SESSION[s]\"");
if(mysql_num_rows($bowp)>0 AND mysql_num_rows($arrp)>0){
$arrp = mysql_query("SELECT * FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$arrp2 = mysql_fetch_assoc($arrp);
if($arrp2[IL_COUNT]>0){
$armi = $arrp2[IL_COUNT]-1;
$updar = mysql_query("UPDATE inv SET IL_COUNT=\"$armi\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");}
if($arrp2[IL_COUNT]<=1){
$updari = mysql_query("UPDATE inv SET IL_NO=\"0\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$updar = mysql_query("DELETE FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
}

}
}//тут магический урон, если попал,не крит,здоровье моба меньше чем удар игрока,урон меньше 1



#############################################ПРОМАХ ИГРОК АТАКУЕТ МОБА
if($use_A>$mob_D AND $a=='attck' AND $use_T<$use_T1 AND $nnick2[DAMAGEmax]>0 AND $mob2[M_UKLON]<$mob_U AND $mob2[M_BLOCK]<$mob_B AND $use_K<$use_K1 AND $nnick2[timer_od]-$tud<1 AND !isset($ski)){
$lU = mysql_query("INSERT INTO logs (COU_DMG,POPAL_ILI_NET,NAPADENIE,DEFENDER,L_TIME,L_LOC,L_KEY) VALUES ('0',' <font color=\"blue\">(промах)</font>','$_SESSION[s]','$mob2[MOBSname]','$vremya','$nnick2[loc]','$mob2[MOBSid]')");
$timUS = mysql_query("UPDATE users SET need_otdix=\"$nnick2[time_otdix]\",timer_od=\"$ttt\" WHERE NICK=\"$_SESSION[s]\"");
if(mysql_num_rows($bowp)>0 AND mysql_num_rows($arrp)>0){
$arrp = mysql_query("SELECT * FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$arrp2 = mysql_fetch_assoc($arrp);
if($arrp2[IL_COUNT]>0){
$armi = $arrp2[IL_COUNT]-1;
$updar = mysql_query("UPDATE inv SET IL_COUNT=\"$armi\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");}
if($arrp2[IL_COUNT]<=1){
$updari = mysql_query("UPDATE inv SET IL_NO=\"0\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$updar = mysql_query("DELETE FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
}

}
}//тут физический урон, если не попал,не уворот,не блок,не крит,урон больше 0



if($use_AM>$mob_MD AND $a=='attck' AND $use_T<$use_T1 AND $nnick2[MG_DMGmax]>0 AND $use_K<$use_K1 AND $nnick2[timer_od]-$tud<1 AND !isset($ski)){
$lU = mysql_query("INSERT INTO logs (COU_DMG,POPAL_ILI_NET,NAPADENIE,DEFENDER,L_TIME,L_LOC,L_KEY) VALUES ('0',' <font color=\"darkblue\">(промах)</font>','$_SESSION[s]','$mob2[MOBSname]','$vremya','$nnick2[loc]','$mob2[MOBSid]')");
$timUS = mysql_query("UPDATE users SET need_otdix=\"$nnick2[time_otdix]\",timer_od=\"$ttt\" WHERE NICK=\"$_SESSION[s]\"");
if(mysql_num_rows($bowp)>0 AND mysql_num_rows($arrp)>0){
$arrp = mysql_query("SELECT * FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$arrp2 = mysql_fetch_assoc($arrp);
if($arrp2[IL_COUNT]>0){
$armi = $arrp2[IL_COUNT]-1;
$updar = mysql_query("UPDATE inv SET IL_COUNT=\"$armi\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");}
if($arrp2[IL_COUNT]<=1){
$updari = mysql_query("UPDATE inv SET IL_NO=\"0\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$updar = mysql_query("DELETE FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
}

}
}//тут магический урон, если не попал,не крит,урон больше 0




if($use_A<=$mob_D AND $a=='attck' AND $use_T<$use_T1 AND $nnick2[DAMAGEmax]>0 AND $mob2[M_UKLON]<$mob_U AND $mob2[M_BLOCK]<$mob_B AND $use_K<$use_K1 AND $nnick2[timer_od]-$tud<1 AND !isset($ski)){
$lU = mysql_query("INSERT INTO logs (COU_DMG,POPAL_ILI_NET,NAPADENIE,DEFENDER,L_TIME,L_LOC,L_KEY) VALUES ('0',' <font color=\"blue\">(промах)</font>','$_SESSION[s]','$mob2[MOBSname]','$vremya','$nnick2[loc]','$mob2[MOBSid]')");
$timUS = mysql_query("UPDATE users SET need_otdix=\"$nnick2[time_otdix]\",timer_od=\"$ttt\" WHERE NICK=\"$_SESSION[s]\"");
if(mysql_num_rows($bowp)>0 AND mysql_num_rows($arrp)>0){
$arrp = mysql_query("SELECT * FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$arrp2 = mysql_fetch_assoc($arrp);
if($arrp2[IL_COUNT]>0){
$armi = $arrp2[IL_COUNT]-1;
$updar = mysql_query("UPDATE inv SET IL_COUNT=\"$armi\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");}
if($arrp2[IL_COUNT]<=1){
$updari = mysql_query("UPDATE inv SET IL_NO=\"0\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$updar = mysql_query("DELETE FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
}

}
}//тут физический урон, если не попал,не уворот,не блок,не крит,урон меньше 1



if($use_AM<=$mob_MD AND $a=='attck' AND $use_T<$use_T1 AND $nnick2[MG_DMGmax]>0 AND $use_K<$use_K1 AND $nnick2[timer_od]-$tud<1 AND !isset($ski)){
$lU = mysql_query("INSERT INTO logs (COU_DMG,POPAL_ILI_NET,NAPADENIE,DEFENDER,L_TIME,L_LOC,L_KEY) VALUES ('0',' <font color=\"darkblue\">(промах)</font>','$_SESSION[s]','$mob2[MOBSname]','$vremya','$nnick2[loc]','$mob2[MOBSid]')");
$timUS = mysql_query("UPDATE users SET need_otdix=\"$nnick2[time_otdix]\",timer_od=\"$ttt\" WHERE NICK=\"$_SESSION[s]\"");
if(mysql_num_rows($bowp)>0 AND mysql_num_rows($arrp)>0){
$arrp = mysql_query("SELECT * FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$arrp2 = mysql_fetch_assoc($arrp);
if($arrp2[IL_COUNT]>0){
$armi = $arrp2[IL_COUNT]-1;
$updar = mysql_query("UPDATE inv SET IL_COUNT=\"$armi\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");}
if($arrp2[IL_COUNT]<=1){
$updari = mysql_query("UPDATE inv SET IL_NO=\"0\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$updar = mysql_query("DELETE FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
}

}
}//тут магический урон, если не попал,не крит,урон меньше 1





#############################################УВОРОТ ИГРОК АТАКУЕТ МОБА
if($use_A>$mob_D AND $a=='attck' AND $use_T>=$use_T1 AND $nnick2[DAMAGEmax]>0 AND $mob2[M_UKLON]>=$mob_U AND $mob2[M_BLOCK]<$mob_B AND $use_K<$use_K1 AND $nnick2[timer_od]-$tud<1 AND !isset($ski)){

$lU = mysql_query("INSERT INTO logs (COU_DMG,POPAL_ILI_NET,NAPADENIE,DEFENDER,L_TIME,L_LOC,L_KEY) VALUES ('0',' <font color=\"orange\">(уворот)</font>','$_SESSION[s]','$mob2[MOBSname]','$vremya','$nnick2[loc]','$mob2[MOBSid]')");
$timUS = mysql_query("UPDATE users SET need_otdix=\"$nnick2[time_otdix]\",timer_od=\"$ttt\" WHERE NICK=\"$_SESSION[s]\"");
if(mysql_num_rows($bowp)>0 AND mysql_num_rows($arrp)>0){
$arrp = mysql_query("SELECT * FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$arrp2 = mysql_fetch_assoc($arrp);
if($arrp2[IL_COUNT]>0){
$armi = $arrp2[IL_COUNT]-1;
$updar = mysql_query("UPDATE inv SET IL_COUNT=\"$armi\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");}
if($arrp2[IL_COUNT]<=1){
$updari = mysql_query("UPDATE inv SET IL_NO=\"0\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$updar = mysql_query("DELETE FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
}

}
}//тут физический урон, если попал,уворот,не блок,не крит,урон больше 0
if($use_A<=$mob_D AND $a=='attck' AND $use_T>=$use_T1 AND $nnick2[DAMAGEmax]>0 AND $mob2[M_UKLON]>=$mob_U AND $mob2[M_BLOCK]<$mob_B AND $use_K<$use_K1 AND $nnick2[timer_od]-$tud<1 AND !isset($ski)){
$lU = mysql_query("INSERT INTO logs (COU_DMG,POPAL_ILI_NET,NAPADENIE,DEFENDER,L_TIME,L_LOC,L_KEY) VALUES ('0',' <font color=\"orange\">(уворот)</font>','$_SESSION[s]','$mob2[MOBSname]','$vremya','$nnick2[loc]','$mob2[MOBSid]')");
$timUS = mysql_query("UPDATE users SET need_otdix=\"$nnick2[time_otdix]\",timer_od=\"$ttt\" WHERE NICK=\"$_SESSION[s]\"");
if(mysql_num_rows($bowp)>0 AND mysql_num_rows($arrp)>0){
$arrp = mysql_query("SELECT * FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$arrp2 = mysql_fetch_assoc($arrp);
if($arrp2[IL_COUNT]>0){
$armi = $arrp2[IL_COUNT]-1;
$updar = mysql_query("UPDATE inv SET IL_COUNT=\"$armi\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");}
if($arrp2[IL_COUNT]<=1){
$updari = mysql_query("UPDATE inv SET IL_NO=\"0\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$updar = mysql_query("DELETE FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
}

}
}//тут физический урон, если попал,уворот,не блок,не крит,урон меньше 1
if($use_A>$mob_D AND $a=='attck' AND $use_T<$use_T1 AND $nnick2[DAMAGEmax]>0 AND $mob2[M_UKLON]>=$mob_U AND $mob2[M_BLOCK]<$mob_B AND $use_K<$use_K1 AND $nnick2[timer_od]-$tud<1 AND !isset($ski)){
$lU = mysql_query("INSERT INTO logs (COU_DMG,POPAL_ILI_NET,NAPADENIE,DEFENDER,L_TIME,L_LOC,L_KEY) VALUES ('0',' <font color=\"orange\">(уворот)</font>','$_SESSION[s]','$mob2[MOBSname]','$vremya','$nnick2[loc]','$mob2[MOBSid]')");
$timUS = mysql_query("UPDATE users SET need_otdix=\"$nnick2[time_otdix]\",timer_od=\"$ttt\" WHERE NICK=\"$_SESSION[s]\"");
if(mysql_num_rows($bowp)>0 AND mysql_num_rows($arrp)>0){
$arrp = mysql_query("SELECT * FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$arrp2 = mysql_fetch_assoc($arrp);
if($arrp2[IL_COUNT]>0){
$armi = $arrp2[IL_COUNT]-1;
$updar = mysql_query("UPDATE inv SET IL_COUNT=\"$armi\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");}
if($arrp2[IL_COUNT]<=1){
$updari = mysql_query("UPDATE inv SET IL_NO=\"0\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$updar = mysql_query("DELETE FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
}

}
}//тут физический урон, если не попал,уворот,не блок,не крит,урон больше 0
if($use_A<=$mob_D AND $a=='attck' AND $use_T<$use_T1 AND $nnick2[DAMAGEmax]>0 AND $mob2[M_UKLON]>=$mob_U AND $mob2[M_BLOCK]<$mob_B AND $use_K<$use_K1 AND $nnick2[timer_od]-$tud<1 AND !isset($ski)){
$lU = mysql_query("INSERT INTO logs (COU_DMG,POPAL_ILI_NET,NAPADENIE,DEFENDER,L_TIME,L_LOC,L_KEY) VALUES ('0',' <font color=\"orange\">(уворот)</font>','$_SESSION[s]','$mob2[MOBSname]','$vremya','$nnick2[loc]','$mob2[MOBSid]')");
$timUS = mysql_query("UPDATE users SET need_otdix=\"$nnick2[time_otdix]\",timer_od=\"$ttt\" WHERE NICK=\"$_SESSION[s]\"");
if(mysql_num_rows($bowp)>0 AND mysql_num_rows($arrp)>0){
$arrp = mysql_query("SELECT * FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$arrp2 = mysql_fetch_assoc($arrp);
if($arrp2[IL_COUNT]>0){
$armi = $arrp2[IL_COUNT]-1;
$updar = mysql_query("UPDATE inv SET IL_COUNT=\"$armi\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");}
if($arrp2[IL_COUNT]<=1){
$updari = mysql_query("UPDATE inv SET IL_NO=\"0\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$updar = mysql_query("DELETE FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
}

}
}//тут физический урон, если не попал,уворот,не блок,не крит,урон меньше 1
############################################БЛОК ИГРОК АТАКУЕТ МОБА
if($use_A>$mob_D AND $a=='attck' AND $use_T>=$use_T1 AND $nnick2[DAMAGEmax]>0 AND $mob2[M_UKLON]<$mob_U AND $mob2[M_BLOCK]>=$mob_B AND $use_K<$use_K1 AND $nnick2[timer_od]-$tud<1 AND !isset($ski)){
$lU = mysql_query("INSERT INTO logs (COU_DMG,POPAL_ILI_NET,NAPADENIE,DEFENDER,L_TIME,L_LOC,L_KEY) VALUES ('0',' <font color=\"darkred\">(парировал)</font>','$_SESSION[s]','$mob2[MOBSname]','$vremya','$nnick2[loc]','$mob2[MOBSid]')");
$timUS = mysql_query("UPDATE users SET need_otdix=\"$nnick2[time_otdix]\",timer_od=\"$ttt\" WHERE NICK=\"$_SESSION[s]\"");
if(mysql_num_rows($bowp)>0 AND mysql_num_rows($arrp)>0){
$arrp = mysql_query("SELECT * FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$arrp2 = mysql_fetch_assoc($arrp);
if($arrp2[IL_COUNT]>0){
$armi = $arrp2[IL_COUNT]-1;
$updar = mysql_query("UPDATE inv SET IL_COUNT=\"$armi\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");}
if($arrp2[IL_COUNT]<=1){
$updari = mysql_query("UPDATE inv SET IL_NO=\"0\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$updar = mysql_query("DELETE FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
}

}
}//тут физический урон, если попал,не уворот,блок,не крит,урон больше 0
if($use_A<=$mob_D AND $a=='attck' AND $use_T>=$use_T1 AND $nnick2[DAMAGEmax]>0 AND $mob2[M_UKLON]<$mob_U AND $mob2[M_BLOCK]>=$mob_B AND $use_K<$use_K1 AND $nnick2[timer_od]-$tud<1 AND !isset($ski)){
$lU = mysql_query("INSERT INTO logs (COU_DMG,POPAL_ILI_NET,NAPADENIE,DEFENDER,L_TIME,L_LOC,L_KEY) VALUES ('0',' <font color=\"darkred\">(парировал)</font>','$_SESSION[s]','$mob2[MOBSname]','$vremya','$nnick2[loc]','$mob2[MOBSid]')");
$timUS = mysql_query("UPDATE users SET need_otdix=\"$nnick2[time_otdix]\",timer_od=\"$ttt\" WHERE NICK=\"$_SESSION[s]\"");
if(mysql_num_rows($bowp)>0 AND mysql_num_rows($arrp)>0){
$arrp = mysql_query("SELECT * FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$arrp2 = mysql_fetch_assoc($arrp);
if($arrp2[IL_COUNT]>0){
$armi = $arrp2[IL_COUNT]-1;
$updar = mysql_query("UPDATE inv SET IL_COUNT=\"$armi\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");}
if($arrp2[IL_COUNT]<=1){
$updari = mysql_query("UPDATE inv SET IL_NO=\"0\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$updar = mysql_query("DELETE FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
}

}
}//тут физический урон, если попал,не уворот,блок,не крит,урон меньше 1
if($use_A>$mob_D AND $a=='attck' AND $use_T<$use_T1 AND $nnick2[DAMAGEmax]>0 AND $mob2[M_UKLON]<$mob_U AND $mob2[M_BLOCK]>=$mob_B AND $use_K<$use_K1 AND $nnick2[timer_od]-$tud<1 AND !isset($ski)){
$lU = mysql_query("INSERT INTO logs (COU_DMG,POPAL_ILI_NET,NAPADENIE,DEFENDER,L_TIME,L_LOC,L_KEY) VALUES ('0',' <font color=\"darkred\">(парировал)</font>','$_SESSION[s]','$mob2[MOBSname]','$vremya','$nnick2[loc]','$mob2[MOBSid]')");
$timUS = mysql_query("UPDATE users SET need_otdix=\"$nnick2[time_otdix]\",timer_od=\"$ttt\" WHERE NICK=\"$_SESSION[s]\"");
if(mysql_num_rows($bowp)>0 AND mysql_num_rows($arrp)>0){
$arrp = mysql_query("SELECT * FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$arrp2 = mysql_fetch_assoc($arrp);
if($arrp2[IL_COUNT]>0){
$armi = $arrp2[IL_COUNT]-1;
$updar = mysql_query("UPDATE inv SET IL_COUNT=\"$armi\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");}
if($arrp2[IL_COUNT]<=1){
$updari = mysql_query("UPDATE inv SET IL_NO=\"0\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$updar = mysql_query("DELETE FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
}

}
}//тут физический урон, если не попал,не уворот,блок,не крит,урон больше 0
if($use_A<=$mob_D AND $a=='attck' AND $use_T<$use_T1 AND $nnick2[DAMAGEmax]>0 AND $mob2[M_UKLON]<$mob_U AND $mob2[M_BLOCK]>=$mob_B AND $use_K<$use_K1 AND $nnick2[timer_od]-$tud<1 AND !isset($ski)){
$lU = mysql_query("INSERT INTO logs (COU_DMG,POPAL_ILI_NET,NAPADENIE,DEFENDER,L_TIME,L_LOC,L_KEY) VALUES ('0',' <font color=\"darkred\">(парировал)</font>','$_SESSION[s]','$mob2[MOBSname]','$vremya','$nnick2[loc]','$mob2[MOBSid]')");
$timUS = mysql_query("UPDATE users SET need_otdix=\"$nnick2[time_otdix]\",timer_od=\"$ttt\" WHERE NICK=\"$_SESSION[s]\"");
if(mysql_num_rows($bowp)>0 AND mysql_num_rows($arrp)>0){
$arrp = mysql_query("SELECT * FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$arrp2 = mysql_fetch_assoc($arrp);
if($arrp2[IL_COUNT]>0){
$armi = $arrp2[IL_COUNT]-1;
$updar = mysql_query("UPDATE inv SET IL_COUNT=\"$armi\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");}
if($arrp2[IL_COUNT]<=1){
$updari = mysql_query("UPDATE inv SET IL_NO=\"0\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$updar = mysql_query("DELETE FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
}

}
}//тут физический урон, если не попал,не уворот,блок,не крит,урон меньше 1
############################################КРИТ ИГРОК АТАКУЕТ МОБА
if($use_A*2>$mob_D AND $a=='attck' AND $use_T>=$use_T1 AND $nnick2[DAMAGEmax]>0 AND $mob2[M_UKLON]<$mob_U AND $mob2[M_BLOCK]<$mob_B AND $use_K>=$use_K1 AND $mob2[mb_MINhp]>$usmd*2 AND $nnick2[timer_od]-$tud<1 AND !isset($ski)){
$use_A = rand($nnick2[DAMAGEmin],$nnick2[DAMAGEmax]);//удар игрока(физой)
$mob_D = rand(0,$mob2[MD_DEFENCE]);//броня моба
$us2 = ($use_A*2);
$usmd2 = ($us2-$mob_D);
$usmd3 = $mob2[mb_MINhp]-$usmd2;
$lU = mysql_query("INSERT INTO logs (COU_DMG,POPAL_ILI_NET,NAPADENIE,DEFENDER,L_TIME,L_LOC,L_KEY) VALUES ('$usmd2',' <font color=\"red\">(КРИТ)</font>','$_SESSION[s]','$mob2[MOBSname]','$vremya','$nnick2[loc]','$mob2[MOBSid]')");
$timUS = mysql_query("UPDATE users SET need_otdix=\"$nnick2[time_otdix]\",timer_od=\"$ttt\" WHERE NICK=\"$_SESSION[s]\"");
$updMob = mysql_query("UPDATE mobs_world SET mb_MINhp=\"$usmd3\" WHERE MOBSid=\"$src\"");
if(mysql_num_rows($bowp)>0 AND mysql_num_rows($arrp)>0){
$arrp = mysql_query("SELECT * FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$arrp2 = mysql_fetch_assoc($arrp);
if($arrp2[IL_COUNT]>0){
$armi = $arrp2[IL_COUNT]-1;
$updar = mysql_query("UPDATE inv SET IL_COUNT=\"$armi\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");}
if($arrp2[IL_COUNT]<=1){
$updari = mysql_query("UPDATE inv SET IL_NO=\"0\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$updar = mysql_query("DELETE FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
}

}
}//тут физический урон, если попал,не уворот,не блок,крит,здоровье моба больше чем удар игрока,урон больше 0



if($use_AM*2>$mob_MD AND $a=='attck' AND $use_T>=$use_T1 AND $nnick2[MG_DMGmax]>0 AND $use_K>=$use_K1 AND $mob2[mb_MINhp]>$usmagic*2 AND $nnick2[timer_od]-$tud<1 AND !isset($ski)){
$use_AM = rand($nnick2[MG_DMGmin],$nnick2[MG_DMGmax]);//удар игрока(магией)
$mob_MD = rand(0,$mob2[MD_MAGIC]);//маг.защита моба
$us2 = ($use_AM*2);
$usmd2 = ($us2-$mob_MD);
$usmd3 = $mob2[mb_MINhp]-$usmd2;
$lU = mysql_query("INSERT INTO logs (COU_DMG,POPAL_ILI_NET,NAPADENIE,DEFENDER,L_TIME,L_LOC,L_KEY) VALUES ('$usmd2',' <font color=\"red\">ТУТ(КРИТ)</font>','$_SESSION[s]','$mob2[MOBSname]','$vremya','$nnick2[loc]','$mob2[MOBSid]')");
$timUS = mysql_query("UPDATE users SET need_otdix=\"$nnick2[time_otdix]\",timer_od=\"$ttt\" WHERE NICK=\"$_SESSION[s]\"");
$updMob = mysql_query("UPDATE mobs_world SET mb_MINhp=\"$usmd3\" WHERE MOBSid=\"$src\"");
$minmh = ($mob2[mb_MINhp]-$usmd*2);//отнимаем здоровье у моба
$minmb = mysql_query("UPDATE mobs_world SET mb_MINhp=\"$minmh\" WHERE MOBSid=\"$src\"");//создаем запрос на отнимание здоровья у моба
if(mysql_num_rows($bowp)>0 AND mysql_num_rows($arrp)>0){
$arrp = mysql_query("SELECT * FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$arrp2 = mysql_fetch_assoc($arrp);
if($arrp2[IL_COUNT]>0){
$armi = $arrp2[IL_COUNT]-1;
$updar = mysql_query("UPDATE inv SET IL_COUNT=\"$armi\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");}
if($arrp2[IL_COUNT]<=1){
$updari = mysql_query("UPDATE inv SET IL_NO=\"0\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$updar = mysql_query("DELETE FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
}

}
}//тут магический урон,крит,здоровье моба больше чем удар игрока,урон больше 0





if($use_A<=$mob_D AND $a=='attck' AND $use_T>=$use_T1 AND $nnick2[DAMAGEmax]>0 AND $mob2[M_UKLON]<$mob_U AND $mob2[M_BLOCK]<$mob_B AND $use_K>=$use_K1 AND $mob2[mb_MINhp]>$usmd*2 AND $nnick2[timer_od]-$tud<1 AND !isset($ski)){

$lU = mysql_query("INSERT INTO logs (COU_DMG,POPAL_ILI_NET,NAPADENIE,DEFENDER,L_TIME,L_LOC,L_KEY) VALUES ('0',' <font color=\"red\">(КРИТ)</font>','$_SESSION[s]','$mob2[MOBSname]','$vremya','$nnick2[loc]','$mob2[MOBSid]')");
$timUS = mysql_query("UPDATE users SET need_otdix=\"$nnick2[time_otdix]\",timer_od=\"$ttt\" WHERE NICK=\"$_SESSION[s]\"");

if(mysql_num_rows($bowp)>0 AND mysql_num_rows($arrp)>0){
$arrp = mysql_query("SELECT * FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$arrp2 = mysql_fetch_assoc($arrp);
if($arrp2[IL_COUNT]>0){
$armi = $arrp2[IL_COUNT]-1;
$updar = mysql_query("UPDATE inv SET IL_COUNT=\"$armi\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");}
if($arrp2[IL_COUNT]<=1){
$updari = mysql_query("UPDATE inv SET IL_NO=\"0\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$updar = mysql_query("DELETE FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
}

}
}//тут физический урон, если попал,не уворот,не блок,крит,здоровье моба больше чем удар игрока,урон меньше 1




if($use_A<=$mob_D AND $a=='attck' AND $use_T>=$use_T1 AND $nnick2[MG_DMGmax]>0 AND $use_K>=$use_K1 AND $mob2[mb_MINhp]>$usmagic*2 AND $nnick2[timer_od]-$tud<1 AND !isset($ski)){

$lU = mysql_query("INSERT INTO logs (COU_DMG,POPAL_ILI_NET,NAPADENIE,DEFENDER,L_TIME,L_LOC,L_KEY) VALUES ('0',' <font color=\"red\">(КРИТ)</font>','$_SESSION[s]','$mob2[MOBSname]','$vremya','$nnick2[loc]','$mob2[MOBSid]')");
$timUS = mysql_query("UPDATE users SET need_otdix=\"$nnick2[time_otdix]\",timer_od=\"$ttt\" WHERE NICK=\"$_SESSION[s]\"");
if(mysql_num_rows($bowp)>0 AND mysql_num_rows($arrp)>0){
$arrp = mysql_query("SELECT * FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$arrp2 = mysql_fetch_assoc($arrp);
if($arrp2[IL_COUNT]>0){
$armi = $arrp2[IL_COUNT]-1;
$updar = mysql_query("UPDATE inv SET IL_COUNT=\"$armi\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");}
if($arrp2[IL_COUNT]<=1){
$updari = mysql_query("UPDATE inv SET IL_NO=\"0\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$updar = mysql_query("DELETE FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
}

}
}//тут магический урон, если попал,крит,здоровье моба больше чем удар игрока,урон меньше 1




$use_A = rand($nnick2[DAMAGEmin],$nnick2[DAMAGEmax]);//удар игрока(физой)
$mob_D = rand(0,$mob2[MD_DEFENCE]);//броня моба
$us2 = ($use_A*2);
$usmd2 = ($us2-$mob_D);
if($use_A*2>$mob_D AND $a=='attck' AND $use_T>=$use_T1 AND $nnick2[DAMAGEmax]>0 AND $mob2[M_UKLON]<$mob_U AND $mob2[M_BLOCK]<$mob_B AND $use_K>=$use_K1 AND $mob2[mb_MINhp]<=$usmd*2 AND $nnick2[timer_od]-$tud<1 AND !isset($ski)){


echo"</div>";
?>
<table><tr>

</tr>
<tr>
<td height="164" align="center" valign="top" bgcolor="#FFE7BA"><b><font color="#a23232"><img src="img/4.png" width="160" height="160"></font></b></td>
</tr>
<tr>
<td height="10" align="left" valign="top" bgcolor="#a23232" width="550" style="border:2px #FFE7BA dotted"><b><font color="#FFE7BA">
<div style="padding:5px">
<img src="img/necr.png" width="18" height="18">3 БОЙ ЗАВЕРШЕН. ТЫ ПОБЕДИЛ!</font></b></div></td>
</tr>
<tr>
<td height="10" align="left" valign="top" bgcolor="#a23232" width="550" style="border:2px #FFE7BA dotted">
<div style="padding:5px">
<b><font color="#FFE7BA"><img src="img/star.png" width="18" height="18"> ОПЫТ +<?echo $mob2[EXP_p];?></font></b></div></td>
</tr>
    <td height="10" align="left" valign="top" bgcolor="#a23232" width="550" style="border:2px #FFE7BA dotted"><div class="menu"><li><a href="game.php"><b><font color="#FFE7BA"> <img src="img/win.png" alt="" width="18" height="18"> ПОКИНУТЬ БОЙ</font></b></a></li></div></td>
</tr>
</table>
<?
$lU = mysql_query("INSERT INTO logs (COU_DMG,POPAL_ILI_NET,NAPADENIE,DEFENDER,L_TIME,L_LOC,L_KEY) VALUES ('$usmd2',' <b><u>$mob2[MOBSname],погиб</u></b> <font color=\"red\">(КРИТ)</font>','$_SESSION[s]','$mob2[MOBSname]','$vremya','$nnick2[loc]','$mob2[MOBSid]')");
$timUS = mysql_query("UPDATE users SET need_otdix=\"$nnick2[time_otdix]\",timer_od=\"$ttt\" WHERE NICK=\"$_SESSION[s]\"");
$ress = time()+$mob2[MNTM];
$minmb = mysql_query("UPDATE mobs_world SET mb_MINhp=\"0\",M_TIME=\"$ress\" WHERE MOBSid=\"$src\"");//создаем запрос на отнимание здоровья у моба
$moexp2 = $nnick2[EXPnow]+$mob2[EXP_p];
$moexp = mysql_query("UPDATE users SET EXPnow=\"$moexp2\" WHERE NICK=\"$_SESSION[s]\"");//добавляем золото и опыт игроку
$t = time();
$users = mysql_query("SET NAMES cp1251");
$users = mysql_query("SELECT * FROM mobs_drop WHERE DI_IDENTIFIKATOR=\"$mob2[ALL_KEY]\"");
$users2 = mysql_fetch_assoc($users);
$rnd = rand($users2[DI_RANDOM_MIN],$users2[DI_RANDOM_MAX]);




$letters = 'abcdefghijklmnopqrstuvwxyz0123456789_';
$word_lenght = 6;
$size_letters = strlen($letters)-1;
for($i=0;$i<6;$i++){
while($word_lenght--){
$pass.=$letters[rand(0,$size_letters)];
}
$word_lenght = 6;
$password.=$pass.'-';
$pass = '';
}
$password = substr($password,0,strlen($password)-1);
$tdr = time()+600;


$dob_trup3 = mysql_query("INSERT INTO died (D_NAME,D_KEY,IDENTIFIKATOR,D_LOC,TIMER) VALUES ('$mob2[MOBSname]','$src','$password','$nnick2[loc]','$tdr')");//добавляем трупа
$mobdr = mysql_query("SET NAMES cp1251");
$mobdr = mysql_query("SELECT * FROM mobs_drop WHERE DI_IDENTIFIKATOR=\"$mob2[ALL_KEY]\"");
while($mobdrop = mysql_fetch_assoc($mobdr)){
$rnd = rand($mobdrop[DI_RANDOM_MIN],$mobdrop[DI_RANDOM_MAX]);
if($rnd<=$mobdrop[DI_IL_SHS]){
$dropcount = rand($mobdrop[IL_COUNT_MIN],$mobdrop[IL_COUNT_MAX]);
$dob_trup = mysql_query("INSERT INTO died_items 
(DI_IT_LVL,DI_IT_CLASS,ID_ALL_CLASS,DI_IL_SUBCLASS,
DI_IL_NAME,DI_IL_COST,DI_IL_KEY,DI_IL_MIN_DMG,
DI_IL_MAX_DMG,DI_IL_MAGD_MIN,DI_IL_MAGD_MAX,
DI_IL_BLOCK,DI_IL_DEF,DI_IL_MDEF,DI_IL_STR,
DI_IL_DEX,DI_IL_INT,DI_IL_SPD,DI_IL_MIN_PROCH,DI_IL_MAX_PROCH,DI_IL_TREBUET,DI_IL_IMAGE,
DI_IL_SRC,DI_IL_NO,DI_IL_SHANS_BLOCK,DI_IL_FIRE,DI_IL_WIND,DI_IL_EARTH,DI_IL_DARK,
DI_BONUS_HP,DI_BONUS_MP,DI_BONUS_MDEF,DI_BONUS_DAM,DI_BONUS_KRIT,BONUS_UKL,
BONUS_VES,IL_UPGRADE,IL_COUNT,IL_VREME,IL_TVRE,IL_DESC,DI_IDENTIFIKATOR,
TIME) 
VALUES ('$mobdrop[DI_IT_LVL]','$mobdrop[DI_IT_CLASS]',
'$mobdrop[ID_ALL_CLASS]','$mobdrop[DI_IL_SUBCLASS]',
'$mobdrop[DI_IL_NAME]','$mobdrop[DI_IL_COST]',
'$mobdrop[DI_IL_KEY]','$mobdrop[DI_IL_MIN_DMG]',
'$mobdrop[DI_IL_MAX_DMG]','$mobdrop[DI_IL_MAGD_MIN]',
'$mobdrop[DI_IL_MAGD_MAX]','$mobdrop[DI_IL_BLOCK]',
'$mobdrop[DI_IL_DEF]','$mobdrop[DI_IL_MDEF]','$mobdrop[DI_IL_STR]',
'$mobdrop[DI_IL_DEX]','$mobdrop[DI_IL_INT]','$mobdrop[DI_IL_SPD]',
'$mobdrop[DI_IL_MIN_PROCH]','$mobdrop[DI_IL_MAX_PROCH]',
'$mobdrop[DI_IL_TREBUET]','$mobdrop[DI_IL_IMAGE]',
'$mobdrop[DI_IL_SRC]','0','$mobdrop[DI_IL_SHANS_BLOCK]',
'$mobdrop[DI_IL_FIRE]','$mobdrop[DI_IL_WIND]',
'$mobdrop[DI_IL_EARTH]','$mobdrop[DI_IL_DARK]',
'$mobdrop[DI_BONUS_HP]','$mobdrop[DI_BONUS_MP]',
'$mobdrop[DI_BONUS_MDEF]','$mobdrop[DI_BONUS_DAM]',
'$mobdrop[DI_BONUS_KRIT]','$mobdrop[BONUS_UKL]',
'$mobdrop[DI_BONUS_VES]','$mobdrop[IL_UPGRADE]',
'$dropcount','$mobdrop[IL_VREME]',
'$mobdrop[IL_TVRE]','$mobdrop[IL_DESC]','$password','$tdr')");//добавляем трупу вещи

}

}

include("footer.php");?>
<?

if(mysql_num_rows($bowp)>0 AND mysql_num_rows($arrp)>0){
$arrp = mysql_query("SELECT * FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$arrp2 = mysql_fetch_assoc($arrp);
if($arrp2[IL_COUNT]>0){
$armi = $arrp2[IL_COUNT]-1;
$updar = mysql_query("UPDATE inv SET IL_COUNT=\"$armi\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");}
if($arrp2[IL_COUNT]<=1){
$updari = mysql_query("UPDATE inv SET IL_NO=\"0\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$updar = mysql_query("DELETE FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
}

}
die;
}//тут физический урон, если попал,не уворот,не блок,крит,здоровье моба больше чем удар игрока,урон больше 0




if($use_AM*2>$mob_MD AND $a=='attck' AND $use_T>=$use_T1 AND $nnick2[MG_DMGmax]>0 AND $use_K>=$use_K1 AND $mob2[mb_MINhp]<=$usmagic*2 AND $nnick2[timer_od]-$tud<1 AND !isset($ski)){
$use_A = rand($nnick2[MG_DMGmin],$nnick2[MG_DMGmax]);//удар игрока(магией)
$mob_D = rand(0,$mob2[MD_MAGIC]);//маг.броня моба
$us2 = ($use_AM*2);
$usmd2 = ($us2-$mob_MD);

echo"</div>";
?>
<table><tr>

</tr>
<tr>
<td height="164" align="center" valign="top" bgcolor="#FFE7BA"><b><font color="#a23232"><img src="img/4.png" width="160" height="160"></font></b></td>
</tr>
<tr>
<td height="10" align="left" valign="top" bgcolor="#a23232" width="550" style="border:2px #FFE7BA dotted"><b><font color="#FFE7BA">
<div style="padding:5px">
<img src="img/necr.png" width="18" height="18">4 БОЙ ЗАВЕРШЕН. ТЫ ПОБЕДИЛ!</font></b></div></td>
</tr>
<tr>
<td height="10" align="left" valign="top" bgcolor="#a23232" width="550" style="border:2px #FFE7BA dotted">
<div style="padding:5px">
<b><font color="#FFE7BA"><img src="img/star.png" width="18" height="18"> ОПЫТ +<?echo $mob2[EXP_p];?></font></b></div></td>
</tr>
    <td height="10" align="left" valign="top" bgcolor="#a23232" width="550" style="border:2px #FFE7BA dotted"><div class="menu"><li><a href="game.php"><b><font color="#FFE7BA"> <img src="img/win.png" alt="" width="18" height="18"> ПОКИНУТЬ БОЙ</font></b></a></li></div></td>
</tr>
</table>
<?include("footer.php");?>
<?$lU = mysql_query("INSERT INTO logs (COU_DMG,POPAL_ILI_NET,NAPADENIE,DEFENDER,L_TIME,L_LOC,L_KEY) VALUES ('$usmd2',' <b><u>$mob2[MOBSname],погиб</u></b> <font color=\"red\">(КРИТ)</font>','$_SESSION[s]','$mob2[MOBSname]','$vremya','$nnick2[loc]','$mob2[MOBSid]')");
$timUS = mysql_query("UPDATE users SET need_otdix=\"$nnick2[time_otdix]\",timer_od=\"$ttt\" WHERE NICK=\"$_SESSION[s]\"");
$ress = time()+$mob2[MNTM];
$minmb = mysql_query("UPDATE mobs_world SET mb_MINhp=\"0\",M_TIME=\"$ress\" WHERE MOBSid=\"$src\"");//создаем запрос на отнимание здоровья у моба
$moexp2 = $nnick2[EXPnow]+$mob2[EXP_p];
$t = time();
$users = mysql_query("SET NAMES cp1251");
$users = mysql_query("SELECT * FROM mobs_drop WHERE DI_IDENTIFIKATOR=\"$mob2[ALL_KEY]\"");
$users2 = mysql_fetch_assoc($users);
$rnd = rand($users2[DI_RANDOM_MIN],$users2[DI_RANDOM_MAX]);




$letters = 'abcdefghijklmnopqrstuvwxyz0123456789_';
$word_lenght = 6;
$size_letters = strlen($letters)-1;
for($i=0;$i<6;$i++){
while($word_lenght--){
$pass.=$letters[rand(0,$size_letters)];
}
$word_lenght = 6;
$password.=$pass.'-';
$pass = '';
}
$password = substr($password,0,strlen($password)-1);
$tdr = time()+600;

$dob_trup = mysql_query("INSERT INTO died (D_NAME,D_KEY,IDENTIFIKATOR,D_LOC,TIMER) VALUES ('$mob2[MOBSname]','$src','$password','$nnick2[loc]','$tdr')");//добавляем трупа
$mobdr = mysql_query("SET NAMES cp1251");
$mobdr = mysql_query("SELECT * FROM mobs_drop WHERE DI_IDENTIFIKATOR=\"$mob2[ALL_KEY]\"");
while($mobdrop = mysql_fetch_assoc($mobdr)){
$rnd = rand($mobdrop[DI_RANDOM_MIN],$mobdrop[DI_RANDOM_MAX]);
if($rnd<=$mobdrop[DI_IL_SHS]){
$dropcount = rand($mobdrop[IL_COUNT_MIN],$mobdrop[IL_COUNT_MAX]);
$dob_trup = mysql_query("INSERT INTO died_items 
(DI_IT_LVL,DI_IT_CLASS,ID_ALL_CLASS,DI_IL_SUBCLASS,
DI_IL_NAME,DI_IL_COST,DI_IL_KEY,DI_IL_MIN_DMG,
DI_IL_MAX_DMG,DI_IL_MAGD_MIN,DI_IL_MAGD_MAX,
DI_IL_BLOCK,DI_IL_DEF,DI_IL_MDEF,DI_IL_STR,
DI_IL_DEX,DI_IL_INT,DI_IL_SPD,DI_IL_MIN_PROCH,DI_IL_MAX_PROCH,DI_IL_TREBUET,DI_IL_IMAGE,
DI_IL_SRC,DI_IL_NO,DI_IL_SHANS_BLOCK,DI_IL_FIRE,DI_IL_WIND,DI_IL_EARTH,DI_IL_DARK,
DI_BONUS_HP,DI_BONUS_MP,DI_BONUS_MDEF,DI_BONUS_DAM,DI_BONUS_KRIT,BONUS_UKL,
BONUS_VES,IL_UPGRADE,IL_COUNT,IL_VREME,IL_TVRE,IL_DESC,DI_IDENTIFIKATOR,
TIME) 
VALUES ('$mobdrop[DI_IT_LVL]','$mobdrop[DI_IT_CLASS]',
'$mobdrop[ID_ALL_CLASS]','$mobdrop[DI_IL_SUBCLASS]',
'$mobdrop[DI_IL_NAME]','$mobdrop[DI_IL_COST]',
'$mobdrop[DI_IL_KEY]','$mobdrop[DI_IL_MIN_DMG]',
'$mobdrop[DI_IL_MAX_DMG]','$mobdrop[DI_IL_MAGD_MIN]',
'$mobdrop[DI_IL_MAGD_MAX]','$mobdrop[DI_IL_BLOCK]',
'$mobdrop[DI_IL_DEF]','$mobdrop[DI_IL_MDEF]','$mobdrop[DI_IL_STR]',
'$mobdrop[DI_IL_DEX]','$mobdrop[DI_IL_INT]','$mobdrop[DI_IL_SPD]',
'$mobdrop[DI_IL_MIN_PROCH]','$mobdrop[DI_IL_MAX_PROCH]',
'$mobdrop[DI_IL_TREBUET]','$mobdrop[DI_IL_IMAGE]',
'$mobdrop[DI_IL_SRC]','0','$mobdrop[DI_IL_SHANS_BLOCK]',
'$mobdrop[DI_IL_FIRE]','$mobdrop[DI_IL_WIND]',
'$mobdrop[DI_IL_EARTH]','$mobdrop[DI_IL_DARK]',
'$mobdrop[DI_BONUS_HP]','$mobdrop[DI_BONUS_MP]',
'$mobdrop[DI_BONUS_MDEF]','$mobdrop[DI_BONUS_DAM]',
'$mobdrop[DI_BONUS_KRIT]','$mobdrop[BONUS_UKL]',
'$mobdrop[DI_BONUS_VES]','$mobdrop[IL_UPGRADE]',
'$dropcount','$mobdrop[IL_VREME]',
'$mobdrop[IL_TVRE]','$mobdrop[IL_DESC]','$password','$tdr')");//добавляем трупу вещи

}

}
if(mysql_num_rows($bowp)>0 AND mysql_num_rows($arrp)>0){
$arrp = mysql_query("SELECT * FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$arrp2 = mysql_fetch_assoc($arrp);
if($arrp2[IL_COUNT]>0){
$armi = $arrp2[IL_COUNT]-1;
$updar = mysql_query("UPDATE inv SET IL_COUNT=\"$armi\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");}
if($arrp2[IL_COUNT]<=1){
$updari = mysql_query("UPDATE inv SET IL_NO=\"0\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$updar = mysql_query("DELETE FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
}

}
die;
}//тут магический урон, если попал,крит,здоровье моба больше чем удар игрока,урон больше 0






if($use_A<=$mob_D AND $a=='attck' AND $use_T>=$use_T1 AND $nnick2[DAMAGEmax]>0 AND $mob2[M_UKLON]<$mob_U AND $mob2[M_BLOCK]<$mob_B AND $use_K>=$use_K1 AND $mob2[mb_MINhp]<=$usmd*2 AND $nnick2[timer_od]-$tud<1 AND !isset($ski)){

$lU = mysql_query("INSERT INTO logs (COU_DMG,POPAL_ILI_NET,NAPADENIE,DEFENDER,L_TIME,L_LOC,L_KEY) VALUES ('0',' <font color=\"red\">(КРИТ)</font>','$_SESSION[s]','$mob2[MOBSname]','$vremya','$nnick2[loc]','$mob2[MOBSid]')");
$timUS = mysql_query("UPDATE users SET need_otdix=\"$nnick2[time_otdix]\",timer_od=\"$ttt\" WHERE NICK=\"$_SESSION[s]\"");
if(mysql_num_rows($bowp)>0 AND mysql_num_rows($arrp)>0){
$arrp = mysql_query("SELECT * FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$arrp2 = mysql_fetch_assoc($arrp);
if($arrp2[IL_COUNT]>0){
$armi = $arrp2[IL_COUNT]-1;
$updar = mysql_query("UPDATE inv SET IL_COUNT=\"$armi\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");}
if($arrp2[IL_COUNT]<=1){
$updari = mysql_query("UPDATE inv SET IL_NO=\"0\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$updar = mysql_query("DELETE FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
}

}
}//тут физический урон, если попал,не уворот,не блок,крит,здоровье моба больше чем удар игрока,урон меньше 1





if($use_AM<=$mob_MD AND $a=='attck' AND $use_T>=$use_T1 AND $nnick2[MG_DMGmax]>0 AND $use_K>=$use_K1 AND $mob2[mb_MINhp]<=$usmagic*2 AND $nnick2[timer_od]-$tud<1 AND !isset($ski)){

$lU = mysql_query("INSERT INTO logs (COU_DMG,POPAL_ILI_NET,NAPADENIE,DEFENDER,L_TIME,L_LOC,L_KEY) VALUES ('0',' <font color=\"red\">(КРИТ)</font>','$_SESSION[s]','$mob2[MOBSname]','$vremya','$nnick2[loc]','$mob2[MOBSid]')");
$timUS = mysql_query("UPDATE users SET need_otdix=\"$nnick2[time_otdix]\",timer_od=\"$ttt\" WHERE NICK=\"$_SESSION[s]\"");
if(mysql_num_rows($bowp)>0 AND mysql_num_rows($arrp)>0){
$arrp = mysql_query("SELECT * FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$arrp2 = mysql_fetch_assoc($arrp);
if($arrp2[IL_COUNT]>0){
$armi = $arrp2[IL_COUNT]-1;
$updar = mysql_query("UPDATE inv SET IL_COUNT=\"$armi\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");}
if($arrp2[IL_COUNT]<=1){
$updari = mysql_query("UPDATE inv SET IL_NO=\"0\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$updar = mysql_query("DELETE FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
}

}
}//тут магический урон, если попал,крит,здоровье моба больше чем удар игрока,урон меньше 1

#####################################################МОБ АТАКУЕТ ИГРОКА(ПОПАЛ)
if($mob_A>$use_D AND $a=='attck' AND $mob_T>=$mob_T1 AND $mob2[MAXdmg]>0 AND $nnick2[U_UKLON]<$use_U AND $nnick2[SHANS_BLOCK]<$use_B AND $mob_K<$mob_K1 AND $nnick2[MINhp]>$mobd AND $mob2[m_needTIME]-$tud<1 AND !isset($ski)){

$minmh = $nnick2[MINhp]-$mobd;//отнимаем здоровье у игрока
$lU = mysql_query("INSERT INTO logs (COU_DMG,POPAL_ILI_NET,NAPADENIE,DEFENDER,L_TIME,L_LOC,L_KEY) VALUES (' - $mobd',' <font color=\"brown\">(ФИЗ)</font>','$mob2[MOBSname]','$_SESSION[s]','$vremya','$nnick2[loc]','$mob2[MOBSid]')");
$mobUP = mysql_query("UPDATE mobs_world SET m_timeNEED=\"$mob2[m_timeOD]\",m_needTIME=\"$ttm\" WHERE MOBSid='$src'");
$minmb = mysql_query("UPDATE users SET MINhp=\"$minmh\" WHERE NICK=\"$_SESSION[s]\"");//создаем запрос на отнимание здоровья у моба


}//тут физический урон, если попал,не уворот,не блок,не крит,здоровье игрока больше чем удар моба,урон больше 0

if($mob_A<=$use_D AND $a=='attck' AND $mob_T>=$mob_T1 AND $mob2[MAXdmg]>0 AND $nnick2[U_UKLON]<$use_U AND $nnick2[SHANS_BLOCK]<$use_B AND $mob_K<$mob_K1 AND $nnick2[MINhp]>$mobd AND $mob2[m_needTIME]-$tud<1 AND !isset($ski)){
$lU = mysql_query("INSERT INTO logs (COU_DMG,POPAL_ILI_NET,NAPADENIE,DEFENDER,L_TIME,L_LOC,L_KEY) VALUES ('0',' <font color=\"brown\">(ФИЗ)</font>','$mob2[MOBSname]','$_SESSION[s]','$vremya','$nnick2[loc]','$mob2[MOBSid]')");
$mobUP = mysql_query("UPDATE mobs_world SET m_timeNEED=\"$mob2[m_timeOD]\",m_needTIME=\"$ttm\" WHERE MOBSid='$src'");
}//тут физический урон, если попал,не уворот,не блок,не крит,здоровье игрока больше чем удар моба,урон меньше 1


if($mob_A>$use_D AND $a=='attck' AND $mob_T>=$mob_T1 AND $mob2[MAXdmg]>0 AND $nnick2[U_UKLON]<$use_U AND $nnick2[SHANS_BLOCK]<$use_B AND $mob_K<$mob_K1 AND $nnick2[MINhp]<=$mobd AND $mob2[m_needTIME]-$tud<1 AND !isset($ski)){

echo"</div>";
?>
<table>
<tr>
<td height="164" align="center" valign="top" bgcolor="#FFE7BA"><b><font color="#a23232"><img src="img/lose.png" width="275" height="169"></font></b></td>
</tr>
<tr>
<td height="10" align="left" valign="top" bgcolor="#a23232" width="550" style="border:2px #FFE7BA dotted"><b><font color="#FFE7BA">
<div style="padding:5px">
<img src="img/necr.png" width="18" height="18"><b><font color="#FFE7BA"> БОЙ ЗАВЕРШЕН. ПОРАЖЕНИЕ!</font></b></div></td>
</tr>

    <td height="10" align="left" valign="top" bgcolor="#a23232" width="550" style="border:2px #FFE7BA dotted"><div class="menu"><li><a href="game.php"><b><font color="#FFE7BA"> <img src="img/win.png" alt="" width="18" height="18"> ПОКИНУТЬ БОЙ</font></b></a></li></div></td>
</tr>
</table>
<?$lU = mysql_query("INSERT INTO logs (COU_DMG,POPAL_ILI_NET,NAPADENIE,DEFENDER,L_TIME,L_LOC,L_KEY) VALUES 
('$mobd',' <font color=\"brown\">(ФИЗ)</font>','$mob2[MOBSname]','$_SESSION[s]','$vremya','$nnick2[loc]','$src')");
$mobUP = mysql_query("UPDATE mobs_world SET m_timeNEED=\"$mob2[m_timeOD]\",m_needTIME=\"$ttm\" WHERE MOBSid='$src'");
$minmb = mysql_query("UPDATE users SET MINhp=\"0\",statys=\"1\" WHERE NICK=\"$_SESSION[s]\"");//создаем запрос на отнимание здоровья у моба
echo"</div></div>";
include("footer.php");
die;
}//тут физический урон, если попал,не уворот,не блок,не крит,здоровье игрока меньше чем чем удар моба,урон больше 0


if($mob_A<=$use_D AND $a=='attck' AND $mob_T>=$mob_T1 AND $mob2[MAXdmg]>0 AND $nnick2[U_UKLON]<$use_U AND $nnick2[SHANS_BLOCK]<$use_B AND $mob_K<$mob_K1 AND $nnick2[MINhp]<=$mobd AND $mob2[m_needTIME]-$tud<1 AND !isset($ski)){
$lU = mysql_query("INSERT INTO logs (COU_DMG,POPAL_ILI_NET,NAPADENIE,DEFENDER,L_TIME,L_LOC,L_KEY) VALUES ('0',' <font color=\"browm\">(ФИЗ)</font>','$mob2[MOBSname]','$_SESSION[s]','$vremya','$nnick2[loc]','$mob2[MOBSid]')");
$mobUP = mysql_query("UPDATE mobs_world SET m_timeNEED=\"$mob2[m_timeOD]\",m_needTIME=\"$ttm\" WHERE MOBSid='$src'");

}//тут физический урон, если попал,не уворот,не блок,не крит,здоровье моба меньше чем удар игрока,урон меньше 1


#############################################ПРОМАХ МОБ АТАКУЕТ ИГРОКА
if($mob_A>$use_D AND $a=='attck' AND $mob_T<$mob_T1 AND $mob2[MAXdmg]>0 AND $nnick2[U_UKLON]<$use_U AND $nnick2[SHANS_BLOCK]<$use_B AND $mob_K<$mob_K1 AND $mob2[m_needTIME]-$tud<1 AND !isset($ski)){
$lU = mysql_query("INSERT INTO logs (COU_DMG,POPAL_ILI_NET,NAPADENIE,DEFENDER,L_TIME,L_LOC,L_KEY) VALUES ('0',' <font color=\"blue\">(промах)</font>','$mob2[MOBSname]','$_SESSION[s]','$vremya','$nnick2[loc]','$mob2[MOBSid]')");
$mobUP = mysql_query("UPDATE mobs_world SET m_timeNEED=\"$mob2[m_timeOD]\",m_needTIME=\"$ttm\" WHERE MOBSid='$src'");
}//тут физический урон, если не попал,не уворот,не блок,не крит,урон больше 0

if($mob_A<=$use_D AND $a=='attck' AND $mob_T<$mob_T1 AND $mob2[MAXdmg]>0 AND $nnick2[U_UKLON]<$use_U AND $nnick2[SHANS_BLOCK]<$use_B AND $mob_K<$mob_K1 AND $mob2[m_needTIME]-$tud<1 AND !isset($ski)){
$lU = mysql_query("INSERT INTO logs (COU_DMG,POPAL_ILI_NET,NAPADENIE,DEFENDER,L_TIME,L_LOC,L_KEY) VALUES ('0',' <font color=\"blue\">(промах)</font>','$mob2[MOBSname]','$_SESSION[s]','$vremya','$nnick2[loc]','$mob2[MOBSid]')");
$mobUP = mysql_query("UPDATE mobs_world SET m_timeNEED=\"$mob2[m_timeOD]\",m_needTIME=\"$ttm\" WHERE MOBSid='$src'");
}//тут физический урон, если не попал,не уворот,не блок,не крит,урон меньше 1

#############################################УВОРОТ МОБ АТАКУЕТ ИГРОКА
if($mob_A>$use_D AND $a=='attck' AND $mob_T>=$mob_T1 AND $mob2[MAXdmg]>0 AND $nnick2[U_UKLON]>=$use_U AND $nnick2[SHANS_BLOCK]<$use_B AND $mob_K<$mob_K1 AND $mob2[m_needTIME]-$tud<1 AND !isset($ski)){

$lU = mysql_query("INSERT INTO logs (COU_DMG,POPAL_ILI_NET,NAPADENIE,DEFENDER,L_TIME,L_LOC,L_KEY) VALUES ('0',' <font color=\"orange\">(уворот)</font>','$mob2[MOBSname]','$_SESSION[s]','$vremya','$nnick2[loc]','$mob2[MOBSid]')");
$mobUP = mysql_query("UPDATE mobs_world SET m_timeNEED=\"$mob2[m_timeOD]\",m_needTIME=\"$ttm\" WHERE MOBSid='$src'");

}//тут физический урон, если попал,уворот,не блок,не крит,урон больше 0

if($mob_A<=$use_D AND $a=='attck' AND $mob_T>=$mob_T1 AND $mob2[MAXdmg]>0 AND $nnick2[U_UKLON]>=$use_U AND $nnick2[SHANS_BLOCK]<$use_B AND $mob_K<$mob_K1 AND $mob2[m_needTIME]-$tud<1 AND !isset($ski)){
$lU = mysql_query("INSERT INTO logs (COU_DMG,POPAL_ILI_NET,NAPADENIE,DEFENDER,L_TIME,L_LOC,L_KEY) VALUES ('0',' <font color=\"orange\">(уворот)</font>','$mob2[MOBSname]','$_SESSION[s]','$vremya','$nnick2[loc]','$mob2[MOBSid]')");
$mobUP = mysql_query("UPDATE mobs_world SET m_timeNEED=\"$mob2[m_timeOD]\",m_needTIME=\"$ttm\" WHERE MOBSid='$src'");

}//тут физический урон, если попал,уворот,не блок,не крит,урон меньше 1

if($mob_A>$use_D AND $a=='attck' AND $mob_T<$mob_T1 AND $mob2[MAXdmg]>0 AND $nnick2[U_UKLON]>=$use_U AND $nnick2[SHANS_BLOCK]<$use_B AND $mob_K<$mob_K1 AND $mob2[m_needTIME]-$tud<1 AND !isset($ski)){
$lU = mysql_query("INSERT INTO logs (COU_DMG,POPAL_ILI_NET,NAPADENIE,DEFENDER,L_TIME,L_LOC,L_KEY) VALUES ('0',' <font color=\"orange\">(уворот)</font>','$mob2[MOBSname]','$_SESSION[s]','$vremya','$nnick2[loc]','$mob2[MOBSid]')");
$mobUP = mysql_query("UPDATE mobs_world SET m_timeNEED=\"$mob2[m_timeOD]\",m_needTIME=\"$ttm\" WHERE MOBSid='$src'");

}//тут физический урон, если не попал,уворот,не блок,не крит,урон больше 0

if($mob_A<=$use_D AND $a=='attck' AND $mob_T<$mob_T1 AND $mob2[MAXdmg]>0 AND $nnick2[U_UKLON]>=$use_U AND $nnick2[SHANS_BLOCK]<$use_B AND $mob_K<$mob_K1 AND $mob2[m_needTIME]-$tud<1 AND !isset($ski)){
$lU = mysql_query("INSERT INTO logs (COU_DMG,POPAL_ILI_NET,NAPADENIE,DEFENDER,L_TIME,L_LOC,L_KEY) VALUES ('0',' <font color=\"orange\">(уворот)</font>','$mob2[MOBSname]','$_SESSION[s]','$vremya','$nnick2[loc]','$mob2[MOBSid]')");
$mobUP = mysql_query("UPDATE mobs_world SET m_timeNEED=\"$mob2[m_timeOD]\",m_needTIME=\"$ttm\" WHERE MOBSid='$src'");

}//тут физический урон, если не попал,уворот,не блок,не крит,урон меньше 1

############################################БЛОК МОБ АТАКУЕТ ИГРОКА
if($mob_A>$use_D AND $a=='attck' AND $mob_T>=$mob_T1 AND $mob2[MAXdmg]>0 AND $nnick2[U_UKLON]<$use_U AND $nnick2[SHANS_BLOCK]>=$use_B AND $mob_K<$mob_K1 AND $mob2[m_needTIME]-$tud<1 AND !isset($ski)){
$lU = mysql_query("INSERT INTO logs (COU_DMG,POPAL_ILI_NET,NAPADENIE,DEFENDER,L_TIME,L_LOC,L_KEY) VALUES ('0',' <font color=\"darkred\">(парировал)</font>','$mob2[MOBSname]','$_SESSION[s]','$vremya','$nnick2[loc]','$mob2[MOBSid]')");
$mobUP = mysql_query("UPDATE mobs_world SET m_timeNEED=\"$mob2[m_timeOD]\",m_needTIME=\"$ttm\" WHERE MOBSid='$src'");

}//тут физический урон, если попал,не уворот,блок,не крит,урон больше 0

if($mob_A<=$use_D AND $a=='attck' AND $mob_T>=$mob_T1 AND $mob2[MAXdmg]>0 AND $nnick2[U_UKLON]<$use_U AND $nnick2[SHANS_BLOCK]>=$use_B AND $mob_K<$mob_K1 AND $mob2[m_needTIME]-$tud<1 AND !isset($ski)){
$lU = mysql_query("INSERT INTO logs (COU_DMG,POPAL_ILI_NET,NAPADENIE,DEFENDER,L_TIME,L_LOC,L_KEY) VALUES ('0',' <font color=\"darkred\">(парировал)</font>','$mob2[MOBSname]','$_SESSION[s]','$vremya','$nnick2[loc]','$mob2[MOBSid]')");
$mobUP = mysql_query("UPDATE mobs_world SET m_timeNEED=\"$mob2[m_timeOD]\",m_needTIME=\"$ttm\" WHERE MOBSid='$src'");

}//тут физический урон, если попал,не уворот,блок,не крит,урон меньше 1

if($mob_A>$use_D AND $a=='attck' AND $mob_T<$mob_T1 AND $mob2[MAXdmg]>0 AND $nnick2[U_UKLON]<$use_U AND $nnick2[SHANS_BLOCK]>=$use_B AND $mob_K<$mob_K1 AND $mob2[m_needTIME]-$tud<1 AND !isset($ski)){
$lU = mysql_query("INSERT INTO logs (COU_DMG,POPAL_ILI_NET,NAPADENIE,DEFENDER,L_TIME,L_LOC,L_KEY) VALUES ('0',' <font color=\"darkred\">(парировал)</font>','$mob2[MOBSname]','$_SESSION[s]','$vremya','$nnick2[loc]','$mob2[MOBSid]')");
$mobUP = mysql_query("UPDATE mobs_world SET m_timeNEED=\"$mob2[m_timeOD]\",m_needTIME=\"$ttm\" WHERE MOBSid='$src'");

}//тут физический урон, если не попал,не уворот,блок,не крит,урон больше 0

if($mob_A<=$use_D AND $a=='attck' AND $mob_T<$mob_T1 AND $mob2[MAXdmg]>0 AND $nnick2[U_UKLON]<$use_U AND $nnick2[SHANS_BLOCK]>=$use_B AND $mob_K<$mob_K1 AND $mob2[m_needTIME]-$tud<1 AND !isset($ski)){
$lU = mysql_query("INSERT INTO logs (COU_DMG,POPAL_ILI_NET,NAPADENIE,DEFENDER,L_TIME,L_LOC,L_KEY) VALUES ('0',' <font color=\"darkred\">(парировал)</font>','$mob2[MOBSname]','$_SESSION[s]','$vremya','$nnick2[loc]','$mob2[MOBSid]')");
$mobUP = mysql_query("UPDATE mobs_world SET m_timeNEED=\"$mob2[m_timeOD]\",m_needTIME=\"$ttm\" WHERE MOBSid='$src'");

}//тут физический урон, если не попал,не уворот,блок,не крит,урон меньше 1

############################################КРИТ МОБ АТАКУЕТ ИГРОКА
if($mob_A*2>$use_D AND $a=='attck' AND $mob_T>=$mob_T1 AND $mob2[MAXdmg]>0 AND $nnick2[U_UKLON]<$use_U AND $nnick2[SHANS_BLOCK]<$use_B AND $mob_K>=$mob_K1 AND $nnick2[MINhp]>$mobd*2 AND $mob2[m_needTIME]-$tud<1 AND !isset($ski)){

$us2 = ($mob_A*2);
$usmd2 = ($us2-$use_D);
$minmh = $nnick2[MINhp]-$usmd2;
$lU = mysql_query("INSERT INTO logs (COU_DMG,POPAL_ILI_NET,NAPADENIE,DEFENDER,L_TIME,L_LOC,L_KEY) VALUES ('$usmd2',' <font color=\"red\">(КРИТ)</font>','$mob2[MOBSname]','$_SESSION[s]','$vremya','$nnick2[loc]','$mob2[MOBSid]')");
$mobUP = mysql_query("UPDATE mobs_world SET m_timeNEED=\"$mob2[m_timeOD]\",m_needTIME=\"$ttm\" WHERE MOBSid='$src'");
$minmb = mysql_query("UPDATE users SET MINhp=\"$minmh\" WHERE NICK=\"$_SESSION[s]\"");//создаем запрос на отнимание здоровья у моба
}//РАБОТАЕТ

if($mob_A*2<=$use_D AND $a=='attck' AND $mob_T>=$mob_T1 AND $mob2[MAXdmg]>0 AND $nnick2[U_UKLON]<$use_U AND $nnick2[SHANS_BLOCK]<$use_B AND $mob_K>=$mob_K1 AND $nnick2[MINhp]>$mobd*2 AND $mob2[m_needTIME]-$tud<1 AND !isset($ski)){

$lU = mysql_query("INSERT INTO logs (COU_DMG,POPAL_ILI_NET,NAPADENIE,DEFENDER,L_TIME,L_LOC,L_KEY) VALUES ('0',' <font color=\"red\">(КРИТ)</font>','$mob2[MOBSname]','$_SESSION[s]','$vremya','$nnick2[loc]','$mob2[MOBSid]')");
$mobUP = mysql_query("UPDATE mobs_world SET m_timeNEED=\"$mob2[m_timeOD]\",m_needTIME=\"$ttm\" WHERE MOBSid='$src'");

}//РАБОТАЕТ


if($mob_A*2>$use_D AND $a=='attck' AND $mob_T>=$mob_T1 AND $mob2[MAXdmg]>0 AND $nnick2[U_UKLON]<$use_U AND $nnick2[SHANS_BLOCK]<$use_B AND $mob_K>=$mob_K1 AND $nnick2[MINhp]<=$mobd*2 AND $mob2[m_needTIME]-$tud<1 AND !isset($ski)){
echo"</div>";

$us2 = ($mob_A*2);
$usmd2 = ($us2-$use_D);
?>
<table>
<tr>
<td height="164" align="center" valign="top" bgcolor="#FFE7BA"><b><font color="#a23232"><img src="img/lose.png" width="275" height="169"></font></b></td>
</tr>
<tr>
<td height="10" align="left" valign="top" bgcolor="#a23232" width="550" style="border:2px #FFE7BA dotted"><b><font color="#FFE7BA">
<div style="padding:5px">
<img src="img/necr.png" width="18" height="18"><b><font color="#FFE7BA"> БОЙ ЗАВЕРШЕН. ПОРАЖЕНИЕ!</font></b></div></td>
</tr>

    <td height="10" align="left" valign="top" bgcolor="#a23232" width="550" style="border:2px #FFE7BA dotted"><div class="menu"><li><a href="game.php"><b><font color="#FFE7BA"> <img src="img/win.png" alt="" width="18" height="18"> ПОКИНУТЬ БОЙ</font></b></a></li></div></td>
</tr>
</table>
<?
$lU = mysql_query("INSERT INTO logs (COU_DMG,POPAL_ILI_NET,NAPADENIE,DEFENDER,L_TIME,L_LOC,L_KEY) VALUES 
('$usmd2',' <font color=\"brown\">(КРИТ)</font>','$mob2[MOBSname]','$_SESSION[s]','$vremya','$nnick2[loc]','$src')");
$mobUP = mysql_query("UPDATE mobs_world SET m_timeNEED=\"$mob2[m_timeOD]\",m_needTIME=\"$ttm\" WHERE MOBSid='$src'");
$minmb = mysql_query("UPDATE users SET MINhp=\"0\",statys=\"1\" WHERE NICK=\"$_SESSION[s]\"");//создаем запрос на отнимание здоровья у моба
echo"</div></div>";
include("footer.php");
die;
}//РАБОТАЕТ


if($mob_A*2<=$use_D AND $a=='attck' AND $mob_T>=$mob_T1 AND $mob2[MAXdmg]>0 AND $nnick2[U_UKLON]<$use_U AND $nnick2[SHANS_BLOCK]<$use_B AND $mob_K>=$mob_K1 AND $nnick2[MINhp]<=$mobd*2 AND $mob2[m_needTIME]-$tud<1 AND !isset($ski)){

$lU = mysql_query("INSERT INTO logs (COU_DMG,POPAL_ILI_NET,NAPADENIE,DEFENDER,L_TIME,L_LOC,L_KEY) VALUES ('0',' <font color=\"red\">(КРИТ)</font>','$mob2[MOBSname]','$_SESSION[s]','$vremya','$nnick2[loc]','$mob2[MOBSid]')");
$mobUP = mysql_query("UPDATE mobs_world SET m_timeNEED=\"$mob2[m_timeOD]\",m_needTIME=\"$ttm\" WHERE MOBSid='$src'");

}//РАБОТАЕТ










#БЛОК,УВОРОТ,КРИТ,ПРОМАХ
#учитываем защиту,маг.защиту моба при ударе
#учитываем шанс нанести критический удар мобу и игроку
#луки,арбалеты,пращи требует расходников для атаки,иначе атака не производится
#при победе получаем опыт, дроп,золото
#ах да чуть не забыл,если вы преступник и убиваете моба на 5 уровней старше себя - 10 секунд времени 
#поражение,приемы,магия
?>
</font>
</b></center>
</div>
<div class="line"></div><div style="padding:5px">
<?
@$indHP = (100*$pers2[mb_MINhp])/$pers2[mb_MAXhp];
@$indTO = 100-$indHP;
@$indMP = (100*$pers2[mb_MINmp])/$pers2[mb_MAXmp];




if($mob2[MOBSimg] != ''){

echo"
<div class=\"main_title\" style=\"text-align:center;color:red\">$mob2[MOBSname] ур.$mob2[LVL]</div>

<div class=\"monster\"><img src=\"$pers2[MOBSimg]\" align=\"left\">
<div style=\"padding-left:65px\">
<div style=\"margin-left:9px;margin-bottom:-19px\">

ХП:$pers2[mb_MINhp]/$pers2[mb_MAXhp]</div>
<table background=\"red\" cellpadding=\"4\" cellspacing=\"0\">
<tr>

";

if($pers2[mb_MINhp]>0){
echo"<td colspan=\"2\" bgcolor=\"lime\" width=\"$indHP\" height=\"4\" align=\"center\"></td>";}
if($pers2[mb_MINhp]<$pers2[mb_MAXhp]){
echo"<td colspan=\"2\" bgcolor=\"red\" width=\"$indTO\" height=\"4\" align=\"center\"></td>";}
echo"</tr></table>
<div style=\"margin-left:6px;margin-bottom:-19px\">МП:$pers2[mb_MINmp]/$pers2[mb_MAXmp]</div>
<table background=\"red\" cellpadding=\"4\" cellspacing=\"0\">
<tr><td colspan=\"2\" bgcolor=\"lightblue\" width=\"$indMP\" height=\"4\" align=\"center\"></td>
</tr></table>
</div></div>
";}

if($mob2[MOBSimg] == ''){

echo"
<div class=\"main_title\" style=\"text-align:center;color:red\">$mob2[MOBSname]</div>

<div class=\"monster\">

<img src=\"monsters/noimage.png\" align=\"left\">
<div style=\"padding-left:65px\">
<div style=\"margin-left:9px;margin-bottom:-19px\">
ХП:$pers2[mb_MINhp]/$pers2[mb_MAXhp]</div>
<table background=\"red\" cellpadding=\"4\" cellspacing=\"0\">
<tr>

";

if($pers2[mb_MINhp]>0){
echo"<td colspan=\"2\" bgcolor=\"lime\" width=\"$indHP\" height=\"4\" align=\"center\"></td>";}
if($pers2[mb_MINhp]<$pers2[mb_MAXhp]){
echo"<td colspan=\"2\" bgcolor=\"red\" width=\"$indTO\" height=\"4\" align=\"center\"></td>";}
echo"</tr></table>
<div style=\"margin-left:6px;margin-bottom:-19px\">МП:$pers2[mb_MINmp]/$pers2[mb_MAXmp]</div>
<table background=\"red\" cellpadding=\"4\" cellspacing=\"0\">
<tr><td colspan=\"2\" bgcolor=\"lightblue\" width=\"$indMP\" height=\"4\" align=\"center\"></td>
</tr></table>
</div></div>
";}
$prov = $_GET['prov'];
if($prov == 'prov'){echo"Проверка";}
echo"<div style=\"padding:2px\"><div class=\"menu\" style=\"border:1px black dotted;\"><li>
<a href=\"attack.php?menu=main&src=$mob2[MOBSid]&a=attck\"><img src=\"img/attck.png\" width=\"24\" height=\"24\"> АТАКОВАТЬ</a></li></div></div>";
#################################################СЛОТ 1
$SLOT_1  = mysql_query("SET NAMES cp1251");
$SLOT_1  = mysql_query("SELECT * FROM slotS WHERE S_NICK=\"$_SESSION[s]\" AND S_NO=\"1\"");
$SLOT_1a = mysql_fetch_assoc($SLOT_1);
$SLOT_1a[S_SRC] = str_replace("use=","",$SLOT_1a[S_SRC]);
$pr_s1 = mysql_query("SELECT * FROM inv WHERE ID_IL=\"$SLOT_1a[S_SRC]\" AND ID_USERS=\"$_SESSION[s]\""); //проверка слота 1
$pr_s2 = mysql_fetch_assoc($pr_s1);

if(mysql_num_rows($SLOT_1)>0 AND mysql_num_rows($pr_s1)>0){echo"<a href=\"game.php\"><img src=\"img/drop.png\"> $pr_s2[IL_NAME]</a><br>";}
#################################################СЛОТ 2
$SLOT_2  = mysql_query("SET NAMES cp1251");
$SLOT_2  = mysql_query("SELECT * FROM slotS WHERE S_NICK=\"$_SESSION[s]\" AND S_NO=\"2\"");
$SLOT_2a = mysql_fetch_assoc($SLOT_2);
$SLOT_2a[S_SRC] = str_replace("use=","",$SLOT_2a[S_SRC]);
$pr_s3 = mysql_query("SELECT * FROM inv WHERE ID_IL=\"$SLOT_2a[S_SRC]\" AND ID_USERS=\"$_SESSION[s]\""); //проверка слота 2
$pr_s4 = mysql_fetch_assoc($pr_s3);

if(mysql_num_rows($SLOT_2)>0 AND mysql_num_rows($pr_s3)>0){echo"<a href=\"game.php\"><img src=\"img/drop.png\"> $pr_s4[IL_NAME]</a><br>";}
#################################################СЛОТ 3
$SLOT_3  = mysql_query("SET NAMES cp1251");
$SLOT_3  = mysql_query("SELECT * FROM slotS WHERE S_NICK=\"$_SESSION[s]\" AND S_NO=\"3\"");
$SLOT_3a = mysql_fetch_assoc($SLOT_3);
$SLOT_3a[S_SRC] = str_replace("use=","",$SLOT_3a[S_SRC]);
$pr_s5 = mysql_query("SELECT * FROM inv WHERE ID_IL=\"$SLOT_3a[S_SRC]\" AND ID_USERS=\"$_SESSION[s]\""); //проверка слота 3
$pr_s6 = mysql_fetch_assoc($pr_s5);

if(mysql_num_rows($SLOT_3)>0 AND mysql_num_rows($pr_s5)>0){echo"<a href=\"game.php\"><img src=\"img/drop.png\"> $pr_s6[IL_NAME]</a><br>";}
#################################################СЛОТ 4
$SLOT_4  = mysql_query("SET NAMES cp1251");
$SLOT_4  = mysql_query("SELECT * FROM slotS WHERE S_NICK=\"$_SESSION[s]\" AND S_NO=\"4\"");
$SLOT_4a = mysql_fetch_assoc($SLOT_4);
$SLOT_4a[S_SRC] = str_replace("use=","",$SLOT_4a[S_SRC]);
$pr_s7 = mysql_query("SELECT * FROM inv WHERE ID_IL=\"$SLOT_4a[S_SRC]\" AND ID_USERS=\"$_SESSION[s]\""); //проверка слота 3
$pr_s8 = mysql_fetch_assoc($pr_s7);

if(mysql_num_rows($SLOT_4)>0 AND mysql_num_rows($pr_s7)>0){echo"<a href=\"game.php\"><img src=\"img/drop.png\"> $pr_s8[IL_NAME]</a><br>";}

$mag = mysql_query("SELECT * FROM magic_slots WHERE S_NICK=\"$_SESSION[s]\"");
while($mag2=mysql_fetch_assoc($mag)){
$ptim = time();
echo"";
echo"<div style=\"padding:2px\"><div class=\"menu\" style=\"border:1px black dotted;\"><li> <a href=\"attack.php?menu=main&src=$mob2[MOBSid]&a=attck&ski=$mag2[S_KEY_MAGIC]\"><img src=\"img/book.png\"> ".$mag2[S_NAME_MAGIC].'</a>';
if($mag2[S_TIME_NEED]>$ptim){
echo ' ('.round(($mag2[S_TIME_NEED]-$ptim)).' сек.)';
}
echo"</li></div></div>";
}



//if(mysql_num_rows($prb)>0 AND isset($ski)){
//include("magik.php");

//}


//echo "<br/><img src=\"img/book.png\"> рывок";
?>

<?
//Подключаем приемы,магию
?>
<div style="padding:2px"><div class="menu" style="border:1px black dotted;"><li>
<?

include("exit_b.php");//подключаем файл выхода их боя
}
?>
</li></div></div></div>
<?
/*if(mysql_num_rows($prb)<1 AND isset($ski)){ print('<SCRIPT>location.href="attack.php?menu=main&src='.$src.'";</SCRIPT>');
$lU = mysql_query("INSERT INTO logs (L_CONT,COU_DMG,POPAL_ILI_NET,NAPADENIE,DEFENDER,L_TIME,L_LOC) VALUES ('невозможно использовать заклинания,у вас нету книги магии ','','','$_SESSION[s]','','$vremya','$nnick2[loc]')");

}*/
//if(mysql_num_rows($prb)>0 AND isset($ski)){
//echo"<div style=\"padding:5px\"><div class=\"menu\" style=\"border:3px red dotted;background:white\"><li>";

include("magik.php");
//echo"</li></div>";
//}

}?>

<?
//подключаем файл врагов

//include("");
?>

<?
if(substr($src,0,4)!="n_c_"){
	$use_A = rand($nnick2[DAMAGEmin],$nnick2[DAMAGEmax]);//удар игрока(физой)
	$usevrag_D = rand(0,$usevrag2[DEFENCE]);//броня игрока(ВРАГА)
	$usmd = ($use_A-$usevrag_D);
	
echo"<div class=\"top\"><font color=\"white\">БИТВА</font></div>";

echo"
<div class=\"main_title\" style=\"text-align:center;color:red\">$usvrag2[NICK] ур.$usvrag2[LVL_USERS]</div>

<div class=\"monster\"><img src=\"$pers2[MOBSimg]\" align=\"left\">
</div>
<div style=\"padding:2px;\"><div class=\"menu\" style=\"border:1px black dotted;text-align:left\"><li>
<a href=\"attack.php?menu=main&src=$usvrag2[NICK]&a=attus\"><img src=\"img/attck.png\" width=\"24\" height=\"24\"> АТАКОВАТЬ</a></li></div></div>";
$mag = mysql_query("SELECT * FROM magic_slots WHERE S_NICK=\"$_SESSION[s]\"");
while($mag2=mysql_fetch_assoc($mag)){
$ptim = time();
echo"";
echo"<div style=\"padding:2px;text-align:left\"><div class=\"menu\" style=\"border:1px black dotted;\"><li> <a href=\"attack.php?menu=main&src=$mob2[MOBSid]&a=attck&ski=$mag2[S_KEY_MAGIC]\"><img src=\"img/book.png\"> ".$mag2[S_NAME_MAGIC].'</a>';
if($mag2[S_TIME_NEED]>$ptim){
echo ' ('.round(($mag2[S_TIME_NEED]-$ptim)).' сек.)';
}
echo"</li></div></div>";
}
?>
<div style="padding:2px"><div class="menu" style="border:1px black dotted;text-align:left"><li>
<?

include("exit_b.php");//подключаем файл выхода их боя

?>
</li>
<?
//при атаке становимся,провокатором
//при убийстве становимся преступником на 30 минут

if($nnick2[timer_od]-$tud>0){
$tvm = $nnick2[timer_od]-$tud;
$lU = mysql_query("INSERT INTO logs (L_CONT,COU_DMG,POPAL_ILI_NET,NAPADENIE,DEFENDER,L_TIME,L_LOC,L_KEY) VALUES (' нужно отдохнуть ','$tvm',' <font color=\"brown\">( сек.)</font>','$_SESSION[s]','','$vremya','$usvrag2[loc]','$usvrag2[NICK]')");
$timUS = mysql_query("UPDATE users SET need_otdix=\"$tvm\" WHERE NICK=\"$_SESSION[s]\"");
}
#attk_statys - 0 обычный
#attk_statys - 1 провокатор
#attk_statys - 2 убийца
#############################################ПОПАЛ ИГРОК АТАКУЕТ ИГРОКА
if($use_A>$usvr_D AND $a=='attus' AND $use_T>=$use_T1 AND $nnick2[DAMAGEmax]>0 AND $usvrag2[U_UKLON]<$usvr_U AND $usvrag2[SHANS_BLOCK]<$usvr_B AND $use_K<$use_K1 AND $usvrag2[MINhp]>$usmd AND $nnick2[timer_od]-$tud<1 AND !isset($ski)){
if($usvrag2[attck_statys] == '0' AND $nnick2[attck_statys] == '0'){
	$ttds = time()+1800;
	$minmb = mysql_query("UPDATE users SET attck_statys=\"1\",attck_time=\"$ttds\" WHERE NICK=\"$_SESSION[s]\"");//делаем Провокатором

	
}//Делаем игрока Провокатором на 30 минут
if($usvrag2[attck_statys] == '0' AND $nnick2[attck_statys] == '1'){
	$ttds = time()+1800;
	$minmb = mysql_query("UPDATE users SET attck_statys=\"1\",attck_time=\"$ttds\" WHERE NICK=\"$_SESSION[s]\"");//делаем Провокатором

	
}//Делаем игрока Провокатором на 30 минут
$minmh = $usvrag2[MINhp]-$usmd;//отнимаем здоровье у игрока (ВРАГА)
$lU = mysql_query("INSERT INTO logs (COU_DMG,POPAL_ILI_NET,NAPADENIE,DEFENDER,L_TIME,L_LOC,L_KEY) 
	VALUES (' - $usmd',' <font color=\"brown\">(ФИЗ)</font>','$_SESSION[s]','$usvrag2[NICK]','$vremya','$usvrag2[loc]','$usvrag2[NICK]')");

$timUS = mysql_query("UPDATE users SET need_otdix=\"$nnick2[time_otdix]\",timer_od=\"$ttt\" WHERE NICK=\"$_SESSION[s]\"");
$minmb = mysql_query("UPDATE users SET MINhp=\"$minmh\" WHERE NICK=\"$src\"");//создаем запрос на отнимание здоровья у игрока (ВРАГА)
if($nnick2[class_pers] == 1 AND $arrp2[IL_COUNT]>0){
$armi = $arrp2[IL_COUNT]-1;
$updar = mysql_query("UPDATE inv SET IL_COUNT=\"$armi\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");}
if($nnick2[class_pers] == 1 AND $arrp2[IL_COUNT]<=1){
$updari = mysql_query("UPDATE inv SET IL_NO=\"0\" WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
$updar = mysql_query("DELETE FROM inv WHERE IL_SUBCLASS=\"streli\" AND ID_USERS=\"$_SESSION[s]\" AND IL_NO=\"1\"");
}

}//тут физический урон, если попал,не уворот,не блок,не крит,здоровье моба больше чем удар игрока,урон больше 0

//человек
?>
</div></div>
<?
}
include("logs.php");//подключаем файл логов
include("footer.php");
include("refresh.php");
?>
