Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update attacking schemes.

  • Loading branch information...
commit b8f4750869743bc1d2b7c6368ecd0854bcada44a 1 parent c57d6b1
@lemming552 lemming552 authored
View
34 bin/diablotin/send_attack.pl
@@ -26,9 +26,9 @@
out('Started');
my $start = time;
-if ($randomize) {
- sleep randint(0, 60*60*18); # attack anytime in the next 18 hours.
-}
+#if ($randomize) {
+# sleep randint(0, 60*60*18); # attack anytime in the next 18 hours.
+#}
out('Loading DB');
@@ -36,23 +36,32 @@
our $ai = Lacuna::AI::Diablotin->new;
my $config = Lacuna->config;
+my $cache = Lacuna->cache;
out('Looping through colonies...');
my $colonies = $ai->empire->planets;
my @attacks;
+my @zones = Lacuna->db->resultset('Map::Star')->search(
+ undef,
+ { distinct => 1 }
+ )->get_column('zone')->all;
+
while (my $attacking_colony = $colonies->next) {
+ next if ($cache->get('diablotin_attack',$attacking_colony->id));
out('Found colony to attack from named '.$attacking_colony->name);
- out('Finding target body to attack...');
+ my @tzones = adjacent_zones($attacking_colony->zone, \@zones);
+ out(sprintf("Find body to attack from %s into %s", $attacking_colony->zone, join(",",@tzones)));
my $targets = $db->resultset('Lacuna::DB::Result::Map::Body')->search({
empire_id => { '>' => 1 },
'empire.is_isolationist' => 0,
+ zone => { 'in' => \@tzones },
},
{
order_by => 'rand()',
rows => 4,
join => 'empire',
});
- my @ships = qw(thud placebo placebo2 placebo3);
+ my @ships = qw(bleeder thud placebo placebo2 placebo3);
while (my $target_colony = $targets->next) {
if ($target_colony->in_neutral_area) {
out($target_colony->name." in Neutral Area, skipping.");
@@ -61,6 +70,8 @@
out('Attacking '.$target_colony->name);
push @attacks, $ai->start_attack($attacking_colony, $target_colony, [shift @ships]);
}
+ my $rest = randint(48,72);
+ $cache->set('diablotin_attack',$attacking_colony->id, 1, 60 * 60 * $rest);
}
out("Waiting on attacks...");
@@ -79,6 +90,19 @@
## SUBROUTINES
###############
+sub adjacent_zones {
+ my ($azone, $zones) = @_;
+
+ my @tzones;
+ my ($ax,$ay) = split('\|', $azone, 2);
+ for my $x (0..2) {
+ for my $y (0..2) {
+ my $tzone = join("|",$x+$ax-1,$y+$ay-1);
+ push @tzones, $tzone if (grep { $tzone eq $_ } @$zones);
+ }
+ }
+ return @tzones;
+}
sub out {
my $message = shift;
View
2  bin/run_daily.sh
@@ -5,8 +5,6 @@ perl trickle_essentia_veins.pl
perl determine_lottery_winner.pl
perl alert_inactive_users.pl
perl rotate_taxes_paid.pl
-perl diablotin/send_attack.pl&
-perl saben/send_attack.pl&
perl clean_up_mail.pl
perl record_rpc.pl
perl util/check_spy_count.pl --burn
View
3  bin/run_hourly.sh
@@ -11,11 +11,10 @@ perl tick_parliament.pl >>/tmp/hourly.log 2>>/tmp/hourly.log
perl add_missions.pl >>/tmp/hourly.log 2>>/tmp/hourly.log
perl clean_up_market.pl >>/tmp/hourly.log 2>>/tmp/hourly.log
perl trelvestian/hourly_update.pl >>/tmp/hourly.log 2>>/tmp/hourly.log
-perl trelvestian/send_attack.pl >>/tmp/hourly.log 2>>/tmp/hourly.log &
perl diablotin/hourly_update.pl >>/tmp/hourly.log 2>>/tmp/hourly.log
perl saben/hourly_update.pl >>/tmp/hourly.log 2>>/tmp/hourly.log
perl delambert/hourly_update.pl >>/tmp/hourly.log 2>>/tmp/hourly.log
perl cult/hourly_update.pl >>/tmp/hourly.log 2>>/tmp/hourly.log
perl tick_fissures.pl >>/tmp/tick_fissures.log 2>>/tmp/tick_fissures.log
perl test_weather.pl >>/tmp/test_weather.csv 2>/tmp/test_weather.log
-
+perl trelvestian/send_attack.pl >>/tmp/attack_trel.log 2>>/tmp/attack_trel.log &
View
3  bin/run_two_hourly.sh
@@ -4,4 +4,5 @@ cd /data/Lacuna-Server/bin
perl tick_planets.pl >>/var/log/tick_planets.log 2>>/var/log/tick_planets.log &
perl tick_spies.pl >>/tmp/tick_spies.log 2>>/tmp/tick_spies.log &
perl summarize_server.pl >>/var/log/run_two_hourly.log 2>>/var/log/run_two_hourly.log
-
+perl saben/send_attack.pl >>/tmp/attack_saben.log 2>>/tmp/attack_saben.log &
+perl diablotin/send_attack.pl >>/tmp/attack_diab.log 2>>/tmp/attack_diab.log &
View
12 bin/saben/send_attack.pl
@@ -26,9 +26,9 @@
out('Started');
my $start = time;
-if ($randomize) {
- sleep randint(0, 60*60*12); # attack anytime in the next 12 hours.
-}
+#if ($randomize) {
+# sleep randint(0, 60*60*12); # attack anytime in the next 12 hours.
+#}
out('Loading DB');
@@ -47,6 +47,10 @@
$ai->destroy_world($attacking_colony);
out('Finding target body to attack...');
+ if ($attacking_colony->in_neutral_area or $attacking_colony->in_starter_zone) {
+ out($attacking_colony->name." in Neutral Area or a Starting Zone, skipping.");
+ next;
+ }
my $targets = $db->resultset('Lacuna::DB::Result::Map::Body')->search({
empire_id => { '>' => 1 },
is_isolationist => 0,
@@ -68,7 +72,7 @@
if (defined $target_colony && !$cache->get('saben'.$attacking_colony->id.'-'.$target_colony->empire_id)) {
out('Attacking '.$target_colony->name.' with sweepers and bleeders and snarks');
push @attacks, $ai->start_attack($attacking_colony, $target_colony, [qw(sweeper bleeder snark1 snark2 snark3)]);
- $cache->set('saben_attack',$attacking_colony->id.'-'.$target_colony->empire_id, 1, 60 * 60 * 48);
+ $cache->set('saben_attack',$attacking_colony->id.'-'.$target_colony->empire_id, 1, 60 * 60 * 72);
}
}

0 comments on commit b8f4750

Please sign in to comment.
Something went wrong with that request. Please try again.