/* * The Mana World Server * Copyright 2004 The Mana World Development Team * * This file is part of The Mana World. * * The Mana World is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version. * * The Mana World is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with The Mana World; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef _TMWSERV_MAGIC #define _TMWSERV_MAGIC #include #include class Script; class Being; struct rune { int id; std::string name; int slots; int cost; }; struct effectRune : rune { int level; int element; int damage; }; enum spellType { SPELL_CAST = 0, SPELL_TARGET, SPELL_AOE } struct applicationRune : rune { spellType type; char enchanementLimit = 3; Script *script; std::list allowedElements; std::list disallowedEnchancements; }; struct enhancementRune : rune { std::list allowedElements; std::list disallowedEnchancements; }; class Spells { public: Spells(); ~Spells(); /** * Returns true if the spell passed to it is possible */ bool isValid(int effect, int application, int e1 = 0, int e2 = 0, int e3 = 0); /** * Calls the Lua script for a certain spell */ bool cast(being* caster, int effect, int application, int e1 = 0, int e2 = 0, int e3 = 0); bool cast(being* caster, being* target, int effect, int application, int e1 = 0, int e2 = 0, int e3 = 0); bool cast(being* caster, int x, int y, int effect, int application, int e1 = 0, int e2 = 0, int e3 = 0); /** * Modifies agruments passed to it to get spell info */ bool spellInfo(int &slots, int &cost, int effect, int application, int e1 = 0, int e2 = 0, int e3 = 0); private: effectRune* findEffectRune(int id); applicationRune* findApplicationRune(int id); findEnhancementRune* fineEnhancementRune(int id); std::list effectRunes; std::list applicationRunes; std::list enhancementRunes; }; #endif