-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCard.cpp
More file actions
114 lines (99 loc) · 2.34 KB
/
Card.cpp
File metadata and controls
114 lines (99 loc) · 2.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
//Card.cpp
// CSCI 1300 Spring 2022
// Author: Matthew Cerza
// Recitation: 202 – Alex Ray
// Project 3
#include "Card.h"
#include <iostream>
using namespace std;
//default constructor that sets all values to 0
//The default constructor is called for empty spaces on a board
Card::Card(){
origHealth = 0;
origAttack = 0;
health = 0;
attack = 0;
name = "";
special = false;
bio = "";
sigil = "";
cost = 0;
}
//paramaterized constructor that takes in stats for a given card
Card::Card(string givenName, int givenHealth, int givenAttack, string givenSigil, string givenBio, int givenCost, bool givenSpecial){
origHealth = givenHealth;
origAttack = givenAttack;
health = givenHealth;
attack = givenAttack;
name = givenName;
special = givenSpecial;
bio = givenBio;
sigil = givenSigil;
cost = givenCost;
}
//returns health for a given card
int Card::getHealth(){
return health;
}
//sets the health of a given card
int Card::setHealth(int givenHealth){
health = givenHealth;
return health;
}
//gets the original health of a creature (before a campfire)
int Card::getOrigHealth(){
return origHealth;
} //decreases the health and returns the new value
int Card::takeDmg(int damage){
health -= damage;
return health;
}
int Card::getAttack(){
return attack;
}
//changes the attack of a card by a given value, returns the new value
int Card::changeAttack(int attackChange){
attack +=attackChange;
return attack;
}
//getter methods
int Card::getCost(){
return cost;
}
void Card::setCost(int givenCost){
cost = givenCost;
}
string Card::getName(){
return name;
}
void Card::setName(string givenName){
name = givenName;
}
void Card::setAttack(int givenAttack){
attack = givenAttack;
}
string Card::getBio(){
return bio;
}
void Card::setBio(string givenBio){
bio = givenBio;
}
string Card::getSigil(){
return sigil;
}
void Card::setSigil(string givenSigil){
sigil = givenSigil;
}
bool Card::isSpecial(){
return special;
}
void Card::setSpecial(bool givenSpecial){
special = givenSpecial;
}
void Card::printInfo(){
cout << "Name: " << name << endl;
cout << "Sigil: " << sigil << endl;
cout << "Attack: " << attack << " Health: " << health << endl;
cout << "Cost: " << cost << endl;
cout << "Biography: " << bio << endl;
}