Entity.cpp 2.74 KB
Newer Older
Noah Olsen's avatar
commit  
Noah Olsen committed
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 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
#include "Entity.h"
#include "Grid.h"
#include "Moves.h"
#include <ctime>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

class MoveSet;

// void Entity::action() {}

void Entity::move() {}

void Entity::setPos() {
  srand(time(0));
  // Random Positioning
  this->colPos = rand() % 3;
  this->rowPos = rand() % 3;
}

bool Entity::checkHealth() { return (con > 0); }

Player::Player() {
  setPos();
  this->con = 10;
  this->str = 10;
  this->dex = 10;
  // setClass('a');
}

void Player::action() {
  char act;
  do {
    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 << " e. Flee" << endl;
    cout << " Enter Action Here: ";
    cin >> act;

    switch (act) {
    case 'a':
      // callLightAttack();
      break;
    case 'b':
      // callHeavyAttack();
      break;
    case 'c':
      // callDefend();
      break;
    case 'd':
      break;
    case 'e':
      break;
    default:
      cout << "Please enter a valid option." << endl;
      break;
    }
  } while (act != 'a' && act != 'b' && act != 'c' && act != 'd' && act != 'e' &&
           act != 'f');
}

void Player::setClass(char Class) {
  switch (Class) {
  case 'a': // Warrior
    this->str = 14;
    this->con = 12;
    this->dex = 8;
    break;
  case 'b': // Rogue
    break;
  }
}

void Enemy::action() {
  int act = rand() % 10;
  if (con <= 2) {
    // Attempt flee
  } else {
    if (act <= 2) {
      // Heavy Attack
    } else if (act >= 3 && act <= 5) {
      // Light Attack
    } else if (act >= 6 && act <= 8) {
      // Defend
    } else if (act >= 9) {
      // Counter
    }
  }
}

void Enemy::setBossClassByChoice(int boss) {
  switch (boss) {
  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;
  }
}

void Enemy::setBossClassByRand() {
  int monster = rand() % 3; // Boss Monster Randomization

  setBossClassByChoice(monster);
}

void Enemy::setClassByChoice(int monster) {
  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;
  }
}

void Enemy::setClassByRand() {
  int monster = rand() % 3; // Monster Randomization

  setClassByChoice(monster);
}

Enemy::Enemy(bool boss) {
  setPos();
  if (boss) {
    setBossClassByRand();
  } else {
    setClassByRand();
  }
}