File Coverage

lib/BalanceOfPower/Commands/RecallRebelMilitarySupport.pm
Criterion Covered Total %
statement 6 20 30.0
branch 0 4 0.0
condition n/a
subroutine 2 4 50.0
pod 0 2 0.0
total 8 30 26.6


line stmt bran cond sub pod time code
1             package BalanceOfPower::Commands::RecallRebelMilitarySupport;
2             $BalanceOfPower::Commands::RecallRebelMilitarySupport::VERSION = '0.400105';
3 13     13   48 use Moo;
  13         15  
  13         52  
4              
5 13     13   2474 use BalanceOfPower::Constants ':all';
  13         16  
  13         7030  
6              
7             extends 'BalanceOfPower::Commands::TargetNation';
8              
9             sub get_available_targets
10             {
11 0     0 0   my $self = shift;
12 0           my @supported = $self->world->rebel_supporter($self->actor);
13 0           my @out = ();
14 0           for(@supported)
15             {
16 0           push @out, $_->destination($self->actor);
17             }
18 0           return @out;
19             }
20              
21             sub IA
22             {
23 0     0 0   my $self = shift;
24 0           my $actor = $self->get_nation();
25 0 0         if($actor->army <= ARMY_TO_RECALL_SUPPORT)
26             {
27 0           my @supports = $self->get_available_targets();
28 0 0         if(@supports > 0)
29             {
30 0           @supports = $self->world->shuffle("Choosing support to recall", @supports);
31 0           return "RECALL REBEL MILITARY SUPPORT " . $supports[0];
32             }
33             }
34 0           return undef;
35             }
36              
37             1;