Skip to content

Commit

Permalink
MenuCharacter: Add Speed and Attack Speed to stat list
Browse files Browse the repository at this point in the history
Closes #1883
  • Loading branch information
dorkster committed Dec 28, 2024
1 parent 130ccb7 commit 9539afe
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
1 change: 1 addition & 0 deletions RELEASE_NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
25 changes: 24 additions & 1 deletion src/MenuCharacter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion src/Version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ FLARE. If not, see http://www.gnu.org/licenses/

#include <SDL.h>

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);

Expand Down

0 comments on commit 9539afe

Please sign in to comment.