implement some BB quest commands

This commit is contained in:
Martin Michelsen
2023-10-19 15:34:06 -07:00
parent 4bc5f1b90f
commit 5a30272869
14 changed files with 307 additions and 97 deletions
+22
View File
@@ -8,6 +8,28 @@
using namespace std;
void PlayerStats::reset_to_base(uint8_t char_class, shared_ptr<const LevelTable> level_table) {
this->level = 0;
this->char_stats = level_table->base_stats_for_class(char_class);
}
void PlayerStats::advance_to_level(uint8_t char_class, uint32_t level, shared_ptr<const LevelTable> level_table) {
for (; this->level < level; this->level++) {
const auto& level_stats = level_table->stats_delta_for_level(char_class, this->level + 1);
// The original code clamps the resulting stat values to [0, max_stat]; we
// don't have max_stat handy so we just allow them to be unbounded
this->char_stats.atp += level_stats.atp;
this->char_stats.mst += level_stats.mst;
this->char_stats.evp += level_stats.evp;
this->char_stats.hp += level_stats.hp;
this->char_stats.dfp += level_stats.dfp;
this->char_stats.ata += level_stats.ata;
// Note: It is not a bug that lck is ignored here; the original code
// ignores it too.
this->experience = level_stats.experience;
}
}
LevelTable::LevelTable(shared_ptr<const string> data, bool compressed) {
if (compressed) {
this->data.reset(new string(prs_decompress(*data)));