fix HP/TP results in $matcount

This commit is contained in:
Martin Michelsen
2023-11-07 21:39:28 -08:00
parent af43756899
commit aa577b4b63
3 changed files with 11 additions and 19 deletions
+8 -8
View File
@@ -58,8 +58,8 @@ void ClientGameData::create_battle_overlay(shared_ptr<const BattleRules> rules,
if (rules->replace_char) {
// TODO: Shouldn't we clear other material usage here? It looks like the
// original code doesn't, but that seems wrong.
this->overlay_player_data->inventory.hp_materials_used = 0;
this->overlay_player_data->inventory.tp_materials_used = 0;
this->overlay_player_data->inventory.hp_from_materials = 0;
this->overlay_player_data->inventory.tp_from_materials = 0;
uint32_t target_level = clamp<uint32_t>(rules->char_level, 0, 199);
uint8_t char_class = this->overlay_player_data->disp.visual.char_class;
@@ -442,9 +442,9 @@ void SavedPlayerDataBB::set_technique_level(uint8_t which, uint8_t level) {
uint8_t SavedPlayerDataBB::get_material_usage(MaterialType which) const {
switch (which) {
case MaterialType::HP:
return this->inventory.hp_materials_used;
return this->inventory.hp_from_materials >> 1;
case MaterialType::TP:
return this->inventory.tp_materials_used;
return this->inventory.tp_from_materials >> 1;
case MaterialType::POWER:
case MaterialType::MIND:
case MaterialType::EVADE:
@@ -459,10 +459,10 @@ uint8_t SavedPlayerDataBB::get_material_usage(MaterialType which) const {
void SavedPlayerDataBB::set_material_usage(MaterialType which, uint8_t usage) {
switch (which) {
case MaterialType::HP:
this->inventory.hp_materials_used = usage;
this->inventory.hp_from_materials = usage << 1;
break;
case MaterialType::TP:
this->inventory.tp_materials_used = usage;
this->inventory.tp_from_materials = usage << 1;
break;
case MaterialType::POWER:
case MaterialType::MIND:
@@ -477,8 +477,8 @@ void SavedPlayerDataBB::set_material_usage(MaterialType which, uint8_t usage) {
}
void SavedPlayerDataBB::clear_all_material_usage() {
this->inventory.hp_materials_used = 0;
this->inventory.tp_materials_used = 0;
this->inventory.hp_from_materials = 0;
this->inventory.tp_from_materials = 0;
for (size_t z = 0; z < 5; z++) {
this->inventory.items[z + 8].extension_data2 = 0;
}
-6
View File
@@ -385,12 +385,6 @@ PlayerRecordsBB_Challenge::operator PlayerRecordsV3_Challenge<false>() const {
return ret;
}
PlayerInventory::PlayerInventory()
: num_items(0),
hp_materials_used(0),
tp_materials_used(0),
language(0) {}
void PlayerBank::add_item(const ItemData& item) {
uint32_t pid = item.primary_identifier();
+3 -5
View File
@@ -64,14 +64,12 @@ struct PlayerBankItem {
struct PlayerInventory {
/* 0000 */ uint8_t num_items = 0;
/* 0001 */ uint8_t hp_materials_used = 0;
/* 0002 */ uint8_t tp_materials_used = 0;
/* 0003 */ uint8_t language = 1; // English
/* 0001 */ uint8_t hp_from_materials = 0;
/* 0002 */ uint8_t tp_from_materials = 0;
/* 0003 */ uint8_t language = 0;
/* 0004 */ parray<PlayerInventoryItem, 30> items;
/* 034C */
PlayerInventory();
size_t find_item(uint32_t item_id) const;
size_t find_item_by_primary_identifier(uint32_t primary_identifier) const;