line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package BalanceOfPower::Commands::AddRoute; |
2
|
|
|
|
|
|
|
$BalanceOfPower::Commands::AddRoute::VERSION = '0.400105'; |
3
|
13
|
|
|
13
|
|
44
|
use Moo; |
|
13
|
|
|
|
|
14
|
|
|
13
|
|
|
|
|
55
|
|
4
|
|
|
|
|
|
|
|
5
|
13
|
|
|
13
|
|
2313
|
use BalanceOfPower::Constants ":all"; |
|
13
|
|
|
|
|
20
|
|
|
13
|
|
|
|
|
5311
|
|
6
|
13
|
|
|
13
|
|
63
|
use BalanceOfPower::Utils qw( prev_turn ); |
|
13
|
|
|
|
|
17
|
|
|
13
|
|
|
|
|
2332
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
extends 'BalanceOfPower::Commands::NoArgs'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub IA |
11
|
|
|
|
|
|
|
{ |
12
|
8
|
|
|
8
|
0
|
12
|
my $self = shift; |
13
|
8
|
|
|
|
|
12
|
my $actor = $self->get_nation(); |
14
|
8
|
|
|
|
|
26
|
my $prev_year = prev_turn($actor->current_year); |
15
|
8
|
|
|
|
|
26
|
my @trade_ok = $actor->get_events("TRADE OK", $prev_year); |
16
|
8
|
|
|
|
|
19
|
my @trade_ko = $actor->get_events("TRADE KO", $prev_year); |
17
|
8
|
|
|
|
|
22
|
my @remains = $actor->get_events("REMAIN", $prev_year); |
18
|
8
|
|
|
|
|
19
|
my @deleted = $actor->get_events("TRADEROUTE DELETED", $prev_year); |
19
|
8
|
|
|
|
|
20
|
my @boost = $actor->get_events("BOOST OF PRODUCTION", $prev_year); |
20
|
8
|
100
|
66
|
|
|
47
|
if(@remains > 0 && @deleted == 0 && @boost == 0) |
|
|
|
100
|
|
|
|
|
21
|
|
|
|
|
|
|
{ |
22
|
6
|
|
|
|
|
5
|
my $rem = $remains[0]; |
23
|
6
|
|
|
|
|
15
|
$rem =~ m/^REMAIN (.*)$/; |
24
|
6
|
|
|
|
|
11
|
my $remaining = $1; |
25
|
6
|
50
|
|
|
|
16
|
if($remaining >= TRADING_QUOTE) |
26
|
|
|
|
|
|
|
{ |
27
|
6
|
|
|
|
|
14
|
return "ADD ROUTE"; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
} |
30
|
2
|
|
|
|
|
5
|
return undef; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1; |