Advertisement
Vultraz

Untitled

May 5th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.38 KB | None | 0 0
  1.  src/gui/dialogs/unit_attack.cpp | 32 ++++++++++++++++++++++++++------
  2.  1 file changed, 26 insertions(+), 6 deletions(-)
  3.  
  4. diff --git a/src/gui/dialogs/unit_attack.cpp b/src/gui/dialogs/unit_attack.cpp
  5. index 97be404273..34f92c757f 100644
  6. --- a/src/gui/dialogs/unit_attack.cpp
  7. +++ b/src/gui/dialogs/unit_attack.cpp
  8. @@ -121,7 +121,7 @@ void unit_attack::pre_show(window& window)
  9.         const attack_type& defender_weapon = defender.weapon ?
  10.             *defender.weapon : *no_weapon;
  11.  
  12. -       // Don't show if the atacker's weapon has at least one active "disable" special.
  13. +       // Don't show if the attacker's weapon has at least one active "disable" special.
  14.         if(attacker.disable) {
  15.             continue;
  16.         }
  17. @@ -137,17 +137,37 @@ void unit_attack::pre_show(window& window)
  18.             range = string_table["range_" + range];
  19.         }
  20.  
  21. -       const std::string& attw_apecials =
  22. -           !attacker_weapon.weapon_specials().empty() ? " " + attacker_weapon.weapon_specials() : "";
  23. -       const std::string& defw_specials =
  24. -           !defender_weapon.weapon_specials().empty() ? " " + defender_weapon.weapon_specials() : "";
  25. +       auto a_ctx = attacker_weapon.specials_context(
  26. +           attacker_itor_.get_shared_ptr(),
  27. +           defender_itor_.get_shared_ptr(),
  28. +           attacker_itor_->get_location(),
  29. +           defender_itor_->get_location(), true, defender.weapon
  30. +       );
  31. +
  32. +       auto d_ctx = defender_weapon.specials_context(
  33. +           defender_itor_.get_shared_ptr(),
  34. +           attacker_itor_.get_shared_ptr(),
  35. +           defender_itor_->get_location(),
  36. +           attacker_itor_->get_location(), false, attacker.weapon
  37. +       );
  38. +
  39. +       std::string attw_specials = attacker_weapon.weapon_specials(true, attacker.backstab_pos);
  40. +       std::string defw_specials = defender_weapon.weapon_specials(true);
  41. +
  42. +       if(!attw_specials.empty()) {
  43. +           attw_specials = " " + attw_specials;
  44. +       }
  45. +
  46. +       if(!defw_specials.empty()) {
  47. +           defw_specials = " " + defw_specials;
  48. +       }
  49.  
  50.         std::stringstream attacker_stats, defender_stats;
  51.  
  52.         // Use attacker/defender.num_blows instead of attacker/defender_weapon.num_attacks() because the latter does not consider the swarm weapon special
  53.         attacker_stats << "<b>" << attw_name << "</b>" << "\n"
  54.             << attacker.damage << font::weapon_numbers_sep << attacker.num_blows
  55. -           << attw_apecials << "\n"
  56. +           << attw_specials << "\n"
  57.             << font::span_color(a_cth_color) << attacker.chance_to_hit << "%</span>";
  58.  
  59.         defender_stats << "<b>" << defw_name << "</b>" << "\n"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement