Permalink
Browse files

Spies steal multiple glyphs.

  • Loading branch information...
1 parent 2a99f85 commit 59d89476070fd8a96fb07c0253d214efd3cb4745 @lemming552 lemming552 committed Mar 10, 2013
Showing with 14 additions and 6 deletions.
  1. +13 −6 lib/Lacuna/DB/Result/Spies.pm
  2. +1 −0 var/www/public/changes.txt
@@ -2335,16 +2335,23 @@ sub steal_glyph {
{task => 'Docked',
type => {'in' => ['cargo_ship',
'smuggler_ship',
+ 'dory',
'galleon',
'freighter',
'hulk',
+ 'hulk_fast',
+ 'hulk_huge',
'barge']}},
{ rows => 1, order_by => 'rand()' }
)->single;
return $self->ship_not_found->id unless defined $ship;
- my $glyph = $on_body->glyph->search(undef, {rows => 1, order_by => 'rand()'})->single;
- return $self->mission_objective_not_found('glyph')->id unless defined $glyph;
+
+ my @glyphs = $on_body->glyph;
+ return $self->mission_objective_not_found('glyph')->id unless scalar @glyphs > 0;
$ship->body($self->from_body);
+ my $glyph = random_element(\@glyphs);
+ my $glyphs_q = $glyph->quantity;
+ my $glyphs_stolen = $self->level > ($glyphs_q/10) ? ($glyphs_q/10) : randint($self->level, $glyphs_q/10);
weaken($ship->{_relationship_data}{body});
$ship->send(
target => $self->on_body,
@@ -2353,20 +2360,20 @@ sub steal_glyph {
spies => [ $self->id ],
glyphs => [ {
name => $glyph->type,
- quantity => 1,
+ quantity => $glyphs_stolen,
} ],
},
);
- my @table = (['Glyph'],[$glyph->type]);
- $on_body->use_glyph($glyph->type, 1);
+ my @table = (['Glyph'],[$glyph->type],[$glyphs_stolen]);
+ $on_body->use_glyph($glyph->type, $glyphs_stolen);
$self->on_body->empire->send_predefined_message(
tags => ['Spies','Alert'],
filename => 'ship_stolen.txt',
params => [$ship->type_formatted, $self->on_body->id, $self->on_body->name],
attachments=> { table => \@table},
);
$self->on_body->add_news(50,
- 'In a daring robbery today a thief absconded with a %s carrying a glyph from %s.',
+ 'In a daring robbery today a thief absconded with a %s carrying glyphs from %s.',
$ship->type_formatted,
$self->on_body->name);
$self->send($self->from_body_id, $ship->date_available);
@@ -2,6 +2,7 @@
- Fix: Library timer was too excessive.
- Mod: Gradual increase in TM range from 465 to 900.
- Mod: Number of halls available passed pack by Halls API.
+ - Mod: Spies can steal more than one glyph.
3.0882:
- Fix: Timers on int ministries get zeroed on flipped planets.

0 comments on commit 59d8947

Please sign in to comment.