Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recruit list shows experience in blue #4736

Closed
IskarJarak opened this issue Feb 8, 2020 · 5 comments · Fixed by #4740
Closed

Recruit list shows experience in blue #4736

IskarJarak opened this issue Feb 8, 2020 · 5 comments · Fixed by #4740
Labels
Bug Issues involving unexpected behavior. Confirmed Issues that have been successfully reproduced by at least one developer. Ready for testing Issues for which a potential fix is available but untested. UI User interface issues, including both back-end and front-end issues.

Comments

@IskarJarak
Copy link
Contributor

Game and System Information

  • 1.15.2
  • website download
  • Windows 10

Describe the bug

Unit that cannot further advance (e.g., Gryphon Master, Lancer, etc.) show experience bar in blue in the recruit menu.

To Reproduce

Found in NR, tested for various factions in arbitrary Era of Heroes maps. So far as I can tell the issue is global.

Expected behavior

Exp bar should be violet to show that now further advancements are possible. (Same as in recall, etc.)

Screenshots

bugreport_exp_bar

@github-actions
Copy link

github-actions bot commented Feb 8, 2020

Hi! Thanks for helping make Wesnoth even better!

@Pentarctagon Pentarctagon added Bug Issues involving unexpected behavior. UI User interface issues, including both back-end and front-end issues. labels Feb 9, 2020
@Wedge009
Copy link
Member

I can't recall any particular scenario where you are permitted to recruit such advanced units straight away - can you give some examples for testing?

@IskarJarak
Copy link
Contributor Author

Hey, for testing I'd advise to start a multiplayer game with Era of Heroes (Multiplayer -> local game -> choose Era of Heroes on the right side, select any map, start the match), then you can recruit all level 2 units of your faction (e.g., Loyalists have Lancer and Javelineer which can't advance).
Otherwise, I met the problem in Northern Rebirth - I think you can only recruit non-advanceable level 2 units (Gryphons) in the last one or two scenarios though (depending on branch).

@Wedge009
Copy link
Member

My guess is that since this situation of having fully-advanced units available for recruiting is so rare, it's easy to see how this one got missed. It could also be a deliberate decision, though I don't see a reason for it to be.

Anyway, confirmed on master and 1.14, with the penultimate scenario for Northern Rebirth, 'Get the Gold'.

@Wedge009 Wedge009 added the Confirmed Issues that have been successfully reproduced by at least one developer. label Feb 11, 2020
@Wedge009
Copy link
Member

If I've found the right place I think the issue is here:

{ "hp",{
{ "label", (formatter() << "<small>" << "<span color='#21e100'>" << "<b>" << _("HP: ") << "</b>" << type.hitpoints() << "</span>" << " | </small>").str() },
{ "use_markup", "true" },
{ "tooltip", get_hp_tooltip(type.movement_type().get_resistances().damage_table(), [&type](const std::string& dt, bool is_attacker) { return type.resistance_against(dt, is_attacker); }) }
} },
{ "xp",{
{ "label", (formatter() << "<small>" << "<span color='#00a0e1'>" << "<b>" << _("XP: ") << "</b>" << type.experience_needed() << "</span>" << " | </small>").str() },
{ "use_markup", "true" },
{ "tooltip", (formatter() << _("Experience Modifier: ") << unit_experience_accelerator::get_acceleration() << '%').str() }
} },
{ "mp",{
{ "label", (formatter() << "<small>" << "<b>" << _("MP: ") << "</b>" << type.movement() << "</small>").str() },
{ "use_markup", "true" },
{ "tooltip", get_mp_tooltip(type.movement(), [&type](t_translation::terrain_code terrain) { return type.movement_type().movement_cost(terrain); }) }
} },

The problem is that in this particular spot we're looking at generic unit types, not a specific unit. Otherwise we can use unit::xp_color() as we do in most other places:

{ "hp",{
{ "label", (formatter() << "<small>" << font::span_color(u.hp_color()) << "<b>" << _("HP: ") << "</b>" << u.hitpoints() << "/" << u.max_hitpoints() << "</span>" << " | </small>").str() },
{ "use_markup", "true" },
{ "tooltip", get_hp_tooltip(u.get_base_resistances(), [&u](const std::string& dt, bool is_attacker) { return u.resistance_against(dt, is_attacker, u.get_location()); }) }
} },
{ "xp",{
{ "label", (formatter() << "<small>" << font::span_color(u.xp_color()) << "<b>" << _("XP: ") << "</b>" << unit_xp << "</span>" << " | </small>").str() },
{ "use_markup", "true" },
{ "tooltip", (formatter() << _("Experience Modifier: ") << unit_experience_accelerator::get_acceleration() << '%').str() }
} },
{ "mp",{
{ "label", (formatter() << "<small>" << "<b>" << _("MP: ") << "</b>" << u.movement_left() << "/" << u.total_movement() << "</small>").str() },
{ "use_markup", "true" },
{ "tooltip", get_mp_tooltip(u.total_movement(), [&u](t_translation::terrain_code terrain) { return u.movement_cost(terrain); }) }
} },

Since the colours are hard-coded at the moment (not a great situation to begin with), the unit type display would need to know if a given unit type is the max level for that line of units and then change the colour of the display accordingly. Is there a method to determine if a given unit type is the last in its line?

Wedge009 added a commit to Wedge009/wesnoth that referenced this issue Feb 12, 2020
@Wedge009 Wedge009 added the Ready for testing Issues for which a potential fix is available but untested. label Feb 12, 2020
Wedge009 added a commit to Wedge009/wesnoth that referenced this issue Feb 13, 2020
* Note this will retain the problem of hard-coded colour values in the unit type display.
Wedge009 added a commit that referenced this issue Feb 17, 2020
* Remove hard-coded colouring for HP as well as XP.

Co-authored-by: gfgtdf <daniel.gfgtdf@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Issues involving unexpected behavior. Confirmed Issues that have been successfully reproduced by at least one developer. Ready for testing Issues for which a potential fix is available but untested. UI User interface issues, including both back-end and front-end issues.
Projects
None yet
3 participants