Change behavior of recruitment_save_gold.
This commit is contained in:
parent
213677b710
commit
d3e24eef3a
2 changed files with 23 additions and 19 deletions
|
@ -96,7 +96,7 @@
|
||||||
[/aspect]
|
[/aspect]
|
||||||
{DEFAULT_ASPECT_EMPTY recruitment_more}
|
{DEFAULT_ASPECT_EMPTY recruitment_more}
|
||||||
{DEFAULT_ASPECT_EMPTY recruitment_pattern}
|
{DEFAULT_ASPECT_EMPTY recruitment_pattern}
|
||||||
{DEFAULT_ASPECT_VALUE recruitment_randomness 15}
|
{DEFAULT_ASPECT_VALUE recruitment_randomness 50}
|
||||||
[aspect]
|
[aspect]
|
||||||
id=recruitment_save_gold
|
id=recruitment_save_gold
|
||||||
engine=cpp
|
engine=cpp
|
||||||
|
@ -106,8 +106,8 @@
|
||||||
name=standard_aspect
|
name=standard_aspect
|
||||||
[value]
|
[value]
|
||||||
active=2
|
active=2
|
||||||
begin=1.0
|
begin=1.1
|
||||||
end=0.7
|
end=0.9
|
||||||
spend_all_gold=-1
|
spend_all_gold=-1
|
||||||
[/value]
|
[/value]
|
||||||
[/default]
|
[/default]
|
||||||
|
|
|
@ -65,7 +65,7 @@ namespace {
|
||||||
|
|
||||||
// When a enemy is in this radius around a leader, this leader is tagged as 'in danger'.
|
// When a enemy is in this radius around a leader, this leader is tagged as 'in danger'.
|
||||||
// If gold is available, this leader will recruit as much units as possible.
|
// If gold is available, this leader will recruit as much units as possible.
|
||||||
const static int LEADER_IN_DANGER_RADIUS = 3;
|
const static int LEADER_IN_DANGER_RADIUS = 5;
|
||||||
|
|
||||||
// This is used for a income estimation. We'll calculate the estimated income of this much
|
// This is used for a income estimation. We'll calculate the estimated income of this much
|
||||||
// future turns and decide if we'd gain gold if we start to recruit no units anymore.
|
// future turns and decide if we'd gain gold if we start to recruit no units anymore.
|
||||||
|
@ -726,7 +726,7 @@ void recruitment::show_important_hexes() const {
|
||||||
}
|
}
|
||||||
resources::screen->labels().clear_all();
|
resources::screen->labels().clear_all();
|
||||||
BOOST_FOREACH(const map_location& loc, important_hexes_) {
|
BOOST_FOREACH(const map_location& loc, important_hexes_) {
|
||||||
// Little hack: use map_location north from loc and make 2 linebreaks to center the dot
|
// Little hack: use map_location north from loc and make 2 linebreaks to center the "X".
|
||||||
resources::screen->labels().set_label(loc.get_direction(map_location::NORTH), "\n\nX");
|
resources::screen->labels().set_label(loc.get_direction(map_location::NORTH), "\n\nX");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1462,21 +1462,25 @@ double recruitment::get_estimated_village_gain() const {
|
||||||
*/
|
*/
|
||||||
double recruitment::get_unit_ratio() const {
|
double recruitment::get_unit_ratio() const {
|
||||||
const unit_map& units = *resources::units;
|
const unit_map& units = *resources::units;
|
||||||
double own_total_value = 0.;
|
double own_total_value = 0.;
|
||||||
double enemy_total_value = 0.;
|
double enemy_total_value = 0.;
|
||||||
BOOST_FOREACH(const unit& unit, units) {
|
BOOST_FOREACH(const unit& unit, units) {
|
||||||
if (unit.incapacitated() || unit.total_movement() <= 0) {
|
if (unit.incapacitated() || unit.total_movement() <= 0 || unit.can_recruit()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
double value = unit.cost() * unit.hitpoints() / unit.max_hitpoints();
|
|
||||||
if (current_team().is_enemy(unit.side())) {
|
|
||||||
enemy_total_value += value;
|
|
||||||
} else {
|
|
||||||
own_total_value += value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (enemy_total_value == 0) {
|
double value = unit.cost() * unit.hitpoints() / unit.max_hitpoints();
|
||||||
return 999.; // Should never happen
|
if (current_team().is_enemy(unit.side())) {
|
||||||
|
enemy_total_value += value;
|
||||||
|
} else {
|
||||||
|
own_total_value += value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// If only the leader is left, the values could be 0.
|
||||||
|
// Catch those cases and return something reasonable.
|
||||||
|
if (own_total_value == 0. && enemy_total_value == 0.) {
|
||||||
|
return 0.;
|
||||||
|
} else if (enemy_total_value == 0.) {
|
||||||
|
return 2.;
|
||||||
}
|
}
|
||||||
return own_total_value / enemy_total_value;
|
return own_total_value / enemy_total_value;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue