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

Show the weapon tooltip in recruit/recall dialogs too (GNA #3698) #1036

Open
wesnoth-bugs opened this issue May 8, 2017 · 10 comments
Open
Labels
Enhancement Issues that are requests for new features or changes to existing ones. Low Priority Issues that will cause no meaningful problems if left unaddressed. UI User interface issues, including both back-end and front-end issues.

Comments

@wesnoth-bugs
Copy link

Original submission by anonymous on 2004-09-20

The information given in the weapon tooltip on the side panel, that shows how well your known enemies fare against a certain type of weapon, f ex touch -70% vs. Ghost, would come in handy when recruiting and recalling as well.

It would probably be best to keep it as a tooltip, not to clutter the recruit and recall dialogs unnecessarily.

(Reproduced on All)
Release: all
Priority: 3 - Low
Severity: 1 - Wish

@wesnoth-bugs
Copy link
Author

Modified on 2005-09-24

ott wrote:

See https://savannah.nongnu.org/bugs/index.php?func=detailitem&item_id=10454 for Savannah history.

ott set priority: 1 - Later

@wesnoth-bugs
Copy link
Author

Modified on 2007-08-29

esr changed status: None -> Wont Fix

esr wrote:

In 1.3.x. this information is one click away through the "Profile" button. Thus a tooltip would be rather superfluous. Marking this Wont Fix.

@wesnoth-bugs
Copy link
Author

Modified on 2007-08-29

anonymous wrote:

The profile key is also present in 1.2 and earlier. I however agree that tooltipping this would not be terribly useful, and it would be superfluous.

@wesnoth-bugs
Copy link
Author

Modified on 2007-09-13

soliton changed status: Wont Fix -> None

soliton wrote:

The requested information is not present in the unit's profile..

It would certainly make sense and be useful to have the same tooltips in the recruit/recalling preview pane as in the side panel. The way attacks are represented in either view should also be synchronized. Currently it differs for no apparent reason.

@wesnoth-bugs
Copy link
Author

Modified on 2007-09-19

hajo changed priority: 1 - Later -> 3 - Low

@CelticMinstrel CelticMinstrel changed the title Show the weapon tooltip in recruit/recall dialogs too Show the weapon tooltip in recruit/recall dialogs too (GNA #3698) May 8, 2017
@CelticMinstrel CelticMinstrel added Enhancement Issues that are requests for new features or changes to existing ones. UI User interface issues, including both back-end and front-end issues. labels May 8, 2017
@CelticMinstrel
Copy link
Member

@sigurdfdragon Are you sure this is superfluous? At least one person in the GNA discussion didn't think so.

@sigurdfdragon
Copy link
Contributor

sigurdfdragon commented May 11, 2017

hmmm... not sure

@Pentarctagon
Copy link
Member

@Vultraz What's your opinion on whether the tooltip should be there?

@Wedge009
Copy link
Member

Pinging @soliton- from Gna discussion.

It's funny that I never really noticed this feature, but I can confirm that the weapon information against known enemies is not readily available in the recall/recruit lists. Thus it's not superfluous - it'd be nice to have, but I also note that often at the recruit/recall stage one may not always know who the enemies will be, so perhaps its usefulness is limited. At any rate the current state of the recall/recruit lists surely are already much nicer and well detailed than when this was originally requested in 2004. Low priority perhaps?

@Wedge009
Copy link
Member

I think this needs to be factored out:

wesnoth/src/reports.cpp

Lines 866 to 902 in e235d9a

tooltip << _("Weapon range: ") << "<b>" << range << "</b>\n"
<< _("Damage type: ") << "<b>" << lang_type << "</b>\n"
<< _("Damage versus: ") << '\n';
// Show this weapon damage and resistance against all the different units.
// We want weak resistances (= good damage) first.
std::map<int, std::set<std::string>, std::greater<int>> resistances;
std::set<std::string> seen_types;
const team &unit_team = rc.dc().get_team(u.side());
const team &viewing_team = rc.teams()[rc.screen().viewing_team()];
for (const unit &enemy : rc.units())
{
if (enemy.incapacitated()) //we can't attack statues so don't display them in this tooltip
continue;
if (!unit_team.is_enemy(enemy.side()))
continue;
const map_location &loc = enemy.get_location();
const bool see_all = game_config::debug || rc.screen().show_everything();
if (!enemy.is_visible_to_team(viewing_team, see_all))
continue;
bool new_type = seen_types.insert(enemy.type_id()).second;
if (new_type) {
int resistance = enemy.resistance_against(at, false, loc);
resistances[resistance].insert(enemy.type_name());
}
}
for (const auto& resist : resistances) {
int damage_with_resistance = round_damage(specials_damage, damage_multiplier * resist.first, damage_divisor);
tooltip << "<b>" << damage_with_resistance << "</b> "
<< "<span color='" << attack_info_percent_color(resist.first-100).to_hex_string() << "'>"
<< "<i>(" << utils::signed_percent(resist.first-100) << ")</i>"
<< naps
<< " : \t" // spaces to align the tab to a multiple of 8
<< utils::join(resist.second, " " + font::unicode_bullet + " ") << '\n';
}
const string_with_tooltip damage_versus {flush(str), flush(tooltip)};

...so it can be re-used here (called by both unit recruit and recall dialogues):

const std::string range_png = std::string("icons/profiles/") + a.range() + "_attack.png~SCALE_INTO_SHARP(16,16)";
const std::string type_png = std::string("icons/profiles/") + a.type() + ".png~SCALE_INTO_SHARP(16,16)";
const bool range_png_exists = ::image::locator(range_png).file_exists();
const bool type_png_exists = ::image::locator(type_png).file_exists();
const t_string& range = string_table["range_" + a.range()];
const t_string& type = string_table["type_" + a.type()];
const std::string label = (formatter()
<< font::span_color(font::unit_type_color)
<< a.damage() << font::weapon_numbers_sep << a.num_attacks()
<< " " << a.name() << "</span>").str();
auto& subsection = header_node.add_child(
"item_image",
{
{ "image_range", { { "label", range_png } } },
{ "image_type", { { "label", type_png } } },
{ "name", { { "label", label }, { "use_markup", "true" } } },
}
);
find_widget<styled_widget>(&subsection, "image_range", true).set_tooltip(range);
find_widget<styled_widget>(&subsection, "image_type", true).set_tooltip(type);
if(!range_png_exists || !type_png_exists) {
add_name_tree_node(
subsection,
"item",
(formatter()
<< font::span_color(font::weapon_details_color)
<< range << font::weapon_details_sep
<< type << "</span>"
).str()
);
}

But I don't know if they are even compatible (eg GUI1 vs GUI2). I recall the unit preview pane is a much newer development compared with the unit details given in the side-bar (especially with the nice little icons for alignment, race, weapon range and attack type).

@soliton- soliton- added the Low Priority Issues that will cause no meaningful problems if left unaddressed. label Dec 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Issues that are requests for new features or changes to existing ones. Low Priority Issues that will cause no meaningful problems if left unaddressed. UI User interface issues, including both back-end and front-end issues.
Projects
None yet
Development

No branches or pull requests

6 participants