noath 6 år sedan
förälder
incheckning
214a2b8f8a
2 ändrade filer med 23 tillägg och 40 borttagningar
  1. 14 6
      unit.cpp
  2. 9 34
      unit.h

+ 14 - 6
unit.cpp

@@ -7,6 +7,14 @@
 
 Unit::Unit() {}
 
+int Unit::getCost(){
+	return cost_;
+}
+
+void Unit::setCost(int value){
+	cost_ = value;
+}
+
 double Unit::getExperience() {
 	return experience_;
 }
@@ -56,11 +64,11 @@ void Unit::setMovementSpeed(int value) {
 	movement_speed_ = value;
 }
 
-int Unit::getAttackSpeed(){
-	return attack_speed_;
+int Unit::getAttackCost(){
+	return attack_cost_;
 }
-void Unit::setAttackSpeed(int value){
-	attack_speed_ = value;
+void Unit::setAttackCost(int value){
+	attack_cost_ = value;
 }
 
 double Unit::getInitiative() {
@@ -99,10 +107,10 @@ void Unit::setAgility(double value) {
 }
 
 int Unit::getAttackPoints(){
-	return attack_speed_;
+	return attack_cost_;
 }
 void Unit::setAttackPoints(int value){
-	attack_speed_ = value;
+	attack_cost_ = value;
 }
 
 double Unit::getMagicDefence() {

+ 9 - 34
unit.h

@@ -24,6 +24,7 @@ protected:
 
 private:
 	//personal information
+	int cost_;
 	double experience_;
 	double level_;
 	std::string race_; //lower case
@@ -52,9 +53,15 @@ private:
 	double physic_defence_; //less or equal 40
 
 public:
-	Unit();
+	Unit() = delete;
+	Unit(std::string path) {
+
+	}
 	virtual ~Unit() = delete;
 
+	int getCost();
+	void setCost(int value);
+
 	double getExperience();
 	void setExperience(double value);
 
@@ -129,36 +136,4 @@ public:
 	virtual bool canAttackToCell(Cell* destination) = 0;
 
 	virtual bool canAttackUnit(Unit* target) = 0;
-};
-
-class MeleeUnit : public Unit {
-protected:
-private:
-
-public:
-	virtual ~MeleeUnit() = delete;
-
-	virtual	bool canAttackForDistance(int distance);
-
-	virtual bool canAttackToCell(Cell* destination);
-
-	virtual bool canAttackUnit(Unit* target);
-
-};
-
-class RangeUnit : public Unit {
-protected:
-private:
-
-public:
-	virtual ~RangeUnit() = delete;
-};
-
-template <class Base>
-class AbstractUnitCreator {
-public:
-	AbstractUnitCreator() {}
-	virtual ~AbstractUnitCreator() {}
-	virtual Base* create() const = 0;
-};
-
+};