Файл: DARK WARS/dark_war/attack/magic_dmg.php
Строк: 20
<?php
$mag = (int)$_GET['magic'];
$mym = mysql_fetch_assoc(mysql_query("SELECT * FROM `dark_war_masteries_u` WHERE `id` = '$mag' LIMIT 1"));
if (!$mym['id']) {
$doc->err("Нету такого умения");
exit;
} elseif ($mym['minus_mp'] > $forwards['mp']) {
$doc->err("Недостаточно маны для применения умения");
exit;
} else {
mysql_query("UPDATE `dark_war_attack` SET `hp` = (`hp`-'$mym[hp]'), `mp` = (`mp`-'$mym[mana]'), `dmg` = (`dmg`-'$mym[dmg]'),
`armor` = (`armor`-'$mym[armor]'), `armorp` = (`armorp`-'$mym[armorp]'), `magicr` = (`magicr`-'$mym[magicr]'),
`magicp` = (`magicp`-'$mym[magicp]') WHERE `number` = '{$player->id}'");
mysql_query("UPDATE `dark_war_attack` SET `mp` = (`mp`-'$mym[minus_mp]') WHERE `id_player` = '{$player->id}'");
}
// Игрок на которогго напали тоже бъет в ответ
$q = mysql_query("SELECT `id` FROM `dark_war_masteries_u` WHERE `id_player` = '{$ank->id}' AND `minus_mp` <= '$defending[mp]'");
while ($post = mysql_fetch_array($q)) {
$ida[] = $post['id'];
}
$cou = count($ida);
$nu = mt_rand(0,($cou - 1));
$res = mysql_fetch_assoc(mysql_query("SELECT * FROM `dark_war_masteries_u` WHERE id = '".$ida[$nu]."' LIMIT 1"));
if ($res['minus_mp'] <= $defending['mp']) {
mysql_query("UPDATE `dark_war_attack` SET `hp` = (`hp`-'$res[hp]'), `mp` = (`mp`-'$res[mana]'), `dmg` = (`dmg`-'$res[dmg]'),
`armor` = (`armor`-'$res[armor]'), `armorp` = (`armorp`-'$res[armorp]'), `magicr` = (`magicr`-'$res[magicr]'),
`magicp` = (`magicp`-'$res[magicp]') WHERE `id_player` = '{$player->id}'");
mysql_query("UPDATE `dark_war_attack` SET `mp` = (`mp`-'$res[minus_mp]') WHERE `number` = '{$player->id}'");
}
/////////////////////////////////////////// <<<<<<<<--------|||
?>