I'm currently working on a project (online game) where we have armies that will do battle. now everyone in these armies are individual, and the battle will be played out by pitting these people against each other, until one army is defeated.
i start off by getting a list of attackers and defenders... so the main array and the combat order array looks like this
Code: Select all
$combat[unit_id][team] = "Attacker";
$combat[unit_id][name] = "name";
$combat[unit_id][dex] = $dexterity;
$combat[unit_id][per] = $perception;
$combat[unit_id][hp] = $hp;
$combat[unit_id][ac] = $ac;
$combat[unit_id][weapon_id] = $weapon_id;
$combat[unit_id][armor_id] = $armor_id;
$combat_order[unit_id] = $perception;now i have all i need to go to battle...
so now for my question: is there an effecient way to do this in an object oriented manor? i've tried to think of a way, but im at a loss...
I have a lil OO experiance, but its limited to a few simple classes like a database abstraction layer, and a user class to track security and such.