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
|
#ifndef Unit_h
#define Unit_h
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include "Board.h"
class Unit
{
public:
// Default constructor
Unit();
// Constructor that specifies a unit
Unit(string n, int h, int a, int w, int c, int m, int p, int r, bool l, int x, int y, bool t, Board* bPtr);
// Unit moves across arena, returns whether it's a legal movement. Takes in coordinates as arguments.
void Move(int x, int y);
// Unit executes its ability (attacks, heal, etc). Takes in defending unit as argument. Returns whether attack is leagal.
void Attack(Unit defender);
// Unit counters an attack. Takes in original attacker as argumentt, as well as original attacker's coordinates.
void Counter(Unit attacker, int x, int y);
// Returns true if a given unit is still alive
bool isAlive(Unit patient);
// Unit changes direction
void Turn();
void setHealth(int h);
void setArmor(int a);
void setWait(int w);
void setCounter(int c);
void setMove(int m);
void setPower(int p);
void setRange(int r);
void setLiving(bool l);
void set_xpos(int x);
void set_ypos(int y);
void setTeam(bool t);
int getHealth();
int getArmor();
int getWait();
int getCounter();
int getMove();
int getPower();
int getRange();
bool getLiving();
int get_xpos();
int get_ypos();
bool getTeam();
protected:
string name;
int health;
int armor;
int wait;
int counter;
int move;
int power;
int range;//?????? will have to be a set of coordinates
bool living;
int xpos;
int ypos;
bool team; // All units of 'true' team are enemies of all units of 'false' team
Board* bPtr; // pointer to the board
};
#endif
|