All pastes #943371 Raw Edit

Zoopz attack code

public php v1 · immutable
·published 2008-03-15 05:43 UTC
rendered paste body
/* Fight Loop */while ($user['zoop_hp'] > 0 && $otheruser['zoop_hp'] > 0) {    if ($whosturn == 0) { // Our turn to attack        $attack = rand(max(1,$user['zoop_strength']-($user['zoop_level']*2)),$user['zoop_strength']);        $defense = rand(max(0,$otheruser['zoop_defense']-($otheruser['zoop_defense']*2)),$otheruser['zoop_defense']);        $damage = max(0,$attack-$defense);        $otheruser['zoop_hp'] -= $damage;        $page_main .= '<b>'.$user['zoop_name'].'</b> hit <b>'.$otheruser['zoop_name'].'</b> for '.$damage.' damage.  (New HP: '.max(0,$otheruser['zoop_hp']).')<br>';    } elseif ($whosturn == 1) { // Their turn to attack        $attack = rand(max(1,$otheruser['zoop_strength']-($otheruser['zoop_level']*2)),$otheruser['zoop_strength']);        $defense = rand(max(0,$user['zoop_defense']-($user['zoop_defense']*2)),$user['zoop_defense']);        $damage = max(0,$attack-$defense);        $user['zoop_hp'] -= $damage;        $page_main .= '<div style="background-color: #CCCCCC; layer-background-color: #CCCCCC;"><b>'.$otheruser['zoop_name'].'</b> hits <b>'.$user['zoop_name'].'</b> for '.$damage.' damage.  (New HP: '.max(0,$user['zoop_hp']).')</div>';    }        // Flip turn    $whosturn = ($whosturn==0) ? 1 : 0;}