line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Settlers::Event::YearOfPlenty; |
2
|
|
|
|
|
|
|
$Settlers::Event::YearOfPlenty::VERSION = '0.07'; |
3
|
2
|
|
|
2
|
|
9
|
use strict; |
|
2
|
|
|
1
|
|
3
|
|
|
2
|
|
|
|
|
48
|
|
|
1
|
|
|
|
|
952
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
23
|
|
4
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
1
|
|
3
|
|
|
2
|
|
|
|
|
55
|
|
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
29
|
|
5
|
2
|
|
|
2
|
|
8
|
use List::Util 'sum'; |
|
2
|
|
|
1
|
|
4
|
|
|
2
|
|
|
|
|
364
|
|
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
396
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
0
|
5
|
sub new { bless {}, shift } |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub validate |
10
|
|
|
|
|
|
|
{ |
11
|
1
|
|
|
1
|
0
|
3
|
my ($self, $trade) = @_; |
12
|
1
|
50
|
33
|
|
|
15
|
die 'calculate requires a trade argument' |
13
|
|
|
|
|
|
|
unless $trade && $trade->isa('Settlers::Game::Trade');; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
die 'YearOfPlenty only permits up to 2 resources to be taken for 1 player' |
16
|
1
|
50
|
33
|
|
|
3
|
unless 2 == @{$trade->players} && -2 == sum map {$_->amount} @{$trade->resources('bank')}; |
|
1
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
4
|
|
17
|
1
|
|
|
|
|
4
|
return 1; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
1; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
__END__ |