CSC112 Spring 2016 Examples
#include "elPaca.h"1#include "../alpaca.h"2#include <cstdlib>3#include <iostream>45using namespace std;67//override virtual functions8std::string9elPaca::name() {10return "ElPaca";11}1213void14elPaca::act(Alpaca *opponent) {1516if (getPower() == 110) {17queso(opponent);18} else {19if (getHp() > 40) {20if(getPower() > 61) {21chile();22} else {23burrito(opponent);24}25} else {26burrito(opponent);27}28}29}3031void32elPaca::burrito(Alpaca* opponent) {33cout << name() << " tosses a sizeable burrito at its opponent!" << endl34<< "...It's Super Effective!!" << endl;35attack(opponent, 6);36}3738void39elPaca::taco(Alpaca* opponent) {40cout << name() << " pummels his opponent with a massive taco!!"41<< "...It's Super Effective!" << endl;42attack(opponent, 10);43}4445void46elPaca::sunbrero() {47cout << name() << " tips its hat to shield from attacks!" << endl;48increaseDefense(6);49}5051void52elPaca::chile() {53cout << name() << " eats some chile powder and goes insane!!" << endl;54increaseAttack(8);55}5657void58elPaca::queso(Alpaca* opponent) {59cout << name() << " throws hot queso in its opponent's face!" << endl;60stun(opponent, 6);61}62636465