Файл: DARK WARS/dark_war/place/attack.php
Строк: 43
<?php
include_once '../start.php';
$doc = new document();
$ar = mysql_fetch_assoc(mysql_query("SELECT * FROM `dark_war_attack_creep` WHERE `id_player` = '{$player->id}' LIMIT 1"));
$creep = mysql_fetch_assoc(mysql_query("SELECT `name`, `img`, `id_place`, `max_gold`, `max_silver`, `max_expe`
FROM `dark_war_place_creeps`
WHERE `id` = '$ar[id_creep]' LIMIT 1"));
$doc->title('Атака ' . $creep['name']);
if (!mysql_result(mysql_query("SELECT COUNT(*) FROM `dark_war_attack_creep` WHERE `id_player` = '{$player->id}'"), 0)) {
header ("Location: /dark_war/place/");
exit();
}
include_once 'finish.php'; // Отправит сообщение о победе или поражении и закончит сражение
if (isset($_GET['attack'])) {
include_once 'dmg.php'; // при атаке обычным дамагом
header ("Location: /dark_war/place/attack.php");
exit();
}if (isset($_GET['magic'])) {
include_once 'magic_dmg.php'; // при атаке скилами
include_once 'dmg.php'; // при атаке обычным дамагом
header ("Location: /dark_war/place/attack.php");
exit;
}if (isset($_GET['leave'])) {
mysql_query("DELETE FROM `dark_war_attack_creep` WHERE `id_player` = '{$player->id}' LIMIT 1"); // сбежать с поля боя
header ("Location: /dark_war/place/view.php?id=$creep[id_place]");
exit();
}echo "<center><img src='/dark_war/all_img/place/creeps/original/$creep[img].jpg' alt='!' /></center>";
if(isset($_SESSION['fight_1']))
echo $player->name . " нанес удар " . $creep['name']. " ". $_SESSION['fight_1'] . "<br />";
$_SESSION['fight_1']= false;
if(isset($_SESSION['fight_2']))
echo $creep['name'] . " нанес удар " . $player->name. " ". $_SESSION['fight_2'] . "<br />";
$_SESSION['fight_2']= false;
if(isset($_SESSION['fight_3']))
echo "Ваш питомец нанес удар " . $creep['name']. " ". $_SESSION['fight_3'] . "<br />";
$_SESSION['fight_3']= false;
$dispatch[] = array ('name' => $player->name, 'hp' => $player->hp, 'mp' => $player->mp, 'dmg' => $player->dmg,
'armor' => $player->armor, 'armorp' => $player->armorp,
'magicr' => $player->magicr, 'magicp' => $player->magicp);
$dispatch[] = array ('name' => $creep['name'], 'hp' => $ar['hp'], 'mp' => $ar['mp'], 'dmg' => $ar['dmg'],
'armor' => $ar['armor'],'armorp' => $ar['armorp'], 'magicr' => $ar['magicr'],
'magicp' => $ar['magicp']);
$doc->assign('post', $dispatch);
$doc->display('view_attack.tpl');
$dispatch = array();
$q=mysql_query("SELECT * FROM `dark_war_masteries_u` WHERE `active` = '1' AND `id_player` = '{$player->id}'");
while ($post = mysql_fetch_array($q)) {
$list = $post['name'];
$img = '/dark_war/all_img/masteries/'.$post['img'].'.png" ';
$link = "?magic=" . $post['id'] . "".(isset($_GET['page'])?'&page='.$_GET['page'].'' : '')."";
$descrip = "<img src='/dark_war/all_img/14/hp.png' alt='' />-$post[hp] ";
$descrip .= "<img src='/dark_war/all_img/14/sword.png' alt='' />-$post[dmg] ";
$descrip .= "<img src='/dark_war/all_img/14/shield1.png' alt='' />-$post[armor] ";
$descrip .= "<img src='/dark_war/all_img/14/shield.png' alt='' />-$post[magicr] ";
$dispatch[] = array ('title' => $list, 'img' => $img, 'link' => $link, 'descrip' => $descrip);
}$doc->assign('post', $dispatch);
$doc->display('view_list_plus_img.tpl');
$doc->act("attack.php?attack", "Атака");
$doc->act("attack.php?leave", "Сбежать");
?>