CSC112 Spring 2016 Examples
//implimentation file for hackPaca12#include "hackPaca.h"3#include "../alpaca.h"4#include <cstdlib>5#include <iostream>67using namespace std;89//virtual functions to override10std::string11hackPaca::name() {12return "hackPaca";13}1415void16hackPaca::act(Alpaca *opponent) {17switch(rand()%5) {18case 0:19bug(opponent);20break;21case 1:22virus(opponent);23break;24case 2:25reboot();26break;27case 3:28error(opponent);29break;30case 4:31rainbow(opponent);32break;33}34}3536//moveset37void38hackPaca::bug(Alpaca *opponent) {39cout << name() << " installs a bug in its opponent's mainframe!" << endl40<< "... It's Super Effective!" << endl;41attack(opponent, 6);42}4344void45hackPaca::virus(Alpaca *opponent) {46cout << name() << " installs a lethal virus!!" << endl47<< "... It's Super Effective!" << endl;48attack(opponent, 10);49}5051void52hackPaca::reboot() {53cout << name() << " reboots and upgrades its attack software!!" << endl;54increaseAttack(8);55}5657void58hackPaca::error(Alpaca *opponent) {59cout << name() << " confuses its opponent with thousands of compilor error messages!!" << endl;60stun(opponent, 4);61}6263void64hackPaca::rainbow(Alpaca *opponent) {65cout << name() << " renders its opponent useless with the dreaded RAINBOW WHEEL!!!!!" << endl;66sleep(opponent, 8);67}686970