species.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. #ifndef __SPECIES_H
  2. #define __SPECIES_H
  3. #include <string>
  4. struct Species {
  5. enum class habitat_t : unsigned int {
  6. walk,
  7. floor,
  8. water,
  9. corner,
  10. shoreline
  11. };
  12. enum class ai_t : unsigned int {
  13. none,
  14. seek,
  15. random,
  16. seek_awake,
  17. magic_none,
  18. magic_none_awake,
  19. suicide,
  20. magic_random
  21. };
  22. enum class idle_ai_t : unsigned int {
  23. none,
  24. random
  25. };
  26. enum class move_t : unsigned int {
  27. walk,
  28. floor,
  29. water,
  30. corner,
  31. shoreline
  32. };
  33. tag_t tag;
  34. std::string name;
  35. skins skin;
  36. unsigned int level;
  37. unsigned int count;
  38. int true_level;
  39. tag_t genus;
  40. std::string descr;
  41. habitat_t habitat;
  42. ai_t ai;
  43. idle_ai_t idle_ai;
  44. move_t move;
  45. pstats::stats_t stats;
  46. double digging;
  47. unsigned int range;
  48. mean_deviation_t clumpsize;
  49. struct companion_t {
  50. tag_t tag;
  51. double chance;
  52. companion_t(tag_t t = tag_t(), double c = 0.0) : tag(t), chance(c) {}
  53. };
  54. std::vector<companion_t> companion;
  55. struct drop_t {
  56. tag_t tag;
  57. double chance;
  58. unsigned int level;
  59. tag_t damage_type;
  60. drop_t(tag_t t = tag_t(), double c = 0.0, unsigned int l = 0) : tag(t), chance(c), level(0) {}
  61. };
  62. std::vector<drop_t> drop;
  63. damage::attacks_t attacks;
  64. damage::defenses_t defenses;
  65. struct cloud_t {
  66. double chance;
  67. tag_t terraintag;
  68. unsigned int radius;
  69. unsigned int turns;
  70. std::string name;
  71. cloud_t() : chance(0), radius(0), turns(0) {}
  72. };
  73. std::vector<cloud_t> cast_cloud;
  74. struct summon_t {
  75. double chance;
  76. tag_t speciestag;
  77. unsigned int turns;
  78. std::string msg;
  79. summon_t() : chance(0), turns(0) {}
  80. };
  81. std::vector<summon_t> summon;
  82. tag_t death_summon;
  83. struct spawn_t {
  84. double chance;
  85. unsigned int level;
  86. unsigned int turns;
  87. std::string msg;
  88. spawn_t() : chance(0), turns(0) {}
  89. };
  90. std::vector<spawn_t> spawns;
  91. struct flags_t {
  92. bool undead;
  93. bool animal;
  94. bool magic;
  95. bool plant;
  96. bool robot;
  97. bool terrain_immune;
  98. bool eyeless;
  99. bool cosmic;
  100. bool stealthy;
  101. bool player;
  102. flags_t() :
  103. undead(false), animal(false), magic(false), plant(false), robot(false),
  104. terrain_immune(false), eyeless(false), cosmic(false), stealthy(false),
  105. player(false)
  106. {}
  107. };
  108. flags_t flags;
  109. struct blast_t {
  110. double chance;
  111. unsigned int radius;
  112. unsigned int range;
  113. unsigned int turns;
  114. damage::attacks_t attacks;
  115. std::string name;
  116. blast_t() : chance(0), radius(0), range(0), turns(0) {}
  117. };
  118. std::vector<blast_t> blast;
  119. struct trail_t {
  120. tag_t terrain;
  121. tag_t stat;
  122. mean_deviation_t cost;
  123. };
  124. trail_t trail;
  125. tag_t steal;
  126. struct morph_t {
  127. tag_t species;
  128. double chance;
  129. morph_t() : chance(0) {}
  130. };
  131. morph_t morph;
  132. std::map<tag_t, double> inc_stat;
  133. tag_t ally;
  134. struct cost_t {
  135. tag_t stat;
  136. double cost;
  137. cost_t() : cost(0) {}
  138. };
  139. cost_t magic_cost;
  140. Species() : level(0), count(0), true_level(-1), habitat(habitat_t::walk), ai(ai_t::none), idle_ai(idle_ai_t::none),
  141. move(move_t::walk), digging(0), range(0), clumpsize(), flags() {}
  142. unsigned int get_computed_level() const {
  143. return (true_level >= 0 ? true_level : level);
  144. }
  145. };
  146. #endif