Entity.cpp 2.79 KB
Newer Older
Noah Olsen's avatar
Noah Olsen committed
1
// "Copyright [year] <Copyright Owner>"
Noah Olsen's avatar
commit  
Noah Olsen committed
2 3 4 5 6
#include "Entity.h"
#include <ctime>
#include <iostream>
#include <string>
#include <vector>
Noah Olsen's avatar
Noah Olsen committed
7
#include "Moves.h"
Noah Olsen's avatar
commit  
Noah Olsen committed
8

Noah Olsen's avatar
commit  
Noah Olsen committed
9 10 11 12 13 14
using std::cerr;
using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;
Noah Olsen's avatar
commit  
Noah Olsen committed
15 16 17

// void Entity::action() {}

Noah Olsen's avatar
Noah Olsen committed
18 19
void Entity::move() {
}
Noah Olsen's avatar
commit  
Noah Olsen committed
20 21

void Entity::setPos() {
Noah Olsen's avatar
commit  
Noah Olsen committed
22
    srand(time(0));
Noah Olsen's avatar
Noah Olsen committed
23
    // Random Positioning
Noah Olsen's avatar
commit  
Noah Olsen committed
24 25
    this->colPos = rand_r() % 3;
    this->rowPos = rand_r() % 3;
Noah Olsen's avatar
commit  
Noah Olsen committed
26 27
}

Noah Olsen's avatar
Noah Olsen committed
28
bool Entity::checkHealth() {
Noah Olsen's avatar
commit  
Noah Olsen committed
29 30 31 32 33
    bool life = true;
    if (con <= 0) {
        life = false;
    }
    return life;
Noah Olsen's avatar
Noah Olsen committed
34
}
Noah Olsen's avatar
commit  
Noah Olsen committed
35 36

Player::Player() {
Noah Olsen's avatar
Noah Olsen committed
37 38 39 40
    setPos();
    this->con = 10;
    this->str = 10;
    this->dex = 10;
Noah Olsen's avatar
commit  
Noah Olsen committed
41 42 43
}

void Player::action() {
Noah Olsen's avatar
Noah Olsen committed
44
    char act;
Noah Olsen's avatar
commit  
Noah Olsen committed
45 46 47 48 49 50 51 52 53 54
    cout << "What will you do?" << endl;
    cout << " a. Light Attack" << endl;
    cout << " b. Heavy Attack" << endl;
    cout << " c. Defend" << endl;
    cout << " d. Counter" << endl;
    cout << " f. Flee" << endl;
    cout << " Enter Action Here: ";
    cin >> act;

    switch (act) {}
Noah Olsen's avatar
commit  
Noah Olsen committed
55 56 57
}

void Player::setClass(char Class) {
Noah Olsen's avatar
Noah Olsen committed
58 59 60 61 62 63 64 65
    switch (Class) {
        case 'a':  // Warrior
            this->str = 14;
            this->con = 12;
            this->dex = 8;
            break;
        case 'b':  // Rogue
            break;
Noah Olsen's avatar
commit  
Noah Olsen committed
66 67
        case 'c':  // Mage
            break;
Noah Olsen's avatar
Noah Olsen committed
68
    }
Noah Olsen's avatar
commit  
Noah Olsen committed
69 70
}

Noah Olsen's avatar
commit  
Noah Olsen committed
71 72 73
void Enemy::setBossClass() {
    srand(time(0));
    int monster = rand_r() % 3;  // Boss Monster Randomization
Noah Olsen's avatar
commit  
Noah Olsen committed
74

Noah Olsen's avatar
commit  
Noah Olsen committed
75
    switch (monster) {
Noah Olsen's avatar
Noah Olsen committed
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
        case 1:  // Minotaur
            this->str = 16;
            this->con = 14;
            this->dex = 8;
            break;
        case 2:  // Dragonoid
            this->str = 14;
            this->con = 16;
            this->dex = 12;
            break;
        case 3:  // Cyclops
            this->str = 18;
            this->con = 16;
            this->dex = 6;
            break;
    }
Noah Olsen's avatar
commit  
Noah Olsen committed
92 93 94
}

void Enemy::setClassByChoice(int monster) {
Noah Olsen's avatar
Noah Olsen committed
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
    switch (monster) {
        case 1:  // Goblin
            this->str = 6;
            this->con = 6;
            this->dex = 12;
            break;
        case 2:  // Orc
            this->str = 14;
            this->con = 10;
            this->dex = 8;
            break;
        case 3:  // Skeleton
            this->str = 8;
            this->con = 10;
            this->dex = 10;
            break;
    }
Noah Olsen's avatar
commit  
Noah Olsen committed
112 113 114
}

void Enemy::setClassByRand() {
Noah Olsen's avatar
commit  
Noah Olsen committed
115 116
    srand(time(0));
    int monster = rand_r() % 3;  // Monster Randomization
Noah Olsen's avatar
commit  
Noah Olsen committed
117

Noah Olsen's avatar
commit  
Noah Olsen committed
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
    switch (monster) {
        case 1:  // Goblin
            this->str = 6;
            this->con = 6;
            this->dex = 12;
            break;
        case 2:  // Orc
            this->str = 14;
            this->con = 10;
            this->dex = 8;
            break;
        case 3:  // Skeleton
            this->str = 8;
            this->con = 10;
            this->dex = 10;
            break;
    }
Noah Olsen's avatar
commit  
Noah Olsen committed
135 136
}

Noah Olsen's avatar
commit  
Noah Olsen committed
137
Enemy::Enemy() {
Noah Olsen's avatar
Noah Olsen committed
138 139
    setPos();
}