Code cleaning.
This commit is contained in:
parent
df436bcef9
commit
98407e76b2
@ -208,11 +208,7 @@ class fbattle
|
||||
|
||||
function chanse($p)
|
||||
{
|
||||
if ($p > mt_rand(1, 100)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return $p > mt_rand(1, 100);
|
||||
}
|
||||
|
||||
function get_info_by_id($id)
|
||||
@ -253,21 +249,13 @@ class fbattle
|
||||
function get_chanse($persent)
|
||||
{
|
||||
$mm = 1000000;
|
||||
if (mt_rand($mm, 100 * $mm) <= $persent * $mm) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return mt_rand($mm, 100 * $mm) <= $persent * $mm;
|
||||
}
|
||||
|
||||
function get_block($who, $where_atack, $whom, $where_defend)
|
||||
function get_block($where_atack, $where_defend)
|
||||
{
|
||||
$blocks = array('1' => array(1, 2), '2' => array(2, 3), '3' => array(3, 4), '4' => array(4, 1));
|
||||
if (!in_array($where_atack, $blocks[$where_defend])) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return !in_array($where_atack, $blocks[$where_defend]);
|
||||
}
|
||||
|
||||
function add_log($text)
|
||||
@ -502,7 +490,6 @@ class fbattle
|
||||
}
|
||||
|
||||
if ($lomka) {
|
||||
$haos_flag = 0;
|
||||
foreach ($lomka as $k => $v) {
|
||||
if (mt_rand(1, 6) == 1) {
|
||||
$us = mysql_query('UPDATE `inventory` SET `duration` = (`duration`+1) WHERE `type` != 12 AND `dressed` = 1 AND `owner` = \'' . $v . '\'');
|
||||
@ -635,11 +622,6 @@ class fbattle
|
||||
function end_gora()
|
||||
{
|
||||
if ($this->GetTimeout()) {
|
||||
foreach ($this->team_mine as $v) {
|
||||
if (in_array($v, array_keys($this->battle))) {
|
||||
$vvv = $v;
|
||||
}
|
||||
}
|
||||
$this->AddToLog("<span class=date>" . date("H:i") . "</span> Бой закончен по таймауту.<BR>");
|
||||
|
||||
foreach ($this->team_enemy as $v => $k) {
|
||||
@ -1093,11 +1075,7 @@ class fbattle
|
||||
$uid = $this->user['id'];
|
||||
}
|
||||
$ins = mysql_query('INSERT INTO `actions` (`uid`, `time`, `city`, `room`, `vars`, `ip`, `vals`) VALUES ("' . $uid . '", "' . $time . '", "capitalcity", "0", "' . mysql_real_escape_string($vars) . '", "' . mysql_real_escape_string($_SERVER['HTTP_X_REAL_IP']) . '", "' . mysql_real_escape_string($vls) . '")');
|
||||
if ($ins) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return $ins;
|
||||
}
|
||||
|
||||
function GetWeaponType($idwep)
|
||||
@ -1124,7 +1102,6 @@ class fbattle
|
||||
|
||||
function razmen_log($type, $kuda, $chem, $uron, $kto, $c1, $pokomy, $c2, $hp, $maxhp)
|
||||
{
|
||||
$color = $this->gen_color($kto, $pokomy);
|
||||
if ($this->enemyhar['sex'] && $kto == $this->enemyhar['id']) {
|
||||
$sex1 = false;
|
||||
}
|
||||
@ -1257,11 +1234,7 @@ class fbattle
|
||||
function get_blocks($where_atack, $where_defend)
|
||||
{
|
||||
$blocks = array('1' => array(1, 2), '2' => array(2, 3), '3' => array(3, 4), '4' => array(4, 1));
|
||||
if (!in_array($where_atack, $blocks[$where_defend])) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return !in_array($where_atack, $blocks[$where_defend]);
|
||||
}
|
||||
|
||||
function GetBlock($komy, $att, $def, $enemy)
|
||||
@ -1270,19 +1243,11 @@ class fbattle
|
||||
|
||||
switch ($komy) {
|
||||
case "me" :
|
||||
if (in_array($this->battle[$enemy][$this->user['id']][0], $blocks[$def])) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return in_array($this->battle[$enemy][$this->user['id']][0], $blocks[$def]);
|
||||
break;
|
||||
|
||||
case "he" :
|
||||
if (in_array($this->battle[$enemy][$this->user['id']][1], $blocks[$att])) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return in_array($this->battle[$enemy][$this->user['id']][1], $blocks[$att]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1290,11 +1255,7 @@ class fbattle
|
||||
function GetChance($percent)
|
||||
{
|
||||
$mm = 1;
|
||||
if (rand($mm, 100 * $mm) <= $percent * $mm) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return rand($mm, 100 * $mm) <= $percent * $mm;
|
||||
}
|
||||
|
||||
function SelectEnemy()
|
||||
|
Loading…
Reference in New Issue
Block a user