function battle_badguy_attacks() { global $badguy, $enemies, $newenemies, $session, $creatureattack, $creatureatkmod, $beta; global $creaturedefmod, $adjustment, $defmod, $atkmod, $compatkmod, $compdefmod, $buffset, $atk, $def, $options; global $companions, $companion, $newcompanions, $roll, $count, $index, $defended, $needtostopfighting; $break = false; $selfdmg = $roll['selfdmg']; if ($badguy['creaturehealth'] <= 0 && $session['user']['hitpoints'] <= 0) { $creaturedmg = 0; $selfdmg = 0; if ($badguy['creaturehealth'] <= 0) { $badguy['dead'] = true; $badguy['istarget'] = false; $count = 1; $needtostopfighting = true; $break = true; } $newenemies[$index] = $badguy; $newcompanions = $companions; $break = true; } else { if ($badguy['creaturehealth'] > 0 && $session['user']['hitpoints'] > 0 && $badguy['istarget']) { if (is_array($companions)) { foreach ($companions as $name => $companion) { if ($companion['hitpoints'] > 0) { $buffer = report_companion_move($companion, "defend"); if ($buffer !== false) { $newcompanions[$name] = $buffer; unset($buffer); } else { unset($companion); unset($newcompanions[$name]); } } else { $newcompanions[$name] = $companion; } } } } else { $newcompanions = $companions; } $companions = $newcompanions; if ($defended == false) { if ($selfdmg == 0) { output("`^%s`4 tries to hit you but `^MISSES!`n", $badguy['creaturename']); process_dmgshield($buffset['dmgshield'], 0); process_lifetaps($buffset['lifetap'], 0); } else { if ($selfdmg < 0) { output("`^%s`4 tries to hit you but you `^RIPOSTE`4 for `^%s`4 points of damage!`n", $badguy['creaturename'], 0 - $selfdmg); $badguy['creaturehealth'] += $selfdmg; process_lifetaps($buffset['lifetap'], -$selfdmg); process_dmgshield($buffset['dmgshield'], $selfdmg); } else { output("`^%s`4 hits you for `\$%s`4 points of damage!`n", $badguy['creaturename'], $selfdmg); $session['user']['hitpoints'] -= $selfdmg; if ($session['user']['hitpoints'] <= 0) { $badguy['killedplayer'] = true; $count = 1; } process_dmgshield($buffset['dmgshield'], $selfdmg); process_lifetaps($buffset['lifetap'], -$selfdmg); $badguy['diddamage'] = 1; } } } if ($badguy['creaturehealth'] <= 0) { $badguy['dead'] = true; $badguy['istarget'] = false; $count = 1; $break = true; } } return $break; }
$buffset = activate_buffs("defense"); if ($selfdmg == 0) { output("`^" . $badguy['creaturename'] . "`4 tries to hit you but `\$MISSES!`n"); process_dmgshield($buffset['dmgshield'], 0); process_lifetaps($buffset['lifetap'], 0); } else { if ($selfdmg < 0) { output("`^" . $badguy['creaturename'] . "`4 tries to hit you but you `^RIPOSTE`4 for `^" . (0 - $selfdmg) . "`4 points of damage!`n"); $badguy['creaturehealth'] += $selfdmg; process_lifetaps($buffset['lifetap'], -$selfdmg); process_dmgshield($buffset['dmgshield'], $selfdmg); } else { output("`^" . $badguy['creaturename'] . "`4 hits you for `\${$selfdmg}`4 points of damage!`n"); $session['user']['hitpoints'] -= $selfdmg; process_dmgshield($buffset['dmgshield'], $selfdmg); process_lifetaps($buffset['lifetap'], -$selfdmg); $badguy['diddamage'] = 1; } } } } expire_buffs(); if ($session['user']['hitpoints'] > 0 && $badguy['creaturehealth'] > 0 && ($HTTP_GET_VARS['op'] == "fight" || $HTTP_GET_VARS['op'] == "run")) { output("`2`bEnd of Round:`b`n"); output("`2" . $badguy['creaturename'] . "`2's " . ($session['user']['alive'] ? "Hitpoints" : "Soulpoints") . ": `6" . $badguy['creaturehealth'] . "`0`n"); output("`2YOUR " . ($session['user']['alive'] ? "Hitpoints" : "Soulpoints") . ": `6" . $session['user']['hitpoints'] . "`0`n"); } if ($badguy['creaturehealth'] <= 0) { $victory = true; $defeat = false; } else {
if ($badguy[creaturehealth]>0 && $session[user][hitpoints]>0){ $buffset = activate_buffs("defense"); if ($selfdmg==0){ output("`^$badguy[creaturename]`4 tries to hit you but `\$MISSES!`n"); process_dmgshield($buffset[dmgshield], 0); process_lifetaps($buffset[lifetap], 0); }else if ($selfdmg<0){ output("`^$badguy[creaturename]`4 tries to hit you but you `^RIPOSTE`4 for `^".(0-$selfdmg)."`4 points of damage!`n"); $badguy[creaturehealth]+=$selfdmg; process_lifetaps($buffset[lifetap], -$selfdmg); process_dmgshield($buffset[dmgshield], $selfdmg); }else{ output("`^$badguy[creaturename]`4 hits you for `\$$selfdmg`4 points of damage!`n"); $session[user][hitpoints]-=$selfdmg; process_dmgshield($buffset[dmgshield], $selfdmg); process_lifetaps($buffset[lifetap], -$selfdmg); $badguy['diddamage']=1; } } } expire_buffs(); if ($session[user][hitpoints]>0 && $badguy[creaturehealth]>0 && ($HTTP_GET_VARS[op]=="fight" || $HTTP_GET_VARS[op]=="run")){ output("`2`bEnd of Round:`b`n"); output("`2$badguy[creaturename]`2's ".($session['user']['alive']?"Hitpoints":"Soulpoints").": `6$badguy[creaturehealth]`0`n"); output("`2YOUR ".($session['user']['alive']?"Hitpoints":"Soulpoints").": `6".$session[user][hitpoints]."`0`n"); } if ($badguy[creaturehealth]<=0){ $victory=true;