blib/lib/BalanceOfPower/Commands/RecallMilitarySupport.pm untested

filter: Statementstmt 0.0% 0 / 22 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 32 CC 3 SCAR 19.5
CC
3
Cov
0%
IA
12.0
get_available_targets
2.0
BEGIN
2.0
CRAP 7.0
1 package BalanceOfPower::Commands::RecallMilitarySupport;
2 $BalanceOfPower::Commands::RecallMilitarySupport::VERSION = '0.300010';
3 use Moo;
4  
5 use BalanceOfPower::Constants ':all';
6  
7 extends 'BalanceOfPower::Commands::TargetNation';
8  
9 sub get_available_targets
10 {
11 my $self = shift;
12 my @supported = $self->world->supporter($self->actor);
13 my @out = ();
14 for(@supported)
15 {
16 push @out, $_->destination($self->actor);
17 }
18 return @out;
19 }
20  
21 sub IA
22 {
23 my $self = shift;
24 my $actor = $self->get_nation();
25 if($actor->army <= ARMY_TO_RECALL_SUPPORT)
26 {
27 my @supports = $self->get_available_targets();
28 if(@supports > 0)
29 {
30 @supports = $self->world->shuffle("Choosing support to recall", @supports);
31 return "RECALL MILITARY SUPPORT " . $supports[0];
32 }
33 }
34 return undef;
35 }
36  
37 1;