if ($power >= 25) { $def_protect_mag = 25; } } } } } $protect_mag = $protect_mag + $power * 1.5 + $def_protect_mag; effects($users_id, $effect); $def_priem = array(); $d_pr = mysql_query("SELECT pr_name FROM person_on WHERE id_person=" . $users_id . " and battle_id={$b_id} and pr_active=2 and pr_cur_uses>0"); while ($defend_priem = mysql_fetch_array($d_pr)) { $def_priem[] = $defend_priem["pr_name"]; } if ($hp_now > 0) { $pers_uron = calc_mag($db, "air_magic"); $uron = $pers_uron + rand($damage_min, $damage_max); $uron = $uron - ($protect_air + $effect["protect_air"]) - ($protect_mag + $effect["add_mg_bron"]) / 4; if (in_Array("protair", $def_priem)) { $uron = $uron / 2; mysql_query("UPDATE person_on SET pr_cur_uses=pr_cur_uses-1 WHERE id_person='" . $users_id . "' and battle_id=" . $b_id . " and pr_name='protair'"); $my_res = mysql_fetch_array(mysql_query("SELECT pr_cur_uses FROM person_on WHERE id_person=" . $users_id . " and battle_id=" . $b_id . " and pr_name='protair'")); if ($my_res["pr_cur_uses"] == 1) { mysql_query("UPDATE person_on SET pr_active=1 WHERE id_person='" . $users_id . "' and battle_id=" . $b_id . " and pr_name='protair'"); } } if (in_Array("block", $def_priem)) { $uron = $uron / 2; $phrase .= "<span class=date>{$date}</span> <span class={$span2}>{$select_target}</span> понял что его спасение это прием <b>Активная защита</b>.<br>"; mysql_query("UPDATE person_on SET pr_active=1 WHERE id_person='" . $users_id . "' and battle_id=" . $b_id . " and pr_name='block'"); }
if ($power >= 25) { $def_protect_mag = 25; } } } } } $protect_mag = $protect_mag + $power * 1.5 + $def_protect_mag; effects($users_id, $effect); $def_priem = array(); $d_pr = mysql_query("SELECT pr_name FROM person_on WHERE id_person=" . $users_id . " and battle_id={$b_id} and pr_active=2 and pr_cur_uses>0"); while ($defend_priem = mysql_fetch_array($d_pr)) { $def_priem[] = $defend_priem["pr_name"]; } if ($hp_now > 0) { $pers_uron = calc_mag($db, "earth_magic"); $uron = $pers_uron + $pers_uron * rand($damage_min, $damage_max) / 100; $uron = $uron - ($protect_earth + $effect["protect_earth"]) - ($protect_mag + $effect["add_mg_bron"]) / 4; if ($uron > $max_damage) { $uron = $max_damage; } if ($uron <= 0) { $uron = 3 * $db["level"]; } if (in_Array("protearth", $def_priem)) { $uron = $uron / 2; mysql_query("UPDATE person_on SET pr_cur_uses=pr_cur_uses-1 WHERE id_person='" . $users_id . "' and battle_id=" . $b_id . " and pr_name='protearth'"); $my_res = mysql_fetch_array(mysql_query("SELECT pr_cur_uses FROM person_on WHERE id_person=" . $users_id . " and battle_id=" . $b_id . " and pr_name='protearth'")); if ($my_res["pr_cur_uses"] == 1) { mysql_query("UPDATE person_on SET pr_active=1 WHERE id_person='" . $users_id . "' and battle_id=" . $b_id . " and pr_name='protearth'"); }
if ($power >= 25) { $def_protect_mag = 25; } } } } } $protect_mag = $protect_mag + $power * 1.5 + $def_protect_mag; effects($users_id, $effect); $def_priem = array(); $d_pr = mysql_query("SELECT pr_name FROM person_on WHERE id_person=" . $users_id . " and battle_id={$b_id} and pr_active=2 and pr_cur_uses>0"); while ($defend_priem = mysql_fetch_array($d_pr)) { $def_priem[] = $defend_priem["pr_name"]; } if ($hp_now > 0) { $pers_uron = calc_mag($db, "fire_magic"); $uron = $pers_uron + rand($damage_min, $damage_max); $uron = $uron - ($protect_fire + $effect["protect_fire"]) - ($protect_mag + $effect["add_mg_bron"]) / 4; if ($uron <= 0) { $uron = 3 * $db["level"]; } if (in_Array("protfire", $def_priem)) { $uron = $uron / 2; mysql_query("UPDATE person_on SET pr_cur_uses=pr_cur_uses-1 WHERE id_person='" . $users_id . "' and battle_id=" . $b_id . " and pr_name='protfire'"); $my_res = mysql_fetch_array(mysql_query("SELECT pr_cur_uses FROM person_on WHERE id_person=" . $users_id . " and battle_id=" . $b_id . " and pr_name='protfire'")); if ($my_res["pr_cur_uses"] == 1) { mysql_query("UPDATE person_on SET pr_active=1 WHERE id_person='" . $users_id . "' and battle_id=" . $b_id . " and pr_name='protfire'"); } } if (in_Array("block", $def_priem)) { $uron = $uron / 2;
} $BLD_ = mysql_query("SELECT bot_temp.bot_name, users.id,users.power, bot_temp.hp, bot_temp.hp_all,protect_fire,protect_water,protect_air,protect_earth,protect_svet,protect_tma,protect_gray,protect_mag FROM bot_temp LEFT JOIN users on users.login=bot_temp.prototype WHERE battle_id='" . $b_id . "' and bot_temp.hp>0 and team={$enemy_team}"); if (mysql_num_rows($BLD_)) { while ($BLD = mysql_fetch_array($BLD_)) { $victims[] = array("opponent" => $BLD["bot_name"], "power" => $BLD["power"], "id" => $BLD["id"], "types" => "bot", "hp" => $BLD["hp"], "hp_all" => $BLD["hp_all"], "protect_fire" => $BLD["protect_fire"], "protect_water" => $BLD["protect_water"], "protect_air" => $BLD["protect_air"], "protect_earth" => $BLD["protect_earth"], "protect_svet" => $BLD["protect_svet"], "protect_tma" => $BLD["protect_tma"], "protect_gray" => $BLD["protect_gray"], "protect_mag" => $BLD["protect_mag"]); } } $n = rand(3, 5); //kolichestvo udarov $n2 = count($victims); if ($n2 < $n) { $n = $n2; } $i = $ret['uron'] = 0; $phrase = ''; $pers_uron = calc_mag($db, "water_magic"); $f = $pers_uron + $damage_min; $g = $pers_uron + $damage_max; shuffle($victims); for ($i = 0; $i < $n; $i++) { effects($victims[$i]["id"], $effect); $def_priem = array(); $d_pr = mysql_query("SELECT pr_name FROM person_on WHERE id_person=" . $victims[$i]["id"] . " and battle_id={$b_id} and pr_active=2 and pr_cur_uses>0"); while ($defend_priem = mysql_fetch_array($d_pr)) { $def_priem[] = $defend_priem["pr_name"]; } $uron = mt_rand($f, $g); if ($victims[$i]["power"] >= 125) { $def_protect_mag = 150; } else { if ($victims[$i]["power"] >= 100) {
$def_protect_mag = 75; } else { if ($power >= 50) { $def_protect_mag = 50; } else { if ($power >= 25) { $def_protect_mag = 25; } } } } } $protect_mag = $protect_mag + $power * 1.5 + $def_protect_mag; effects($users_id, $effect); if ($hp_now > 0) { $pers_uron = calc_mag($db, "tma_magic"); $uron = $pers_uron + rand($damage_min, $damage_max); $uron = $uron - $protect_fire - ($protect_mag + $effect["add_mg_bron"]) / 4; if ($uron <= 0) { $uron = 3 * $db["level"]; } $uron = ceil($uron); $add_me_hp = ceil($uron / 2); $hp_new = $hp_now - $uron; if ($hp_new <= 0) { $hp_new = 0; $phrase = "<span class=sysdate>{$date}</span> <B>" . $select_target . " убит</B><BR>"; } if ($target_bot != 1) { mysql_query("UPDATE users SET hp='" . $hp_new . "' WHERE login='******'"); } else {