CCreatureHandler.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #ifndef CCREATUREHANDLER_H
  2. #define CCREATUREHANDLER_H
  3. #include "../global.h"
  4. #include <string>
  5. #include <vector>
  6. #include <map>
  7. #include <set>
  8. class CLodHandler;
  9. class DLL_EXPORT CCreature
  10. {
  11. public:
  12. std::string namePl, nameSing, nameRef; //name in singular and plural form; and reference name
  13. std::vector<int> cost; //cost[res_id] - amount of that resource
  14. std::set<int> upgrades; // IDs of creatures to which this creature can be upgraded
  15. int fightValue, AIValue, growth, hordeGrowth, hitPoints, speed, attack, defence, shots, spells;
  16. int damageMin, damageMax;
  17. int ammMin, ammMax;
  18. int level; // 0 - unknown
  19. std::string abilityText; //description of abilities
  20. std::string abilityRefs; //references to abilities, in textformat
  21. std::string animDefName;
  22. int idNumber;
  23. int faction; //-1 = neutral
  24. ///animation info
  25. float timeBetweenFidgets, walkAnimationTime, attackAnimationTime, flightAnimationDistance;
  26. int upperRightMissleOffsetX, rightMissleOffsetX, lowerRightMissleOffsetX, upperRightMissleOffsetY, rightMissleOffsetY, lowerRightMissleOffsetY;
  27. float missleFrameAngles[12];
  28. int troopCountLocationOffset, attackClimaxFrame;
  29. ///end of anim info
  30. //for some types of towns
  31. bool isDefinite; //if the creature type is wotn dependent, it should be true
  32. int indefLevel; //only if indefinite
  33. bool indefUpgraded; //onlu if inddefinite
  34. //TODO - zdolnoœci (abilities) - na typie wyliczeniowym czy czymœ - albo lepiej secie czegoœ
  35. bool isDoubleWide(); //returns true if unit is double wide on battlefield
  36. bool isFlying(); //returns true if it is a flying unit
  37. int maxAmount(const std::vector<int> &res) const; //how many creatures can be bought
  38. static int getQuantityID(int quantity); //0 - a few, 1 - several, 2 - pack, 3 - lots, 4 - horde, 5 - throng, 6 - swarm, 7 - zounds, 8 - legion
  39. };
  40. class DLL_EXPORT CCreatureHandler
  41. {
  42. public:
  43. std::vector<CCreature> creatures; //creature ID -> creature info
  44. std::map<int,std::vector<CCreature*> > levelCreatures; //level -> list of creatures
  45. std::map<std::string,int> nameToID;
  46. void loadCreatures();
  47. void loadAnimationInfo();
  48. void loadUnitAnimInfo(CCreature & unit, std::string & src, int & i);
  49. CCreatureHandler();
  50. };
  51. #endif //CCREATUREHANDLER_H