-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
1,205 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/**************************************************************************************************** | ||
* * Program name: CS162 Project3 | ||
* * Author: Taekyoung Kim | ||
* * Date: 02/05/2019 | ||
* * Description: This is Barbarian.h file for CS162 Project3 | ||
* * This project demonstrates a fantasy combat game. | ||
* * There are 5 characters that have different ability and power. | ||
* * The real game is done with a dice. | ||
******************************************************************************************************/ | ||
|
||
#include "Barbarian.h" | ||
|
||
Barbarian::Barbarian() =default; | ||
Barbarian::~Barbarian()= default; | ||
Barbarian::Barbarian(int s, int a) | ||
:Chara(s, a) | ||
{ | ||
|
||
} | ||
int Barbarian::Attack() { | ||
|
||
return Chara::Dice(2, 6); | ||
|
||
} | ||
int Barbarian::Defense() { | ||
|
||
return Chara::Dice(2, 6); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/**************************************************************************************************** | ||
* * Program name: CS162 Project3 | ||
* * Author: Taekyoung Kim | ||
* * Date: 02/05/2019 | ||
* * Description: This is Barbarian.h file for CS162 Project3 | ||
* * This project demonstrates a fantasy combat game. | ||
* * There are 5 characters that have different ability and power. | ||
* * The real game is done with a dice. | ||
******************************************************************************************************/ | ||
|
||
#ifndef PROJECT3_BARBARIAN_H | ||
#define PROJECT3_BARBARIAN_H | ||
#include "Chara.h" | ||
|
||
|
||
class Barbarian: | ||
public Chara | ||
{ | ||
|
||
private: | ||
|
||
public: | ||
|
||
Barbarian(); | ||
~Barbarian() override; | ||
Barbarian(int s, int a); | ||
int Attack() override; | ||
int Defense() override; | ||
}; | ||
|
||
|
||
|
||
#endif //PROJECT3_BARBARIAN_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/**************************************************************************************************** | ||
* * Program name: CS162 Project3 | ||
* * Author: Taekyoung Kim | ||
* * Date: 02/05/2019 | ||
* * Description: This is BlueMen.cpp file for CS162 Project3 | ||
* * This project demonstrates a fantasy combat game. | ||
* * There are 5 characters that have different ability and power. | ||
* * The real game is done with a dice. | ||
******************************************************************************************************/ | ||
|
||
#include "BlueMen.h" | ||
|
||
|
||
BlueMen::BlueMen() = default; | ||
BlueMen::~BlueMen() = default ; | ||
BlueMen::BlueMen(int s, int a, int numDie) | ||
:Chara(s, a) | ||
{ | ||
this ->numDie =numDie; | ||
} | ||
int BlueMen::getNumDie(){ | ||
return this->numDie; | ||
} | ||
void BlueMen::setNumDie(int die){ | ||
|
||
numDie = die; | ||
|
||
} | ||
|
||
int BlueMen::Attack() { | ||
|
||
return Chara::Dice(2, 10); | ||
|
||
} | ||
int BlueMen::Defense() { | ||
|
||
return Chara::Dice(3, 6); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/**************************************************************************************************** | ||
* * Program name: CS162 Project3 | ||
* * Author: Taekyoung Kim | ||
* * Date: 02/05/2019 | ||
* * Description: This is BlueMen.h file for CS162 Project3 | ||
* * This project demonstrates a fantasy combat game. | ||
* * There are 5 characters that have different ability and power. | ||
* * The real game is done with a dice. | ||
******************************************************************************************************/ | ||
|
||
#ifndef PROJECT3_BLUEMEN_H | ||
#define PROJECT3_BLUEMEN_H | ||
|
||
|
||
#include "Chara.h" | ||
|
||
class BlueMen: | ||
public Chara | ||
{ | ||
|
||
private: | ||
int numDie; | ||
|
||
|
||
public: | ||
|
||
BlueMen(); | ||
~BlueMen() override; | ||
BlueMen(int s, int a, int die); | ||
int getNumDie(); | ||
void setNumDie(int die); | ||
int Attack() override; | ||
int Defense() override; | ||
|
||
}; | ||
|
||
|
||
#endif //PROJECT3_BLUEMEN_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/**************************************************************************************************** | ||
* * Program name: CS162 Project3 | ||
* * Author: Taekyoung Kim | ||
* * Date: 02/05/2019 | ||
* * Description: This is Chara.cpp file for CS162 Project3 | ||
* * This project demonstrates a fantasy combat game. | ||
* * There are 5 characters that have different ability and power. | ||
* * The real game is done with a dice. | ||
******************************************************************************************************/ | ||
|
||
#include "Chara.h" | ||
#include <iostream> | ||
#include <random> | ||
|
||
|
||
Chara::Chara()=default; | ||
Chara::~Chara()=default; | ||
Chara::Chara(int s, int a) { | ||
this -> strength = s; | ||
this -> armor = a; | ||
} | ||
|
||
int Chara::getStrength() const{ | ||
|
||
return this-> strength; | ||
} | ||
int Chara::getArmor() const { | ||
return this ->armor; | ||
} | ||
void Chara::setArmor(int a) { | ||
armor = a; | ||
} | ||
void Chara::setStrength(int s){ | ||
strength = s; | ||
} | ||
int Chara::Dice (int num, int side)const { | ||
int output; | ||
|
||
if(num <=0 ){ | ||
return 0; | ||
} | ||
else { | ||
std::random_device ran; | ||
std::mt19937 mt(ran()); | ||
std::uniform_int_distribution<int> dist(1, side); | ||
output = dist(mt); | ||
//std::cout<< "The dice number is: "<<output<<std::endl; | ||
return(Dice(num-1, side) + output); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/**************************************************************************************************** | ||
* * Program name: CS162 Project3 | ||
* * Author: Taekyoung Kim | ||
* * Date: 02/05/2019 | ||
* * Description: This is Chara.h file for CS162 Project3 | ||
* * This project demonstrates a fantasy combat game. | ||
* * There are 5 characters that have different ability and power. | ||
* * The real game is done with a dice. | ||
******************************************************************************************************/ | ||
|
||
#ifndef CHARA_H | ||
#define CHARA_H | ||
|
||
|
||
class Chara { | ||
|
||
protected: | ||
|
||
int strength; | ||
int armor; | ||
|
||
public: | ||
Chara(); | ||
virtual ~Chara(); | ||
Chara(int s, int a); | ||
virtual int getStrength() const; | ||
virtual void setStrength(int s); | ||
virtual int getArmor() const; | ||
virtual void setArmor(int a); | ||
virtual int Attack()=0; | ||
virtual int Defense()=0; | ||
int Dice (int num, int side)const; | ||
|
||
}; | ||
|
||
|
||
#endif //PROJECT3_CHARACT_H |
Oops, something went wrong.