From 677b34414cec5cf40921a48991b5cf8f900d7dc5 Mon Sep 17 00:00:00 2001 From: JT Smith Date: Tue, 9 Nov 2010 15:48:20 -0600 Subject: [PATCH] no special resources needed when there's a plan --- .../DB/Result/Building/Permanent/GasGiantPlatform.pm | 8 +++++--- .../DB/Result/Building/Permanent/TerraformingPlatform.pm | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/Lacuna/DB/Result/Building/Permanent/GasGiantPlatform.pm b/lib/Lacuna/DB/Result/Building/Permanent/GasGiantPlatform.pm index 9186df16..7dbbbd0e 100644 --- a/lib/Lacuna/DB/Result/Building/Permanent/GasGiantPlatform.pm +++ b/lib/Lacuna/DB/Result/Building/Permanent/GasGiantPlatform.pm @@ -25,9 +25,11 @@ around can_build => sub { before has_special_resources => sub { my $self = shift; my $planet = $self->body; - my $amount_needed = sprintf('%.0f', $self->ore_to_build * $self->upgrade_cost * 0.50); - if ($planet->rutile_stored + $planet->chromite_stored + $planet->bauxite_stored + $planet->magnetite_stored + $planet->beryl_stored + $planet->goethite_stored < $amount_needed) { - confess [1012,"You do not have a sufficient supply (".$amount_needed.") of structural minerals such as Rutile, Chromite, Bauxite, Magnetite, Beryl, and Goethite to build the components that can handle the stresses of gas giant missions."]; + unless ($planet->get_plan(ref $self, $self->level + 1)) { + my $amount_needed = sprintf('%.0f', $self->ore_to_build * $self->upgrade_cost * 0.50); + if ($planet->rutile_stored + $planet->chromite_stored + $planet->bauxite_stored + $planet->magnetite_stored + $planet->beryl_stored + $planet->goethite_stored < $amount_needed) { + confess [1012,"You do not have a sufficient supply (".$amount_needed.") of structural minerals such as Rutile, Chromite, Bauxite, Magnetite, Beryl, and Goethite to build the components that can handle the stresses of gas giant missions."]; + } } }; diff --git a/lib/Lacuna/DB/Result/Building/Permanent/TerraformingPlatform.pm b/lib/Lacuna/DB/Result/Building/Permanent/TerraformingPlatform.pm index b3bc8532..13d2fe21 100644 --- a/lib/Lacuna/DB/Result/Building/Permanent/TerraformingPlatform.pm +++ b/lib/Lacuna/DB/Result/Building/Permanent/TerraformingPlatform.pm @@ -23,9 +23,11 @@ around can_build => sub { before has_special_resources => sub { my $self = shift; my $planet = $self->body; - my $amount_needed = sprintf('%.0f', $self->ore_to_build * $self->upgrade_cost * 0.20); - if ($planet->gypsum_stored + $planet->sulfur_stored + $planet->monazite_stored < $amount_needed) { - confess [1012,"You do not have a sufficient supply (".$amount_needed.") of phosphorus from sources like Gypsum, Sulfur, and Monazite to create the chemical compounds to terraform a planet."]; + unless ($planet->get_plan(ref $self, $self->level + 1)) { + my $amount_needed = sprintf('%.0f', $self->ore_to_build * $self->upgrade_cost * 0.20); + if ($planet->gypsum_stored + $planet->sulfur_stored + $planet->monazite_stored < $amount_needed) { + confess [1012,"You do not have a sufficient supply (".$amount_needed.") of phosphorus from sources like Gypsum, Sulfur, and Monazite to create the chemical compounds to terraform a planet."]; + } } }; -- 2.51.2