Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string>
- #include <iostream>
- #include <cstdlib>
- #include "elf.h"
- #include "creature.h"
- using namespace std;
- elf::elf(){
- }
- elf::elf(int inStrength, int inHitpoints) : creature(inStrength, inHitpoints)
- {
- }
- int elf::getDamage() const{
- int damage = creature::getDamage();
- cout << "The elf attacks for " << damage << " points!" << endl;
- if (rand() % 100 < 50) {
- cout << "Magical attack inflicts " << damage << " additional damage points!" << endl;
- damage = damage * 2;
- }
- return damage;
- }
- string elf::getSpecies() const
- {
- return "elf";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement