From 425b9d6a91bafffa74bd18de1719780aa138cc7c Mon Sep 17 00:00:00 2001 From: JT Smith Date: Tue, 28 Dec 2010 17:32:36 -0600 Subject: [PATCH] Added "Abduct Operatives" offensive assignment. --- docs/Intelligence.pod | 4 ++ lib/Lacuna/DB/Result/Spies.pm | 58 +++++++++++++++++++++++++ var/messages/bringing_home_abductee.txt | 5 +++ var/messages/spy_abducted.txt | 7 +++ var/www/public/changes.txt | 8 ++-- 5 files changed, 79 insertions(+), 3 deletions(-) create mode 100644 var/messages/bringing_home_abductee.txt create mode 100644 var/messages/spy_abducted.txt diff --git a/docs/Intelligence.pod b/docs/Intelligence.pod index 10316be5..b9c1406a 100644 --- a/docs/Intelligence.pod +++ b/docs/Intelligence.pod @@ -324,6 +324,10 @@ Destroy buildings. Turn spies. If successful they come work for you. +=item Abduct Operatives + +Kidnap a spy and bring him back home. + =item Appropriate Technology Steal plans for buildings that this empire has built, or has in inventory. diff --git a/lib/Lacuna/DB/Result/Spies.pm b/lib/Lacuna/DB/Result/Spies.pm index 1998f562..a822602e 100644 --- a/lib/Lacuna/DB/Result/Spies.pm +++ b/lib/Lacuna/DB/Result/Spies.pm @@ -132,6 +132,10 @@ use constant offensive_assignments => ( task =>'Incite Mutiny', recovery => 60 * 60 * 12, }, + { + task =>'Abduct Operatives', + recovery => 60 * 60 * 12, + }, { task =>'Appropriate Technology', recovery => 60 * 60 * 12, @@ -270,6 +274,7 @@ use constant assignments => ( 'Sabotage Infrastructure', 'Assassinate Operatives', 'Incite Mutiny', + 'Abduct Operatives', 'Appropriate Technology', 'Incite Rebellion', ); @@ -367,6 +372,7 @@ my %skills = ( 'Assassinate Operatives' => 'mayhem_xp', 'Sabotage Infrastructure' => 'mayhem_xp', 'Incite Mutiny' => 'politics_xp', + 'Abduct Operatives' => 'intel_xp', 'Incite Rebellion' => 'politics_xp', ); @@ -385,6 +391,7 @@ my %outcomes = ( 'Assassinate Operatives' => 'assassinate_operatives', 'Sabotage Infrastructure' => 'sabotage_infrastructure', 'Incite Mutiny' => 'incite_mutany', + 'Abduct Operatives' => 'abduct_operatives', 'Incite Rebellion' => 'incite_rebellion', ); @@ -893,6 +900,23 @@ sub rescue_comrades_loss { } } +sub abduct_operatives { + my $self = shift; + given (randint(1,1)) { + when (1) { return $self->abduct_operative(@_) } + } +} + +sub abduct_operatives_loss { + my $self = shift; + given (randint(1,4)) { + when (1) { return $self->capture_kidnapper(@_) } + when (2) { return $self->knock_attacker_unconscious(@_) } + when (3) { return $self->thwart_intelligence(@_) } + when (4) { return $self->kill_intelligence(@_) } + } +} + sub sabotage_resources { my $self = shift; given (randint(1,4)) { @@ -1152,6 +1176,40 @@ sub capture_rebel { return $defender->capture_a_spy($self)->id; } +sub capture_kidnapper { + my ($self, $defender) = @_; + return $self->get_spooked->id unless (defined $defender); + $self->on_body->add_news(50,'Police say they have captured the notorious %s-time kidnapper %s on %s.', randint(10,20), $self->on_body->name, $self->name); + return $defender->capture_a_spy($self)->id; +} + +sub abduct_operative { + my ($self, $defender) = @_; + my $ship = Lacuna->db->resultset('Lacuna::DB::Result::Ships')->search( + {body_id => $self->on_body->id, task => 'Docked', hold_size => { '>=' => 700 }}, + {rows => 1} + )->single; + return $self->ship_not_found unless (defined $ship); + return $self->get_spooked->id unless (defined $defender); + $defender->task('Waiting On Trade'); + $defender->update; + $ship->send( + target => $self->from_body, + direction => 'in', + payload => { spies => [ $self->id ], prisoners => [$defender->id] } + ); + $defender->empire->send_predefined_message( + tags => ['Alert'], + filename => 'spy_abducted.txt', + params => [$defender->format_from, $defender->name], + ); + return $self->empire->send_predefined_message( + tags => ['Alert'], + filename => 'bringing_home_abductee.txt', + params => [$defender->format_from, $self->format_from], + )->id; +} + #sub kill_rebel { # my ($self, $defender) = @_; # return $self->get_spooked->id unless (defined $defender); diff --git a/var/messages/bringing_home_abductee.txt b/var/messages/bringing_home_abductee.txt new file mode 100644 index 00000000..b0901e15 --- /dev/null +++ b/var/messages/bringing_home_abductee.txt @@ -0,0 +1,5 @@ +Got One! +~~~ +I've bagged %s and am on my way home with our new prisoner now. + +%s diff --git a/var/messages/spy_abducted.txt b/var/messages/spy_abducted.txt new file mode 100644 index 00000000..0b61eaaa --- /dev/null +++ b/var/messages/spy_abducted.txt @@ -0,0 +1,7 @@ +Agent Abducted +~~~ +Nobody has seen %s for a while. The current thinking in the Intelligence community is that %s was abducted. + +Regards, + +Your Humble Assistant diff --git a/var/www/public/changes.txt b/var/www/public/changes.txt index a50d4a8d..76f805df 100644 --- a/var/www/public/changes.txt +++ b/var/www/public/changes.txt @@ -1,12 +1,14 @@ 2.4200 - - API now tells you exactly what assignments a spy can be given at the present time and how long the recovery time will be. - Added "Security Sweep" defensive assignment. - - Fixed a crash bug with fleet movement missions. + - Added "Abduct Operatives" offensive assignment. + - You can no longer burn a spy that has been captured. - If you have ships heading to a body that becomes uninhabited while on route, the ships will now turn around and come home instead of falling dead. - If you have spies on a body that becomes uninhabited while they are on the planet, they will teleport home. - You can now only have 1 subspace transporter per planet. That's all that ever made sense anyway. - - Fixed a bug in the genetics ministry where killed spies didn't get killed. - Exposed "max_occupants" on shipyard.get_buildable(). + - API now tells you exactly what assignments a spy can be given at the present time and how long the recovery time will be. + - Fixed a bug in the genetics ministry where killed spies didn't get killed. + - Fixed a crash bug with fleet movement missions. 2.4102 - Fixed bleeders and thuds being added to the normal build queue on striking ground. -- 2.51.2