unit.h 3.0 KB

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