lib/BalanceOfPower/Commands/AidInsurgents.pm

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