<?php

include_once 'core/class.php';
require_once 'core/system.php';







?><style> .section._decor {    padding: 10px 18px 15px 18px;}.section._decor {    background:         url('/img/section/decor-tl.png') 0 0 no-repeat,         url('/img/section/decor-tr.png') 100% 0 no-repeat,         url('/img/section/decor-bl.png') 0 100% no-repeat,        url('/img/section/decor-br.png') 100% 100% no-repeat #16161e !important;    color: inherit;} .section._decor {        background-image: url('/img/section/decor_tl_x2.png'),        url('/img/section/decor_tr_x2.png'),        url('/img/section/decor_bl_x2.png'),        url('/img/section/decor_br_x2.png') !important;        background-size: 22px 22px !important;    } </style><?




head('Ледяной Призрак');



reg();

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



$bum = 5;
$param = new param;











$intro = $param->udar($weapo,$bum,$user['crit'],$user['sokru']);







list($weapon,$crit,$sokru) = $intro;










$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']."'")->fetch_assoc(); $next = $pet['str']; }


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
























$aluko = $dbc->query("SELECT `max_health`,`health`,`rubin`,`id`,`war` FROM `aluko` ORDER BY `id` LIMIT 1")->fetch_assoc();


$cc = $aluko['health']/$aluko['max_health']*100;
$cc = floor($cc);



	if($aluko['health']==0){





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



?><div class="section _decor mt2">
<div class="font14 center text-gold">Призрак убит, земли защищены </div>


<table width="100%" border="0" cellpadding="0" cellspacing="0" class="mt5 table-raiting">
<tbody>
<tr valign="top">
</td></br></br><?

$wim = $dbc->query("SELECT * FROM `kas_user` WHERE `war`='".$aluko['war']."' and `res`=1")->fetch_assoc();


$buy = $dbc->query("SELECT * FROM `dung_item` WHERE `id`=23 LIMIT 1")->fetch_assoc();  

?><center><img width="16" height="16" src="img/items/82.png" alt="." border="0"><a href="dung_item.php?ids=<?=$buy['id']?>" class="<?=$buy['lite']?>"><?=$buy['nik']?></a>
 Для:<span class="nowrap"><img src="img/class/<?=$wim['storona']?>/<?=$wim['pers']?>/pers.png" width="14" height="14" alt="*"><b><a href="pers.php?ank=<?=$wim['user_id']?>"><?=$wim['text']?></a></b></span></br></br></center><?










$yh = 0;

$by = $dbc->query("SELECT * FROM `kas_user` WHERE `war`='".$aluko['war']."'  ORDER BY `uron` desc limit 5");







while($de=$by->fetch_assoc()){


$yh++;

?><span><?=$yh?>.</span>
<span class="nowrap"><img src="img/class/<?=$de['storona']?>/<?=$de['pers']?>/pers.png" width="14" height="14" alt="*"><b><a href="pers.php?ank=<?=$de['user_id']?>"<font color=green> <?=$de['text']?></font></b></a> (<?=$de['uron']?>) <img src="img/money/money.png"><?=$de['gold']?> <img src="img/stat/sera.png"><?=$de['sera']?></span></br>




</td>

<?



}



















?></tr>


</tbody>
</table>

</div><?




















	foot();
	exit;
	}
function dead_bos(){
global $user;
global $dbc;
global $aluko;

$dbc->query("UPDATE `aluko` SET `health`=0 WHERE `id`='".$aluko['id']."'");
$dbc->query("UPDATE `alien` SET `state`=0");

$dbc->query("TRUNCATE TABLE  `aluko_log`");
$top_q = $dbc->query("SELECT * FROM `users` WHERE `sob`>1000 ORDER BY `sob` DESC LIMIT 5");

$win = $dbc->query("SELECT * FROM `users` WHERE `sob`>3000 ORDER BY RAND()")->fetch_assoc();


$invot = rand(1,5);
$shmot = $dbc->query("SELECT * FROM `dung_item` WHERE `id`=23")->fetch_assoc();









$dbc->query("INSERT INTO `artefact` (user_id,status,nik,strong,hp,prot,crit,regen,level,tip,class,lite,coin,img,vamp,sok,art) values('".$win['id']."','".$shmot['status']."','".$shmot['nik']."','".$shmot['strong']."','".$shmot['hp']."','".$shmot['prot']."','".$shmot['crit']."','".$shmot['regen']."','".$shmot['level']."','".$shmot['tip']."','".$win['pers']."','".$shmot['lite']."','".$shmot['coin']."','".$shmot['img']."','".$shmot['vamp']."','".$shmot['sok']."',1)");






$last = $dbc->insert_id;




	
			$topes_us = '<font color=blueviolet><a

href="/info_art.php?ids='.

$last.'">'.$shmot[nik].'</a> для <img src="img/class/'.$win['storona'].'/'.$win['pers'].'/pers.png" width="14" height="14" alt="*"><b><a href="pers.php?ank='.$win['id'].'"<font color=green> '.$win['login'].'</font></b></a></br>';

$pul2 = 27;

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

if($top['id']==$win['id']){ $item = $last; $res=1; }else{ $item = 0; $res = 0; }



$pul2  = $pul2 -2;

$pul = $top['sob']/20; $pul = ceil($pul); if($pul>10000){ $pul=10000;}



$dbc->query("INSERT INTO `kas_user` (user_id,uron,sera,text,gold,item,res,war,storona,pers) values('".$top['id']."','".$top['sob']."','".$pul."','".$top['login']."','".$pul2."','".$item."','".$res."','".$aluko['war']."','".$top['storona']."','".$top['pers']."')");






				
$dbc->query("UPDATE `users` SET `gold`=`gold`+".$pul2." , `serebro`=`serebro`+".$pul." WHERE `id`='".$top['id']."'");






				



$topes_us.= ' <img src="img/class/'.$top['storona'].'/'.$top['pers'].'/pers.png" width="14" height="14" alt="*"><b><a href="pers.php?ank='.$top['id'].'"<font color=green> '.$top['login'].'</font></b></a><img src="img/money/money.png">x5';


				$aluko['rubin']=$aluko['rubin']-1;
				$aluko['oput']= round($aluko['oput']/2);
			}
$dbc->query("UPDATE `aluko` SET `text`='.$topes_us.'");

				
$dbc->query("UPDATE `users` SET `sob`=0 WHERE `sob`>0");
				





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




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

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


 $_SESSION['logi']="$loki";  header('location:anow.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:anow.php');exit;}}





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

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



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

$_SESSION['logi']="$loki"; header('location:anow.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] . '"'); }


$vi ='';
$re = $weapon;
$re = $re - 50;
$weapon = ($re>0) ? $re : 1;

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

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





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

Oput($weapon);
dead_bos(); }
else{
$dbc->query("UPDATE `aluko` SET `health`=`health`-".$weapon." WHERE `id`='".$aluko['id']."'");
$dbc->query('UPDATE `users` SET `sob` = `sob`+ "' .$weapon. '",`udar` = "' .(time() + 2) . '" WHERE `id` = "' . $user[id] . '"');
$maxty = ($sokru==1) ? 'Сокрушил' : Ударил;


$suk = '<font color=green> Ты '.$maxty.' Ледяной Призрак на  '.$wep.' '.$messi.'</font>'.$ma.''; }




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);


$mob_udar = mt_rand(1,2);


$tf = 100; 


$tf = $tf - $user['defense'];
$mob_uron = ($tf>100) ? $tf : mt_rand(100,3500);





if($mob_udar == 2){
$wow = array('ударил','укусил','ранил');
shuffle($wow);
$tanki = '</br><font color=red> Ледяной Призрак '.$wow[0].' тебя на  '.$mob_uron.'</font>'; 


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

$dbc->query("UPDATE `users` SET `sob`='0',`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:anow.php');exit();}


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


	if(isset($_GET['dusha'])){
   if($user['dobav'] > 0) {  header('location:anow.php');exit;}

                if($user['am1_time'] > time()) {  header('location:anow.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:anow.php');exit;}}










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

	if(isset($_GET['plazm'])){
                if($user['am2_time'] > time()) { header('location:anow.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 >= $aluko['health']) {         dead_bos();
Oput($astor);
$sukm = '<font color=blueviovet> Лучи плазмы сожгли  </font>'; 


$dbc->query("INSERT INTO dolina_log SET user='$user[id]', text='$sukm' img=4 ");}else{

Oput($astor);
$dbc->query("UPDATE `aluko` SET `health`=`health`-".$astor." WHERE `id`='".$aluko['id']."'");
$dbc->query("UPDATE `users` SET `sob`=`sob`+".$astor." WHERE `id`='".$user['id']."'");
$maw = '<font color=blueviolet> Лучи плазмы пронзили Ледяной Призрак  раня на '.$astor.' '.$mess.'</font>'.$in.'';   $_SESSION['logi']="$maw"; header('location:?');exit;}}}






	



?><div class="combati">


<div class="combati-enemy">


<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td width="39" valign="top">
<div class="img-enemy">
<img src="/images/mob/likan.png" width="32" height="32" alt="."/></div>

</td>
<td valign="top">
<div class="name">
<b><?=$aluko['name']?></b> 
</div>
<div class="progress-hp">
<div class="hp-feel" style="width:<?=$cc?>%" id="hpFill"></div>

<div class="hp-health">
<span id="flashEnemyDamage" class="deltaEnemyDamage"><?=$aluko['health']?></span> <span class="va-m">/ <?=$aluko['max_health']?></span>
</div>
<div class="hp-damage flashEnemyDamage"></div>

</div>
</td>
</tr>
</tbody>
</table>

</div><? 


?><div class="combat-line"><a href="?jump" class="btn-aqua btn-potion"><img class="link-icon" src="/img/log/2.png" alt="" width="12" height="12"><span>Атаковать</span></a></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="/anow.php?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><?}




If($am1_time <= 0){?><div class="combat-line"><a href="/anow.php?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="/anow.php?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="/anow.php?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="/anow.php?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; }








	
























$gogom = $dbc->query("SELECT * FROM `users` WHERE `sob`>0 ORDER BY `sob` DESC LIMIT 5");
$i =0;
while($namf=$gogom->fetch_assoc()){


?><?=++$i?>.<img src="img/class/<?=$namf['storona']?>/<?=$namf['pers']?>/pers.png" width="14" height="14" alt="*"><b><a href="pers.php?ank=<?=$namf['id']?>"<font color=green> <?=$namf['login']?></font></b></a> (<?=$namf['sob']?>)<br><?}
?></div></div><?
foot();
?>
