From f3bb55848b90f75c5d2d9cb448bd8734dc103cf7 Mon Sep 17 00:00:00 2001 From: lopar Date: Tue, 23 Jun 2020 09:12:04 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA?= =?UTF-8?q?=D0=B8=20=D1=81=D1=83=D1=89=D0=B5=D1=81=D1=82=D0=B2=D0=BE=D0=B2?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D1=8F=20=D0=BF=D0=B5=D1=80=D0=B5=D0=BC=D0=B5?= =?UTF-8?q?=D0=BD=D0=BD=D1=8B=D1=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- magic/healing.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/magic/healing.php b/magic/healing.php index a59e659..ac897fd 100644 --- a/magic/healing.php +++ b/magic/healing.php @@ -33,17 +33,16 @@ * */ // Если не в игре - идём нахер. -if ($_SESSION['uid'] == null) header("Location: index.php"); +if (empty($_SESSION['uid'])) {header("Location: index.php");} // Если нет цели заклинания - идём нахер. -// IDEA: Или кастуем на себя. Но тут нужны дополнительные проверки. -if (empty($_POST['target'])) header("Location: index.php"); +if (empty($_POST['target'])) {header("Location: index.php");} //Цель заклинания $target = $_POST['target']; //Шанс на успех $chance = 0; $chance = $_POST['chance']; -if ($chance > 95) $chance = 95; +if ($chance > 95) {$chance = 95;} //Интеллект заклинателя $mage_intellect = 0; $mage_intellect = $user['intel']; @@ -52,12 +51,12 @@ $receiver = db::c()->query('SELECT `id`, `hp`, `maxhp`, `battle`, `room`, (selec //Сила заклинания (на сколько лечим) //Если не указано, лечим на случайное значение от 0 до уровня интеллекта мага. $magic_power = mt_rand(0, $mage_intellect); -$magic_power = $_POST['magic_power']; +if (!empty($_POST['magic_power'])) {$magic_power = $_POST['magic_power'];} //Является ли сила лечения процентом? $percentage = false; if (!empty($_POST['percentage'])) { $percentage = true; - if ($magic_power > 100) $magic_power = 100; + if ($magic_power > 100) {$magic_power = 100;} } //Статус, отображаемый магу $status = ''; @@ -83,7 +82,7 @@ if ($receiver['battle'] != $user['battle']) { $new_hp = $receiver['hp'] + $magic_power; } - if ($new_hp >= $receiver['maxhp']) $new_hp = $receiver['maxhp']; + if ($new_hp >= $receiver['maxhp']) {$new_hp = $receiver['maxhp'];} if ($user['battle'] > 0) { db::c()->query('UPDATE `battle` SET `to1` = ?i, `to2` = ?i WHERE `id` = ?i', time(), time(), $user['battle']);