maestro: /me is about to post some mostly decontextualised code on the blag.

function unitstats($unit) {
/* gets the stats of a particular unit */
$stats = array();
if ($unit == 'l') {
$stats['atk'] = 24;
$stats['def'] = 18;
} elseif ($unit == ‘e’) {
$stats['atk'] = 4;
$stats['def'] = 2;
} elseif ($unit == ’s’) {
$stats['atk'] = 12;
$stats['def'] = 4;
} elseif ($unit == ‘r’) {
$stats['atk'] = 2;
$stats['def'] = 4;
} elseif ($unit == ‘o’) {
$stats['atk'] = 12;
$stats['def'] = 6;
} elseif ($unit == ‘a’) {
$stats['atk'] = 12;
$stats['def'] = 4;
}
return $stats;
}


$avb = round($stats1['atk'] / $stats2['def']);
$bva = round($stats2['atk'] / $stats1['def']);
$health1 -= $bva;
$health2 -= $avb;

Categories: Projects » Games » Authority and Programming » PHP
Authority is an online strategy game with units and stuff, currently in development.

1 response to “maestro: /me is about to post some mostly decontextualised code on the blag.”


  1. 1 maestro

    This should totally be an array shouldn’t it.

Leave a Reply