Неиспользуемая магия
This commit is contained in:
parent
b01f2465a0
commit
73642cc643
@ -1,45 +0,0 @@
|
||||
<?php
|
||||
|
||||
//параметры
|
||||
$needint=0;
|
||||
$effect_id=215;
|
||||
$effect_text="Защита эфира [1]";
|
||||
$log_text="<strong><font color=#0198ef>Защита эфира [1]</font></strong>";
|
||||
$mag_id=126;
|
||||
$book=866;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `date` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '".mysql_real_escape_string($_POST['target'])."' LIMIT 1;"));
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' ;"));
|
||||
|
||||
$mag_def="`type` = '215'";
|
||||
$md_arr=array("216","217","218","219","220","221","222","223","224","225","226");
|
||||
foreach($md_arr as $mdi)
|
||||
$mag_def.=" OR `type` = '".$mdi."'";
|
||||
$effect = mysql_fetch_array(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '{$us['id']}' AND ({$mag_def}) LIMIT 1;"));
|
||||
//шансы
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int=$magic['chanse'] + ($user['intel'] - $needint)*3;
|
||||
if ($int>98){$int=99;}
|
||||
}
|
||||
else {$int=0;}
|
||||
|
||||
if (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif ($effect['time']) {
|
||||
echo "На персонаже уже есть защита от магии!";
|
||||
} elseif (!$us['online']) {
|
||||
echo "Персонаж не в игре!";
|
||||
} elseif ($user['battle'] > 0) { echo "Не в бою...";
|
||||
} elseif (rand(1,100) < $int) {
|
||||
$us_in = mysql_fetch_array(mysql_query("SELECT `id` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;"));
|
||||
mysql_query("INSERT INTO `effects` (`owner`,`name`,`time`,`type`) values ('{$us_in['id']}','{$effect_text}',".(time()+7200).",'{$effect_id}');");
|
||||
echo "<font color=red><b>На персонажа ".$_POST['target']." наложено заклятие </b></font>".$log_text;
|
||||
$bet=1;
|
||||
$outok=1;
|
||||
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet=1;
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
<?php
|
||||
|
||||
//параметры
|
||||
$needint=0;
|
||||
$effect_id=216;
|
||||
$effect_text="Защита эфира [2]";
|
||||
$log_text="<strong><font color=#0198ef>Защита эфира [2]</font></strong>";
|
||||
$mag_id=127;
|
||||
$book=908;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `date` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '".mysql_real_escape_string($_POST['target'])."' LIMIT 1;"));
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' ;"));
|
||||
|
||||
$mag_def="`type` = '215'";
|
||||
$md_arr=array("216","217","218","219","220","221","222","223","224","225","226");
|
||||
foreach($md_arr as $mdi)
|
||||
$mag_def.=" OR `type` = '".$mdi."'";
|
||||
$effect = mysql_fetch_array(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '{$us['id']}' AND ({$mag_def}) LIMIT 1;"));
|
||||
//шансы
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int=$magic['chanse'] + ($user['intel'] - $needint)*3;
|
||||
if ($int>98){$int=99;}
|
||||
}
|
||||
else {$int=0;}
|
||||
|
||||
if (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif ($effect['time']) {
|
||||
echo "На персонаже уже есть защита от магии!";
|
||||
} elseif (!$us['online']) {
|
||||
echo "Персонаж не в игре!";
|
||||
} elseif ($user['battle'] > 0) { echo "Не в бою...";
|
||||
} elseif (rand(1,100) < $int) {
|
||||
$us_in = mysql_fetch_array(mysql_query("SELECT `id` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;"));
|
||||
mysql_query("INSERT INTO `effects` (`owner`,`name`,`time`,`type`) values ('{$us_in['id']}','{$effect_text}',".(time()+7200).",'{$effect_id}');");
|
||||
echo "<font color=red><b>На персонажа ".$_POST['target']." наложено заклятие </b></font>".$log_text;
|
||||
$bet=1;
|
||||
$outok=1;
|
||||
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet=1;
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
<?php
|
||||
|
||||
//параметры
|
||||
$needint=0;
|
||||
$effect_id=217;
|
||||
$effect_text="Защита эфира [3]";
|
||||
$log_text="<strong><font color=#0198ef>Защита эфира [3]</font></strong>";
|
||||
$mag_id=128;
|
||||
$book=909;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `date` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '".mysql_real_escape_string($_POST['target'])."' LIMIT 1;"));
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' ;"));
|
||||
|
||||
$mag_def="`type` = '215'";
|
||||
$md_arr=array("216","217","218","219","220","221","222","223","224","225","226");
|
||||
foreach($md_arr as $mdi)
|
||||
$mag_def.=" OR `type` = '".$mdi."'";
|
||||
$effect = mysql_fetch_array(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '{$us['id']}' AND ({$mag_def}) LIMIT 1;"));
|
||||
//шансы
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int=$magic['chanse'] + ($user['intel'] - $needint)*3;
|
||||
if ($int>98){$int=99;}
|
||||
}
|
||||
else {$int=0;}
|
||||
|
||||
if (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif ($effect['time']) {
|
||||
echo "На персонаже уже есть защита от магии!";
|
||||
} elseif (!$us['online']) {
|
||||
echo "Персонаж не в игре!";
|
||||
} elseif ($user['battle'] > 0) { echo "Не в бою...";
|
||||
} elseif (rand(1,100) < $int) {
|
||||
$us_in = mysql_fetch_array(mysql_query("SELECT `id` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;"));
|
||||
mysql_query("INSERT INTO `effects` (`owner`,`name`,`time`,`type`) values ('{$us_in['id']}','{$effect_text}',".(time()+7200).",'{$effect_id}');");
|
||||
echo "<font color=red><b>На персонажа ".$_POST['target']." наложено заклятие </b></font>".$log_text;
|
||||
$bet=1;
|
||||
$outok=1;
|
||||
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet=1;
|
||||
}
|
@ -1,147 +0,0 @@
|
||||
<?php
|
||||
//параметры
|
||||
$basedmg = 150;
|
||||
$needmana = 55;
|
||||
$needint = 80;
|
||||
$elem = 'a';
|
||||
$t_min = 1;
|
||||
$t_max = 2;
|
||||
$count = mt_rand($t_min, $t_max);
|
||||
$mag_id = 114;
|
||||
$log_text = "<strong><font color=#0198ef>Цепь Исцеления [1]</font></strong>";
|
||||
$book = 866;
|
||||
$have_book = mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
|
||||
if (empty($_SESSION['uid'])) {
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;"));
|
||||
$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
//mana needed
|
||||
$t1 = explode(";", $bat['t1']);
|
||||
$t2 = explode(";", $bat['t2']);
|
||||
if (in_array($user['id'], $t1)) $e_team = $t1;
|
||||
if (in_array($user['id'], $t2)) $e_team = $t2;
|
||||
foreach ($e_team as $k => $l) {
|
||||
if ($l > _BOTSEPARATOR_) $e_hp = mysql_fetch_array(mysql_query("SELECT `hp` FROM `bots` WHERE `id`='{$l}' LIMIT 1;"));
|
||||
else $e_hp = mysql_fetch_array(mysql_query("SELECT `hp` FROM `users` WHERE `id`='{$l}' LIMIT 1;"));
|
||||
if ($e_hp['hp'] < 1) unset($e_team[$k]);
|
||||
}
|
||||
shuffle($e_team);
|
||||
|
||||
if ($user['battle'] == 0) {
|
||||
echo "Это боевая магия...";
|
||||
} elseif (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif ($user['mana'] < $needmana) {
|
||||
echo "Недостаточно энергии!";
|
||||
} else {
|
||||
//attack script
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int = $magic['chanse'] + ($user['intel'] - $needint) * 3;
|
||||
if ($int > 98) {
|
||||
$int = 99;
|
||||
}
|
||||
} else {
|
||||
$int = 0;
|
||||
}
|
||||
|
||||
if (rand(1, 100) < $int) {
|
||||
$user_elem = element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)));
|
||||
|
||||
switch ($user_elem) {
|
||||
case 'f':
|
||||
$uel = 'mfire';
|
||||
break;
|
||||
case 'a':
|
||||
$uel = 'mair';
|
||||
break;
|
||||
case 'w':
|
||||
$uel = 'mwater';
|
||||
break;
|
||||
case 'e':
|
||||
$uel = 'mearth';
|
||||
break;
|
||||
}
|
||||
switch ($elem) {
|
||||
case 'f':
|
||||
$sel = 'mfire';
|
||||
break;
|
||||
case 'a':
|
||||
$sel = 'mair';
|
||||
break;
|
||||
case 'w':
|
||||
$sel = 'mwater';
|
||||
break;
|
||||
case 'e':
|
||||
$sel = 'mearth';
|
||||
break;
|
||||
}
|
||||
$sex_action = "применил";
|
||||
if ($user['sex'] == 0) $sex_action .= "а";
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . Nick::id($user['id'])->short() . ' ' . $sex_action . $targeted . ' заклинание ' . $log_text . '<BR>');
|
||||
|
||||
//mass magic
|
||||
mysql_query("UPDATE `users` SET `mana` = `mana`-'" . $needmana . "' WHERE `id` = '" . $user['id'] . "';");
|
||||
foreach ($e_team as $v)
|
||||
if ($count > 0) {
|
||||
$count--;
|
||||
$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= " . (time() - 60) . " AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;"));
|
||||
if (!$us) {
|
||||
$bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;"));
|
||||
$b_maxhp = mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;"));
|
||||
$b_maxhp = $b_maxhp['maxhp'];
|
||||
}
|
||||
//dmg=base+INT/LVL+X_magic
|
||||
$dmg = $basedmg + ($user['intel'] / $user['level']) + $user[$sel];
|
||||
//MF
|
||||
$dmg *= Config::$elem_align[$user_elem][$elem];
|
||||
if ($us) $dmg *= Config::$elem_bonus[element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)))][element(star_sign(substr($us['borndate'], 3, 2), substr($us['borndate'], 0, 2)))];
|
||||
//rand +- 25%
|
||||
$dmg = mt_rand(0.75 * $dmg, 1.25 * $dmg);
|
||||
$dmg = round($dmg);
|
||||
if ($us) $delta = $us['maxhp'] - $us['hp'];
|
||||
else $delta = $b_maxhp - $bot['hp'];
|
||||
if ($delta < $dmg) $dmg = floor($delta);
|
||||
if ($dmg < 1) $dmg = 0;
|
||||
|
||||
if ($us) $target = $us['id'];
|
||||
else $target = $bot['id'];
|
||||
|
||||
$targeted = '';
|
||||
//dmg >0 - go
|
||||
$all_dmg = unserialize($bat['damage']);
|
||||
$all_exp = unserialize($bat['exp']);
|
||||
$all_dmg[$user['id']] += $dmg;
|
||||
$all_exp[$user['id']] += SolveExp($user['id'], $target, $dmg);
|
||||
|
||||
//сработало
|
||||
if ($dmg > 0) $hit = '-1'; else $hit = 0;
|
||||
$action = preg_replace("/Х/", Nick::id($target)->short(), magic_log($elem, $hit, $target));
|
||||
if ($dmg > 0) {
|
||||
if ($us)
|
||||
mysql_query("UPDATE `users` SET `hp` = `hp`+'" . $dmg . "' WHERE `id` = '" . $target . "';");
|
||||
else
|
||||
mysql_query("UPDATE `bots` SET `hp` = `hp`+'" . $dmg . "' WHERE `id` = '" . $target . "';");
|
||||
mysql_query("UPDATE `battle` SET `damage`='" . serialize($all_dmg) . "', `exp`='" . serialize($all_exp) . "' WHERE `id`='{$user['battle']}';");
|
||||
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . $action . ' <strong>+' . $dmg . '</strong><BR>');
|
||||
|
||||
$bet = 1;
|
||||
} else //не сработало
|
||||
{
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . $action . '<BR>');
|
||||
$bet = 1;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet = 1;
|
||||
}
|
||||
}
|
||||
|
@ -1,129 +0,0 @@
|
||||
<?php
|
||||
//параметры
|
||||
$basedmg=210;
|
||||
$needmana=65;
|
||||
$needint=100;
|
||||
$elem='a';
|
||||
$t_min=1;
|
||||
$t_max=3;
|
||||
$count=mt_rand($t_min,$t_max);
|
||||
$mag_id=115;
|
||||
$log_text="<strong><font color=#0198ef>Цепь Исцеления [2]</font></strong>";
|
||||
$book=908;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
|
||||
if (empty($_SESSION['uid'])) {
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;"));
|
||||
$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
//mana needed
|
||||
$t1 = explode(";",$bat['t1']);
|
||||
$t2 = explode(";",$bat['t2']);
|
||||
if(in_array($user['id'],$t1)) $e_team=$t1;
|
||||
if(in_array($user['id'],$t2)) $e_team=$t2;
|
||||
foreach($e_team as $k=>$l)
|
||||
{
|
||||
if($l>_BOTSEPARATOR_) $e_hp=mysql_fetch_array(mysql_query("SELECT `hp` FROM `bots` WHERE `id`='{$l}' LIMIT 1;"));
|
||||
else $e_hp=mysql_fetch_array(mysql_query("SELECT `hp` FROM `users` WHERE `id`='{$l}' LIMIT 1;"));
|
||||
if($e_hp['hp']<1) unset($e_team[$k]);
|
||||
}
|
||||
shuffle($e_team);
|
||||
|
||||
if ($user['battle'] == 0) {
|
||||
echo "Это боевая магия...";
|
||||
} elseif (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif ($user['mana']<$needmana) {
|
||||
echo "Недостаточно энергии!";
|
||||
} else {
|
||||
//attack script
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int=$magic['chanse'] + ($user['intel'] - $needint)*3;
|
||||
if ($int>98){$int=99;}
|
||||
}
|
||||
else {$int=0;}
|
||||
|
||||
if (rand(1,100) < $int) {
|
||||
$user_elem=element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2)));
|
||||
|
||||
switch($user_elem)
|
||||
{
|
||||
case 'f':$uel='mfire';break;
|
||||
case 'a':$uel='mair';break;
|
||||
case 'w':$uel='mwater';break;
|
||||
case 'e':$uel='mearth';break;
|
||||
}
|
||||
switch($elem)
|
||||
{
|
||||
case 'f':$sel='mfire';break;
|
||||
case 'a':$sel='mair';break;
|
||||
case 'w':$sel='mwater';break;
|
||||
case 'e':$sel='mearth';break;
|
||||
}
|
||||
$sex_action="применил";if($user['sex']==0) $sex_action.="а";
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.Nick::id($user['id'])->short().' '.$sex_action.$targeted.' заклинание '.$log_text.'<BR>');
|
||||
|
||||
//mass magic
|
||||
mysql_query ("UPDATE `users` SET `mana` = `mana`-'".$needmana."' WHERE `id` = '".$user['id']."';");
|
||||
foreach($e_team as $v)
|
||||
if($count>0)
|
||||
{
|
||||
$count--;
|
||||
$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;"));
|
||||
if(!$us) {$bot= mysql_fetch_array(mysql_query ("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;"));$b_maxhp=mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;"));$b_maxhp=$b_maxhp['maxhp'];}
|
||||
//dmg=base+INT/LVL+X_magic
|
||||
$dmg=$basedmg+($user['intel']/$user['level'])+$user[$sel];
|
||||
//MF
|
||||
$dmg*=Config::$elem_align[$user_elem][$elem];
|
||||
if($us) $dmg*=Config::$elem_bonus[element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2)))][element(star_sign(substr($us['borndate'],3,2), substr($us['borndate'],0,2)))];
|
||||
//rand +- 25%
|
||||
$dmg=mt_rand(0.75*$dmg,1.25*$dmg);
|
||||
$dmg=round($dmg);
|
||||
if($us) $delta=$us['maxhp']-$us['hp'];
|
||||
else $delta=$b_maxhp-$bot['hp'];
|
||||
if($delta<$dmg) $dmg=floor($delta);
|
||||
if($dmg<1) $dmg=0;
|
||||
|
||||
if($us) $target=$us['id'];
|
||||
else $target=$bot['id'];
|
||||
|
||||
$targeted='';
|
||||
//dmg >0 - go
|
||||
$all_dmg=unserialize($bat['damage']);
|
||||
$all_exp=unserialize($bat['exp']);
|
||||
$all_dmg[$user['id']]+=$dmg;
|
||||
$all_exp[$user['id']]+=SolveExp($user['id'],$target,$dmg);
|
||||
|
||||
//сработало
|
||||
if($dmg>0) $hit='-1'; else $hit=0;
|
||||
$action=preg_replace("/Х/",Nick::id($target)->short(),magic_log($elem,$hit,$target));
|
||||
if($dmg>0)
|
||||
{
|
||||
if($us)
|
||||
mysql_query("UPDATE `users` SET `hp` = `hp`+'".$dmg."' WHERE `id` = '".$target."';");
|
||||
else
|
||||
mysql_query("UPDATE `bots` SET `hp` = `hp`+'".$dmg."' WHERE `id` = '".$target."';");
|
||||
mysql_query("UPDATE `battle` SET `damage`='".serialize($all_dmg)."', `exp`='".serialize($all_exp)."' WHERE `id`='{$user['battle']}';");
|
||||
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.$action.' <strong>+'.$dmg.'</strong><BR>');
|
||||
|
||||
$bet=1;
|
||||
}
|
||||
else
|
||||
//не сработало
|
||||
{
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.$action.'<BR>');
|
||||
$bet=1;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet=1;
|
||||
}
|
||||
}
|
||||
|
@ -1,129 +0,0 @@
|
||||
<?php
|
||||
//параметры
|
||||
$basedmg=330;
|
||||
$needmana=75;
|
||||
$needint=120;
|
||||
$elem='a';
|
||||
$t_min=1;
|
||||
$t_max=4;
|
||||
$count=mt_rand($t_min,$t_max);
|
||||
$mag_id=116;
|
||||
$log_text="<strong><font color=#0198ef>Цепь Исцеления [3]</font></strong>";
|
||||
$book=909;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
|
||||
if (empty($_SESSION['uid'])) {
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;"));
|
||||
$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
//mana needed
|
||||
$t1 = explode(";",$bat['t1']);
|
||||
$t2 = explode(";",$bat['t2']);
|
||||
if(in_array($user['id'],$t1)) $e_team=$t1;
|
||||
if(in_array($user['id'],$t2)) $e_team=$t2;
|
||||
foreach($e_team as $k=>$l)
|
||||
{
|
||||
if($l>_BOTSEPARATOR_) $e_hp=mysql_fetch_array(mysql_query("SELECT `hp` FROM `bots` WHERE `id`='{$l}' LIMIT 1;"));
|
||||
else $e_hp=mysql_fetch_array(mysql_query("SELECT `hp` FROM `users` WHERE `id`='{$l}' LIMIT 1;"));
|
||||
if($e_hp['hp']<1) unset($e_team[$k]);
|
||||
}
|
||||
shuffle($e_team);
|
||||
|
||||
if ($user['battle'] == 0) {
|
||||
echo "Это боевая магия...";
|
||||
} elseif (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif ($user['mana']<$needmana) {
|
||||
echo "Недостаточно энергии!";
|
||||
} else {
|
||||
//attack script
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int=$magic['chanse'] + ($user['intel'] - $needint)*3;
|
||||
if ($int>98){$int=99;}
|
||||
}
|
||||
else {$int=0;}
|
||||
|
||||
if (rand(1,100) < $int) {
|
||||
$user_elem=element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2)));
|
||||
|
||||
switch($user_elem)
|
||||
{
|
||||
case 'f':$uel='mfire';break;
|
||||
case 'a':$uel='mair';break;
|
||||
case 'w':$uel='mwater';break;
|
||||
case 'e':$uel='mearth';break;
|
||||
}
|
||||
switch($elem)
|
||||
{
|
||||
case 'f':$sel='mfire';break;
|
||||
case 'a':$sel='mair';break;
|
||||
case 'w':$sel='mwater';break;
|
||||
case 'e':$sel='mearth';break;
|
||||
}
|
||||
$sex_action="применил";if($user['sex']==0) $sex_action.="а";
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.Nick::id($user['id'])->short().' '.$sex_action.$targeted.' заклинание '.$log_text.'<BR>');
|
||||
|
||||
//mass magic
|
||||
mysql_query ("UPDATE `users` SET `mana` = `mana`-'".$needmana."' WHERE `id` = '".$user['id']."';");
|
||||
foreach($e_team as $v)
|
||||
if($count>0)
|
||||
{
|
||||
$count--;
|
||||
$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;"));
|
||||
if(!$us) {$bot= mysql_fetch_array(mysql_query ("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;"));$b_maxhp=mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;"));$b_maxhp=$b_maxhp['maxhp'];}
|
||||
//dmg=base+INT/LVL+X_magic
|
||||
$dmg=$basedmg+($user['intel']/$user['level'])+$user[$sel];
|
||||
//MF
|
||||
$dmg*=Config::$elem_align[$user_elem][$elem];
|
||||
if($us) $dmg*=Config::$elem_bonus[element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2)))][element(star_sign(substr($us['borndate'],3,2), substr($us['borndate'],0,2)))];
|
||||
//rand +- 25%
|
||||
$dmg=mt_rand(0.75*$dmg,1.25*$dmg);
|
||||
$dmg=round($dmg);
|
||||
if($us) $delta=$us['maxhp']-$us['hp'];
|
||||
else $delta=$b_maxhp-$bot['hp'];
|
||||
if($delta<$dmg) $dmg=floor($delta);
|
||||
if($dmg<1) $dmg=0;
|
||||
|
||||
if($us) $target=$us['id'];
|
||||
else $target=$bot['id'];
|
||||
|
||||
$targeted='';
|
||||
//dmg >0 - go
|
||||
$all_dmg=unserialize($bat['damage']);
|
||||
$all_exp=unserialize($bat['exp']);
|
||||
$all_dmg[$user['id']]+=$dmg;
|
||||
$all_exp[$user['id']]+=SolveExp($user['id'],$target,$dmg);
|
||||
|
||||
//сработало
|
||||
if($dmg>0) $hit='-1'; else $hit=0;
|
||||
$action=preg_replace("/Х/",Nick::id($target)->short(),magic_log($elem,$hit,$target));
|
||||
if($dmg>0)
|
||||
{
|
||||
if($us)
|
||||
mysql_query("UPDATE `users` SET `hp` = `hp`+'".$dmg."' WHERE `id` = '".$target."';");
|
||||
else
|
||||
mysql_query("UPDATE `bots` SET `hp` = `hp`+'".$dmg."' WHERE `id` = '".$target."';");
|
||||
mysql_query("UPDATE `battle` SET `damage`='".serialize($all_dmg)."', `exp`='".serialize($all_exp)."' WHERE `id`='{$user['battle']}';");
|
||||
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.$action.' <strong>+'.$dmg.'</strong><BR>');
|
||||
|
||||
$bet=1;
|
||||
}
|
||||
else
|
||||
//не сработало
|
||||
{
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.$action.'<BR>');
|
||||
$bet=1;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet=1;
|
||||
}
|
||||
}
|
||||
|
@ -1,150 +0,0 @@
|
||||
<?php
|
||||
//параметры
|
||||
$basedmg = 110;
|
||||
$needmana = 20;
|
||||
$needint = 80;
|
||||
$elem = 'a';
|
||||
$mag_id = 93;
|
||||
$log_text = "<strong><font color=#0198ef>Молния [1]</font></strong>";
|
||||
$book = 866;
|
||||
$have_book = mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
|
||||
if (empty($_SESSION['uid'])) {
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= " . (time() - 60) . " AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;"));
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;"));
|
||||
$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
if (!$us) $bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `name` = '" . $_POST['target'] . "' LIMIT 1;"));
|
||||
//mana needed
|
||||
$t1 = explode(";", $bat['t1']);
|
||||
$t2 = explode(";", $bat['t2']);
|
||||
if ($us) $e_id = $us['id'];
|
||||
else $e_id = $bot['id'];
|
||||
if ($user['battle'] == 0) {
|
||||
echo "Это боевая магия...";
|
||||
} elseif (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif ((in_array($user['id'], $t1) && in_array($e_id, $t1)) || (in_array($user['id'], $t2) && in_array($e_id, $t2))) {
|
||||
echo "Персонаж в Вашей команде!";
|
||||
} elseif ($user['login'] == $_POST['target']) {
|
||||
echo "Герр Леопольд фон Захер Мазох был бы доволен Вами...";
|
||||
} elseif ($us && $us['battle'] != $user['battle']) {
|
||||
echo "Персонаж не в Вашем бою!";
|
||||
} elseif ($user['mana'] < $needmana) {
|
||||
echo "Недостаточно энергии!";
|
||||
} elseif (!$us['online'] && !$bot) {
|
||||
echo "Персонаж не в игре!";
|
||||
} else {
|
||||
//attack script
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int = $magic['chanse'] + ($user['intel'] - $needint) * 3;
|
||||
if ($int > 98) {
|
||||
$int = 99;
|
||||
}
|
||||
} else {
|
||||
$int = 0;
|
||||
}
|
||||
|
||||
if (rand(1, 100) < $int) {
|
||||
$user_elem = element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)));
|
||||
|
||||
switch ($user_elem) {
|
||||
case 'f':
|
||||
$uel = 'mfire';
|
||||
break;
|
||||
case 'a':
|
||||
$uel = 'mair';
|
||||
break;
|
||||
case 'w':
|
||||
$uel = 'mwater';
|
||||
break;
|
||||
case 'e':
|
||||
$uel = 'mearth';
|
||||
break;
|
||||
}
|
||||
switch ($elem) {
|
||||
case 'f':
|
||||
$sel = 'mfire';
|
||||
break;
|
||||
case 'a':
|
||||
$sel = 'mair';
|
||||
break;
|
||||
case 'w':
|
||||
$sel = 'mwater';
|
||||
break;
|
||||
case 'e':
|
||||
$sel = 'mearth';
|
||||
break;
|
||||
}
|
||||
//dmg=base+INT/LVL+X_magic
|
||||
$dmg = $basedmg + ($user['intel'] / 4) + $user[$sel];
|
||||
//MF
|
||||
$dmg *= Config::$elem_align[$user_elem][$elem];
|
||||
if ($us) $dmg *= Config::$elem_bonus[element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)))][element(star_sign(substr($us['borndate'], 3, 2), substr($us['borndate'], 0, 2)))];
|
||||
//- MF
|
||||
if ($us) {
|
||||
$def = magic_def($elem, $_POST['target'], $user_elem);
|
||||
$dmg *= (1 - magic_def($elem, $us['login'], $user_elem, 1) / 100);
|
||||
$dmg -= $def;
|
||||
}
|
||||
|
||||
//rand +- 25%
|
||||
$dmg = mt_rand(0.75 * $dmg, 1.25 * $dmg);
|
||||
$dmg = round($dmg);
|
||||
if ($us) $target = $us['id'];
|
||||
else $target = $bot['id'];
|
||||
// команды
|
||||
$t1 = explode(";", $bat['t1']);
|
||||
$t2 = explode(";", $bat['t2']);
|
||||
if (in_array($user['id'], $t1)) {
|
||||
$us_team = "B1";
|
||||
$tar_team = "B2";
|
||||
} else {
|
||||
$us_team = "B2";
|
||||
$tar_team = "B1";
|
||||
}
|
||||
|
||||
$targeted = ' на ' . Nick::id($target)->short();
|
||||
//dmg >0 - go
|
||||
$all_dmg = unserialize($bat['damage']);
|
||||
$all_exp = unserialize($bat['exp']);
|
||||
$all_dmg[$user['id']] += $dmg;
|
||||
$all_exp[$user['id']] += SolveExp($user['id'], $target, $dmg);
|
||||
$sex_action = "применил";
|
||||
if ($user['sex'] == 0) $sex_action .= "а";
|
||||
if (!(($us['id'] > 0 && $us['hp'] < 1) || ($bot['id'] > 0 && $bot['hp'] < 1)))
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . Nick::id($user['id'])->short() . ' ' . $sex_action . $targeted . ' заклинание ' . $log_text . '<BR>');
|
||||
else
|
||||
echo "Не нарушайте покой мертвых!";
|
||||
//сработало
|
||||
if ($dmg > 0) $hit = 1; else $hit = 0;
|
||||
$action = preg_replace("/Х/", Nick::id($target)->short(), magic_log($elem, $hit, $target));
|
||||
//проверка hp>0
|
||||
if (!(($us['id'] > 0 && $us['hp'] < 1) || ($bot['id'] > 0 && $bot['hp'] < 1)))
|
||||
if ($dmg > 0) {
|
||||
if ($us)
|
||||
mysql_query("UPDATE `users` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';");
|
||||
else
|
||||
mysql_query("UPDATE `bots` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';");
|
||||
mysql_query("UPDATE `battle` SET `damage`='" . serialize($all_dmg) . "', `exp`='" . serialize($all_exp) . "' WHERE `id`='{$user['battle']}';");
|
||||
mysql_query("UPDATE `users` SET `mana` = `mana`-'" . $needmana . "' WHERE `id` = '" . $user['id'] . "';");
|
||||
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . $action . ' <strong>-' . $dmg . '</strong><BR>');
|
||||
|
||||
$bet = 1;
|
||||
} else //не сработало
|
||||
{
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . $action . '<BR>');
|
||||
$bet = 1;
|
||||
}
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet = 1;
|
||||
}
|
||||
}
|
||||
|
@ -1,152 +0,0 @@
|
||||
<?php
|
||||
//параметры
|
||||
$basedmg = 150;
|
||||
$needmana = 35;
|
||||
$needint = 100;
|
||||
$elem = 'a';
|
||||
$mag_id = 94;
|
||||
$log_text = "<strong><font color=#0198ef>Молния [2]</font></strong>";
|
||||
$book = 908;
|
||||
$have_book = mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
|
||||
if (empty($_SESSION['uid'])) {
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= " . (time() - 60) . " AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;"));
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;"));
|
||||
$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
if (!$us) $bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `name` = '" . $_POST['target'] . "' LIMIT 1;"));
|
||||
//mana needed
|
||||
$t1 = explode(";", $bat['t1']);
|
||||
$t2 = explode(";", $bat['t2']);
|
||||
if ($us) $e_id = $us['id'];
|
||||
else $e_id = $bot['id'];
|
||||
if ($user['battle'] == 0) {
|
||||
echo "Это боевая магия...";
|
||||
} elseif (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif ((in_array($user['id'], $t1) && in_array($e_id, $t1)) || (in_array($user['id'], $t2) && in_array($e_id, $t2))) {
|
||||
echo "Персонаж в Вашей команде!";
|
||||
} elseif ($user['login'] == $_POST['target']) {
|
||||
echo "Герр Леопольд фон Захер Мазох был бы доволен Вами...";
|
||||
} elseif ($us && $us['battle'] != $user['battle']) {
|
||||
echo "Персонаж не в Вашем бою!";
|
||||
} elseif ($user['mana'] < $needmana) {
|
||||
echo "Недостаточно энергии!";
|
||||
} elseif (!$us['online'] && !$bot) {
|
||||
echo "Персонаж не в игре!";
|
||||
} else {
|
||||
//attack script
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int = $magic['chanse'] + ($user['intel'] - $needint) * 3;
|
||||
if ($int > 98) {
|
||||
$int = 99;
|
||||
}
|
||||
} else {
|
||||
$int = 0;
|
||||
}
|
||||
|
||||
if (rand(1, 100) < $int) {
|
||||
global $elem_align, $elem_bonus;
|
||||
|
||||
$user_elem = element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)));
|
||||
|
||||
switch ($user_elem) {
|
||||
case 'f':
|
||||
$uel = 'mfire';
|
||||
break;
|
||||
case 'a':
|
||||
$uel = 'mair';
|
||||
break;
|
||||
case 'w':
|
||||
$uel = 'mwater';
|
||||
break;
|
||||
case 'e':
|
||||
$uel = 'mearth';
|
||||
break;
|
||||
}
|
||||
switch ($elem) {
|
||||
case 'f':
|
||||
$sel = 'mfire';
|
||||
break;
|
||||
case 'a':
|
||||
$sel = 'mair';
|
||||
break;
|
||||
case 'w':
|
||||
$sel = 'mwater';
|
||||
break;
|
||||
case 'e':
|
||||
$sel = 'mearth';
|
||||
break;
|
||||
}
|
||||
//dmg=base+INT/LVL+X_magic
|
||||
$dmg = $basedmg + ($user['intel'] / 4) + $user[$sel];
|
||||
//MF
|
||||
$dmg *= $elem_align[$user_elem][$elem];
|
||||
if ($us) $dmg *= $elem_bonus[element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)))][element(star_sign(substr($us['borndate'], 3, 2), substr($us['borndate'], 0, 2)))];
|
||||
//- MF
|
||||
if ($us) {
|
||||
$def = magic_def($elem, $_POST['target'], $user_elem);
|
||||
$dmg *= (1 - magic_def($elem, $us['login'], $user_elem, 1) / 100);
|
||||
$dmg -= $def;
|
||||
}
|
||||
|
||||
//rand +- 25%
|
||||
$dmg = mt_rand(0.75 * $dmg, 1.25 * $dmg);
|
||||
$dmg = round($dmg);
|
||||
if ($us) $target = $us['id'];
|
||||
else $target = $bot['id'];
|
||||
// команды
|
||||
$t1 = explode(";", $bat['t1']);
|
||||
$t2 = explode(";", $bat['t2']);
|
||||
if (in_array($user['id'], $t1)) {
|
||||
$us_team = "B1";
|
||||
$tar_team = "B2";
|
||||
} else {
|
||||
$us_team = "B2";
|
||||
$tar_team = "B1";
|
||||
}
|
||||
|
||||
$targeted = ' на ' . Nick::id($target)->short();
|
||||
//dmg >0 - go
|
||||
$all_dmg = unserialize($bat['damage']);
|
||||
$all_exp = unserialize($bat['exp']);
|
||||
$all_dmg[$user['id']] += $dmg;
|
||||
$all_exp[$user['id']] += SolveExp($user['id'], $target, $dmg);
|
||||
$sex_action = "применил";
|
||||
if ($user['sex'] == 0) $sex_action .= "а";
|
||||
if (!(($us['id'] > 0 && $us['hp'] < 1) || ($bot['id'] > 0 && $bot['hp'] < 1)))
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . Nick::id($user['id'])->short() . ' ' . $sex_action . $targeted . ' заклинание ' . $log_text . '<BR>');
|
||||
else
|
||||
echo "Не нарушайте покой мертвых!";
|
||||
//сработало
|
||||
if ($dmg > 0) $hit = 1; else $hit = 0;
|
||||
$action = preg_replace("/Х/", Nick::id($target)->short(), magic_log($elem, $hit, $target));
|
||||
//проверка hp>0
|
||||
if (!(($us['id'] > 0 && $us['hp'] < 1) || ($bot['id'] > 0 && $bot['hp'] < 1)))
|
||||
if ($dmg > 0) {
|
||||
if ($us)
|
||||
mysql_query("UPDATE `users` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';");
|
||||
else
|
||||
mysql_query("UPDATE `bots` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';");
|
||||
mysql_query("UPDATE `battle` SET `damage`='" . serialize($all_dmg) . "', `exp`='" . serialize($all_exp) . "' WHERE `id`='{$user['battle']}';");
|
||||
mysql_query("UPDATE `users` SET `mana` = `mana`-'" . $needmana . "' WHERE `id` = '" . $user['id'] . "';");
|
||||
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . $action . ' <strong>-' . $dmg . '</strong><BR>');
|
||||
|
||||
$bet = 1;
|
||||
} else //не сработало
|
||||
{
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . $action . '<BR>');
|
||||
$bet = 1;
|
||||
}
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet = 1;
|
||||
}
|
||||
}
|
||||
|
@ -1,136 +0,0 @@
|
||||
<?php
|
||||
//параметры
|
||||
$basedmg=300;
|
||||
$needmana=50;
|
||||
$needint=120;
|
||||
$elem='a';
|
||||
$mag_id=95;
|
||||
$log_text="<strong><font color=#0198ef>Молния [3]</font></strong>";
|
||||
$book=909;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
|
||||
if (empty($_SESSION['uid'])) {
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;"));
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;"));
|
||||
$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
if(!$us) $bot= mysql_fetch_array(mysql_query ("SELECT * FROM `bots` WHERE `name` = '".$_POST['target']."' LIMIT 1;"));
|
||||
//mana needed
|
||||
$t1 = explode(";",$bat['t1']);
|
||||
$t2 = explode(";",$bat['t2']);
|
||||
if($us) $e_id=$us['id'];
|
||||
else $e_id=$bot['id'];
|
||||
if ($user['battle'] == 0) {
|
||||
echo "Это боевая магия...";
|
||||
} elseif (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif((in_array ($user['id'],$t1)&&in_array ($e_id,$t1)) || (in_array ($user['id'],$t2)&&in_array ($e_id,$t2))) {
|
||||
echo "Персонаж в Вашей команде!";
|
||||
} elseif($user['login']==$_POST['target']) {
|
||||
echo "Герр Леопольд фон Захер Мазох был бы доволен Вами...";
|
||||
} elseif ($us && $us['battle']!=$user['battle']) {
|
||||
echo "Персонаж не в Вашем бою!";
|
||||
} elseif ($user['mana']<$needmana) {
|
||||
echo "Недостаточно энергии!";
|
||||
} elseif (!$us['online']&&!$bot) {
|
||||
echo "Персонаж не в игре!";
|
||||
} else {
|
||||
//attack script
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int=$magic['chanse'] + ($user['intel'] - $needint)*3;
|
||||
if ($int>98){$int=99;}
|
||||
}
|
||||
else {$int=0;}
|
||||
|
||||
if (rand(1,100) < $int) {
|
||||
global $elem_align,$elem_bonus;
|
||||
|
||||
$user_elem=element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2)));
|
||||
|
||||
switch($user_elem)
|
||||
{
|
||||
case 'f':$uel='mfire';break;
|
||||
case 'a':$uel='mair';break;
|
||||
case 'w':$uel='mwater';break;
|
||||
case 'e':$uel='mearth';break;
|
||||
}
|
||||
switch($elem)
|
||||
{
|
||||
case 'f':$sel='mfire';break;
|
||||
case 'a':$sel='mair';break;
|
||||
case 'w':$sel='mwater';break;
|
||||
case 'e':$sel='mearth';break;
|
||||
}
|
||||
//dmg=base+INT/LVL+X_magic
|
||||
$dmg=$basedmg+($user['intel']/4)+$user[$sel];
|
||||
//MF
|
||||
$dmg*=$elem_align[$user_elem][$elem];
|
||||
if($us) $dmg*=$elem_bonus[element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2)))][element(star_sign(substr($us['borndate'],3,2), substr($us['borndate'],0,2)))];
|
||||
//- MF
|
||||
if($us) {
|
||||
$def=magic_def($elem,$_POST['target'],$user_elem);$dmg*=(1-magic_def($elem,$us['login'],$user_elem,1)/100);
|
||||
$dmg-=$def;
|
||||
}
|
||||
|
||||
//rand +- 25%
|
||||
$dmg=mt_rand(0.75*$dmg,1.25*$dmg);
|
||||
$dmg=round($dmg);
|
||||
if($us) $target=$us['id'];
|
||||
else $target=$bot['id'];
|
||||
// команды
|
||||
$t1 = explode(";",$bat['t1']);
|
||||
$t2 = explode(";",$bat['t2']);
|
||||
if (in_array ($user['id'],$t1)) {
|
||||
$us_team = "B1";
|
||||
$tar_team = "B2";
|
||||
}
|
||||
else {
|
||||
$us_team = "B2";
|
||||
$tar_team = "B1";
|
||||
}
|
||||
|
||||
$targeted=' на '.Nick::id($target)->short();
|
||||
//dmg >0 - go
|
||||
$all_dmg=unserialize($bat['damage']);
|
||||
$all_exp=unserialize($bat['exp']);
|
||||
$all_dmg[$user['id']]+=$dmg;
|
||||
$all_exp[$user['id']]+=SolveExp($user['id'],$target,$dmg);
|
||||
$sex_action="применил";if($user['sex']==0) $sex_action.="а";
|
||||
if(!(($us['id']>0 && $us['hp']<1) || ($bot['id']>0 && $bot['hp']<1)))
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.Nick::id($user['id'])->short().' '.$sex_action.$targeted.' заклинание '.$log_text.'<BR>');
|
||||
else
|
||||
echo "Не нарушайте покой мертвых!";
|
||||
//сработало
|
||||
if($dmg>0) $hit=1; else $hit=0;
|
||||
$action=preg_replace("/Х/",Nick::id($target)->short(),magic_log($elem,$hit,$target));
|
||||
//проверка hp>0
|
||||
if(!(($us['id']>0 && $us['hp']<1) || ($bot['id']>0 && $bot['hp']<1)))
|
||||
if($dmg>0)
|
||||
{
|
||||
if($us)
|
||||
mysql_query("UPDATE `users` SET `hp` = `hp`-'".$dmg."' WHERE `id` = '".$target."';");
|
||||
else
|
||||
mysql_query("UPDATE `bots` SET `hp` = `hp`-'".$dmg."' WHERE `id` = '".$target."';");
|
||||
mysql_query("UPDATE `battle` SET `damage`='".serialize($all_dmg)."', `exp`='".serialize($all_exp)."' WHERE `id`='{$user['battle']}';");
|
||||
mysql_query ("UPDATE `users` SET `mana` = `mana`-'".$needmana."' WHERE `id` = '".$user['id']."';");
|
||||
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.$action.' <strong>-'.$dmg.'</strong><BR>');
|
||||
|
||||
$bet=1;
|
||||
}
|
||||
else
|
||||
//не сработало
|
||||
{
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.$action.'<BR>');
|
||||
$bet=1;
|
||||
}
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet=1;
|
||||
}
|
||||
}
|
||||
|
@ -1,67 +0,0 @@
|
||||
<?php
|
||||
|
||||
//параметры
|
||||
$needmana=60;
|
||||
$needint=60;
|
||||
$effect_id=203;
|
||||
$effect_text="Туманный Образ [1]";
|
||||
$log_text="<strong><font color=#0198ef>Туманный Образ [1]</font></strong>";
|
||||
$mag_id=90;
|
||||
$book=866;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `date` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '".mysql_real_escape_string($_POST['target'])."' LIMIT 1;"));
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' ;"));
|
||||
$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
$mag_def="`type` = '203'";
|
||||
$md_arr=array("204","205","206","207","208","209","210","211","212","213","214");
|
||||
foreach($md_arr as $mdi)
|
||||
$mag_def.=" OR `type` = '".$mdi."'";
|
||||
$effect = mysql_fetch_array(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '{$us['id']}' AND ({$mag_def}) LIMIT 1;"));
|
||||
// команды
|
||||
$t1 = explode(";",$bat['t1']);
|
||||
$t2 = explode(";",$bat['t2']);
|
||||
if (in_array ($user['id'],$t1)) {
|
||||
$us_team = "B1";
|
||||
}
|
||||
else {
|
||||
$us_team = "B2";
|
||||
}
|
||||
//шансы
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int=$magic['chanse'] + ($user['intel'] - $needint)*3;
|
||||
if ($int>98){$int=99;}
|
||||
}
|
||||
else {$int=0;}
|
||||
|
||||
if ($user['battle'] == 0) {
|
||||
echo "Это боевая магия...";
|
||||
} elseif (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif (in_array ($user['id'],$t1)&&!in_array($us['id'],$t1) || in_array ($user['id'],$t2)&&!in_array($us['id'],$t2)) {
|
||||
echo("Персонаж не в Вашей команде!");
|
||||
}elseif ($us && $us['battle']!=$user['battle']) {
|
||||
echo "Персонаж не в Вашем бою!";
|
||||
} elseif ($user['mana']<$needmana) {
|
||||
echo "Недостаточно энергии!";
|
||||
} elseif ($effect['time']) {
|
||||
echo "На персонаже уже есть защита от магии!";
|
||||
} elseif (!$us['online']) {
|
||||
echo "Персонаж не в игре!";
|
||||
} elseif (rand(1,100) < $int) {
|
||||
$us_in = mysql_fetch_array(mysql_query("SELECT `id` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;"));
|
||||
mysql_query("INSERT INTO `effects` (`owner`,`name`,`time`,`type`) values ('{$us_in['id']}','{$effect_text}',".(time()+7200).",'{$effect_id}');");
|
||||
echo "<font color=red><b>На персонажа ".$_POST['target']." наложено заклятие </b></font>".$log_text;
|
||||
$sex_action="применил";if($user['sex']==0) $sex_action.="а";
|
||||
if($user['id']==$us_in['id'])
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.Nick::id($user['id'])->short().' '.$sex_action.' на себя заклятие </font></b>'.$log_text.' <BR>');
|
||||
else
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.Nick::id($user['id'])->short().' '.$sex_action.' на '.Nick::id($us_in['id'])->short().' заклятие </font></b>'.$log_text.' <BR>');
|
||||
$bet=1;
|
||||
mysql_query ("UPDATE `users` SET `mana` = `mana`-'".$needmana."' WHERE `id` = '".$user['id']."';");$outok=1;
|
||||
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet=1;
|
||||
}
|
@ -1,68 +0,0 @@
|
||||
<?php
|
||||
|
||||
//параметры
|
||||
$needmana=65;
|
||||
$needint=80;
|
||||
$effect_id=204;
|
||||
$effect_text="Туманный Образ [2]";
|
||||
$log_text="<strong><font color=#0198ef>Туманный Образ [2]</font></strong>";
|
||||
$mag_id=78;
|
||||
$book=908;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
|
||||
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `date` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '".mysql_real_escape_string($_POST['target'])."' LIMIT 1;"));
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' ;"));
|
||||
$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
$mag_def="`type` = '203'";
|
||||
$md_arr=array("204","205","206","207","208","209","210","211","212","213","214");
|
||||
foreach($md_arr as $mdi)
|
||||
$mag_def.=" OR `type` = '".$mdi."'";
|
||||
$effect = mysql_fetch_array(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '{$us['id']}' AND ({$mag_def}) LIMIT 1;"));
|
||||
// команды
|
||||
$t1 = explode(";",$bat['t1']);
|
||||
$t2 = explode(";",$bat['t2']);
|
||||
if (in_array ($user['id'],$t1)) {
|
||||
$us_team = "B1";
|
||||
}
|
||||
else {
|
||||
$us_team = "B2";
|
||||
}
|
||||
//шансы
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int=$magic['chanse'] + ($user['intel'] - $needint)*3;
|
||||
if ($int>98){$int=99;}
|
||||
}
|
||||
else {$int=0;}
|
||||
|
||||
if ($user['battle'] == 0) {
|
||||
echo "Это боевая магия...";
|
||||
} elseif (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif (in_array ($user['id'],$t1)&&!in_array($us['id'],$t1) || in_array ($user['id'],$t2)&&!in_array($us['id'],$t2)) {
|
||||
echo("Персонаж не в Вашей команде!");
|
||||
}elseif ($us && $us['battle']!=$user['battle']) {
|
||||
echo "Персонаж не в Вашем бою!";
|
||||
} elseif ($user['mana']<$needmana) {
|
||||
echo "Недостаточно энергии!";
|
||||
} elseif ($effect['time']) {
|
||||
echo "На персонаже уже есть защита от магии!";
|
||||
} elseif (!$us['online']) {
|
||||
echo "Персонаж не в игре!";
|
||||
} elseif (rand(1,100) < $int) {
|
||||
$us_in = mysql_fetch_array(mysql_query("SELECT `id` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;"));
|
||||
mysql_query("INSERT INTO `effects` (`owner`,`name`,`time`,`type`) values ('{$us_in['id']}','{$effect_text}',".(time()+7200).",'{$effect_id}');");
|
||||
echo "<font color=red><b>На персонажа ".$_POST['target']." наложено заклятие </b></font>".$log_text;
|
||||
$sex_action="применил";if($user['sex']==0) $sex_action.="а";
|
||||
if($user['id']==$us_in['id'])
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.Nick::id($user['id'])->short().' '.$sex_action.' на себя заклятие </font></b>'.$log_text.' <BR>');
|
||||
else
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.Nick::id($user['id'])->short().' '.$sex_action.' на '.Nick::id($us_in['id'])->short().' заклятие </font></b>'.$log_text.' <BR>');
|
||||
$bet=1;
|
||||
mysql_query ("UPDATE `users` SET `mana` = `mana`-'".$needmana."' WHERE `id` = '".$user['id']."';");$outok=1;
|
||||
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet=1;
|
||||
}
|
@ -1,68 +0,0 @@
|
||||
<?php
|
||||
|
||||
//параметры
|
||||
$needmana=80;
|
||||
$needint=100;
|
||||
$effect_id=205;
|
||||
$effect_text="Туманный Образ [3]";
|
||||
$log_text="<strong><font color=#0198ef>Туманный Образ [3]</font></strong>";
|
||||
$mag_id=79;
|
||||
$book=909;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
|
||||
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `date` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '".mysql_real_escape_string($_POST['target'])."' LIMIT 1;"));
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' ;"));
|
||||
$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
$mag_def="`type` = '203'";
|
||||
$md_arr=array("204","205","206","207","208","209","210","211","212","213","214");
|
||||
foreach($md_arr as $mdi)
|
||||
$mag_def.=" OR `type` = '".$mdi."'";
|
||||
$effect = mysql_fetch_array(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '{$us['id']}' AND ({$mag_def}) LIMIT 1;"));
|
||||
// команды
|
||||
$t1 = explode(";",$bat['t1']);
|
||||
$t2 = explode(";",$bat['t2']);
|
||||
if (in_array ($user['id'],$t1)) {
|
||||
$us_team = "B1";
|
||||
}
|
||||
else {
|
||||
$us_team = "B2";
|
||||
}
|
||||
//шансы
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int=$magic['chanse'] + ($user['intel'] - $needint)*3;
|
||||
if ($int>98){$int=99;}
|
||||
}
|
||||
else {$int=0;}
|
||||
|
||||
if ($user['battle'] == 0) {
|
||||
echo "Это боевая магия...";
|
||||
} elseif (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif (in_array ($user['id'],$t1)&&!in_array($us['id'],$t1) || in_array ($user['id'],$t2)&&!in_array($us['id'],$t2)) {
|
||||
echo("Персонаж не в Вашей команде!");
|
||||
}elseif ($us && $us['battle']!=$user['battle']) {
|
||||
echo "Персонаж не в Вашем бою!";
|
||||
} elseif ($user['mana']<$needmana) {
|
||||
echo "Недостаточно энергии!";
|
||||
} elseif ($effect['time']) {
|
||||
echo "На персонаже уже есть защита от магии!";
|
||||
} elseif (!$us['online']) {
|
||||
echo "Персонаж не в игре!";
|
||||
} elseif (rand(1,100) < $int) {
|
||||
$us_in = mysql_fetch_array(mysql_query("SELECT `id` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;"));
|
||||
mysql_query("INSERT INTO `effects` (`owner`,`name`,`time`,`type`) values ('{$us_in['id']}','{$effect_text}',".(time()+7200).",'{$effect_id}');");
|
||||
echo "<font color=red><b>На персонажа ".$_POST['target']." наложено заклятие </b></font>".$log_text;
|
||||
$sex_action="применил";if($user['sex']==0) $sex_action.="а";
|
||||
if($user['id']==$us_in['id'])
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.Nick::id($user['id'])->short().' '.$sex_action.' на себя заклятие </font></b>'.$log_text.' <BR>');
|
||||
else
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.Nick::id($user['id'])->short().' '.$sex_action.' на '.Nick::id($us_in['id'])->short().' заклятие </font></b>'.$log_text.' <BR>');
|
||||
$bet=1;
|
||||
mysql_query ("UPDATE `users` SET `mana` = `mana`-'".$needmana."' WHERE `id` = '".$user['id']."';");$outok=1;
|
||||
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet=1;
|
||||
}
|
@ -1,145 +0,0 @@
|
||||
<?php
|
||||
//параметры
|
||||
$basedmg = 50;
|
||||
$needmana = 55;
|
||||
$needint = 80;
|
||||
$elem = 'a';
|
||||
$t_min = 3;
|
||||
$t_max = 4;
|
||||
$count = mt_rand($t_min, $t_max);
|
||||
$mag_id = 102;
|
||||
$log_text = "<strong><font color=#0198ef>Цепь Молний [1]</font></strong>";
|
||||
$book = 866;
|
||||
$have_book = mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
if (empty($_SESSION['uid'])) {
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;"));
|
||||
$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
//mana needed
|
||||
$t1 = explode(";", $bat['t1']);
|
||||
$t2 = explode(";", $bat['t2']);
|
||||
if (in_array($user['id'], $t1)) $e_team = $t2;
|
||||
if (in_array($user['id'], $t2)) $e_team = $t1;
|
||||
shuffle($e_team);
|
||||
|
||||
if ($user['battle'] == 0) {
|
||||
echo "Это боевая магия...";
|
||||
} elseif (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif ($user['mana'] < $needmana) {
|
||||
echo "Недостаточно энергии!";
|
||||
} else {
|
||||
//attack script
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int = $magic['chanse'] + ($user['intel'] - $needint) * 3;
|
||||
if ($int > 98) {
|
||||
$int = 99;
|
||||
}
|
||||
} else {
|
||||
$int = 0;
|
||||
}
|
||||
|
||||
if (rand(1, 100) < $int) {
|
||||
global $elem_align, $elem_bonus;
|
||||
$user_elem = element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)));
|
||||
|
||||
switch ($user_elem) {
|
||||
case 'f':
|
||||
$uel = 'mfire';
|
||||
break;
|
||||
case 'a':
|
||||
$uel = 'mair';
|
||||
break;
|
||||
case 'w':
|
||||
$uel = 'mwater';
|
||||
break;
|
||||
case 'e':
|
||||
$uel = 'mearth';
|
||||
break;
|
||||
}
|
||||
switch ($elem) {
|
||||
case 'f':
|
||||
$sel = 'mfire';
|
||||
break;
|
||||
case 'a':
|
||||
$sel = 'mair';
|
||||
break;
|
||||
case 'w':
|
||||
$sel = 'mwater';
|
||||
break;
|
||||
case 'e':
|
||||
$sel = 'mearth';
|
||||
break;
|
||||
}
|
||||
$sex_action = "применил";
|
||||
if ($user['sex'] == 0) $sex_action .= "а";
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . Nick::id($user['id'])->short() . ' ' . $sex_action . $targeted . ' заклинание ' . $log_text . '<BR>');
|
||||
|
||||
//mass magic
|
||||
mysql_query("UPDATE `users` SET `mana` = `mana`-'" . $needmana . "' WHERE `id` = '" . $user['id'] . "';");
|
||||
foreach ($e_team as $v)
|
||||
if ($count > 0) {
|
||||
$count--;
|
||||
$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= " . (time() - 60) . " AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;"));
|
||||
if (!$us) {
|
||||
$bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;"));
|
||||
$b_maxhp = mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;"));
|
||||
$b_maxhp = $b_maxhp['maxhp'];
|
||||
}
|
||||
//dmg=base+INT/LVL+X_magic
|
||||
$dmg = $basedmg + ($user['intel'] / 4) + $user[$sel];
|
||||
//MF
|
||||
$dmg *= $elem_align[$user_elem][$elem];
|
||||
if ($us) $dmg *= $elem_bonus[element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)))][element(star_sign(substr($us['borndate'], 3, 2), substr($us['borndate'], 0, 2)))];
|
||||
//- MF
|
||||
if ($us) {
|
||||
$def = magic_def($elem, $_POST['target'], $user_elem);
|
||||
$dmg *= (1 - magic_def($elem, $us['login'], $user_elem, 1) / 100);
|
||||
$dmg -= $def;
|
||||
}
|
||||
//rand +- 25%
|
||||
$dmg = mt_rand(0.75 * $dmg, 1.25 * $dmg);
|
||||
$dmg = round($dmg);
|
||||
if ($us) $target = $us['id'];
|
||||
else $target = $bot['id'];
|
||||
|
||||
$targeted = '';
|
||||
//dmg >0 - go
|
||||
$all_dmg = unserialize($bat['damage']);
|
||||
$all_exp = unserialize($bat['exp']);
|
||||
$all_dmg[$user['id']] += $dmg;
|
||||
$all_exp[$user['id']] += SolveExp($user['id'], $target, $dmg);
|
||||
|
||||
//сработало
|
||||
if ($dmg > 0) $hit = 1; else $hit = 0;
|
||||
$action = preg_replace("/Х/", Nick::id($target)->short(), magic_log($elem, $hit, $target));
|
||||
if (!(($us['id'] > 0 && $us['hp'] < 1) || ($bot['id'] > 0 && $bot['hp'] < 1)))
|
||||
if ($dmg > 0) {
|
||||
if ($us)
|
||||
mysql_query("UPDATE `users` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';");
|
||||
else
|
||||
mysql_query("UPDATE `bots` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';");
|
||||
mysql_query("UPDATE `battle` SET `damage`='" . serialize($all_dmg) . "', `exp`='" . serialize($all_exp) . "' WHERE `id`='{$user['battle']}';");
|
||||
|
||||
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . $action . ' <strong>-' . $dmg . '</strong><BR>');
|
||||
|
||||
$bet = 1;
|
||||
} else //не сработало
|
||||
{
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . $action . '<BR>');
|
||||
$bet = 1;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet = 1;
|
||||
}
|
||||
}
|
||||
|
@ -1,125 +0,0 @@
|
||||
<?php
|
||||
//параметры
|
||||
$basedmg=70;
|
||||
$needmana=65;
|
||||
$needint=100;
|
||||
$elem='a';
|
||||
$t_min=3;
|
||||
$t_max=5;
|
||||
$count=mt_rand($t_min,$t_max);
|
||||
$mag_id=103;
|
||||
$log_text="<strong><font color=#0198ef>Цепь Молний [2]</font></strong>";
|
||||
$book=908;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
if (empty($_SESSION['uid'])) {
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;"));
|
||||
$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
//mana needed
|
||||
$t1 = explode(";",$bat['t1']);
|
||||
$t2 = explode(";",$bat['t2']);
|
||||
if(in_array($user['id'],$t1)) $e_team=$t2;
|
||||
if(in_array($user['id'],$t2)) $e_team=$t1;
|
||||
shuffle($e_team);
|
||||
|
||||
if ($user['battle'] == 0) {
|
||||
echo "Это боевая магия...";
|
||||
} elseif (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif ($user['mana']<$needmana) {
|
||||
echo "Недостаточно энергии!";
|
||||
} else {
|
||||
//attack script
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int=$magic['chanse'] + ($user['intel'] - $needint)*3;
|
||||
if ($int>98){$int=99;}
|
||||
}
|
||||
else {$int=0;}
|
||||
|
||||
if (rand(1,100) < $int) {
|
||||
global $elem_align,$elem_bonus;
|
||||
$user_elem=element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2)));
|
||||
|
||||
switch($user_elem)
|
||||
{
|
||||
case 'f':$uel='mfire';break;
|
||||
case 'a':$uel='mair';break;
|
||||
case 'w':$uel='mwater';break;
|
||||
case 'e':$uel='mearth';break;
|
||||
}
|
||||
switch($elem)
|
||||
{
|
||||
case 'f':$sel='mfire';break;
|
||||
case 'a':$sel='mair';break;
|
||||
case 'w':$sel='mwater';break;
|
||||
case 'e':$sel='mearth';break;
|
||||
}
|
||||
$sex_action="применил";if($user['sex']==0) $sex_action.="а";
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.Nick::id($user['id'])->short().' '.$sex_action.$targeted.' заклинание '.$log_text.'<BR>');
|
||||
|
||||
//mass magic
|
||||
mysql_query ("UPDATE `users` SET `mana` = `mana`-'".$needmana."' WHERE `id` = '".$user['id']."';");
|
||||
foreach($e_team as $v)
|
||||
if($count>0)
|
||||
{
|
||||
$count--;
|
||||
$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;"));
|
||||
if(!$us) {$bot= mysql_fetch_array(mysql_query ("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;"));$b_maxhp=mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;"));$b_maxhp=$b_maxhp['maxhp'];}
|
||||
//dmg=base+INT/LVL+X_magic
|
||||
$dmg=$basedmg+($user['intel']/4)+$user[$sel];
|
||||
//MF
|
||||
$dmg*=$elem_align[$user_elem][$elem];
|
||||
if($us) $dmg*=$elem_bonus[element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2)))][element(star_sign(substr($us['borndate'],3,2), substr($us['borndate'],0,2)))];
|
||||
//- MF
|
||||
if($us) {
|
||||
$def=magic_def($elem,$_POST['target'],$user_elem);$dmg*=(1-magic_def($elem,$us['login'],$user_elem,1)/100);
|
||||
$dmg-=$def;
|
||||
}
|
||||
//rand +- 25%
|
||||
$dmg=mt_rand(0.75*$dmg,1.25*$dmg);
|
||||
$dmg=round($dmg);
|
||||
if($us) $target=$us['id'];
|
||||
else $target=$bot['id'];
|
||||
|
||||
$targeted='';
|
||||
//dmg >0 - go
|
||||
$all_dmg=unserialize($bat['damage']);
|
||||
$all_exp=unserialize($bat['exp']);
|
||||
$all_dmg[$user['id']]+=$dmg;
|
||||
$all_exp[$user['id']]+=SolveExp($user['id'],$target,$dmg);
|
||||
|
||||
//сработало
|
||||
if($dmg>0) $hit=1; else $hit=0;
|
||||
$action=preg_replace("/Х/",Nick::id($target)->short(),magic_log($elem,$hit,$target));
|
||||
if(!(($us['id']>0 && $us['hp']<1) || ($bot['id']>0 && $bot['hp']<1)))
|
||||
if($dmg>0)
|
||||
{
|
||||
if($us)
|
||||
mysql_query("UPDATE `users` SET `hp` = `hp`-'".$dmg."' WHERE `id` = '".$target."';");
|
||||
else
|
||||
mysql_query("UPDATE `bots` SET `hp` = `hp`-'".$dmg."' WHERE `id` = '".$target."';");
|
||||
mysql_query("UPDATE `battle` SET `damage`='".serialize($all_dmg)."', `exp`='".serialize($all_exp)."' WHERE `id`='{$user['battle']}';");
|
||||
|
||||
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.$action.' <strong>-'.$dmg.'</strong><BR>');
|
||||
|
||||
$bet=1;
|
||||
}
|
||||
else
|
||||
//не сработало
|
||||
{
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.$action.'<BR>');
|
||||
$bet=1;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet=1;
|
||||
}
|
||||
}
|
||||
|
@ -1,145 +0,0 @@
|
||||
<?php
|
||||
//параметры
|
||||
$basedmg = 110;
|
||||
$needmana = 80;
|
||||
$needint = 120;
|
||||
$elem = 'a';
|
||||
$t_min = 3;
|
||||
$t_max = 7;
|
||||
$count = mt_rand($t_min, $t_max);
|
||||
$mag_id = 104;
|
||||
$log_text = "<strong><font color=#0198ef>Цепь Молний [3]</font></strong>";
|
||||
$book = 909;
|
||||
$have_book = mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
if (empty($_SESSION['uid'])) {
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;"));
|
||||
$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
//mana needed
|
||||
$t1 = explode(";", $bat['t1']);
|
||||
$t2 = explode(";", $bat['t2']);
|
||||
if (in_array($user['id'], $t1)) $e_team = $t2;
|
||||
if (in_array($user['id'], $t2)) $e_team = $t1;
|
||||
shuffle($e_team);
|
||||
|
||||
if ($user['battle'] == 0) {
|
||||
echo "Это боевая магия...";
|
||||
} elseif (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif ($user['mana'] < $needmana) {
|
||||
echo "Недостаточно энергии!";
|
||||
} else {
|
||||
//attack script
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int = $magic['chanse'] + ($user['intel'] - $needint) * 3;
|
||||
if ($int > 98) {
|
||||
$int = 99;
|
||||
}
|
||||
} else {
|
||||
$int = 0;
|
||||
}
|
||||
|
||||
if (rand(1, 100) < $int) {
|
||||
global $elem_align, $elem_bonus;
|
||||
$user_elem = element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)));
|
||||
|
||||
switch ($user_elem) {
|
||||
case 'f':
|
||||
$uel = 'mfire';
|
||||
break;
|
||||
case 'a':
|
||||
$uel = 'mair';
|
||||
break;
|
||||
case 'w':
|
||||
$uel = 'mwater';
|
||||
break;
|
||||
case 'e':
|
||||
$uel = 'mearth';
|
||||
break;
|
||||
}
|
||||
switch ($elem) {
|
||||
case 'f':
|
||||
$sel = 'mfire';
|
||||
break;
|
||||
case 'a':
|
||||
$sel = 'mair';
|
||||
break;
|
||||
case 'w':
|
||||
$sel = 'mwater';
|
||||
break;
|
||||
case 'e':
|
||||
$sel = 'mearth';
|
||||
break;
|
||||
}
|
||||
$sex_action = "применил";
|
||||
if ($user['sex'] == 0) $sex_action .= "а";
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . Nick::id($user['id'])->short() . ' ' . $sex_action . $targeted . ' заклинание ' . $log_text . '<BR>');
|
||||
|
||||
//mass magic
|
||||
mysql_query("UPDATE `users` SET `mana` = `mana`-'" . $needmana . "' WHERE `id` = '" . $user['id'] . "';");
|
||||
foreach ($e_team as $v)
|
||||
if ($count > 0) {
|
||||
$count--;
|
||||
$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= " . (time() - 60) . " AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;"));
|
||||
if (!$us) {
|
||||
$bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;"));
|
||||
$b_maxhp = mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;"));
|
||||
$b_maxhp = $b_maxhp['maxhp'];
|
||||
}
|
||||
//dmg=base+INT/LVL+X_magic
|
||||
$dmg = $basedmg + ($user['intel'] / 4) + $user[$sel];
|
||||
//MF
|
||||
$dmg *= $elem_align[$user_elem][$elem];
|
||||
if ($us) $dmg *= $elem_bonus[element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)))][element(star_sign(substr($us['borndate'], 3, 2), substr($us['borndate'], 0, 2)))];
|
||||
//- MF
|
||||
if ($us) {
|
||||
$def = magic_def($elem, $_POST['target'], $user_elem);
|
||||
$dmg *= (1 - magic_def($elem, $us['login'], $user_elem, 1) / 100);
|
||||
$dmg -= $def;
|
||||
}
|
||||
//rand +- 25%
|
||||
$dmg = mt_rand(0.75 * $dmg, 1.25 * $dmg);
|
||||
$dmg = round($dmg);
|
||||
if ($us) $target = $us['id'];
|
||||
else $target = $bot['id'];
|
||||
|
||||
$targeted = '';
|
||||
//dmg >0 - go
|
||||
$all_dmg = unserialize($bat['damage']);
|
||||
$all_exp = unserialize($bat['exp']);
|
||||
$all_dmg[$user['id']] += $dmg;
|
||||
$all_exp[$user['id']] += SolveExp($user['id'], $target, $dmg);
|
||||
|
||||
//сработало
|
||||
if ($dmg > 0) $hit = 1; else $hit = 0;
|
||||
$action = preg_replace("/Х/", Nick::id($target)->short(), magic_log($elem, $hit, $target));
|
||||
if (!(($us['id'] > 0 && $us['hp'] < 1) || ($bot['id'] > 0 && $bot['hp'] < 1)))
|
||||
if ($dmg > 0) {
|
||||
if ($us)
|
||||
mysql_query("UPDATE `users` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';");
|
||||
else
|
||||
mysql_query("UPDATE `bots` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';");
|
||||
mysql_query("UPDATE `battle` SET `damage`='" . serialize($all_dmg) . "', `exp`='" . serialize($all_exp) . "' WHERE `id`='{$user['battle']}';");
|
||||
|
||||
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . $action . ' <strong>-' . $dmg . '</strong><BR>');
|
||||
|
||||
$bet = 1;
|
||||
} else //не сработало
|
||||
{
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . $action . '<BR>');
|
||||
$bet = 1;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet = 1;
|
||||
}
|
||||
}
|
||||
|
@ -1,130 +0,0 @@
|
||||
<?php
|
||||
//параметры
|
||||
$basedmg=150;
|
||||
$needmana=55;
|
||||
$needint=80;
|
||||
$elem='e';
|
||||
$t_min=1;
|
||||
$t_max=2;
|
||||
$count=mt_rand($t_min,$t_max);
|
||||
$mag_id=117;
|
||||
$log_text="<strong><font color=#086604>Дух Природы [1]</font></strong>";
|
||||
$book=866;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
|
||||
if (empty($_SESSION['uid'])) {
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;"));
|
||||
$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
//mana needed
|
||||
$t1 = explode(";",$bat['t1']);
|
||||
$t2 = explode(";",$bat['t2']);
|
||||
if(in_array($user['id'],$t1)) $e_team=$t1;
|
||||
if(in_array($user['id'],$t2)) $e_team=$t2;
|
||||
foreach($e_team as $k=>$l)
|
||||
{
|
||||
if($l>_BOTSEPARATOR_) $e_hp=mysql_fetch_array(mysql_query("SELECT `hp` FROM `bots` WHERE `id`='{$l}' LIMIT 1;"));
|
||||
else $e_hp=mysql_fetch_array(mysql_query("SELECT `hp` FROM `users` WHERE `id`='{$l}' LIMIT 1;"));
|
||||
if($e_hp['hp']<1) unset($e_team[$k]);
|
||||
}
|
||||
shuffle($e_team);
|
||||
|
||||
if ($user['battle'] == 0) {
|
||||
echo "Это боевая магия...";
|
||||
} elseif (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif ($user['mana']<$needmana) {
|
||||
echo "Недостаточно энергии!";
|
||||
} else {
|
||||
//attack script
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int=$magic['chanse'] + ($user['intel'] - $needint)*3;
|
||||
if ($int>98){$int=99;}
|
||||
}
|
||||
else {$int=0;}
|
||||
|
||||
if (rand(1,100) < $int) {
|
||||
global $elem_align,$elem_bonus;
|
||||
$user_elem=element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2)));
|
||||
|
||||
switch($user_elem)
|
||||
{
|
||||
case 'f':$uel='mfire';break;
|
||||
case 'a':$uel='mair';break;
|
||||
case 'w':$uel='mwater';break;
|
||||
case 'e':$uel='mearth';break;
|
||||
}
|
||||
switch($elem)
|
||||
{
|
||||
case 'f':$sel='mfire';break;
|
||||
case 'a':$sel='mair';break;
|
||||
case 'w':$sel='mwater';break;
|
||||
case 'e':$sel='mearth';break;
|
||||
}
|
||||
$sex_action="применил";if($user['sex']==0) $sex_action.="а";
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.Nick::id($user['id'])->short().' '.$sex_action.$targeted.' заклинание '.$log_text.'<BR>');
|
||||
|
||||
//mass magic
|
||||
mysql_query ("UPDATE `users` SET `mana` = `mana`-'".$needmana."' WHERE `id` = '".$user['id']."';");
|
||||
foreach($e_team as $v)
|
||||
if($count>0)
|
||||
{
|
||||
$count--;
|
||||
$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;"));
|
||||
if(!$us) {$bot= mysql_fetch_array(mysql_query ("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;"));$b_maxhp=mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;"));$b_maxhp=$b_maxhp['maxhp'];}
|
||||
//dmg=base+INT/LVL+X_magic
|
||||
$dmg=$basedmg+($user['intel']/$user['level'])+$user[$sel];
|
||||
//MF
|
||||
$dmg*=$elem_align[$user_elem][$elem];
|
||||
if($us) $dmg*=$elem_bonus[element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2)))][element(star_sign(substr($us['borndate'],3,2), substr($us['borndate'],0,2)))];
|
||||
//rand +- 25%
|
||||
$dmg=mt_rand(0.75*$dmg,1.25*$dmg);
|
||||
$dmg=round($dmg);
|
||||
if($us) $delta=$us['maxhp']-$us['hp'];
|
||||
else $delta=$b_maxhp-$bot['hp'];
|
||||
if($delta<$dmg) $dmg=floor($delta);
|
||||
if($dmg<1) $dmg=0;
|
||||
|
||||
if($us) $target=$us['id'];
|
||||
else $target=$bot['id'];
|
||||
|
||||
$targeted='';
|
||||
//dmg >0 - go
|
||||
$all_dmg=unserialize($bat['damage']);
|
||||
$all_exp=unserialize($bat['exp']);
|
||||
$all_dmg[$user['id']]+=$dmg;
|
||||
$all_exp[$user['id']]+=SolveExp($user['id'],$target,$dmg);
|
||||
|
||||
//сработало
|
||||
if($dmg>0) $hit='-1'; else $hit=0;
|
||||
$action=preg_replace("/Х/",Nick::id($target)->short(),magic_log($elem,$hit,$target));
|
||||
if($dmg>0)
|
||||
{
|
||||
if($us)
|
||||
mysql_query("UPDATE `users` SET `hp` = `hp`+'".$dmg."' WHERE `id` = '".$target."';");
|
||||
else
|
||||
mysql_query("UPDATE `bots` SET `hp` = `hp`+'".$dmg."' WHERE `id` = '".$target."';");
|
||||
mysql_query("UPDATE `battle` SET `damage`='".serialize($all_dmg)."', `exp`='".serialize($all_exp)."' WHERE `id`='{$user['battle']}';");
|
||||
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.$action.' <strong>+'.$dmg.'</strong><BR>');
|
||||
|
||||
$bet=1;
|
||||
}
|
||||
else
|
||||
//не сработало
|
||||
{
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.$action.'<BR>');
|
||||
$bet=1;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet=1;
|
||||
}
|
||||
}
|
||||
|
@ -1,130 +0,0 @@
|
||||
<?php
|
||||
//параметры
|
||||
$basedmg=210;
|
||||
$needmana=65;
|
||||
$needint=100;
|
||||
$elem='e';
|
||||
$t_min=1;
|
||||
$t_max=3;
|
||||
$count=mt_rand($t_min,$t_max);
|
||||
$mag_id=118;
|
||||
$log_text="<strong><font color=#086604>Дух Природы [2]</font></strong>";
|
||||
$book=908;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
|
||||
if (empty($_SESSION['uid'])) {
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;"));
|
||||
$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
//mana needed
|
||||
$t1 = explode(";",$bat['t1']);
|
||||
$t2 = explode(";",$bat['t2']);
|
||||
if(in_array($user['id'],$t1)) $e_team=$t1;
|
||||
if(in_array($user['id'],$t2)) $e_team=$t2;
|
||||
foreach($e_team as $k=>$l)
|
||||
{
|
||||
if($l>_BOTSEPARATOR_) $e_hp=mysql_fetch_array(mysql_query("SELECT `hp` FROM `bots` WHERE `id`='{$l}' LIMIT 1;"));
|
||||
else $e_hp=mysql_fetch_array(mysql_query("SELECT `hp` FROM `users` WHERE `id`='{$l}' LIMIT 1;"));
|
||||
if($e_hp['hp']<1) unset($e_team[$k]);
|
||||
}
|
||||
shuffle($e_team);
|
||||
|
||||
if ($user['battle'] == 0) {
|
||||
echo "Это боевая магия...";
|
||||
} elseif (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif ($user['mana']<$needmana) {
|
||||
echo "Недостаточно энергии!";
|
||||
} else {
|
||||
//attack script
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int=$magic['chanse'] + ($user['intel'] - $needint)*3;
|
||||
if ($int>98){$int=99;}
|
||||
}
|
||||
else {$int=0;}
|
||||
|
||||
if (rand(1,100) < $int) {
|
||||
global $elem_align,$elem_bonus;
|
||||
$user_elem=element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2)));
|
||||
|
||||
switch($user_elem)
|
||||
{
|
||||
case 'f':$uel='mfire';break;
|
||||
case 'a':$uel='mair';break;
|
||||
case 'w':$uel='mwater';break;
|
||||
case 'e':$uel='mearth';break;
|
||||
}
|
||||
switch($elem)
|
||||
{
|
||||
case 'f':$sel='mfire';break;
|
||||
case 'a':$sel='mair';break;
|
||||
case 'w':$sel='mwater';break;
|
||||
case 'e':$sel='mearth';break;
|
||||
}
|
||||
$sex_action="применил";if($user['sex']==0) $sex_action.="а";
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.Nick::id($user['id'])->short().' '.$sex_action.$targeted.' заклинание '.$log_text.'<BR>');
|
||||
|
||||
//mass magic
|
||||
mysql_query ("UPDATE `users` SET `mana` = `mana`-'".$needmana."' WHERE `id` = '".$user['id']."';");
|
||||
foreach($e_team as $v)
|
||||
if($count>0)
|
||||
{
|
||||
$count--;
|
||||
$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;"));
|
||||
if(!$us) {$bot= mysql_fetch_array(mysql_query ("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;"));$b_maxhp=mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;"));$b_maxhp=$b_maxhp['maxhp'];}
|
||||
//dmg=base+INT/LVL+X_magic
|
||||
$dmg=$basedmg+($user['intel']/$user['level'])+$user[$sel];
|
||||
//MF
|
||||
$dmg*=$elem_align[$user_elem][$elem];
|
||||
if($us) $dmg*=$elem_bonus[element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2)))][element(star_sign(substr($us['borndate'],3,2), substr($us['borndate'],0,2)))];
|
||||
//rand +- 25%
|
||||
$dmg=mt_rand(0.75*$dmg,1.25*$dmg);
|
||||
$dmg=round($dmg);
|
||||
if($us) $delta=$us['maxhp']-$us['hp'];
|
||||
else $delta=$b_maxhp-$bot['hp'];
|
||||
if($delta<$dmg) $dmg=floor($delta);
|
||||
if($dmg<1) $dmg=0;
|
||||
|
||||
if($us) $target=$us['id'];
|
||||
else $target=$bot['id'];
|
||||
|
||||
$targeted='';
|
||||
//dmg >0 - go
|
||||
$all_dmg=unserialize($bat['damage']);
|
||||
$all_exp=unserialize($bat['exp']);
|
||||
$all_dmg[$user['id']]+=$dmg;
|
||||
$all_exp[$user['id']]+=SolveExp($user['id'],$target,$dmg);
|
||||
|
||||
//сработало
|
||||
if($dmg>0) $hit='-1'; else $hit=0;
|
||||
$action=preg_replace("/Х/",Nick::id($target)->short(),magic_log($elem,$hit,$target));
|
||||
if($dmg>0)
|
||||
{
|
||||
if($us)
|
||||
mysql_query("UPDATE `users` SET `hp` = `hp`+'".$dmg."' WHERE `id` = '".$target."';");
|
||||
else
|
||||
mysql_query("UPDATE `bots` SET `hp` = `hp`+'".$dmg."' WHERE `id` = '".$target."';");
|
||||
mysql_query("UPDATE `battle` SET `damage`='".serialize($all_dmg)."', `exp`='".serialize($all_exp)."' WHERE `id`='{$user['battle']}';");
|
||||
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.$action.' <strong>+'.$dmg.'</strong><BR>');
|
||||
|
||||
$bet=1;
|
||||
}
|
||||
else
|
||||
//не сработало
|
||||
{
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.$action.'<BR>');
|
||||
$bet=1;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet=1;
|
||||
}
|
||||
}
|
||||
|
@ -1,129 +0,0 @@
|
||||
<?php
|
||||
//параметры
|
||||
$basedmg=330;
|
||||
$needmana=75;
|
||||
$needint=120;
|
||||
$elem='e';
|
||||
$t_min=1;
|
||||
$t_max=4;
|
||||
$count=mt_rand($t_min,$t_max);
|
||||
$mag_id=119;
|
||||
$log_text="<strong><font color=#086604>Дух Природы [3]</font></strong>";
|
||||
$book=909;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
if (empty($_SESSION['uid'])) {
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;"));
|
||||
$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
//mana needed
|
||||
$t1 = explode(";",$bat['t1']);
|
||||
$t2 = explode(";",$bat['t2']);
|
||||
if(in_array($user['id'],$t1)) $e_team=$t1;
|
||||
if(in_array($user['id'],$t2)) $e_team=$t2;
|
||||
foreach($e_team as $k=>$l)
|
||||
{
|
||||
if($l>_BOTSEPARATOR_) $e_hp=mysql_fetch_array(mysql_query("SELECT `hp` FROM `bots` WHERE `id`='{$l}' LIMIT 1;"));
|
||||
else $e_hp=mysql_fetch_array(mysql_query("SELECT `hp` FROM `users` WHERE `id`='{$l}' LIMIT 1;"));
|
||||
if($e_hp['hp']<1) unset($e_team[$k]);
|
||||
}
|
||||
shuffle($e_team);
|
||||
|
||||
if ($user['battle'] == 0) {
|
||||
echo "Это боевая магия...";
|
||||
} elseif (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif ($user['mana']<$needmana) {
|
||||
echo "Недостаточно энергии!";
|
||||
} else {
|
||||
//attack script
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int=$magic['chanse'] + ($user['intel'] - $needint)*3;
|
||||
if ($int>98){$int=99;}
|
||||
}
|
||||
else {$int=0;}
|
||||
|
||||
if (rand(1,100) < $int) {
|
||||
global $elem_align,$elem_bonus;
|
||||
$user_elem=element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2)));
|
||||
|
||||
switch($user_elem)
|
||||
{
|
||||
case 'f':$uel='mfire';break;
|
||||
case 'a':$uel='mair';break;
|
||||
case 'w':$uel='mwater';break;
|
||||
case 'e':$uel='mearth';break;
|
||||
}
|
||||
switch($elem)
|
||||
{
|
||||
case 'f':$sel='mfire';break;
|
||||
case 'a':$sel='mair';break;
|
||||
case 'w':$sel='mwater';break;
|
||||
case 'e':$sel='mearth';break;
|
||||
}
|
||||
$sex_action="применил";if($user['sex']==0) $sex_action.="а";
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.Nick::id($user['id'])->short().' '.$sex_action.$targeted.' заклинание '.$log_text.'<BR>');
|
||||
|
||||
//mass magic
|
||||
mysql_query ("UPDATE `users` SET `mana` = `mana`-'".$needmana."' WHERE `id` = '".$user['id']."';");
|
||||
foreach($e_team as $v)
|
||||
if($count>0)
|
||||
{
|
||||
$count--;
|
||||
$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;"));
|
||||
if(!$us) {$bot= mysql_fetch_array(mysql_query ("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;"));$b_maxhp=mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;"));$b_maxhp=$b_maxhp['maxhp'];}
|
||||
//dmg=base+INT/LVL+X_magic
|
||||
$dmg=$basedmg+($user['intel']/$user['level'])+$user[$sel];
|
||||
//MF
|
||||
$dmg*=$elem_align[$user_elem][$elem];
|
||||
if($us) $dmg*=$elem_bonus[element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2)))][element(star_sign(substr($us['borndate'],3,2), substr($us['borndate'],0,2)))];
|
||||
//rand +- 25%
|
||||
$dmg=mt_rand(0.75*$dmg,1.25*$dmg);
|
||||
$dmg=round($dmg);
|
||||
if($us) $delta=$us['maxhp']-$us['hp'];
|
||||
else $delta=$b_maxhp-$bot['hp'];
|
||||
if($delta<$dmg) $dmg=floor($delta);
|
||||
if($dmg<1) $dmg=0;
|
||||
|
||||
if($us) $target=$us['id'];
|
||||
else $target=$bot['id'];
|
||||
|
||||
$targeted='';
|
||||
//dmg >0 - go
|
||||
$all_dmg=unserialize($bat['damage']);
|
||||
$all_exp=unserialize($bat['exp']);
|
||||
$all_dmg[$user['id']]+=$dmg;
|
||||
$all_exp[$user['id']]+=SolveExp($user['id'],$target,$dmg);
|
||||
|
||||
//сработало
|
||||
if($dmg>0) $hit='-1'; else $hit=0;
|
||||
$action=preg_replace("/Х/",Nick::id($target)->short(),magic_log($elem,$hit,$target));
|
||||
if($dmg>0)
|
||||
{
|
||||
if($us)
|
||||
mysql_query("UPDATE `users` SET `hp` = `hp`+'".$dmg."' WHERE `id` = '".$target."';");
|
||||
else
|
||||
mysql_query("UPDATE `bots` SET `hp` = `hp`+'".$dmg."' WHERE `id` = '".$target."';");
|
||||
mysql_query("UPDATE `battle` SET `damage`='".serialize($all_dmg)."', `exp`='".serialize($all_exp)."' WHERE `id`='{$user['battle']}';");
|
||||
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.$action.' <strong>+'.$dmg.'</strong><BR>');
|
||||
|
||||
$bet=1;
|
||||
}
|
||||
else
|
||||
//не сработало
|
||||
{
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.$action.'<BR>');
|
||||
$bet=1;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet=1;
|
||||
}
|
||||
}
|
||||
|
@ -1,45 +0,0 @@
|
||||
<?php
|
||||
|
||||
//параметры
|
||||
$needint=0;
|
||||
$effect_id=218;
|
||||
$effect_text="Песчаный Щит [1]";
|
||||
$log_text="<strong><font color=#086604>Песчаный Щит [1]</font></strong>";
|
||||
$mag_id=129;
|
||||
$book=866;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `date` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '".mysql_real_escape_string($_POST['target'])."' LIMIT 1;"));
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' ;"));
|
||||
|
||||
$mag_def="`type` = '215'";
|
||||
$md_arr=array("216","217","218","219","220","221","222","223","224","225","226");
|
||||
foreach($md_arr as $mdi)
|
||||
$mag_def.=" OR `type` = '".$mdi."'";
|
||||
$effect = mysql_fetch_array(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '{$us['id']}' AND ({$mag_def}) LIMIT 1;"));
|
||||
//шансы
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int=$magic['chanse'] + ($user['intel'] - $needint)*3;
|
||||
if ($int>98){$int=99;}
|
||||
}
|
||||
else {$int=0;}
|
||||
|
||||
if (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif ($effect['time']) {
|
||||
echo "На персонаже уже есть защита от магии!";
|
||||
} elseif (!$us['online']) {
|
||||
echo "Персонаж не в игре!";
|
||||
} elseif ($user['battle'] > 0) { echo "Не в бою...";
|
||||
} elseif (rand(1,100) < $int) {
|
||||
$us_in = mysql_fetch_array(mysql_query("SELECT `id` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;"));
|
||||
mysql_query("INSERT INTO `effects` (`owner`,`name`,`time`,`type`) values ('{$us_in['id']}','{$effect_text}',".(time()+7200).",'{$effect_id}');");
|
||||
echo "<font color=red><b>На персонажа ".$_POST['target']." наложено заклятие </b></font>".$log_text;
|
||||
$bet=1;
|
||||
$outok=1;
|
||||
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet=1;
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
<?php
|
||||
|
||||
//параметры
|
||||
$needint=0;
|
||||
$effect_id=219;
|
||||
$effect_text="Песчаный Щит [2]";
|
||||
$log_text="<strong><font color=#086604>Песчаный Щит [2]</font></strong>";
|
||||
$mag_id=130;
|
||||
$book=908;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `date` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '".mysql_real_escape_string($_POST['target'])."' LIMIT 1;"));
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' ;"));
|
||||
|
||||
$mag_def="`type` = '215'";
|
||||
$md_arr=array("216","217","218","219","220","221","222","223","224","225","226");
|
||||
foreach($md_arr as $mdi)
|
||||
$mag_def.=" OR `type` = '".$mdi."'";
|
||||
$effect = mysql_fetch_array(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '{$us['id']}' AND ({$mag_def}) LIMIT 1;"));
|
||||
//шансы
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int=$magic['chanse'] + ($user['intel'] - $needint)*3;
|
||||
if ($int>98){$int=99;}
|
||||
}
|
||||
else {$int=0;}
|
||||
|
||||
if (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif ($effect['time']) {
|
||||
echo "На персонаже уже есть защита от магии!";
|
||||
} elseif (!$us['online']) {
|
||||
echo "Персонаж не в игре!";
|
||||
} elseif ($user['battle'] > 0) { echo "Не в бою...";
|
||||
} elseif (rand(1,100) < $int) {
|
||||
$us_in = mysql_fetch_array(mysql_query("SELECT `id` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;"));
|
||||
mysql_query("INSERT INTO `effects` (`owner`,`name`,`time`,`type`) values ('{$us_in['id']}','{$effect_text}',".(time()+7200).",'{$effect_id}');");
|
||||
echo "<font color=red><b>На персонажа ".$_POST['target']." наложено заклятие </b></font>".$log_text;
|
||||
$bet=1;
|
||||
$outok=1;
|
||||
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet=1;
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
<?php
|
||||
|
||||
//параметры
|
||||
$needint=0;
|
||||
$effect_id=220;
|
||||
$effect_text="Песчаный Щит [3]";
|
||||
$log_text="<strong><font color=#086604>Песчаный Щит [3]</font></strong>";
|
||||
$mag_id=131;
|
||||
$book=909;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `date` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '".mysql_real_escape_string($_POST['target'])."' LIMIT 1;"));
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' ;"));
|
||||
|
||||
$mag_def="`type` = '215'";
|
||||
$md_arr=array("216","217","218","219","220","221","222","223","224","225","226");
|
||||
foreach($md_arr as $mdi)
|
||||
$mag_def.=" OR `type` = '".$mdi."'";
|
||||
$effect = mysql_fetch_array(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '{$us['id']}' AND ({$mag_def}) LIMIT 1;"));
|
||||
//шансы
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int=$magic['chanse'] + ($user['intel'] - $needint)*3;
|
||||
if ($int>98){$int=99;}
|
||||
}
|
||||
else {$int=0;}
|
||||
|
||||
if (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif ($effect['time']) {
|
||||
echo "На персонаже уже есть защита от магии!";
|
||||
} elseif (!$us['online']) {
|
||||
echo "Персонаж не в игре!";
|
||||
} elseif ($user['battle'] > 0) { echo "Не в бою...";
|
||||
} elseif (rand(1,100) < $int) {
|
||||
$us_in = mysql_fetch_array(mysql_query("SELECT `id` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;"));
|
||||
mysql_query("INSERT INTO `effects` (`owner`,`name`,`time`,`type`) values ('{$us_in['id']}','{$effect_text}',".(time()+7200).",'{$effect_id}');");
|
||||
echo "<font color=red><b>На персонажа ".$_POST['target']." наложено заклятие </b></font>".$log_text;
|
||||
$bet=1;
|
||||
$outok=1;
|
||||
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet=1;
|
||||
}
|
@ -1,71 +0,0 @@
|
||||
<?php
|
||||
|
||||
//параметры
|
||||
$needmana=60;
|
||||
$needint=60;
|
||||
$effect_id=206;
|
||||
$effect_text="Гравитация [1]";
|
||||
$log_text="<strong><font color=#086604>Гравитация [1]</font></strong>";
|
||||
$mag_id=80;
|
||||
$book=866;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
|
||||
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `date` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '".mysql_real_escape_string($_POST['target'])."' LIMIT 1;"));
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' ;"));
|
||||
$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
$mag_def="`type` = '203'";
|
||||
$md_arr=array("204","205",
|
||||
"206","207","208",
|
||||
"209","210","211",
|
||||
"212","213","214");
|
||||
foreach($md_arr as $mdi)
|
||||
$mag_def.=" OR `type` = '".$mdi."'";
|
||||
$effect = mysql_fetch_array(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '{$us['id']}' AND ({$mag_def}) LIMIT 1;"));
|
||||
// команды
|
||||
$t1 = explode(";",$bat['t1']);
|
||||
$t2 = explode(";",$bat['t2']);
|
||||
if (in_array ($user['id'],$t1)) {
|
||||
$us_team = "B1";
|
||||
}
|
||||
else {
|
||||
$us_team = "B2";
|
||||
}
|
||||
//шансы
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int=$magic['chanse'] + ($user['intel'] - $needint)*3;
|
||||
if ($int>98){$int=99;}
|
||||
}
|
||||
else {$int=0;}
|
||||
|
||||
if ($user['battle'] == 0) {
|
||||
echo "Это боевая магия...";
|
||||
} elseif (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif (in_array ($user['id'],$t1)&&!in_array($us['id'],$t1) || in_array ($user['id'],$t2)&&!in_array($us['id'],$t2)) {
|
||||
echo("Персонаж не в Вашей команде!");
|
||||
}elseif ($us && $us['battle']!=$user['battle']) {
|
||||
echo "Персонаж не в Вашем бою!";
|
||||
} elseif ($user['mana']<$needmana) {
|
||||
echo "Недостаточно энергии!";
|
||||
} elseif ($effect['time']) {
|
||||
echo "На персонаже уже есть защита от магии!";
|
||||
} elseif (!$us['online']) {
|
||||
echo "Персонаж не в игре!";
|
||||
} elseif (rand(1,100) < $int) {
|
||||
$us_in = mysql_fetch_array(mysql_query("SELECT `id` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;"));
|
||||
mysql_query("INSERT INTO `effects` (`owner`,`name`,`time`,`type`) values ('{$us_in['id']}','{$effect_text}',".(time()+7200).",'{$effect_id}');");
|
||||
echo "<font color=red><b>На персонажа ".$_POST['target']." наложено заклятие </b></font>".$log_text;
|
||||
$sex_action="применил";if($user['sex']==0) $sex_action.="а";
|
||||
if($user['id']==$us_in['id'])
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.Nick::id($user['id'])->short().' '.$sex_action.' на себя заклятие </font></b>'.$log_text.' <BR>');
|
||||
else
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.Nick::id($user['id'])->short().' '.$sex_action.' на '.Nick::id($us_in['id'])->short().' заклятие </font></b>'.$log_text.' <BR>');
|
||||
$bet=1;
|
||||
mysql_query ("UPDATE `users` SET `mana` = `mana`-'".$needmana."' WHERE `id` = '".$user['id']."';");$outok=1;
|
||||
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet=1;
|
||||
}
|
@ -1,70 +0,0 @@
|
||||
<?php
|
||||
|
||||
//параметры
|
||||
$needmana=65;
|
||||
$needint=80;
|
||||
$effect_id=207;
|
||||
$effect_text="Гравитация [2]";
|
||||
$log_text="<strong><font color=#086604>Гравитация [2]</font></strong>";
|
||||
$mag_id=81;
|
||||
$book=908;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `date` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '".mysql_real_escape_string($_POST['target'])."' LIMIT 1;"));
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' ;"));
|
||||
$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
$mag_def="`type` = '203'";
|
||||
$md_arr=array("204","205",
|
||||
"206","207","208",
|
||||
"209","210","211",
|
||||
"212","213","214");
|
||||
foreach($md_arr as $mdi)
|
||||
$mag_def.=" OR `type` = '".$mdi."'";
|
||||
$effect = mysql_fetch_array(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '{$us['id']}' AND ({$mag_def}) LIMIT 1;"));
|
||||
// команды
|
||||
$t1 = explode(";",$bat['t1']);
|
||||
$t2 = explode(";",$bat['t2']);
|
||||
if (in_array ($user['id'],$t1)) {
|
||||
$us_team = "B1";
|
||||
}
|
||||
else {
|
||||
$us_team = "B2";
|
||||
}
|
||||
//шансы
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int=$magic['chanse'] + ($user['intel'] - $needint)*3;
|
||||
if ($int>98){$int=99;}
|
||||
}
|
||||
else {$int=0;}
|
||||
|
||||
if ($user['battle'] == 0) {
|
||||
echo "Это боевая магия...";
|
||||
} elseif (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif (in_array ($user['id'],$t1)&&!in_array($us['id'],$t1) || in_array ($user['id'],$t2)&&!in_array($us['id'],$t2)) {
|
||||
echo("Персонаж не в Вашей команде!");
|
||||
}elseif ($us && $us['battle']!=$user['battle']) {
|
||||
echo "Персонаж не в Вашем бою!";
|
||||
} elseif ($user['mana']<$needmana) {
|
||||
echo "Недостаточно энергии!";
|
||||
} elseif ($effect['time']) {
|
||||
echo "На персонаже уже есть защита от магии!";
|
||||
} elseif (!$us['online']) {
|
||||
echo "Персонаж не в игре!";
|
||||
} elseif (rand(1,100) < $int) {
|
||||
$us_in = mysql_fetch_array(mysql_query("SELECT `id` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;"));
|
||||
mysql_query("INSERT INTO `effects` (`owner`,`name`,`time`,`type`) values ('{$us_in['id']}','{$effect_text}',".(time()+7200).",'{$effect_id}');");
|
||||
echo "<font color=red><b>На персонажа ".$_POST['target']." наложено заклятие </b></font>".$log_text;
|
||||
$sex_action="применил";if($user['sex']==0) $sex_action.="а";
|
||||
if($user['id']==$us_in['id'])
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.Nick::id($user['id'])->short().' '.$sex_action.' на себя заклятие </font></b>'.$log_text.' <BR>');
|
||||
else
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.Nick::id($user['id'])->short().' '.$sex_action.' на '.Nick::id($us_in['id'])->short().' заклятие </font></b>'.$log_text.' <BR>');
|
||||
$bet=1;
|
||||
mysql_query ("UPDATE `users` SET `mana` = `mana`-'".$needmana."' WHERE `id` = '".$user['id']."';");$outok=1;
|
||||
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet=1;
|
||||
}
|
@ -1,69 +0,0 @@
|
||||
<?php
|
||||
|
||||
//параметры
|
||||
$needmana=80;
|
||||
$needint=100;
|
||||
$effect_id=208;
|
||||
$effect_text="Гравитация [3]";
|
||||
$log_text="<strong><font color=#086604>Гравитация [3]</font></strong>";
|
||||
$mag_id=83;
|
||||
$book=909;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `date` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '".mysql_real_escape_string($_POST['target'])."' LIMIT 1;"));
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' ;"));
|
||||
$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
$mag_def="`type` = '203'";
|
||||
$md_arr=array("204","205",
|
||||
"206","207","208",
|
||||
"209","210","211",
|
||||
"212","213","214");
|
||||
foreach($md_arr as $mdi)
|
||||
$mag_def.=" OR `type` = '".$mdi."'";
|
||||
$effect = mysql_fetch_array(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '{$us['id']}' AND ({$mag_def}) LIMIT 1;"));
|
||||
// команды
|
||||
$t1 = explode(";",$bat['t1']);
|
||||
$t2 = explode(";",$bat['t2']);
|
||||
if (in_array ($user['id'],$t1)) {
|
||||
$us_team = "B1";
|
||||
}
|
||||
else {
|
||||
$us_team = "B2";
|
||||
}
|
||||
//шансы
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int=$magic['chanse'] + ($user['intel'] - $needint)*3;
|
||||
if ($int>98){$int=99;}
|
||||
}
|
||||
else {$int=0;}
|
||||
|
||||
if ($user['battle'] == 0) {
|
||||
echo "Это боевая магия...";
|
||||
} elseif (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif (in_array ($user['id'],$t1)&&!in_array($us['id'],$t1) || in_array ($user['id'],$t2)&&!in_array($us['id'],$t2)) {
|
||||
echo("Персонаж не в Вашей команде!");
|
||||
}elseif ($us && $us['battle']!=$user['battle']) {
|
||||
echo "Персонаж не в Вашем бою!";
|
||||
} elseif ($user['mana']<$needmana) {
|
||||
echo "Недостаточно энергии!";
|
||||
} elseif ($effect['time']) {
|
||||
echo "На персонаже уже есть защита от магии!";
|
||||
} elseif (!$us['online']) {
|
||||
echo "Персонаж не в игре!";
|
||||
} elseif (rand(1,100) < $int) {
|
||||
$us_in = mysql_fetch_array(mysql_query("SELECT `id` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;"));
|
||||
mysql_query("INSERT INTO `effects` (`owner`,`name`,`time`,`type`) values ('{$us_in['id']}','{$effect_text}',".(time()+7200).",'{$effect_id}');");
|
||||
echo "<font color=red><b>На персонажа ".$_POST['target']." наложено заклятие </b></font>".$log_text;
|
||||
$sex_action="применил";if($user['sex']==0) $sex_action.="а";
|
||||
if($user['id']==$us_in['id'])
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.Nick::id($user['id'])->short().' '.$sex_action.' на себя заклятие </font></b>'.$log_text.' <BR>');
|
||||
else
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.Nick::id($user['id'])->short().' '.$sex_action.' на '.Nick::id($us_in['id'])->short().' заклятие </font></b>'.$log_text.' <BR>');
|
||||
$bet=1;
|
||||
mysql_query ("UPDATE `users` SET `mana` = `mana`-'".$needmana."' WHERE `id` = '".$user['id']."';");$outok=1;
|
||||
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet=1;
|
||||
}
|
@ -1,146 +0,0 @@
|
||||
<?php
|
||||
//параметры
|
||||
$basedmg = 50;
|
||||
$needmana = 55;
|
||||
$needint = 80;
|
||||
$elem = 'e';
|
||||
$t_min = 3;
|
||||
$t_max = 4;
|
||||
$count = mt_rand($t_min, $t_max);
|
||||
$mag_id = 105;
|
||||
$log_text = "<strong><font color=#086604>Каменный Дождь [1]</font></strong>";
|
||||
$book = 866;
|
||||
$have_book = mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
|
||||
if (empty($_SESSION['uid'])) {
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;"));
|
||||
$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
//mana needed
|
||||
$t1 = explode(";", $bat['t1']);
|
||||
$t2 = explode(";", $bat['t2']);
|
||||
if (in_array($user['id'], $t1)) $e_team = $t2;
|
||||
if (in_array($user['id'], $t2)) $e_team = $t1;
|
||||
shuffle($e_team);
|
||||
|
||||
if ($user['battle'] == 0) {
|
||||
echo "Это боевая магия...";
|
||||
} elseif (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif ($user['mana'] < $needmana) {
|
||||
echo "Недостаточно энергии!";
|
||||
} else {
|
||||
//attack script
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int = $magic['chanse'] + ($user['intel'] - $needint) * 3;
|
||||
if ($int > 98) {
|
||||
$int = 99;
|
||||
}
|
||||
} else {
|
||||
$int = 0;
|
||||
}
|
||||
|
||||
if (rand(1, 100) < $int) {
|
||||
global $elem_align, $elem_bonus;
|
||||
$user_elem = element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)));
|
||||
|
||||
switch ($user_elem) {
|
||||
case 'f':
|
||||
$uel = 'mfire';
|
||||
break;
|
||||
case 'a':
|
||||
$uel = 'mair';
|
||||
break;
|
||||
case 'w':
|
||||
$uel = 'mwater';
|
||||
break;
|
||||
case 'e':
|
||||
$uel = 'mearth';
|
||||
break;
|
||||
}
|
||||
switch ($elem) {
|
||||
case 'f':
|
||||
$sel = 'mfire';
|
||||
break;
|
||||
case 'a':
|
||||
$sel = 'mair';
|
||||
break;
|
||||
case 'w':
|
||||
$sel = 'mwater';
|
||||
break;
|
||||
case 'e':
|
||||
$sel = 'mearth';
|
||||
break;
|
||||
}
|
||||
$sex_action = "применил";
|
||||
if ($user['sex'] == 0) $sex_action .= "а";
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . Nick::id($user['id'])->short() . ' ' . $sex_action . $targeted . ' заклинание ' . $log_text . '<BR>');
|
||||
|
||||
//mass magic
|
||||
mysql_query("UPDATE `users` SET `mana` = `mana`-'" . $needmana . "' WHERE `id` = '" . $user['id'] . "';");
|
||||
foreach ($e_team as $v)
|
||||
if ($count > 0) {
|
||||
$count--;
|
||||
$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= " . (time() - 60) . " AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;"));
|
||||
if (!$us) {
|
||||
$bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;"));
|
||||
$b_maxhp = mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;"));
|
||||
$b_maxhp = $b_maxhp['maxhp'];
|
||||
}
|
||||
//dmg=base+INT/LVL+X_magic
|
||||
$dmg = $basedmg + ($user['intel'] / 4) + $user[$sel];
|
||||
//MF
|
||||
$dmg *= $elem_align[$user_elem][$elem];
|
||||
if ($us) $dmg *= $elem_bonus[element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)))][element(star_sign(substr($us['borndate'], 3, 2), substr($us['borndate'], 0, 2)))];
|
||||
//- MF
|
||||
if ($us) {
|
||||
$def = magic_def($elem, $_POST['target'], $user_elem);
|
||||
$dmg *= (1 - magic_def($elem, $us['login'], $user_elem, 1) / 100);
|
||||
$dmg -= $def;
|
||||
}
|
||||
//rand +- 25%
|
||||
$dmg = mt_rand(0.75 * $dmg, 1.25 * $dmg);
|
||||
$dmg = round($dmg);
|
||||
if ($us) $target = $us['id'];
|
||||
else $target = $bot['id'];
|
||||
|
||||
$targeted = '';
|
||||
//dmg >0 - go
|
||||
$all_dmg = unserialize($bat['damage']);
|
||||
$all_exp = unserialize($bat['exp']);
|
||||
$all_dmg[$user['id']] += $dmg;
|
||||
$all_exp[$user['id']] += SolveExp($user['id'], $target, $dmg);
|
||||
|
||||
//сработало
|
||||
if ($dmg > 0) $hit = 1; else $hit = 0;
|
||||
$action = preg_replace("/Х/", Nick::id($target)->short(), magic_log($elem, $hit, $target));
|
||||
if (!(($us['id'] > 0 && $us['hp'] < 1) || ($bot['id'] > 0 && $bot['hp'] < 1)))
|
||||
if ($dmg > 0) {
|
||||
if ($us)
|
||||
mysql_query("UPDATE `users` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';");
|
||||
else
|
||||
mysql_query("UPDATE `bots` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';");
|
||||
mysql_query("UPDATE `battle` SET `damage`='" . serialize($all_dmg) . "', `exp`='" . serialize($all_exp) . "' WHERE `id`='{$user['battle']}';");
|
||||
|
||||
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . $action . ' <strong>-' . $dmg . '</strong><BR>');
|
||||
|
||||
$bet = 1;
|
||||
} else //не сработало
|
||||
{
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . $action . '<BR>');
|
||||
$bet = 1;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet = 1;
|
||||
}
|
||||
}
|
||||
|
@ -1,125 +0,0 @@
|
||||
<?php
|
||||
//параметры
|
||||
$basedmg=70;
|
||||
$needmana=65;
|
||||
$needint=100;
|
||||
$elem='e';
|
||||
$t_min=3;
|
||||
$t_max=5;
|
||||
$count=mt_rand($t_min,$t_max);
|
||||
$mag_id=106;
|
||||
$log_text="<strong><font color=#086604>Каменный Дождь [2]</font></strong>";
|
||||
$book=908;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
if (empty($_SESSION['uid'])) {
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;"));
|
||||
$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
//mana needed
|
||||
$t1 = explode(";",$bat['t1']);
|
||||
$t2 = explode(";",$bat['t2']);
|
||||
if(in_array($user['id'],$t1)) $e_team=$t2;
|
||||
if(in_array($user['id'],$t2)) $e_team=$t1;
|
||||
shuffle($e_team);
|
||||
|
||||
if ($user['battle'] == 0) {
|
||||
echo "Это боевая магия...";
|
||||
} elseif (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif ($user['mana']<$needmana) {
|
||||
echo "Недостаточно энергии!";
|
||||
} else {
|
||||
//attack script
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int=$magic['chanse'] + ($user['intel'] - $needint)*3;
|
||||
if ($int>98){$int=99;}
|
||||
}
|
||||
else {$int=0;}
|
||||
|
||||
if (rand(1,100) < $int) {
|
||||
global $elem_align,$elem_bonus;
|
||||
$user_elem=element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2)));
|
||||
|
||||
switch($user_elem)
|
||||
{
|
||||
case 'f':$uel='mfire';break;
|
||||
case 'a':$uel='mair';break;
|
||||
case 'w':$uel='mwater';break;
|
||||
case 'e':$uel='mearth';break;
|
||||
}
|
||||
switch($elem)
|
||||
{
|
||||
case 'f':$sel='mfire';break;
|
||||
case 'a':$sel='mair';break;
|
||||
case 'w':$sel='mwater';break;
|
||||
case 'e':$sel='mearth';break;
|
||||
}
|
||||
$sex_action="применил";if($user['sex']==0) $sex_action.="а";
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.Nick::id($user['id'])->short().' '.$sex_action.$targeted.' заклинание '.$log_text.'<BR>');
|
||||
|
||||
//mass magic
|
||||
mysql_query ("UPDATE `users` SET `mana` = `mana`-'".$needmana."' WHERE `id` = '".$user['id']."';");
|
||||
foreach($e_team as $v)
|
||||
if($count>0)
|
||||
{
|
||||
$count--;
|
||||
$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;"));
|
||||
if(!$us) {$bot= mysql_fetch_array(mysql_query ("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;"));$b_maxhp=mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;"));$b_maxhp=$b_maxhp['maxhp'];}
|
||||
//dmg=base+INT/LVL+X_magic
|
||||
$dmg=$basedmg+($user['intel']/4)+$user[$sel];
|
||||
//MF
|
||||
$dmg*=$elem_align[$user_elem][$elem];
|
||||
if($us) $dmg*=$elem_bonus[element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2)))][element(star_sign(substr($us['borndate'],3,2), substr($us['borndate'],0,2)))];
|
||||
//- MF
|
||||
if($us) {
|
||||
$def=magic_def($elem,$_POST['target'],$user_elem);$dmg*=(1-magic_def($elem,$us['login'],$user_elem,1)/100);
|
||||
$dmg-=$def;
|
||||
}
|
||||
//rand +- 25%
|
||||
$dmg=mt_rand(0.75*$dmg,1.25*$dmg);
|
||||
$dmg=round($dmg);
|
||||
if($us) $target=$us['id'];
|
||||
else $target=$bot['id'];
|
||||
|
||||
$targeted='';
|
||||
//dmg >0 - go
|
||||
$all_dmg=unserialize($bat['damage']);
|
||||
$all_exp=unserialize($bat['exp']);
|
||||
$all_dmg[$user['id']]+=$dmg;
|
||||
$all_exp[$user['id']]+=SolveExp($user['id'],$target,$dmg);
|
||||
|
||||
//сработало
|
||||
if($dmg>0) $hit=1; else $hit=0;
|
||||
$action=preg_replace("/Х/",Nick::id($target)->short(),magic_log($elem,$hit,$target));
|
||||
if(!(($us['id']>0 && $us['hp']<1) || ($bot['id']>0 && $bot['hp']<1)))
|
||||
if($dmg>0)
|
||||
{
|
||||
if($us)
|
||||
mysql_query("UPDATE `users` SET `hp` = `hp`-'".$dmg."' WHERE `id` = '".$target."';");
|
||||
else
|
||||
mysql_query("UPDATE `bots` SET `hp` = `hp`-'".$dmg."' WHERE `id` = '".$target."';");
|
||||
mysql_query("UPDATE `battle` SET `damage`='".serialize($all_dmg)."', `exp`='".serialize($all_exp)."' WHERE `id`='{$user['battle']}';");
|
||||
|
||||
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.$action.' <strong>-'.$dmg.'</strong><BR>');
|
||||
|
||||
$bet=1;
|
||||
}
|
||||
else
|
||||
//не сработало
|
||||
{
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.$action.'<BR>');
|
||||
$bet=1;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet=1;
|
||||
}
|
||||
}
|
||||
|
@ -1,125 +0,0 @@
|
||||
<?php
|
||||
//параметры
|
||||
$basedmg=110;
|
||||
$needmana=80;
|
||||
$needint=120;
|
||||
$elem='e';
|
||||
$t_min=3;
|
||||
$t_max=7;
|
||||
$count=mt_rand($t_min,$t_max);
|
||||
$mag_id=107;
|
||||
$log_text="<strong><font color=#086604>Каменный Дождь [3]</font></strong>";
|
||||
$book=909;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
if (empty($_SESSION['uid'])) {
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;"));
|
||||
$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
//mana needed
|
||||
$t1 = explode(";",$bat['t1']);
|
||||
$t2 = explode(";",$bat['t2']);
|
||||
if(in_array($user['id'],$t1)) $e_team=$t2;
|
||||
if(in_array($user['id'],$t2)) $e_team=$t1;
|
||||
shuffle($e_team);
|
||||
|
||||
if ($user['battle'] == 0) {
|
||||
echo "Это боевая магия...";
|
||||
} elseif (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif ($user['mana']<$needmana) {
|
||||
echo "Недостаточно энергии!";
|
||||
} else {
|
||||
//attack script
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int=$magic['chanse'] + ($user['intel'] - $needint)*3;
|
||||
if ($int>98){$int=99;}
|
||||
}
|
||||
else {$int=0;}
|
||||
|
||||
if (rand(1,100) < $int) {
|
||||
global $elem_align,$elem_bonus;
|
||||
$user_elem=element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2)));
|
||||
|
||||
switch($user_elem)
|
||||
{
|
||||
case 'f':$uel='mfire';break;
|
||||
case 'a':$uel='mair';break;
|
||||
case 'w':$uel='mwater';break;
|
||||
case 'e':$uel='mearth';break;
|
||||
}
|
||||
switch($elem)
|
||||
{
|
||||
case 'f':$sel='mfire';break;
|
||||
case 'a':$sel='mair';break;
|
||||
case 'w':$sel='mwater';break;
|
||||
case 'e':$sel='mearth';break;
|
||||
}
|
||||
$sex_action="применил";if($user['sex']==0) $sex_action.="а";
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.Nick::id($user['id'])->short().' '.$sex_action.$targeted.' заклинание '.$log_text.'<BR>');
|
||||
|
||||
//mass magic
|
||||
mysql_query ("UPDATE `users` SET `mana` = `mana`-'".$needmana."' WHERE `id` = '".$user['id']."';");
|
||||
foreach($e_team as $v)
|
||||
if($count>0)
|
||||
{
|
||||
$count--;
|
||||
$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;"));
|
||||
if(!$us) {$bot= mysql_fetch_array(mysql_query ("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;"));$b_maxhp=mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;"));$b_maxhp=$b_maxhp['maxhp'];}
|
||||
//dmg=base+INT/LVL+X_magic
|
||||
$dmg=$basedmg+($user['intel']/4)+$user[$sel];
|
||||
//MF
|
||||
$dmg*=$elem_align[$user_elem][$elem];
|
||||
if($us) $dmg*=$elem_bonus[element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2)))][element(star_sign(substr($us['borndate'],3,2), substr($us['borndate'],0,2)))];
|
||||
//- MF
|
||||
if($us) {
|
||||
$def=magic_def($elem,$_POST['target'],$user_elem);$dmg*=(1-magic_def($elem,$us['login'],$user_elem,1)/100);
|
||||
$dmg-=$def;
|
||||
}
|
||||
//rand +- 25%
|
||||
$dmg=mt_rand(0.75*$dmg,1.25*$dmg);
|
||||
$dmg=round($dmg);
|
||||
if($us) $target=$us['id'];
|
||||
else $target=$bot['id'];
|
||||
|
||||
$targeted='';
|
||||
//dmg >0 - go
|
||||
$all_dmg=unserialize($bat['damage']);
|
||||
$all_exp=unserialize($bat['exp']);
|
||||
$all_dmg[$user['id']]+=$dmg;
|
||||
$all_exp[$user['id']]+=SolveExp($user['id'],$target,$dmg);
|
||||
|
||||
//сработало
|
||||
if($dmg>0) $hit=1; else $hit=0;
|
||||
$action=preg_replace("/Х/",Nick::id($target)->short(),magic_log($elem,$hit,$target));
|
||||
if(!(($us['id']>0 && $us['hp']<1) || ($bot['id']>0 && $bot['hp']<1)))
|
||||
if($dmg>0)
|
||||
{
|
||||
if($us)
|
||||
mysql_query("UPDATE `users` SET `hp` = `hp`-'".$dmg."' WHERE `id` = '".$target."';");
|
||||
else
|
||||
mysql_query("UPDATE `bots` SET `hp` = `hp`-'".$dmg."' WHERE `id` = '".$target."';");
|
||||
mysql_query("UPDATE `battle` SET `damage`='".serialize($all_dmg)."', `exp`='".serialize($all_exp)."' WHERE `id`='{$user['battle']}';");
|
||||
|
||||
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.$action.' <strong>-'.$dmg.'</strong><BR>');
|
||||
|
||||
$bet=1;
|
||||
}
|
||||
else
|
||||
//не сработало
|
||||
{
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.$action.'<BR>');
|
||||
$bet=1;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet=1;
|
||||
}
|
||||
}
|
||||
|
@ -1,152 +0,0 @@
|
||||
<?php
|
||||
//параметры
|
||||
$basedmg = 110;
|
||||
$needmana = 20;
|
||||
$needint = 80;
|
||||
$elem = 'e';
|
||||
$mag_id = 96;
|
||||
$log_text = "<strong><font color=#086604>Метеорит [1]</font></strong>";
|
||||
$book = 866;
|
||||
$have_book = mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
|
||||
if (empty($_SESSION['uid'])) {
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= " . (time() - 60) . " AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;"));
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;"));
|
||||
$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
if (!$us) $bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `name` = '" . $_POST['target'] . "' LIMIT 1;"));
|
||||
//mana needed
|
||||
$t1 = explode(";", $bat['t1']);
|
||||
$t2 = explode(";", $bat['t2']);
|
||||
if ($us) $e_id = $us['id'];
|
||||
else $e_id = $bot['id'];
|
||||
if ($user['battle'] == 0) {
|
||||
echo "Это боевая магия...";
|
||||
} elseif (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif ((in_array($user['id'], $t1) && in_array($e_id, $t1)) || (in_array($user['id'], $t2) && in_array($e_id, $t2))) {
|
||||
echo "Персонаж в Вашей команде!";
|
||||
} elseif ($user['login'] == $_POST['target']) {
|
||||
echo "Герр Леопольд фон Захер Мазох был бы доволен Вами...";
|
||||
} elseif ($us && $us['battle'] != $user['battle']) {
|
||||
echo "Персонаж не в Вашем бою!";
|
||||
} elseif ($user['mana'] < $needmana) {
|
||||
echo "Недостаточно энергии!";
|
||||
} elseif (!$us['online'] && !$bot) {
|
||||
echo "Персонаж не в игре!";
|
||||
} else {
|
||||
//attack script
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int = $magic['chanse'] + ($user['intel'] - $needint) * 3;
|
||||
if ($int > 98) {
|
||||
$int = 99;
|
||||
}
|
||||
} else {
|
||||
$int = 0;
|
||||
}
|
||||
|
||||
if (rand(1, 100) < $int) {
|
||||
global $elem_align, $elem_bonus;
|
||||
|
||||
$user_elem = element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)));
|
||||
|
||||
switch ($user_elem) {
|
||||
case 'f':
|
||||
$uel = 'mfire';
|
||||
break;
|
||||
case 'a':
|
||||
$uel = 'mair';
|
||||
break;
|
||||
case 'w':
|
||||
$uel = 'mwater';
|
||||
break;
|
||||
case 'e':
|
||||
$uel = 'mearth';
|
||||
break;
|
||||
}
|
||||
switch ($elem) {
|
||||
case 'f':
|
||||
$sel = 'mfire';
|
||||
break;
|
||||
case 'a':
|
||||
$sel = 'mair';
|
||||
break;
|
||||
case 'w':
|
||||
$sel = 'mwater';
|
||||
break;
|
||||
case 'e':
|
||||
$sel = 'mearth';
|
||||
break;
|
||||
}
|
||||
//dmg=base+INT/LVL+X_magic
|
||||
$dmg = $basedmg + ($user['intel'] / 4) + $user[$sel];
|
||||
//MF
|
||||
$dmg *= $elem_align[$user_elem][$elem];
|
||||
if ($us) $dmg *= $elem_bonus[element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)))][element(star_sign(substr($us['borndate'], 3, 2), substr($us['borndate'], 0, 2)))];
|
||||
//- MF
|
||||
if ($us) {
|
||||
$def = magic_def($elem, $_POST['target'], $user_elem);
|
||||
$dmg *= (1 - magic_def($elem, $us['login'], $user_elem, 1) / 100);
|
||||
$dmg -= $def;
|
||||
}
|
||||
|
||||
//rand +- 25%
|
||||
$dmg = mt_rand(0.75 * $dmg, 1.25 * $dmg);
|
||||
$dmg = round($dmg);
|
||||
if ($us) $target = $us['id'];
|
||||
else $target = $bot['id'];
|
||||
// команды
|
||||
$t1 = explode(";", $bat['t1']);
|
||||
$t2 = explode(";", $bat['t2']);
|
||||
if (in_array($user['id'], $t1)) {
|
||||
$us_team = "B1";
|
||||
$tar_team = "B2";
|
||||
} else {
|
||||
$us_team = "B2";
|
||||
$tar_team = "B1";
|
||||
}
|
||||
|
||||
$targeted = ' на ' . Nick::id($target)->short();
|
||||
//dmg >0 - go
|
||||
$all_dmg = unserialize($bat['damage']);
|
||||
$all_exp = unserialize($bat['exp']);
|
||||
$all_dmg[$user['id']] += $dmg;
|
||||
$all_exp[$user['id']] += SolveExp($user['id'], $target, $dmg);
|
||||
$sex_action = "применил";
|
||||
if ($user['sex'] == 0) $sex_action .= "а";
|
||||
if (!(($us['id'] > 0 && $us['hp'] < 1) || ($bot['id'] > 0 && $bot['hp'] < 1)))
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . Nick::id($user['id'])->short() . ' ' . $sex_action . $targeted . ' заклинание ' . $log_text . '<BR>');
|
||||
else
|
||||
echo "Не нарушайте покой мертвых!";
|
||||
//сработало
|
||||
if ($dmg > 0) $hit = 1; else $hit = 0;
|
||||
$action = preg_replace("/Х/", Nick::id($target)->short(), magic_log($elem, $hit, $target));
|
||||
//проверка hp>0
|
||||
if (!(($us['id'] > 0 && $us['hp'] < 1) || ($bot['id'] > 0 && $bot['hp'] < 1)))
|
||||
if ($dmg > 0) {
|
||||
if ($us)
|
||||
mysql_query("UPDATE `users` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';");
|
||||
else
|
||||
mysql_query("UPDATE `bots` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';");
|
||||
mysql_query("UPDATE `battle` SET `damage`='" . serialize($all_dmg) . "', `exp`='" . serialize($all_exp) . "' WHERE `id`='{$user['battle']}';");
|
||||
mysql_query("UPDATE `users` SET `mana` = `mana`-'" . $needmana . "' WHERE `id` = '" . $user['id'] . "';");
|
||||
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . $action . ' <strong>-' . $dmg . '</strong><BR>');
|
||||
|
||||
$bet = 1;
|
||||
} else //не сработало
|
||||
{
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . $action . '<BR>');
|
||||
$bet = 1;
|
||||
}
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet = 1;
|
||||
}
|
||||
}
|
||||
|
@ -1,152 +0,0 @@
|
||||
<?php
|
||||
//параметры
|
||||
$basedmg = 150;
|
||||
$needmana = 35;
|
||||
$needint = 100;
|
||||
$elem = 'e';
|
||||
$mag_id = 97;
|
||||
$log_text = "<strong><font color=#086604>Метеорит [2]</font></strong>";
|
||||
$book = 908;
|
||||
$have_book = mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
|
||||
if (empty($_SESSION['uid'])) {
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= " . (time() - 60) . " AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;"));
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;"));
|
||||
$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
if (!$us) $bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `name` = '" . $_POST['target'] . "' LIMIT 1;"));
|
||||
//mana needed
|
||||
$t1 = explode(";", $bat['t1']);
|
||||
$t2 = explode(";", $bat['t2']);
|
||||
if ($us) $e_id = $us['id'];
|
||||
else $e_id = $bot['id'];
|
||||
if ($user['battle'] == 0) {
|
||||
echo "Это боевая магия...";
|
||||
} elseif (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif ((in_array($user['id'], $t1) && in_array($e_id, $t1)) || (in_array($user['id'], $t2) && in_array($e_id, $t2))) {
|
||||
echo "Персонаж в Вашей команде!";
|
||||
} elseif ($user['login'] == $_POST['target']) {
|
||||
echo "Герр Леопольд фон Захер Мазох был бы доволен Вами...";
|
||||
} elseif ($us && $us['battle'] != $user['battle']) {
|
||||
echo "Персонаж не в Вашем бою!";
|
||||
} elseif ($user['mana'] < $needmana) {
|
||||
echo "Недостаточно энергии!";
|
||||
} elseif (!$us['online'] && !$bot) {
|
||||
echo "Персонаж не в игре!";
|
||||
} else {
|
||||
//attack script
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int = $magic['chanse'] + ($user['intel'] - $needint) * 3;
|
||||
if ($int > 98) {
|
||||
$int = 99;
|
||||
}
|
||||
} else {
|
||||
$int = 0;
|
||||
}
|
||||
|
||||
if (rand(1, 100) < $int) {
|
||||
global $elem_align, $elem_bonus;
|
||||
|
||||
$user_elem = element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)));
|
||||
|
||||
switch ($user_elem) {
|
||||
case 'f':
|
||||
$uel = 'mfire';
|
||||
break;
|
||||
case 'a':
|
||||
$uel = 'mair';
|
||||
break;
|
||||
case 'w':
|
||||
$uel = 'mwater';
|
||||
break;
|
||||
case 'e':
|
||||
$uel = 'mearth';
|
||||
break;
|
||||
}
|
||||
switch ($elem) {
|
||||
case 'f':
|
||||
$sel = 'mfire';
|
||||
break;
|
||||
case 'a':
|
||||
$sel = 'mair';
|
||||
break;
|
||||
case 'w':
|
||||
$sel = 'mwater';
|
||||
break;
|
||||
case 'e':
|
||||
$sel = 'mearth';
|
||||
break;
|
||||
}
|
||||
//dmg=base+INT/LVL+X_magic
|
||||
$dmg = $basedmg + ($user['intel'] / 4) + $user[$sel];
|
||||
//MF
|
||||
$dmg *= $elem_align[$user_elem][$elem];
|
||||
if ($us) $dmg *= $elem_bonus[element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)))][element(star_sign(substr($us['borndate'], 3, 2), substr($us['borndate'], 0, 2)))];
|
||||
//- MF
|
||||
if ($us) {
|
||||
$def = magic_def($elem, $_POST['target'], $user_elem);
|
||||
$dmg *= (1 - magic_def($elem, $us['login'], $user_elem, 1) / 100);
|
||||
$dmg -= $def;
|
||||
}
|
||||
|
||||
//rand +- 25%
|
||||
$dmg = mt_rand(0.75 * $dmg, 1.25 * $dmg);
|
||||
$dmg = round($dmg);
|
||||
if ($us) $target = $us['id'];
|
||||
else $target = $bot['id'];
|
||||
// команды
|
||||
$t1 = explode(";", $bat['t1']);
|
||||
$t2 = explode(";", $bat['t2']);
|
||||
if (in_array($user['id'], $t1)) {
|
||||
$us_team = "B1";
|
||||
$tar_team = "B2";
|
||||
} else {
|
||||
$us_team = "B2";
|
||||
$tar_team = "B1";
|
||||
}
|
||||
|
||||
$targeted = ' на ' . Nick::id($target)->short();
|
||||
//dmg >0 - go
|
||||
$all_dmg = unserialize($bat['damage']);
|
||||
$all_exp = unserialize($bat['exp']);
|
||||
$all_dmg[$user['id']] += $dmg;
|
||||
$all_exp[$user['id']] += SolveExp($user['id'], $target, $dmg);
|
||||
$sex_action = "применил";
|
||||
if ($user['sex'] == 0) $sex_action .= "а";
|
||||
if (!(($us['id'] > 0 && $us['hp'] < 1) || ($bot['id'] > 0 && $bot['hp'] < 1)))
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . Nick::id($user['id'])->short() . ' ' . $sex_action . $targeted . ' заклинание ' . $log_text . '<BR>');
|
||||
else
|
||||
echo "Не нарушайте покой мертвых!";
|
||||
//сработало
|
||||
if ($dmg > 0) $hit = 1; else $hit = 0;
|
||||
$action = preg_replace("/Х/", Nick::id($target)->short(), magic_log($elem, $hit, $target));
|
||||
//проверка hp>0
|
||||
if (!(($us['id'] > 0 && $us['hp'] < 1) || ($bot['id'] > 0 && $bot['hp'] < 1)))
|
||||
if ($dmg > 0) {
|
||||
if ($us)
|
||||
mysql_query("UPDATE `users` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';");
|
||||
else
|
||||
mysql_query("UPDATE `bots` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';");
|
||||
mysql_query("UPDATE `battle` SET `damage`='" . serialize($all_dmg) . "', `exp`='" . serialize($all_exp) . "' WHERE `id`='{$user['battle']}';");
|
||||
mysql_query("UPDATE `users` SET `mana` = `mana`-'" . $needmana . "' WHERE `id` = '" . $user['id'] . "';");
|
||||
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . $action . ' <strong>-' . $dmg . '</strong><BR>');
|
||||
|
||||
$bet = 1;
|
||||
} else //не сработало
|
||||
{
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . $action . '<BR>');
|
||||
$bet = 1;
|
||||
}
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet = 1;
|
||||
}
|
||||
}
|
||||
|
@ -1,152 +0,0 @@
|
||||
<?php
|
||||
//параметры
|
||||
$basedmg = 300;
|
||||
$needmana = 50;
|
||||
$needint = 120;
|
||||
$elem = 'e';
|
||||
$mag_id = 98;
|
||||
$log_text = "<strong><font color=#086604>Метеорит [3]</font></strong>";
|
||||
$book = 909;
|
||||
$have_book = mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
|
||||
if (empty($_SESSION['uid'])) {
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= " . (time() - 60) . " AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;"));
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;"));
|
||||
$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
if (!$us) $bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `name` = '" . $_POST['target'] . "' LIMIT 1;"));
|
||||
//mana needed
|
||||
$t1 = explode(";", $bat['t1']);
|
||||
$t2 = explode(";", $bat['t2']);
|
||||
if ($us) $e_id = $us['id'];
|
||||
else $e_id = $bot['id'];
|
||||
if ($user['battle'] == 0) {
|
||||
echo "Это боевая магия...";
|
||||
} elseif (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif ((in_array($user['id'], $t1) && in_array($e_id, $t1)) || (in_array($user['id'], $t2) && in_array($e_id, $t2))) {
|
||||
echo "Персонаж в Вашей команде!";
|
||||
} elseif ($user['login'] == $_POST['target']) {
|
||||
echo "Герр Леопольд фон Захер Мазох был бы доволен Вами...";
|
||||
} elseif ($us && $us['battle'] != $user['battle']) {
|
||||
echo "Персонаж не в Вашем бою!";
|
||||
} elseif ($user['mana'] < $needmana) {
|
||||
echo "Недостаточно энергии!";
|
||||
} elseif (!$us['online'] && !$bot) {
|
||||
echo "Персонаж не в игре!";
|
||||
} else {
|
||||
//attack script
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int = $magic['chanse'] + ($user['intel'] - $needint) * 3;
|
||||
if ($int > 98) {
|
||||
$int = 99;
|
||||
}
|
||||
} else {
|
||||
$int = 0;
|
||||
}
|
||||
|
||||
if (rand(1, 100) < $int) {
|
||||
global $elem_align, $elem_bonus;
|
||||
|
||||
$user_elem = element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)));
|
||||
|
||||
switch ($user_elem) {
|
||||
case 'f':
|
||||
$uel = 'mfire';
|
||||
break;
|
||||
case 'a':
|
||||
$uel = 'mair';
|
||||
break;
|
||||
case 'w':
|
||||
$uel = 'mwater';
|
||||
break;
|
||||
case 'e':
|
||||
$uel = 'mearth';
|
||||
break;
|
||||
}
|
||||
switch ($elem) {
|
||||
case 'f':
|
||||
$sel = 'mfire';
|
||||
break;
|
||||
case 'a':
|
||||
$sel = 'mair';
|
||||
break;
|
||||
case 'w':
|
||||
$sel = 'mwater';
|
||||
break;
|
||||
case 'e':
|
||||
$sel = 'mearth';
|
||||
break;
|
||||
}
|
||||
//dmg=base+INT/LVL+X_magic
|
||||
$dmg = $basedmg + ($user['intel'] / 4) + $user[$sel];
|
||||
//MF
|
||||
$dmg *= $elem_align[$user_elem][$elem];
|
||||
if ($us) $dmg *= $elem_bonus[element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)))][element(star_sign(substr($us['borndate'], 3, 2), substr($us['borndate'], 0, 2)))];
|
||||
//- MF
|
||||
if ($us) {
|
||||
$def = magic_def($elem, $_POST['target'], $user_elem);
|
||||
$dmg *= (1 - magic_def($elem, $us['login'], $user_elem, 1) / 100);
|
||||
$dmg -= $def;
|
||||
}
|
||||
|
||||
//rand +- 25%
|
||||
$dmg = mt_rand(0.75 * $dmg, 1.25 * $dmg);
|
||||
$dmg = round($dmg);
|
||||
if ($us) $target = $us['id'];
|
||||
else $target = $bot['id'];
|
||||
// команды
|
||||
$t1 = explode(";", $bat['t1']);
|
||||
$t2 = explode(";", $bat['t2']);
|
||||
if (in_array($user['id'], $t1)) {
|
||||
$us_team = "B1";
|
||||
$tar_team = "B2";
|
||||
} else {
|
||||
$us_team = "B2";
|
||||
$tar_team = "B1";
|
||||
}
|
||||
|
||||
$targeted = ' на ' . Nick::id($target)->short();
|
||||
//dmg >0 - go
|
||||
$all_dmg = unserialize($bat['damage']);
|
||||
$all_exp = unserialize($bat['exp']);
|
||||
$all_dmg[$user['id']] += $dmg;
|
||||
$all_exp[$user['id']] += SolveExp($user['id'], $target, $dmg);
|
||||
$sex_action = "применил";
|
||||
if ($user['sex'] == 0) $sex_action .= "а";
|
||||
if (!(($us['id'] > 0 && $us['hp'] < 1) || ($bot['id'] > 0 && $bot['hp'] < 1)))
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . Nick::id($user['id'])->short() . ' ' . $sex_action . $targeted . ' заклинание ' . $log_text . '<BR>');
|
||||
else
|
||||
echo "Не нарушайте покой мертвых!";
|
||||
//сработало
|
||||
if ($dmg > 0) $hit = 1; else $hit = 0;
|
||||
$action = preg_replace("/Х/", Nick::id($target)->short(), magic_log($elem, $hit, $target));
|
||||
//проверка hp>0
|
||||
if (!(($us['id'] > 0 && $us['hp'] < 1) || ($bot['id'] > 0 && $bot['hp'] < 1)))
|
||||
if ($dmg > 0) {
|
||||
if ($us)
|
||||
mysql_query("UPDATE `users` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';");
|
||||
else
|
||||
mysql_query("UPDATE `bots` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';");
|
||||
mysql_query("UPDATE `battle` SET `damage`='" . serialize($all_dmg) . "', `exp`='" . serialize($all_exp) . "' WHERE `id`='{$user['battle']}';");
|
||||
mysql_query("UPDATE `users` SET `mana` = `mana`-'" . $needmana . "' WHERE `id` = '" . $user['id'] . "';");
|
||||
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . $action . ' <strong>-' . $dmg . '</strong><BR>');
|
||||
|
||||
$bet = 1;
|
||||
} else //не сработало
|
||||
{
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . $action . '<BR>');
|
||||
$bet = 1;
|
||||
}
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet = 1;
|
||||
}
|
||||
}
|
||||
|
@ -1,44 +0,0 @@
|
||||
<?php
|
||||
|
||||
//параметры
|
||||
$needint=0;
|
||||
$effect_id=221;
|
||||
$effect_text="Огненный Щит [1]";
|
||||
$log_text="<strong><font color=#df0d0d>Огненный Щит [1]</font></strong>";
|
||||
$mag_id=132;
|
||||
$book=866;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `date` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '".mysql_real_escape_string($_POST['target'])."' LIMIT 1;"));
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' ;"));
|
||||
|
||||
$mag_def="`type` = '215'";
|
||||
$md_arr=array("216","217","218","219","220","221","222","223","224","225","226");
|
||||
foreach($md_arr as $mdi)
|
||||
$mag_def.=" OR `type` = '".$mdi."'";
|
||||
$effect = mysql_fetch_array(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '{$us['id']}' AND ({$mag_def}) LIMIT 1;"));
|
||||
//шансы
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int=$magic['chanse'] + ($user['intel'] - $needint)*3;
|
||||
if ($int>98){$int=99;}
|
||||
}
|
||||
else {$int=0;}
|
||||
|
||||
if (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif ($effect['time']) {
|
||||
echo "На персонаже уже есть защита от магии!";
|
||||
} elseif (!$us['online']) {
|
||||
echo "Персонаж не в игре!";
|
||||
} elseif ($user['battle'] > 0) { echo "Не в бою...";
|
||||
} elseif (rand(1,100) < $int) {
|
||||
$us_in = mysql_fetch_array(mysql_query("SELECT `id` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;"));
|
||||
mysql_query("INSERT INTO `effects` (`owner`,`name`,`time`,`type`) values ('{$us_in['id']}','{$effect_text}',".(time()+7200).",'{$effect_id}');");
|
||||
echo "<font color=red><b>На персонажа ".$_POST['target']." наложено заклятие </b></font>".$log_text;
|
||||
$bet=1;
|
||||
$outok=1;
|
||||
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet=1;
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
<?php
|
||||
|
||||
//параметры
|
||||
$needint=0;
|
||||
$effect_id=222;
|
||||
$effect_text="Огненный Щит [2]";
|
||||
$log_text="<strong><font color=#df0d0d>Огненный Щит [2]</font></strong>";
|
||||
$mag_id=133;
|
||||
$book=908;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `date` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '".mysql_real_escape_string($_POST['target'])."' LIMIT 1;"));
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' ;"));
|
||||
|
||||
$mag_def="`type` = '215'";
|
||||
$md_arr=array("216","217","218","219","220","221","222","223","224","225","226");
|
||||
foreach($md_arr as $mdi)
|
||||
$mag_def.=" OR `type` = '".$mdi."'";
|
||||
$effect = mysql_fetch_array(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '{$us['id']}' AND ({$mag_def}) LIMIT 1;"));
|
||||
//шансы
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int=$magic['chanse'] + ($user['intel'] - $needint)*3;
|
||||
if ($int>98){$int=99;}
|
||||
}
|
||||
else {$int=0;}
|
||||
|
||||
if (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif ($effect['time']) {
|
||||
echo "На персонаже уже есть защита от магии!";
|
||||
} elseif (!$us['online']) {
|
||||
echo "Персонаж не в игре!";
|
||||
} elseif ($user['battle'] > 0) { echo "Не в бою...";
|
||||
} elseif (rand(1,100) < $int) {
|
||||
$us_in = mysql_fetch_array(mysql_query("SELECT `id` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;"));
|
||||
mysql_query("INSERT INTO `effects` (`owner`,`name`,`time`,`type`) values ('{$us_in['id']}','{$effect_text}',".(time()+7200).",'{$effect_id}');");
|
||||
echo "<font color=red><b>На персонажа ".$_POST['target']." наложено заклятие </b></font>".$log_text;
|
||||
$bet=1;
|
||||
$outok=1;
|
||||
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet=1;
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
<?php
|
||||
|
||||
//параметры
|
||||
$needint=0;
|
||||
$effect_id=223;
|
||||
$effect_text="Огненный Щит [3]";
|
||||
$log_text="<strong><font color=#df0d0d>Огненный Щит [3]</font></strong>";
|
||||
$mag_id=134;
|
||||
$book=909;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `date` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '".mysql_real_escape_string($_POST['target'])."' LIMIT 1;"));
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' ;"));
|
||||
|
||||
$mag_def="`type` = '215'";
|
||||
$md_arr=array("216","217","218","219","220","221","222","223","224","225","226");
|
||||
foreach($md_arr as $mdi)
|
||||
$mag_def.=" OR `type` = '".$mdi."'";
|
||||
$effect = mysql_fetch_array(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '{$us['id']}' AND ({$mag_def}) LIMIT 1;"));
|
||||
//шансы
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int=$magic['chanse'] + ($user['intel'] - $needint)*3;
|
||||
if ($int>98){$int=99;}
|
||||
}
|
||||
else {$int=0;}
|
||||
|
||||
if (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif ($effect['time']) {
|
||||
echo "На персонаже уже есть защита от магии!";
|
||||
} elseif (!$us['online']) {
|
||||
echo "Персонаж не в игре!";
|
||||
} elseif ($user['battle'] > 0) { echo "Не в бою...";
|
||||
} elseif (rand(1,100) < $int) {
|
||||
$us_in = mysql_fetch_array(mysql_query("SELECT `id` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;"));
|
||||
mysql_query("INSERT INTO `effects` (`owner`,`name`,`time`,`type`) values ('{$us_in['id']}','{$effect_text}',".(time()+7200).",'{$effect_id}');");
|
||||
echo "<font color=red><b>На персонажа ".$_POST['target']." наложено заклятие </b></font>".$log_text;
|
||||
$bet=1;
|
||||
$outok=1;
|
||||
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet=1;
|
||||
}
|
@ -1,69 +0,0 @@
|
||||
<?php
|
||||
|
||||
//параметры
|
||||
$needmana=60;
|
||||
$needint=60;
|
||||
$effect_id=209;
|
||||
$effect_text="Стена Огня [1]";
|
||||
$log_text="<strong><font color=#df0d0d>Стена Огня [1]</font></strong>";
|
||||
$mag_id=84;
|
||||
$book=866;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `date` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '".mysql_real_escape_string($_POST['target'])."' LIMIT 1;"));
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' ;"));
|
||||
$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
$mag_def="`type` = '203'";
|
||||
$md_arr=array("204","205",
|
||||
"206","207","208",
|
||||
"209","210","211",
|
||||
"212","213","214");
|
||||
foreach($md_arr as $mdi)
|
||||
$mag_def.=" OR `type` = '".$mdi."'";
|
||||
$effect = mysql_fetch_array(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '{$us['id']}' AND ({$mag_def}) LIMIT 1;"));
|
||||
// команды
|
||||
$t1 = explode(";",$bat['t1']);
|
||||
$t2 = explode(";",$bat['t2']);
|
||||
if (in_array ($user['id'],$t1)) {
|
||||
$us_team = "B1";
|
||||
}
|
||||
else {
|
||||
$us_team = "B2";
|
||||
}
|
||||
//шансы
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int=$magic['chanse'] + ($user['intel'] - $needint)*3;
|
||||
if ($int>98){$int=99;}
|
||||
}
|
||||
else {$int=0;}
|
||||
|
||||
if ($user['battle'] == 0) {
|
||||
echo "Это боевая магия...";
|
||||
} elseif (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif (in_array ($user['id'],$t1)&&!in_array($us['id'],$t1) || in_array ($user['id'],$t2)&&!in_array($us['id'],$t2)) {
|
||||
echo("Персонаж не в Вашей команде!");
|
||||
}elseif ($us && $us['battle']!=$user['battle']) {
|
||||
echo "Персонаж не в Вашем бою!";
|
||||
} elseif ($user['mana']<$needmana) {
|
||||
echo "Недостаточно энергии!";
|
||||
} elseif ($effect['time']) {
|
||||
echo "На персонаже уже есть защита от магии!";
|
||||
} elseif (!$us['online']) {
|
||||
echo "Персонаж не в игре!";
|
||||
} elseif (rand(1,100) < $int) {
|
||||
$us_in = mysql_fetch_array(mysql_query("SELECT `id` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;"));
|
||||
mysql_query("INSERT INTO `effects` (`owner`,`name`,`time`,`type`) values ('{$us_in['id']}','{$effect_text}',".(time()+7200).",'{$effect_id}');");
|
||||
echo "<font color=red><b>На персонажа ".$_POST['target']." наложено заклятие </b></font>".$log_text;
|
||||
$sex_action="применил";if($user['sex']==0) $sex_action.="а";
|
||||
if($user['id']==$us_in['id'])
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.Nick::id($user['id'])->short().' '.$sex_action.' на себя заклятие </font></b>'.$log_text.' <BR>');
|
||||
else
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.Nick::id($user['id'])->short().' '.$sex_action.' на '.Nick::id($us_in['id'])->short().' заклятие </font></b>'.$log_text.' <BR>');
|
||||
$bet=1;
|
||||
mysql_query ("UPDATE `users` SET `mana` = `mana`-'".$needmana."' WHERE `id` = '".$user['id']."';");$outok=1;
|
||||
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet=1;
|
||||
}
|
@ -1,70 +0,0 @@
|
||||
<?php
|
||||
|
||||
//параметры
|
||||
$needmana=65;
|
||||
$needint=80;
|
||||
$effect_id=210;
|
||||
$effect_text="Стена Огня [2]";
|
||||
$log_text="<strong><font color=#df0d0d>Стена Огня [2]</font></strong>";
|
||||
$mag_id=85;
|
||||
$book=908;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `date` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '".mysql_real_escape_string($_POST['target'])."' LIMIT 1;"));
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' ;"));
|
||||
$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
$mag_def="`type` = '203'";
|
||||
$md_arr=array("204","205",
|
||||
"206","207","208",
|
||||
"209","210","211",
|
||||
"212","213","214");
|
||||
foreach($md_arr as $mdi)
|
||||
$mag_def.=" OR `type` = '".$mdi."'";
|
||||
$effect = mysql_fetch_array(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '{$us['id']}' AND ({$mag_def}) LIMIT 1;"));
|
||||
// команды
|
||||
$t1 = explode(";",$bat['t1']);
|
||||
$t2 = explode(";",$bat['t2']);
|
||||
if (in_array ($user['id'],$t1)) {
|
||||
$us_team = "B1";
|
||||
}
|
||||
else {
|
||||
$us_team = "B2";
|
||||
}
|
||||
//шансы
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int=$magic['chanse'] + ($user['intel'] - $needint)*3;
|
||||
if ($int>98){$int=99;}
|
||||
}
|
||||
else {$int=0;}
|
||||
|
||||
if ($user['battle'] == 0) {
|
||||
echo "Это боевая магия...";
|
||||
} elseif (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif (in_array ($user['id'],$t1)&&!in_array($us['id'],$t1) || in_array ($user['id'],$t2)&&!in_array($us['id'],$t2)) {
|
||||
echo("Персонаж не в Вашей команде!");
|
||||
}elseif ($us && $us['battle']!=$user['battle']) {
|
||||
echo "Персонаж не в Вашем бою!";
|
||||
} elseif ($user['mana']<$needmana) {
|
||||
echo "Недостаточно энергии!";
|
||||
} elseif ($effect['time']) {
|
||||
echo "На персонаже уже есть защита от магии!";
|
||||
} elseif (!$us['online']) {
|
||||
echo "Персонаж не в игре!";
|
||||
} elseif (rand(1,100) < $int) {
|
||||
$us_in = mysql_fetch_array(mysql_query("SELECT `id` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;"));
|
||||
mysql_query("INSERT INTO `effects` (`owner`,`name`,`time`,`type`) values ('{$us_in['id']}','{$effect_text}',".(time()+7200).",'{$effect_id}');");
|
||||
echo "<font color=red><b>На персонажа ".$_POST['target']." наложено заклятие </b></font>".$log_text;
|
||||
$sex_action="применил";if($user['sex']==0) $sex_action.="а";
|
||||
if($user['id']==$us_in['id'])
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.Nick::id($user['id'])->short().' '.$sex_action.' на себя заклятие </font></b>'.$log_text.' <BR>');
|
||||
else
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.Nick::id($user['id'])->short().' '.$sex_action.' на '.Nick::id($us_in['id'])->short().' заклятие </font></b>'.$log_text.' <BR>');
|
||||
$bet=1;
|
||||
mysql_query ("UPDATE `users` SET `mana` = `mana`-'".$needmana."' WHERE `id` = '".$user['id']."';");$outok=1;
|
||||
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet=1;
|
||||
}
|
@ -1,69 +0,0 @@
|
||||
<?php
|
||||
|
||||
//параметры
|
||||
$needmana=80;
|
||||
$needint=100;
|
||||
$effect_id=211;
|
||||
$effect_text="Стена Огня [3]";
|
||||
$log_text="<strong><font color=#df0d0d>Стена Огня [3]</font></strong>";
|
||||
$mag_id=86;
|
||||
$book=909;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `date` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '".mysql_real_escape_string($_POST['target'])."' LIMIT 1;"));
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' ;"));
|
||||
$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
$mag_def="`type` = '203'";
|
||||
$md_arr=array("204","205",
|
||||
"206","207","208",
|
||||
"209","210","211",
|
||||
"212","213","214");
|
||||
foreach($md_arr as $mdi)
|
||||
$mag_def.=" OR `type` = '".$mdi."'";
|
||||
$effect = mysql_fetch_array(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '{$us['id']}' AND ({$mag_def}) LIMIT 1;"));
|
||||
// команды
|
||||
$t1 = explode(";",$bat['t1']);
|
||||
$t2 = explode(";",$bat['t2']);
|
||||
if (in_array ($user['id'],$t1)) {
|
||||
$us_team = "B1";
|
||||
}
|
||||
else {
|
||||
$us_team = "B2";
|
||||
}
|
||||
//шансы
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int=$magic['chanse'] + ($user['intel'] - $needint)*3;
|
||||
if ($int>98){$int=99;}
|
||||
}
|
||||
else {$int=0;}
|
||||
|
||||
if ($user['battle'] == 0) {
|
||||
echo "Это боевая магия...";
|
||||
} elseif (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif (in_array ($user['id'],$t1)&&!in_array($us['id'],$t1) || in_array ($user['id'],$t2)&&!in_array($us['id'],$t2)) {
|
||||
echo("Персонаж не в Вашей команде!");
|
||||
}elseif ($us && $us['battle']!=$user['battle']) {
|
||||
echo "Персонаж не в Вашем бою!";
|
||||
} elseif ($user['mana']<$needmana) {
|
||||
echo "Недостаточно энергии!";
|
||||
} elseif ($effect['time']) {
|
||||
echo "На персонаже уже есть защита от магии!";
|
||||
} elseif (!$us['online']) {
|
||||
echo "Персонаж не в игре!";
|
||||
} elseif (rand(1,100) < $int) {
|
||||
$us_in = mysql_fetch_array(mysql_query("SELECT `id` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;"));
|
||||
mysql_query("INSERT INTO `effects` (`owner`,`name`,`time`,`type`) values ('{$us_in['id']}','{$effect_text}',".(time()+7200).",'{$effect_id}');");
|
||||
echo "<font color=red><b>На персонажа ".$_POST['target']." наложено заклятие </b></font>".$log_text;
|
||||
$sex_action="применил";if($user['sex']==0) $sex_action.="а";
|
||||
if($user['id']==$us_in['id'])
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.Nick::id($user['id'])->short().' '.$sex_action.' на себя заклятие </font></b>'.$log_text.' <BR>');
|
||||
else
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.Nick::id($user['id'])->short().' '.$sex_action.' на '.Nick::id($us_in['id'])->short().' заклятие </font></b>'.$log_text.' <BR>');
|
||||
$bet=1;
|
||||
mysql_query ("UPDATE `users` SET `mana` = `mana`-'".$needmana."' WHERE `id` = '".$user['id']."';");$outok=1;
|
||||
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet=1;
|
||||
}
|
@ -1,145 +0,0 @@
|
||||
<?php
|
||||
//параметры
|
||||
$basedmg = 50;
|
||||
$needmana = 55;
|
||||
$needint = 80;
|
||||
$elem = 'f';
|
||||
$t_min = 3;
|
||||
$t_max = 4;
|
||||
$count = mt_rand($t_min, $t_max);
|
||||
$mag_id = 108;
|
||||
$log_text = "<strong><font color=#df0d0d>Пожирающее Пламя [1]</font></strong>";
|
||||
$book = 866;
|
||||
$have_book = mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
if (empty($_SESSION['uid'])) {
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;"));
|
||||
$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
//mana needed
|
||||
$t1 = explode(";", $bat['t1']);
|
||||
$t2 = explode(";", $bat['t2']);
|
||||
if (in_array($user['id'], $t1)) $e_team = $t2;
|
||||
if (in_array($user['id'], $t2)) $e_team = $t1;
|
||||
shuffle($e_team);
|
||||
|
||||
if ($user['battle'] == 0) {
|
||||
echo "Это боевая магия...";
|
||||
} elseif (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif ($user['mana'] < $needmana) {
|
||||
echo "Недостаточно энергии!";
|
||||
} else {
|
||||
//attack script
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int = $magic['chanse'] + ($user['intel'] - $needint) * 3;
|
||||
if ($int > 98) {
|
||||
$int = 99;
|
||||
}
|
||||
} else {
|
||||
$int = 0;
|
||||
}
|
||||
|
||||
if (rand(1, 100) < $int) {
|
||||
global $elem_align, $elem_bonus;
|
||||
$user_elem = element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)));
|
||||
|
||||
switch ($user_elem) {
|
||||
case 'f':
|
||||
$uel = 'mfire';
|
||||
break;
|
||||
case 'a':
|
||||
$uel = 'mair';
|
||||
break;
|
||||
case 'w':
|
||||
$uel = 'mwater';
|
||||
break;
|
||||
case 'e':
|
||||
$uel = 'mearth';
|
||||
break;
|
||||
}
|
||||
switch ($elem) {
|
||||
case 'f':
|
||||
$sel = 'mfire';
|
||||
break;
|
||||
case 'a':
|
||||
$sel = 'mair';
|
||||
break;
|
||||
case 'w':
|
||||
$sel = 'mwater';
|
||||
break;
|
||||
case 'e':
|
||||
$sel = 'mearth';
|
||||
break;
|
||||
}
|
||||
$sex_action = "применил";
|
||||
if ($user['sex'] == 0) $sex_action .= "а";
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . Nick::id($user['id'])->short() . ' ' . $sex_action . $targeted . ' заклинание ' . $log_text . '<BR>');
|
||||
|
||||
//mass magic
|
||||
mysql_query("UPDATE `users` SET `mana` = `mana`-'" . $needmana . "' WHERE `id` = '" . $user['id'] . "';");
|
||||
foreach ($e_team as $v)
|
||||
if ($count > 0) {
|
||||
$count--;
|
||||
$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= " . (time() - 60) . " AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;"));
|
||||
if (!$us) {
|
||||
$bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;"));
|
||||
$b_maxhp = mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;"));
|
||||
$b_maxhp = $b_maxhp['maxhp'];
|
||||
}
|
||||
//dmg=base+INT/LVL+X_magic
|
||||
$dmg = $basedmg + ($user['intel'] / 4) + $user[$sel];
|
||||
//MF
|
||||
$dmg *= $elem_align[$user_elem][$elem];
|
||||
if ($us) $dmg *= $elem_bonus[element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)))][element(star_sign(substr($us['borndate'], 3, 2), substr($us['borndate'], 0, 2)))];
|
||||
//- MF
|
||||
if ($us) {
|
||||
$def = magic_def($elem, $_POST['target'], $user_elem);
|
||||
$dmg *= (1 - magic_def($elem, $us['login'], $user_elem, 1) / 100);
|
||||
$dmg -= $def;
|
||||
}
|
||||
//rand +- 25%
|
||||
$dmg = mt_rand(0.75 * $dmg, 1.25 * $dmg);
|
||||
$dmg = round($dmg);
|
||||
if ($us) $target = $us['id'];
|
||||
else $target = $bot['id'];
|
||||
|
||||
$targeted = '';
|
||||
//dmg >0 - go
|
||||
$all_dmg = unserialize($bat['damage']);
|
||||
$all_exp = unserialize($bat['exp']);
|
||||
$all_dmg[$user['id']] += $dmg;
|
||||
$all_exp[$user['id']] += SolveExp($user['id'], $target, $dmg);
|
||||
|
||||
//сработало
|
||||
if ($dmg > 0) $hit = 1; else $hit = 0;
|
||||
$action = preg_replace("/Х/", Nick::id($target)->short(), magic_log($elem, $hit, $target));
|
||||
if (!(($us['id'] > 0 && $us['hp'] < 1) || ($bot['id'] > 0 && $bot['hp'] < 1)))
|
||||
if ($dmg > 0) {
|
||||
if ($us)
|
||||
mysql_query("UPDATE `users` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';");
|
||||
else
|
||||
mysql_query("UPDATE `bots` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';");
|
||||
mysql_query("UPDATE `battle` SET `damage`='" . serialize($all_dmg) . "', `exp`='" . serialize($all_exp) . "' WHERE `id`='{$user['battle']}';");
|
||||
|
||||
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . $action . ' <strong>-' . $dmg . '</strong><BR>');
|
||||
|
||||
$bet = 1;
|
||||
} else //не сработало
|
||||
{
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . $action . '<BR>');
|
||||
$bet = 1;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet = 1;
|
||||
}
|
||||
}
|
||||
|
@ -1,145 +0,0 @@
|
||||
<?php
|
||||
//параметры
|
||||
$basedmg = 70;
|
||||
$needmana = 65;
|
||||
$needint = 100;
|
||||
$elem = 'f';
|
||||
$t_min = 3;
|
||||
$t_max = 5;
|
||||
$count = mt_rand($t_min, $t_max);
|
||||
$mag_id = 109;
|
||||
$log_text = "<strong><font color=#df0d0d>Пожирающее Пламя [2]</font></strong>";
|
||||
$book = 908;
|
||||
$have_book = mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
if (empty($_SESSION['uid'])) {
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;"));
|
||||
$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
//mana needed
|
||||
$t1 = explode(";", $bat['t1']);
|
||||
$t2 = explode(";", $bat['t2']);
|
||||
if (in_array($user['id'], $t1)) $e_team = $t2;
|
||||
if (in_array($user['id'], $t2)) $e_team = $t1;
|
||||
shuffle($e_team);
|
||||
|
||||
if ($user['battle'] == 0) {
|
||||
echo "Это боевая магия...";
|
||||
} elseif (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif ($user['mana'] < $needmana) {
|
||||
echo "Недостаточно энергии!";
|
||||
} else {
|
||||
//attack script
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int = $magic['chanse'] + ($user['intel'] - $needint) * 3;
|
||||
if ($int > 98) {
|
||||
$int = 99;
|
||||
}
|
||||
} else {
|
||||
$int = 0;
|
||||
}
|
||||
|
||||
if (rand(1, 100) < $int) {
|
||||
global $elem_align, $elem_bonus;
|
||||
$user_elem = element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)));
|
||||
|
||||
switch ($user_elem) {
|
||||
case 'f':
|
||||
$uel = 'mfire';
|
||||
break;
|
||||
case 'a':
|
||||
$uel = 'mair';
|
||||
break;
|
||||
case 'w':
|
||||
$uel = 'mwater';
|
||||
break;
|
||||
case 'e':
|
||||
$uel = 'mearth';
|
||||
break;
|
||||
}
|
||||
switch ($elem) {
|
||||
case 'f':
|
||||
$sel = 'mfire';
|
||||
break;
|
||||
case 'a':
|
||||
$sel = 'mair';
|
||||
break;
|
||||
case 'w':
|
||||
$sel = 'mwater';
|
||||
break;
|
||||
case 'e':
|
||||
$sel = 'mearth';
|
||||
break;
|
||||
}
|
||||
$sex_action = "применил";
|
||||
if ($user['sex'] == 0) $sex_action .= "а";
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . Nick::id($user['id'])->short() . ' ' . $sex_action . $targeted . ' заклинание ' . $log_text . '<BR>');
|
||||
|
||||
//mass magic
|
||||
mysql_query("UPDATE `users` SET `mana` = `mana`-'" . $needmana . "' WHERE `id` = '" . $user['id'] . "';");
|
||||
foreach ($e_team as $v)
|
||||
if ($count > 0) {
|
||||
$count--;
|
||||
$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= " . (time() - 60) . " AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;"));
|
||||
if (!$us) {
|
||||
$bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;"));
|
||||
$b_maxhp = mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;"));
|
||||
$b_maxhp = $b_maxhp['maxhp'];
|
||||
}
|
||||
//dmg=base+INT/LVL+X_magic
|
||||
$dmg = $basedmg + ($user['intel'] / 4) + $user[$sel];
|
||||
//MF
|
||||
$dmg *= $elem_align[$user_elem][$elem];
|
||||
if ($us) $dmg *= $elem_bonus[element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)))][element(star_sign(substr($us['borndate'], 3, 2), substr($us['borndate'], 0, 2)))];
|
||||
//- MF
|
||||
if ($us) {
|
||||
$def = magic_def($elem, $_POST['target'], $user_elem);
|
||||
$dmg *= (1 - magic_def($elem, $us['login'], $user_elem, 1) / 100);
|
||||
$dmg -= $def;
|
||||
}
|
||||
//rand +- 25%
|
||||
$dmg = mt_rand(0.75 * $dmg, 1.25 * $dmg);
|
||||
$dmg = round($dmg);
|
||||
if ($us) $target = $us['id'];
|
||||
else $target = $bot['id'];
|
||||
|
||||
$targeted = '';
|
||||
//dmg >0 - go
|
||||
$all_dmg = unserialize($bat['damage']);
|
||||
$all_exp = unserialize($bat['exp']);
|
||||
$all_dmg[$user['id']] += $dmg;
|
||||
$all_exp[$user['id']] += SolveExp($user['id'], $target, $dmg);
|
||||
|
||||
//сработало
|
||||
if ($dmg > 0) $hit = 1; else $hit = 0;
|
||||
$action = preg_replace("/Х/", Nick::id($target)->short(), magic_log($elem, $hit, $target));
|
||||
if (!(($us['id'] > 0 && $us['hp'] < 1) || ($bot['id'] > 0 && $bot['hp'] < 1)))
|
||||
if ($dmg > 0) {
|
||||
if ($us)
|
||||
mysql_query("UPDATE `users` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';");
|
||||
else
|
||||
mysql_query("UPDATE `bots` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';");
|
||||
mysql_query("UPDATE `battle` SET `damage`='" . serialize($all_dmg) . "', `exp`='" . serialize($all_exp) . "' WHERE `id`='{$user['battle']}';");
|
||||
|
||||
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . $action . ' <strong>-' . $dmg . '</strong><BR>');
|
||||
|
||||
$bet = 1;
|
||||
} else //не сработало
|
||||
{
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . $action . '<BR>');
|
||||
$bet = 1;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet = 1;
|
||||
}
|
||||
}
|
||||
|
@ -1,145 +0,0 @@
|
||||
<?php
|
||||
//параметры
|
||||
$basedmg = 110;
|
||||
$needmana = 80;
|
||||
$needint = 120;
|
||||
$elem = 'f';
|
||||
$t_min = 3;
|
||||
$t_max = 7;
|
||||
$count = mt_rand($t_min, $t_max);
|
||||
$mag_id = 110;
|
||||
$log_text = "<strong><font color=#df0d0d>Пожирающее Пламя [3]</font></strong>";
|
||||
$book = 909;
|
||||
$have_book = mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
if (empty($_SESSION['uid'])) {
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;"));
|
||||
$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
//mana needed
|
||||
$t1 = explode(";", $bat['t1']);
|
||||
$t2 = explode(";", $bat['t2']);
|
||||
if (in_array($user['id'], $t1)) $e_team = $t2;
|
||||
if (in_array($user['id'], $t2)) $e_team = $t1;
|
||||
shuffle($e_team);
|
||||
|
||||
if ($user['battle'] == 0) {
|
||||
echo "Это боевая магия...";
|
||||
} elseif (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif ($user['mana'] < $needmana) {
|
||||
echo "Недостаточно энергии!";
|
||||
} else {
|
||||
//attack script
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int = $magic['chanse'] + ($user['intel'] - $needint) * 3;
|
||||
if ($int > 98) {
|
||||
$int = 99;
|
||||
}
|
||||
} else {
|
||||
$int = 0;
|
||||
}
|
||||
|
||||
if (rand(1, 100) < $int) {
|
||||
global $elem_align, $elem_bonus;
|
||||
$user_elem = element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)));
|
||||
|
||||
switch ($user_elem) {
|
||||
case 'f':
|
||||
$uel = 'mfire';
|
||||
break;
|
||||
case 'a':
|
||||
$uel = 'mair';
|
||||
break;
|
||||
case 'w':
|
||||
$uel = 'mwater';
|
||||
break;
|
||||
case 'e':
|
||||
$uel = 'mearth';
|
||||
break;
|
||||
}
|
||||
switch ($elem) {
|
||||
case 'f':
|
||||
$sel = 'mfire';
|
||||
break;
|
||||
case 'a':
|
||||
$sel = 'mair';
|
||||
break;
|
||||
case 'w':
|
||||
$sel = 'mwater';
|
||||
break;
|
||||
case 'e':
|
||||
$sel = 'mearth';
|
||||
break;
|
||||
}
|
||||
$sex_action = "применил";
|
||||
if ($user['sex'] == 0) $sex_action .= "а";
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . Nick::id($user['id'])->short() . ' ' . $sex_action . $targeted . ' заклинание ' . $log_text . '<BR>');
|
||||
|
||||
//mass magic
|
||||
mysql_query("UPDATE `users` SET `mana` = `mana`-'" . $needmana . "' WHERE `id` = '" . $user['id'] . "';");
|
||||
foreach ($e_team as $v)
|
||||
if ($count > 0) {
|
||||
$count--;
|
||||
$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= " . (time() - 60) . " AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;"));
|
||||
if (!$us) {
|
||||
$bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;"));
|
||||
$b_maxhp = mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;"));
|
||||
$b_maxhp = $b_maxhp['maxhp'];
|
||||
}
|
||||
//dmg=base+INT/LVL+X_magic
|
||||
$dmg = $basedmg + ($user['intel'] / 4) + $user[$sel];
|
||||
//MF
|
||||
$dmg *= $elem_align[$user_elem][$elem];
|
||||
if ($us) $dmg *= $elem_bonus[element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)))][element(star_sign(substr($us['borndate'], 3, 2), substr($us['borndate'], 0, 2)))];
|
||||
//- MF
|
||||
if ($us) {
|
||||
$def = magic_def($elem, $_POST['target'], $user_elem);
|
||||
$dmg *= (1 - magic_def($elem, $us['login'], $user_elem, 1) / 100);
|
||||
$dmg -= $def;
|
||||
}
|
||||
//rand +- 25%
|
||||
$dmg = mt_rand(0.75 * $dmg, 1.25 * $dmg);
|
||||
$dmg = round($dmg);
|
||||
if ($us) $target = $us['id'];
|
||||
else $target = $bot['id'];
|
||||
|
||||
$targeted = '';
|
||||
//dmg >0 - go
|
||||
$all_dmg = unserialize($bat['damage']);
|
||||
$all_exp = unserialize($bat['exp']);
|
||||
$all_dmg[$user['id']] += $dmg;
|
||||
$all_exp[$user['id']] += SolveExp($user['id'], $target, $dmg);
|
||||
|
||||
//сработало
|
||||
if ($dmg > 0) $hit = 1; else $hit = 0;
|
||||
$action = preg_replace("/Х/", Nick::id($target)->short(), magic_log($elem, $hit, $target));
|
||||
if (!(($us['id'] > 0 && $us['hp'] < 1) || ($bot['id'] > 0 && $bot['hp'] < 1)))
|
||||
if ($dmg > 0) {
|
||||
if ($us)
|
||||
mysql_query("UPDATE `users` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';");
|
||||
else
|
||||
mysql_query("UPDATE `bots` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';");
|
||||
mysql_query("UPDATE `battle` SET `damage`='" . serialize($all_dmg) . "', `exp`='" . serialize($all_exp) . "' WHERE `id`='{$user['battle']}';");
|
||||
|
||||
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . $action . ' <strong>-' . $dmg . '</strong><BR>');
|
||||
|
||||
$bet = 1;
|
||||
} else //не сработало
|
||||
{
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . $action . '<BR>');
|
||||
$bet = 1;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet = 1;
|
||||
}
|
||||
}
|
||||
|
@ -1,148 +0,0 @@
|
||||
<?php
|
||||
//параметры
|
||||
$basedmg = 150;
|
||||
$needmana = 55;
|
||||
$needint = 80;
|
||||
$elem = 'f';
|
||||
$t_min = 1;
|
||||
$t_max = 2;
|
||||
$count = mt_rand($t_min, $t_max);
|
||||
$mag_id = 120;
|
||||
$log_text = "<strong><font color=#df0d0d>Тепло Жизни [1]</font></strong>";
|
||||
$book = 866;
|
||||
$have_book = mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
|
||||
if (empty($_SESSION['uid'])) {
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;"));
|
||||
$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
//mana needed
|
||||
$t1 = explode(";", $bat['t1']);
|
||||
$t2 = explode(";", $bat['t2']);
|
||||
if (in_array($user['id'], $t1)) $e_team = $t1;
|
||||
if (in_array($user['id'], $t2)) $e_team = $t2;
|
||||
foreach ($e_team as $k => $l) {
|
||||
if ($l > _BOTSEPARATOR_) $e_hp = mysql_fetch_array(mysql_query("SELECT `hp` FROM `bots` WHERE `id`='{$l}' LIMIT 1;"));
|
||||
else $e_hp = mysql_fetch_array(mysql_query("SELECT `hp` FROM `users` WHERE `id`='{$l}' LIMIT 1;"));
|
||||
if ($e_hp['hp'] < 1) unset($e_team[$k]);
|
||||
}
|
||||
shuffle($e_team);
|
||||
|
||||
if ($user['battle'] == 0) {
|
||||
echo "Это боевая магия...";
|
||||
} elseif (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif ($user['mana'] < $needmana) {
|
||||
echo "Недостаточно энергии!";
|
||||
} else {
|
||||
//attack script
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int = $magic['chanse'] + ($user['intel'] - $needint) * 3;
|
||||
if ($int > 98) {
|
||||
$int = 99;
|
||||
}
|
||||
} else {
|
||||
$int = 0;
|
||||
}
|
||||
|
||||
if (rand(1, 100) < $int) {
|
||||
global $elem_align, $elem_bonus;
|
||||
$user_elem = element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)));
|
||||
|
||||
switch ($user_elem) {
|
||||
case 'f':
|
||||
$uel = 'mfire';
|
||||
break;
|
||||
case 'a':
|
||||
$uel = 'mair';
|
||||
break;
|
||||
case 'w':
|
||||
$uel = 'mwater';
|
||||
break;
|
||||
case 'e':
|
||||
$uel = 'mearth';
|
||||
break;
|
||||
}
|
||||
switch ($elem) {
|
||||
case 'f':
|
||||
$sel = 'mfire';
|
||||
break;
|
||||
case 'a':
|
||||
$sel = 'mair';
|
||||
break;
|
||||
case 'w':
|
||||
$sel = 'mwater';
|
||||
break;
|
||||
case 'e':
|
||||
$sel = 'mearth';
|
||||
break;
|
||||
}
|
||||
$sex_action = "применил";
|
||||
if ($user['sex'] == 0) $sex_action .= "а";
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . Nick::id($user['id'])->short() . ' ' . $sex_action . $targeted . ' заклинание ' . $log_text . '<BR>');
|
||||
|
||||
//mass magic
|
||||
mysql_query("UPDATE `users` SET `mana` = `mana`-'" . $needmana . "' WHERE `id` = '" . $user['id'] . "';");
|
||||
foreach ($e_team as $v)
|
||||
if ($count > 0) {
|
||||
$count--;
|
||||
$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= " . (time() - 60) . " AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;"));
|
||||
if (!$us) {
|
||||
$bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;"));
|
||||
$b_maxhp = mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;"));
|
||||
$b_maxhp = $b_maxhp['maxhp'];
|
||||
}
|
||||
//dmg=base+INT/LVL+X_magic
|
||||
$dmg = $basedmg + ($user['intel'] / $user['level']) + $user[$sel];
|
||||
//MF
|
||||
$dmg *= $elem_align[$user_elem][$elem];
|
||||
if ($us) $dmg *= $elem_bonus[element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)))][element(star_sign(substr($us['borndate'], 3, 2), substr($us['borndate'], 0, 2)))];
|
||||
//rand +- 25%
|
||||
$dmg = mt_rand(0.75 * $dmg, 1.25 * $dmg);
|
||||
$dmg = round($dmg);
|
||||
if ($us) $delta = $us['maxhp'] - $us['hp'];
|
||||
else $delta = $b_maxhp - $bot['hp'];
|
||||
if ($delta < $dmg) $dmg = floor($delta);
|
||||
if ($dmg < 1) $dmg = 0;
|
||||
|
||||
if ($us) $target = $us['id'];
|
||||
else $target = $bot['id'];
|
||||
|
||||
$targeted = '';
|
||||
//dmg >0 - go
|
||||
$all_dmg = unserialize($bat['damage']);
|
||||
$all_exp = unserialize($bat['exp']);
|
||||
$all_dmg[$user['id']] += $dmg;
|
||||
$all_exp[$user['id']] += SolveExp($user['id'], $target, $dmg);
|
||||
|
||||
//сработало
|
||||
if ($dmg > 0) $hit = '-1'; else $hit = 0;
|
||||
$action = preg_replace("/Х/", Nick::id($target)->short(), magic_log($elem, $hit, $target));
|
||||
if ($dmg > 0) {
|
||||
if ($us)
|
||||
mysql_query("UPDATE `users` SET `hp` = `hp`+'" . $dmg . "' WHERE `id` = '" . $target . "';");
|
||||
else
|
||||
mysql_query("UPDATE `bots` SET `hp` = `hp`+'" . $dmg . "' WHERE `id` = '" . $target . "';");
|
||||
mysql_query("UPDATE `battle` SET `damage`='" . serialize($all_dmg) . "', `exp`='" . serialize($all_exp) . "' WHERE `id`='{$user['battle']}';");
|
||||
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . $action . ' <strong>+' . $dmg . '</strong><BR>');
|
||||
|
||||
$bet = 1;
|
||||
} else //не сработало
|
||||
{
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . $action . '<BR>');
|
||||
$bet = 1;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet = 1;
|
||||
}
|
||||
}
|
||||
|
@ -1,148 +0,0 @@
|
||||
<?php
|
||||
//параметры
|
||||
$basedmg = 210;
|
||||
$needmana = 65;
|
||||
$needint = 100;
|
||||
$elem = 'f';
|
||||
$t_min = 1;
|
||||
$t_max = 3;
|
||||
$count = mt_rand($t_min, $t_max);
|
||||
$mag_id = 121;
|
||||
$log_text = "<strong><font color=#df0d0d>Тепло Жизни [2]</font></strong>";
|
||||
$book = 908;
|
||||
$have_book = mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
|
||||
if (empty($_SESSION['uid'])) {
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;"));
|
||||
$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
//mana needed
|
||||
$t1 = explode(";", $bat['t1']);
|
||||
$t2 = explode(";", $bat['t2']);
|
||||
if (in_array($user['id'], $t1)) $e_team = $t1;
|
||||
if (in_array($user['id'], $t2)) $e_team = $t2;
|
||||
foreach ($e_team as $k => $l) {
|
||||
if ($l > _BOTSEPARATOR_) $e_hp = mysql_fetch_array(mysql_query("SELECT `hp` FROM `bots` WHERE `id`='{$l}' LIMIT 1;"));
|
||||
else $e_hp = mysql_fetch_array(mysql_query("SELECT `hp` FROM `users` WHERE `id`='{$l}' LIMIT 1;"));
|
||||
if ($e_hp['hp'] < 1) unset($e_team[$k]);
|
||||
}
|
||||
shuffle($e_team);
|
||||
|
||||
if ($user['battle'] == 0) {
|
||||
echo "Это боевая магия...";
|
||||
} elseif (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif ($user['mana'] < $needmana) {
|
||||
echo "Недостаточно энергии!";
|
||||
} else {
|
||||
//attack script
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int = $magic['chanse'] + ($user['intel'] - $needint) * 3;
|
||||
if ($int > 98) {
|
||||
$int = 99;
|
||||
}
|
||||
} else {
|
||||
$int = 0;
|
||||
}
|
||||
|
||||
if (rand(1, 100) < $int) {
|
||||
global $elem_align, $elem_bonus;
|
||||
$user_elem = element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)));
|
||||
|
||||
switch ($user_elem) {
|
||||
case 'f':
|
||||
$uel = 'mfire';
|
||||
break;
|
||||
case 'a':
|
||||
$uel = 'mair';
|
||||
break;
|
||||
case 'w':
|
||||
$uel = 'mwater';
|
||||
break;
|
||||
case 'e':
|
||||
$uel = 'mearth';
|
||||
break;
|
||||
}
|
||||
switch ($elem) {
|
||||
case 'f':
|
||||
$sel = 'mfire';
|
||||
break;
|
||||
case 'a':
|
||||
$sel = 'mair';
|
||||
break;
|
||||
case 'w':
|
||||
$sel = 'mwater';
|
||||
break;
|
||||
case 'e':
|
||||
$sel = 'mearth';
|
||||
break;
|
||||
}
|
||||
$sex_action = "применил";
|
||||
if ($user['sex'] == 0) $sex_action .= "а";
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . Nick::id($user['id'])->short() . ' ' . $sex_action . $targeted . ' заклинание ' . $log_text . '<BR>');
|
||||
|
||||
//mass magic
|
||||
mysql_query("UPDATE `users` SET `mana` = `mana`-'" . $needmana . "' WHERE `id` = '" . $user['id'] . "';");
|
||||
foreach ($e_team as $v)
|
||||
if ($count > 0) {
|
||||
$count--;
|
||||
$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= " . (time() - 60) . " AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;"));
|
||||
if (!$us) {
|
||||
$bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;"));
|
||||
$b_maxhp = mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;"));
|
||||
$b_maxhp = $b_maxhp['maxhp'];
|
||||
}
|
||||
//dmg=base+INT/LVL+X_magic
|
||||
$dmg = $basedmg + ($user['intel'] / $user['level']) + $user[$sel];
|
||||
//MF
|
||||
$dmg *= $elem_align[$user_elem][$elem];
|
||||
if ($us) $dmg *= $elem_bonus[element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)))][element(star_sign(substr($us['borndate'], 3, 2), substr($us['borndate'], 0, 2)))];
|
||||
//rand +- 25%
|
||||
$dmg = mt_rand(0.75 * $dmg, 1.25 * $dmg);
|
||||
$dmg = round($dmg);
|
||||
if ($us) $delta = $us['maxhp'] - $us['hp'];
|
||||
else $delta = $b_maxhp - $bot['hp'];
|
||||
if ($delta < $dmg) $dmg = floor($delta);
|
||||
if ($dmg < 1) $dmg = 0;
|
||||
|
||||
if ($us) $target = $us['id'];
|
||||
else $target = $bot['id'];
|
||||
|
||||
$targeted = '';
|
||||
//dmg >0 - go
|
||||
$all_dmg = unserialize($bat['damage']);
|
||||
$all_exp = unserialize($bat['exp']);
|
||||
$all_dmg[$user['id']] += $dmg;
|
||||
$all_exp[$user['id']] += SolveExp($user['id'], $target, $dmg);
|
||||
|
||||
//сработало
|
||||
if ($dmg > 0) $hit = '-1'; else $hit = 0;
|
||||
$action = preg_replace("/Х/", Nick::id($target)->short(), magic_log($elem, $hit, $target));
|
||||
if ($dmg > 0) {
|
||||
if ($us)
|
||||
mysql_query("UPDATE `users` SET `hp` = `hp`+'" . $dmg . "' WHERE `id` = '" . $target . "';");
|
||||
else
|
||||
mysql_query("UPDATE `bots` SET `hp` = `hp`+'" . $dmg . "' WHERE `id` = '" . $target . "';");
|
||||
mysql_query("UPDATE `battle` SET `damage`='" . serialize($all_dmg) . "', `exp`='" . serialize($all_exp) . "' WHERE `id`='{$user['battle']}';");
|
||||
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . $action . ' <strong>+' . $dmg . '</strong><BR>');
|
||||
|
||||
$bet = 1;
|
||||
} else //не сработало
|
||||
{
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . $action . '<BR>');
|
||||
$bet = 1;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet = 1;
|
||||
}
|
||||
}
|
||||
|
@ -1,148 +0,0 @@
|
||||
<?php
|
||||
//параметры
|
||||
$basedmg = 330;
|
||||
$needmana = 75;
|
||||
$needint = 120;
|
||||
$elem = 'f';
|
||||
$t_min = 1;
|
||||
$t_max = 4;
|
||||
$count = mt_rand($t_min, $t_max);
|
||||
$mag_id = 122;
|
||||
$log_text = "<strong><font color=#df0d0d>Тепло Жизни [3]</font></strong>";
|
||||
$book = 909;
|
||||
$have_book = mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
|
||||
if (empty($_SESSION['uid'])) {
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;"));
|
||||
$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
//mana needed
|
||||
$t1 = explode(";", $bat['t1']);
|
||||
$t2 = explode(";", $bat['t2']);
|
||||
if (in_array($user['id'], $t1)) $e_team = $t1;
|
||||
if (in_array($user['id'], $t2)) $e_team = $t2;
|
||||
foreach ($e_team as $k => $l) {
|
||||
if ($l > _BOTSEPARATOR_) $e_hp = mysql_fetch_array(mysql_query("SELECT `hp` FROM `bots` WHERE `id`='{$l}' LIMIT 1;"));
|
||||
else $e_hp = mysql_fetch_array(mysql_query("SELECT `hp` FROM `users` WHERE `id`='{$l}' LIMIT 1;"));
|
||||
if ($e_hp['hp'] < 1) unset($e_team[$k]);
|
||||
}
|
||||
shuffle($e_team);
|
||||
|
||||
if ($user['battle'] == 0) {
|
||||
echo "Это боевая магия...";
|
||||
} elseif (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif ($user['mana'] < $needmana) {
|
||||
echo "Недостаточно энергии!";
|
||||
} else {
|
||||
//attack script
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int = $magic['chanse'] + ($user['intel'] - $needint) * 3;
|
||||
if ($int > 98) {
|
||||
$int = 99;
|
||||
}
|
||||
} else {
|
||||
$int = 0;
|
||||
}
|
||||
|
||||
if (rand(1, 100) < $int) {
|
||||
global $elem_align, $elem_bonus;
|
||||
$user_elem = element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)));
|
||||
|
||||
switch ($user_elem) {
|
||||
case 'f':
|
||||
$uel = 'mfire';
|
||||
break;
|
||||
case 'a':
|
||||
$uel = 'mair';
|
||||
break;
|
||||
case 'w':
|
||||
$uel = 'mwater';
|
||||
break;
|
||||
case 'e':
|
||||
$uel = 'mearth';
|
||||
break;
|
||||
}
|
||||
switch ($elem) {
|
||||
case 'f':
|
||||
$sel = 'mfire';
|
||||
break;
|
||||
case 'a':
|
||||
$sel = 'mair';
|
||||
break;
|
||||
case 'w':
|
||||
$sel = 'mwater';
|
||||
break;
|
||||
case 'e':
|
||||
$sel = 'mearth';
|
||||
break;
|
||||
}
|
||||
$sex_action = "применил";
|
||||
if ($user['sex'] == 0) $sex_action .= "а";
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . Nick::id($user['id'])->short() . ' ' . $sex_action . $targeted . ' заклинание ' . $log_text . '<BR>');
|
||||
|
||||
//mass magic
|
||||
mysql_query("UPDATE `users` SET `mana` = `mana`-'" . $needmana . "' WHERE `id` = '" . $user['id'] . "';");
|
||||
foreach ($e_team as $v)
|
||||
if ($count > 0) {
|
||||
$count--;
|
||||
$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= " . (time() - 60) . " AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;"));
|
||||
if (!$us) {
|
||||
$bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;"));
|
||||
$b_maxhp = mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;"));
|
||||
$b_maxhp = $b_maxhp['maxhp'];
|
||||
}
|
||||
//dmg=base+INT/LVL+X_magic
|
||||
$dmg = $basedmg + ($user['intel'] / $user['level']) + $user[$sel];
|
||||
//MF
|
||||
$dmg *= $elem_align[$user_elem][$elem];
|
||||
if ($us) $dmg *= $elem_bonus[element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)))][element(star_sign(substr($us['borndate'], 3, 2), substr($us['borndate'], 0, 2)))];
|
||||
//rand +- 25%
|
||||
$dmg = mt_rand(0.75 * $dmg, 1.25 * $dmg);
|
||||
$dmg = round($dmg);
|
||||
if ($us) $delta = $us['maxhp'] - $us['hp'];
|
||||
else $delta = $b_maxhp - $bot['hp'];
|
||||
if ($delta < $dmg) $dmg = floor($delta);
|
||||
if ($dmg < 1) $dmg = 0;
|
||||
|
||||
if ($us) $target = $us['id'];
|
||||
else $target = $bot['id'];
|
||||
|
||||
$targeted = '';
|
||||
//dmg >0 - go
|
||||
$all_dmg = unserialize($bat['damage']);
|
||||
$all_exp = unserialize($bat['exp']);
|
||||
$all_dmg[$user['id']] += $dmg;
|
||||
$all_exp[$user['id']] += SolveExp($user['id'], $target, $dmg);
|
||||
|
||||
//сработало
|
||||
if ($dmg > 0) $hit = '-1'; else $hit = 0;
|
||||
$action = preg_replace("/Х/", Nick::id($target)->short(), magic_log($elem, $hit, $target));
|
||||
if ($dmg > 0) {
|
||||
if ($us)
|
||||
mysql_query("UPDATE `users` SET `hp` = `hp`+'" . $dmg . "' WHERE `id` = '" . $target . "';");
|
||||
else
|
||||
mysql_query("UPDATE `bots` SET `hp` = `hp`+'" . $dmg . "' WHERE `id` = '" . $target . "';");
|
||||
mysql_query("UPDATE `battle` SET `damage`='" . serialize($all_dmg) . "', `exp`='" . serialize($all_exp) . "' WHERE `id`='{$user['battle']}';");
|
||||
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . $action . ' <strong>+' . $dmg . '</strong><BR>');
|
||||
|
||||
$bet = 1;
|
||||
} else //не сработало
|
||||
{
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . $action . '<BR>');
|
||||
$bet = 1;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet = 1;
|
||||
}
|
||||
}
|
||||
|
@ -1,136 +0,0 @@
|
||||
<?php
|
||||
//параметры
|
||||
$basedmg=110;
|
||||
$needmana=20;
|
||||
$needint=80;
|
||||
$elem='f';
|
||||
$mag_id=76;
|
||||
$log_text="<strong><font color=#df0d0d>Вспышка [1]</font></strong>";
|
||||
$book=866;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
|
||||
if (empty($_SESSION['uid'])) {
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;"));
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;"));
|
||||
$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
if(!$us) $bot= mysql_fetch_array(mysql_query ("SELECT * FROM `bots` WHERE `name` = '".$_POST['target']."' LIMIT 1;"));
|
||||
//mana needed
|
||||
$t1 = explode(";",$bat['t1']);
|
||||
$t2 = explode(";",$bat['t2']);
|
||||
if($us) $e_id=$us['id'];
|
||||
else $e_id=$bot['id'];
|
||||
if ($user['battle'] == 0) {
|
||||
echo "Это боевая магия...";
|
||||
} elseif (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif((in_array ($user['id'],$t1)&&in_array ($e_id,$t1)) || (in_array ($user['id'],$t2)&&in_array ($e_id,$t2))) {
|
||||
echo "Персонаж в Вашей команде!";
|
||||
} elseif($user['login']==$_POST['target']) {
|
||||
echo "Герр Леопольд фон Захер Мазох был бы доволен Вами...";
|
||||
} elseif ($us && $us['battle']!=$user['battle']) {
|
||||
echo "Персонаж не в Вашем бою!";
|
||||
} elseif ($user['mana']<$needmana) {
|
||||
echo "Недостаточно энергии!";
|
||||
} elseif (!$us['online']&&!$bot) {
|
||||
echo "Персонаж не в игре!";
|
||||
} else {
|
||||
//attack script
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int=$magic['chanse'] + ($user['intel'] - $needint)*3;
|
||||
if ($int>98){$int=99;}
|
||||
}
|
||||
else {$int=0;}
|
||||
|
||||
if (rand(1,100) < $int) {
|
||||
global $elem_align,$elem_bonus;
|
||||
|
||||
$user_elem=element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2)));
|
||||
|
||||
switch($user_elem)
|
||||
{
|
||||
case 'f':$uel='mfire';break;
|
||||
case 'a':$uel='mair';break;
|
||||
case 'w':$uel='mwater';break;
|
||||
case 'e':$uel='mearth';break;
|
||||
}
|
||||
switch($elem)
|
||||
{
|
||||
case 'f':$sel='mfire';break;
|
||||
case 'a':$sel='mair';break;
|
||||
case 'w':$sel='mwater';break;
|
||||
case 'e':$sel='mearth';break;
|
||||
}
|
||||
//dmg=base+INT/LVL+X_magic
|
||||
$dmg=$basedmg+($user['intel']/4)+$user[$sel];
|
||||
//MF
|
||||
$dmg*=$elem_align[$user_elem][$elem];
|
||||
if($us) $dmg*=$elem_bonus[element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2)))][element(star_sign(substr($us['borndate'],3,2), substr($us['borndate'],0,2)))];
|
||||
//- MF
|
||||
if($us) {
|
||||
$def=magic_def($elem,$_POST['target'],$user_elem);$dmg*=(1-magic_def($elem,$us['login'],$user_elem,1)/100);
|
||||
$dmg-=$def;
|
||||
}
|
||||
|
||||
//rand +- 25%
|
||||
$dmg=mt_rand(0.75*$dmg,1.25*$dmg);
|
||||
$dmg=round($dmg);
|
||||
if($us) $target=$us['id'];
|
||||
else $target=$bot['id'];
|
||||
// команды
|
||||
$t1 = explode(";",$bat['t1']);
|
||||
$t2 = explode(";",$bat['t2']);
|
||||
if (in_array ($user['id'],$t1)) {
|
||||
$us_team = "B1";
|
||||
$tar_team = "B2";
|
||||
}
|
||||
else {
|
||||
$us_team = "B2";
|
||||
$tar_team = "B1";
|
||||
}
|
||||
|
||||
$targeted=' на '.Nick::id($target)->short();
|
||||
//dmg >0 - go
|
||||
$all_dmg=unserialize($bat['damage']);
|
||||
$all_exp=unserialize($bat['exp']);
|
||||
$all_dmg[$user['id']]+=$dmg;
|
||||
$all_exp[$user['id']]+=SolveExp($user['id'],$target,$dmg);
|
||||
$sex_action="применил";if($user['sex']==0) $sex_action.="а";
|
||||
if(!(($us['id']>0 && $us['hp']<1) || ($bot['id']>0 && $bot['hp']<1)))
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.Nick::id($user['id'])->short().' '.$sex_action.$targeted.' заклинание '.$log_text.'<BR>');
|
||||
else
|
||||
echo "Не нарушайте покой мертвых!";
|
||||
//сработало
|
||||
if($dmg>0) $hit=1; else $hit=0;
|
||||
$action=preg_replace("/Х/",Nick::id($target)->short(),magic_log($elem,$hit,$target));
|
||||
//проверка hp>0
|
||||
if(!(($us['id']>0 && $us['hp']<1) || ($bot['id']>0 && $bot['hp']<1)))
|
||||
if($dmg>0)
|
||||
{
|
||||
if($us)
|
||||
mysql_query("UPDATE `users` SET `hp` = `hp`-'".$dmg."' WHERE `id` = '".$target."';");
|
||||
else
|
||||
mysql_query("UPDATE `bots` SET `hp` = `hp`-'".$dmg."' WHERE `id` = '".$target."';");
|
||||
mysql_query("UPDATE `battle` SET `damage`='".serialize($all_dmg)."', `exp`='".serialize($all_exp)."' WHERE `id`='{$user['battle']}';");
|
||||
mysql_query ("UPDATE `users` SET `mana` = `mana`-'".$needmana."' WHERE `id` = '".$user['id']."';");
|
||||
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.$action.' <strong>-'.$dmg.'</strong><BR>');
|
||||
|
||||
$bet=1;
|
||||
}
|
||||
else
|
||||
//не сработало
|
||||
{
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.$action.'<BR>');
|
||||
$bet=1;
|
||||
}
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet=1;
|
||||
}
|
||||
}
|
||||
|
@ -1,152 +0,0 @@
|
||||
<?php
|
||||
//параметры
|
||||
$basedmg = 150;
|
||||
$needmana = 35;
|
||||
$needint = 100;
|
||||
$elem = 'f';
|
||||
$mag_id = 91;
|
||||
$log_text = "<strong><font color=#df0d0d>Вспышка [2]</font></strong>";
|
||||
$book = 908;
|
||||
$have_book = mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
|
||||
if (empty($_SESSION['uid'])) {
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= " . (time() - 60) . " AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;"));
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;"));
|
||||
$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
if (!$us) $bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `name` = '" . $_POST['target'] . "' LIMIT 1;"));
|
||||
//mana needed
|
||||
$t1 = explode(";", $bat['t1']);
|
||||
$t2 = explode(";", $bat['t2']);
|
||||
if ($us) $e_id = $us['id'];
|
||||
else $e_id = $bot['id'];
|
||||
if ($user['battle'] == 0) {
|
||||
echo "Это боевая магия...";
|
||||
} elseif (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif ((in_array($user['id'], $t1) && in_array($e_id, $t1)) || (in_array($user['id'], $t2) && in_array($e_id, $t2))) {
|
||||
echo "Персонаж в Вашей команде!";
|
||||
} elseif ($user['login'] == $_POST['target']) {
|
||||
echo "Герр Леопольд фон Захер Мазох был бы доволен Вами...";
|
||||
} elseif ($us && $us['battle'] != $user['battle']) {
|
||||
echo "Персонаж не в Вашем бою!";
|
||||
} elseif ($user['mana'] < $needmana) {
|
||||
echo "Недостаточно энергии!";
|
||||
} elseif (!$us['online'] && !$bot) {
|
||||
echo "Персонаж не в игре!";
|
||||
} else {
|
||||
//attack script
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int = $magic['chanse'] + ($user['intel'] - $needint) * 3;
|
||||
if ($int > 98) {
|
||||
$int = 99;
|
||||
}
|
||||
} else {
|
||||
$int = 0;
|
||||
}
|
||||
|
||||
if (rand(1, 100) < $int) {
|
||||
global $elem_align, $elem_bonus;
|
||||
|
||||
$user_elem = element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)));
|
||||
|
||||
switch ($user_elem) {
|
||||
case 'f':
|
||||
$uel = 'mfire';
|
||||
break;
|
||||
case 'a':
|
||||
$uel = 'mair';
|
||||
break;
|
||||
case 'w':
|
||||
$uel = 'mwater';
|
||||
break;
|
||||
case 'e':
|
||||
$uel = 'mearth';
|
||||
break;
|
||||
}
|
||||
switch ($elem) {
|
||||
case 'f':
|
||||
$sel = 'mfire';
|
||||
break;
|
||||
case 'a':
|
||||
$sel = 'mair';
|
||||
break;
|
||||
case 'w':
|
||||
$sel = 'mwater';
|
||||
break;
|
||||
case 'e':
|
||||
$sel = 'mearth';
|
||||
break;
|
||||
}
|
||||
//dmg=base+INT/LVL+X_magic
|
||||
$dmg = $basedmg + ($user['intel'] / 4) + $user[$sel];
|
||||
//MF
|
||||
$dmg *= $elem_align[$user_elem][$elem];
|
||||
if ($us) $dmg *= $elem_bonus[element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)))][element(star_sign(substr($us['borndate'], 3, 2), substr($us['borndate'], 0, 2)))];
|
||||
//- MF
|
||||
if ($us) {
|
||||
$def = magic_def($elem, $_POST['target'], $user_elem);
|
||||
$dmg *= (1 - magic_def($elem, $us['login'], $user_elem, 1) / 100);
|
||||
$dmg -= $def;
|
||||
}
|
||||
|
||||
//rand +- 25%
|
||||
$dmg = mt_rand(0.75 * $dmg, 1.25 * $dmg);
|
||||
$dmg = round($dmg);
|
||||
if ($us) $target = $us['id'];
|
||||
else $target = $bot['id'];
|
||||
// команды
|
||||
$t1 = explode(";", $bat['t1']);
|
||||
$t2 = explode(";", $bat['t2']);
|
||||
if (in_array($user['id'], $t1)) {
|
||||
$us_team = "B1";
|
||||
$tar_team = "B2";
|
||||
} else {
|
||||
$us_team = "B2";
|
||||
$tar_team = "B1";
|
||||
}
|
||||
|
||||
$targeted = ' на ' . Nick::id($target)->short();
|
||||
//dmg >0 - go
|
||||
$all_dmg = unserialize($bat['damage']);
|
||||
$all_exp = unserialize($bat['exp']);
|
||||
$all_dmg[$user['id']] += $dmg;
|
||||
$all_exp[$user['id']] += SolveExp($user['id'], $target, $dmg);
|
||||
$sex_action = "применил";
|
||||
if ($user['sex'] == 0) $sex_action .= "а";
|
||||
if (!(($us['id'] > 0 && $us['hp'] < 1) || ($bot['id'] > 0 && $bot['hp'] < 1)))
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . Nick::id($user['id'])->short() . ' ' . $sex_action . $targeted . ' заклинание ' . $log_text . '<BR>');
|
||||
else
|
||||
echo "Не нарушайте покой мертвых!";
|
||||
//сработало
|
||||
if ($dmg > 0) $hit = 1; else $hit = 0;
|
||||
$action = preg_replace("/Х/", Nick::id($target)->short(), magic_log($elem, $hit, $target));
|
||||
//проверка hp>0
|
||||
if (!(($us['id'] > 0 && $us['hp'] < 1) || ($bot['id'] > 0 && $bot['hp'] < 1)))
|
||||
if ($dmg > 0) {
|
||||
if ($us)
|
||||
mysql_query("UPDATE `users` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';");
|
||||
else
|
||||
mysql_query("UPDATE `bots` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';");
|
||||
mysql_query("UPDATE `battle` SET `damage`='" . serialize($all_dmg) . "', `exp`='" . serialize($all_exp) . "' WHERE `id`='{$user['battle']}';");
|
||||
mysql_query("UPDATE `users` SET `mana` = `mana`-'" . $needmana . "' WHERE `id` = '" . $user['id'] . "';");
|
||||
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . $action . ' <strong>-' . $dmg . '</strong><BR>');
|
||||
|
||||
$bet = 1;
|
||||
} else //не сработало
|
||||
{
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . $action . '<BR>');
|
||||
$bet = 1;
|
||||
}
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet = 1;
|
||||
}
|
||||
}
|
||||
|
@ -1,152 +0,0 @@
|
||||
<?php
|
||||
//параметры
|
||||
$basedmg = 300;
|
||||
$needmana = 50;
|
||||
$needint = 120;
|
||||
$elem = 'f';
|
||||
$mag_id = 92;
|
||||
$log_text = "<strong><font color=#df0d0d>Вспышка [3]</font></strong>";
|
||||
$book = 909;
|
||||
$have_book = mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
|
||||
if (empty($_SESSION['uid'])) {
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= " . (time() - 60) . " AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;"));
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;"));
|
||||
$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
if (!$us) $bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `name` = '" . $_POST['target'] . "' LIMIT 1;"));
|
||||
//mana needed
|
||||
$t1 = explode(";", $bat['t1']);
|
||||
$t2 = explode(";", $bat['t2']);
|
||||
if ($us) $e_id = $us['id'];
|
||||
else $e_id = $bot['id'];
|
||||
if ($user['battle'] == 0) {
|
||||
echo "Это боевая магия...";
|
||||
} elseif (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif ((in_array($user['id'], $t1) && in_array($e_id, $t1)) || (in_array($user['id'], $t2) && in_array($e_id, $t2))) {
|
||||
echo "Персонаж в Вашей команде!";
|
||||
} elseif ($user['login'] == $_POST['target']) {
|
||||
echo "Герр Леопольд фон Захер Мазох был бы доволен Вами...";
|
||||
} elseif ($us && $us['battle'] != $user['battle']) {
|
||||
echo "Персонаж не в Вашем бою!";
|
||||
} elseif ($user['mana'] < $needmana) {
|
||||
echo "Недостаточно энергии!";
|
||||
} elseif (!$us['online'] && !$bot) {
|
||||
echo "Персонаж не в игре!";
|
||||
} else {
|
||||
//attack script
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int = $magic['chanse'] + ($user['intel'] - $needint) * 3;
|
||||
if ($int > 98) {
|
||||
$int = 99;
|
||||
}
|
||||
} else {
|
||||
$int = 0;
|
||||
}
|
||||
|
||||
if (rand(1, 100) < $int) {
|
||||
global $elem_align, $elem_bonus;
|
||||
|
||||
$user_elem = element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)));
|
||||
|
||||
switch ($user_elem) {
|
||||
case 'f':
|
||||
$uel = 'mfire';
|
||||
break;
|
||||
case 'a':
|
||||
$uel = 'mair';
|
||||
break;
|
||||
case 'w':
|
||||
$uel = 'mwater';
|
||||
break;
|
||||
case 'e':
|
||||
$uel = 'mearth';
|
||||
break;
|
||||
}
|
||||
switch ($elem) {
|
||||
case 'f':
|
||||
$sel = 'mfire';
|
||||
break;
|
||||
case 'a':
|
||||
$sel = 'mair';
|
||||
break;
|
||||
case 'w':
|
||||
$sel = 'mwater';
|
||||
break;
|
||||
case 'e':
|
||||
$sel = 'mearth';
|
||||
break;
|
||||
}
|
||||
//dmg=base+INT/LVL+X_magic
|
||||
$dmg = $basedmg + ($user['intel'] / 4) + $user[$sel];
|
||||
//MF
|
||||
$dmg *= $elem_align[$user_elem][$elem];
|
||||
if ($us) $dmg *= $elem_bonus[element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)))][element(star_sign(substr($us['borndate'], 3, 2), substr($us['borndate'], 0, 2)))];
|
||||
//- MF
|
||||
if ($us) {
|
||||
$def = magic_def($elem, $_POST['target'], $user_elem);
|
||||
$dmg *= (1 - magic_def($elem, $us['login'], $user_elem, 1) / 100);
|
||||
$dmg -= $def;
|
||||
}
|
||||
|
||||
//rand +- 25%
|
||||
$dmg = mt_rand(0.75 * $dmg, 1.25 * $dmg);
|
||||
$dmg = round($dmg);
|
||||
if ($us) $target = $us['id'];
|
||||
else $target = $bot['id'];
|
||||
// команды
|
||||
$t1 = explode(";", $bat['t1']);
|
||||
$t2 = explode(";", $bat['t2']);
|
||||
if (in_array($user['id'], $t1)) {
|
||||
$us_team = "B1";
|
||||
$tar_team = "B2";
|
||||
} else {
|
||||
$us_team = "B2";
|
||||
$tar_team = "B1";
|
||||
}
|
||||
|
||||
$targeted = ' на ' . Nick::id($target)->short();
|
||||
//dmg >0 - go
|
||||
$all_dmg = unserialize($bat['damage']);
|
||||
$all_exp = unserialize($bat['exp']);
|
||||
$all_dmg[$user['id']] += $dmg;
|
||||
$all_exp[$user['id']] += SolveExp($user['id'], $target, $dmg);
|
||||
$sex_action = "применил";
|
||||
if ($user['sex'] == 0) $sex_action .= "а";
|
||||
if (!(($us['id'] > 0 && $us['hp'] < 1) || ($bot['id'] > 0 && $bot['hp'] < 1)))
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . Nick::id($user['id'])->short() . ' ' . $sex_action . $targeted . ' заклинание ' . $log_text . '<BR>');
|
||||
else
|
||||
echo "Не нарушайте покой мертвых!";
|
||||
//сработало
|
||||
if ($dmg > 0) $hit = 1; else $hit = 0;
|
||||
$action = preg_replace("/Х/", Nick::id($target)->short(), magic_log($elem, $hit, $target));
|
||||
//проверка hp>0
|
||||
if (!(($us['id'] > 0 && $us['hp'] < 1) || ($bot['id'] > 0 && $bot['hp'] < 1)))
|
||||
if ($dmg > 0) {
|
||||
if ($us)
|
||||
mysql_query("UPDATE `users` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';");
|
||||
else
|
||||
mysql_query("UPDATE `bots` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';");
|
||||
mysql_query("UPDATE `battle` SET `damage`='" . serialize($all_dmg) . "', `exp`='" . serialize($all_exp) . "' WHERE `id`='{$user['battle']}';");
|
||||
mysql_query("UPDATE `users` SET `mana` = `mana`-'" . $needmana . "' WHERE `id` = '" . $user['id'] . "';");
|
||||
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . $action . ' <strong>-' . $dmg . '</strong><BR>');
|
||||
|
||||
$bet = 1;
|
||||
} else //не сработало
|
||||
{
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . $action . '<BR>');
|
||||
$bet = 1;
|
||||
}
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet = 1;
|
||||
}
|
||||
}
|
||||
|
@ -1,70 +0,0 @@
|
||||
<?php
|
||||
|
||||
//параметры
|
||||
$needmana=60;
|
||||
$needint=60;
|
||||
$effect_id=212;
|
||||
$effect_text="Чистота Воды [1]";
|
||||
$log_text="<strong><font color=#0d2b99>Чистота Воды [1]</font></strong>";
|
||||
$mag_id=87;
|
||||
$book=866;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `date` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '".mysql_real_escape_string($_POST['target'])."' LIMIT 1;"));
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' ;"));
|
||||
$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
$mag_def="`type` = '203'";
|
||||
$md_arr=array("204","205",
|
||||
"206","207","208",
|
||||
"209","210","211",
|
||||
"212","213","214");
|
||||
foreach($md_arr as $mdi)
|
||||
$mag_def.=" OR `type` = '".$mdi."'";
|
||||
$effect = mysql_fetch_array(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '{$us['id']}' AND ({$mag_def}) LIMIT 1;"));
|
||||
// команды
|
||||
$t1 = explode(";",$bat['t1']);
|
||||
$t2 = explode(";",$bat['t2']);
|
||||
if (in_array ($user['id'],$t1)) {
|
||||
$us_team = "B1";
|
||||
}
|
||||
else {
|
||||
$us_team = "B2";
|
||||
}
|
||||
//шансы
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int=$magic['chanse'] + ($user['intel'] - $needint)*3;
|
||||
if ($int>98){$int=99;}
|
||||
}
|
||||
else {$int=0;}
|
||||
|
||||
if ($user['battle'] == 0) {
|
||||
echo "Это боевая магия...";
|
||||
} elseif (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif (in_array ($user['id'],$t1)&&!in_array($us['id'],$t1) || in_array ($user['id'],$t2)&&!in_array($us['id'],$t2)) {
|
||||
echo("Персонаж не в Вашей команде!");
|
||||
}elseif ($us && $us['battle']!=$user['battle']) {
|
||||
echo "Персонаж не в Вашем бою!";
|
||||
} elseif ($user['mana']<$needmana) {
|
||||
echo "Недостаточно энергии!";
|
||||
} elseif ($effect['time']) {
|
||||
echo "На персонаже уже есть защита от магии!";
|
||||
} elseif (!$us['online']) {
|
||||
echo "Персонаж не в игре!";
|
||||
} elseif (rand(1,100) < $int) {
|
||||
$us_in = mysql_fetch_array(mysql_query("SELECT `id` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;"));
|
||||
mysql_query("INSERT INTO `effects` (`owner`,`name`,`time`,`type`) values ('{$us_in['id']}','{$effect_text}',".(time()+7200).",'{$effect_id}');");
|
||||
echo "<font color=red><b>На персонажа ".$_POST['target']." наложено заклятие </b></font>".$log_text;
|
||||
$sex_action="применил";if($user['sex']==0) $sex_action.="а";
|
||||
if($user['id']==$us_in['id'])
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.Nick::id($user['id'])->short().' '.$sex_action.' на себя заклятие </font></b>'.$log_text.' <BR>');
|
||||
else
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.Nick::id($user['id'])->short().' '.$sex_action.' на '.Nick::id($us_in['id'])->short().' заклятие </font></b>'.$log_text.' <BR>');
|
||||
$bet=1;
|
||||
mysql_query ("UPDATE `users` SET `mana` = `mana`-'".$needmana."' WHERE `id` = '".$user['id']."';");$outok=1;
|
||||
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet=1;
|
||||
}
|
@ -1,70 +0,0 @@
|
||||
<?php
|
||||
|
||||
//параметры
|
||||
$needmana=65;
|
||||
$needint=80;
|
||||
$effect_id=213;
|
||||
$effect_text="Чистота Воды [2]";
|
||||
$log_text="<strong><font color=#0d2b99>Чистота Воды [2]</font></strong>";
|
||||
$mag_id=88;
|
||||
$book=908;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `date` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '".mysql_real_escape_string($_POST['target'])."' LIMIT 1;"));
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' ;"));
|
||||
$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
$mag_def="`type` = '203'";
|
||||
$md_arr=array("204","205",
|
||||
"206","207","208",
|
||||
"209","210","211",
|
||||
"212","213","214");
|
||||
foreach($md_arr as $mdi)
|
||||
$mag_def.=" OR `type` = '".$mdi."'";
|
||||
$effect = mysql_fetch_array(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '{$us['id']}' AND ({$mag_def}) LIMIT 1;"));
|
||||
// команды
|
||||
$t1 = explode(";",$bat['t1']);
|
||||
$t2 = explode(";",$bat['t2']);
|
||||
if (in_array ($user['id'],$t1)) {
|
||||
$us_team = "B1";
|
||||
}
|
||||
else {
|
||||
$us_team = "B2";
|
||||
}
|
||||
//шансы
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int=$magic['chanse'] + ($user['intel'] - $needint)*3;
|
||||
if ($int>98){$int=99;}
|
||||
}
|
||||
else {$int=0;}
|
||||
|
||||
if ($user['battle'] == 0) {
|
||||
echo "Это боевая магия...";
|
||||
} elseif (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif (in_array ($user['id'],$t1)&&!in_array($us['id'],$t1) || in_array ($user['id'],$t2)&&!in_array($us['id'],$t2)) {
|
||||
echo("Персонаж не в Вашей команде!");
|
||||
}elseif ($us && $us['battle']!=$user['battle']) {
|
||||
echo "Персонаж не в Вашем бою!";
|
||||
} elseif ($user['mana']<$needmana) {
|
||||
echo "Недостаточно энергии!";
|
||||
} elseif ($effect['time']) {
|
||||
echo "На персонаже уже есть защита от магии!";
|
||||
} elseif (!$us['online']) {
|
||||
echo "Персонаж не в игре!";
|
||||
} elseif (rand(1,100) < $int) {
|
||||
$us_in = mysql_fetch_array(mysql_query("SELECT `id` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;"));
|
||||
mysql_query("INSERT INTO `effects` (`owner`,`name`,`time`,`type`) values ('{$us_in['id']}','{$effect_text}',".(time()+7200).",'{$effect_id}');");
|
||||
echo "<font color=red><b>На персонажа ".$_POST['target']." наложено заклятие </b></font>".$log_text;
|
||||
$sex_action="применил";if($user['sex']==0) $sex_action.="а";
|
||||
if($user['id']==$us_in['id'])
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.Nick::id($user['id'])->short().' '.$sex_action.' на себя заклятие </font></b>'.$log_text.' <BR>');
|
||||
else
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.Nick::id($user['id'])->short().' '.$sex_action.' на '.Nick::id($us_in['id'])->short().' заклятие </font></b>'.$log_text.' <BR>');
|
||||
$bet=1;
|
||||
mysql_query ("UPDATE `users` SET `mana` = `mana`-'".$needmana."' WHERE `id` = '".$user['id']."';");$outok=1;
|
||||
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet=1;
|
||||
}
|
@ -1,70 +0,0 @@
|
||||
<?php
|
||||
|
||||
//параметры
|
||||
$needmana=80;
|
||||
$needint=100;
|
||||
$effect_id=214;
|
||||
$effect_text="Чистота Воды [3]";
|
||||
$log_text="<strong><font color=#0d2b99>Чистота Воды [3]</font></strong>";
|
||||
$mag_id=89;
|
||||
$book=909;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `date` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '".mysql_real_escape_string($_POST['target'])."' LIMIT 1;"));
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' ;"));
|
||||
$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
$mag_def="`type` = '203'";
|
||||
$md_arr=array("204","205",
|
||||
"206","207","208",
|
||||
"209","210","211",
|
||||
"212","213","214");
|
||||
foreach($md_arr as $mdi)
|
||||
$mag_def.=" OR `type` = '".$mdi."'";
|
||||
$effect = mysql_fetch_array(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '{$us['id']}' AND ({$mag_def}) LIMIT 1;"));
|
||||
// команды
|
||||
$t1 = explode(";",$bat['t1']);
|
||||
$t2 = explode(";",$bat['t2']);
|
||||
if (in_array ($user['id'],$t1)) {
|
||||
$us_team = "B1";
|
||||
}
|
||||
else {
|
||||
$us_team = "B2";
|
||||
}
|
||||
//шансы
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int=$magic['chanse'] + ($user['intel'] - $needint)*3;
|
||||
if ($int>98){$int=99;}
|
||||
}
|
||||
else {$int=0;}
|
||||
|
||||
if ($user['battle'] == 0) {
|
||||
echo "Это боевая магия...";
|
||||
} elseif (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif (in_array ($user['id'],$t1)&&!in_array($us['id'],$t1) || in_array ($user['id'],$t2)&&!in_array($us['id'],$t2)) {
|
||||
echo("Персонаж не в Вашей команде!");
|
||||
}elseif ($us && $us['battle']!=$user['battle']) {
|
||||
echo "Персонаж не в Вашем бою!";
|
||||
} elseif ($user['mana']<$needmana) {
|
||||
echo "Недостаточно энергии!";
|
||||
} elseif ($effect['time']) {
|
||||
echo "На персонаже уже есть защита от магии!";
|
||||
} elseif (!$us['online']) {
|
||||
echo "Персонаж не в игре!";
|
||||
} elseif (rand(1,100) < $int) {
|
||||
$us_in = mysql_fetch_array(mysql_query("SELECT `id` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;"));
|
||||
mysql_query("INSERT INTO `effects` (`owner`,`name`,`time`,`type`) values ('{$us_in['id']}','{$effect_text}',".(time()+7200).",'{$effect_id}');");
|
||||
echo "<font color=red><b>На персонажа ".$_POST['target']." наложено заклятие </b></font>".$log_text;
|
||||
$sex_action="применил";if($user['sex']==0) $sex_action.="а";
|
||||
if($user['id']==$us_in['id'])
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.Nick::id($user['id'])->short().' '.$sex_action.' на себя заклятие </font></b>'.$log_text.' <BR>');
|
||||
else
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.Nick::id($user['id'])->short().' '.$sex_action.' на '.Nick::id($us_in['id'])->short().' заклятие </font></b>'.$log_text.' <BR>');
|
||||
$bet=1;
|
||||
mysql_query ("UPDATE `users` SET `mana` = `mana`-'".$needmana."' WHERE `id` = '".$user['id']."';");$outok=1;
|
||||
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet=1;
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
<?php
|
||||
|
||||
//параметры
|
||||
$needint=0;
|
||||
$effect_id=224;
|
||||
$effect_text="Стена Воды [1]";
|
||||
$log_text="<strong><font color=#0d2b99>Стена Воды [1]</font></strong>";
|
||||
$mag_id=135;
|
||||
$book=866;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `date` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '".mysql_real_escape_string($_POST['target'])."' LIMIT 1;"));
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' ;"));
|
||||
|
||||
$mag_def="`type` = '215'";
|
||||
$md_arr=array("216","217","218","219","220","221","222","223","224","225","226");
|
||||
foreach($md_arr as $mdi)
|
||||
$mag_def.=" OR `type` = '".$mdi."'";
|
||||
$effect = mysql_fetch_array(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '{$us['id']}' AND ({$mag_def}) LIMIT 1;"));
|
||||
//шансы
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int=$magic['chanse'] + ($user['intel'] - $needint)*3;
|
||||
if ($int>98){$int=99;}
|
||||
}
|
||||
else {$int=0;}
|
||||
|
||||
if (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif ($effect['time']) {
|
||||
echo "На персонаже уже есть защита от магии!";
|
||||
} elseif (!$us['online']) {
|
||||
echo "Персонаж не в игре!";
|
||||
} elseif ($user['battle'] > 0) { echo "Не в бою...";
|
||||
} elseif (rand(1,100) < $int) {
|
||||
$us_in = mysql_fetch_array(mysql_query("SELECT `id` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;"));
|
||||
mysql_query("INSERT INTO `effects` (`owner`,`name`,`time`,`type`) values ('{$us_in['id']}','{$effect_text}',".(time()+7200).",'{$effect_id}');");
|
||||
echo "<font color=red><b>На персонажа ".$_POST['target']." наложено заклятие </b></font>".$log_text;
|
||||
$bet=1;
|
||||
$outok=1;
|
||||
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet=1;
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
<?php
|
||||
|
||||
//параметры
|
||||
$needint=0;
|
||||
$effect_id=225;
|
||||
$effect_text="Стена Воды [2]";
|
||||
$log_text="<strong><font color=#0d2b99>Стена Воды [2]</font></strong>";
|
||||
$mag_id=136;
|
||||
$book=908;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `date` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '".mysql_real_escape_string($_POST['target'])."' LIMIT 1;"));
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' ;"));
|
||||
|
||||
$mag_def="`type` = '215'";
|
||||
$md_arr=array("216","217","218","219","220","221","222","223","224","225","226");
|
||||
foreach($md_arr as $mdi)
|
||||
$mag_def.=" OR `type` = '".$mdi."'";
|
||||
$effect = mysql_fetch_array(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '{$us['id']}' AND ({$mag_def}) LIMIT 1;"));
|
||||
//шансы
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int=$magic['chanse'] + ($user['intel'] - $needint)*3;
|
||||
if ($int>98){$int=99;}
|
||||
}
|
||||
else {$int=0;}
|
||||
|
||||
if (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif ($effect['time']) {
|
||||
echo "На персонаже уже есть защита от магии!";
|
||||
} elseif (!$us['online']) {
|
||||
echo "Персонаж не в игре!";
|
||||
} elseif (rand(1,100) < $int) {
|
||||
$us_in = mysql_fetch_array(mysql_query("SELECT `id` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;"));
|
||||
mysql_query("INSERT INTO `effects` (`owner`,`name`,`time`,`type`) values ('{$us_in['id']}','{$effect_text}',".(time()+7200).",'{$effect_id}');");
|
||||
echo "<font color=red><b>На персонажа ".$_POST['target']." наложено заклятие </b></font>".$log_text;
|
||||
$bet=1;
|
||||
$outok=1;
|
||||
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet=1;
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
<?php
|
||||
|
||||
//параметры
|
||||
$needint=0;
|
||||
$effect_id=226;
|
||||
$effect_text="Стена Воды [3]";
|
||||
$log_text="<strong><font color=#0d2b99>Стена Воды [3]</font></strong>";
|
||||
$mag_id=137;
|
||||
$book=909;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `date` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '".mysql_real_escape_string($_POST['target'])."' LIMIT 1;"));
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' ;"));
|
||||
|
||||
$mag_def="`type` = '215'";
|
||||
$md_arr=array("216","217","218","219","220","221","222","223","224","225","226");
|
||||
foreach($md_arr as $mdi)
|
||||
$mag_def.=" OR `type` = '".$mdi."'";
|
||||
$effect = mysql_fetch_array(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '{$us['id']}' AND ({$mag_def}) LIMIT 1;"));
|
||||
//шансы
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int=$magic['chanse'] + ($user['intel'] - $needint)*3;
|
||||
if ($int>98){$int=99;}
|
||||
}
|
||||
else {$int=0;}
|
||||
|
||||
if (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif ($effect['time']) {
|
||||
echo "На персонаже уже есть защита от магии!";
|
||||
} elseif (!$us['online']) {
|
||||
echo "Персонаж не в игре!";
|
||||
} elseif ($user['battle'] > 0) { echo "Не в бою...";
|
||||
} elseif (rand(1,100) < $int) {
|
||||
$us_in = mysql_fetch_array(mysql_query("SELECT `id` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;"));
|
||||
mysql_query("INSERT INTO `effects` (`owner`,`name`,`time`,`type`) values ('{$us_in['id']}','{$effect_text}',".(time()+7200).",'{$effect_id}');");
|
||||
echo "<font color=red><b>На персонажа ".$_POST['target']." наложено заклятие </b></font>".$log_text;
|
||||
$bet=1;
|
||||
$outok=1;
|
||||
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet=1;
|
||||
}
|
@ -1,152 +0,0 @@
|
||||
<?php
|
||||
//параметры
|
||||
$basedmg = 110;
|
||||
$needmana = 20;
|
||||
$needint = 80;
|
||||
$elem = 'w';
|
||||
$mag_id = 99;
|
||||
$log_text = "<strong><font color=#0d2b99>Оледенение [1]</font></strong>";
|
||||
$book = 866;
|
||||
$have_book = mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
|
||||
if (empty($_SESSION['uid'])) {
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= " . (time() - 60) . " AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;"));
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;"));
|
||||
$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
if (!$us) $bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `name` = '" . $_POST['target'] . "' LIMIT 1;"));
|
||||
//mana needed
|
||||
$t1 = explode(";", $bat['t1']);
|
||||
$t2 = explode(";", $bat['t2']);
|
||||
if ($us) $e_id = $us['id'];
|
||||
else $e_id = $bot['id'];
|
||||
if ($user['battle'] == 0) {
|
||||
echo "Это боевая магия...";
|
||||
} elseif (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif ((in_array($user['id'], $t1) && in_array($e_id, $t1)) || (in_array($user['id'], $t2) && in_array($e_id, $t2))) {
|
||||
echo "Персонаж в Вашей команде!";
|
||||
} elseif ($user['login'] == $_POST['target']) {
|
||||
echo "Герр Леопольд фон Захер Мазох был бы доволен Вами...";
|
||||
} elseif ($us && $us['battle'] != $user['battle']) {
|
||||
echo "Персонаж не в Вашем бою!";
|
||||
} elseif ($user['mana'] < $needmana) {
|
||||
echo "Недостаточно энергии!";
|
||||
} elseif (!$us['online'] && !$bot) {
|
||||
echo "Персонаж не в игре!";
|
||||
} else {
|
||||
//attack script
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int = $magic['chanse'] + ($user['intel'] - $needint) * 3;
|
||||
if ($int > 98) {
|
||||
$int = 99;
|
||||
}
|
||||
} else {
|
||||
$int = 0;
|
||||
}
|
||||
|
||||
if (rand(1, 100) < $int) {
|
||||
global $elem_align, $elem_bonus;
|
||||
|
||||
$user_elem = element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)));
|
||||
|
||||
switch ($user_elem) {
|
||||
case 'f':
|
||||
$uel = 'mfire';
|
||||
break;
|
||||
case 'a':
|
||||
$uel = 'mair';
|
||||
break;
|
||||
case 'w':
|
||||
$uel = 'mwater';
|
||||
break;
|
||||
case 'e':
|
||||
$uel = 'mearth';
|
||||
break;
|
||||
}
|
||||
switch ($elem) {
|
||||
case 'f':
|
||||
$sel = 'mfire';
|
||||
break;
|
||||
case 'a':
|
||||
$sel = 'mair';
|
||||
break;
|
||||
case 'w':
|
||||
$sel = 'mwater';
|
||||
break;
|
||||
case 'e':
|
||||
$sel = 'mearth';
|
||||
break;
|
||||
}
|
||||
//dmg=base+INT/LVL+X_magic
|
||||
$dmg = $basedmg + ($user['intel'] / 4) + $user[$sel];
|
||||
//MF
|
||||
$dmg *= $elem_align[$user_elem][$elem];
|
||||
if ($us) $dmg *= $elem_bonus[element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)))][element(star_sign(substr($us['borndate'], 3, 2), substr($us['borndate'], 0, 2)))];
|
||||
//- MF
|
||||
if ($us) {
|
||||
$def = magic_def($elem, $_POST['target'], $user_elem);
|
||||
$dmg *= (1 - magic_def($elem, $us['login'], $user_elem, 1) / 100);
|
||||
$dmg -= $def;
|
||||
}
|
||||
|
||||
//rand +- 25%
|
||||
$dmg = mt_rand(0.75 * $dmg, 1.25 * $dmg);
|
||||
$dmg = round($dmg);
|
||||
if ($us) $target = $us['id'];
|
||||
else $target = $bot['id'];
|
||||
// команды
|
||||
$t1 = explode(";", $bat['t1']);
|
||||
$t2 = explode(";", $bat['t2']);
|
||||
if (in_array($user['id'], $t1)) {
|
||||
$us_team = "B1";
|
||||
$tar_team = "B2";
|
||||
} else {
|
||||
$us_team = "B2";
|
||||
$tar_team = "B1";
|
||||
}
|
||||
|
||||
$targeted = ' на ' . Nick::id($target)->short();
|
||||
//dmg >0 - go
|
||||
$all_dmg = unserialize($bat['damage']);
|
||||
$all_exp = unserialize($bat['exp']);
|
||||
$all_dmg[$user['id']] += $dmg;
|
||||
$all_exp[$user['id']] += SolveExp($user['id'], $target, $dmg);
|
||||
$sex_action = "применил";
|
||||
if ($user['sex'] == 0) $sex_action .= "а";
|
||||
if (!(($us['id'] > 0 && $us['hp'] < 1) || ($bot['id'] > 0 && $bot['hp'] < 1)))
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . Nick::id($user['id'])->short() . ' ' . $sex_action . $targeted . ' заклинание ' . $log_text . '<BR>');
|
||||
else
|
||||
echo "Не нарушайте покой мертвых!";
|
||||
//сработало
|
||||
if ($dmg > 0) $hit = 1; else $hit = 0;
|
||||
$action = preg_replace("/Х/", Nick::id($target)->short(), magic_log($elem, $hit, $target));
|
||||
//проверка hp>0
|
||||
if (!(($us['id'] > 0 && $us['hp'] < 1) || ($bot['id'] > 0 && $bot['hp'] < 1)))
|
||||
if ($dmg > 0) {
|
||||
if ($us)
|
||||
mysql_query("UPDATE `users` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';");
|
||||
else
|
||||
mysql_query("UPDATE `bots` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';");
|
||||
mysql_query("UPDATE `battle` SET `damage`='" . serialize($all_dmg) . "', `exp`='" . serialize($all_exp) . "' WHERE `id`='{$user['battle']}';");
|
||||
mysql_query("UPDATE `users` SET `mana` = `mana`-'" . $needmana . "' WHERE `id` = '" . $user['id'] . "';");
|
||||
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . $action . ' <strong>-' . $dmg . '</strong><BR>');
|
||||
|
||||
$bet = 1;
|
||||
} else //не сработало
|
||||
{
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . $action . '<BR>');
|
||||
$bet = 1;
|
||||
}
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet = 1;
|
||||
}
|
||||
}
|
||||
|
@ -1,152 +0,0 @@
|
||||
<?php
|
||||
//параметры
|
||||
$basedmg = 150;
|
||||
$needmana = 35;
|
||||
$needint = 100;
|
||||
$elem = 'w';
|
||||
$mag_id = 100;
|
||||
$log_text = "<strong><font color=#0d2b99>Оледенение [2]</font></strong>";
|
||||
$book = 908;
|
||||
$have_book = mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
|
||||
if (empty($_SESSION['uid'])) {
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= " . (time() - 60) . " AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;"));
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;"));
|
||||
$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
if (!$us) $bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `name` = '" . $_POST['target'] . "' LIMIT 1;"));
|
||||
//mana needed
|
||||
$t1 = explode(";", $bat['t1']);
|
||||
$t2 = explode(";", $bat['t2']);
|
||||
if ($us) $e_id = $us['id'];
|
||||
else $e_id = $bot['id'];
|
||||
if ($user['battle'] == 0) {
|
||||
echo "Это боевая магия...";
|
||||
} elseif (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif ((in_array($user['id'], $t1) && in_array($e_id, $t1)) || (in_array($user['id'], $t2) && in_array($e_id, $t2))) {
|
||||
echo "Персонаж в Вашей команде!";
|
||||
} elseif ($user['login'] == $_POST['target']) {
|
||||
echo "Герр Леопольд фон Захер Мазох был бы доволен Вами...";
|
||||
} elseif ($us && $us['battle'] != $user['battle']) {
|
||||
echo "Персонаж не в Вашем бою!";
|
||||
} elseif ($user['mana'] < $needmana) {
|
||||
echo "Недостаточно энергии!";
|
||||
} elseif (!$us['online'] && !$bot) {
|
||||
echo "Персонаж не в игре!";
|
||||
} else {
|
||||
//attack script
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int = $magic['chanse'] + ($user['intel'] - $needint) * 3;
|
||||
if ($int > 98) {
|
||||
$int = 99;
|
||||
}
|
||||
} else {
|
||||
$int = 0;
|
||||
}
|
||||
|
||||
if (rand(1, 100) < $int) {
|
||||
global $elem_align, $elem_bonus;
|
||||
|
||||
$user_elem = element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)));
|
||||
|
||||
switch ($user_elem) {
|
||||
case 'f':
|
||||
$uel = 'mfire';
|
||||
break;
|
||||
case 'a':
|
||||
$uel = 'mair';
|
||||
break;
|
||||
case 'w':
|
||||
$uel = 'mwater';
|
||||
break;
|
||||
case 'e':
|
||||
$uel = 'mearth';
|
||||
break;
|
||||
}
|
||||
switch ($elem) {
|
||||
case 'f':
|
||||
$sel = 'mfire';
|
||||
break;
|
||||
case 'a':
|
||||
$sel = 'mair';
|
||||
break;
|
||||
case 'w':
|
||||
$sel = 'mwater';
|
||||
break;
|
||||
case 'e':
|
||||
$sel = 'mearth';
|
||||
break;
|
||||
}
|
||||
//dmg=base+INT/LVL+X_magic
|
||||
$dmg = $basedmg + ($user['intel'] / 4) + $user[$sel];
|
||||
//MF
|
||||
$dmg *= $elem_align[$user_elem][$elem];
|
||||
if ($us) $dmg *= $elem_bonus[element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)))][element(star_sign(substr($us['borndate'], 3, 2), substr($us['borndate'], 0, 2)))];
|
||||
//- MF
|
||||
if ($us) {
|
||||
$def = magic_def($elem, $_POST['target'], $user_elem);
|
||||
$dmg *= (1 - magic_def($elem, $us['login'], $user_elem, 1) / 100);
|
||||
$dmg -= $def;
|
||||
}
|
||||
|
||||
//rand +- 25%
|
||||
$dmg = mt_rand(0.75 * $dmg, 1.25 * $dmg);
|
||||
$dmg = round($dmg);
|
||||
if ($us) $target = $us['id'];
|
||||
else $target = $bot['id'];
|
||||
// команды
|
||||
$t1 = explode(";", $bat['t1']);
|
||||
$t2 = explode(";", $bat['t2']);
|
||||
if (in_array($user['id'], $t1)) {
|
||||
$us_team = "B1";
|
||||
$tar_team = "B2";
|
||||
} else {
|
||||
$us_team = "B2";
|
||||
$tar_team = "B1";
|
||||
}
|
||||
|
||||
$targeted = ' на ' . Nick::id($target)->short();
|
||||
//dmg >0 - go
|
||||
$all_dmg = unserialize($bat['damage']);
|
||||
$all_exp = unserialize($bat['exp']);
|
||||
$all_dmg[$user['id']] += $dmg;
|
||||
$all_exp[$user['id']] += SolveExp($user['id'], $target, $dmg);
|
||||
$sex_action = "применил";
|
||||
if ($user['sex'] == 0) $sex_action .= "а";
|
||||
if (!(($us['id'] > 0 && $us['hp'] < 1) || ($bot['id'] > 0 && $bot['hp'] < 1)))
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . Nick::id($user['id'])->short() . ' ' . $sex_action . $targeted . ' заклинание ' . $log_text . '<BR>');
|
||||
else
|
||||
echo "Не нарушайте покой мертвых!";
|
||||
//сработало
|
||||
if ($dmg > 0) $hit = 1; else $hit = 0;
|
||||
$action = preg_replace("/Х/", Nick::id($target)->short(), magic_log($elem, $hit, $target));
|
||||
//проверка hp>0
|
||||
if (!(($us['id'] > 0 && $us['hp'] < 1) || ($bot['id'] > 0 && $bot['hp'] < 1)))
|
||||
if ($dmg > 0) {
|
||||
if ($us)
|
||||
mysql_query("UPDATE `users` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';");
|
||||
else
|
||||
mysql_query("UPDATE `bots` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';");
|
||||
mysql_query("UPDATE `battle` SET `damage`='" . serialize($all_dmg) . "', `exp`='" . serialize($all_exp) . "' WHERE `id`='{$user['battle']}';");
|
||||
mysql_query("UPDATE `users` SET `mana` = `mana`-'" . $needmana . "' WHERE `id` = '" . $user['id'] . "';");
|
||||
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . $action . ' <strong>-' . $dmg . '</strong><BR>');
|
||||
|
||||
$bet = 1;
|
||||
} else //не сработало
|
||||
{
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . $action . '<BR>');
|
||||
$bet = 1;
|
||||
}
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet = 1;
|
||||
}
|
||||
}
|
||||
|
@ -1,136 +0,0 @@
|
||||
<?php
|
||||
//параметры
|
||||
$basedmg=300;
|
||||
$needmana=50;
|
||||
$needint=120;
|
||||
$elem='w';
|
||||
$mag_id=101;
|
||||
$log_text="<strong><font color=#0d2b99>Оледенение [3]</font></strong>";
|
||||
$book=909;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
|
||||
if (empty($_SESSION['uid'])) {
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `login` = '{$_POST['target']}' LIMIT 1;"));
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;"));
|
||||
$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
if(!$us) $bot= mysql_fetch_array(mysql_query ("SELECT * FROM `bots` WHERE `name` = '".$_POST['target']."' LIMIT 1;"));
|
||||
//mana needed
|
||||
$t1 = explode(";",$bat['t1']);
|
||||
$t2 = explode(";",$bat['t2']);
|
||||
if($us) $e_id=$us['id'];
|
||||
else $e_id=$bot['id'];
|
||||
if ($user['battle'] == 0) {
|
||||
echo "Это боевая магия...";
|
||||
} elseif (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif((in_array ($user['id'],$t1)&&in_array ($e_id,$t1)) || (in_array ($user['id'],$t2)&&in_array ($e_id,$t2))) {
|
||||
echo "Персонаж в Вашей команде!";
|
||||
} elseif($user['login']==$_POST['target']) {
|
||||
echo "Герр Леопольд фон Захер Мазох был бы доволен Вами...";
|
||||
} elseif ($us && $us['battle']!=$user['battle']) {
|
||||
echo "Персонаж не в Вашем бою!";
|
||||
} elseif ($user['mana']<$needmana) {
|
||||
echo "Недостаточно энергии!";
|
||||
} elseif (!$us['online']&&!$bot) {
|
||||
echo "Персонаж не в игре!";
|
||||
} else {
|
||||
//attack script
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int=$magic['chanse'] + ($user['intel'] - $needint)*3;
|
||||
if ($int>98){$int=99;}
|
||||
}
|
||||
else {$int=0;}
|
||||
|
||||
if (rand(1,100) < $int) {
|
||||
global $elem_align,$elem_bonus;
|
||||
|
||||
$user_elem=element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2)));
|
||||
|
||||
switch($user_elem)
|
||||
{
|
||||
case 'f':$uel='mfire';break;
|
||||
case 'a':$uel='mair';break;
|
||||
case 'w':$uel='mwater';break;
|
||||
case 'e':$uel='mearth';break;
|
||||
};
|
||||
switch($elem)
|
||||
{
|
||||
case 'f':$sel='mfire';break;
|
||||
case 'a':$sel='mair';break;
|
||||
case 'w':$sel='mwater';break;
|
||||
case 'e':$sel='mearth';break;
|
||||
};
|
||||
//dmg=base+INT/LVL+X_magic
|
||||
$dmg=$basedmg+($user['intel']/4)+$user[$sel];
|
||||
//MF
|
||||
$dmg*=$elem_align[$user_elem][$elem];
|
||||
if($us) $dmg*=$elem_bonus[element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2)))][element(star_sign(substr($us['borndate'],3,2), substr($us['borndate'],0,2)))];
|
||||
//- MF
|
||||
if($us) {
|
||||
$def=magic_def($elem,$_POST['target'],$user_elem);$dmg*=(1-magic_def($elem,$us['login'],$user_elem,1)/100);
|
||||
$dmg-=$def;
|
||||
}
|
||||
|
||||
//rand +- 25%
|
||||
$dmg=mt_rand(0.75*$dmg,1.25*$dmg);
|
||||
$dmg=round($dmg);
|
||||
if($us) $target=$us['id'];
|
||||
else $target=$bot['id'];
|
||||
// команды
|
||||
$t1 = explode(";",$bat['t1']);
|
||||
$t2 = explode(";",$bat['t2']);
|
||||
if (in_array ($user['id'],$t1)) {
|
||||
$us_team = "B1";
|
||||
$tar_team = "B2";
|
||||
}
|
||||
else {
|
||||
$us_team = "B2";
|
||||
$tar_team = "B1";
|
||||
}
|
||||
|
||||
$targeted=' на '.Nick::id($target)->short();
|
||||
//dmg >0 - go
|
||||
$all_dmg=unserialize($bat['damage']);
|
||||
$all_exp=unserialize($bat['exp']);
|
||||
$all_dmg[$user['id']]+=$dmg;
|
||||
$all_exp[$user['id']]+=SolveExp($user['id'],$target,$dmg);
|
||||
$sex_action="применил";if($user['sex']==0) $sex_action.="а";
|
||||
if(!(($us['id']>0 && $us['hp']<1) || ($bot['id']>0 && $bot['hp']<1)))
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.Nick::id($user['id'])->short().' '.$sex_action.$targeted.' заклинание '.$log_text.'<BR>');
|
||||
else
|
||||
echo "Не нарушайте покой мертвых!";
|
||||
//сработало
|
||||
if($dmg>0) $hit=1; else $hit=0;
|
||||
$action=preg_replace("/Х/",Nick::id($target)->short(),magic_log($elem,$hit,$target));
|
||||
//проверка hp>0
|
||||
if(!(($us['id']>0 && $us['hp']<1) || ($bot['id']>0 && $bot['hp']<1)))
|
||||
if($dmg>0)
|
||||
{
|
||||
if($us)
|
||||
mysql_query("UPDATE `users` SET `hp` = `hp`-'".$dmg."' WHERE `id` = '".$target."';");
|
||||
else
|
||||
mysql_query("UPDATE `bots` SET `hp` = `hp`-'".$dmg."' WHERE `id` = '".$target."';");
|
||||
mysql_query("UPDATE `battle` SET `damage`='".serialize($all_dmg)."', `exp`='".serialize($all_exp)."' WHERE `id`='{$user['battle']}';");
|
||||
mysql_query ("UPDATE `users` SET `mana` = `mana`-'".$needmana."' WHERE `id` = '".$user['id']."';");
|
||||
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.$action.' <strong>-'.$dmg.'</strong><BR>');
|
||||
|
||||
$bet=1;
|
||||
}
|
||||
else
|
||||
//не сработало
|
||||
{
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.$action.'<BR>');
|
||||
$bet=1;
|
||||
}
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet=1;
|
||||
}
|
||||
}
|
||||
|
@ -1,148 +0,0 @@
|
||||
<?php
|
||||
//параметры
|
||||
$basedmg = 150;
|
||||
$needmana = 55;
|
||||
$needint = 80;
|
||||
$elem = 'w';
|
||||
$t_min = 1;
|
||||
$t_max = 2;
|
||||
$count = mt_rand($t_min, $t_max);
|
||||
$mag_id = 123;
|
||||
$log_text = "<strong><font color=#0d2b99>Регенерация [1]</font></strong>";
|
||||
$book = 866;
|
||||
$have_book = mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
|
||||
if (empty($_SESSION['uid'])) {
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;"));
|
||||
$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
//mana needed
|
||||
$t1 = explode(";", $bat['t1']);
|
||||
$t2 = explode(";", $bat['t2']);
|
||||
if (in_array($user['id'], $t1)) $e_team = $t1;
|
||||
if (in_array($user['id'], $t2)) $e_team = $t2;
|
||||
foreach ($e_team as $k => $l) {
|
||||
if ($l > _BOTSEPARATOR_) $e_hp = mysql_fetch_array(mysql_query("SELECT `hp` FROM `bots` WHERE `id`='{$l}' LIMIT 1;"));
|
||||
else $e_hp = mysql_fetch_array(mysql_query("SELECT `hp` FROM `users` WHERE `id`='{$l}' LIMIT 1;"));
|
||||
if ($e_hp['hp'] < 1) unset($e_team[$k]);
|
||||
}
|
||||
shuffle($e_team);
|
||||
|
||||
if ($user['battle'] == 0) {
|
||||
echo "Это боевая магия...";
|
||||
} elseif (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif ($user['mana'] < $needmana) {
|
||||
echo "Недостаточно энергии!";
|
||||
} else {
|
||||
//attack script
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int = $magic['chanse'] + ($user['intel'] - $needint) * 3;
|
||||
if ($int > 98) {
|
||||
$int = 99;
|
||||
}
|
||||
} else {
|
||||
$int = 0;
|
||||
}
|
||||
|
||||
if (rand(1, 100) < $int) {
|
||||
global $elem_align, $elem_bonus;
|
||||
$user_elem = element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)));
|
||||
|
||||
switch ($user_elem) {
|
||||
case 'f':
|
||||
$uel = 'mfire';
|
||||
break;
|
||||
case 'a':
|
||||
$uel = 'mair';
|
||||
break;
|
||||
case 'w':
|
||||
$uel = 'mwater';
|
||||
break;
|
||||
case 'e':
|
||||
$uel = 'mearth';
|
||||
break;
|
||||
}
|
||||
switch ($elem) {
|
||||
case 'f':
|
||||
$sel = 'mfire';
|
||||
break;
|
||||
case 'a':
|
||||
$sel = 'mair';
|
||||
break;
|
||||
case 'w':
|
||||
$sel = 'mwater';
|
||||
break;
|
||||
case 'e':
|
||||
$sel = 'mearth';
|
||||
break;
|
||||
}
|
||||
$sex_action = "применил";
|
||||
if ($user['sex'] == 0) $sex_action .= "а";
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . Nick::id($user['id'])->short() . ' ' . $sex_action . $targeted . ' заклинание ' . $log_text . '<BR>');
|
||||
|
||||
//mass magic
|
||||
mysql_query("UPDATE `users` SET `mana` = `mana`-'" . $needmana . "' WHERE `id` = '" . $user['id'] . "';");
|
||||
foreach ($e_team as $v)
|
||||
if ($count > 0) {
|
||||
$count--;
|
||||
$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= " . (time() - 60) . " AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;"));
|
||||
if (!$us) {
|
||||
$bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;"));
|
||||
$b_maxhp = mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;"));
|
||||
$b_maxhp = $b_maxhp['maxhp'];
|
||||
}
|
||||
//dmg=base+INT/LVL+X_magic
|
||||
$dmg = $basedmg + ($user['intel'] / $user['level']) + $user[$sel];
|
||||
//MF
|
||||
$dmg *= $elem_align[$user_elem][$elem];
|
||||
if ($us) $dmg *= $elem_bonus[element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)))][element(star_sign(substr($us['borndate'], 3, 2), substr($us['borndate'], 0, 2)))];
|
||||
//rand +- 25%
|
||||
$dmg = mt_rand(0.75 * $dmg, 1.25 * $dmg);
|
||||
$dmg = round($dmg);
|
||||
if ($us) $delta = $us['maxhp'] - $us['hp'];
|
||||
else $delta = $b_maxhp - $bot['hp'];
|
||||
if ($delta < $dmg) $dmg = floor($delta);
|
||||
if ($dmg < 1) $dmg = 0;
|
||||
|
||||
if ($us) $target = $us['id'];
|
||||
else $target = $bot['id'];
|
||||
|
||||
$targeted = '';
|
||||
//dmg >0 - go
|
||||
$all_dmg = unserialize($bat['damage']);
|
||||
$all_exp = unserialize($bat['exp']);
|
||||
$all_dmg[$user['id']] += $dmg;
|
||||
$all_exp[$user['id']] += SolveExp($user['id'], $target, $dmg);
|
||||
|
||||
//сработало
|
||||
if ($dmg > 0) $hit = '-1'; else $hit = 0;
|
||||
$action = preg_replace("/Х/", Nick::id($target)->short(), magic_log($elem, $hit, $target));
|
||||
if ($dmg > 0) {
|
||||
if ($us)
|
||||
mysql_query("UPDATE `users` SET `hp` = `hp`+'" . $dmg . "' WHERE `id` = '" . $target . "';");
|
||||
else
|
||||
mysql_query("UPDATE `bots` SET `hp` = `hp`+'" . $dmg . "' WHERE `id` = '" . $target . "';");
|
||||
mysql_query("UPDATE `battle` SET `damage`='" . serialize($all_dmg) . "', `exp`='" . serialize($all_exp) . "' WHERE `id`='{$user['battle']}';");
|
||||
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . $action . ' <strong>+' . $dmg . '</strong><BR>');
|
||||
|
||||
$bet = 1;
|
||||
} else //не сработало
|
||||
{
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . $action . '<BR>');
|
||||
$bet = 1;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet = 1;
|
||||
}
|
||||
}
|
||||
|
@ -1,148 +0,0 @@
|
||||
<?php
|
||||
//параметры
|
||||
$basedmg = 210;
|
||||
$needmana = 65;
|
||||
$needint = 100;
|
||||
$elem = 'w';
|
||||
$t_min = 1;
|
||||
$t_max = 3;
|
||||
$count = mt_rand($t_min, $t_max);
|
||||
$mag_id = 124;
|
||||
$log_text = "<strong><font color=#0d2b99>Регенерация [2]</font></strong>";
|
||||
$book = 908;
|
||||
$have_book = mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
|
||||
if (empty($_SESSION['uid'])) {
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;"));
|
||||
$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
//mana needed
|
||||
$t1 = explode(";", $bat['t1']);
|
||||
$t2 = explode(";", $bat['t2']);
|
||||
if (in_array($user['id'], $t1)) $e_team = $t1;
|
||||
if (in_array($user['id'], $t2)) $e_team = $t2;
|
||||
foreach ($e_team as $k => $l) {
|
||||
if ($l > _BOTSEPARATOR_) $e_hp = mysql_fetch_array(mysql_query("SELECT `hp` FROM `bots` WHERE `id`='{$l}' LIMIT 1;"));
|
||||
else $e_hp = mysql_fetch_array(mysql_query("SELECT `hp` FROM `users` WHERE `id`='{$l}' LIMIT 1;"));
|
||||
if ($e_hp['hp'] < 1) unset($e_team[$k]);
|
||||
}
|
||||
shuffle($e_team);
|
||||
|
||||
if ($user['battle'] == 0) {
|
||||
echo "Это боевая магия...";
|
||||
} elseif (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif ($user['mana'] < $needmana) {
|
||||
echo "Недостаточно энергии!";
|
||||
} else {
|
||||
//attack script
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int = $magic['chanse'] + ($user['intel'] - $needint) * 3;
|
||||
if ($int > 98) {
|
||||
$int = 99;
|
||||
}
|
||||
} else {
|
||||
$int = 0;
|
||||
}
|
||||
|
||||
if (rand(1, 100) < $int) {
|
||||
global $elem_align, $elem_bonus;
|
||||
$user_elem = element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)));
|
||||
|
||||
switch ($user_elem) {
|
||||
case 'f':
|
||||
$uel = 'mfire';
|
||||
break;
|
||||
case 'a':
|
||||
$uel = 'mair';
|
||||
break;
|
||||
case 'w':
|
||||
$uel = 'mwater';
|
||||
break;
|
||||
case 'e':
|
||||
$uel = 'mearth';
|
||||
break;
|
||||
}
|
||||
switch ($elem) {
|
||||
case 'f':
|
||||
$sel = 'mfire';
|
||||
break;
|
||||
case 'a':
|
||||
$sel = 'mair';
|
||||
break;
|
||||
case 'w':
|
||||
$sel = 'mwater';
|
||||
break;
|
||||
case 'e':
|
||||
$sel = 'mearth';
|
||||
break;
|
||||
}
|
||||
$sex_action = "применил";
|
||||
if ($user['sex'] == 0) $sex_action .= "а";
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . Nick::id($user['id'])->short() . ' ' . $sex_action . $targeted . ' заклинание ' . $log_text . '<BR>');
|
||||
|
||||
//mass magic
|
||||
mysql_query("UPDATE `users` SET `mana` = `mana`-'" . $needmana . "' WHERE `id` = '" . $user['id'] . "';");
|
||||
foreach ($e_team as $v)
|
||||
if ($count > 0) {
|
||||
$count--;
|
||||
$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= " . (time() - 60) . " AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;"));
|
||||
if (!$us) {
|
||||
$bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;"));
|
||||
$b_maxhp = mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;"));
|
||||
$b_maxhp = $b_maxhp['maxhp'];
|
||||
}
|
||||
//dmg=base+INT/LVL+X_magic
|
||||
$dmg = $basedmg + ($user['intel'] / $user['level']) + $user[$sel];
|
||||
//MF
|
||||
$dmg *= $elem_align[$user_elem][$elem];
|
||||
if ($us) $dmg *= $elem_bonus[element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)))][element(star_sign(substr($us['borndate'], 3, 2), substr($us['borndate'], 0, 2)))];
|
||||
//rand +- 25%
|
||||
$dmg = mt_rand(0.75 * $dmg, 1.25 * $dmg);
|
||||
$dmg = round($dmg);
|
||||
if ($us) $delta = $us['maxhp'] - $us['hp'];
|
||||
else $delta = $b_maxhp - $bot['hp'];
|
||||
if ($delta < $dmg) $dmg = floor($delta);
|
||||
if ($dmg < 1) $dmg = 0;
|
||||
|
||||
if ($us) $target = $us['id'];
|
||||
else $target = $bot['id'];
|
||||
|
||||
$targeted = '';
|
||||
//dmg >0 - go
|
||||
$all_dmg = unserialize($bat['damage']);
|
||||
$all_exp = unserialize($bat['exp']);
|
||||
$all_dmg[$user['id']] += $dmg;
|
||||
$all_exp[$user['id']] += SolveExp($user['id'], $target, $dmg);
|
||||
|
||||
//сработало
|
||||
if ($dmg > 0) $hit = '-1'; else $hit = 0;
|
||||
$action = preg_replace("/Х/", Nick::id($target)->short(), magic_log($elem, $hit, $target));
|
||||
if ($dmg > 0) {
|
||||
if ($us)
|
||||
mysql_query("UPDATE `users` SET `hp` = `hp`+'" . $dmg . "' WHERE `id` = '" . $target . "';");
|
||||
else
|
||||
mysql_query("UPDATE `bots` SET `hp` = `hp`+'" . $dmg . "' WHERE `id` = '" . $target . "';");
|
||||
mysql_query("UPDATE `battle` SET `damage`='" . serialize($all_dmg) . "', `exp`='" . serialize($all_exp) . "' WHERE `id`='{$user['battle']}';");
|
||||
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . $action . ' <strong>+' . $dmg . '</strong><BR>');
|
||||
|
||||
$bet = 1;
|
||||
} else //не сработало
|
||||
{
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . $action . '<BR>');
|
||||
$bet = 1;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet = 1;
|
||||
}
|
||||
}
|
||||
|
@ -1,148 +0,0 @@
|
||||
<?php
|
||||
//параметры
|
||||
$basedmg = 330;
|
||||
$needmana = 75;
|
||||
$needint = 120;
|
||||
$elem = 'w';
|
||||
$t_min = 1;
|
||||
$t_max = 4;
|
||||
$count = mt_rand($t_min, $t_max);
|
||||
$mag_id = 125;
|
||||
$log_text = "<strong><font color=#0d2b99>Регенерация [3]</font></strong>";
|
||||
$book = 909;
|
||||
$have_book = mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
|
||||
if (empty($_SESSION['uid'])) {
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;"));
|
||||
$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
//mana needed
|
||||
$t1 = explode(";", $bat['t1']);
|
||||
$t2 = explode(";", $bat['t2']);
|
||||
if (in_array($user['id'], $t1)) $e_team = $t1;
|
||||
if (in_array($user['id'], $t2)) $e_team = $t2;
|
||||
foreach ($e_team as $k => $l) {
|
||||
if ($l > _BOTSEPARATOR_) $e_hp = mysql_fetch_array(mysql_query("SELECT `hp` FROM `bots` WHERE `id`='{$l}' LIMIT 1;"));
|
||||
else $e_hp = mysql_fetch_array(mysql_query("SELECT `hp` FROM `users` WHERE `id`='{$l}' LIMIT 1;"));
|
||||
if ($e_hp['hp'] < 1) unset($e_team[$k]);
|
||||
}
|
||||
shuffle($e_team);
|
||||
|
||||
if ($user['battle'] == 0) {
|
||||
echo "Это боевая магия...";
|
||||
} elseif (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif ($user['mana'] < $needmana) {
|
||||
echo "Недостаточно энергии!";
|
||||
} else {
|
||||
//attack script
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int = $magic['chanse'] + ($user['intel'] - $needint) * 3;
|
||||
if ($int > 98) {
|
||||
$int = 99;
|
||||
}
|
||||
} else {
|
||||
$int = 0;
|
||||
}
|
||||
|
||||
if (rand(1, 100) < $int) {
|
||||
global $elem_align, $elem_bonus;
|
||||
$user_elem = element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)));
|
||||
|
||||
switch ($user_elem) {
|
||||
case 'f':
|
||||
$uel = 'mfire';
|
||||
break;
|
||||
case 'a':
|
||||
$uel = 'mair';
|
||||
break;
|
||||
case 'w':
|
||||
$uel = 'mwater';
|
||||
break;
|
||||
case 'e':
|
||||
$uel = 'mearth';
|
||||
break;
|
||||
}
|
||||
switch ($elem) {
|
||||
case 'f':
|
||||
$sel = 'mfire';
|
||||
break;
|
||||
case 'a':
|
||||
$sel = 'mair';
|
||||
break;
|
||||
case 'w':
|
||||
$sel = 'mwater';
|
||||
break;
|
||||
case 'e':
|
||||
$sel = 'mearth';
|
||||
break;
|
||||
}
|
||||
$sex_action = "применил";
|
||||
if ($user['sex'] == 0) $sex_action .= "а";
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . Nick::id($user['id'])->short() . ' ' . $sex_action . $targeted . ' заклинание ' . $log_text . '<BR>');
|
||||
|
||||
//mass magic
|
||||
mysql_query("UPDATE `users` SET `mana` = `mana`-'" . $needmana . "' WHERE `id` = '" . $user['id'] . "';");
|
||||
foreach ($e_team as $v)
|
||||
if ($count > 0) {
|
||||
$count--;
|
||||
$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= " . (time() - 60) . " AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;"));
|
||||
if (!$us) {
|
||||
$bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;"));
|
||||
$b_maxhp = mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;"));
|
||||
$b_maxhp = $b_maxhp['maxhp'];
|
||||
}
|
||||
//dmg=base+INT/LVL+X_magic
|
||||
$dmg = $basedmg + ($user['intel'] / $user['level']) + $user[$sel];
|
||||
//MF
|
||||
$dmg *= $elem_align[$user_elem][$elem];
|
||||
if ($us) $dmg *= $elem_bonus[element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)))][element(star_sign(substr($us['borndate'], 3, 2), substr($us['borndate'], 0, 2)))];
|
||||
//rand +- 25%
|
||||
$dmg = mt_rand(0.75 * $dmg, 1.25 * $dmg);
|
||||
$dmg = round($dmg);
|
||||
if ($us) $delta = $us['maxhp'] - $us['hp'];
|
||||
else $delta = $b_maxhp - $bot['hp'];
|
||||
if ($delta < $dmg) $dmg = floor($delta);
|
||||
if ($dmg < 1) $dmg = 0;
|
||||
|
||||
if ($us) $target = $us['id'];
|
||||
else $target = $bot['id'];
|
||||
|
||||
$targeted = '';
|
||||
//dmg >0 - go
|
||||
$all_dmg = unserialize($bat['damage']);
|
||||
$all_exp = unserialize($bat['exp']);
|
||||
$all_dmg[$user['id']] += $dmg;
|
||||
$all_exp[$user['id']] += SolveExp($user['id'], $target, $dmg);
|
||||
|
||||
//сработало
|
||||
if ($dmg > 0) $hit = '-1'; else $hit = 0;
|
||||
$action = preg_replace("/Х/", Nick::id($target)->short(), magic_log($elem, $hit, $target));
|
||||
if ($dmg > 0) {
|
||||
if ($us)
|
||||
mysql_query("UPDATE `users` SET `hp` = `hp`+'" . $dmg . "' WHERE `id` = '" . $target . "';");
|
||||
else
|
||||
mysql_query("UPDATE `bots` SET `hp` = `hp`+'" . $dmg . "' WHERE `id` = '" . $target . "';");
|
||||
mysql_query("UPDATE `battle` SET `damage`='" . serialize($all_dmg) . "', `exp`='" . serialize($all_exp) . "' WHERE `id`='{$user['battle']}';");
|
||||
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . $action . ' <strong>+' . $dmg . '</strong><BR>');
|
||||
|
||||
$bet = 1;
|
||||
} else //не сработало
|
||||
{
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . $action . '<BR>');
|
||||
$bet = 1;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet = 1;
|
||||
}
|
||||
}
|
||||
|
@ -1,126 +0,0 @@
|
||||
<?php
|
||||
//параметры
|
||||
$basedmg=50;
|
||||
$needmana=55;
|
||||
$needint=80;
|
||||
$elem='w';
|
||||
$t_min=3;
|
||||
$t_max=4;
|
||||
$count=mt_rand($t_min,$t_max);
|
||||
$mag_id=111;
|
||||
$log_text="<strong><font color=#0d2b99>Отравление [1]</font></strong>";
|
||||
$book=866;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
|
||||
if (empty($_SESSION['uid'])) {
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;"));
|
||||
$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
//mana needed
|
||||
$t1 = explode(";",$bat['t1']);
|
||||
$t2 = explode(";",$bat['t2']);
|
||||
if(in_array($user['id'],$t1)) $e_team=$t2;
|
||||
if(in_array($user['id'],$t2)) $e_team=$t1;
|
||||
shuffle($e_team);
|
||||
|
||||
if ($user['battle'] == 0) {
|
||||
echo "Это боевая магия...";
|
||||
} elseif (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif ($user['mana']<$needmana) {
|
||||
echo "Недостаточно энергии!";
|
||||
} else {
|
||||
//attack script
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int=$magic['chanse'] + ($user['intel'] - $needint)*3;
|
||||
if ($int>98){$int=99;}
|
||||
}
|
||||
else {$int=0;}
|
||||
|
||||
if (rand(1,100) < $int) {
|
||||
global $elem_align,$elem_bonus;
|
||||
$user_elem=element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2)));
|
||||
|
||||
switch($user_elem)
|
||||
{
|
||||
case 'f':$uel='mfire';break;
|
||||
case 'a':$uel='mair';break;
|
||||
case 'w':$uel='mwater';break;
|
||||
case 'e':$uel='mearth';break;
|
||||
}
|
||||
switch($elem)
|
||||
{
|
||||
case 'f':$sel='mfire';break;
|
||||
case 'a':$sel='mair';break;
|
||||
case 'w':$sel='mwater';break;
|
||||
case 'e':$sel='mearth';break;
|
||||
}
|
||||
$sex_action="применил";if($user['sex']==0) $sex_action.="а";
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.Nick::id($user['id'])->short().' '.$sex_action.$targeted.' заклинание '.$log_text.'<BR>');
|
||||
|
||||
//mass magic
|
||||
mysql_query ("UPDATE `users` SET `mana` = `mana`-'".$needmana."' WHERE `id` = '".$user['id']."';");
|
||||
foreach($e_team as $v)
|
||||
if($count>0)
|
||||
{
|
||||
$count--;
|
||||
$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;"));
|
||||
if(!$us) {$bot= mysql_fetch_array(mysql_query ("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;"));$b_maxhp=mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;"));$b_maxhp=$b_maxhp['maxhp'];}
|
||||
//dmg=base+INT/LVL+X_magic
|
||||
$dmg=$basedmg+($user['intel']/4)+$user[$sel];
|
||||
//MF
|
||||
$dmg*=$elem_align[$user_elem][$elem];
|
||||
if($us) $dmg*=$elem_bonus[element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2)))][element(star_sign(substr($us['borndate'],3,2), substr($us['borndate'],0,2)))];
|
||||
//- MF
|
||||
if($us) {
|
||||
$def=magic_def($elem,$_POST['target'],$user_elem);$dmg*=(1-magic_def($elem,$us['login'],$user_elem,1)/100);
|
||||
$dmg-=$def;
|
||||
}
|
||||
//rand +- 25%
|
||||
$dmg=mt_rand(0.75*$dmg,1.25*$dmg);
|
||||
$dmg=round($dmg);
|
||||
if($us) $target=$us['id'];
|
||||
else $target=$bot['id'];
|
||||
|
||||
$targeted='';
|
||||
//dmg >0 - go
|
||||
$all_dmg=unserialize($bat['damage']);
|
||||
$all_exp=unserialize($bat['exp']);
|
||||
$all_dmg[$user['id']]+=$dmg;
|
||||
$all_exp[$user['id']]+=SolveExp($user['id'],$target,$dmg);
|
||||
|
||||
//сработало
|
||||
if($dmg>0) $hit=1; else $hit=0;
|
||||
$action=preg_replace("/Х/",Nick::id($target)->short(),magic_log($elem,$hit,$target));
|
||||
if(!(($us['id']>0 && $us['hp']<1) || ($bot['id']>0 && $bot['hp']<1)))
|
||||
if($dmg>0)
|
||||
{
|
||||
if($us)
|
||||
mysql_query("UPDATE `users` SET `hp` = `hp`-'".$dmg."' WHERE `id` = '".$target."';");
|
||||
else
|
||||
mysql_query("UPDATE `bots` SET `hp` = `hp`-'".$dmg."' WHERE `id` = '".$target."';");
|
||||
mysql_query("UPDATE `battle` SET `damage`='".serialize($all_dmg)."', `exp`='".serialize($all_exp)."' WHERE `id`='{$user['battle']}';");
|
||||
|
||||
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.$action.' <strong>-'.$dmg.'</strong><BR>');
|
||||
|
||||
$bet=1;
|
||||
}
|
||||
else
|
||||
//не сработало
|
||||
{
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.$action.'<BR>');
|
||||
$bet=1;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet=1;
|
||||
}
|
||||
}
|
||||
|
@ -1,125 +0,0 @@
|
||||
<?php
|
||||
//параметры
|
||||
$basedmg=70;
|
||||
$needmana=65;
|
||||
$needint=100;
|
||||
$elem='w';
|
||||
$t_min=3;
|
||||
$t_max=5;
|
||||
$count=mt_rand($t_min,$t_max);
|
||||
$mag_id=112;
|
||||
$log_text="<strong><font color=#0d2b99>Отравление [2]</font></strong>";
|
||||
$book=908;$have_book=mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
if (empty($_SESSION['uid'])) {
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;"));
|
||||
$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
//mana needed
|
||||
$t1 = explode(";",$bat['t1']);
|
||||
$t2 = explode(";",$bat['t2']);
|
||||
if(in_array($user['id'],$t1)) $e_team=$t2;
|
||||
if(in_array($user['id'],$t2)) $e_team=$t1;
|
||||
shuffle($e_team);
|
||||
|
||||
if ($user['battle'] == 0) {
|
||||
echo "Это боевая магия...";
|
||||
} elseif (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif ($user['mana']<$needmana) {
|
||||
echo "Недостаточно энергии!";
|
||||
} else {
|
||||
//attack script
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int=$magic['chanse'] + ($user['intel'] - $needint)*3;
|
||||
if ($int>98){$int=99;}
|
||||
}
|
||||
else {$int=0;}
|
||||
|
||||
if (rand(1,100) < $int) {
|
||||
global $elem_align,$elem_bonus;
|
||||
$user_elem=element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2)));
|
||||
|
||||
switch($user_elem)
|
||||
{
|
||||
case 'f':$uel='mfire';break;
|
||||
case 'a':$uel='mair';break;
|
||||
case 'w':$uel='mwater';break;
|
||||
case 'e':$uel='mearth';break;
|
||||
}
|
||||
switch($elem)
|
||||
{
|
||||
case 'f':$sel='mfire';break;
|
||||
case 'a':$sel='mair';break;
|
||||
case 'w':$sel='mwater';break;
|
||||
case 'e':$sel='mearth';break;
|
||||
}
|
||||
$sex_action="применил";if($user['sex']==0) $sex_action.="а";
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.Nick::id($user['id'])->short().' '.$sex_action.$targeted.' заклинание '.$log_text.'<BR>');
|
||||
|
||||
//mass magic
|
||||
mysql_query ("UPDATE `users` SET `mana` = `mana`-'".$needmana."' WHERE `id` = '".$user['id']."';");
|
||||
foreach($e_team as $v)
|
||||
if($count>0)
|
||||
{
|
||||
$count--;
|
||||
$bat=mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= ".(time()-60)." AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;"));
|
||||
if(!$us) {$bot= mysql_fetch_array(mysql_query ("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;"));$b_maxhp=mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;"));$b_maxhp=$b_maxhp['maxhp'];}
|
||||
//dmg=base+INT/LVL+X_magic
|
||||
$dmg=$basedmg+($user['intel']/4)+$user[$sel];
|
||||
//MF
|
||||
$dmg*=$elem_align[$user_elem][$elem];
|
||||
if($us) $dmg*=$elem_bonus[element(star_sign(substr($user['borndate'],3,2), substr($user['borndate'],0,2)))][element(star_sign(substr($us['borndate'],3,2), substr($us['borndate'],0,2)))];
|
||||
//- MF
|
||||
if($us) {
|
||||
$def=magic_def($elem,$_POST['target'],$user_elem);$dmg*=(1-magic_def($elem,$us['login'],$user_elem,1)/100);
|
||||
$dmg-=$def;
|
||||
}
|
||||
//rand +- 25%
|
||||
$dmg=mt_rand(0.75*$dmg,1.25*$dmg);
|
||||
$dmg=round($dmg);
|
||||
if($us) $target=$us['id'];
|
||||
else $target=$bot['id'];
|
||||
|
||||
$targeted='';
|
||||
//dmg >0 - go
|
||||
$all_dmg=unserialize($bat['damage']);
|
||||
$all_exp=unserialize($bat['exp']);
|
||||
$all_dmg[$user['id']]+=$dmg;
|
||||
$all_exp[$user['id']]+=SolveExp($user['id'],$target,$dmg);
|
||||
|
||||
//сработало
|
||||
if($dmg>0) $hit=1; else $hit=0;
|
||||
$action=preg_replace("/Х/",Nick::id($target)->short(),magic_log($elem,$hit,$target));
|
||||
if(!(($us['id']>0 && $us['hp']<1) || ($bot['id']>0 && $bot['hp']<1)))
|
||||
if($dmg>0)
|
||||
{
|
||||
if($us)
|
||||
mysql_query("UPDATE `users` SET `hp` = `hp`-'".$dmg."' WHERE `id` = '".$target."';");
|
||||
else
|
||||
mysql_query("UPDATE `bots` SET `hp` = `hp`-'".$dmg."' WHERE `id` = '".$target."';");
|
||||
mysql_query("UPDATE `battle` SET `damage`='".serialize($all_dmg)."', `exp`='".serialize($all_exp)."' WHERE `id`='{$user['battle']}';");
|
||||
|
||||
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.$action.' <strong>-'.$dmg.'</strong><BR>');
|
||||
|
||||
$bet=1;
|
||||
}
|
||||
else
|
||||
//не сработало
|
||||
{
|
||||
addlog($user['battle'],'<span class=date>'.date("H:i").'</span> '.$action.'<BR>');
|
||||
$bet=1;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet=1;
|
||||
}
|
||||
}
|
||||
|
@ -1,145 +0,0 @@
|
||||
<?php
|
||||
//параметры
|
||||
$basedmg = 110;
|
||||
$needmana = 80;
|
||||
$needint = 120;
|
||||
$elem = 'w';
|
||||
$t_min = 3;
|
||||
$t_max = 7;
|
||||
$count = mt_rand($t_min, $t_max);
|
||||
$mag_id = 113;
|
||||
$log_text = "<strong><font color=#0d2b99>Отравление [3]</font></strong>";
|
||||
$book = 909;
|
||||
$have_book = mysql_fetch_array(mysql_query("SELECT `id` FROM `inventory` WHERE `prototype`='{$book}' AND `owner`='{$user['id']}' LIMIT 1;"));
|
||||
|
||||
if (empty($_SESSION['uid'])) {
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$magic = mysql_fetch_array(mysql_query("SELECT `chanse` FROM `magic` WHERE `id` = '{$mag_id}' LIMIT 1 ;"));
|
||||
$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
//mana needed
|
||||
$t1 = explode(";", $bat['t1']);
|
||||
$t2 = explode(";", $bat['t2']);
|
||||
if (in_array($user['id'], $t1)) $e_team = $t2;
|
||||
if (in_array($user['id'], $t2)) $e_team = $t1;
|
||||
shuffle($e_team);
|
||||
|
||||
if ($user['battle'] == 0) {
|
||||
echo "Это боевая магия...";
|
||||
} elseif (!$have_book['id']) {
|
||||
echo("У Вас нет необходимой книги магии!");
|
||||
} elseif ($user['mana'] < $needmana) {
|
||||
echo "Недостаточно энергии!";
|
||||
} else {
|
||||
//attack script
|
||||
if ($user['intel'] >= $needint) {
|
||||
$int = $magic['chanse'] + ($user['intel'] - $needint) * 3;
|
||||
if ($int > 98) {
|
||||
$int = 99;
|
||||
}
|
||||
} else {
|
||||
$int = 0;
|
||||
}
|
||||
|
||||
if (rand(1, 100) < $int) {
|
||||
global $elem_align, $elem_bonus;
|
||||
$user_elem = element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)));
|
||||
|
||||
switch ($user_elem) {
|
||||
case 'f':
|
||||
$uel = 'mfire';
|
||||
break;
|
||||
case 'a':
|
||||
$uel = 'mair';
|
||||
break;
|
||||
case 'w':
|
||||
$uel = 'mwater';
|
||||
break;
|
||||
case 'e':
|
||||
$uel = 'mearth';
|
||||
break;
|
||||
}
|
||||
switch ($elem) {
|
||||
case 'f':
|
||||
$sel = 'mfire';
|
||||
break;
|
||||
case 'a':
|
||||
$sel = 'mair';
|
||||
break;
|
||||
case 'w':
|
||||
$sel = 'mwater';
|
||||
break;
|
||||
case 'e':
|
||||
$sel = 'mearth';
|
||||
break;
|
||||
}
|
||||
$sex_action = "применил";
|
||||
if ($user['sex'] == 0) $sex_action .= "а";
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . Nick::id($user['id'])->short() . ' ' . $sex_action . $targeted . ' заклинание ' . $log_text . '<BR>');
|
||||
|
||||
//mass magic
|
||||
mysql_query("UPDATE `users` SET `mana` = `mana`-'" . $needmana . "' WHERE `id` = '" . $user['id'] . "';");
|
||||
foreach ($e_team as $v)
|
||||
if ($count > 0) {
|
||||
$count--;
|
||||
$bat = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id`='{$user['battle']}';"));
|
||||
$us = mysql_fetch_array(mysql_query("SELECT *,(select `id` from `online` WHERE `real_time` >= " . (time() - 60) . " AND `id` = users.`id`) as `online` FROM `users` WHERE `id` = '{$v}' LIMIT 1;"));
|
||||
if (!$us) {
|
||||
$bot = mysql_fetch_array(mysql_query("SELECT * FROM `bots` WHERE `id` = '{$v}' LIMIT 1;"));
|
||||
$b_maxhp = mysql_fetch_array(mysql_query("SELECT `maxhp` FROM `users`WHERE `id`='{$bot['prototype']}' LIMIT 1;"));
|
||||
$b_maxhp = $b_maxhp['maxhp'];
|
||||
}
|
||||
//dmg=base+INT/LVL+X_magic
|
||||
$dmg = $basedmg + ($user['intel'] / 4) + $user[$sel];
|
||||
//MF
|
||||
$dmg *= $elem_align[$user_elem][$elem];
|
||||
if ($us) $dmg *= $elem_bonus[element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)))][element(star_sign(substr($us['borndate'], 3, 2), substr($us['borndate'], 0, 2)))];
|
||||
//- MF
|
||||
if ($us) {
|
||||
$def = magic_def($elem, $_POST['target'], $user_elem);
|
||||
$dmg *= (1 - magic_def($elem, $us['login'], $user_elem, 1) / 100);
|
||||
$dmg -= $def;
|
||||
}
|
||||
//rand +- 25%
|
||||
$dmg = mt_rand(0.75 * $dmg, 1.25 * $dmg);
|
||||
$dmg = round($dmg);
|
||||
if ($us) $target = $us['id'];
|
||||
else $target = $bot['id'];
|
||||
|
||||
$targeted = '';
|
||||
//dmg >0 - go
|
||||
$all_dmg = unserialize($bat['damage']);
|
||||
$all_exp = unserialize($bat['exp']);
|
||||
$all_dmg[$user['id']] += $dmg;
|
||||
$all_exp[$user['id']] += SolveExp($user['id'], $target, $dmg);
|
||||
|
||||
//сработало
|
||||
if ($dmg > 0) $hit = 1; else $hit = 0;
|
||||
$action = preg_replace("/Х/", Nick::id($target)->short(), magic_log($elem, $hit, $target));
|
||||
if (!(($us['id'] > 0 && $us['hp'] < 1) || ($bot['id'] > 0 && $bot['hp'] < 1)))
|
||||
if ($dmg > 0) {
|
||||
if ($us)
|
||||
mysql_query("UPDATE `users` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';");
|
||||
else
|
||||
mysql_query("UPDATE `bots` SET `hp` = `hp`-'" . $dmg . "' WHERE `id` = '" . $target . "';");
|
||||
mysql_query("UPDATE `battle` SET `damage`='" . serialize($all_dmg) . "', `exp`='" . serialize($all_exp) . "' WHERE `id`='{$user['battle']}';");
|
||||
|
||||
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . $action . ' <strong>-' . $dmg . '</strong><BR>');
|
||||
|
||||
$bet = 1;
|
||||
} else //не сработало
|
||||
{
|
||||
addlog($user['battle'], '<span class=date>' . date("H:i") . '</span> ' . $action . '<BR>');
|
||||
$bet = 1;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
echo "Свиток рассыпался в ваших руках...";
|
||||
$bet = 1;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user