Permalink
Browse files

Fixing gratch to not slow spies already done infiltrating.

  • Loading branch information...
1 parent d81d19e commit 9e6d75fadb6ab09663739c592a8d300c4861c7b2 @lemming552 lemming552 committed Jan 6, 2014
View
@@ -7,7 +7,7 @@ use Config::JSON;
useall __PACKAGE__;
-our $VERSION = 3.0899;
+our $VERSION = 3.0900;
my $config = Config::JSON->new('/data/Lacuna-Server/etc/lacuna.conf');
my $db = Lacuna::DB->connect($config->get('db/dsn'),$config->get('db/username'),$config->get('db/password'), { mysql_enable_utf8 => 1});
@@ -23,6 +23,32 @@ after finish_upgrade => sub {
$self->body->add_news(30, sprintf('The agents on %s use techniques handed down for millenia, which they say makes them unbeatable.', $self->body->name));
};
+before 'repair' => sub {
+ my $self = shift;
+ my $db = Lacuna->db;
+ my $now = DateTime->now;
+ my $dtf = $db->storage->datetime_parser;
+ my $i_spies = $db->resultset('Spies')
+ ->search( { on_body_id => $self->body->id,
+ empire_id => { '!=' => $self->body->empire_id },
+ available_on => { '<' => $dtf->format_datetime($now) },
+ task => 'Travelling',
+ });
+ while (my $spy = $i_spies->next) {
+ my $starting_task = $spy->task;
+ $spy->is_available;
+ if ($spy->task eq 'Idle' && $starting_task ne 'Idle') {
+ if (!$spy->empire->skip_spy_recovery) {
+ $spy->empire->send_predefined_message(
+ tags => ['Intelligence'],
+ filename => 'ready_for_assignment.txt',
+ params => [$spy->name, $spy->from_body->id, $spy->from_body->name],
+ );
+ }
+ }
+ }
+};
+
use constant name => 'Gratch\'s Gauntlet';
use constant time_to_build => 0;
use constant max_instances_per_planet => 1;
@@ -337,8 +337,7 @@ sub tick_all_spies {
my $db = Lacuna->db;
my $dtf = $db->storage->datetime_parser;
- my $spies = Lacuna->db
- ->resultset('Spies')
+ my $spies = $db->resultset('Spies')
->search( { available_on => { '<' => $dtf->format_datetime(DateTime->now) },
task => { 'not in' => ['Idle',
'Counter Espionage',
@@ -353,8 +352,6 @@ sub tick_all_spies {
}
my $starting_task = $spy->task;
$spy->is_available;
- my $train_bld;
- my $tr_skill;
if ($spy->task eq 'Idle' && $starting_task ne 'Idle') {
if (!$spy->empire->skip_spy_recovery) {
$spy->empire->send_predefined_message(
@@ -1520,9 +1517,10 @@ sub sabotage_probes_loss {
sub rescue_comrades {
my $self = shift;
- given (randint(1,2)) {
+ given (randint(1,4)) {
when (1) { return $self->escape_prison(@_) }
- when (2) { return $self->knock_defender_unconscious(@_) }
+ when (2) { return $self->escape_prison(@_) }
+ when (3) { return $self->knock_defender_unconscious(@_) }
# when (2) { return $self->kill_guard_and_escape_prison(@_) }
}
}
@@ -1,10 +1,14 @@
+3.0900:
+ - Fix: Gratch's Gauntlet on repair, checks spies current status.
+
3.0899:
- Mod: Different speeds for the various Supply Pods. Smaller the pod, the faster.
- Add: Supply Pod V
- Mod: Saben no longer waste attacks on Isolationists.
- Fix: Stealing planets no longer resets "defenders".
- Fix: Better checking on lack of resource damage.
- Mod: Added more spy statistics.
+ - Mod: Rescued Comrades have same cooldown as rescuer.
3.0898:
- Mod: The Dillon Forge can now take a quantity of plans for splitting.

0 comments on commit 9e6d75f

Please sign in to comment.