• 1000 , последняя попытка кода, журнал боя не отображается
Скриншот страницы матча
MatchController. php
public function MatchSimulation()
{
$PlayerModel = new UserModel();
$MobModel = new MobModel();
$player = $PlayerModel->where('username', session()->get('username'))->first();
$mob = $MobModel->where('idMob', 'MOB001')->first();
$data['player'] = $player;
$data['mob'] = $mob;
$data = [
'title' => 'RPG | Match Simulation',
'player' => $player,
'mob' => $mob,
];
if ($this->request->getMethod() == 'post') {
$PlayerModel = new UserModel();
$MobModel = new MobModel();
$player = $PlayerModel->where('username', session()->get('username'))->first();
$mob = $MobModel->where('idMob', 'MOB001')->first();
$playerATK = $player['atk'];
$playerDEF = $player['def'];
$mobATK = $mob['atk'];
$mobDEF = $mob['def'];
$mobHP = $mob['currentHP'];
$playerDamageFormula = $playerATK - $mobDEF;
$mobCurrentHP = $mobHP - $playerDamageFormula;
$mobTempHP = "";
$mobTempHP -= $mobCurrentHP . '';
} else {
$data['playerDamage'] = null;
}
$data['playerDamage'] = $playerDamageFormula;
$data['mobCurrentHP'] = $mobCurrentHP;
$data['mobTempHP'] = $mobTempHP;
return view('/match', $data);
}