Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

CSC112 Spring 2016 Examples

2370 views
1
//implimentation file for blobPaca
2
3
#include "blobPaca.h"
4
#include "../alpaca.h"
5
#include <cstdlib>
6
#include <iostream>
7
8
using namespace std;
9
10
//virtual functions to override
11
std::string
12
blobPaca::name() {
13
return nickName;
14
}
15
16
void
17
blobPaca::act(Alpaca *opponent) {
18
19
static int moves = 0;
20
21
if(getPower() > 11) {
22
if(moves < 3 and getHp() < 20) {
23
reblob();
24
} else {
25
//up the attack of the first or second zenPaca like nothin else
26
int i = (rand()%2);
27
int j = (*pack).packSize()-(10 +i);
28
jellify((*pack)[j]);
29
}
30
} else {
31
snooze();
32
}
33
34
moves++;
35
}
36
37
//moveset
38
void
39
blobPaca::congeal() {
40
cout << name() << " adds blobenous mass!" << endl;
41
increaseDefense(10);
42
}
43
44
void
45
blobPaca::snooze() {
46
cout << name() << " takes a frickin nap??" << endl;
47
}
48
49
void
50
blobPaca::reblob() {
51
cout << name() << " reattaches some lost blobberisms." << endl;
52
increaseHp(11);
53
}
54
55
void
56
blobPaca::ooze(Alpaca *opponent) {
57
cout << name() << " grosses out his opponent!" << endl;
58
decreaseAttack(opponent, 5);
59
}
60
61
void
62
blobPaca::jellify(Alpaca *buddy) {
63
cout << name() << " surrounds his teammate in a glowing gel!" << endl;
64
bufAlly(buddy, 10, 0,0);
65
}
66
67