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

filter: Statementstmt 0.0% 0 / 28 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 37 CC 2 SCAR 11.5
CC
2
Cov
0%
IA
6.0
BEGIN
2.0
BEGIN
2.0
CRAP 3.1
1 package BalanceOfPower::Commands::AidInsurgents;
2 $BalanceOfPower::Commands::AidInsurgents::VERSION = '0.300010';
3 use v5.10;
4 use Moo;
5  
6 use Array::Utils qw(intersect);
7  
8 use BalanceOfPower::Constants ":all";
9 use BalanceOfPower::Utils qw( prev_turn );
10  
11 extends 'BalanceOfPower::Commands::InMilitaryRange';
12  
13  
14 sub IA
15 {
16 my $self = shift;
17 my $actor = $self->get_nation();
18  
19 my @available = $self->get_available_targets();
20 my @crises = $self->world->get_crises($actor->name);
21 my @crisis_enemies;
22 foreach my $c (@crises)
23 {
24 push @crisis_enemies, $c->destination($actor->name);
25 }
26 my @choose = $self->world->shuffle("Choosing insurgents to aid for ". $actor->name , intersect(@available, @crisis_enemies));
27 if(@choose > 0)
28 {
29 return "AID INSURGENTS IN " . $choose[0];
30 }
31 else
32 {
33 return undef;
34 }
35 }
36  
37 1;