<?php

require_once 'core/system.php';


head('Болото');




reg();
$bat=$dbc->query("SELECT `priz`,`opp` FROM `aluko`where `id`= 1 ")->fetch_assoc();

$may=$dbc->query("SELECT * FROM `dop`where `user`= '".$user['id']."' ")->fetch_assoc();

$slim = '';


if($bat['opp']<=0 and $bat['priz']==0){ 


$top_q = $dbc->query("SELECT * FROM `users` WHERE `cr`>1 ORDER BY `cr` DESC LIMIT 3");
$win = $dbc->query("SELECT * FROM `users` WHERE `cr`>1 ORDER BY `cr` DESC LIMIT 1")->fetch_assoc();

            
while($top=$top_q->fetch_assoc()){

$tr = 20;



                
$dbc->query("UPDATE `users` SET     `gold`=`gold`+".$tr." WHERE `id`='".$top['id']."'");}


$dbc->query("UPDATE `users` SET  `strength`=`strength`+300, `defense`=`defense`+300,`god`=1 WHERE `id`='".$win['id']."' AND `god`=0");




$dbc->query("UPDATE `aluko` SET     `priz`=1 WHERE `id`=1");



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

}



if($bat['priz']==1){ 

?><center><img src="img/ivent/vamp.jpg" width="100%" height="120" alt="*"></center><?



$top_q = $dbc->query("SELECT * FROM `users` WHERE `cr`>1 ORDER BY `cr` DESC LIMIT 3");
$win = $dbc->query("SELECT * FROM `users` WHERE `cr`>1 ORDER BY `cr` DESC LIMIT 1")->fetch_assoc();

            



?><div class="b-panel-new dblue-panel bordered mt2"><div class="panel-inner-2"><center><span class="info">Маги даруют благодать Герою по имени <a href="/pers.php?ank=<?=$win['id']?>"> <img src="img/class/<?=$win['storona']?>/<?=$win['pers']?>/pers.png" width="14" height="14" alt="*"><?=$win['login']?></a> он получает <img src="img/stat/AKulak.png">+300<img src="images/icons/armor.png"> +300 на сутки</span></div></div><?





$i = 0;


while($top=$top_q->fetch_assoc()){


?><a class="link-panel no-arr" href="/pers.php?ank=<?=$top['id']?>"> <?=++$i?>.<img src="img/class/<?=$top['storona']?>/<?=$top['pers']?>/pers.png" width="14" height="14" alt="*"><?=$top['login']?></font></b> (<img src="img/money/money.png">x20) собрано: <img src="img/icon/sk.png"><?=$top['cr']?></a><?








}


?></br> <center><span class="info">Битва проходит каждый день в 20:00</span></center><?






foot();


exit;

}

























if($may['pro_opp']==1){


$name ='Проклятый Вампир';



$sila  = 100;



$brony  = 100;




$hp = 5000;

$cr = 1;








}

if($may['pro_opp']==2){

$name ='Воин Культа';

$sila  = 150;

$brony  = 150;

$hp = 7000;

$cr = 2;

}

if($may['pro_opp']==3){

$name ='Безумный Кровопийца';

$sila  = 200;

$brony  = 200;

$hp = 8000;

$cr = 3;

}

if($may['pro_opp']==4){

$name ='Лорд Агнес';

$sila  = 250;

$brony  = 250;

$hp = 9000;

$cr = 4;

}

if($may['pro_opp']==5){

$name ='Осквернитель';

$sila  = 300;

$brony  = 300;

$hp = 10000;

$cr = 5;

}


function crea_bos(){
global $user;
global $dbc;
global $aluko;
global $hp;

global $cr;
global $may;


$sink = mt_rand(1,5);


    $hp = array (0,5000,7000,8000,9000,10000,10000); 

$hpup  = $hp[$sink];




$dbc->query("UPDATE `dop` SET `pro_hp`='".$hpup."', `pro_opp` ='".$sink."' WHERE `user`='".$user['id']."'");


$dbc->query("UPDATE `users` SET `cr`=`cr`+'".$may['pro_opp']."' WHERE `id`='".$user['id']."'");
$dbc->query("UPDATE `aluko` SET `opp`=`opp`-1 WHERE `id`=1");




$slim = '<span class=info>+'.$may['pro_opp'].'';









}




$heal = $may['pro_hp']/$pask*100;



$my = $user['health']/$user['max_health']*100;


if(isset($_GET['sn'])){ 
if($user['serebro']<1000){ $_SESSION['message']='недостаточно серебра'; header('location:protect.php');exit;}


$sink = mt_rand(1,5);


    $hp = array (0,5000,7000,8000,9000,10000,10000); 

$hpup  = $hp[$sink];




$dbc->query("UPDATE `dop` SET `pro_hp`='".$hpup."', `pro_opp` ='".$sink."' WHERE `user`='".$user['id']."'");


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













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


}

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

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

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


  $my_udar = $user['strength']-$brony+mt_rand(5,10);    $vrag_udar = $sila-$user['defense']+mt_rand(1,5); if($vrag_udar<1){ $vrag_udar = mt_rand(1,5);} if($my_udar<1){ $my_udar = mt_rand(1,5);} $_SESSION['my']='<span class="info"> - '.$my_udar.'</span>'; $_SESSION['vrag']='<font color="red"> - '.$vrag_udar.'</font>';                                                                                                           






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






$se = $bat['sera']/2; $se = ceil($se);

$dell = $may['pro_hp']-$my_udar; $des = $user['health']-$vrag_udar;




//if($des<=0){
if($vrag_udar>=$user['health']){









                                                            $dbc->query("update `dop` set `pro_hp`=5000 , `pro_opp`=1 where `user`= '".$user['id']."'");
                                                            $dbc->query("update `users` set `cr`=0 where `id`= '".$user['id']."'");











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


if($dell>0){
                                                                $dbc->query("update `dop` set `pro_hp`=`pro_hp`-'".$my_udar."' where `user`= '".$user['id']."'");

                                                                $dbc->query("update `users` set `health`=`health`-'".$vrag_udar."' where `id`= '".$user['id']."'");




Oput($my_udar);

}
if($dell<=0){ 




















crea_bos();





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






}




$batt=$dbc->query("SELECT `pro_hp` FROM `dop` where `user`= '".$user['id']."' ")->fetch_assoc();






$heal = $batt['pro_hp']/$hp*100;




$my = $user['health']/$user['max_health']*100;



?><center><div class="b-panel-new dblue-panel bordered mt2">
<div class="panel-inner-2"><div class="font-small text-italic c-verygray">Противников: <?=$bat['opp']?></center><?






?><div class="b-panel-new dblue-panel bordered mt2"><div class="panel-inner-2"><img src="img/ivent/demon_vamp.png"><?=$name?>(<img src="img/icon/sk.png"><?=$cr?>) <img


src="/img/stat/
AKulak.png"><?=$sila?><img src="images/icons/armor.png"><?=$brony?> <img src="img/stat/hp.png"><?=$may['pro_hp']?><?=$_SESSION['my']?> <div class="enemy-hp2">






<div class="enemy-hp-remain2 hp-green" style="width:<?=$heal?>%"></div>

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



?><div class="combat-line"><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td width="50%"><a href="/protect.php?at" 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="?" class="btn-red"><span>Обновить</span></a></td></tr></table></div><? 











?><div class="b-panel-new dblue-panel bordered mt2"><div class="panel-inner-2"><img src="/img/auser/<?=$user['storona']?>/<?=$user['pers']?>/pers.png" width="32" height="32" alt="."/><?=$user['login']?> <img
src="/img/stat/
AKulak.png"><?=$user['strength']?><img src="images/icons/armor.png"><?=$user['defense']?> <img src="img/stat/hp.png"><?=$user['health']?><?=$_SESSION['vrag']?><div class="enemy-hp2">






<div class="enemy-hp-remain2 hp-green" style="width:<?=$my?>%"></div> ><br/></div></div><?


?><div class="lblue-panel"><div class="panel-inner-2"><div class="font-small text-italic c-verygray">
Вы собрали: <img src="img/icon/sk.png"><?=$user['cr']?> <?=$slim?></br>


После смерти черепа обнуляются</div></div></div></div><?

?><a class="btn" href="protect.php?sn">Сменить Противника за <img src="img/stat/sera.png">1000</a><?

$slim = '';

$_SESSION['my']=null; $_SESSION['vrag']=null;

foot();  

