diff --git a/lib/Lacuna/DB/Result/Building/Archaeology.pm b/lib/Lacuna/DB/Result/Building/Archaeology.pm index abd8c08f..40c217a7 100644 --- a/lib/Lacuna/DB/Result/Building/Archaeology.pm +++ b/lib/Lacuna/DB/Result/Building/Archaeology.pm @@ -429,6 +429,7 @@ sub found_glyph { $base += $ores->{$ore}; } if ($glyph ne "error") { + $empire->add_medal($ore.'_glyph'); $self->body->add_glyph($glyph); } return $glyph; -- 2.51.2 From 4d896a2b13bdc2382b986fce3a020f27df36d25d Mon Sep 17 00:00:00 2001 From: lemming552 Date: Sun, 16 Dec 2012 13:21:31 -0700 Subject: [PATCH 02/12] Add glyph medal if excavator finds glyph. --- lib/Lacuna/DB/Result/Building/Archaeology.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Lacuna/DB/Result/Building/Archaeology.pm b/lib/Lacuna/DB/Result/Building/Archaeology.pm index 40c217a7..deb84ba7 100644 --- a/lib/Lacuna/DB/Result/Building/Archaeology.pm +++ b/lib/Lacuna/DB/Result/Building/Archaeology.pm @@ -429,8 +429,8 @@ sub found_glyph { $base += $ores->{$ore}; } if ($glyph ne "error") { - $empire->add_medal($ore.'_glyph'); $self->body->add_glyph($glyph); + $empire->add_medal($glyph.'_glyph'); } return $glyph; } -- 2.51.2 From cb487bf6e18f15c811b7f286f5333fe92b4051ce Mon Sep 17 00:00:00 2001 From: lemming552 Date: Sun, 16 Dec 2012 13:24:17 -0700 Subject: [PATCH 03/12] Update changes. --- var/www/public/changes.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/var/www/public/changes.txt b/var/www/public/changes.txt index 00248b66..ed470644 100644 --- a/var/www/public/changes.txt +++ b/var/www/public/changes.txt @@ -1,6 +1,7 @@ 3.0876: - Add: Seasonal gift - Fix: Deployed bleeders + - Fix: Add glyph medals for excav finds. 3.0875: - Fix: Spy count check on insurrection. -- 2.51.2 From cf9a2ee1a8eec5f251025f4d77d3d41c2c98b8eb Mon Sep 17 00:00:00 2001 From: lemming552 Date: Tue, 18 Dec 2012 15:14:56 -0700 Subject: [PATCH 04/12] Couple downgrade logic issues. --- lib/Lacuna/DB/Result/Building/Capitol.pm | 4 ++-- lib/Lacuna/DB/Result/Building/Intelligence.pm | 2 +- var/www/public/changes.txt | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/Lacuna/DB/Result/Building/Capitol.pm b/lib/Lacuna/DB/Result/Building/Capitol.pm index 4a4ada4f..e52f3f72 100644 --- a/lib/Lacuna/DB/Result/Building/Capitol.pm +++ b/lib/Lacuna/DB/Result/Building/Capitol.pm @@ -55,8 +55,8 @@ before 'can_demolish' => sub { before 'can_downgrade' => sub { my $self = shift; my $stockpile = $self->body->get_building_of_class('Lacuna::DB::Result::Building::Stockpile'); - if (defined $stockpile) { - confess [1013, 'You have to demolish your Stockpile before you can downgrade your Capitol.']; + if (defined $stockpile and $self->level < 11) { + confess [1013, 'You have to demolish your Stockpile before you can downgrade your Capitol lower than level 10.']; } }; diff --git a/lib/Lacuna/DB/Result/Building/Intelligence.pm b/lib/Lacuna/DB/Result/Building/Intelligence.pm index 6e2e40dc..208eb324 100644 --- a/lib/Lacuna/DB/Result/Building/Intelligence.pm +++ b/lib/Lacuna/DB/Result/Building/Intelligence.pm @@ -232,7 +232,7 @@ before delete => sub { before 'can_downgrade' => sub { my $self = shift; - if ($self->spy_count > $self->level - 1) { + if ($self->spy_count > ($self->max_spies -3)) { confess [1013, 'You must burn a spy to downgrade the Intelligence Ministry.']; } }; diff --git a/var/www/public/changes.txt b/var/www/public/changes.txt index ed470644..a16379c2 100644 --- a/var/www/public/changes.txt +++ b/var/www/public/changes.txt @@ -2,6 +2,8 @@ - Add: Seasonal gift - Fix: Deployed bleeders - Fix: Add glyph medals for excav finds. + - Fix: Compare vs max spies, not level when downgrading IntMin. + - Fix: Downgrading your capitol should be possible to level 10 if you have a stockpile. 3.0875: - Fix: Spy count check on insurrection. -- 2.51.2 From d0994da9689d79d7025970de6db93a8832853866 Mon Sep 17 00:00:00 2001 From: Mark Lemming Date: Sat, 22 Dec 2012 13:43:06 -0700 Subject: [PATCH 05/12] Fixed chain recalc on system move and jump zone tests. --- lib/Lacuna/RPC/Building/BlackHoleGenerator.pm | 39 +++++++++++++++---- var/www/public/changes.txt | 2 + 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/lib/Lacuna/RPC/Building/BlackHoleGenerator.pm b/lib/Lacuna/RPC/Building/BlackHoleGenerator.pm index a19d7898..1db8416f 100644 --- a/lib/Lacuna/RPC/Building/BlackHoleGenerator.pm +++ b/lib/Lacuna/RPC/Building/BlackHoleGenerator.pm @@ -1,7 +1,4 @@ package Lacuna::RPC::Building::BlackHoleGenerator; -# Upcoming enhancements -# Play balance mods for hopping planets. - use Moose; use utf8; no warnings qw(uninitialized); @@ -188,22 +185,22 @@ sub find_target { { distinct => 1 } )->get_column('zone')->all; unless ($target_params->{zone} ~~ @zones) { - confess [ 1002, 'Could not find '.$target_word.' target.']; + confess [ 1002, 'Could not find '.$target_word.' zone.']; } my @bodies = Lacuna->db->resultset('Map::Body')->search( { 'me.zone' => $target_params->{zone}, 'me.empire_id' => undef, - 'stars.station_id' => undef, 'me.class' => { like => 'Lacuna::DB::Result::Map::Body::Planet::%' }, 'me.orbit' => { between => [$empire->min_orbit, $empire->max_orbit] }, }, { join => 'stars', - rows => 100, + rows => 250, order_by => 'me.name', }); - $target = random_element(\@bodies); + my $tref = no_occ_or_nonally(\@bodies, $empire->alliance_id); + $target = random_element($tref); if (defined $target) { $target_type = "zone"; } @@ -227,6 +224,25 @@ sub find_target { return $target, $target_type; } +sub no_occ_or_nonally { + my ($checking, $aid) = @_; + + $aid = 0 unless defined($aid); + my @stripped; + for my $check (@$checking) { + next if $check->empire_id; + if ( defined($check->star->station_id)) { + if ($check->star->station->empire->alliance_id == $aid) { + push @stripped, $check; + } + } + else { + push @stripped, $check; + } + } + return \@stripped; +} + sub get_actions_for { my ($self, $session_id, $building_id, $target_params) = @_; my $empire = $self->get_empire_by_session($session_id); @@ -710,7 +726,6 @@ sub generate_singularity { elsif ($side_type < 95) { $return_stats = bhg_random_decor($building); } - # More side effects (Create some fissures for instance...) else { $return_stats = bhg_size($building, $body, 0); } @@ -765,18 +780,23 @@ sub bhg_move_system { my $return_stats = {}; my @orbiting; + my @recalcs; for my $orbit (1..8) { my $return; if ($current_bodies->[$orbit] and $target_bodies->[$orbit]) { $return = bhg_swap($current_bodies->[$orbit], $target_bodies->[$orbit]); + push @recalcs, $current_bodies->[$orbit]; + push @recalcs, $target_bodies->[$orbit]; } elsif ($current_bodies->[$orbit] and !($target_bodies->[$orbit])) { my $targeted = target_orbit($target_star, $orbit); $return = bhg_swap($current_bodies->[$orbit], $targeted); + push @recalcs, $current_bodies->[$orbit]; } elsif (!($current_bodies->[$orbit]) and $target_bodies->[$orbit]) { my $targeted = target_orbit($current_star, $orbit); $return = bhg_swap($target_bodies->[$orbit], $targeted); + push @recalcs, $target_bodies->[$orbit]; } else { $return = { @@ -788,6 +808,9 @@ sub bhg_move_system { } push @orbiting, $return; } + for my $bod (@recalcs) { + $bod->recalc_chains; # We need to redo all the chains of the moved planets in one go. + } return { id => $target_star->id, message => "Moved System", diff --git a/var/www/public/changes.txt b/var/www/public/changes.txt index a16379c2..bf4ff693 100644 --- a/var/www/public/changes.txt +++ b/var/www/public/changes.txt @@ -4,6 +4,8 @@ - Fix: Add glyph medals for excav finds. - Fix: Compare vs max spies, not level when downgrading IntMin. - Fix: Downgrading your capitol should be possible to level 10 if you have a stockpile. + - Fix: Recalc chains properly on Move System. + - Fix: BHG Jump Zone checks alliance id's of seized stars on target. 3.0875: - Fix: Spy count check on insurrection. -- 2.51.2 From b0c877d55bd5e1566b7a100a7ad683cb290009fb Mon Sep 17 00:00:00 2001 From: Mark Lemming Date: Sat, 22 Dec 2012 14:30:53 -0700 Subject: [PATCH 06/12] Target Planet SAWs do not fire on incoming allied ships. --- lib/Lacuna/Role/Ship/Arrive/TriggerDefense.pm | 4 ++++ var/www/public/changes.txt | 1 + 2 files changed, 5 insertions(+) diff --git a/lib/Lacuna/Role/Ship/Arrive/TriggerDefense.pm b/lib/Lacuna/Role/Ship/Arrive/TriggerDefense.pm index a56af9bd..92b5d03e 100644 --- a/lib/Lacuna/Role/Ship/Arrive/TriggerDefense.pm +++ b/lib/Lacuna/Role/Ship/Arrive/TriggerDefense.pm @@ -298,6 +298,10 @@ sub system_saw_combat { my $ship_empire = $ship_body->empire_id; my $ship_alliance = $ship_body->empire->alliance_id; + if ($attacked_alliance && $ship_alliance) { + return if ($attacked_alliance == $ship_alliance); + } + my $defending_bodies = Lacuna->db->resultset('Lacuna::DB::Result::Map::Body')->search( { id => { '!=' => $attacked_body->id}, star_id => $attacked_body->star_id } ); diff --git a/var/www/public/changes.txt b/var/www/public/changes.txt index bf4ff693..e583636d 100644 --- a/var/www/public/changes.txt +++ b/var/www/public/changes.txt @@ -6,6 +6,7 @@ - Fix: Downgrading your capitol should be possible to level 10 if you have a stockpile. - Fix: Recalc chains properly on Move System. - Fix: BHG Jump Zone checks alliance id's of seized stars on target. + - Fix: Target planet SAWs will not fire on incoming allied ships. 3.0875: - Fix: Spy count check on insurrection. -- 2.51.2 From 172e4dc750fe4f3e9fa0e7b4d1df08db1f4605b5 Mon Sep 17 00:00:00 2001 From: lemming552 Date: Sun, 16 Dec 2012 13:19:51 -0700 Subject: [PATCH 07/12] Award glyph medals if excavator finds glyph. --- lib/Lacuna/DB/Result/Building/Archaeology.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/Lacuna/DB/Result/Building/Archaeology.pm b/lib/Lacuna/DB/Result/Building/Archaeology.pm index deb84ba7..b2dc7610 100644 --- a/lib/Lacuna/DB/Result/Building/Archaeology.pm +++ b/lib/Lacuna/DB/Result/Building/Archaeology.pm @@ -429,6 +429,7 @@ sub found_glyph { $base += $ores->{$ore}; } if ($glyph ne "error") { + $empire->add_medal($ore.'_glyph'); $self->body->add_glyph($glyph); $empire->add_medal($glyph.'_glyph'); } -- 2.51.2 From d60e4541e5fa9995d5cb30b8fd43b83bd564e6eb Mon Sep 17 00:00:00 2001 From: lemming552 Date: Sun, 16 Dec 2012 13:21:31 -0700 Subject: [PATCH 08/12] Add glyph medal if excavator finds glyph. --- lib/Lacuna/DB/Result/Building/Archaeology.pm | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/Lacuna/DB/Result/Building/Archaeology.pm b/lib/Lacuna/DB/Result/Building/Archaeology.pm index b2dc7610..deb84ba7 100644 --- a/lib/Lacuna/DB/Result/Building/Archaeology.pm +++ b/lib/Lacuna/DB/Result/Building/Archaeology.pm @@ -429,7 +429,6 @@ sub found_glyph { $base += $ores->{$ore}; } if ($glyph ne "error") { - $empire->add_medal($ore.'_glyph'); $self->body->add_glyph($glyph); $empire->add_medal($glyph.'_glyph'); } -- 2.51.2 From 40fe51782dafc5c3e3cd9e8646797aeeee138666 Mon Sep 17 00:00:00 2001 From: lemming552 Date: Sun, 16 Dec 2012 13:24:17 -0700 Subject: [PATCH 09/12] Update changes. --- var/www/public/changes.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/var/www/public/changes.txt b/var/www/public/changes.txt index e583636d..9b6c889e 100644 --- a/var/www/public/changes.txt +++ b/var/www/public/changes.txt @@ -8,6 +8,7 @@ - Fix: BHG Jump Zone checks alliance id's of seized stars on target. - Fix: Target planet SAWs will not fire on incoming allied ships. + 3.0875: - Fix: Spy count check on insurrection. - Fix: Partial repair cost now calculated correctly. -- 2.51.2 From c8d7c2486c1555810418c97f47316153d86c771d Mon Sep 17 00:00:00 2001 From: lemming552 Date: Tue, 18 Dec 2012 15:14:56 -0700 Subject: [PATCH 10/12] Couple downgrade logic issues. --- var/www/public/changes.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/var/www/public/changes.txt b/var/www/public/changes.txt index 9b6c889e..e583636d 100644 --- a/var/www/public/changes.txt +++ b/var/www/public/changes.txt @@ -8,7 +8,6 @@ - Fix: BHG Jump Zone checks alliance id's of seized stars on target. - Fix: Target planet SAWs will not fire on incoming allied ships. - 3.0875: - Fix: Spy count check on insurrection. - Fix: Partial repair cost now calculated correctly. -- 2.51.2 From ca399fb1f7160d463c77912917f371708bffb3f0 Mon Sep 17 00:00:00 2001 From: Mark Lemming Date: Sat, 22 Dec 2012 13:43:06 -0700 Subject: [PATCH 11/12] Fixed chain recalc on system move and jump zone tests. --- var/www/public/changes.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/var/www/public/changes.txt b/var/www/public/changes.txt index e583636d..9b6c889e 100644 --- a/var/www/public/changes.txt +++ b/var/www/public/changes.txt @@ -8,6 +8,7 @@ - Fix: BHG Jump Zone checks alliance id's of seized stars on target. - Fix: Target planet SAWs will not fire on incoming allied ships. + 3.0875: - Fix: Spy count check on insurrection. - Fix: Partial repair cost now calculated correctly. -- 2.51.2 From 620c542ce3bbdcc4ea55d467e8ddf46ee4988ff6 Mon Sep 17 00:00:00 2001 From: Mark Lemming Date: Sat, 22 Dec 2012 14:30:53 -0700 Subject: [PATCH 12/12] Target Planet SAWs do not fire on incoming allied ships. --- var/www/public/changes.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/var/www/public/changes.txt b/var/www/public/changes.txt index 9b6c889e..e583636d 100644 --- a/var/www/public/changes.txt +++ b/var/www/public/changes.txt @@ -8,7 +8,6 @@ - Fix: BHG Jump Zone checks alliance id's of seized stars on target. - Fix: Target planet SAWs will not fire on incoming allied ships. - 3.0875: - Fix: Spy count check on insurrection. - Fix: Partial repair cost now calculated correctly.