⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 spell.h

📁 S.C.O.U.R.G.E.是一款类似Rogue的游戏
💻 H
字号:
/***************************************************************************                          spell.h  -  description                             -------------------    begin                : Sun Sep 28 2003    copyright            : (C) 2003 by Gabor Torok    email                : cctorok@yahoo.com ***************************************************************************//*************************************************************************** *                                                                         * *   This program 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     * *   (at your option) any later version.                                   * *                                                                         * ***************************************************************************/#ifndef SPELL_H#define SPELL_H#include <map>#include <string>#include <vector>#include "../constants.h"using namespace std;class Dice { private:  char *s;  int count;  int sides;  int mod; public:  Dice(char *s);  ~Dice();  inline char *toString() { return s; }  inline int roll() { 	float n = (float)sides * rand()/RAND_MAX;	n *= count;	n += mod;	return (int)n;  }};class MagicSchool;class Spell { private:  char *name;  int level;  int mp;  int exp;  int failureRate;  Dice *action;  int distance;  int targetType;  char notes[1000];  int speed;  int effect;  MagicSchool *school;    bool creatureTarget, locationTarget, itemTarget;  static map<string, Spell*> spellMap; public:  Spell(char *name, int level, int mp, int exp, int failureRate, Dice *action, 		int distance, int targetType, int speed, int effect, bool creatureTarget, 		bool locationTarget, bool itemTarget, MagicSchool *school);  ~Spell();  inline char *getName() { return name; }  inline int getAction() { return action->roll(); }  inline int getLevel()  { return level; }  inline int getMp() { return mp; }  inline int getExp() { return exp; }  inline int getFailureRate() { return failureRate; }  inline int getDistance() { return distance; }  inline int getTargetType() { return targetType; }    inline char *getNotes() { return notes; }  inline int getSpeed() { return speed; }  inline int getEffect() { return effect; }  inline MagicSchool *getSchool() { return school; }  inline bool isRangedSpell() { return distance > 1; }    inline void describe(char *s) { sprintf(s, "%s (L:%d)(M:%d)", name, level, mp); }  inline void addNotes(char *s) { strcat(notes, s); }  // what kind of target is allowed for this spell  inline bool isCreatureTargetAllowed() { return creatureTarget; }  inline bool isLocationTargetAllowed() { return locationTarget; }  inline bool isItemTargetAllowed() { return itemTarget; }  static Spell *getSpellByName(char *name);};class MagicSchool { private:  char *name;  char *deity;  int skill;  vector<Spell*> spells;  static MagicSchool *schools[10];  static int schoolCount; public:  MagicSchool(char *name, char *deity, int skill);  ~MagicSchool();  inline char *getName() { return name; }  inline char *getDeity() { return deity; }  inline int getSkill() { return skill; }  inline int getSpellCount() { return spells.size(); }  inline Spell *getSpell(int index) { return spells[index]; }  static void initMagic();  inline static int getMagicSchoolCount() { return schoolCount; }  inline static MagicSchool *getMagicSchool( int index ) { return schools[index]; }  static Spell *getRandomSpell(int level); protected:  inline void addSpell( Spell *spell ) { spells.push_back( spell ); }};#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -