mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-03 10:47:39 +00:00
Use uniform status flags.
This commit is contained in:
parent
8560711a13
commit
d2e6a6e173
@ -230,7 +230,7 @@ gamemap::location under_leadership(const units_map& units,
|
||||
const unit_map::const_iterator it = units.find(adjacent[i]);
|
||||
if(it != units.end() && (int)it->second.side() == side &&
|
||||
it->second.get_ability_bool("leader",adjacent[i]) &&
|
||||
it->second.get_state("stoned") != "true") {
|
||||
it->second.get_state("stoned") != "yes") {
|
||||
current_bonus = maximum<int>(current_bonus,it->second.get_abilities("leadership",adjacent[i]).highest("value"));
|
||||
if(current_bonus != bonus_tracker) {
|
||||
best_loc = adjacent[i];
|
||||
@ -408,7 +408,7 @@ battle_stats evaluate_battle_stats(const gamemap& map,
|
||||
bonus += leader_bonus;
|
||||
|
||||
}
|
||||
if (d->second.get_state("slowed") == "true") {
|
||||
if (d->second.get_state("slowed") == "yes") {
|
||||
divisor *= 2;
|
||||
}
|
||||
|
||||
@ -460,7 +460,7 @@ battle_stats evaluate_battle_stats(const gamemap& map,
|
||||
|
||||
weapon_special_list plague = attack.get_specials("plague");
|
||||
static const std::string plague_string("plague");
|
||||
res.attacker_plague = d->second.get_state("not_living") != "true" &&
|
||||
res.attacker_plague = d->second.get_state("not_living") != "yes" &&
|
||||
(!plague.empty()) &&
|
||||
strcmp(d->second.undead_variation().c_str(),"null") &&
|
||||
!map.is_village(defender);
|
||||
@ -661,7 +661,7 @@ battle_stats evaluate_battle_stats(const gamemap& map,
|
||||
}
|
||||
}
|
||||
*/
|
||||
if (d->second.get_state("slowed") == "true") {
|
||||
if (d->second.get_state("slowed") == "yes") {
|
||||
divisor *= 2;
|
||||
if (strings) {
|
||||
std::stringstream str;
|
||||
@ -716,12 +716,12 @@ battle_stats evaluate_battle_stats(const gamemap& map,
|
||||
|
||||
//if the defender drains, and the attacker is a living creature, then
|
||||
//the defender will drain for half the damage it does
|
||||
if (defend.get_special_bool("drains") && a->second.get_state("not_living") != "true") {
|
||||
if (defend.get_special_bool("drains") && a->second.get_state("not_living") != "yes") {
|
||||
res.amount_defender_drains = res.damage_attacker_takes/2;
|
||||
}
|
||||
|
||||
weapon_special_list defend_plague = attack.get_specials("plague");
|
||||
res.defender_plague = a->second.get_state("not_living") != "true" &&
|
||||
res.defender_plague = a->second.get_state("not_living") != "yes" &&
|
||||
(!defend_plague.empty()) &&
|
||||
strcmp(a->second.undead_variation().c_str(),"null") &&
|
||||
!map.is_village(attacker);
|
||||
@ -845,7 +845,7 @@ battle_stats evaluate_battle_stats(const gamemap& map,
|
||||
|
||||
}
|
||||
|
||||
if (a->second.get_state("slowed") == "true") {
|
||||
if (a->second.get_state("slowed") == "yes") {
|
||||
divisor *= 2;
|
||||
|
||||
if (strings) {
|
||||
@ -871,7 +871,7 @@ battle_stats evaluate_battle_stats(const gamemap& map,
|
||||
|
||||
//if the attacker drains, and the defender is a living creature, then
|
||||
//the attacker will drain for half the damage it does
|
||||
if(attack.get_special_bool("drains") && d->second.get_state("not_living") != "true") {
|
||||
if(attack.get_special_bool("drains") && d->second.get_state("not_living") != "yes") {
|
||||
res.amount_attacker_drains = res.damage_defender_takes/2;
|
||||
}
|
||||
|
||||
@ -1195,19 +1195,19 @@ void attack(display& gui, const gamemap& map,
|
||||
break;
|
||||
} else if(hits) {
|
||||
if (stats.attacker_poisons &&
|
||||
d->second.get_state("poisoned") != "true" &&
|
||||
d->second.get_state("not_living") != "true") {
|
||||
d->second.get_state("poisoned") != "yes" &&
|
||||
d->second.get_state("not_living") != "yes") {
|
||||
if (update_display){
|
||||
gui.float_label(d->first,_("poisoned"),255,0,0);
|
||||
}
|
||||
d->second.set_state("poisoned","true");
|
||||
d->second.set_state("poisoned","yes");
|
||||
}
|
||||
|
||||
if(stats.attacker_slows && d->second.get_state("slowed") != "true") {
|
||||
if(stats.attacker_slows && d->second.get_state("slowed") != "yes") {
|
||||
if (update_display){
|
||||
gui.float_label(d->first,_("slowed"),255,0,0);
|
||||
}
|
||||
d->second.set_state("slowed","true");
|
||||
d->second.set_state("slowed","yes");
|
||||
stats.damage_attacker_takes = round_damage(stats.damage_attacker_takes,1,2);
|
||||
}
|
||||
|
||||
@ -1217,7 +1217,7 @@ void attack(display& gui, const gamemap& map,
|
||||
if (update_display){
|
||||
gui.float_label(d->first,_("stone"),255,0,0);
|
||||
}
|
||||
d->second.set_state("stoned","true");
|
||||
d->second.set_state("stoned","yes");
|
||||
stats.ndefends = 0;
|
||||
stats.nattacks = 0;
|
||||
game_events::fire(stone_string,d->first,a->first);
|
||||
@ -1432,19 +1432,19 @@ void attack(display& gui, const gamemap& map,
|
||||
break;
|
||||
} else if(hits) {
|
||||
if (stats.defender_poisons &&
|
||||
a->second.get_state("poisoned") != "true" &&
|
||||
a->second.get_state("not_living") != "true") {
|
||||
a->second.get_state("poisoned") != "yes" &&
|
||||
a->second.get_state("not_living") != "yes") {
|
||||
if (update_display){
|
||||
gui.float_label(a->first,_("poisoned"),255,0,0);
|
||||
}
|
||||
a->second.set_state("poisoned","true");
|
||||
a->second.set_state("poisoned","yes");
|
||||
}
|
||||
|
||||
if(stats.defender_slows && a->second.get_state("slowed") != "true") {
|
||||
if(stats.defender_slows && a->second.get_state("slowed") != "yes") {
|
||||
if (update_display){
|
||||
gui.float_label(a->first,_("slowed"),255,0,0);
|
||||
}
|
||||
a->second.set_state("slowed","true");
|
||||
a->second.set_state("slowed","yes");
|
||||
stats.damage_defender_takes = round_damage(stats.damage_defender_takes,1,2);
|
||||
}
|
||||
|
||||
@ -1455,7 +1455,7 @@ void attack(display& gui, const gamemap& map,
|
||||
if (update_display){
|
||||
gui.float_label(a->first,_("stone"),255,0,0);
|
||||
}
|
||||
a->second.set_state("stoned","true");
|
||||
a->second.set_state("stoned","yes");
|
||||
stats.ndefends = 0;
|
||||
stats.nattacks = 0;
|
||||
game_events::fire(stone_string,a->first,d->first);
|
||||
@ -1643,7 +1643,7 @@ unit_map::iterator find_healer(const gamemap::location &loc, std::map<gamemap::l
|
||||
for (unsigned int n = 0; n != 6U; ++n) {
|
||||
unit_map::iterator i = units.find(adjacent[n]);
|
||||
if (i != units.end()) {
|
||||
if (i->second.get_state("stoned")=="true")
|
||||
if (i->second.get_state("stoned")=="yes")
|
||||
continue;
|
||||
if (i->second.side() != side)
|
||||
continue;
|
||||
@ -1674,7 +1674,7 @@ void calculate_healing(display& disp, const gamestatus& status, const gamemap& m
|
||||
if (teams[i->second.side()-1].is_enemy(side))
|
||||
continue;
|
||||
|
||||
if (i->second.get_state("healable") == "false")
|
||||
if (i->second.get_state("healable") == "no")
|
||||
continue;
|
||||
|
||||
patient p(i->second, i->first,i->second.side() != side);
|
||||
@ -1882,7 +1882,7 @@ const time_of_day& timeofday_at(const gamestatus& status,const unit_map& units,c
|
||||
for(int i = 0; i != 7; ++i) {
|
||||
const unit_map::const_iterator itor = units.find(locs[i]);
|
||||
if(itor != units.end() &&
|
||||
itor->second.get_ability_bool("illuminates",itor->first) && itor->second.get_state("stoned")!="true") {
|
||||
itor->second.get_ability_bool("illuminates",itor->first) && itor->second.get_state("stoned")!="yes") {
|
||||
lighten = maximum<int>(itor->second.get_abilities("illuminates",itor->first).highest("value").first, lighten);
|
||||
darken = minimum<int>(itor->second.get_abilities("illuminates",itor->first).lowest("value").first, darken);
|
||||
}
|
||||
@ -2334,7 +2334,7 @@ bool unit_can_move(const gamemap::location& loc, const unit_map& units,
|
||||
if(map.on_board(locs[n])) {
|
||||
const unit_map::const_iterator i = units.find(locs[n]);
|
||||
if(i != units.end()) {
|
||||
if(i->second.get_state("stoned")!="true" && current_team.is_enemy(i->second.side())) {
|
||||
if(i->second.get_state("stoned")!="yes" && current_team.is_enemy(i->second.side())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -2422,7 +2422,7 @@ bool backstab_check(const gamemap::location& attacker_loc,
|
||||
const units_map::const_iterator opp =
|
||||
units.find(adj[(i+3)%6]);
|
||||
if(opp == units.end()) return false; // No opposite unit
|
||||
if(opp->second.get_state("stoned") == "true") return false;
|
||||
if(opp->second.get_state("stoned") == "yes") return false;
|
||||
if(size_t(defender->second.side()-1) >= teams.size() ||
|
||||
size_t(opp->second.side()-1) >= teams.size())
|
||||
return true; // If sides aren't valid teams, then they are enemies
|
||||
|
20
src/ai.cpp
20
src/ai.cpp
@ -597,7 +597,7 @@ gamemap::location ai::move_unit(location from, location to, std::map<location,pa
|
||||
for(adjacent_tiles_array::const_iterator adj_i = locs.begin(); adj_i != locs.end(); ++adj_i) {
|
||||
const unit_map::const_iterator itor = units_.find(*adj_i);
|
||||
if(itor != units_.end() && current_team().is_enemy(itor->second.side()) &&
|
||||
itor->second.get_state("stoned") != "true") {
|
||||
itor->second.get_state("stoned") != "yes") {
|
||||
battle_stats stats;
|
||||
const int weapon = choose_weapon(res,itor->first,stats,0);
|
||||
attack_enemy(res,itor->first,weapon);
|
||||
@ -642,7 +642,7 @@ void ai_interface::calculate_possible_moves(std::map<location,paths>& res, move_
|
||||
}
|
||||
|
||||
//discount incapacitated units
|
||||
if(un_it->second.get_state("stoned")=="true") {
|
||||
if(un_it->second.get_state("stoned")=="yes") {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1003,7 +1003,7 @@ void ai_interface::attack_enemy(const location& u, const location& target, int w
|
||||
const command_disabler disable_commands;
|
||||
|
||||
if(info_.units.count(u) && info_.units.count(target)) {
|
||||
if(info_.units.find(target)->second.get_state("stoned")=="true") {
|
||||
if(info_.units.find(target)->second.get_state("stoned")=="yes") {
|
||||
LOG_STREAM(err, ai) << "attempt to attack unit that is turned to stone\n";
|
||||
return;
|
||||
}
|
||||
@ -1139,7 +1139,7 @@ bool ai::get_villages(std::map<gamemap::location,paths>& possible_moves, const m
|
||||
}
|
||||
|
||||
const unit_map::const_iterator u = units_.find(j->second);
|
||||
if(u == units_.end() || u->second.get_state("guardian")=="true") {
|
||||
if(u == units_.end() || u->second.get_state("guardian")=="yes") {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1392,7 +1392,7 @@ bool ai::move_to_targets(std::map<gamemap::location,paths>& possible_moves, move
|
||||
teams_,current_team());
|
||||
|
||||
if(enemy != units_.end() &&
|
||||
current_team().is_enemy(enemy->second.side()) && enemy->second.get_state("stoned") != "true") {
|
||||
current_team().is_enemy(enemy->second.side()) && enemy->second.get_state("stoned") != "yes") {
|
||||
const int res = choose_weapon(move.first,adj[n],bat_stats,
|
||||
map_[move.second.x][move.second.y]);
|
||||
|
||||
@ -1419,7 +1419,7 @@ bool ai::move_to_targets(std::map<gamemap::location,paths>& possible_moves, move
|
||||
const unit_map::const_iterator un_it = units_.find(arrived_at);
|
||||
|
||||
//if we're going to attack someone
|
||||
if(u_it != units_.end() && u_it->second.get_state("stoned") != "true" && weapon != -1) {
|
||||
if(u_it != units_.end() && u_it->second.get_state("stoned") != "yes" && weapon != -1) {
|
||||
attack_enemy(move.second,target,weapon);
|
||||
}
|
||||
|
||||
@ -1742,7 +1742,7 @@ void ai::move_leader_to_goals( const move_map& enemy_dstsrc)
|
||||
}
|
||||
|
||||
const unit_map::iterator leader = find_leader(units_,team_num_);
|
||||
if(leader == units_.end() || leader->second.get_state("stoned")=="true") {
|
||||
if(leader == units_.end() || leader->second.get_state("stoned")=="yes") {
|
||||
WRN_AI << "Leader not found\n";
|
||||
return;
|
||||
}
|
||||
@ -1779,7 +1779,7 @@ void ai::move_leader_to_goals( const move_map& enemy_dstsrc)
|
||||
void ai::move_leader_to_keep(const move_map& enemy_dstsrc)
|
||||
{
|
||||
const unit_map::iterator leader = find_leader(units_,team_num_);
|
||||
if(leader == units_.end() || leader->second.get_state("stoned")=="true") {
|
||||
if(leader == units_.end() || leader->second.get_state("stoned")=="yes") {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1828,7 +1828,7 @@ void ai::move_leader_after_recruit(const move_map& enemy_dstsrc)
|
||||
LOG_AI << "moving leader after recruit...\n";
|
||||
|
||||
const unit_map::iterator leader = find_leader(units_,team_num_);
|
||||
if(leader == units_.end() || leader->second.get_state("stoned")=="true") {
|
||||
if(leader == units_.end() || leader->second.get_state("stoned")=="yes") {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1916,7 +1916,7 @@ void ai::move_leader_after_recruit(const move_map& enemy_dstsrc)
|
||||
bool ai::leader_can_reach_keep() const
|
||||
{
|
||||
const unit_map::iterator leader = find_leader(units_,team_num_);
|
||||
if(leader == units_.end() || leader->second.get_state("stoned")=="true") {
|
||||
if(leader == units_.end() || leader->second.get_state("stoned")=="yes") {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -414,7 +414,7 @@ void ai::attack_analysis::analyze(const gamemap& map, unit_map& units, int num_s
|
||||
|
||||
int defenderxp = 0;
|
||||
|
||||
bool defender_slowed= defend_it->second.get_state("slowed")=="true";
|
||||
bool defender_slowed= defend_it->second.get_state("slowed")=="yes";
|
||||
|
||||
int defhp = target_hp;
|
||||
for(size_t i = 0; i != movements.size() && defhp; ++i) {
|
||||
@ -432,7 +432,7 @@ void ai::attack_analysis::analyze(const gamemap& map, unit_map& units, int num_s
|
||||
}
|
||||
|
||||
const bool on_village = map.is_village(movements[i].second);
|
||||
bool attacker_slowed= att->second.get_state("slowed")=="true";
|
||||
bool attacker_slowed= att->second.get_state("slowed")=="yes";
|
||||
|
||||
//up to double the value of a unit based on experience
|
||||
cost += (double(att->second.experience())/
|
||||
@ -691,7 +691,7 @@ std::vector<ai::attack_analysis> ai::analyze_targets(
|
||||
for(unit_map::const_iterator j = units_.begin(); j != units_.end(); ++j) {
|
||||
|
||||
//attack anyone who is on the enemy side, and who is not invisible or turned to stone
|
||||
if(current_team().is_enemy(j->second.side()) && j->second.get_state("stoned")!="true" &&
|
||||
if(current_team().is_enemy(j->second.side()) && j->second.get_state("stoned")!="yes" &&
|
||||
j->second.invisible(map_.underlying_union_terrain(map_[j->first.x][j->first.y]),
|
||||
state_.get_time_of_day().lawful_bonus,j->first,
|
||||
units_,teams_) == false) {
|
||||
|
@ -398,7 +398,7 @@ std::pair<gamemap::location,gamemap::location> ai::choose_move(std::vector<targe
|
||||
|
||||
//find the first eligible unit
|
||||
for(u = units_.begin(); u != units_.end(); ++u) {
|
||||
if(!(u->second.side() != team_num_ || u->second.can_recruit() || u->second.movement_left() <= 0 || u->second.get_state("stoned")=="true")) {
|
||||
if(!(u->second.side() != team_num_ || u->second.can_recruit() || u->second.movement_left() <= 0 || u->second.get_state("stoned")=="yes")) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -409,7 +409,7 @@ std::pair<gamemap::location,gamemap::location> ai::choose_move(std::vector<targe
|
||||
}
|
||||
|
||||
//guardian units stay put
|
||||
if(u->second.get_state("guardian")=="true") {
|
||||
if(u->second.get_state("guardian")=="yes") {
|
||||
LOG_AI << u->second.id() << " is guardian, staying still\n";
|
||||
return std::pair<location,location>(u->first,u->first);
|
||||
}
|
||||
@ -499,7 +499,7 @@ std::pair<gamemap::location,gamemap::location> ai::choose_move(std::vector<targe
|
||||
//now see if any other unit can put a better bid forward
|
||||
for(++u; u != units_.end(); ++u) {
|
||||
if(u->second.side() != team_num_ || u->second.can_recruit() ||
|
||||
u->second.movement_left() <= 0 || u->second.get_state("guardian")=="true" || u->second.get_state("stoned")=="true") {
|
||||
u->second.movement_left() <= 0 || u->second.get_state("guardian")=="yes" || u->second.get_state("stoned")=="yes") {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -347,7 +347,7 @@ bool event_handler::handle_event_command(const queued_event& event_info,
|
||||
else if(cmd == "unstone") {
|
||||
const vconfig filter = cfg.child("filter");
|
||||
for(unit_map::iterator i = units->begin(); i != units->end(); ++i) {
|
||||
if(i->second.get_state("stoned")=="true") {
|
||||
if(i->second.get_state("stoned")=="yes") {
|
||||
if(!filter.null()) {
|
||||
if(game_events::unit_matches_filter(i, filter))
|
||||
i->second.set_state("stoned","");
|
||||
|
@ -89,7 +89,7 @@ void mouse_handler::mouse_motion(int x, int y)
|
||||
attack_from.valid())) {
|
||||
if(mouseover_unit == units_.end()) {
|
||||
cursor::set(cursor::MOVE);
|
||||
} else if(current_team().is_enemy(mouseover_unit->second.side()) && mouseover_unit->second.get_state("stoned")!="true") {
|
||||
} else if(current_team().is_enemy(mouseover_unit->second.side()) && mouseover_unit->second.get_state("stoned")!="yes") {
|
||||
cursor::set(cursor::ATTACK);
|
||||
} else {
|
||||
cursor::set(cursor::NORMAL);
|
||||
@ -114,7 +114,7 @@ void mouse_handler::mouse_motion(int x, int y)
|
||||
|
||||
unit_map::const_iterator un = find_unit(selected_hex_);
|
||||
|
||||
if((new_hex != last_hex_ || attack_from.valid()) && un != units_.end() && un->second.get_state("stoned")!="true") {
|
||||
if((new_hex != last_hex_ || attack_from.valid()) && un != units_.end() && un->second.get_state("stoned")!="yes") {
|
||||
const shortest_path_calculator calc(un->second,current_team(), visible_units(),teams_,map_,status_);
|
||||
const bool can_teleport = un->second.get_ability_bool("teleport",un->first);
|
||||
|
||||
@ -409,7 +409,7 @@ void mouse_handler::show_attack_options(unit_map::const_iterator u)
|
||||
|
||||
for(unit_map::const_iterator target = units_.begin(); target != units_.end(); ++target) {
|
||||
if(current_team.is_enemy(target->second.side()) &&
|
||||
distance_between(target->first,u->first) == 1 && target->second.get_state("stoned")!="true") {
|
||||
distance_between(target->first,u->first) == 1 && target->second.get_state("stoned")!="yes") {
|
||||
current_paths_.routes[target->first] = paths::route();
|
||||
}
|
||||
}
|
||||
|
@ -405,7 +405,7 @@ void turn_info::mouse_motion(int x, int y)
|
||||
attack_from.valid())) {
|
||||
if(mouseover_unit == units_.end()) {
|
||||
cursor::set(cursor::MOVE);
|
||||
} else if(viewing_team().is_enemy(mouseover_unit->second.side()) && mouseover_unit->second.get_state("stoned")!="true") {
|
||||
} else if(viewing_team().is_enemy(mouseover_unit->second.side()) && mouseover_unit->second.get_state("stoned")!="yes") {
|
||||
cursor::set(cursor::ATTACK);
|
||||
} else {
|
||||
cursor::set(cursor::NORMAL);
|
||||
@ -430,7 +430,7 @@ void turn_info::mouse_motion(int x, int y)
|
||||
|
||||
unit_map::const_iterator un = find_unit(selected_hex_);
|
||||
|
||||
if((new_hex != last_hex_ || attack_from.valid()) && un != units_.end() && un->second.get_state("stoned")!="true") {
|
||||
if((new_hex != last_hex_ || attack_from.valid()) && un != units_.end() && un->second.get_state("stoned")!="yes") {
|
||||
const shortest_path_calculator calc(un->second,viewing_team(),
|
||||
visible_units(),teams_,map_,status_);
|
||||
const bool can_teleport = un->second.get_ability_bool("teleport",un->first);
|
||||
@ -916,7 +916,7 @@ void turn_info::left_click(const SDL_MouseButtonEvent& event)
|
||||
u = find_unit(attack_from);
|
||||
// enemy = find_unit(hex);
|
||||
if(u != units_.end() && u->second.side() == team_num_ &&
|
||||
enemy != units_.end() && current_team().is_enemy(enemy->second.side()) && enemy->second.get_state("stoned")!="true") {
|
||||
enemy != units_.end() && current_team().is_enemy(enemy->second.side()) && enemy->second.get_state("stoned")!="yes") {
|
||||
if(attack_enemy(u,enemy) == false) {
|
||||
undo();
|
||||
selected_hex_ = src;
|
||||
@ -1011,7 +1011,7 @@ void turn_info::show_attack_options(unit_map::const_iterator u)
|
||||
|
||||
for(unit_map::const_iterator target = units_.begin(); target != units_.end(); ++target) {
|
||||
if(current_team.is_enemy(target->second.side()) &&
|
||||
distance_between(target->first,u->first) == 1 && target->second.get_state("stoned")!="true") {
|
||||
distance_between(target->first,u->first) == 1 && target->second.get_state("stoned")!="yes") {
|
||||
current_paths_.routes[target->first] = paths::route();
|
||||
}
|
||||
}
|
||||
@ -2829,7 +2829,7 @@ void turn_info::show_enemy_moves(bool ignore_units)
|
||||
.lawful_bonus,
|
||||
u->first, units_, teams_);
|
||||
|
||||
if(current_team().is_enemy(u->second.side()) && !gui_.fogged(u->first.x,u->first.y) && u->second.get_state("stoned")!="true" && !invisible) {
|
||||
if(current_team().is_enemy(u->second.side()) && !gui_.fogged(u->first.x,u->first.y) && u->second.get_state("stoned")!="yes" && !invisible) {
|
||||
const unit_movement_resetter move_reset(u->second);
|
||||
const bool is_skirmisher = u->second.get_ability_bool("skirmisher",u->first);
|
||||
const bool teleports = u->second.get_ability_bool("teleport",u->first);
|
||||
|
@ -132,19 +132,19 @@ report generate_report(TYPE type, const gamemap& map, unit_map& units,
|
||||
tooltip << _("invisible: ") << _("This unit is invisible. It cannot be seen or attacked by enemy units.");
|
||||
res.add_image(unit_status,tooltip);
|
||||
}
|
||||
if(u->second.get_state("slowed")=="true") {
|
||||
if(u->second.get_state("slowed")=="yes") {
|
||||
unit_status << "misc/slowed.png";
|
||||
tooltip << _("slowed: ") << _("This unit has been slowed. It will only deal half its normal damage when attacking.");
|
||||
res.add_image(unit_status,tooltip);
|
||||
}
|
||||
if(u->second.get_state("poisoned")=="true") {
|
||||
if(u->second.get_state("poisoned")=="yes") {
|
||||
unit_status << "misc/poisoned.png";
|
||||
tooltip << _("poisoned: ") << _("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\
|
||||
\n\
|
||||
Units cannot be killed by poison alone. The poison will not reduce it below 1 HP.");
|
||||
res.add_image(unit_status,tooltip);
|
||||
}
|
||||
if(u->second.get_state("stoned")=="true") {
|
||||
if(u->second.get_state("stoned")=="yes") {
|
||||
unit_status << "misc/stone.png";
|
||||
tooltip << _("stone: ") << _("This unit has been turned to stone. It may not move or attack.");
|
||||
res.add_image(unit_status,tooltip);
|
||||
@ -195,7 +195,7 @@ Units cannot be killed by poison alone. The poison will not reduce it below 1 HP
|
||||
}
|
||||
case UNIT_MOVES: {
|
||||
int x = 180;
|
||||
if(u->second.get_state("stoned")=="true"){
|
||||
if(u->second.get_state("stoned")=="yes"){
|
||||
x = 128;
|
||||
}else{
|
||||
x = (int)(128 + (255-128)*((float)u->second.movement_left()/u->second.total_movement()));
|
||||
@ -221,7 +221,7 @@ Units cannot be killed by poison alone. The poison will not reduce it below 1 HP
|
||||
const std::string& lang_type = gettext(at_it->type().c_str());
|
||||
str.str("");
|
||||
str << "<245,230,193>";
|
||||
if(u->second.get_state("slowed")=="true") {
|
||||
if(u->second.get_state("slowed")=="yes") {
|
||||
str << round_damage(at_it->damage(),1,2) << "-" ;
|
||||
} else {
|
||||
str << at_it->damage() << "-" ;
|
||||
@ -243,7 +243,7 @@ Units cannot be killed by poison alone. The poison will not reduce it below 1 HP
|
||||
str << nattacks;
|
||||
str << " " << at_it->name();
|
||||
tooltip << at_it->name() << "\n";
|
||||
if(u->second.get_state("slowed")=="true") {
|
||||
if(u->second.get_state("slowed")=="yes") {
|
||||
tooltip << round_damage(at_it->damage(),1,2) << " " << _("damage") << ", ";
|
||||
} else {
|
||||
tooltip << at_it->damage() << " " << _("damage") << ", ";
|
||||
|
@ -512,11 +512,11 @@ void unit::new_turn(const gamemap::location& loc)
|
||||
movement_ = total_movement();
|
||||
attacks_left_ = max_attacks_;
|
||||
if(get_ability_bool("hides",loc)) {
|
||||
set_state("hides","true");
|
||||
set_state("hides","yes");
|
||||
} else {
|
||||
set_state("hides","");
|
||||
}
|
||||
if(get_state("stoned")=="true") {
|
||||
if(get_state("stoned")=="yes") {
|
||||
set_attacks(0);
|
||||
}
|
||||
if (hold_position_) {
|
||||
@ -2123,7 +2123,7 @@ void unit::add_modification(const std::string& type, const config& mod,
|
||||
const std::string& remove = (**i.first)["remove"];
|
||||
|
||||
if(add.empty() == false) {
|
||||
set_state(add,"true");
|
||||
set_state(add,"yes");
|
||||
}
|
||||
|
||||
if(remove.empty() == false) {
|
||||
@ -2456,7 +2456,7 @@ bool unit::invisible(const std::string& terrain, int lawful_bonus,
|
||||
bool is_inv = false;
|
||||
|
||||
static const std::string hides("hides");
|
||||
if (get_state(hides)=="true") {
|
||||
if (get_state(hides)=="yes") {
|
||||
is_inv = this->get_ability_bool("hides",loc);
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ bool unit::get_ability_bool(const std::string& ability, const gamemap::location&
|
||||
for(int i = 0; i != 6; ++i) {
|
||||
const unit_map::const_iterator it = units_->find(adjacent[i]);
|
||||
if(it != units_->end() &&
|
||||
it->second.get_state("stoned") != "true") {
|
||||
it->second.get_state("stoned") != "yes") {
|
||||
const config* adj_abilities = it->second.cfg_.child("abilities");
|
||||
if(adj_abilities) {
|
||||
const config::child_list& list = adj_abilities->get_children(ability);
|
||||
@ -150,7 +150,7 @@ unit_ability_list unit::get_abilities(const std::string& ability, const gamemap:
|
||||
for(int i = 0; i != 6; ++i) {
|
||||
const unit_map::const_iterator it = units_->find(adjacent[i]);
|
||||
if(it != units_->end() &&
|
||||
it->second.get_state("stoned") != "true") {
|
||||
it->second.get_state("stoned") != "yes") {
|
||||
const config* adj_abilities = it->second.cfg_.child("abilities");
|
||||
if(adj_abilities) {
|
||||
const config::child_list& list = adj_abilities->get_children(ability);
|
||||
@ -216,7 +216,7 @@ std::vector<std::string> unit::ability_tooltips(const gamemap::location& loc) co
|
||||
for(int i = 0; i != 6; ++i) {
|
||||
const unit_map::const_iterator it = units_->find(adjacent[i]);
|
||||
if(it != units_->end() && 0 &&
|
||||
it->second.get_state("stoned") != "true") {
|
||||
it->second.get_state("stoned") != "yes") {
|
||||
const config* adj_abilities = it->second.cfg_.child("abilities");
|
||||
if(adj_abilities) {
|
||||
const config::child_map& adj_list_map = adj_abilities->all_children();
|
||||
|
Loading…
x
Reference in New Issue
Block a user