CCreatureHandler.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. ui32 idNumber;
  23. std::set<EAbilities> abilities;
  24. int faction; //-1 = neutral
  25. ///animation info
  26. float timeBetweenFidgets, walkAnimationTime, attackAnimationTime, flightAnimationDistance;
  27. int upperRightMissleOffsetX, rightMissleOffsetX, lowerRightMissleOffsetX, upperRightMissleOffsetY, rightMissleOffsetY, lowerRightMissleOffsetY;
  28. float missleFrameAngles[12];
  29. int troopCountLocationOffset, attackClimaxFrame;
  30. ///end of anim info
  31. //for some types of towns
  32. bool isDefinite; //if the creature type is wotn dependent, it should be true
  33. int indefLevel; //only if indefinite
  34. bool indefUpgraded; //onlu if inddefinite
  35. //TODO - zdolnoœci (abilities) - na typie wyliczeniowym czy czymœ - albo lepiej secie czegoœ
  36. bool isDoubleWide(); //returns true if unit is double wide on battlefield
  37. bool isFlying(); //returns true if it is a flying unit
  38. bool isShooting(); //returns true if unit can shoot
  39. si32 maxAmount(const std::vector<si32> &res) const; //how many creatures can be bought
  40. static int getQuantityID(int quantity); //0 - a few, 1 - several, 2 - pack, 3 - lots, 4 - horde, 5 - throng, 6 - swarm, 7 - zounds, 8 - legion
  41. };
  42. class DLL_EXPORT CCreatureHandler
  43. {
  44. public:
  45. std::set<int> notUsedMonsters;
  46. std::vector<CCreature> creatures; //creature ID -> creature info
  47. std::map<int,std::vector<CCreature*> > levelCreatures; //level -> list of creatures
  48. std::map<std::string,int> nameToID;
  49. std::map<int,std::string> idToProjectile;
  50. std::map<int,bool> idToProjectileSpin; //if true, appropriate projectile is spinning during flight
  51. void loadCreatures();
  52. void loadAnimationInfo();
  53. void loadUnitAnimInfo(CCreature & unit, std::string & src, int & i);
  54. CCreatureHandler();
  55. };
  56. #endif //CCREATUREHANDLER_H