Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

100 rindas
5.7 KiB

pirms 5 gadiem
  1. #include "Game.hpp"
  2. std::map<std::string, Element> Game::Elements;
  3. std::map<Element, std::vector<Spell>> Game::SpellBook;
  4. std::vector<Character> Game::PlayerParty;
  5. bool Game::isPartyAlive(std::vector<Character> &party)
  6. {
  7. std::vector<Character>::iterator it;
  8. for (it = party.begin(); it != party.end(); ++it)
  9. {
  10. if (it->isAlive())
  11. {
  12. return true;
  13. }
  14. }
  15. return false;
  16. }
  17. void Game::init()
  18. {
  19. /* initialise elements */
  20. Game::Elements["Fire"] = Element("Fire");
  21. Game::Elements["Water"] = Element("Water");
  22. Game::Elements["Wind"] = Element("Wind");
  23. Game::Elements["Earth"] = Element("Earth");
  24. Game::Elements["Holy"] = Element("Holy");
  25. Game::Elements["Dark"] = Element("Dark");
  26. Game::Elements["Void"] = Element("Void");
  27. Game::Elements["Fire"].setStrongAgainst(&Game::Elements["Earth"]);
  28. Game::Elements["Fire"].setWeakAgainst(&Game::Elements["Water"]);
  29. Game::Elements["Water"].setStrongAgainst(&Game::Elements["Fire"]);
  30. Game::Elements["Water"].setWeakAgainst(&Game::Elements["Wind"]);
  31. Game::Elements["Wind"].setStrongAgainst(&Game::Elements["Water"]);
  32. Game::Elements["Wind"].setWeakAgainst(&Game::Elements["Earth"]);
  33. Game::Elements["Earth"].setStrongAgainst(&Game::Elements["Wind"]);
  34. Game::Elements["Earth"].setWeakAgainst(&Game::Elements["Fire"]);
  35. Game::Elements["Holy"].setStrongAgainst(&Game::Elements["Dark"]);
  36. Game::Elements["Holy"].setWeakAgainst(&Game::Elements["Dark"]);
  37. Game::Elements["Dark"].setStrongAgainst(&Game::Elements["Holy"]);
  38. Game::Elements["Dark"].setWeakAgainst(&Game::Elements["Holy"]);
  39. /* initialise spell book */
  40. SpellBook[Game::Elements["Fire"]] = {
  41. Spell("Fire Bolt", &Game::Elements["Fire"], Spell::TYPE_DESTRUCTION, 10, 5),
  42. Spell("Warm Touch", &Game::Elements["Fire"], Spell::TYPE_RESTORATION, 10, 10),
  43. Spell("Flame Javelin", &Game::Elements["Fire"], Spell::TYPE_DESTRUCTION, 25, 15),
  44. Spell("Flaming Rocket", &Game::Elements["Fire"], Spell::TYPE_DESTRUCTION, 50, 20),
  45. Spell("Sun's Strike", &Game::Elements["Fire"], Spell::TYPE_DESTRUCTION, 100, 25),
  46. Spell("Big Bang", &Game::Elements["Fire"], Spell::TYPE_DESTRUCTION, 200, 30)};
  47. SpellBook[Game::Elements["Water"]] = {
  48. Spell("Water Splash", &Game::Elements["Water"], Spell::TYPE_DESTRUCTION, 10, 5),
  49. Spell("Healing Water", &Game::Elements["Water"], Spell::TYPE_RESTORATION, 10, 10),
  50. Spell("Jet Stream", &Game::Elements["Water"], Spell::TYPE_DESTRUCTION, 25, 15),
  51. Spell("Rain of Healing", &Game::Elements["Water"], Spell::TYPE_RESTORATION, 25, 20),
  52. Spell("Whirlpool", &Game::Elements["Water"], Spell::TYPE_DESTRUCTION, 50, 25),
  53. Spell("Tsunami", &Game::Elements["Water"], Spell::TYPE_DESTRUCTION, 100, 30),
  54. };
  55. SpellBook[Game::Elements["Wind"]] = {
  56. Spell("Breath of Wind", &Game::Elements["Wind"], Spell::TYPE_DESTRUCTION, 10, 5),
  57. Spell("Wind of Restoration", &Game::Elements["Wind"], Spell::TYPE_RESTORATION, 10, 10),
  58. Spell("Air Needle", &Game::Elements["Wind"], Spell::TYPE_DESTRUCTION, 25, 15),
  59. Spell("Tornado", &Game::Elements["Wind"], Spell::TYPE_DESTRUCTION, 50, 20),
  60. Spell("Twin Tornado", &Game::Elements["Wind"], Spell::TYPE_DESTRUCTION, 100, 25),
  61. Spell("Triple Tornado", &Game::Elements["Wind"], Spell::TYPE_DESTRUCTION, 200, 30),
  62. };
  63. SpellBook[Game::Elements["Earth"]] = {
  64. Spell("Rock Throw", &Game::Elements["Earth"], Spell::TYPE_DESTRUCTION, 10, 5),
  65. Spell("Earth Sheet", &Game::Elements["Earth"], Spell::TYPE_RESTORATION, 10, 10),
  66. Spell("Earth Split", &Game::Elements["Earth"], Spell::TYPE_DESTRUCTION, 25, 15),
  67. Spell("Crushed Earth", &Game::Elements["Earth"], Spell::TYPE_DESTRUCTION, 50, 20),
  68. Spell("Wall of Eden", &Game::Elements["Earth"], Spell::TYPE_RESTORATION, 50, 25),
  69. Spell("Earthquake", &Game::Elements["Earth"], Spell::TYPE_DESTRUCTION, 100, 30),
  70. };
  71. SpellBook[Game::Elements["Holy"]] = {
  72. Spell("Holy Light", &Game::Elements["Holy"], Spell::TYPE_DESTRUCTION, 10, 5),
  73. Spell("Healing Light", &Game::Elements["Holy"], Spell::TYPE_RESTORATION, 25, 10),
  74. Spell("Light of Judgment", &Game::Elements["Holy"], Spell::TYPE_DESTRUCTION, 50, 15),
  75. Spell("Flame of Purgatory", &Game::Elements["Holy"], Spell::TYPE_DESTRUCTION, 100, 20),
  76. Spell("God's Protection", &Game::Elements["Holy"], Spell::TYPE_RESTORATION, 1000000000, 25),
  77. };
  78. SpellBook[Game::Elements["Dark"]] = {
  79. Spell("Dark Touch", &Game::Elements["Dark"], Spell::TYPE_DESTRUCTION, 10, 5),
  80. Spell("Hell's Touch", &Game::Elements["Dark"], Spell::TYPE_DESTRUCTION, 25, 10),
  81. Spell("Hell's Inferno", &Game::Elements["Dark"], Spell::TYPE_DESTRUCTION, 50, 15),
  82. Spell("Eclipse", &Game::Elements["Dark"], Spell::TYPE_DESTRUCTION, 100, 20),
  83. Spell("Hell on Earth", &Game::Elements["Dark"], Spell::TYPE_DESTRUCTION, 200, 25),
  84. };
  85. SpellBook[Game::Elements["Void"]] = {
  86. Spell("?", &Game::Elements["Void"], Spell::TYPE_DESTRUCTION, 1, 1),
  87. Spell("?", &Game::Elements["Void"], Spell::TYPE_DESTRUCTION, 10, 1),
  88. Spell("?", &Game::Elements["Void"], Spell::TYPE_DESTRUCTION, 100, 1),
  89. Spell("?", &Game::Elements["Void"], Spell::TYPE_DESTRUCTION, 1000, 1),
  90. Spell("?", &Game::Elements["Void"], Spell::TYPE_DESTRUCTION, 10000, 1),
  91. Spell("?", &Game::Elements["Void"], Spell::TYPE_DESTRUCTION, 100000, 1),
  92. Spell("?", &Game::Elements["Void"], Spell::TYPE_DESTRUCTION, 1000000, 1),
  93. Spell("?", &Game::Elements["Void"], Spell::TYPE_DESTRUCTION, 10000000, 1),
  94. Spell("?", &Game::Elements["Void"], Spell::TYPE_DESTRUCTION, 100000000, 1),
  95. Spell("?", &Game::Elements["Void"], Spell::TYPE_DESTRUCTION, 1000000000, 1),
  96. };
  97. }