liblcf
rpg_setup.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of liblcf. Copyright (c) 2021 liblcf authors.
3  * https://github.com/EasyRPG/liblcf - https://easyrpg.org
4  *
5  * liblcf is Free/Libre Open Source Software, released under the MIT License.
6  * For the full copyright and license information, please view the COPYING
7  * file that was distributed with this source code.
8  */
9 
10 #include "lcf/config.h"
11 #include "lcf/rpg/actor.h"
12 #include "lcf/rpg/event.h"
13 #include "lcf/rpg/map.h"
14 #include "lcf/rpg/mapinfo.h"
15 #include "lcf/rpg/system.h"
16 #include "lcf/rpg/save.h"
17 #include "lcf/rpg/chipset.h"
18 #include "lcf/rpg/parameters.h"
19 
20 namespace lcf {
21 
22 void rpg::Actor::Setup(bool is2k3) {
23  int max_final_level = 0;
24  if (is2k3) {
25  max_final_level = 99;
26  if (final_level == -1) {
27  final_level = max_final_level;
28  }
29  exp_base = exp_base == -1 ? 300 : exp_base;
30  exp_inflation = exp_inflation == -1 ? 300 : exp_inflation;
31  }
32  else {
33  max_final_level = 50;
34  if (final_level == -1) {
35  final_level = max_final_level;
36  }
37  exp_base = exp_base == -1 ? 30 : exp_base;
38  exp_inflation = exp_inflation == -1 ? 30 : exp_inflation;
39  }
40  parameters.Setup(max_final_level);
41 }
42 
43 void rpg::Parameters::Setup(int final_level) {
44  size_t level = 0;
45  if (final_level > 0) level = final_level;
46  if (maxhp.size() < level) maxhp.resize(level, 1);
47  if (maxsp.size() < level) maxsp.resize(level, 0);
48  if (attack.size() < level) attack.resize(level, 1);
49  if (defense.size() < level) defense.resize(level, 1);
50  if (spirit.size() < level) spirit.resize(level, 1);
51  if (agility.size() < level) agility.resize(level, 1);
52 }
53 
54 } // namespace lcf
Definition: dbarray.cpp:13