From e419af892505bd0aed159fabbbab870045c8d32e Mon Sep 17 00:00:00 2001 From: Mark Lemming Date: Wed, 16 Jan 2013 13:23:36 -0700 Subject: [PATCH] Snark fix. --- lib/Lacuna/DB/Result/Map/Body.pm | 19 +++++++++++++++++++ lib/Lacuna/Role/Ship/Arrive/DamageBuilding.pm | 3 ++- var/messages/planet_moved.txt | 1 - var/www/public/changes.txt | 1 + 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/lib/Lacuna/DB/Result/Map/Body.pm b/lib/Lacuna/DB/Result/Map/Body.pm index d4ea7f44..90379a72 100644 --- a/lib/Lacuna/DB/Result/Map/Body.pm +++ b/lib/Lacuna/DB/Result/Map/Body.pm @@ -365,6 +365,25 @@ sub delete_last_attacked_by { Lacuna->cache->delete('last_attacked_by',$self->id); } +sub is_bhg_neutralized { + my ($check) = @_; + my $tstar; my $tname; + if ($check->isa('Lacuna::DB::Result::Map::Star')) { + $tstar = $check; + $tname = $check->name; + } + else { + $tstar = $check->star; + $tname = $check->name; + } + my $sname = $tstar->name; + if ($tstar->station_id) { + if ($tstar->station->laws->search({type => 'BHGNeutralized'})->count) { + return 1; + } + } + return 0; +} no Moose; __PACKAGE__->meta->make_immutable(inline_constructor => 0); diff --git a/lib/Lacuna/Role/Ship/Arrive/DamageBuilding.pm b/lib/Lacuna/Role/Ship/Arrive/DamageBuilding.pm index 0260d91c..e110f8d9 100644 --- a/lib/Lacuna/Role/Ship/Arrive/DamageBuilding.pm +++ b/lib/Lacuna/Role/Ship/Arrive/DamageBuilding.pm @@ -21,7 +21,7 @@ after handle_arrival_procedures => sub { if (defined $citadel) { $building = $citadel; } - elsif ($self->target_building) { + elsif (scalar @{$self->target_building} > 0) { my @builds; for my $tb ( @{$self->target_building} ) { my @temp = $body_attacked->get_buildings_of_class($tb); @@ -45,6 +45,7 @@ after handle_arrival_procedures => sub { rand() <=> rand() } grep { + ($_->efficiency > 0) and ($_->class ne 'Lacuna::DB::Result::Building::Permanent::Crater') and ($_->class ne 'Lacuna::DB::Result::Building::DeployedBleeder') and ($_->class ne 'Lacuna::DB::Result::Building::TheDillonForge') diff --git a/var/messages/planet_moved.txt b/var/messages/planet_moved.txt index b6949e1d..0a4afd79 100644 --- a/var/messages/planet_moved.txt +++ b/var/messages/planet_moved.txt @@ -2,7 +2,6 @@ We have moved! ~~~ A blackhole generator must have moved {Starmap %s %s %s} to %s/%s in orbit %s around {Starmap %s %s %s}. - Regards, Your Humble Assistant diff --git a/var/www/public/changes.txt b/var/www/public/changes.txt index 44d13dee..8eecc1a4 100644 --- a/var/www/public/changes.txt +++ b/var/www/public/changes.txt @@ -1,6 +1,7 @@ 3.0878: - Fix: Fissure Sealers were sending extra email on home arrival. - Add: Cult of the Fissure added into code base. + - Fix: Snarks will actually hit planet instead of doing a flyby. 3.0877: - Fix: Shipyard,Intelligence,ThemePark work time now correctly updated -- 2.51.2