Файл: monst/core/jphp/ca/attack.php
Строк: 36
<?
$HOME = $_SERVER['DOCUMENT_ROOT'];
include $HOME . '/core/in/j.php';
$ca = $_ca -> findOne(
[
'id' => 1
]
);
if ( !$ca ) {
exit;
}
if ( $ca['hp'] <= 0 ) {
exit;
}
if ( $ca['count'] > 0 ) {
$log = '';
$damage = $user['st'];
//
$damage -= $ca['m']['armor'];
if ( $damage < 0 ) $damage = 0;
$monster_newhp = $ca['hp'] - $damage;
$monsterhp_percent = round($monster_newhp / $ca['m']['hp'] * 100);
$log = '<img src="'.av($user['id']).'" alt="" width="15"/>'.Name($user['id']).' > <img src="'.$ca['m']['icon'].'" alt="" width="15"/> '.$ca['m']['name'].': <span style="color: indianred;">'.$damage.'</span><br/>' . $log;
$m_damage = $ca['m']['st'];
$m_damage -= $user['armor'];
if ($m_damage < 0) $m_damage = 0;
$user_newhp = $user['hp'] - $m_damage;
//$log = '<img src="'.$ca['m']['icon'].'" alt="" width="15"/> ' . $ca['m']['name'] . ' > <img src="'.av($user['id']).'" alt="" width="15"/>' . Name($user['id']) . ': <span style="color: indianred;">' . $m_damage . '</span><br/>' . $log;
$log = '<span style="color: #777;">' . date('H:i:s') . '</span><br/>' . $log;
$log = $log . '--<br/>' . $ca['log'];
// clear log
$new_log = '';
$log_array = explode('<br/>', $log);
$i = 0;
foreach ( $log_array as $log_line ) {
$new_log .= $log_line.'<br/>';
$i++;
if ( $i >= 30 ) {
break;
}
}
$log = $new_log;
$user_ids = $ca['user_ids'];
$user_ids[$user['id']] = time();
$upd = $_ca -> update(
[
'id' => 1
],
[
'$set' =>
[
'hp' => $monster_newhp,
'log' => $log,
'user_ids' => $user_ids
]
]
);
//$upd = $_users->update(
// [
// 'id' => $user['id']
// ],
//
// [
// '$set' =>
// [
// 'hp' => $user_newhp,
// ]
// ]
//);
}