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