Файл: monst/core/jphp/fig/attack.php
Строк: 63
<?
$HOME = $_SERVER['DOCUMENT_ROOT'];
include $HOME . '/core/in/j.php';
//$a_id = (int)$_POST['a_id'];
//if ( !$a_id ) {
// exit;
//}
$fig = $_fig -> findOne(
[
'user_id' => $user['id']
]
);
if ( !$fig ) {
exit;
}
include $HOME . '/core/content/monster.php';
if ( !$monster_dat = $MONSTER[$user['part']][$fig['monster_id']] ) {
exit;
}
if ( $fig['monster_hp'] <= 0 OR $user['hp'] <= 0 ) {
exit;
}
$log = '';
$damage = $user['st'];
//
$damage -= $monster_dat['armor'];
if ( $damage < 0 ) $damage = 0;
$monster_newhp = $fig['monster_hp'] - $damage;
$monsterhp_percent = round($monster_newhp / $fig['monster_hpf'] * 100);
if ( $monsterhp_percent <= 50 AND $_SESSION['monster_says_time'] != $fig['monster_id'] AND !empty($monster_dat['says_50']) ) {
$log .= '<img src="/core/i/monster/'.$user['part'].'/'.$fig['monster_id'].'.jpg" alt="" width="15"/> <span style="color: #999;">'.$monster_dat['name'].'</span>: '.$monster_dat['says_50'].'<br/>';
$_SESSION['monster_says_time'] = $fig['monster_id'];
}
$log = Name($user['id']).' > <img src="/core/i/monster/'.$user['part'].'/'.$fig['monster_id'].'.jpg" alt="" width="15"/> '.$monster_dat['name'].': <span style="color: indianred;">'.$damage.'</span><br/>' . $log;
//$log = '<span style="color: #777;">'.date('H:i:s').'</span><br/>' . $log;
//$log = $log . '--<br/>' .$fig['log'];
$m_damage = $monster_dat['st'];
$m_damage -= $user['armor'];
if ($m_damage < 0) $m_damage = 0;
$user_newhp = $user['hp'] - $m_damage;
$log = '<img src="/core/i/monster/' . $user['part'] . '/' . $fig['monster_id'] . '.jpg" alt="" width="15"/> ' . $monster_dat['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/>' . $fig['log'];
$upd = $_fig -> update(
[
'user_id' => $user['id']
],
[
'$set' =>
[
'monster_hp' => $monster_newhp,
'log' => $log
]
]
);
$upd = $_users->update(
[
'id' => $user['id']
],
[
'$set' =>
[
'hp' => $user_newhp,
]
]
);