Labyrinth
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
power.hpp
1 //////////////////////////////
2 //
3 // File: swrs/power.hpp
4 // Author: Maciej Kaminski
5 // E-mail: maciej.a.kaminski@gmail.com
6 // Website: maciejkaminski.pl
7 //
8 // File creation date: Feb 24 2013
9 // This file is part of Project Labyrinth
10 // This file is going to be released under terms of GNU GPL in near future
11 //
12 //////////////////////////////
13 
14 #ifndef __SW_POWER_H_
15 #define __SW_POWER_H_
16 #include <string>
17 #include "swrs/option.hpp"
18 namespace SWRS
19 {
20  //! record for magical power available in game
22  {
23  public:
24  //! name
25  std::string name;
26  //! fluff
27  std::string flavor_text;
28  //! edge required to use this power
29  std::string required_edge;
30  //! is attribute linked to this power
31  std::string linked_attribute_name;//for attributes it's undefined;
32  //! id of attribute related
34  };
35  //! Magical powers; characters may have some of them
36  class Power: public IOption
37  {
38  friend class Skill;
39  friend class PowerMap;
40  protected:
41  //! protected constructor for generating power type objects in rules system
42  Power(const PowerRecord * tr) ;
43  //! customized name
44  std::string custom_name;
45  //! proper data on power
47  //! set alternative name
48  void SetCustomName(std::string s) {custom_name.assign(s);}
49 
50  public:
51  //! set flavor test
52  const std::string & GetFlavorText() const
53  {
54  return power_record->flavor_text;
55  }
56  //! return default name
57  const std::string & GetBaseName()const
58  {
59  return power_record->name;
60  }
61  //! return custom name (if exists) or empty text (if no custom name exists)
62  const std::string & GetCustomName()const
63  {
64  return custom_name;
65  }
66  //! a copy constructor
67  Power(const Power & cSource)
68  {
69  custom_name=cSource.custom_name;
70  power_record=cSource.power_record;
71  }
72  //! return power name (or custom name)
73  const std::string & GetName()const
74  {
75  if (custom_name.empty())
76  return power_record->name;
77  else
78  return custom_name;
79  }
80  };
81 }
82 #endif