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.
 
 
 
 

101 lines
5.7 KiB

#include "Game.hpp"
std::map<std::string, Element> Game::Elements;
std::map<Element, std::vector<Spell>> Game::SpellBook;
std::vector<Character> Game::PlayerParty;
bool Game::isPartyAlive(std::vector<Character> &party)
{
std::vector<Character>::iterator it;
for (it = party.begin(); it != party.end(); ++it)
{
if (it->isAlive())
{
return true;
}
}
return false;
}
void Game::init()
{
/* initialise elements */
Game::Elements["Fire"] = Element("Fire");
Game::Elements["Water"] = Element("Water");
Game::Elements["Wind"] = Element("Wind");
Game::Elements["Earth"] = Element("Earth");
Game::Elements["Holy"] = Element("Holy");
Game::Elements["Dark"] = Element("Dark");
Game::Elements["Void"] = Element("Void");
Game::Elements["Fire"].setStrongAgainst(&Game::Elements["Earth"]);
Game::Elements["Fire"].setWeakAgainst(&Game::Elements["Water"]);
Game::Elements["Water"].setStrongAgainst(&Game::Elements["Fire"]);
Game::Elements["Water"].setWeakAgainst(&Game::Elements["Wind"]);
Game::Elements["Wind"].setStrongAgainst(&Game::Elements["Water"]);
Game::Elements["Wind"].setWeakAgainst(&Game::Elements["Earth"]);
Game::Elements["Earth"].setStrongAgainst(&Game::Elements["Wind"]);
Game::Elements["Earth"].setWeakAgainst(&Game::Elements["Fire"]);
Game::Elements["Holy"].setStrongAgainst(&Game::Elements["Dark"]);
Game::Elements["Holy"].setWeakAgainst(&Game::Elements["Dark"]);
Game::Elements["Dark"].setStrongAgainst(&Game::Elements["Holy"]);
Game::Elements["Dark"].setWeakAgainst(&Game::Elements["Holy"]);
/* initialise spell book */
SpellBook[Game::Elements["Fire"]] = {
Spell("Fire Bolt", &Game::Elements["Fire"], Spell::TYPE_DESTRUCTION, 10, 5),
Spell("Warm Touch", &Game::Elements["Fire"], Spell::TYPE_RESTORATION, 10, 10),
Spell("Flame Javelin", &Game::Elements["Fire"], Spell::TYPE_DESTRUCTION, 25, 15),
Spell("Flaming Rocket", &Game::Elements["Fire"], Spell::TYPE_DESTRUCTION, 50, 20),
Spell("Sun's Strike", &Game::Elements["Fire"], Spell::TYPE_DESTRUCTION, 100, 25),
Spell("Big Bang", &Game::Elements["Fire"], Spell::TYPE_DESTRUCTION, 200, 30)};
SpellBook[Game::Elements["Water"]] = {
Spell("Water Splash", &Game::Elements["Water"], Spell::TYPE_DESTRUCTION, 10, 5),
Spell("Healing Water", &Game::Elements["Water"], Spell::TYPE_RESTORATION, 10, 10),
Spell("Jet Stream", &Game::Elements["Water"], Spell::TYPE_DESTRUCTION, 25, 15),
Spell("Rain of Healing", &Game::Elements["Water"], Spell::TYPE_RESTORATION, 25, 20),
Spell("Whirlpool", &Game::Elements["Water"], Spell::TYPE_DESTRUCTION, 50, 25),
Spell("Tsunami", &Game::Elements["Water"], Spell::TYPE_DESTRUCTION, 100, 30),
};
SpellBook[Game::Elements["Wind"]] = {
Spell("Breath of Wind", &Game::Elements["Wind"], Spell::TYPE_DESTRUCTION, 10, 5),
Spell("Wind of Restoration", &Game::Elements["Wind"], Spell::TYPE_RESTORATION, 10, 10),
Spell("Air Needle", &Game::Elements["Wind"], Spell::TYPE_DESTRUCTION, 25, 15),
Spell("Tornado", &Game::Elements["Wind"], Spell::TYPE_DESTRUCTION, 50, 20),
Spell("Twin Tornado", &Game::Elements["Wind"], Spell::TYPE_DESTRUCTION, 100, 25),
Spell("Triple Tornado", &Game::Elements["Wind"], Spell::TYPE_DESTRUCTION, 200, 30),
};
SpellBook[Game::Elements["Earth"]] = {
Spell("Rock Throw", &Game::Elements["Earth"], Spell::TYPE_DESTRUCTION, 10, 5),
Spell("Earth Sheet", &Game::Elements["Earth"], Spell::TYPE_RESTORATION, 10, 10),
Spell("Earth Split", &Game::Elements["Earth"], Spell::TYPE_DESTRUCTION, 25, 15),
Spell("Crushed Earth", &Game::Elements["Earth"], Spell::TYPE_DESTRUCTION, 50, 20),
Spell("Wall of Eden", &Game::Elements["Earth"], Spell::TYPE_RESTORATION, 50, 25),
Spell("Earthquake", &Game::Elements["Earth"], Spell::TYPE_DESTRUCTION, 100, 30),
};
SpellBook[Game::Elements["Holy"]] = {
Spell("Holy Light", &Game::Elements["Holy"], Spell::TYPE_DESTRUCTION, 10, 5),
Spell("Healing Light", &Game::Elements["Holy"], Spell::TYPE_RESTORATION, 25, 10),
Spell("Light of Judgment", &Game::Elements["Holy"], Spell::TYPE_DESTRUCTION, 50, 15),
Spell("Flame of Purgatory", &Game::Elements["Holy"], Spell::TYPE_DESTRUCTION, 100, 20),
Spell("God's Protection", &Game::Elements["Holy"], Spell::TYPE_RESTORATION, 1000000000, 25),
};
SpellBook[Game::Elements["Dark"]] = {
Spell("Dark Touch", &Game::Elements["Dark"], Spell::TYPE_DESTRUCTION, 10, 5),
Spell("Hell's Touch", &Game::Elements["Dark"], Spell::TYPE_DESTRUCTION, 25, 10),
Spell("Hell's Inferno", &Game::Elements["Dark"], Spell::TYPE_DESTRUCTION, 50, 15),
Spell("Eclipse", &Game::Elements["Dark"], Spell::TYPE_DESTRUCTION, 100, 20),
Spell("Hell on Earth", &Game::Elements["Dark"], Spell::TYPE_DESTRUCTION, 200, 25),
};
SpellBook[Game::Elements["Void"]] = {
Spell("?", &Game::Elements["Void"], Spell::TYPE_DESTRUCTION, 1, 1),
Spell("?", &Game::Elements["Void"], Spell::TYPE_DESTRUCTION, 10, 1),
Spell("?", &Game::Elements["Void"], Spell::TYPE_DESTRUCTION, 100, 1),
Spell("?", &Game::Elements["Void"], Spell::TYPE_DESTRUCTION, 1000, 1),
Spell("?", &Game::Elements["Void"], Spell::TYPE_DESTRUCTION, 10000, 1),
Spell("?", &Game::Elements["Void"], Spell::TYPE_DESTRUCTION, 100000, 1),
Spell("?", &Game::Elements["Void"], Spell::TYPE_DESTRUCTION, 1000000, 1),
Spell("?", &Game::Elements["Void"], Spell::TYPE_DESTRUCTION, 10000000, 1),
Spell("?", &Game::Elements["Void"], Spell::TYPE_DESTRUCTION, 100000000, 1),
Spell("?", &Game::Elements["Void"], Spell::TYPE_DESTRUCTION, 1000000000, 1),
};
}