Файл: DARK WARS/dark_war/clans/raid/dmg.php
Строк: 14
<?php
$res = mysql_query("SELECT COUNT(*) FROM `dark_war_pets_u` where `id_user` = '{$player->id}' AND `attack` > '0'"); $row = mysql_fetch_row($res);$total = $row[0];
if($total >= 1){
$attack = mysql_fetch_assoc(mysql_query("SELECT * FROM `dark_war_pets_u` where `id_user` = '{$player->id}' AND `attack` > '0'"));
$attack['attack'] = rand(1, $attack['attack']);
$_SESSION['fight_3'] = $attack['attack'];
mysql_query("UPDATE `dark_war_clan_creep` SET `hp` = (`hp`-'$attack[attack]') WHERE `id_clan` = '".$_SESSION['clan']."'");
}if($player->dmg >= $ar['armor']) {
//Расчет при условии что брони меньше чем дамага
$eew = (($player->dmg - ($player->dmg * 12 / 100) + $player->dmg) / 2) * 1.2 - ($ar['armor'] * 77 / 100);
$eew = ceil($eew + ($player->armorp * 15 / 100));
}else{
// Расчет при условии что брони больше чем дамага
$eew = (($player->dmg - ($player->dmg * 12 / 100) + $player->dmg) / 2) * 1.2 - ($ar['armor'] * 37 / 100);
$eew = ceil($eew + ($forwards['armorp'] * 10 / 100));
}$eew = rand(1, $eew);
$crit = rand(1, 5);
if($crit == 5)
$eew = $eew * 2;
$_SESSION['fight_1'] = $eew;
mysql_query("UPDATE `dark_war_clan_creep` SET `hp` = (`hp`-'$eew') WHERE `id_clan` = '".$_SESSION['clan']."'");
if ($ar['dmg-max'] >= $player->armor) {
//Расчет при условии что брони меньше чем дамага
$eew = (($ar['dmg'] - ($ar['dmg'] * 12 / 100) + $ar['dmg']) / 2) * 1.2 - ($player->armor * 77 / 100);
$eew = ceil($eew + ($ar['armorp'] * 15 / 100));
$eew = rand($ar['dmg'], $ar['dmg-max']);
$eew -= $ar['armorp'];
if($eew < 0){
$eew = 0;
}
}else {
// Расчет при условии что брони больше чем дамага
$eew = rand(1,5);
}$eew = rand(1,$eew);
$_SESSION['fight_2'] = $eew;
mysql_query("UPDATE `dark_war_users` SET `hp` = (`hp`-'$eew') WHERE `id` = '{$player->id}'");
$dmg = $_SESSION['fight_1'] + $_SESSION['fight_3'];
mysql_query("UPDATE `dark_war_clan_creep_u` SET `dmg` = (`dmg`+'$dmg')
WHERE `id_user` = '{$player->id}'");
?>