lib/BalanceOfPower/Commands/BuildTroops.pm

filter: Statementstmt 34.6% 9 / 26 Branchbran 0.0% 0 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 2 / 4 Podpod 0.0% 0 / 2 totaltotal 25.0% 11 / 44 CC 7 SCAR 32.8
CC
7
Cov
24%
IA
42.0
allowed
6.0
BEGIN
1.0
CRAP 26.6
« blib/lib/BalanceOfPower/Role/Reporter.pm ↑ Summary blib/lib/BalanceOfPower/Commands/MilitarySupport.pm »
1 package BalanceOfPower::Commands::BuildTroops;
2 11 $BalanceOfPower::Commands::BuildTroops::VERSION = '0.300010';
3 11 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 11 ▶use BalanceOfPower::Constants ':all';
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 11 extends 'BalanceOfPower::Commands::NoArgs';
8  
9 sub allowed
10 {
11 0 ▶ my $self = shift;
Subroutine allowed: not called CC=2 SCAR=17.9
Pod undocumented
12 0 my $nation = $self->world->get_nation($self->actor);
13 0 my $other_checks = $self->SUPER::allowed();
14 0 ▶ if($other_checks)
Branch: 1 branch
BranchTrueFalseTotal
if ($other_checks) { } 0 0 0
15 {
16 0 my $export_cost = $nation->build_troops_cost();
17 0 return $nation->production_for_export >= $export_cost;
18 }
19 else
20 {
21 0 return 0;
22 }
23 }
24  
25 sub IA
26 {
27 0 ▶ my $self = shift;
Subroutine IA: not called CC=6 SCAR=37.4
Pod undocumented
28 0 my $actor = $self->get_nation();
29 0 ▶ if($actor->army < MAX_ARMY_FOR_SIZE->[ $actor->size ])
Branch: 1 branch
BranchTrueFalseTotal
if ($actor->army < [9,12,15]->[$actor->size]) 0 0 0
30 {
31 0 ▶ if($actor->army < MINIMUM_ARMY_LIMIT)
Branch: 2 branches
BranchTrueFalseTotal
if ($actor->army < 5) { } 0 0 0
elsif ($actor->army < 10) { } 0 0 0
32 {
33 0 return "BUILD TROOPS";
34 }
35 elsif($actor->army < MEDIUM_ARMY_LIMIT)
36 {
37 0 ▶ if($actor->production_for_export > MEDIUM_ARMY_BUDGET)
Branch: 1 branch
BranchTrueFalseTotal
if ($actor->production_for_export > 40) 0 0 0
38 {
39 0 return "BUILD TROOPS";
40 }
41 }
42 else
43 {
44 0 ▶ if($actor->production_for_export > MAX_ARMY_BUDGET)
Branch: 1 branch
BranchTrueFalseTotal
if ($actor->production_for_export > 60) 0 0 0
45 {
46 0 return "BUILD TROOPS";
47 }
48 }
49 }
50 0 return undef;
51 }
52  
53 11 1;
« blib/lib/BalanceOfPower/Role/Reporter.pm ↑ Summary blib/lib/BalanceOfPower/Commands/MilitarySupport.pm »