JNR
rpgSheet_PlayableChar.h
1 /*
2 
3 Jump'n'Run Engine
4 http://www.atanaslaskov.com/jnr/
5 
6 BSD LICENSE
7 Copyright (c) 2007-2013, Atanas Laskov
8 All rights reserved.
9 
10 Redistribution and use in source and binary forms, with or without
11 modification, are permitted provided that the following conditions are met:
12 1. Redistributions of source code must retain the above copyright notice,
13 this list of conditions and the following disclaimer.
14 2. Redistributions in binary form must reproduce the above copyright notice,
15 this list of conditions and the following disclaimer in the documentation
16 and/or other materials provided with the distribution.
17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 DISCLAIMED. IN NO EVENT SHALL ATANAS LASKOV BE LIABLE FOR ANY
21 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 */
29 #ifndef M_PLAYER_SHEET_H
30 #define M_PLAYER_SHEET_H
31 
33 
34 
46 class rpgSheet_PlayableChar_Props : public rpgSheet_Fighter_Props
47 {
48 public:
49  M_SHEET_PROPS_COPY(rpgSheet_PlayableChar_Props);
50 
51  rpgSheet_PlayableChar_Props(void)
52  {
53  dSpeed = M_PLAYER_SPEED;
54  dJPower = M_PLAYER_JUMP;
55  dSPower = M_PLAYER_SOMERSAULT;
56 
57  nLevel = 1;
58  nXP = 0;
59  nXP_Next = M_XP_LVL2;
60 
61  nTrainingPoints = 3; //todo: set to 0;
62  }
63 
64  // Experience
65  //
66  unsigned nLevel; // character level
67  unsigned nXP; // current xp
68  unsigned nXP_Next; // total xp needed for advancing to the next level
69  unsigned nTrainingPoints; // pt to spend on skills
70 
71  // Item inventory
72  //
73  rpgInventory items;
74 
75  // Active potions
76  //
77  // NOTE: This is not saved/loaded in the savegame ;
78  // Principally it shoud be in the rpgSheet_PlayableChar_Mods
79  // but that would cause recursion issues.
80  //
81  rpgInventory potions;
82 
83  // Skills list
84  //
85  // NOTE: This list contains all skills registered in the TS;
86  // Some of them are not learnt by the player and therefore should not be applied
87  // but only used for the skills upgrade interface
88  //
89  rpgSkillsInventory skills;
90 
91  // Load from TS
92  virtual void load(class laPropertyList* pElement);
93 
98  virtual void load(class laFileParser *fp);
99  void save(FILE* f);
100 
101  //_extract_skills();
102 };
103 
104 // Player sheet
105 //
106 M_SHEET_BEGIN(rpgSheet_PlayableChar, rpgSheet_Fighter);
107 
108  virtual rpgAttack modAttack( unsigned n );
109  virtual double modDP(unsigned nElement);
110 
111  void collect( unsigned nXP );
112 
113 protected:
114  unsigned _XP_for_next_level();
115  void _level_up();
116 
117 M_SHEET_END;
119 #endif
Player RPG Properties.
Attack RPG Properties.
Definition: rpgAttack.h:55
File Parser.
Definition: laFileParser.h:41