From ff7e96df8783c2e43d38360f21e47081d4f3b2d2 Mon Sep 17 00:00:00 2001 From: Mark Lemming Date: Tue, 24 Dec 2013 14:10:30 -0700 Subject: [PATCH] More restrictions by University Level --- lib/Lacuna/DB/Result/Building/Archaeology.pm | 13 +++++++++---- .../Building/Permanent/GasGiantPlatform.pm | 10 ++++++++++ .../Building/Permanent/TerraformingPlatform.pm | 10 ++++++++++ .../Result/Building/Permanent/TheDillonForge.pm | 16 +++++++++++----- var/www/public/changes.txt | 6 ++++++ 5 files changed, 46 insertions(+), 9 deletions(-) diff --git a/lib/Lacuna/DB/Result/Building/Archaeology.pm b/lib/Lacuna/DB/Result/Building/Archaeology.pm index 1e2a7d6e..9ebfa850 100644 --- a/lib/Lacuna/DB/Result/Building/Archaeology.pm +++ b/lib/Lacuna/DB/Result/Building/Archaeology.pm @@ -47,7 +47,9 @@ use constant waste_production => 20; sub chance_of_glyph { my $self = shift; - return $self->level; + my $chance = ($self->level > $self->body->empire->university_level + 1) ? + $self->body->empire->university_level + 1 : $self->level; + return $chance; } sub is_glyph_found { @@ -70,15 +72,18 @@ sub get_ores_available_for_processing { sub max_excavators { my $self = shift; - return 0 if ($self->level < 11); - return ($self->level - 10); + my $level = ($self->level > $self->body->empire->university_level + 1) ? + $self->body->empire->university_level + 1 : $self->level; + return 0 if ($level < 11); + return ($level - 10); } sub run_excavators { my $self = shift; my $results; - my $level = $self->level; + my $level = ($self->level > $self->body->empire->university_level + 1) ? + $self->body->empire->university_level + 1 : $self->level; my $empire = $self->body->empire; # Do once for arch itself. No chance of destroy or artifacts. my $result = $self->dig_it($self->body, $level, 1); diff --git a/lib/Lacuna/DB/Result/Building/Permanent/GasGiantPlatform.pm b/lib/Lacuna/DB/Result/Building/Permanent/GasGiantPlatform.pm index 8416356b..2cc5bf6a 100644 --- a/lib/Lacuna/DB/Result/Building/Permanent/GasGiantPlatform.pm +++ b/lib/Lacuna/DB/Result/Building/Permanent/GasGiantPlatform.pm @@ -3,6 +3,7 @@ package Lacuna::DB::Result::Building::Permanent::GasGiantPlatform; use Moose; use utf8; no warnings qw(uninitialized); +use Lacuna::Constants qw(GROWTH); extends 'Lacuna::DB::Result::Building::Permanent'; with "Lacuna::Role::Building::CantBuildWithoutPlan"; @@ -74,6 +75,15 @@ before has_special_resources => sub { } }; +sub production_hour { + my $self = shift; + return 0 unless $self->level; + my $prod_level = $self->level; + my $production = (GROWTH ** ( $prod_level - 1)); + $production = ($production * $self->efficiency) / 100; + return $production; +} + use constant name => 'Gas Giant Settlement Platform'; use constant food_to_build => 0; diff --git a/lib/Lacuna/DB/Result/Building/Permanent/TerraformingPlatform.pm b/lib/Lacuna/DB/Result/Building/Permanent/TerraformingPlatform.pm index 26d82c65..bfbe5e8d 100644 --- a/lib/Lacuna/DB/Result/Building/Permanent/TerraformingPlatform.pm +++ b/lib/Lacuna/DB/Result/Building/Permanent/TerraformingPlatform.pm @@ -3,6 +3,7 @@ package Lacuna::DB::Result::Building::Permanent::TerraformingPlatform; use Moose; use utf8; no warnings qw(uninitialized); +use Lacuna::Constants qw(GROWTH); extends 'Lacuna::DB::Result::Building::Permanent'; with "Lacuna::Role::Building::CantBuildWithoutPlan"; @@ -70,6 +71,15 @@ before has_special_resources => sub { } }; +sub production_hour { + my $self = shift; + return 0 unless $self->level; + my $prod_level = $self->level; + my $production = (GROWTH ** ( $prod_level - 1)); + $production = ($production * $self->efficiency) / 100; + return $production; +} + use constant image => 'terraformingplatform'; use constant name => 'Terraforming Platform'; diff --git a/lib/Lacuna/DB/Result/Building/Permanent/TheDillonForge.pm b/lib/Lacuna/DB/Result/Building/Permanent/TheDillonForge.pm index 99a4111f..720e705c 100644 --- a/lib/Lacuna/DB/Result/Building/Permanent/TheDillonForge.pm +++ b/lib/Lacuna/DB/Result/Building/Permanent/TheDillonForge.pm @@ -76,6 +76,9 @@ sub split_plan { and $_->extra_build_level == $extra_build_level } @{$body->plan_cache}; + my $effective_level = ($self->level > $self->body->empire->university_level + 1) ? + $self->body->empire->university_level + 1 : $self->level; + if (not $plan) { confess [1002, 'You cannot split a plan you do not have.']; } @@ -92,8 +95,7 @@ sub split_plan { $body->delete_many_plans($plan, $quantity); my $num_glyphs = scalar @$glyphs; - my $base = ($num_glyphs * $halls * 30 * 3600) / ($self->level * 4); -# my $pow_two = int(log($work->{quantity})/log(2)+0.5); + my $base = ($num_glyphs * $halls * 30 * 3600) / ($effective_level * 4); my $build_secs = int($base * (1.5 ** (log($quantity)/log(2))) + 0.5); $self->start_work({task => 'split_plan', class => $class, level => $level, extra_build_level => $extra_build_level, quantity => $quantity}, $build_secs)->update; } @@ -101,8 +103,10 @@ sub split_plan { sub make_plan { my ($self, $plan_class, $level) = @_; - if ($level > $self->level) { - confess [1002, 'Your Dillon Forge level is not high enough to build that high a plan level.']; + my $effective_level = ($self->level > $self->body->empire->university_level + 1) ? + $self->body->empire->university_level + 1 : $self->level; + if ($level > $effective_level) { + confess [1002, 'Your Dillon Forge or your tech level is not high enough to build that high a plan level.']; } if ($plan_class =~ m/HallsOfVrbansk/) { confess [1002, 'It is not a good idea to create a plan you cannot use.']; @@ -158,8 +162,10 @@ before finish_work => sub { $body->add_news(100, sprintf('%s used the Dillon Forge to create a %s plan level %s on %s.', $empire->name, $plan_class->name, $work->{level}, $body->name)); } if ($work->{task} eq 'split_plan') { + my $effective_level = ($self->level > $self->body->empire->university_level + 1) ? + $self->body->empire->university_level + 1 : $self->level; # calculate the probability of success - my $success_percent = $self->level * 3; + my $success_percent = $effective_level * 3; my $halls = $self->equivalent_halls($work->{level}, $work->{extra_build_level}); my $pow_two = int(log($work->{quantity})/log(2)+0.5); diff --git a/var/www/public/changes.txt b/var/www/public/changes.txt index 3609b33e..f41d8ba4 100644 --- a/var/www/public/changes.txt +++ b/var/www/public/changes.txt @@ -1,3 +1,9 @@ +3.0898: + - Mod: The Dillon Forge can now take a quantity of plans for splitting. + - Fix: GG & Terra Platforms ignore University Level. + - Fix: Archeology Level is limited by University Level. + - Fix: The Dillon Forge is limited by University Level. + 3.0897: - Fix: SupplyPods ignore University Level. - Fix: Deployed Bleeders ignore University Level. -- 2.51.2