Enemy class. Written for OOP Review. Derived from life_entity.
Diff: enemy.h
- Revision:
- 1:59274d3772ec
- Parent:
- 0:91a68e5fd4b8
diff -r 91a68e5fd4b8 -r 59274d3772ec enemy.h --- a/enemy.h Thu Mar 31 19:55:30 2011 +0000 +++ b/enemy.h Fri Apr 01 01:29:38 2011 +0000 @@ -8,18 +8,92 @@ #define DEBUG_ENEMY 0x01 #define DEBUG_ENEMY_VERBOSE 0x00 +/** Enemy class (basic enemy) derived from life_entity. + * + * This class is derived from life_entity. + * + * Example: + * @code + * + * // Create a pointer to a life_entity object. + * life_entity *currentEnemy; + * + * int main() + * { + * // Use the pointer to create a new armoured_vehicle (derived class) + * currentEnemy = new enemy(user); + * } + * @endcode + */ class enemy : public life_entity { public: - // Constructor + /** Enemy class constructor. + * + * This class is derived from life_entity. + * + * @param *thePlayer Pointer to the player's class. + * + * Example: + * @code + * // Create a pointer to a life_entity object. + * life_entity *currentEnemy; // Life entity object + * + * int main() + * { + * // Use the pointer to create a new armoured_vehicle (derived class) + * currentEnemy = new enemy(user); + * } + * @endcode + */ enemy(player *thePlayer); - // Deconstructor + /** Enemy class destructor. + * + * This class is derived from life_entity. + * + * Example: + * @code + * // Create a pointer to a life_entity object. + * life_entity *currentEnemy; + * + * int main() + * { + * // Use the pointer to create a new armoured_vehicle (derived class) + * currentEnemy = new enemy(user); + * + * delete currentEnemy; + * } + * @endcode + */ virtual ~enemy(); - // Incoming damage + /** Take damage from apponent. + * + * This applies the player's damage roll to the enemy's health after a dodge roll + * is performed. + * + * @param roll The damage roll to be passed in (most likely from rollDamage()). + * + * Example: + * @code + * player *user = new player(); + * life_entity *currentEnemy; + * + * int main() + * { + * // Use the pointer to create a new armoured_vehicle (derived class) + * currentEnemy = new enemy(user); + * + * // User rolls for damage + * int roll = user->rollDamage(); + * // Current enemy takes the hit + * currentEnemy->takeDamage(roll); + * } + * @endcode + */ virtual void takeDamage(int roll);