-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCampfire.cpp
More file actions
70 lines (60 loc) · 1.86 KB
/
Campfire.cpp
File metadata and controls
70 lines (60 loc) · 1.86 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
//Campfire.cpp
// CSCI 1300 Spring 2022
// Author: Matthew Cerza
// Recitation: 202 – Alex Ray
// Project 3
#include <iostream>
#include <stdlib.h>
#include <time.h>
#include "Card.h"
#include "Campfire.h"
using namespace std;
//Sets the type of campfire between health and attack randomly
//UNFINISHED
Campfire::Campfire(){
double random = rand();
random = rand();
random = random/RAND_MAX;
if (random>=0.5){
type = "Health";
} else {
type = "Attack";
}
}
string Campfire::getType(){
return type;
}
//When given a card, upgrade it's attack by one and return one.
int Campfire::chanceAttkUpgrade(Card givenCard){
cout << "The survivors were right about the flames. They had enhanced the "<< givenCard.getName() << "'s "<<type<<"." << endl;
return 1;
}
//When given a card, have a 50% chance of upgrading it's attack, and a 50% chance of destroying the card and removing it from the player's hand
//returns 1 if successful, returns 0 to destroy the card
int Campfire::chanceAttkUpgrade2(Card givenCard){
double random = rand();
random = rand();
random = random/RAND_MAX;
if (random>=0.5){
return 0;
} else {
return 1;
}
}
//When given a card, upgrade it's health by two and return two.
int Campfire::chanceHealthUpgrade(Card givenCard){
cout << "The survivors were right about the flames. They had enhanced the "<< givenCard.getName() << "'s "<<type<<"." << endl;
return 2;
}
//When given a card, have a 50% chance of upgrading it's health, and a 50% chance of destroying the card and removing it from the player's hand
//returns 1 if successful, returns 0 to destroy the card
int Campfire::chanceHealthUpgrade2(Card givenCard){
double random = rand();
random = rand();
random = random/RAND_MAX;
if (random>=0.5){
return 0;
} else {
return 2;
}
}