00001 /* 00002 * The Mana World Server 00003 * Copyright 2004 The Mana World Development Team 00004 * 00005 * This file is part of The Mana World. 00006 * 00007 * The Mana World is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 2 of the License, or 00010 * any later version. 00011 * 00012 * The Mana World is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with The Mana World; if not, write to the Free Software 00019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 * 00021 * $Id: skill.h 2211 2006-03-06 00:26:05Z der_doener $ 00022 */ 00023 00024 #ifndef SKILL_H 00025 #define SKILL_H 00026 00027 #include <iostream> 00028 #include <vector> 00029 00030 #ifdef SCRIPT_SUPPORT 00031 #include "script.h" 00032 #endif 00033 00034 class Skill 00035 { 00036 /* 00037 * Skill identifier 00038 */ 00039 std::string id; 00040 00041 /* 00042 * Skill description 00043 */ 00044 std::string description; 00045 00046 /* 00047 * Children skills 00048 */ 00049 std::vector<Skill*> children; 00050 00051 /* 00052 * Skill properties/weighting (used when calculating player class) 00053 */ 00054 float light; 00055 float dark; 00056 float life; 00057 float death; 00058 00059 /* 00060 * Skill script 00061 */ 00062 #ifdef SCRIPT_SUPPORT 00063 Script *script; 00064 #endif 00065 00066 public: 00067 Skill(const std::string &ident); 00068 virtual ~Skill(); 00069 00070 /* 00071 * addSkill 00072 * Add skill to parent with id 00073 */ 00074 bool addSkill(const std::string &, Skill *); 00075 00076 /* 00077 * deleteSkill 00078 * Delete skill from tree with id 00079 */ 00080 bool deleteSkill(const std::string &, bool delTree = false); 00081 00082 /* 00083 * useSkill 00084 * Uses skill (runs skill script). Returns true upon successful 00085 * skill completion, false otherwise. 00086 */ 00087 bool useSkill(); 00088 00089 /* 00090 * setScript 00091 * Set script for the skill to execute when used. 00092 */ 00093 bool setScript(const std::string &); 00094 00095 /* 00096 * printTree 00097 * Print tree to stderr 00098 */ 00099 void printTree(const std::string &indent) { 00100 std::cerr << indent << id << std::endl; 00101 for (unsigned int i = 0; i < children.size(); i++) { 00102 children[i]->printTree(indent + " "); 00103 } 00104 } 00105 }; 00106 00107 #endif 00108
1.3.9.1