<?php

//include_once 'core/class.php';

require_once 'core/system.php';








head('Лес Боли');









reg();

$dop=$dbc->query("SELECT * FROM `dop`where `user`= '".$user['id']."' ")->fetch_assoc(); 
if($user['mesto']!=8){ $dbc->query("update `users` set `mesto`=8 where `id`='".$user['id']."'"); }

$weapo = $user['strength']+$user['dobav'];











if($user['vip']==1){ $shans =70; }else{ $shans = 40;}









$weapon = $weapo;
$bb = mt_rand(1,100);
$crit = ($bb<=$user['crit']) ? true : false;


$bbb = mt_rand(1,100);
$sok = ($bbb<=30) ? true : false;





if($sok==1){ $takt= $weapon * $up / 100; $takt = ceil($takt); $weapon = $weapon +$takt;}





if($crit == 1){ $weapon = $weapon  * 1.5; $weapon = ceil($weapon); }














$plazma = $user['strength']+$user['dobav'];

$messi = ($crit==1) ? '<font color=red>(крит)</font>' : '';


$am1_time = $user['am1_time'] -time();
$am2_time = $user['am2_time'] -time();
$apteka_time = $user['apteka_t'] -time();

if($user['s_pet']==1){

$pet = $dbc->query("SELECT `name`,`str`,`spec` FROM `user_pets` WHERE `id_user` = '".$user['id']."' LIMIT 1")->fetch_assoc(); $next = $pet['str']; }



$rast = ($next>0 and $pet['spec']==2) ? $next : 0 ;



if($user['strength']<300){ ?><center>Вы слишком слабые для этого сражения..</center><? }





$adgame = $dbc->query("SELECT * FROM `adgame_info` ORDER BY `id` LIMIT 1")->fetch_assoc();



$adgame_time = $adgame['time'] -time();






/*







*/






$opp=$dbc->query("SELECT * FROM `adg` where `id`= '".$dop['goal']."' LIMIT 1")->fetch_assoc();  












function dead_bos(){
global $user;
global $dbc;

global $opp;

global $hp;
global $dop;



$kr = 1;


$dem = mt_rand(0,1);























$dbc->query("UPDATE `adg` SET `health`=`max_health` WHERE `id`='".$opp['id']."'");   




$dbc->query("UPDATE `dop` SET `goal`=0 WHERE `user`='".$dop['user']."'");   




























                





header ('location: adg.php');exit();



}


if(isset($_GET['linkrand'])){ 
if($user['level']<50){ $rash = 1; }else{ $rash = 2;}
$usik=$dbc->query("SELECT * FROM `adg` ORDER BY RAND() LIMIT 1 ")->fetch_assoc();  



//$usik = $dbc->query("SELECT * FROM `users` where `mesto`=3 and `storona`!='".$user['storona']."' ORDER BY RAND() LIMIT 1 ")->fetch_assoc();



if($usik){ $dbc->query("update `dop` set `goal`='".$usik['id']."' where `user`='".$user['id']."'"); header('location:adg.php?jump');exit;}else{ $_SESSION['message']='врагов нет!'; header('location:adg.php');exit;}}




/////Элексир
    if(isset($_GET['el'])){
                if ($user['apteka_t'] > time()) {   
header('location:rtut.php');exit;}




If($user['apteka']<=0){
$loki = '<font color=grey> У вас нет зелий</font>'; 


 $_SESSION['logi']="$loki";  header('location:adg.php');exit;}else{







$min = '<font color=green> Вы использовали зелье, здоровье восстановлено</font>'; 



$_SESSION['logi']="$min";


$dbc->query("UPDATE `users` SET `health`='".$user['max_health']."',`apteka_t` = '" .
(time() + 40) . "' ,`apteka`=`apteka`-1 WHERE `id`='".$user['id']."'");header('location:adg.php');exit;}}









/////////Простой Удар

    if(isset($_GET['jump'])){

If($dop['goal']==0){ header('location:adg.php?linkrand');exit;}









If($user['udar']>time()){
$loki = '<font color=grey> Промах!</font>'; 

$_SESSION['logi']="$loki"; header('location:adg.php');exit;}







$lolvamp = mt_rand(1,100);
$lolpet = mt_rand(1,100);

$hill = $user['strength'] * $user['vampir'] / 100; $hill = ceil($hill);



$hill = ($lolvamp<=20) ? $hill : 0;








$last_pet = ($lolpet<=25) ? $pet['str'] : 0;




$conf=$hill+$last_pet;



$conf=$conf+$user['health']; 


$itog = ($conf>=$user['max_health']) ? $user['max_health'] : $conf; 













$ma = ($lolvamp<=20) ? ' ,похитив '.$hill.' здоровья' : '';



if($user['health']<$user['max_health'] and $lolpet<=25 || $lolvamp<=20){






$dbc->query('UPDATE `users` SET `health` = "' .$itog. '" WHERE `id` = "' . $user[id] . '"'); }

if($opp['defense'] < 1600){ $brony=$opp['def'] * 5 / 100;}elseif($opp['def'] >= 1600){ $brony = 80;} $brony = floor($brony);





$vi ='';

if($brony>0){ $key = $weapon/100*$brony;


$key = floor($key);



$weapon = $weapon - $key; $weapon = floor($weapon); }


$weapon = ($weapon>0) ? $weapon : 1;


$wep = $weapon;
if($lolpet<=25 and $pet['spec']==1){

$vi = '</br><font color=green>Ваш питомец '.$pet[name].' зацепил '.$opp['name'].'  на  '.$pet['str'].'</font>'; $weapon = $weapon+$pet['str']; }









if ($weapon >= $opp['health']) {


$dbc->query("UPDATE `dop` SET `adg_uron`=`adg_uron`+".$weapon.",`adg_kill`=`adg_kill`+1 WHERE `user`='".$user['id']."'"); 

$dbc->query("UPDATE `adgame_info` SET `uron`=`uron`+".$weapon.",`kill`=`kill`+1 WHERE `id`=1"); 


Oput($weapon);
$_SESSION['logi']='Вы убили '.$opp['name'].'';


dead_bos(); }

else{
$dbc->query("UPDATE `adg` SET `health`=`health`-".$weapon." WHERE `id`='".$dop['goal']."'");


$dbc->query("UPDATE `dop` SET `adg_uron`=`adg_uron`+".$weapon." WHERE `user`='".$user['id']."'"); 
$dbc->query("UPDATE `adgame_info` SET `uron`=`uron`+".$weapon." WHERE `id`=1"); 



$dbc->query('UPDATE `users` SET `udar` = "' .(time() + 2) . '" WHERE `id` = "' . $user[id] . '"');

$maxty = ($sok==1) ? 'Сокрушил' : Ударил;



$suk = '<font color=green> Ты '.$maxty.' '.$opp['name'].' на  '.$wep.' '.$messi.'</font>'.$ma.''; }




if($opp['bot']==1){ 

$mins = ''.$opp['name'].' ударил вас на '.$weapon.''; 



$dbc->query("INSERT INTO `adgame2_log` SET `user`='".$user['id']."', `text`='".$mins."',`time`='".time()."' ");




}











If($user['s_pet']==1 and $user['health']<$user['max_health'] and $lolpet<=25){



If($pet['spec']==2){ 



$vi = '</br><font color=lime> '.$pet['name'].' Исцелил тебя на  '.$last_pet.'</font>'; 











}}

Oput($weapon);


if($user['defense'] < 1600){ $def=$user['defense'] * 5 / 100;}elseif($user['defense'] >= 1600){ $def = 80;} $def = floor($def);



$mob_uron = $opp['strength'];


if($def>0){ $keys = $mob_uron/100*$def;




$keys = floor($keys);



$mob_uron = $mob_uron - $keys; $mob_uron = floor($mob_uron); }




$mob_uron = ($mob_uron>0) ? $mob_uron : 1;










if($opp['bot'] == 0){




$wow ='ударил';

shuffle($wow);
$tanki = '</br><font color=red> '.$opp['name'].' '.$wow.' тебя на  '.$mob_uron.'</font>'; 











if($mob_uron>0){
                if ($mob_uron > $user['health']) {

$dbc->query("UPDATE `users` SET `health`='100' WHERE `id`='".$user['id']."'");

header ('location:death.php');exit();
}else{ $dbc->query("UPDATE `users` SET `health`=`health`-".$mob_uron." WHERE `id`='".$user['id']."'");}
}

}

$suk.=$tanki;
$suk.=$vi;
$_SESSION['logi']="$suk";





header('location:adg.php');exit();}






//////Душа Тени


    if(isset($_GET['dusha'])){
                if($user['am1_time'] > time()) {  header('location:adg.php');exit;}else{





$basik = 0;
$inf ='';

if($user['pers']==1 and $user['amulet1']>4){ 



$basik = $user['defense'] * 30 / 100;
$basik = ceil($basik);

 $ins ='<span class=iLegendary>дополнительно + '.$basik.' силы , Эффект: Ярость Воина</span>'; }




$astor = $plazma * $user['ten'] / 100;


$astor = ceil($astor);
$sin = $astor;
$astor = $astor+$basik;



$dbc->query('UPDATE `users` SET `am1_time` = "' .(time() + 60) . '",`dobav`=`dobav`+"'.$astor.'" WHERE `id` = "' . $user[id] . '"');

$maw = '<font color=green> Ты активировал Душа Теней (Сила +'.$sin.') '.$ins.'</font>'; 


$_SESSION['logi']="$maw"; header('location:adg.php');exit;}}














////// Плазма

    if(isset($_GET['plazm'])){
If($dop['goal']==0){  $_SESSION['message']='некого бить!'; header('location:adg.php?');exit;}







                if($user['am2_time'] > time()) { header('location:adg.php');exit;}else{





$dbc->query('UPDATE `users` SET `am2_time` = "' . (time() + 60) . '" WHERE `id` = "' . $user['id'] . '"');
$astor = $plazma * $user['plazm'] / 100;


$astor = ceil($astor);
$astor = $astor+$plazma;
if($crit==1){$tali= $astor * 50 / 100; $tali = ceil($tali); $astor = $astor+$tali;$mess =' <font color=red>(крит)</font>';}

$in ='';
$sh = mt_rand(1,3);
if($user['pers']==2 and $user['amulet2']>4 and $sh==2){ 
$astor = $astor*2;
$in =' <span class=iLegendary>Сила удвоена, Эффект: Гнев Мага</span>';}

if ($astor >= $opp['health']) { $_SESSION['logi']='<font color=blueviolet>Лучи плазмы сожгли '.$opp['name'].'   '.$in.'</font>';   



$dbc->query("UPDATE `dop` SET `adg_uron`=`adg_uron`+".$astor.",`adg_kill`=`adg_kill`+1 WHERE `user`='".$user['id']."'");  

$dbc->query("UPDATE `adg_info` SET `uron`=`uron`+".$astor.",`kill`=`kill`+1 WHERE `id`=1"); 





     dead_bos();














Oput($astor);

}else{


Oput($astor);
$dbc->query("UPDATE `adg` SET `health`=`health`-".$astor." WHERE `id`='".$dop['goal']."'");





$dbc->query("UPDATE `dop` SET `adg_uron`=`adg_uron`+".$astor." WHERE `user`='".$user['id']."'");  

$dbc->query("UPDATE `adg_info` SET `uron`=`uron`+".$astor." WHERE `id`=1"); 

if($opp['bot']==0){ 
$mins = ''.$user['login'].' пронзил вас лучем плазмы '.$astor.''; 

$dbc->query("INSERT INTO `oboroten_log` SET `user`='".$opp['id']."', `text`='".$mins."',`time`='".time()."' ");


} 



$maw = '<font color=blueviolet> Лучи плазмы пронзили '.$opp['login'].'  раня на '.$astor.' '.$mess.'  '.$in.'</font>';   $_SESSION['logi']="$maw"; header('location:?');exit;}}}










    

?><div class="section _decor">
<div class="basin-efir">
<div class="efir-info" style="float: left;">
<img src="/img/new/cyc.png" width="12" height="12" alt="."/> Эфир <span class="efir-percent"><?=$adgame['efir']?></span>%


(<font color="aqua"><?=Sec2Time($adgame_time)?></font>)


</div>
<div class="section-sep mt5"></div>
<div class="basin-vs-table mb5">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
Ваш урон: <span class="info"><?=$dop['adg_uron']?></span>

</td>
<td>
- -
</td>
<td>
Убийств: <span class="major"><?=$dop['adg_kill']?></span>


</td>
</tr>
</table>
</div>
<div class="">

</div>
</div>
<div><?








If($dop['goal']>0){?><div class="panel-inner">

<img src="/img/forest/<?=$opp['img']?>.png" width="32" height="32" alt="."/><span class="major"><?=$opp['name']?> <img src="img/stat/hp.png"><strong><?=$opp['health']?></strong></span><br/></div><?}





?><div class="combat-line"><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td width="50%"><a href="?jump" class="btn-red"><img class="link-icon" src="/images/icons/sword1.png" alt="" width="12" height="12"><span>Атаковать</span></a></td><td width="50%"><a href="?linkrand" class="btn-red"><img class="link-icon" src="/images/icons/sword1.png" alt="" width="12" height="12"><span>Бить любого</span></a></td></tr></table></div><? 







If($am2_time <= 0){ ?><div class="combat-line"><a href="?plazm" class="btn-red"><img class="link-icon" src="/img/log/3.png" alt="" width="12" height="12"><span>Сияние Плазмы</span></a></div><?}else{?><div class="combat-line"><a href="?plazm" class="btn-red inactive inactive25"><img class="link-icon"src="/img/log/3.png" alt="" width="12" height="12"><span>Сияние Плазмы</span>&nbsp;<span class="locked-time"><?=Sec2Time($am2_time)?></span></a></div><?}







If($am1_time <= 0){?><div class="combat-line"><a href="?dusha" class="btn-red"><img class="link-icon" src="/img/log/4.png" alt="" width="12" height="12"><span>Душа Тени </span></a></div><?}else{?><div class="combat-line"><a href="?dusha" class="btn-red inactive inactive25"><img class="link-icon" src="/img/log/4.png" alt="" width="12" height="12"><span>Душа Тени</ span>&nbsp;<span class="locked-time"><?=Sec2Time($am1_time)?></span></a></div><?}  If($apteka_time <= 0){?><div class="combat-line"><a href="?el" class="btn-aqua btn-potion"><img class="link-icon" src="/img/log/5.png" alt="" width="12" height="12"><span>Зелье Здоровья(<?=$user['apteka']?>)</span></a></div><? }Else{ ?></div><div class="combat-line"><a href="?el" class="btn-aqua inactive-skill inactive50"><img class="link-icon" src="/img/log/5.png" alt="" width="12" height="12"><span>Зелье Здоровья(<?=$user['apteka']?>)</span>&nbsp;<span class="locked-time"><?=Sec2Time($apteka_time)?></span></a></div><?}





if($user['s_pet']==1){?><div class="info-box"><font color=orange>Помощник</font>: <font color=grey><?=$pet['name']?></br></div><?}

if (isset($_SESSION['logi'])){?>

<div class="b-panel-new dblue-panel bordered mt2">
<div class="panel-inner-2"><?=$_SESSION[logi]?></div></div><?   $_SESSION['logi']=NULL; }







$los=$dbc->query("SELECT `text`,`time`,`user`,`id` FROM `adgame2_log` where `user`= '".$user['id']."' order by `id` desc limit 1")->fetch_assoc();   















$very = $los['time'] -time();

$very = abs($very);




    
if($very < 10){
?><div class="b-panel-new dblue-panel bordered mt2"><div class="panel-inner-2"><font color=red><?=$los['text']?></font></div></div><?}






if (isset($_SESSION['snow'])){?><div style="clear:both;"></div><div class="b-notice trsmgr"><div class="notify-inner"><?=$_SESSION[snow]?></div></div><?   $_SESSION['snow']=NULL; } 








?><div class="b-panel-new dblue-panel bordered mt2">
<div class="panel-inner-2"><center><span class="iLegendary">Последняя Награда</span></center><?





?><table>




        <tr>












<td><?=$adgame['text']?>







            </br>Награда выдается при достижении 100% Эфира.</br><span class="info">(Имейте дополнительно 10 убийств при взрыве эфира. получите 20 золотых)</span></td></tr></table>





<?





?></div></div><? 



















































foot();
?> 

