From 9539afe02187b357f13f42c85a82ce4f1a986128 Mon Sep 17 00:00:00 2001 From: Justin Jacobs Date: Fri, 27 Dec 2024 19:32:22 -0500 Subject: [PATCH] MenuCharacter: Add Speed and Attack Speed to stat list Closes #1883 --- RELEASE_NOTES.txt | 1 + src/MenuCharacter.cpp | 25 ++++++++++++++++++++++++- src/Version.cpp | 2 +- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt index ec4f7dc69..af940d261 100644 --- a/RELEASE_NOTES.txt +++ b/RELEASE_NOTES.txt @@ -19,6 +19,7 @@ Engine features: * Added 'font' property to engine/combat_text.txt config. * New mouse movment behavior. Click once to move the player to a target and, if applicable, interact with it. * Stats on the character page are now organized by categories: Core, Offense, Defense, and Misc. +* Speed and Attack Speed are now able to be shown in the Character menu. * Android: Enabled use of external input devices (gamepads, keyboards, mice) Engine fixes: diff --git a/src/MenuCharacter.cpp b/src/MenuCharacter.cpp index 9952b83ad..2cda6040c 100644 --- a/src/MenuCharacter.cpp +++ b/src/MenuCharacter.cpp @@ -81,7 +81,7 @@ MenuCharacter::MenuCharacter() cstat[i+2].label->setText(eset->primary_stats.list[i].name); } - show_stat.resize(Stats::COUNT + eset->damage_types.count + eset->elements.list.size() + eset->resource_stats.stat_count); + show_stat.resize(Stats::COUNT + eset->damage_types.count + eset->elements.list.size() + eset->resource_stats.stat_count + 2); for (size_t i = 0; i < show_stat.size(); i++) { if (i >= Stats::RESIST_DAMAGE_OVER_TIME && i < Stats::COUNT) { // some stats are hidden by default @@ -303,6 +303,7 @@ void MenuCharacter::refreshStats() { // scrolling stat list unsigned stat_index = 0; size_t resource_offset_index = Stats::COUNT + eset->damage_types.count + eset->elements.list.size(); + size_t speed_offset_index = resource_offset_index + eset->resource_stats.stat_count; ss.str(""); ss << msg->get("Core Stats"); @@ -448,6 +449,20 @@ void MenuCharacter::refreshStats() { stat_index++; } + if (show_stat[speed_offset_index]) { + ss.str(""); + ss << " " << msg->get("Movement Speed") << ": " << pc->stats.effects.speed << "%"; + statList->set(stat_index, ss.str(), ""); + stat_index++; + } + + if (show_stat[speed_offset_index + 1]) { + ss.str(""); + ss << " " << msg->get("Attack Speed") << ": " << pc->stats.effects.getAttackSpeed("") << "%"; + statList->set(stat_index, ss.str(), ""); + stat_index++; + } + // update tool tips cstat[CSTAT_NAME].tip.clear(); cstat[CSTAT_NAME].tip.addText(pc->stats.name); @@ -875,6 +890,14 @@ void MenuCharacter::parseShowStat(FileParser& infile) { } } } + offset_index += eset->resource_stats.stat_count; + + if (stat_name == "speed") { + show_stat[offset_index] = value; + } + else if (stat_name == "attack_speed") { + show_stat[offset_index + 1] = value; + } } MenuCharacter::~MenuCharacter() { diff --git a/src/Version.cpp b/src/Version.cpp index 4e9da3afa..dca293749 100644 --- a/src/Version.cpp +++ b/src/Version.cpp @@ -30,7 +30,7 @@ FLARE. If not, see http://www.gnu.org/licenses/ #include -Version VersionInfo::ENGINE(1, 14, 79); +Version VersionInfo::ENGINE(1, 14, 80); Version VersionInfo::MIN(0, 0, 0); Version VersionInfo::MAX(USHRT_MAX, USHRT_MAX, USHRT_MAX);