Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

CSC112 Spring 2016 Examples

2370 views
1
#include "elPaca.h"
2
#include "../alpaca.h"
3
#include <cstdlib>
4
#include <iostream>
5
6
using namespace std;
7
8
//override virtual functions
9
std::string
10
elPaca::name() {
11
return "ElPaca";
12
}
13
14
void
15
elPaca::act(Alpaca *opponent) {
16
17
if (getPower() == 110) {
18
queso(opponent);
19
} else {
20
if (getHp() > 40) {
21
if(getPower() > 61) {
22
chile();
23
} else {
24
burrito(opponent);
25
}
26
} else {
27
burrito(opponent);
28
}
29
}
30
}
31
32
void
33
elPaca::burrito(Alpaca* opponent) {
34
cout << name() << " tosses a sizeable burrito at its opponent!" << endl
35
<< "...It's Super Effective!!" << endl;
36
attack(opponent, 6);
37
}
38
39
void
40
elPaca::taco(Alpaca* opponent) {
41
cout << name() << " pummels his opponent with a massive taco!!"
42
<< "...It's Super Effective!" << endl;
43
attack(opponent, 10);
44
}
45
46
void
47
elPaca::sunbrero() {
48
cout << name() << " tips its hat to shield from attacks!" << endl;
49
increaseDefense(6);
50
}
51
52
void
53
elPaca::chile() {
54
cout << name() << " eats some chile powder and goes insane!!" << endl;
55
increaseAttack(8);
56
}
57
58
void
59
elPaca::queso(Alpaca* opponent) {
60
cout << name() << " throws hot queso in its opponent's face!" << endl;
61
stun(opponent, 6);
62
}
63
64
65