Вход Регистрация
Файл: ten.php
Строк: 55
<?php
require_once ('system/func.php');
$title 'Тень';
require_once (
'system/header.php');
auth(); // Закроем от гостей
# Атака #
if(isset($_GET['attack']) and $user['ten_koll'] >= 1){
if(
$user['gold'] < 3){
$_SESSION['msg'] = 'Не хватает '.ico('icons','gold.png').' '.(3-$user['gold']).' золота';
header("Location: ?");
exit();
}
$_hp ceil($user['max_health']*10/100);
if(
$user['health'] < $_hp){
$_SESSION['msg'] = "Для нападения необходимо минимум ".ico('icons','health.png')." 10% жизни.<br><a href='/rinok?koldun&url=/ten/?$random' class='btn2' data-ajax>Восстановить ".ico('icons','gold.png')." 15</a>";
header('Location: ?');
exit();
}else{
mysql_query("update `users` set `gold` = '".($user['gold']-3)."' where (`id` = '".$user['id']."')");
# Статы тени #
$batle_str ceil($user['str']*99/100);
$batle_def ceil($user['def']*99/100);
# Урон #
$schet 0;
$schet_opp 0;
$_str_opp rand(round($batle_str/6), round($batle_str/4));
$_def_opp rand(round($batle_def/12), round($batle_def/7));
$_str_opp $_str_opp $_def;
if(
$_str_opp 0)$_str_opp 0;
$_str $_str $_def_opp;
if(
$_str 0)$_str 0;
if(
$_str $_str_opp){
$schet $schet 1;
}elseif(
$_str_opp $_str){
$schet_opp $schet_opp 1;
}else{
$schet $schet 1;
$schet_opp $schet_opp 1;
}
$gold rand(4,10);
$crystals rand(500,1500);
if(
$schet $schet_opp){
mysql_query("update `users` set 
`gold` = '"
.($user['gold']+$gold)."', `health` = '".($user['health']-$_str_opp)."' 
where (`id` = '"
.$user['id']."')");
$_SESSION['pobeda'] = "<font color='green'><b>Победа</b></font><hr>Награда: ".ico('icons','gold.png').$gold золота";
}else{
mysql_query("update `users` set 
`crystals` = '"
.($user['crystals']+$crystals)."', `health` = '".($user['health']-$_str_opp)."' 
where (`id` = '"
.$user['id']."')");
$_SESSION['porazenie'] = "<font color='red'><b>Поражение</b></font><hr>Награда: ".ico('icons','crystal.png').$crystals кристаллов";
}
mysql_query("update `users` set `ten_koll` = '".($user['ten_koll']-1)."' where (`id` = '".$user['id']."')");
header("Location: ?");
exit();
}
}
echo 
"<div class='block center'>";
echo 
"<h1>Победи самого себя ($user[ten_koll])</h1><br>";
echo 
"<img src='/manekenImage_$myID.png' width='160px'><br>";
/*
echo ico('icons','str.png')." Атака: ".ceil($user[str]*99/100)."<br>".ico('icons','def.png')." Защита: ".ceil($user[def]*99/100);
*/
echo "<br>";
echo 
"<a href='?attack' class='btn center'>Атаковать за 3 ".ico('icons','gold.png')."</a>";
echo 
"<ul class='info'><br>";
echo 
"<li>Победив свою тень Вы получите от 4 до 10 золота</li><li>В случае поражения Вы получите от 500 до 1'500 кристаллов</li>";
echo 
"</ul>";
echo 
"</div>";
require_once (
'system/footer.php');
?>
Онлайн: 3
Реклама