Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
tkim949 authored Feb 7, 2019
1 parent 10b08a2 commit 96cd8f0
Show file tree
Hide file tree
Showing 17 changed files with 1,205 additions and 0 deletions.
28 changes: 28 additions & 0 deletions Barbarian.cpp
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);
}
33 changes: 33 additions & 0 deletions Barbarian.h
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
39 changes: 39 additions & 0 deletions BlueMen.cpp
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);

}
38 changes: 38 additions & 0 deletions BlueMen.h
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
52 changes: 52 additions & 0 deletions Chara.cpp
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);
}


}
37 changes: 37 additions & 0 deletions Chara.h
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
Loading

0 comments on commit 96cd8f0

Please sign in to comment.