Include local factors in the tooltip showing damage vs. unit types.

Fixes bug #19533
This commit is contained in:
J. Tyne 2012-08-23 20:58:01 +00:00
parent b0e4f12b57
commit f409590dd5
3 changed files with 4 additions and 8 deletions

View file

@ -230,6 +230,7 @@ Version 1.11.0-svn:
for shrouded or (visibly) occupied hexes.
* Fixed bug #19844: Block recruiting into shrouded hexes.
* Fixed bug #19783: Disable commands while WML menu items are executing.
* Fixed bug #19533: Both damage tooltips now take into account local factors.
* Whiteboard:
* Fixed bug #19626: segfaults on window resize
* Fixed bug #19369: Using planning mode can cause losing ability to move my units

View file

@ -133,6 +133,7 @@ Version 1.11.0-svn:
for shrouded or (visibly) occupied hexes.
* Fixed bug #19844: Block recruiting into shrouded hexes.
* Fixed bug #19783: Disable commands while WML menu items are executing.
* Fixed bug #19533: Both damage tooltips now take into account local factors.
* Whiteboard:
* Fixed bug #19369: Using planning mode can cause losing ability to move my

View file

@ -567,11 +567,10 @@ static int attack_info(const attack_type &at, config &res, unit *u, const map_lo
if (under_leadership(*resources::units, displayed_unit_hex, &leader_bonus).valid())
damage_multiplier += leader_bonus;
// Assume no specific resistance.
damage_multiplier *= 100;
bool slowed = u->get_state(unit::STATE_SLOWED);
int damage_divisor = slowed ? 20000 : 10000;
int damage = round_damage(base_damage, damage_multiplier, damage_divisor);
// Assume no specific resistance (i.e. multiply by 100).
int damage = round_damage(base_damage, damage_multiplier * 100, damage_divisor);
int base_nattacks = at.num_attacks();
int nattacks = base_nattacks;
@ -654,11 +653,6 @@ static int attack_info(const attack_type &at, config &res, unit *u, const map_lo
}
}
// Get global ToD.
damage_multiplier = 100;
tod_bonus = combat_modifier(map_location::null_location, u->alignment(), u->is_fearless());
damage_multiplier += tod_bonus;
typedef std::pair<int, std::set<std::string> > resist_units;
BOOST_FOREACH(const resist_units &resist, resistances) {
int damage = round_damage(base_damage, damage_multiplier * resist.first, damage_divisor);