fix HP/TP results in $matcount
This commit is contained in:
+8
-8
@@ -58,8 +58,8 @@ void ClientGameData::create_battle_overlay(shared_ptr<const BattleRules> rules,
|
|||||||
if (rules->replace_char) {
|
if (rules->replace_char) {
|
||||||
// TODO: Shouldn't we clear other material usage here? It looks like the
|
// TODO: Shouldn't we clear other material usage here? It looks like the
|
||||||
// original code doesn't, but that seems wrong.
|
// original code doesn't, but that seems wrong.
|
||||||
this->overlay_player_data->inventory.hp_materials_used = 0;
|
this->overlay_player_data->inventory.hp_from_materials = 0;
|
||||||
this->overlay_player_data->inventory.tp_materials_used = 0;
|
this->overlay_player_data->inventory.tp_from_materials = 0;
|
||||||
|
|
||||||
uint32_t target_level = clamp<uint32_t>(rules->char_level, 0, 199);
|
uint32_t target_level = clamp<uint32_t>(rules->char_level, 0, 199);
|
||||||
uint8_t char_class = this->overlay_player_data->disp.visual.char_class;
|
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 {
|
uint8_t SavedPlayerDataBB::get_material_usage(MaterialType which) const {
|
||||||
switch (which) {
|
switch (which) {
|
||||||
case MaterialType::HP:
|
case MaterialType::HP:
|
||||||
return this->inventory.hp_materials_used;
|
return this->inventory.hp_from_materials >> 1;
|
||||||
case MaterialType::TP:
|
case MaterialType::TP:
|
||||||
return this->inventory.tp_materials_used;
|
return this->inventory.tp_from_materials >> 1;
|
||||||
case MaterialType::POWER:
|
case MaterialType::POWER:
|
||||||
case MaterialType::MIND:
|
case MaterialType::MIND:
|
||||||
case MaterialType::EVADE:
|
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) {
|
void SavedPlayerDataBB::set_material_usage(MaterialType which, uint8_t usage) {
|
||||||
switch (which) {
|
switch (which) {
|
||||||
case MaterialType::HP:
|
case MaterialType::HP:
|
||||||
this->inventory.hp_materials_used = usage;
|
this->inventory.hp_from_materials = usage << 1;
|
||||||
break;
|
break;
|
||||||
case MaterialType::TP:
|
case MaterialType::TP:
|
||||||
this->inventory.tp_materials_used = usage;
|
this->inventory.tp_from_materials = usage << 1;
|
||||||
break;
|
break;
|
||||||
case MaterialType::POWER:
|
case MaterialType::POWER:
|
||||||
case MaterialType::MIND:
|
case MaterialType::MIND:
|
||||||
@@ -477,8 +477,8 @@ void SavedPlayerDataBB::set_material_usage(MaterialType which, uint8_t usage) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SavedPlayerDataBB::clear_all_material_usage() {
|
void SavedPlayerDataBB::clear_all_material_usage() {
|
||||||
this->inventory.hp_materials_used = 0;
|
this->inventory.hp_from_materials = 0;
|
||||||
this->inventory.tp_materials_used = 0;
|
this->inventory.tp_from_materials = 0;
|
||||||
for (size_t z = 0; z < 5; z++) {
|
for (size_t z = 0; z < 5; z++) {
|
||||||
this->inventory.items[z + 8].extension_data2 = 0;
|
this->inventory.items[z + 8].extension_data2 = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -385,12 +385,6 @@ PlayerRecordsBB_Challenge::operator PlayerRecordsV3_Challenge<false>() const {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerInventory::PlayerInventory()
|
|
||||||
: num_items(0),
|
|
||||||
hp_materials_used(0),
|
|
||||||
tp_materials_used(0),
|
|
||||||
language(0) {}
|
|
||||||
|
|
||||||
void PlayerBank::add_item(const ItemData& item) {
|
void PlayerBank::add_item(const ItemData& item) {
|
||||||
uint32_t pid = item.primary_identifier();
|
uint32_t pid = item.primary_identifier();
|
||||||
|
|
||||||
|
|||||||
@@ -64,14 +64,12 @@ struct PlayerBankItem {
|
|||||||
|
|
||||||
struct PlayerInventory {
|
struct PlayerInventory {
|
||||||
/* 0000 */ uint8_t num_items = 0;
|
/* 0000 */ uint8_t num_items = 0;
|
||||||
/* 0001 */ uint8_t hp_materials_used = 0;
|
/* 0001 */ uint8_t hp_from_materials = 0;
|
||||||
/* 0002 */ uint8_t tp_materials_used = 0;
|
/* 0002 */ uint8_t tp_from_materials = 0;
|
||||||
/* 0003 */ uint8_t language = 1; // English
|
/* 0003 */ uint8_t language = 0;
|
||||||
/* 0004 */ parray<PlayerInventoryItem, 30> items;
|
/* 0004 */ parray<PlayerInventoryItem, 30> items;
|
||||||
/* 034C */
|
/* 034C */
|
||||||
|
|
||||||
PlayerInventory();
|
|
||||||
|
|
||||||
size_t find_item(uint32_t item_id) const;
|
size_t find_item(uint32_t item_id) const;
|
||||||
size_t find_item_by_primary_identifier(uint32_t primary_identifier) const;
|
size_t find_item_by_primary_identifier(uint32_t primary_identifier) const;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user