battles/magic/down.php

38 lines
1.7 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// магия "шаг назад"
if ($user['battle'] > 0) {
echo "Не в бою...";
} elseif (rand(1, 100) != 1) {
\Battles\DressedItems::undressAllItems($user['id']);
$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;"));
if (empty($_SESSION['uid'])) {
header("Location: index.php");
exit;
}
if ($user['sila'] > 3) {
mysql_query("UPDATE `users` SET `stats`=`stats`+1,`sila` = `sila`-1 WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;");
}
if ($user['inta'] > 3) {
mysql_query("UPDATE `users` SET `stats`=`stats`+1,`inta` = `inta`-1 WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;");
}
if ($user['lovk'] > 3) {
mysql_query("UPDATE `users` SET `stats`=`stats`+1,`lovk` = `lovk`-1 WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;");
}
if ($user['vinos'] > 3) {
if ($user['hp'] <= ($user['maxhp'] - 6)) {
mysql_query("UPDATE `users` SET `stats`=`stats`+1, `maxhp`=`maxhp`-'6',`vinos` = `vinos`-1 WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;");
} else {
mysql_query("UPDATE `users` SET `stats`=`stats`+1, `maxhp`=`maxhp`-'6', `hp`=`hp`-'6',`vinos` = `vinos`-1 WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;");
}
}
if ($user['intel'] > 0) {
mysql_query("UPDATE `users` SET `stats`=`stats`+1,`intel` = `intel`-1 WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;");
}
if ($user['mudra'] > 0) {
mysql_query("UPDATE `users` SET `stats`=`stats`+1,`mudra` = `mudra`-1 WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;");
}
echo "<font color=red><b>Удачно использована магия \"Шаг назад\"<b></font>";
$bet = 1;
}