File Coverage

lib/BalanceOfPower/Commands/MilitaryAid.pm
Criterion Covered Total %
statement 14 14 100.0
branch 1 2 50.0
condition n/a
subroutine 3 3 100.0
pod 0 1 0.0
total 18 20 90.0


line stmt bran cond sub pod time code
1             package BalanceOfPower::Commands::MilitaryAid;
2             $BalanceOfPower::Commands::MilitaryAid::VERSION = '0.400115';
3 13     13   48 use Moo;
  13         17  
  13         2066  
4 13     13   5429 use BalanceOfPower::Constants ":all";
  13         14  
  13         7978  
5              
6              
7             extends 'BalanceOfPower::Commands::TargetNation';
8              
9             sub IA
10             {
11 6     6 0 10 my $self = shift;
12 6         12 my $actor = $self->get_nation();
13              
14 6         50 my @friends = $self->world->shuffle("Choosing nation to military aid for " . $actor->name, $self->world->get_friends($actor->name));
15 6         21 for(@friends)
16             {
17 1         3 my $f = $_;
18 1 50       5 if($self->world->get_nation($f)->army < MINIMUM_ARMY_FOR_AID)
19             {
20 1         4 return "MILITARY AID FOR $f";
21             }
22             }
23 5         24 return undef;
24             }
25              
26             1;