diff --git a/bin/util/wipe_colony.pl b/bin/util/wipe_colony.pl new file mode 100755 index 00000000..ec1d40be --- /dev/null +++ b/bin/util/wipe_colony.pl @@ -0,0 +1,60 @@ +use 5.010; +use strict; +use lib '/data/Lacuna-Server/lib'; +use Lacuna::DB; +use Lacuna; +use Lacuna::Util qw(randint format_date); +use Getopt::Long; +use JSON; +$|=1; +our $quiet; + my @body_id; + my $sanitize; + + GetOptions( + 'quiet' => \$quiet, + 'body=s@' => \@body_id, + ); + + + die "Usage: perl $0 --body X\n" unless ( defined @body_id ); + + out('Started'); + my $start = time; + + out('Loading DB'); + our $db = Lacuna->db; + + for my $body_id (@body_id) { + my $body = $db->resultset('Lacuna::DB::Result::Map::Body')->find($body_id); + printf "Found %d, %s at %d/%d in zone %s\n", $body_id, $body->name, $body->x, $body->y, $body->zone; + unless ($body) { + die "Cannot find body id $body_id\n"; + } + my @all_buildings = @{$body->building_cache}; + $body->delete_buildings(\@all_buildings); + $body->sanitize; + } +exit; + + +############### +## SUBROUTINES +############### + +sub out { + my $message = shift; + unless ($quiet) { + say format_date(DateTime->now), " ", $message; + } +} + +sub get_builds { + my ( $data_file ) = @_; + + my $bld_data = get_json($data_file); + unless ($bld_data) { + die "Could not read $data_file\n"; + } + return $bld_data; +} diff --git a/lib/Lacuna/AI.pm b/lib/Lacuna/AI.pm index 1e2bbf5f..0b943da5 100644 --- a/lib/Lacuna/AI.pm +++ b/lib/Lacuna/AI.pm @@ -213,6 +213,7 @@ sub run_missions { my $mission = $missions[rand @missions]; my $infiltrated_spies = Lacuna->db->resultset('Lacuna::DB::Result::Spies')->search({from_body_id => $colony->id, on_body_id => {'!=', $colony->id}}); while (my $spy = $infiltrated_spies->next) { + next if $spy->task eq "Sabotage BHG"; if ($spy->is_available) { say " Spy ID: ".$spy->id." running mission..."; my $result = eval{$spy->assign($mission)}; diff --git a/lib/Lacuna/AI/Diablotin.pm b/lib/Lacuna/AI/Diablotin.pm index 114acfcc..1042b034 100644 --- a/lib/Lacuna/AI/Diablotin.pm +++ b/lib/Lacuna/AI/Diablotin.pm @@ -141,6 +141,7 @@ sub ship_building_priorities { ['placebo2', 18], ['placebo3', 18], ['placebo', 18], + ['bleeder', 18], ); } @@ -148,7 +149,7 @@ sub run_hourly_colony_updates { my ($self, $colony) = @_; $self->demolish_bleeders($colony); $self->set_defenders($colony); - $self->pod_check($colony, 10); + $self->pod_check($colony, 15); $self->repair_buildings($colony); $self->train_spies($colony); $self->build_ships($colony); diff --git a/lib/Lacuna/DB/Result/Building.pm b/lib/Lacuna/DB/Result/Building.pm index f2b2080e..8cff6636 100755 --- a/lib/Lacuna/DB/Result/Building.pm +++ b/lib/Lacuna/DB/Result/Building.pm @@ -648,6 +648,7 @@ sub downgrade { return $self->demolish; } $self->level( $self->level - 1); + $self->efficiency(100); $self->update; my $body = $self->body; if (!$theft) { diff --git a/var/www/public/changes.txt b/var/www/public/changes.txt index 204f69bd..7bcd7060 100644 --- a/var/www/public/changes.txt +++ b/var/www/public/changes.txt @@ -1,7 +1,7 @@ 3.0895: - Fix: Bad error message when not enough glyphs for a mission fixed. - Fix: Fetch Spies exploit filled in. - - Fix: BHG Sabotage option available + - Add: BHG Sabotage option available - Add: Date Landed returned from excavation sites. - Fix: All spies in training on a planet are executed on new management. - Mod: Uni level also determines top production levels.