<?php
echo"<script language=JavaScript src='img/js/login_form.js'></script>";
echo"<script language=JavaScript src='img/js/show_inf.js'></script>";
echo"<script language=JavaScript src='img/js/battle.js'></script>";
echo"<div id=mainform style='position:absolute; left:11px; top:30px'></div>";
echo"<div id=hint1 class=hint></div>";
$_RESERVER['battle'] = $stat['battle'];
echo"<script LANGUAGE='JavaScript'>
<!--
var is_view = 0;
var is_user = '$stat[user]';
var offer_date = '".date("H:i",$stat['battle'])."';
var shield=0;
//-->
</SCRIPT>";
//print "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"30; URL=battle.php?refresh=".$_GET['refresh']."&tmp=".time()."\">";
include('includes/battle/modules/battle_function.php');
include('includes/battle/modules/travma_function.php');
if (!empty($use_priem)){
if (!preg_match("/^[0-9]{1,10}$/", $use_priem)) die("Ошибка1");
$qqqq = mysql_query("select wait, name from priem where id='$use_priem'");
if (!$qqqq) die("Ошибка3");
else{
$qq1 = mysql_fetch_array($qqqq);
mysql_query("update participants set priem=$use_priem, wait=$qq1[wait] where time='".$stat['battle']."' AND id='".$stat['id']."' LIMIT 1");
$p_p = mysql_query("select krit, parry, dam, mag from priem where id='$use_priem'");
$pr=mysql_fetch_array($p_p);
$p_krit=round($pr['krit']*10);
$p_mag=round($pr['mag']*10);
$p_parry=round($pr['parry']*10);
$p_hp=round($pr['dam']*10);
mysql_query("update participants set krit=krit-$p_krit, mag=mag-$p_mag, parry=parry-$p_parry, dam=dam-$p_hp where time='".$stat['battle']."' AND id='".$stat['id']."'");
echo"<script>parent.main.location=\"battle.php?tmp=\"+Math.random();\"\"</script>";
}}
include("includes/battle/changed_1.php");
$now=time();
$_RESERVER['battle'] = $stat['battle'];
echo"<script LANGUAGE='JavaScript'>
<!--
var number_of_block=$stat_block;
var number_of_kick=$stat_kick;
//-->
</SCRIPT>";
// ----- # Узнаем, в какой команде, и сколько HP нанесли # ----- //
$participant=mysql_fetch_array(mysql_query("SELECT `hp`, `damage`, `side`, `krit`, `mag`, `parry`, `dam`, `wait`, `priem` FROM participants WHERE time='".$stat['battle']."' AND id='".$stat['id']."' LIMIT 1"));
if ($participant['side'] == "") $participant['side'] = $stat['side'];
switch ($participant['side']) {
case 0: $opp_side=1; break;
case 1: $opp_side=0; break;
}
// ----- # Информация о бое (Из таблицы заявок) # ----- //
$offer=mysql_fetch_array(mysql_query("SELECT `timeout`, `type`, `blood`, `kulak`, `stavka` FROM offers WHERE time='".$stat['battle']."' LIMIT 1"));
$max11=mysql_fetch_array(mysql_query("SELECT MAX(time) AS time FROM battles WHERE offer='".$stat['battle']."'"));
if ($stat['hp_now'] && $participant['hp']) {
if ($kick1!="" && $block1!="" && $opponent!="") {
$user_turn=mysql_fetch_array(
mysql_query(
"select * from battles
where offer=$stat[battle]
and attacker='$stat[user]'
and defender='".addslashes($opponent)."'
and type is NULL"));
if (!$user_turn) {
$opp_stats=mysql_query("SELECT id, user, level, strength, dex, agility, vitality, razum, hp_now, invisible, battle, rank, m_k, m_m, m_t, m_d, elik_time, elik_action, aura, aura_t FROM person WHERE user='".addslashes($opponent)."' LIMIT 1");
$opp_stat=mysql_fetch_array($opp_stats);
if ($opp_stat['hp_now'] == 0)
$opponent = "";
include("includes/battle/changed_opp.php");
$rating=calculate_fight_rating($stat,$opp_stat);
$str1='
[i]По мнению местных криминальных авторитетов шансы на победу [b]'.$stat['user'].'[/b] составляют '.$rating[0].'%, соответственно шансы на победу [b]'.$opp_stat['user'].'[/b] - '.$rating[1].'%[/i]';
if ($participant['wait'] == 1 AND $participant['priem'] != 0){
$id_p = $participant['priem'];
include("includes/battle/priem/$id_p.php");
}
if ($opp_stat['rank'] == 60 && $opponent!="") {
$max=mysql_fetch_array(mysql_query("select max(id) as id from battles where offer='".$stat['battle']."'"));
if (!$max)
$new_id=1;
else
$new_id=$max['id']+1;
$opponent_turn['kick1'] = rand(1,5);
$opponent_turn['block1'] = rand(1,5);
$opponent_turn['block2'] = rand(1,5);
$opponent_turn['id'] = $new_id;
mysql_query(
"insert into battles (offer, time, id, attacker, defender, kick1, block1, block2, side)
values ($stat[battle],$now,$new_id,'".$opp_stat['user']."','$stat[user]','".$opponent_turn['kick1']."','".$opponent_turn['block1']."','".$opponent_turn['block2']."', ".$opp_side.")");
mysql_query("UPDATE `person` SET `lpv` = '".time()."' WHERE `id`='".$opp_stat['id']."'");
}
elseif ($opponent!="")
$opponent_turn=mysql_fetch_array(
mysql_query(
"select * from battles
where offer='".$stat['battle']."'
AND attacker='".addslashes($opponent)."'
AND defender='".$stat[user]."'
AND type is NULL"));
if ($opponent_turn) {
$kick1=round($kick1);
$kick2=round($kick2);
$block1=round($block1);
$block2=round($block2);
$block3=round($block3);
$b1 = array();
$b2 = array();
$b1['1']=$stat['br1'];
$b1['2']=$stat['br2'];
$b1['3']=$stat['br3'];
$b1['4']=$stat['br4'];
$b1['5']=$stat['br5'];
$b2['1']=$opp_stat['br1'];
$b2['2']=$opp_stat['br2'];
$b2['3']=$opp_stat['br3'];
$b2['4']=$opp_stat['br4'];
$b2['5']=$opp_stat['br5'];
if ($priem_id == 3) $priem_krit =100000; else $priem_krit =0;
if ($priem_id == 4) $priem_uvorot =100000; else $priem_uvorot =0;
$i1+=$priem_krit;
$l1+=$priem_uvorot;
$priem_krit =0;
$priem_uvorot =0;
$x = $stat['agility'] + $stat['unuv']/STATS_VS_MOD;
$y = $opp_stat['agility'] + $opp_stat['uv']/STATS_VS_MOD;
if (4*$x <= $y) $pu1 = 1 - 2*$x/(5*$y);
elseif (2*$x <= $y && $y < 4*$x) $pu1 = 1.05 - 0.6*$x/$y;
elseif (4*$x/3 <= $y && $y < 2*$x) $pu1 = 1.75 - 2*$x/$y;
elseif ($x <= $y && $y < 4*$x/3) $pu1 = 0.7 - 0.6*$x/$y;
elseif (2*$x/3 <= $y && $y < $x) $pu1 = 0.28 - 0.18*$x/$y;
elseif ($x/2 <= $y && $y < 2*$x/3) $pu1 = 0.04 - 0.02*$x/$y;
elseif ($y < $x/2) $pu1 = 0;
$x = $opp_stat['dex'] + $opp_stat['unkrit']/STATS_VS_MOD;
$y = $stat['dex'] + $stat['krit']/STATS_VS_MOD;
if (4*$x <= $y) $pi1 = 1 - 2*$x/(5*$y);
elseif (2*$x <= $y && $y < 4*$x) $pi1 = 1.05 - 0.6*$x/$y;
elseif (4*$x/3 <= $y && $y < 2*$x) $pi1 = 1.75 - 2*$x/$y;
elseif ($x <= $y && $y < 4*$x/3) $pi1 = 0.7 - 0.6*$x/$y;
elseif (2*$x/3 <= $y && $y < $x) $pi1 = 0.28 - 0.18*$x/$y;
elseif ($x/2 <= $y && $y < 2*$x/3) $pi1 = 0.04 - 0.02*$x/$y;
elseif ($y < $x/2) $pi1 = 0;
$x = $opp_stat['agility'] + $opp_stat['unuv']/STATS_VS_MOD;
$y = $stat['agility'] + $stat['uv']/STATS_VS_MOD;
if (4*$x <= $y) $pu2 = 1 - 2*$x/(5*$y);
elseif (2*$x <= $y && $y < 4*$x) $pu2 = 1.05 - 0.6*$x/$y;
elseif (4*$x/3 <= $y && $y < 2*$x) $pu2 = 1.75 - 2*$x/$y;
elseif ($x <= $y && $y < 4*$x/3) $pu2 = 0.7 - 0.6*$x/$y;
elseif (2*$x/3 <= $y && $y < $x) $pu2 = 0.28 - 0.18*$x/$y;
elseif ($x/2 <= $y && $y < 2*$x/3) $pu2 = 0.04 - 0.02*$x/$y;
elseif ($y < $x/2) $pu2 = 0;
$x = $stat['dex'] + $stat['unkrit']/STATS_VS_MOD;
$y = $opp_stat['dex'] + $opp_stat['krit']/STATS_VS_MOD;
if (4*$x <= $y) $pi2 = 1 - 2*$x/(5*$y);
elseif (2*$x <= $y && $y < 4*$x) $pi2 = 1.05 - 0.6*$x/$y;
elseif (4*$x/3 <= $y && $y < 2*$x) $pi2 = 1.75 - 2*$x/$y;
elseif ($x <= $y && $y < 4*$x/3) $pi2 = 0.7 - 0.6*$x/$y;
elseif (2*$x/3 <= $y && $y < $x) $pi2 = 0.28 - 0.18*$x/$y;
elseif ($x/2 <= $y && $y < 2*$x/3) $pi2 = 0.04 - 0.02*$x/$y;
elseif ($y < $x/2) $pi2 = 0;
$uron_attacker_1=0;
$uron_attacker_2=0;
$uron_attacker=0;
$uron_defender_1=0;
$uron_defender_2=0;
$uron_defender=0;
$a1=mt_rand(0,PRECESSION)/PRECESSION;
$a2=mt_rand(0,PRECESSION)/PRECESSION;
# случайное число на (0,1), показывающее, сработал ли уворот в данном случае.
$rb1=mt_rand(0,PRECESSION)/PRECESSION;
$rb2=mt_rand(0,PRECESSION)/PRECESSION;
# случайное число на (0,1), показывающее, сработал ли крит в данном случае.
if($pu1>$a1) { // уворот 1
$uron_attacker_1=0;
$uron_attacker_2=0;
$uron_attacker=0;
$action_attacker=uvorot;
}elseif ($pi1>$rb1) { // крит 1
$uron_attacker=(int)rand(1.5*$stat['strength']+2*$stat['min'], 2*$stat['strength']+2*$stat['max']);
$uron_attacker=ceil($uron_attacker*(1+($p_har['sp_3']/100)));
$uron_attacker=ceil($uron_attacker*(1-($po_har['sp_14']/100)));
$action_attacker=krit;
}else{
if($kick1==$opponent_turn['block1'] or $kick1==$opponent_turn['block2'] or $kick1==$opponent_turn['block3']) {
$uron_attacker_1=0;
$action_attacker_1=block1;
}else{
$uron_attacker_1=(int)rand(0.75*$stat['strength']+$stat['min']-$b2[$kick1], $stat['strength']+$stat['max']-0.5*$b2[$kick1]);
if($uron_attacker_1<0) $uron_attacker_1=0;
$action_attacker_1=udar;
}
if ($stat_obj_t2['tip'] == 1){
if($kick2==$opponent_turn['block1'] or $kick2==$opponent_turn['block2'] or $kick2==$opponent_turn['block3']) {
$uron_attacker_2=0;
$action_attacker_2=block2;
}else{
$uron_attacker_2=(int)rand(0.5*$stat['strength']+$stat['min']-$b2[$kick2], 0.75*($stat['strength']+$stat['max']-0.5*$b2[$kick2]));
if($uron_attacker_2<0) $uron_attacker_2=0;
$action_attacker_2=udar;
}}
}
if($pu2>$a2) { // уворот 2
$uron_defender_1=0;
$uron_defender_2=0;
$uron_defender=0;
$action_defender=uvorot;
}elseif ($pi2>$rb2) { // крит 2
$uron_defender=(int)rand(1.5*$opp_stat['strength']+2*$opp_stat['min'], 2*$opp_stat['strength']+2*$opp_stat['max']);
$uron_defender=ceil($uron_defender*(1+($po_har['sp_3']/100)));
$uron_defender=ceil($uron_defender*(1-($p_har['sp_3']/100)));
$action_defender=krit;
}else{
if($opponent_turn['kick1']==$block1 or $opponent_turn['kick1']==$block2 or $opponent_turn['kick1']==$block3) {
$uron_defender_1=0;
$action_defender_1=block1;
}else{
$uron_defender_1=(int)rand(0.75*$opp_stat['strength']+$opp_stat['min']-$b1[$opponent_turn['kick1']], $opp_stat['strength']+$opp_stat['max']-0.5*$b1[$opponent_turn['kick1']]);
if($uron_defender_1<0) $uron_defender_1=0;
$action_defender_1=udar;
}
if ($ostat_obj_t2['tip'] == 1){
if($opponent_turn['kick2']==$block1 or $opponent_turn['kick2']==$block2 or $opponent_turn['kick2']==$block3) {
$uron_defender_2=0;
$action_defender_2=block2;
}else{
$uron_defender_2=(int)rand(0.5*$opp_stat['strength']+$opp_stat['min']-$b1[$opponent_turn['kick2']], 0.75*($opp_stat['strength']+$opp_stat['max']-0.5*$b1[$opponent_turn['kick2']]));
if($uron_defender_2<0) $uron_defender_2=0;
$action_defender_2=udar;
}}
}
$damage[0] = $uron_attacker + $uron_attacker_1 + $uron_attacker_2;
$damage[1] = $uron_defender + $uron_defender_1 + $uron_defender_2;
if($action_attacker == krit) mysql_query("UPDATE person, participants SET participants.krit=participants.krit+".$pi1." WHERE person.id='".$stat['id']."' AND participants.time='".$stat['battle']."' AND participants.id='".$stat['id']."'");
if($action_defender == krit) mysql_query("UPDATE person, participants SET participants.krit=participants.krit+".$pi2." WHERE person.id='".$opp_stat['id']."' AND participants.time='".$opp_stat['battle']."' AND participants.id='".$opp_stat['id']."'");
if($action_defender == uvorot) mysql_query("UPDATE person, participants SET participants.parry=participants.parry+".$pu1." WHERE person.id='".$stat['id']."' AND participants.time='".$stat['battle']."' AND participants.id='".$stat['id']."'");
if($action_attacker == uvorot) mysql_query("UPDATE person, participants SET participants.parry=participants.parry+".$pu2." WHERE person.id='".$opp_stat['id']."' AND participants.time='".$opp_stat['battle']."' AND participants.id='".$opp_stat['id']."'");
$damage[0]+=$priem_dam;
// ----- # Отнимаем жизни # ----- /
mysql_query("UPDATE person, participants SET person.hp_now=if(person.hp_now<$damage[1],0,person.hp_now-$damage[1]), participants.hp=if(participants.hp<$damage[1],0,participants.hp-$damage[1]), participants.damage=participants.damage+".$damage['0'].", participants.dam=participants.dam+".$damage['0']." WHERE person.id='".$stat['id']."' AND participants.time='".$stat['battle']."' AND participants.id='".$stat['id']."'");
mysql_query("UPDATE person, participants SET person.hp_now=if(person.hp_now<$damage[0],0,person.hp_now-$damage[0]), participants.hp=if(participants.hp<$damage[0],0,participants.hp-$damage[0]), participants.damage=participants.damage+".$damage['1']." WHERE person.id='".$opp_stat['id']."' AND participants.time='".$stat['battle']."' AND participants.id='".$opp_stat['id']."'");
$participant['dam']+=$damage[0];
$participant['damage'] += $damage['0'];
if ($participant['wait'] >0) {
mysql_query("update participants set wait=wait-1 where time='".$stat['battle']."' AND id='".$stat['id']."'");
$participant['wait'] -=1;
}
// HP
if($stat['hp_now'] > $damage['1']) $stat['hp_now']-=$damage['1'];
else $stat['hp_now']=0;
if ($opp_stat['hp_now']<$damage[0]) $comhp_0=0; else $comhp_0=$opp_stat['hp_now']-$damage[0];
$comhp_1=$stat['hp_now'];
//
if($action_attacker == krit) $comment['0'] = rand(21, 23);
elseif($action_attacker == uvorot) $comment['0'] = rand(31, 33);
elseif ($action_attacker_1==block1 && $action_attacker_2!=udar) $comment['0'] = rand(11, 20);
//elseif ($damage[0] == 0) $comment['0'] = rand(11, 20);
elseif ($action_attacker_1==udar && $action_attacker_2!=block2) $comment['0'] = rand(1, 4);
elseif ($action_attacker_1==udar && $action_attacker_2==block2) $comment['0'] = rand(5, 7);
elseif ($action_attacker_1==block1 && $action_attacker_2==udar) $comment['0'] = rand(8, 10);
if($action_defender == krit) $comment['1'] = rand(21, 23);
elseif($action_defender == uvorot) $comment['1'] = rand(31, 33);
elseif ($action_defender_1==block1 && $action_defender_2!=udar) $comment['1'] = rand(11, 20);
//elseif ($damage[1] == 0) $comment['1'] = rand(11, 20);
elseif ($action_defender_1==udar && $action_defender_2!=block2) $comment['1'] = rand(1, 4);
elseif ($action_defender_1==udar && $action_defender_2==block2) $comment['1'] = rand(5, 7);
elseif ($action_defender_1==block1 && $action_defender_2==udar) $comment['1'] = rand(8, 10);
$max=mysql_fetch_array(mysql_query("select max(id) as id from battles where offer='".$stat['battle']."'"));
if (!$max)
$new_id=1;
else
$new_id=$max['id']+1;
mysql_query("UPDATE battles SET type=1, damage=$damage[1], comment='".$comment['1']."',id=$new_id WHERE offer='".$stat['battle']."' AND id='".$opponent_turn['id']."'");
mysql_query(
"insert into battles (offer, time, id, attacker, defender, kick1, kick2, block1, block2, block3, type, damage, comment, side)
values ($stat[battle], $now, $new_id, '$stat[user]', '$opponent', $kick1, $kick2, $block1, $block2, $block3, 1, $damage[0], '$comment[0]', ".$participant['side'].")");
if ($comhp_0 <= 0) {
//if ($opp_stat['rank'] != 60 && $opponent)
mysql_query("DELETE FROM battles WHERE offer=".$stat['battle']." AND defender='".$opp_stat['user']."' AND type IS NULL");
$max=mysql_fetch_array(mysql_query("SELECT MAX(id) as id FROM battles WHERE offer='".$stat['battle']."'"));
$max['id']+=1;
mysql_query("INSERT INTO battles (offer, time, id, attacker, defender, type, damage, comment, side) VALUES ($stat[battle], $now, '$max[id]', '$opp_stat[user]', '', NULL, '', '70',$opp_side)");
}
elseif ($comhp_1 <= 0 && $participant['hp'] <= 0) {
//if ($opp_stat['rank'] != 60 && $opponent)
calculate_kick_power($stat, $damage[1], $stat['hp_max'], $opp_stat, $damage[0], $opp_stat['hp_max']);
mysql_query("DELETE FROM battles WHERE offer=".$stat['battle']." AND defender='".$stat['user']."' AND type IS NULL");
$max=mysql_fetch_array(mysql_query("SELECT MAX(id) as id FROM battles WHERE offer=".$stat['battle'].""));
$max['id']+=1;
mysql_query("INSERT INTO battles (offer, time, id, attacker, defender, type, damage, comment, side) VALUES ($stat[battle], ".$now.", '$max[id]', '$stat[user]', '', NULL, '', '70',".$participant['side'].")");
}
} else {
$max=mysql_fetch_array(mysql_query("select max(id) as id from battles where offer='".$stat['battle']."'"));
if (!$max)
$new_id=1;
else
$new_id=$max['id']+1;
mysql_query(
"insert into battles (offer, time, id, attacker, defender, kick1, kick2, block1, block2, block3, side)
values ($stat[battle],$now,$new_id,'$stat[user]','".addslashes($opponent)."',".addslashes($kick1).",".addslashes($kick2).",".addslashes($block1).",".addslashes($block2).",".addslashes($block3).", ".$participant['side'].")");
}
}
}
}
include('includes/battle/functions.php');
include('person/func/alt.php');
// ----- # HP равно нулю, проигрываем, выигрываем, или ждём окончания боя # ----- //
if ($stat['hp_now'] <= 0 || $participant['hp'] <= 0) {
$user_command=mysql_fetch_array(
mysql_query(
"select count(*) as count from participants, person
where person.id=participants.id
and participants.hp>0
and person.hp_now>0
and participants.time=".$stat['battle']."
and participants.side=".$participant['side'].""));
$user_opponent_command=mysql_fetch_array(
mysql_query(
"select count(*) as count from participants, person
where person.id=participants.id
and participants.hp>0
and person.hp_now>0
and participants.time=".$stat['battle']."
and participants.side=".$opp_side.""));
// ----- # НИЧЬЯ # ----- //
if (($user_command['count'] == 0 && $user_opponent_command['count'] == 0) && !$endbattle) {
$echo="<center>[b]Бой закончен. Ничья.[/b]
<input type=button value=' Вернуться ' onclick='window.location.href=\"main.php?tmp=\"+Math.random();\"\"' class=standbut></center>
";
mysql_query("UPDATE person SET last_battle=".$_RESERVER['battle']." WHERE battle='".$stat['battle']."'");
mysql_query("UPDATE participants SET hp=0 WHERE time='".$stat['battle']."'");
mysql_query("UPDATE person SET drawn=drawn+1, battle=NULL WHERE id='".$stat['id']."'");
mysql_query("UPDATE participants SET live=1 WHERE time='".$stat['battle']."' AND id='".$stat['id']."'");
require_once("function/chat_insert.php");
insert_msg ("К сожалению бой закончился ничьёй. Попытайтесь снова. Всего Вами нанесено урона: [b][u]".$participant['damage']." HP[/u][/b].","","","1",$stat['user'],"",$stat['room']);
aktivnost();
$masseg = iznos();
if ($masseg) insert_msg ($masseg,"","","1",$stat['user'],"",$stat['room']);
$endbattle = 1;
$stat['battle'] = '';
}
// ----- # ПРОИГРЫШ КОМАНДЫ # ----- //
elseif (($user_command['count'] == 0 && $user_opponent_command['count'] > 0) && !$endbattle) {
$echo="<center>[b]Бой закончен. Вы проиграли.[/b]
<input type=button value=' Вернуться ' onclick='window.location.href=\"main.php?tmp=\"+Math.random();\"\"' class=standbut></center>
";
mysql_query("UPDATE person SET last_battle=".$_RESERVER['battle']." WHERE battle='".$stat['battle']."' AND side='".$opp_side."'");
mysql_query("UPDATE person SET losses=losses+1, battle=NULL WHERE id='".$stat['id']."'");
mysql_query("UPDATE participants SET live=1 WHERE time='".$stat['battle']."' AND id='".$stat['id']."'");
require_once("function/chat_insert.php");
insert_msg ("Бой закончен, Вы проиграли. Всего Вами нанесено урона: [b][u]".$participant['damage']." HP[/u][/b].","","","1",$stat['user'],"",$stat['room']);
if ($stat['bs'] == 1) {
mysql_query("UPDATE bs set t=0 where user='$stat[user]' AND t='1'");
mysql_query("UPDATE person SET bs = 0 WHERE id='".$stat['id']."'");
mysql_query("DELETE FROM objects WHERE user='".$stat['user']."' AND bs = 1");
mysql_query("UPDATE slots set slots.1=0, slots.2=0, slots.3=0, slots.4=0, slots.5=0, slots.6=0, slots.7=0, slots.8=0, slots.9=0, slots.10=0, slots.11=0, slots.12=0, slots.13=0, slots.14=0, slots.15=0, slots.16=0, slots.17=0, slots.18=0, slots.19=0, slots.20=0, slots.21=0, slots.22=0 WHERE id = '".$stat[id]."'");
insert_msg ("Вы погибли в турнире, вас автоматичеки исключают из турнира.","","","1",$stat['user'],"",$stat['room']);
}
aktivnost();
$masseg = iznos();
$ae = -1;
battle_upd();
if ($masseg) insert_msg ($masseg,"","","1",$stat['user'],"",$stat['room']);
if ($offer['blood'] == 1) mysql_query("UPDATE person SET travma=$now+10800 WHERE id='".$stat['id']."'");
if ($offer['type'] == 4) {
if ($offer['stavka'] > 0) $stvs=mysql_query("Update person set credits=credits-".$offer[stavka]." where id='".$stat[id]."'");
require_once("function/chat_insert.php");
if ($stvs) insert_msg ("Бой закончен, Вы проиграли. Вы теряете свои деньги.","","","1",$stat['user'],"",$stat['room']);
}
$endbattle = 1;
$stat['battle'] = '';
}
// ----- # ПОБЕДА КОМАНДЫ # ----- //
elseif (($user_command['count'] > 0 && $user_opponent_command['count'] == 0) && !$endbattle) {
$echo="<center>[b]Поздравляем, Вы одержали победу![/b]
<input type=button value=' Вернуться ' onclick='window.location.href=\"main.php?tmp=\"+Math.random();\"\"' class=standbut></center>
";
mysql_query("UPDATE person SET last_battle=".$_RESERVER['battle']." WHERE battle='".$stat['battle']."'");
mysql_query("UPDATE participants SET hp=0 WHERE time='".$stat['battle']."' AND side='".$opp_side."'");
get_exp();
level_up();
aktivnost();
$ae = 1;
battle_upd();
require_once("function/chat_insert.php");
insert_msg("Поздравляем, Вы одержали победу! Всего Вами нанесено урона: [b][u]".$participant['damage']." HP[/u][/b]. Получено опыта: [b][u]".$addexp."[/u][/b].","","","1",$stat['user'],"",$stat['room']);
$endbattle = 1;
$stat['battle'] = '';
}
// ----- # ЖДЁМ ОКОНЧАНИЯ БОЯ # ----- //
elseif ($user_command['count'] > 0 && $user_opponent_command['count'] > 0) {
$echo="<center>[b]К сожалению, для Вас бой окончен. Ожидайте окончания боя...[/b]
<input type=button value=' Обновить ' name=ref onclick='ref.disabled = true; window.location.href=\"battle.php?tmp=\"+Math.random();\"\"' class=standbut></center>
";
}
} else {
$opponents=mysql_query(
"select person.id,person.user from participants, person
where person.id=participants.id
and participants.hp>0
and person.hp_now>0
and participants.live=0
and participants.time=".$stat['battle']."
and participants.side=".$opp_side."");
if ($opponents && mysql_num_rows($opponents)) {
$victims=array();
while ($opponent=mysql_fetch_array($opponents)) {
$user_turn=mysql_fetch_array(
mysql_query(
"select * from battles
where offer=$stat[battle]
and attacker='$stat[user]'
and defender='$opponent[user]'
and type is NULL"));
if (!$user_turn)
$victims[] = $opponent[user];
}
$count_opponents=count($victims);
if (!$count_opponents) {
$max=mysql_fetch_array(mysql_query("SELECT MAX(time) AS time FROM battles WHERE offer='".$stat['battle']."'"));
$timeout=$offer['timeout']-($now-$max['time']);
// ----- # Выиграли по таймауту # ----- //
if (($now-$max['time']>$offer['timeout']) && !$endbattle) {
$echo="<center>[b]Поздравляем! Вы получаете победу по таймауту![/b]
<input type=button value=' Вернуться ' onclick='window.location.href=\"main.php?tmp=\"+Math.random();\"\"' class=standbut></center>
";
mysql_query("UPDATE person, participants SET person.hp_now=0, person.last_battle=".$_RESERVER['battle'].", participants.hp=0 WHERE participants.time='".$stat['battle']."' AND participants.side='".$opp_side."' AND person.id=participants.id");
mysql_query("UPDATE offers SET status=0 WHERE time='".$stat['battle']."'");
get_exp();
level_up();
aktivnost();
require_once("function/chat_insert.php");
insert_msg("Поздравляем, Вы одержали победу! Всего Вами нанесено урона: [b][u]".$participant['damage']." HP[/u][/b]. Получено опыта: [b][u]".$addexp."[/u][/b].","","","1",$stat['user'],"",$stat['room']);
$endbattle = 1;
$stat['battle'] = '';
// ----- # Конец # ----- //
} else{
$a123=array('Ожидаем хода противника','Ща ответят','Ждемс','Еще немного','Жахнет Гендальф или нет?','ЩАс все будет','Еще немного подождем','Противник явно маринует','Сейчас долбанет','Блин ну когда же','Ахтунг в тапках','Только бы никто не вмешался','Перекур','Таймаут был близок','Ждем-недождемся','Ща ведь ударит, зараза','Кто-то щас кританет','Ау блин слоники??','Заснули там??','Эй там, на берегу!','Давай мочи зараза!','Рубись!!!','И долго еще так сидеть?','А ответить?');
$r123=rand(0,count($a123)-1);
$message=$a123[$r123];
$echo="<center>[b]".$message."[/b]
<input type=button name=ref value=' Обновить ' onclick='ref.disabled = true; window.location.href=\"battle.php?tmp=\"+Math.random();\"\"' class=standbut></center>
";}
} else {
$random=0; // rand(0,$count_opponents-1);
$max_=mysql_fetch_array(mysql_query("SELECT MAX(time) AS time FROM battles WHERE offer='".$stat['battle']."' LIMIT 1"));
$timeout=$offer['timeout']-($now-$max_['time']);
// ----- # Пройгрыш по таймауту # ----- //
if ($timeout<=0 && $max_['time']!=''){
$echo="<center>[b]Бой закончен. Вы проиграли по таймауту![/b]
<input type=button value=' Вернуться ' onclick='window.location.href=\"main.php?tmp=\"+Math.random();\"\"' class=standbut></center>
";
mysql_query("UPDATE person SET last_battle=".$_RESERVER['battle']." WHERE battle='".$stat['battle']."' AND side='".$opp_side."'");
mysql_query("UPDATE person SET losses=losses+1, battle=NULL, hp_now=0 WHERE id='".$stat['id']."'");
mysql_query("UPDATE participants SET live=1 WHERE time='".$stat['battle']."' AND id='".$stat['id']."'");
require_once("function/chat_insert.php");
insert_msg ("Бой закончен, Вы проиграли по таймауту! Всего Вами нанесено урона: [b][u]".$participant['damage']." HP[/u][/b].","","","1",$stat['user'],"",$stat['room']);
if ($stat['bs'] == 1) {
mysql_query("UPDATE bs set t=0 where user='$stat[user]' AND t='1'");
mysql_query("UPDATE person SET bs = 0 WHERE id='".$stat['id']."'");
mysql_query("DELETE FROM objects WHERE user='".$stat['user']."' AND bs = 1");
mysql_query("UPDATE slots set slots.1=0, slots.2=0, slots.3=0, slots.4=0, slots.5=0, slots.6=0, slots.7=0, slots.8=0, slots.9=0, slots.10=0, slots.11=0, slots.12=0, slots.13=0, slots.14=0, slots.15=0, slots.16=0, slots.17=0, slots.18=0, slots.19=0, slots.20=0, slots.21=0, slots.22=0 WHERE id = '".$stat[id]."'");
insert_msg ("Вы погибли в турнире, вас автоматичеки исключают из турнира.","","","1",$stat['user'],"",$stat['room']);
}
$masseg = iznos();
if ($masseg) insert_msg ($masseg,"","","1",$stat['user'],"",$stat['room']);
if ($offer['blood'] == 1) mysql_query("UPDATE person SET travma=$now+10800 WHERE id='".$stat['id']."'");
$endbattle = 1;
$stat['battle'] = '';
}
// ----- # Конец # ----- //
if ($timeout>0 || $max_['time']==''){
$echo="<form method=POST action=battle.php?page=battle>";
$echo.="<input type=hidden name=opponent value='$victims[$random]'>";
?>
<?
$p_krit=round($participant['krit']/10);
$p_mag=round($participant['mag']/10);
$p_parry=round($participant['parry']/10);
$p_hp=round($participant['dam']/10);
$SL_P = mysql_fetch_array(mysql_query("select * from slots_priem where id = $stat[id]"));
for ($i=1; $i<6; $i++) {
$SL_PP = mysql_fetch_array(mysql_query("select * from priem where id = $SL_P[$i]"));
if ($SL_PP){
if ($p_krit < $SL_PP[krit] || $p_mag < $SL_PP[mag] || $p_parry < $SL_PP[parry] || $p_hp < $SL_PP[dam] || $participant['wait'] > 0) {
$priem_[$i]="<IMG style=\"\" width=40 height=25 src='img/battle/priem/$SL_PP[id]n.gif' onmouseover=\"hint('<table width=100% cellspacing=0 cellpadding=0 border=0 bgcolor=#000000><tr><td bgcolor=#F6E3B1><font color=blue>[b]$SL_PP[name]</td></tr><tr><td bgcolor=#ffffff><font color=red size=1>Мин. треб:
</font><font size=1>Крит: $SL_PP[krit]
Парирование: $SL_PP[parry]
Урон: $SL_PP[dam]
Магия: $SL_PP[mag]
</font><font color=red size=1>Описание:
</font><font size=1>$SL_PP[about]</font>[/b]</td></tr></table>');\" onmouseout=\"c();\">";}
else{
$priem_[$i]="<IMG style=\"\" style='CURSOR: HAND;' width=40 height=25 src='img/battle/priem/$SL_PP[id].gif' alt='Нажмите для использования' onmouseover=\"hint('<table width=100% cellspacing=0 cellpadding=0 border=0 bgcolor=#000000><tr><td bgcolor=#F6E3B1><font color=blue>[b]$SL_PP[name]</td></tr><tr><td bgcolor=#ffffff><font color=red size=1>Мин. треб:
</font><font size=1>Крит: $SL_PP[krit]
Парирование: $SL_PP[parry]
Урон: $SL_PP[dam]
Магия: $SL_PP[mag]
</font><font color=red size=1>Описание:
</font><font size=1>$SL_PP[about]</font>[/b]</td></tr></table>');\" onmouseout=\"c();\" onclick='window.location.href=\"?use_priem=$SL_PP[id]&use_slot=$i&tmp=\"+Math.random();\"\"'>";}
}else{
$priem_[$i]="<IMG style=\"\" width=40 height=25 src='img/battle/priem/clear.gif' alt='Пустой слот приёма'>";}
}
if($_POST['auto_go']) $_SESSION['auto_go']='on';
if($_SESSION['auto_go']) $check_auto=" checked disabled";
?>
<script language="JavaScript">
function auto_go_check() {
frm=window.document.forms[0];
zk1=false;
zk2=false;
zb1=false;
zb2=false;
zb3=false;
if("<?$_SESSION['auto_go']?>"!='' || frm.auto_go.checked) {
for(i=0;i<frm.kick1.length;i++)
if(frm.kick1[i].checked) zk1=true;
for(i=0;i<frm.kick2.length;i++)
if(frm.kick2[i].checked) zk2=true;
for(i=0;i<frm.block1.length;i++)
if(frm.block1[i].checked) zb1=true;
for(i=0;i<frm.block2.length;i++)
if(frm.block2[i].checked) zb2=true;
for(i=0;i<frm.block3.length;i++)
if(frm.block3[i].checked) zb3=true;
if (number_of_kick == 2){
if(zk1 && zk2 && zb1 && zb2) {
frm.fight.disabled='true';
frm.submit();
} else frm.fight.disabled='false';
}
if (number_of_block == 3){
if(zk1 && zk2 && zb1 && zb2) {
frm.fight.disabled='true';
frm.submit();
} else frm.fight.disabled='false';
}
if (number_of_kick == 1 && number_of_block == 2){
if(zk1 && zb1 && zb2) {
frm.fight.disabled='true';
frm.submit();
} else frm.fight.disabled='false';
}
}
}
</script>
<?
$form="
<center>
<table width=350 align=center border=0 cellspacing=0 cellpadding=5 bordercolor=A5A5A5>
<tr>
<td width=50% align=center style='BORDER-RIGHT: 1px solid; BORDER-BOTTOM: 1px solid'>
[b]Атака[/b]</td>
<td align=center style='BORDER-BOTTOM: 1px solid'>
[b]Защита[/b]</td></tr>
<tr>
<td valign=center style='BORDER-RIGHT: 1px solid' align=center>
<table width=100% border=0 cellspacing=0 cellpadding=0>
<tr>";
if ($stat_obj_t2['tip'] == 1){
$form.="<td>
<table width=100% cellpadding=0 cellspacing=0 border=0>
<tr><td width=20><input type=checkbox name=kick2 value=1 onclick='auto_go_check(); testshot()'></td></tr>
<tr><td width=20><input type=checkbox name=kick2 value=2 onclick='auto_go_check(); testshot()'></td></tr>
<tr><td width=20><input type=checkbox name=kick2 value=3 onclick='auto_go_check(); testshot()'></td></tr>
<tr><td width=20><input type=checkbox name=kick2 value=4 onclick='auto_go_check(); testshot()'></td></tr>
<tr><td width=20><input type=checkbox name=kick2 value=5 onclick='auto_go_check(); testshot()'></td></tr>
</table>
</td>";}else
$form.="<td>
<table width=100% cellpadding=0 cellspacing=0 border=0>
<tr><td width=20><input type=hidden name=kick2 value=0 onclick='auto_go_check(); testshot()'></td></tr>
<tr><td width=20><input type=hidden name=kick2 value=0 onclick='auto_go_check(); testshot()'></td></tr>
<tr><td width=20><input type=hidden name=kick2 value=0 onclick='auto_go_check(); testshot()'></td></tr>
<tr><td width=20><input type=hidden name=kick2 value=0 onclick='auto_go_check(); testshot()'></td></tr>
<tr><td width=20><input type=hidden name=kick2 value=0 onclick='auto_go_check(); testshot()'></td></tr>
</table>
</td>";
$form.="<td align=left width=100%>
<table width=100% cellpadding=0 cellspacing=0 border=0>
<tr><td width=20><input type=checkbox name=kick1 value=1 onclick='auto_go_check(); testshot()'></td><td valign=center><label class=ch> Удар в голову</label></td></tr>
<tr><td width=20><input type=checkbox name=kick1 value=2 onclick='auto_go_check(); testshot()'></td><td valign=center><label class=ch> Удар в грудь</label></td></tr>
<tr><td width=20><input type=checkbox name=kick1 value=3 onclick='auto_go_check(); testshot()'></td><td valign=center><label class=ch> Удар в живот</label></td></tr>
<tr><td width=20><input type=checkbox name=kick1 value=4 onclick='auto_go_check(); testshot()'></td><td valign=center><label class=ch> Удар в пах</label></td></tr>
<tr><td width=20><input type=checkbox name=kick1 value=5 onclick='auto_go_check(); testshot()'></td><td valign=center><label class=ch> Удар в ноги</label></td></tr>
</table>
</td>
</tr>
</table>
</td>
<td valign=center ALIGN=CENTER>
<table width=100% border=0 cellspacing=0 cellpadding=0>
<tr>";
if ($stat_obj_t2['tip'] == 5){
$form.="<td>
<table width=10 cellpadding=0 cellspacing=0 border=0>
<tr><td><input type=checkbox name=block3 value=1 onclick='auto_go_check(); testblock()'></td></tr>
<tr><td><input type=checkbox name=block3 value=2 onclick='auto_go_check(); testblock()'></td></tr>
<tr><td><input type=checkbox name=block3 value=3 onclick='auto_go_check(); testblock()'></td></tr>
<tr><td><input type=checkbox name=block3 value=4 onclick='auto_go_check(); testblock()'></td></tr>
<tr><td><input type=checkbox name=block3 value=5 onclick='auto_go_check(); testblock()'></td></tr>
</table>
</td>";}else
$form.="<td>
<table width=10 cellpadding=0 cellspacing=0 border=0>
<tr><td><input type=hidden name=block3 value=0 onclick='auto_go_check(); testblock()'></td></tr>
<tr><td><input type=hidden name=block3 value=0 onclick='auto_go_check(); testblock()'></td></tr>
<tr><td><input type=hidden name=block3 value=0 onclick='auto_go_check(); testblock()'></td></tr>
<tr><td><input type=hidden name=block3 value=0 onclick='auto_go_check(); testblock()'></td></tr>
<tr><td><input type=hidden name=block3 value=0 onclick='auto_go_check(); testblock()'></td></tr>
</table>
</td>";
$form.="<td>
<table width=10 cellpadding=0 cellspacing=0 border=0>
<tr><td><input type=checkbox name=block1 value=1 onclick='auto_go_check(); testblock()'></td></tr>
<tr><td><input type=checkbox name=block1 value=2 onclick='auto_go_check(); testblock()'></td></tr>
<tr><td><input type=checkbox name=block1 value=3 onclick='auto_go_check(); testblock()'></td></tr>
<tr><td><input type=checkbox name=block1 value=4 onclick='auto_go_check(); testblock()'></td></tr>
<tr><td><input type=checkbox name=block1 value=5 onclick='auto_go_check(); testblock()'></td></tr>
</table></td>
<td align=left width=100%>
<table width=100% cellpadding=0 cellspacing=0 border=0>
<tr><td width=20><input type=checkbox name=block2 value=1 onclick='auto_go_check(); testblock()'></td><td valign=center><label class=ch> Голова</label></td></tr>
<tr><td width=20><input type=checkbox name=block2 value=2 onclick='auto_go_check(); testblock()'></td><td valign=center><label class=ch> Грудь</label></td></tr>
<tr><td width=20><input type=checkbox name=block2 value=3 onclick='auto_go_check(); testblock()'></td><td valign=center><label class=ch> Живот</label></td></tr>
<tr><td width=20><input type=checkbox name=block2 value=4 onclick='auto_go_check(); testblock()'></td><td valign=center><label class=ch> Пояс<label></td></tr>
<tr><td width=20><input type=checkbox name=block2 value=5 onclick='auto_go_check(); testblock()'></td><td valign=center><label class=ch> Ноги</label></td></tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align=center style='BORDER-TOP: 1px solid; BORDER-RIGHT: 1px solid'><input type=button value=' Ударить ' class=standbut name=fight onClick=\"gofight(this)\"></td>
<td align=center style='BORDER-TOP: 1px solid;'><input type=button name=ref value=' Обновить ' onclick='ref.disabled = true; window.location.href=\"battle.php?tmp=\"+Math.random();\"\"' class=standbut></td>
</tr>
<tr><td colspan=2 align=center>
<input type='checkbox' name='auto_go' $check_auto onclick=''> - автоматический ход, если выбран удар и блок
</td></tr>
<tr><td colspan=2 align=center>
<script>
DrawRes( ".(0+$p_krit).", ".(0+$p_parry).", ".(0+$p_hp).",".(0+$p_mag).");
</script>
</td></tr>
<tr><td colspan=2 align=center>
$priem_[1]$priem_[2]$priem_[3]$priem_[4]$priem_[5]
</td></tr>
<tr><td colspan=2 align=center>
$str1
</td></tr>
</table>
</center>
</form>";
}
?>
<?php
}
} else {
// ----- # Выигрыш # ----- //
if (!$endbattle) {
$echo="<center>[b]Поздравляем! Победа за Вами![/b]
<input type=button value=' Вернуться ' onclick='window.location.href=\"main.php?tmp=\"+Math.random();\"\"' class=standbut></center>
";
mysql_query("UPDATE person SET last_battle=".$_RESERVER['battle']." WHERE battle='".$stat['battle']."' AND side='".$opp_side."'");
mysql_query("UPDATE participants SET hp=0 WHERE time='".$stat['battle']."' AND side='".$opp_side."'");
if ($offer[stavka] > 0) $stv=mysql_query("Update person set credits=credits+'".$offer[stavka]."' where id='".$stat[id]."'");
get_exp();
level_up();
aktivnost();
$ae = 1;
battle_upd();
if ($stat['tribe']){
$dam = mysql_fetch_array(mysql_query("SELECT damage FROM participants WHERE time='".$stat['battle']."' AND id='".$stat['id']."'"));
$add1 = round($dam[damage]/2);
$add2 = round($dam[damage]*1.5);
$addpoints = rand($add1, $add2);
$SS = mysql_query("UPDATE tribes SET points=points+$addpoints WHERE name='".$stat['tribe']."' ");
}
if ($opp_stat['rank']==60){
mysql_query("update person set credits=credits+0.2 where id='".$stat['id']."'");
$addmoney = 0.2;
}else{
if ($stat['room'] == 1) $addmoney = 0.5*($opp_stat['level'] + 1); else $addmoney = 0.1;
mysql_query("update person set credits=credits+$addmoney where id='".$stat['id']."'");
}
require_once("function/chat_insert.php");
insert_msg("Поздравляем, Вы одержали победу! Всего Вами нанесено урона: [b][u]".$participant['damage']." HP[/u][/b]. Получено опыта: [b][u]".$addexp."[/u][/b]. Получена награда: [b][u]".$addmoney." кр.[/u][/b].","","","1",$stat['user'],"",$stat['room']);
if ($SS) insert_msg ("Вы заработали для клана ".$addpoints." очков рейтинга.","","","1",$stat['user'],"",$stat['room']);
if ($stv) insert_msg ("Вы получаете деньги ($offer[stavka]) со ставки.","","","1",$stat['user'],"",$stat['room']);
$endbattle = 1;
$stat['battle'] = '';
}
// ----- # Конец # ----- //
}
}
include("includes/magic/use.php");
include("includes/magic/abils/use2.php");
include("includes/battle/left.php");
if (!empty($nms)) echo"<center><font color=red>[b]$nms[/b]</font></center>";
echo"$echo$form";
if (!$endbattle) {
// Построение комманд
$_comm=mysql_query("select
participants.side, participants.hp as hp, person.level as lvl, person.user as `user` from participants, person where
person.id=participants.id
and participants.hp>0
and person.hp_now>0
and participants.time=".$stat['battle']." ORDER BY person.level DESC");
for ($i=0; $i<mysql_numrows($_comm); $i++) {
$comm=mysql_fetch_array($_comm);
switch ($comm[side]) {
case 0: $command[left][]="$comm[user]"; $command[left_hp][]="$comm[hp]";$command[left_lvl][]="$comm[lvl]"; break;
case 1: $command[right][]="$comm[user]"; $command[right_hp][]="$comm[hp]"; $command[right_lvl][]="$comm[lvl]"; break;
}}
//
echo"<TABLE WIDTH=100% cellspacing=0 cellpadding=5 bgcolor=e2e0e0 style='border-style: inset; border-width: 1'><TR><TD style='BORDER-CENTER: 0px solid' align=top>";
echo"<TD width=50% style='BORDER-RIGHT: 0px solid' align=top><CENTER>[b][u]
Союзники[/u][/b]</CENTER>
";
// Список команд
for ($i=0; $i<count($command[left]); $i++) {
echo "<center><a href=\"java script:top.to('".$command[left][$i]."')\" oncontextmenu=\"top.pp('".$command[left][$i]."'); return false;\"><font color=CFA87A>".$command[left][$i]."[".$command[left_lvl][$i]."]</font></a> [size="1"] [ ".$command[left_hp][$i]." ][/size]</center>";
}
echo"<TD width=50% style='BORDER-LEFT: 0px solid' align=top><CENTER>[b][u]
Противники[/u][/b]</CENTER>
";
for ($i=0; $i<count($command[right]); $i++) {
echo "<center><a href=\"java script:top.to('".$command[right][$i]."')\" oncontextmenu=\"top.pp('".$command[right][$i]."'); return false;\"><font color=679958>".$command[right][$i]."[".$command[right_lvl][$i]."]</font></a> [size="1"] [ ".$command[right_hp][$i]." ][/size]</center>";
}
//
echo"</TD></TR></TABLE>";
}
$last_turns=mysql_query("select id, time, attacker, defender, kick1, kick2, damage, comment, type, side from battles where offer='".$_RESERVER['battle']."' AND comment!=0 ORDER BY id DESC LIMIT 10");
if ($last_turns)
for ($i=0; $i<mysql_num_rows($last_turns); $i++) {
if ($i==0) {
echo "<TABLE CELLSPACING=0 CELLPADDING=1 WIDTH=100%><TR><TD";
if (!$endbattle) echo" WIDTH=50%>Нанесено урона: [u]".$participant['damage']." HP[/u]";
else echo" WIDTH=100% ALIGN=CENTER>[b]Бой закончен.[/b]
Нанесено урона: [u]".$participant['damage']." HP[/u].";
echo"";
if ($timeout<0) $timeout=0;
if ($endbattle!=1) {
echo" Тайм-аут: [u]",$offer['timeout']/60," мин.[/u]До тайм-аута: <b id='timeout'>[/b]";
echo"<script>ShowTime('timeout',".$timeout.",1);</script>";
}
echo"</TR></TABLE><HR color=e2e0e0>";
}
$turn=mysql_fetch_array($last_turns);
echo"<script>SC('".$turn['attacker']."', '".$turn['defender']."', '".$turn['damage']."', $turn[kick1], $turn[kick2], $turn[comment], $turn[side], '".date("H:i",$turn['time'])."');</script>";
if ($turn['id'] == $l_id || !$turn['type']) echo"<HR color=e2e0e0>";
$l_id = $turn['id'];
}
if ($now-$max['time']>$offer['timeout'] and $stat['hp_now']>0 and !$endbattle) include('includes/battle/right.php');
else echo"</td><td valign=top align=right><img src=img/battle/1.gif width=210 height=277></td></tr></table>";
?>