37 #include <boost/shared_ptr.hpp>
46 element[
"text"] = text;
47 if (!tooltip.empty()) element[
"tooltip"] = tooltip;
48 if (!
help.empty()) element[
"help"] =
help;
55 element[
"image"] =
image;
56 if (!tooltip.empty()) element[
"tooltip"] = tooltip;
57 if (!
help.empty()) element[
"help"] =
help;
79 char const *
path,
char const *desc1,
char const *desc2)
104 #define REPORT_GENERATOR(n, cn) \
105 static config report_##n(reports::context & cn); \
106 static report_generator_helper reg_gen_##n(#n, &report_##n); \
107 static config report_##n(reports::context & cn)
109 static char const *
naps =
"</span>";
144 std::ostringstream str, tooltip;
145 str <<
"<b>" << name <<
"</b>";
146 tooltip <<
_(
"Name: ") <<
"<b>" << name <<
"</b>";
165 std::ostringstream str, tooltip;
167 tooltip <<
_(
"Type: ") <<
"<b>" << u->
type_name() <<
"</b>\n"
169 return text_report(str.str(), tooltip.str(), has_variations_prefix +
"unit_" + u->
type_id());
185 std::ostringstream str, tooltip;
187 tooltip <<
_(
"Race: ") <<
"<b>" << u->
race()->
name(u->
gender()) <<
"</b>";
210 std::string mods =
"~RC(" + old_rgb +
">" + new_rgb +
")";
211 if (flag_icon.empty())
214 std::stringstream text;
215 text <<
" " << u->
side();
218 add_text(report, text.str(),
"",
"");
235 std::ostringstream str, tooltip;
237 tooltip <<
_(
"Level: ") <<
"<b>" << u->
level() <<
"</b>\n";
240 tooltip <<
_(
"No advancement");
242 tooltip <<
_(
"Advances to:") <<
"\n<b>\t"
262 typedef std::pair<std::string, std::string> pair_string;
263 for (
const pair_string &ps : u->
amla_icons()) {
273 const std::vector<t_string> &traits = u->
trait_names();
276 unsigned nb = traits.size();
277 for (
unsigned i = 0;
i < nb; ++
i)
279 std::ostringstream str, tooltip;
281 if (
i != nb - 1 ) str <<
", ";
282 tooltip <<
_(
"Trait: ") <<
"<b>" << traits[
i] <<
"</b>\n"
284 add_text(res, str.str(), tooltip.str(),
"traits_" + trait_ids[
i]);
305 add_status(res,
"misc/invisible.png",
N_(
"invisible: "),
306 N_(
"This unit is invisible. It cannot be seen or attacked by enemy units."));
310 N_(
"This unit has been slowed. It will only deal half its normal damage when attacking and its movement cost is doubled."));
314 N_(
"This unit is poisoned. It will lose 8 HP every turn until it can seek a cure to the poison in a village or from a friendly unit with the ‘cures’ ability.\n\nUnits cannot be killed by poison alone. The poison will not reduce it below 1 HP."));
317 add_status(res,
"misc/petrified.png",
N_(
"petrified: "),
318 N_(
"This unit has been petrified. It may not move or attack."));
336 std::ostringstream str, tooltip;
349 tooltip <<
_(
"Alignment: ") <<
"<b>" << align <<
"</b>\n"
352 return text_report(str.str(), tooltip.str(),
"time_of_day");
371 std::vector<bool> active;
372 const std::vector<boost::tuple<t_string,t_string,t_string> > &abilities = u->
ability_tooltips(&active);
373 const size_t abilities_size = abilities.size();
374 for (
size_t i = 0;
i != abilities_size; ++
i )
378 const t_string &display_name = abilities[
i].get<1>();
379 const t_string &description = abilities[
i].get<2>();
381 std::ostringstream str, tooltip;
387 if ( i + 1 != abilities_size )
390 tooltip <<
_(
"Ability: ") <<
"<b>" << display_name <<
"</b>";
392 tooltip <<
"<i>" <<
_(
" (inactive)") <<
"</i>";
393 tooltip <<
'\n' << description;
414 std::ostringstream str, tooltip;
418 std::set<std::string> resistances_table;
420 bool att_def_diff =
false;
424 std::ostringstream line;
430 if (res_att == res_def) {
441 resistances_table.insert(line.str());
444 tooltip <<
_(
"Resistances: ");
446 tooltip <<
_(
"(Att / Def)");
448 for (
const std::string &line : resistances_table) {
467 std::ostringstream str, tooltip;
472 tooltip <<
_(
"Experience Modifier: ") << exp_mod <<
'%';
490 typedef std::pair<std::string, std::string> pair_string;
513 std::ostringstream str, tooltip;
526 if (underlyings.size() != 1 || underlyings.front() !=
terrain)
540 << (revert ?
_(
"maximum^max.") :
_(
"minimum^min.")) <<
'\n';
545 tooltip <<
"<b>" <<
_(
"Defense: ") <<
span_color(color) << def <<
'%' << naps <<
"</b>";
551 const map_location& displayed_unit_hex = rc.screen().displayed_unit_hex();
557 const map_location& selected_hex = rc.screen().selected_hex();
566 std::ostringstream str;
568 str <<
_(
"vision: ") << u->
vision(); }
585 std::ostringstream str, tooltip;
586 double movement_frac = 1.0;
589 if (movement_frac > 1.0)
593 std::set<t_translation::t_terrain>::const_iterator terrain_it =
596 tooltip <<
_(
"Movement Costs:") <<
"\n";
610 tooltip << name <<
": ";
621 tooltip <<
"<span foreground=\"" << color <<
"\">";
629 tooltip <<
naps <<
'\n';
633 int grey = 128 +
int((255 - 128) * movement_frac);
651 std::ostringstream str, tooltip;
654 int base_damage = at.
damage();
656 int damage_multiplier = 100;
658 damage_multiplier += tod_bonus;
659 int leader_bonus = 0;
661 damage_multiplier += leader_bonus;
664 int damage_divisor = slowed ? 20000 : 10000;
666 int damage =
round_damage(specials_damage, damage_multiplier * 100, damage_divisor);
670 unsigned cur_hp = std::min<unsigned>(std::max(0, u.
hitpoints()), max_hp);
673 unsigned min_attacks, max_attacks;
675 unsigned num_attacks =
swarm_blows(min_attacks, max_attacks, cur_hp, max_hp);
678 if ( damage > specials_damage )
680 else if ( damage < specials_damage )
686 tooltip <<
_(
"Weapon: ") <<
"<b>" << at.
name() <<
"</b>\n"
687 <<
_(
"Damage: ") <<
"<b>" << damage <<
"</b>\n";
689 if ( tod_bonus || leader_bonus || slowed || specials_damage != base_damage )
691 tooltip <<
'\t' <<
_(
"Base damage: ") << base_damage <<
'\n';
692 if ( specials_damage != base_damage ) {
693 tooltip <<
'\t' <<
_(
"With specials: ") << specials_damage <<
'\n';
696 tooltip <<
'\t' <<
_(
"Time of day: ")
700 tooltip <<
'\t' <<
_(
"Leadership: ")
704 tooltip <<
'\t' <<
_(
"Slowed: ") <<
"/ 2" <<
'\n';
708 tooltip <<
_(
"Attacks: ") <<
"<b>" << num_attacks <<
"</b>\n";
709 if ( max_attacks != min_attacks && cur_hp != max_hp ) {
710 if ( max_attacks < min_attacks ) {
712 tooltip <<
'\t' <<
_(
"Max swarm bonus: ") << (min_attacks-max_attacks) <<
'\n';
713 tooltip <<
'\t' <<
_(
"Swarm: ") <<
"* "<< (100 - cur_hp*100/max_hp) <<
"%\n";
714 tooltip <<
'\t' <<
_(
"Base attacks: ") <<
'+' << base_attacks <<
'\n';
718 if ( max_attacks != base_attacks ) {
719 int attack_diff =
int(max_attacks) -
int(base_attacks);
725 tooltip <<
'\t' <<
_(
"Base attacks: ") << base_attacks <<
'\n';
726 if ( max_attacks != base_attacks ) {
727 tooltip <<
'\t' <<
_(
"With specials: ") << max_attacks <<
'\n';
729 if ( min_attacks != 0 ) {
730 tooltip <<
'\t' <<
_(
"Subject to swarm: ") << (max_attacks-min_attacks) <<
'\n';
732 tooltip <<
'\t' <<
_(
"Swarm: ") <<
"* "<< (cur_hp*100/max_hp) <<
"%\n";
735 else if ( num_attacks != base_attacks ) {
736 tooltip <<
'\t' <<
_(
"Base attacks: ") << base_attacks <<
'\n';
737 tooltip <<
'\t' <<
_(
"With specials: ") << num_attacks <<
'\n';
747 << lang_type <<
"</span>\n";
749 tooltip <<
_(
"Weapon range: ") <<
"<b>" << range <<
"</b>\n"
750 <<
_(
"Damage type: ") <<
"<b>" << lang_type <<
"</b>\n"
751 <<
_(
"Damage versus: ") <<
'\n';
755 std::map<int, std::set<std::string>, std::greater<int> > resistances;
756 std::set<std::string> seen_types;
761 if (enemy.incapacitated())
763 if (!unit_team.
is_enemy(enemy.side()))
766 if (viewing_team.
fogged(loc) ||
767 (viewing_team.
is_enemy(enemy.side()) && enemy.invisible(loc)))
769 bool new_type = seen_types.insert(enemy.type_id()).second;
771 int resistance = enemy.resistance_against(at,
false, loc);
772 resistances[resistance].insert(enemy.type_name());
776 typedef std::pair<int, std::set<std::string> > resist_units;
777 for (
const resist_units &resist : resistances) {
778 int damage =
round_damage(specials_damage, damage_multiplier * resist.first, damage_divisor);
779 tooltip <<
"<b>" << damage <<
"</b> "
786 if (!accuracy_parry.empty())
789 <<
" " << accuracy_parry <<
"</span>\n";
792 tooltip <<
_(
"Accuracy:") <<
"<b>"
795 int parry = at.
parry();
797 tooltip <<
_(
"Parry:") <<
"<b>"
804 std::vector<bool> active;
805 const std::vector<std::pair<t_string, t_string> > &specials = at.
special_tooltips(&active);
806 const size_t specials_size = specials.size();
807 for (
size_t i = 0;
i != specials_size; ++
i )
811 const t_string &description = specials[
i].second;
815 str <<
span_color(details_color) <<
" " <<
" " << name <<
naps <<
'\n';
817 tooltip <<
_(
"Weapon special: ") <<
"<b>" << name <<
"</b>";
819 tooltip <<
"<i>" <<
_(
" (inactive)") <<
"</i>";
820 tooltip <<
'\n' << description;
832 snprintf(str_buf, 10,
"100 %%");
833 }
else if(prob >= 0.1) {
834 snprintf(str_buf, 10,
"%4.1f %%", 100.0 * prob);
836 snprintf(str_buf, 10,
" %3.1f %%", 100.0 * prob);
845 snprintf(str_buf, 10,
" %i", hp);
847 snprintf(str_buf, 10,
" %i", hp);
849 snprintf(str_buf, 10,
" %i", hp);
857 if (!attacker || !defender)
return config();
859 const unit* u = show_attacker ? attacker : defender;
862 std::ostringstream str, tooltip;
865 std::vector<battle_context> weapons;
866 for (
unsigned int i = 0;
i < attacker->
attacks().size();
i++) {
868 if (attacker->
attacks()[
i].attack_weight() > 0) {
870 weapons.push_back(
weapon);
879 attacker_combatant.
fight(defender_combatant);
882 show_attacker ?
weapon.get_attacker_stats() :
weapon.get_defender_stats();
884 int total_damage = 0;
887 int chance_to_hit = 0;
891 if (context_unit_stats.
weapon) {
893 total_damage = context_unit_stats.
damage;
894 num_blows = context_unit_stats.
num_blows;
896 weapon_name = context_unit_stats.
weapon->
name();
898 if ( total_damage > base_damage )
900 else if ( total_damage < base_damage )
904 tooltip <<
_(
"Weapon: ") <<
"<b>" << weapon_name <<
"</b>\n"
905 <<
_(
"Damage: ") <<
"<b>" <<
"0" <<
"</b>\n";
913 <<
" (" <<
span_color(chance_color) << chance_to_hit <<
"%" <<
naps <<
")"
916 tooltip <<
_(
"Weapon: ") <<
"<b>" << weapon_name <<
"</b>\n"
917 <<
_(
"Total damage") <<
"<b>" << total_damage <<
"</b>\n";
920 std::vector<std::pair<int, double> > hp_prob_vector;
923 std::vector<std::pair<double, int> > prob_hp_vector;
926 combatant*
c = show_attacker ? &attacker_combatant : &defender_combatant;
928 for(i = 0; i < static_cast<int>(c->
hp_dist.size()); i++) {
933 prob_hp_vector.push_back(std::pair<double, int>(prob, i));
936 std::sort(prob_hp_vector.begin(), prob_hp_vector.end());
939 int max_hp_distrib_rows_ = 10;
942 int nb_elem = std::min<int>(max_hp_distrib_rows_, prob_hp_vector.size());
944 for(i = prob_hp_vector.size() - nb_elem;
945 i < static_cast<int>(prob_hp_vector.size()); i++) {
947 hp_prob_vector.push_back(std::pair<int, double>
948 (prob_hp_vector[i].second, prob_hp_vector[i].
first));
952 std::sort(hp_prob_vector.begin(), hp_prob_vector.end());
954 std::reverse(hp_prob_vector.begin(), hp_prob_vector.end());
957 i < static_cast<int>(hp_prob_vector.size()); i++) {
959 int hp = hp_prob_vector[
i].first;
960 double prob = hp_prob_vector[
i].second;
1013 if (!sec_u || u == sec_u)
return unit_weapons(rc, sec_u);
1015 map_location highlighted_hex = rc.screen().displayed_unit_hex();
1018 attack_loc = rc.mhb()->current_unit_attacks_from(highlighted_hex);
1020 if (!attack_loc.
valid())
1033 map_location highlighted_hex = rc.screen().displayed_unit_hex();
1036 attack_loc = rc.mhb()->current_unit_attacks_from(highlighted_hex);
1038 if (!attack_loc.
valid())
1072 std::ostringstream tooltip;
1073 std::ostringstream text;
1075 const map_location& selected_hex = rc.screen().selected_hex();
1076 const map_location& mouseover_hex = rc.screen().mouseover_hex();
1080 const std::vector<time_of_day>& schedule = rc.tod().times(hex);
1082 int current = rc.tod().get_current_time(hex);
1085 if (i == current) tooltip <<
"<big><b>";
1086 tooltip << tod.name <<
"\n";
1087 if (i == current) tooltip <<
"</b></big>";
1091 int times = schedule.size();
1092 text << current + 1 <<
"/" << times;
1094 return text_report(text.str(), tooltip.str(),
"..schedule");
1099 std::ostringstream tooltip;
1102 if (viewing_team.
shrouded(mouseover_hex)) {
1105 }
else if (viewing_team.
fogged(mouseover_hex)) {
1119 lawful_color = (b > 0) ?
"green" :
"red";
1120 chaotic_color = (b < 0) ?
"green" :
"red";
1121 liminal_color =
"red";
1123 tooltip << tod.
name <<
'\n'
1124 <<
_(
"Lawful units: ") <<
"<span foreground=\"" << lawful_color <<
"\">"
1127 <<
_(
"Chaotic units: ") <<
"<span foreground=\"" << chaotic_color <<
"\">"
1129 <<
_(
"Liminal units: ") <<
"<span foreground=\"" << liminal_color <<
"\">"
1136 return image_report(tod_image, tooltip.str(),
"time_of_day_" + tod.
id);
1140 map_location mouseover_hex = rc.screen().mouseover_hex();
1147 std::ostringstream tooltip;
1151 if (viewing_team.
shrouded(mouseover_hex)) {
1153 local_tod = global_tod;
1154 }
else if (viewing_team.
fogged(mouseover_hex)) {
1168 lawful_color = (bonus > 0) ?
"green" :
"red";
1169 chaotic_color = (bonus < 0) ?
"green" :
"red";
1170 liminal_color =
"red";
1172 tooltip << local_tod.
name <<
'\n'
1173 <<
_(
"Lawful units: ") <<
"<span foreground=\"" << lawful_color <<
"\">"
1176 <<
_(
"Chaotic units: ") <<
"<span foreground=\"" << chaotic_color <<
"\">"
1178 <<
_(
"Liminal units: ") <<
"<span foreground=\"" << liminal_color <<
"\">"
1183 if (local_tod.
bonus_modified > 0) local_tod_image +=
"~BRIGHTEN()";
1184 else if (local_tod.
bonus_modified < 0) local_tod_image +=
"~DARKEN()";
1202 bg_terrain_image =
"~BLIT(unit_env/terrain/terrain-" + terrain_id +
".png)" + bg_terrain_image;
1205 std::stringstream
color;
1206 color << local_tod.
color;
1208 bg_terrain_image = bg_terrain_image +
"~CS(" + color.str() +
")";
1215 std::string tod_image = global_tod_image +
"~BLIT(" + local_tod_image +
")";
1217 return image_report(tod_image + bg_terrain_image + unit_image, tooltip.str(),
"time_of_day");
1221 map_location mouseover_hex = rc.screen().mouseover_hex();
1228 std::ostringstream str;
1229 str << rc.tod().turn();
1230 int nb = rc.tod().number_of_turns();
1231 if (nb != -1) str <<
'/' << nb;
1237 std::ostringstream str;
1238 int viewing_side = rc.screen().viewing_side();
1240 int fake_gold = rc.teams()[viewing_side - 1].gold();
1243 fake_gold -= rc.wb()->get_spent_gold_for(viewing_side);
1245 if (viewing_side != rc.screen().playing_side()) {
1248 else if (fake_gold < 0) {
1260 std::ostringstream str;
1261 int viewing_side = rc.screen().viewing_side();
1262 const team &viewing_team = rc.teams()[viewing_side - 1];
1263 team_data td = rc.dc().calculate_team_data(viewing_team, viewing_side);
1266 int unshrouded_villages = 0;
1269 ++unshrouded_villages;
1271 str << unshrouded_villages;
1273 str << rc.map().villages().size();
1280 return gray_inactive(rc, std::to_string(rc.dc().side_units(rc.screen().viewing_side())));
1285 std::ostringstream str;
1286 int viewing_side = rc.screen().viewing_side();
1287 const team &viewing_team = rc.teams()[viewing_side - 1];
1288 team_data td = rc.dc().calculate_team_data(viewing_team, viewing_side);
1295 int viewing_side = rc.screen().viewing_side();
1296 const team &viewing_team = rc.teams()[viewing_side - 1];
1297 team_data td = rc.dc().calculate_team_data(viewing_team, rc.screen().viewing_side());
1303 std::ostringstream str;
1304 int viewing_side = rc.screen().viewing_side();
1305 const team &viewing_team = rc.teams()[viewing_side - 1];
1306 team_data td = rc.dc().calculate_team_data(viewing_team, viewing_side);
1308 if (viewing_side != rc.screen().playing_side()) {
1333 const std::string tc_base = high_res ?
"images/buttons/icon-base-32.png" :
"images/buttons/icon-base-16.png";
1334 const std::string terrain_image =
"terrain/" + icon_image + (high_res ?
"_30.png" :
".png");
1335 add_image(cfg, tc_base +
"~RC(magenta>" + terrain_id +
")~BLIT(" + terrain_image +
")", terrain_name);
1341 const gamemap &map = rc.map();
1342 map_location mouseover_hex = rc.screen().mouseover_hex();
1345 mouseover_hex = rc.screen().selected_hex();
1354 std::ostringstream str;
1357 bool high_res =
false;
1379 if (terrain_icon.empty())
1381 blit_tced_icon(cfg, terrain_id, terrain_icon, high_res, terrain_name);
1388 const gamemap &map = rc.map();
1389 int viewing_side = rc.screen().viewing_side();
1390 const team &viewing_team = rc.teams()[viewing_side - 1];
1391 map_location mouseover_hex = rc.screen().mouseover_hex();
1399 std::ostringstream str;
1402 int owner = rc.dc().village_owner(mouseover_hex) + 1;
1403 if (owner == 0 || viewing_team.
fogged(mouseover_hex)) {
1405 }
else if (owner == viewing_side) {
1407 }
else if (viewing_team.
is_enemy(owner)) {
1414 if(!underlying_desc.empty()) {
1415 str << underlying_desc;
1426 std::ostringstream text;
1427 std::ostringstream tooltip;
1428 std::ostringstream
help;
1430 text << static_cast<int>(rc.screen().get_zoom_factor() * 100) <<
"%";
1432 return text_report(text.str(), tooltip.str(), help.str());
1437 const gamemap &map = rc.map();
1438 map_location mouseover_hex = rc.screen().mouseover_hex(),
1439 displayed_unit_hex = rc.screen().displayed_unit_hex(),
1440 selected_hex = rc.screen().selected_hex();
1442 if (!map.
on_board(mouseover_hex)) {
1446 mouseover_hex = selected_hex;
1454 std::ostringstream str;
1455 str << mouseover_hex;
1458 const team &viewing_team = rc.teams()[rc.screen().viewing_team()];
1460 (displayed_unit_hex != mouseover_hex &&
1461 displayed_unit_hex != rc.screen().selected_hex()) ||
1462 viewing_team.
shrouded(mouseover_hex))
1468 str <<
" " << defense <<
"%," << move_cost;
1469 }
else if (mouseover_hex == displayed_unit_hex) {
1470 str <<
" " << defense <<
"%,‒";
1479 const team &active_team = rc.teams()[rc.screen().playing_team()];
1483 std::string mods =
"~RC(" + old_rgb +
">" + new_rgb +
")";
1484 if (flag_icon.empty())
1491 const std::set<std::string> &observers = rc.screen().observers();
1492 if (observers.empty())
1495 std::ostringstream str;
1496 str <<
_(
"Observers:") <<
'\n';
1527 time_t
t = std::time(
nullptr);
1528 struct tm *lt = std::localtime(&t);
1529 if (!lt)
return config();
1540 int viewing_side = rc.screen().viewing_side();
1541 const team &viewing_team = rc.teams()[viewing_side - 1];
1544 return report_report_clock(rc);
1545 std::ostringstream str;
1548 if (viewing_side != rc.screen().playing_side())
1551 str <<
"<span foreground=\"#c80000\">";
1553 str <<
"<span foreground=\"#c8c800\">";
1559 if (sec < 10) str <<
'0';
1574 return i->second->generate(rc);
1578 return j->second(rc);
const SDL_Color good_dmg_color
std::string image_mods() const
const t_string & name() const
static config unit_level(const unit *u)
const std::vector< t_string > & trait_descriptions() const
int total_movement() const
size_t strftime(char *str, size_t count, const std::string &format, const std::tm *time)
t_string unit_description() const
Information about the unit – a detailed description of it.
static config unit_xp(const unit *u)
std::vector< double > hp_dist
Resulting probability distribution (might be not as large as max_hp)
const map_location & get_location() const
static display * get_singleton()
Returns the display object if a display object exists.
static int get_acceleration()
std::string absolute_image() const
The name of the file to game_display (used in menus).
config(* generator_function)(reports::context &)
int max_hitpoints() const
bool get_state(const std::string &state) const
const std::string weapon_details_sep
SDL_Color create_color(const unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha)
void set_specials_context(const map_location &unit_loc, const map_location &other_loc, bool attacking, const attack_type *other_attack) const
Sets the context under which specials will be checked for being active.
static config time_of_day_at(reports::context &rc, const map_location &mouseover_hex)
const t_string & income_description_enemy() const
tod_color color
The color modifications that should be made to the game board to reflect the time of day...
const t_string & name() const
The unit name for display.
const t_string & type_name() const
The unit type name.
std::string get_underlying_terrain_string(const t_translation::t_terrain &terrain) const
const t_string & name(GENDER gender=MALE) const
bool shrouded(const map_location &loc) const
int movement_cost(const t_translation::t_terrain &terrain) const
static config unit_advancement_options(const unit *u)
int modified_damage(bool is_backstab) const
Returns the damage per attack of this weapon, considering specials.
Various functions that implement attacks and attack calculations.
std::vector< boost::tuple< t_string, t_string, t_string > > ability_tooltips(std::vector< bool > *active_list=nullptr) const
Tuple of: neutral ability name, gendered ability name, description.
static void format_prob(char str_buf[10], double prob)
SDL_Color int_to_color(const Uint32 rgb)
static const int UNREACHABLE
Magic value that signifies a hex is unreachable.
const time_of_day & get_time_of_day(int for_turn=0) const
Returns global time of day for the passed turn.
bool is_village(const map_location &loc) const
static int report(lua_State *L, int status)
bool is_enemy(int n) const
static void add_status(config &r, char const *path, char const *desc1, char const *desc2)
void set_specials_context_for_listing() const
const std::vector< std::string > advances_to_translated() const
static config image_report(const std::string &image, const std::string &tooltip="", const std::string &help="")
const std::set< std::string > & report_list()
GLenum GLsizei GLenum GLenum const GLvoid * image
const std::string & id() const
int lawful_bonus
The % bonus lawful units receive.
const t_string & name() const
static config text_report(const std::string &text, const std::string &tooltip="", const std::string &help="")
std::string image
The image to be displayed in the game status.
const std::string & id() const
const attack_type * weapon
The weapon used by the unit to attack the opponent, or nullptr if there is none.
const t_translation::t_list & union_type() const
SDL_Color xp_color() const
Colors for the unit's XP.
virtual int playing_side() const
static config unit_side(reports::context &rc, const unit *u)
static config unit_name(const unit *u)
static config unit_traits(const unit *u)
report_generator_helper(const char *name, reports::generator_function g)
static config unit_type(const unit *u)
const t_translation::t_list & underlying_union_terrain(const map_location &loc) const
const t_terrain OFF_MAP_USER
std::string small_profile() const
The unit's profile.
std::string get_terrain_string(const map_location &loc) const
unsigned int chance_to_hit
Effective chance to hit as a percentage (all factors accounted for).
Uint32 red_to_green(int val, bool for_text)
Return a color corresponding to the value val red for val=0 to green for val=100, passing by yellow...
int defense_modifier(const t_translation::t_terrain &terrain) const
std::string span_color(const SDL_Color &color)
Creates pango markup of a color.
const t_string & income_description_own() const
const SDL_Color inactive_details_color
static config unit_alignment(reports::context &rc, const unit *u)
const unit_type & type() const
The type of the unit (accounting for gender and variation).
GLdouble GLdouble GLdouble b
static static_report_generators static_generators
std::map< std::string, std::string > advancement_icons() const
Object which defines a time of day with associated bonuses, image, sounds etc.
static config unit_race(const unit *u)
const std::string & type_id() const
The id of the type of the unit.
const std::string unicode_minus
const SDL_Color bad_dmg_color
This class stores all the data for a single 'side' (in game nomenclature).
std::string half_signed_value(int val)
Sign with Unicode "−" if negative.
static std::string at(const std::string &file, int line)
static UNUSEDNOWARN std::string _(const char *str)
virtual const map_location & displayed_unit_hex() const
Virtual functions shadowed in game_display.
int damage
Effective damage of the weapon (all factors accounted for).
GLsizei const char ** path
const std::string & flag_icon() const
const SDL_Color BAD_COLOR
unit_type::ALIGNMENT alignment() const
const std::string unicode_en_dash
#define REPORT_GENERATOR(n, cn)
void register_generator(const std::string &name, generator *)
std::set< std::string > all_reports_
std::string base_name(const std::string &file)
Returns the base filename of a file, with directory name stripped.
t_translation::t_terrain number() const
config generate_report(const std::string &name, context &ct, bool only_static=false)
std::set< t_translation::t_terrain > & encountered_terrains()
Encapsulates the map of the game.
bool show_variations_in_help() const
Whether the unit type has at least one help-visible variation.
Computes the statistics of a battle between an attacker and a defender unit.
config & add_child(const std::string &key)
void fight(combatant &opponent, bool levelup_considered=true)
Simulate a fight! Can be called multiple times for cumulative calculations.
unit_race::GENDER gender() const
static config unit_hp(reports::context &rc, const unit *u)
Structure describing the statistics of a unit involved in the battle.
static UNUSEDNOWARN std::string gettext(const char *str)
int movement_left() const
Returns how far a unit can move this turn (zero if incapacitated).
static const ::config * terrain
The terrain used to create the cache.
typedef int(WINAPI *PFNWGLRELEASEPBUFFERDCARBPROC)(HPBUFFERARB hPbuffer
const tod_manager & tod()
const SDL_Color weapon_details_color
dynamic_report_generators dynamic_generators_
const std::string & type() const
const std::vector< attack_type > & attacks() const
bool invisible(const map_location &loc, bool see_all=true) const
A terrain string which is converted to a terrain is a string with 1 or 2 layers the layers are separa...
std::string join(T const &v, const std::string &s=",")
Generates a new string joining container items in a list.
static config unit_status(reports::context &rc, const unit *u)
std::string base_str() const
Encapsulates the map of the game.
static const unit * get_visible_unit(reports::context &rc)
const terrain_type & get_terrain_info(const t_translation::t_terrain &terrain) const
std::vector< std::pair< std::string, std::string > > amla_icons() const
unsigned swarm_blows(unsigned min_blows, unsigned max_blows, unsigned hp, unsigned max_hp)
Calculates the number of blows resulting from swarm.
static config unit_box_at(reports::context &rc, const map_location &mouseover_hex)
std::string escape_text(const std::string &text)
Escapes the markup characters in a text.
int round_damage(int base_damage, int bonus, int divisor)
round (base_damage * bonus / divisor) to the closest integer, but up or down towards base_damage ...
const std::string unicode_figure_dash
static config unit_moves(reports::context &rc, const unit *u)
std::string resistance_color(const int resistance)
static const unit * get_selected_unit(reports::context &rc)
Uint32 blue_to_white(int val, bool for_text)
static void add_image(config &report, const std::string &image, const std::string &tooltip, const std::string &help="")
const t_string & income_description_ally() const
const std::vector< team > & teams()
std::string signed_percent(int val)
Convert into a percentage (using the Unicode "−" and +0% convention.
const std::string & range() const
void modified_attacks(bool is_backstab, unsigned &min_attacks, unsigned &max_attacks) const
Calculates the number of attacks this weapon has, considering specials.
static std::string flush(std::ostringstream &s)
const display_context & dc()
bool fogged(const map_location &loc) const
GLdouble GLdouble GLdouble r
static int sort(lua_State *L)
int resistance_against(const std::string &damage_name, bool attacker, const map_location &loc) const
static config unit_defense(reports::context &rc, const unit *u, const map_location &displayed_unit_hex)
GLuint const GLchar * name
t_translation::t_terrain get_terrain(const map_location &loc) const
Looks up terrain at a particular location.
bool on_board(const map_location &loc) const
Tell if a location is on the map.
std::string accuracy_parry_description() const
std::map< std::string, reports::generator_function > static_report_generators
const t_terrain VOID_TERRAIN
const time_of_day get_illuminated_time_of_day(const unit_map &units, const gamemap &map, const map_location &loc, int for_turn=0) const
Returns time of day object for the passed turn at a location.
static int attack_info(reports::context &rc, const attack_type &at, config &res, const unit &u, const map_location &displayed_unit_hex)
const SDL_Color weapon_color
int countdown_time() const
int max_experience() const
const std::string weapon_numbers_sep
const std::vector< t_string > & trait_names() const
static config gray_inactive(reports::context &rc, const std::string &str)
const std::string & side_name() const
SDL_Color hp_color() const
Colors for the unit's current hitpoints.
symbol_table string_table
static void add_text(config &report, const std::string &text, const std::string &tooltip, const std::string &help="")
const SDL_Color GRAY_COLOR
bool show_everything() const
this module manages the cache of images.
const t_translation::t_list & underlying_def_terrain(const map_location &loc) const
utils::string_map get_base_resistances() const
static std::string get_side_color_index(int side)
unsigned int num_blows
Effective number of blows, takes swarm into account.
static config unit_weapons(reports::context &rc, const unit *attacker, const map_location &attacker_pos, const unit *defender, bool show_attacker)
size_t viewing_team() const
The viewing team is the team currently viewing the game.
static void format_hp(char str_buf[10], int hp)
std::string signed_value(int val)
Convert into a signed value (using the Unicode "−" and +0 convention.
const SDL_Color inactive_ability_color
A config object defines a single node in a WML file, with access to child nodes.
static std::string alignment_description(ALIGNMENT align, unit_race::GENDER gender=unit_race::MALE)
static config unit_abilities(const unit *u)
map_location under_leadership(const unit_map &units, const map_location &loc, int *bonus)
function which tests if the unit at loc is currently affected by leadership.
const t_string & description() const
const unit * get_visible_unit(const map_location &loc, const team ¤t_team, bool see_all=false) const
const unit_race * race() const
Never returns nullptr, but may point to the null race.
static config unit_vision(const unit *u)
const t_string & income_description() const
GLsizei const GLcharARB ** string
bool use_twelve_hour_clock_format()
const std::string & icon_image() const
const map_location & selected_hex() const
std::vector< t_terrain > t_list
const std::string valid
Little parts of regex templates used to parse Wml annoations.
std::vector< std::string > get_traits_list() const
int combat_modifier(const unit_map &units, const gamemap &map, const map_location &loc, unit_type::ALIGNMENT alignment, bool is_fearless)
Returns the amount that a unit's damage should be multiplied by due to the current time of day...
std::vector< std::pair< t_string, t_string > > special_tooltips(std::vector< bool > *active_list=nullptr) const
Returns a vector of names and descriptions for the specials of *this.