diff --git a/lib/Lacuna/DB/Result/Building.pm b/lib/Lacuna/DB/Result/Building.pm index 9089a0f1..831e3c65 100755 --- a/lib/Lacuna/DB/Result/Building.pm +++ b/lib/Lacuna/DB/Result/Building.pm @@ -816,15 +816,12 @@ sub time_cost_reduction_bonus { my $empire = $body->empire; return 1 unless defined $empire; my $unhappy_workers = 0; - if ($body->happiness < 0 ) { - $unhappy_workers = abs($body->happiness) / 1000; - } my $base_cost_reduction = 100 - $extra - ($body->empire->effective_management_affinity * 5); if ( $base_cost_reduction < 1 ) { my $new_factor = (1 - $base_cost_reduction) / 30; $base_cost_reduction = 1 - $new_factor; } - return ($base_cost_reduction + $unhappy_workers) / 100; + return $base_cost_reduction / 100; } sub cost_to_upgrade { @@ -856,6 +853,7 @@ sub cost_to_upgrade { $self->building_reduction_bonus * $self->time_cost_reduction_bonus * $oversight_reduction * $time_with_plan; $time_cost = 5184000 if ($time_cost > 5184000); # 60 Days + $time_cost *= $self->body->build_boost; $time_cost = 15 if ($time_cost < 15); if ($build_with_halls) { diff --git a/lib/Lacuna/DB/Result/Building/Shipyard.pm b/lib/Lacuna/DB/Result/Building/Shipyard.pm index 91ec0636..73afc6db 100644 --- a/lib/Lacuna/DB/Result/Building/Shipyard.pm +++ b/lib/Lacuna/DB/Result/Building/Shipyard.pm @@ -48,11 +48,12 @@ sub get_ship_costs { $percentage_of_cost /= 100; my $throttle = Lacuna->config->get('ship_build_speed') || 0; my $seconds = sprintf('%0.f', $ship->base_time_cost * $self->time_cost_reduction_bonus(($self->effective_level * 3) + $throttle)); - $seconds = 15 if $seconds < 15; $seconds = 5184000 if ($seconds > 5184000); # 60 Days + $seconds *= $self->body->build_boost; + $seconds = 15 if $seconds < 15; my $bonus = $self->manufacturing_cost_reduction_bonus; return { - seconds => $seconds, + seconds => int($seconds), food => sprintf('%0.f', $ship->base_food_cost * $percentage_of_cost * $bonus), water => sprintf('%0.f', $ship->base_water_cost * $percentage_of_cost * $bonus), ore => sprintf('%0.f', $ship->base_ore_cost * $percentage_of_cost * $bonus), diff --git a/lib/Lacuna/DB/Result/Map/Body/Planet.pm b/lib/Lacuna/DB/Result/Map/Body/Planet.pm index 1ed8a93c..72a915e8 100644 --- a/lib/Lacuna/DB/Result/Map/Body/Planet.pm +++ b/lib/Lacuna/DB/Result/Map/Body/Planet.pm @@ -743,6 +743,25 @@ has oracle => ( }, ); +has build_boost => ( + is => 'rw', + lazy => 1, + clearer => "clear_bb", + default => sub { + my $self = shift; + + my $sign = $self->happiness >= 0 ? 1 : -1; + my $scale = $self->happiness == 0 ? 0 : + int( + log(abs($self->happiness)) / + log(1000) + ); + #1 - $sign * $scale * ($sign < 0 ? 10 : 2) / 100; + 1 - $sign * $scale * ($sign < 0 ? 150 : 5) / 100; + }, +); + + sub is_space_free { my ($self, $unclean_x, $unclean_y) = @_; my $x = int( $unclean_x ); diff --git a/var/www/public/changes.txt b/var/www/public/changes.txt index f4413db4..c0eea6ba 100644 --- a/var/www/public/changes.txt +++ b/var/www/public/changes.txt @@ -15,6 +15,7 @@ - Fix: Supply Pods don't count toward population. - Add: abandoned colony, fissure explosion, and fissure repair medals - Add: get_buildable_locations API for bodies (Jazz request) + - Add: Happy citizens can build faster. 3.0911: - Add: Reduce opacity for less-well-controlled stars.