diff --git a/src/ai_move.cpp b/src/ai_move.cpp index 1c9406fa628..f5a32c67c4a 100644 --- a/src/ai_move.cpp +++ b/src/ai_move.cpp @@ -255,20 +255,33 @@ std::pair ai::choose_move(std::vector::const_iterator Itor; std::pair its = dstsrc.equal_range(*ri); while(its.first != its.second) { - if(its.first->second == best->first && !should_retreat(its.first->first,fullmove_srcdst,fullmove_dstsrc,enemy_srcdst,enemy_dstsrc)) { - const double value = best_target->value - best->second.type().cost()/20.0; - targets.erase(best_target); + if(its.first->second == best->first) { + if(!should_retreat(its.first->first,fullmove_srcdst,fullmove_dstsrc,enemy_srcdst,enemy_dstsrc)) { + const double value = best_target->value - best->second.type().cost()/20.0; - //if this is a sufficiently valuable target, we add this unit as a target -- meaning - //that a group of units will rally around it, creating a teaming effect - if(best_target->value > 0.0) { - targets.push_back(target(its.first->first,value)); - } + if(value > 0.0) { + //there are enemies ahead. Rally troops around us to + //try to take the target + if(is_dangerous) { + targets.push_back(target(its.first->first,value*2.0)); + } + + best_target->value = value; + } else { + targets.erase(best_target); + } - return std::pair(its.first->second,its.first->first); + return std::pair(its.first->second,its.first->first); + } else { + is_dangerous = true; + } } ++its.first; diff --git a/src/display.cpp b/src/display.cpp index 1fb3a65cb69..17f41cea011 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -1376,7 +1376,7 @@ void display::draw_tile(int x, int y, SDL_Surface* unit_image_override, blend_with = it->second.type().alignment() == unit_type::CHAOTIC ? 0x0001 : 0xFFFF; highlight_ratio = advancingAmount_; - } else if(it->second.poisoned()) { + } else if(it->second.poisoned() && highlight_ratio == 1.0) { //the unit is poisoned - draw with a green hue blend_with = SDL_MapRGB(dst->format,0,255,0); highlight_ratio = 0.75;