Skip to content

Commit

Permalink
AI recruitment: use unit-specific recall cost
Browse files Browse the repository at this point in the history
… when deciding whether a recall is worth it.

(cherry picked from commit 0119413)
  • Loading branch information
mattsc committed Oct 28, 2018
1 parent b9f26a4 commit d1ba9a3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/ai/default/recruitment.cpp
Expand Up @@ -499,7 +499,11 @@ double recruitment::recall_unit_value(const unit_const_ptr & recall_unit) const
double xp_quantity = static_cast<double>(recall_unit->experience()) /
recall_unit->max_experience();
double recall_value = recall_unit->cost() + xp_quantity * average_cost_of_advanced_unit;
if (recall_value < current_team().recall_cost()) {
int cost = current_team().recall_cost();
if (recall_unit->recall_cost() > -1) {
cost=recall_unit->recall_cost();
}
if (recall_value < cost) {
recall_value = -1; // Unit is not worth to get recalled.
}
return recall_value;
Expand Down

0 comments on commit d1ba9a3

Please sign in to comment.