lib/BalanceOfPower/Commands/RecallMilitarySupport.pm

filter: Statementstmt 100% 23 / 23 Branchbran 100% 4 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 0.0% 0 / 2 totaltotal 93.9% 31 / 33 CC 4 SCAR 7.6
CC
4
Cov
100%
IA
3.0
get_available_targets
2.0
BEGIN
1.0
CRAP 2.1
« lib/BalanceOfPower/Commands/MilitaryAid.pm ↑ Summary blib/lib/BalanceOfPower.pm »
1 package BalanceOfPower::Commands::RecallMilitarySupport;
2 11 $BalanceOfPower::Commands::RecallMilitarySupport::VERSION = '0.200000';
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::TargetNation';
8  
9 sub get_available_targets
10 {
11 12 ▶ my $self = shift;
Subroutine get_available_targets: called CC=2 SCAR=6.9
Pod undocumented
12 12 my @supported = $self->world->supporter($self->actor);
13 12 my @out = ();
14 12 for(@supported)
15 {
16 1 push @out, $_->destination($self->actor);
17 }
18 12 return @out;
19 }
20  
21 sub IA
22 {
23 15 ▶ my $self = shift;
Subroutine IA: called CC=3 SCAR=11.0
Pod undocumented
24 15 my $actor = $self->get_nation();
25 15 ▶ if($actor->army <= ARMY_TO_RECALL_SUPPORT)
Branch: 1 branch
BranchTrueFalseTotal
if ($actor->army <= 3) 12 3 15
26 {
27 12 my @supports = $self->get_available_targets();
28 12 ▶ if(@supports > 0)
Branch: 1 branch
BranchTrueFalseTotal
if (@supports > 0) 1 11 12
29 {
30 1 @supports = $self->world->shuffle("Choosing support to recall", @supports);
31 1 return "RECALL MILITARY SUPPORT " . $supports[0];
32 }
33 }
34 14 return undef;
35 }
36  
37 11 1;
« lib/BalanceOfPower/Commands/MilitaryAid.pm ↑ Summary blib/lib/BalanceOfPower.pm »