unit.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. #pragma once
  2. #include <iostream>
  3. #include <vector>
  4. #include "AbstractFactory.h"
  5. class Spell;
  6. class Cell {
  7. //waiting for a realisation
  8. public:
  9. //must be in cell.h
  10. bool isEmpty() {
  11. return true;
  12. }
  13. std::vector <Cell*> actualPath(Cell* destination) { //the shortest existing path from (*this) to (*destination)
  14. std::vector <Cell*> path;
  15. return path;
  16. }
  17. };
  18. class Unit {
  19. protected:
  20. std::vector <Spell> skills_;
  21. private:
  22. //personal information
  23. int cost_;
  24. std::string parent_spec_;
  25. std::vector<std::string> upgrade_specs_;
  26. double experience_;
  27. double level_;
  28. std::string race_; //lower case
  29. //actions and events
  30. double initiative_;
  31. int activity_points_;
  32. //movement
  33. Cell* location_;
  34. int movement_speed_; //how many cells can move for one activity point
  35. double real_x_;
  36. double real_y_;
  37. //attack action
  38. double agility_;
  39. double attack_range_;
  40. double damage_per_hit_;
  41. double intelligence_;
  42. double strength_;
  43. int attack_cost_; //how many activity points does attack cost
  44. //durability
  45. double health_points_;
  46. double magic_defence_; //less or equal 40
  47. double physic_defence_; //less or equal 40
  48. public:
  49. Unit() = delete;
  50. Unit(std::string path) {
  51. }
  52. virtual ~Unit() = delete;
  53. int getCost();
  54. void setCost(int value);
  55. std::string getParentSpec();
  56. void setParentSpec(std::string specId);
  57. std::vector<std::string> getUpgradeSpecs();
  58. void setUpgradeSpecs(std::vector <std::string> specs);
  59. double getExperience();
  60. void setExperience(double value);
  61. double getLevel();
  62. void setLevel(double value);
  63. double getHealthPoints();
  64. void setHealthPoints(double value);
  65. double getAttackRange();
  66. void setAttackRange(double value);
  67. int getActivityPoints();
  68. void setActivityPoints(int value);
  69. Cell* getLocation();
  70. void setLocation(Cell* to);
  71. int getMovementSpeed();
  72. void setMovementSpeed(int value);
  73. int getAttackCost();
  74. void setAttackCost(int value);
  75. double getInitiative();
  76. void setInitiative(double value);
  77. double getDamagePerHit();
  78. void setDamagePerHit(double value);
  79. double getIntelligence();
  80. void setIntelligence(double value);
  81. double getStrength();
  82. void setStrength(double value);
  83. double getAgility();
  84. void setAgility(double value);
  85. int getAttackPoints();
  86. void setAttackPoints(int value);
  87. double getMagicDefence();
  88. void setMagicDefence(double value);
  89. double getPhysicDefence();
  90. void setPhysicDefence(double value);
  91. std::string getRace();
  92. void setRace(std::string new_race);
  93. double getRealX();
  94. void setRealX(double x);
  95. double getRealY();
  96. void setRealY(double y);
  97. virtual void calculateDamagePerHit();
  98. virtual double reduceIncomingDamage(std::string damageType, int value);
  99. int lenOfActualPath(Cell* destination);
  100. virtual bool canMoveForDistance(int distance);
  101. virtual bool canMoveToCell(Cell* destination);
  102. virtual void moveToCell(Cell* destination);
  103. virtual bool canAttackForDistance(int distance) = 0;
  104. virtual bool canAttackToCell(Cell* destination) = 0;
  105. virtual bool canAttackUnit(Unit* target) = 0;
  106. };