spellbook.h

Go to the documentation of this file.
00001 
00007 /*
00008 Copyright (C) 2000 The Exult Team.
00009 
00010 This program is free software; you can redistribute it and/or
00011 modify it under the terms of the GNU General Public License
00012 as published by the Free Software Foundation; either version 2
00013 of the License, or (at your option) any later version.
00014 
00015 This program is distributed in the hope that it will be useful,
00016 but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018 GNU General Public License for more details.
00019 
00020 You should have received a copy of the GNU General Public License
00021 along with this program; if not, write to the Free Software
00022 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00023 */
00024 
00025 #ifndef INCL_SPELLBOOK
00026 #define INCL_SPELLBOOK  1
00027 
00028 #include "iregobjs.h"
00029 
00030 const int NREAGENTS = 11;   // Total # reagents.
00031 
00032 /*
00033  *  A spellbook:
00034  */
00035 class Spellbook_object : public Ireg_game_object
00036   {
00037           // Reagents needed for each spell:
00038   static unsigned short bg_reagents[9*8], si_reagents[9*8];
00039   unsigned short *reagents; // ->appropriate table.
00040   unsigned char circles[9]; // Spell-present flags for each circle.
00041   int bookmark;     // Spell # that bookmark is on, or -1.
00042 public:
00043   friend class Bookmark_button;
00044   friend class Spellbook_gump;
00045           // Create from ireg. data.
00046   Spellbook_object(int shapenum, int framenum, unsigned int shapex,
00047     unsigned int shapey, unsigned int lft, unsigned char *c,
00048     unsigned char bmark);
00049   int add_spell(int spell); // Add a spell.
00050   bool has_ring(Actor *act);  // Has ring-o-reagents?
00051           // Can we do this spell?
00052   bool can_do_spell(Actor *act, int spell);
00053   bool can_do_spell(Actor *act) // Can we do bookmarked spell?
00054     { return bookmark >= 0 ? can_do_spell(act, bookmark) : false; }
00055           // Do the spell.
00056   bool do_spell(Actor *act, int spell, bool can_do = false,
00057             bool in_combat = false);
00058           // Do bookmarked spell.
00059   bool do_spell(Actor *act, bool in_combat = false)
00060     { return bookmark >= 0 ?
00061       do_spell(act, bookmark, false, in_combat) : false; }
00062   static void execute_spell(Actor *act, int spell, 
00063             bool in_combat = false);
00064           // Run usecode function.
00065   virtual void activate(int event = 1);
00066           // Write out to IREG file.
00067   virtual void write_ireg(DataSource* out);
00068         // Get size of IREG. 
00069         // Returns -1 if can't write to buffer
00070   virtual int get_ireg_size();
00071   };
00072 
00073 #endif

Generated on Mon Jul 9 14:42:49 2007 for ExultEngine by  doxygen 1.5.1