unit.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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; //empty if there is no way
  15. return path;
  16. }
  17. };
  18. class Unit {
  19. protected:
  20. std::vector <Spell> skills_;
  21. //personal information
  22. int cost_;
  23. std::string parent_spec_;
  24. std::vector<std::string> upgrade_specs_;
  25. double experience_;
  26. double level_;
  27. std::string race_; //lower case
  28. int max_copies_in_army_;
  29. //actions and events
  30. double initiative_;
  31. int activity_points_;
  32. int starting_activity_points_; //at start turn
  33. //movement
  34. Cell* location_;
  35. int movement_speed_; //how many cells can move for one activity point
  36. double real_x_;
  37. double real_y_;
  38. //attack action
  39. double agility_;
  40. double attack_range_;
  41. double damage_per_hit_;
  42. double intelligence_;
  43. double strength_;
  44. int attack_cost_; //how many activity points does attack cost
  45. //durability
  46. double health_points_;
  47. double magic_defence_; //less or equal 40
  48. double physic_defence_; //less or equal 40
  49. public:
  50. Unit() {};
  51. Unit(std::string id);
  52. virtual ~Unit() {};
  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. int getStartingActivityPoints();
  70. void setStartingActivityPoints(int value);
  71. Cell* getLocation();
  72. void setLocation(Cell* to);
  73. int getMovementSpeed();
  74. void setMovementSpeed(int value);
  75. int getAttackCost();
  76. void setAttackCost(int value);
  77. double getInitiative();
  78. void setInitiative(double value);
  79. double getDamagePerHit();
  80. void setDamagePerHit(double value);
  81. double getIntelligence();
  82. void setIntelligence(double value);
  83. double getStrength();
  84. void setStrength(double value);
  85. double getAgility();
  86. void setAgility(double value);
  87. int getAttackPoints();
  88. void setAttackPoints(int value);
  89. double getMagicDefence();
  90. void setMagicDefence(double value);
  91. double getPhysicDefence();
  92. void setPhysicDefence(double value);
  93. int getMaxCopiesInArmy();
  94. void setMaxCopiesInArmy(int count);
  95. std::string getRace();
  96. void setRace(std::string new_race);
  97. double getRealX();
  98. void setRealX(double x);
  99. double getRealY();
  100. void setRealY(double y);
  101. virtual void calculateDamagePerHit();
  102. virtual double reduceIncomingDamage(std::string damageType, int damage);
  103. int lenOfActualPath(Cell* destination);
  104. virtual bool canMoveForDistance(int distance);
  105. virtual bool canMoveToCell(Cell* destination);
  106. virtual void moveToCell(Cell* destination);
  107. virtual bool canAttackForDistance(int distance) = 0;
  108. virtual bool canAttackToCell(Cell* destination) = 0;
  109. virtual bool canAttackUnit(Unit* target) = 0;
  110. };