You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

main0.cpp 5.5KB

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