Selaa lähdekoodia

added real coordinates and race

noath 6 vuotta sitten
vanhempi
commit
712b5dbd10
2 muutettua tiedostoa jossa 41 lisäystä ja 6 poistoa
  1. 24 1
      unit.cpp
  2. 17 5
      unit.h

+ 24 - 1
unit.cpp

@@ -112,6 +112,27 @@ void Unit::setPhysicDefence(double value) {
 	physic_defence_ = value;
 }
 
+std::string Unit::getRace() {
+	return race_;
+}
+void Unit::setRace(std::string new_race) {
+	race_ = new_race;
+}
+
+double Unit::getRealX() {
+	return real_x_;
+}
+void Unit::setRealX(double x) {
+	real_x_ = x;
+}
+
+double Unit::getRealY() {
+	return real_y_;
+}
+void Unit::setRealY(double y) {
+	real_y_ = y;
+}
+
 void Unit::calculateDamagePerHit() {
 	damage_per_hit_ = 0.5 * std::max(getAgility(), std::max(getStrength(), getIntelligence()));
 }
@@ -151,8 +172,10 @@ void Unit::moveToCell(Cell* destination) {
 	}
 }
 
+
+
 /*bool canAttack(int distance) {
 
 }*/
 
-//TODO: real_x_, real_y_, ptr to player
+//TODO: real_x_, real_y_

+ 17 - 5
unit.h

@@ -23,9 +23,10 @@ protected:
 	std::vector <Spell> skills_;
 
 private:
-	//personal growth
+	//personal information
 	double experience_;
 	double level_;
+	std::string race_; //lower case
 
 	//actions and events
 	double initiative_;
@@ -33,6 +34,8 @@ private:
 	//movement
 	Cell* location_;
 	double movement_points_; //how many cells can move for one activity point
+	double real_x_;
+	double real_y_;
 
 	//attack action
 	double agility_;
@@ -97,17 +100,26 @@ public:
 	double getPhysicDefence();
 	void setPhysicDefence(double value);
 
+	std::string getRace();
+	void setRace(std::string new_race);
+
+	double getRealX();
+	void setRealX(double x);
+
+	double getRealY();
+	void setRealY(double y);
+
 	virtual void calculateDamagePerHit();
 
-	double reduceIncomingDamage(std::string damageType, int value);
+	virtual double reduceIncomingDamage(std::string damageType, int value);
 
 	int lenOfActualPath(Cell* destination);
 
-	bool canMoveForDistance(int distance);
+	virtual bool canMoveForDistance(int distance);
 
-	bool canMoveToCell(Cell* destination);
+	virtual bool canMoveToCell(Cell* destination);
 
-	void moveToCell(Cell* destination);
+	virtual void moveToCell(Cell* destination);
 	
 //	bool canAttackForDistance(int distance);
 };