line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Settlers::Event::RoadBuilding; |
2
|
|
|
|
|
|
|
$Settlers::Event::RoadBuilding::VERSION = '0.07'; |
3
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
1
|
|
3
|
|
|
2
|
|
|
|
|
47
|
|
|
1
|
|
|
|
|
903
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
21
|
|
4
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
1
|
|
3
|
|
|
2
|
|
|
|
|
274
|
|
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
259
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub new |
7
|
|
|
|
|
|
|
{ |
8
|
2
|
|
|
2
|
0
|
6
|
my ($class, $player) = @_; |
9
|
2
|
50
|
33
|
|
|
8
|
die 'RoadBuilding requires a player object argument' |
10
|
|
|
|
|
|
|
unless $player && $player->isa('Settlers::Game::Player'); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
bless { |
13
|
2
|
|
|
|
|
6
|
starting_roads => scalar @{$player->roads}, |
|
2
|
|
|
|
|
7
|
|
14
|
|
|
|
|
|
|
player => $player, |
15
|
|
|
|
|
|
|
}, $class; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# has a player built 2 roads since activating road building |
19
|
|
|
|
|
|
|
sub can_build_road |
20
|
|
|
|
|
|
|
{ |
21
|
6
|
|
|
6
|
0
|
13
|
my $self = shift; |
22
|
6
|
50
|
|
|
|
12
|
return $self->{starting_roads} - scalar @{$self->{player}->roads} < 2 ? 1 : 0; |
|
6
|
|
|
|
|
18
|
|
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
1; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
__END__ |