File Coverage

lib/BalanceOfPower/Commands/MilitaryAid.pm
Criterion Covered Total %
statement 13 14 92.8
branch 2 2 100.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.400110';
3 13     13   42 use Moo;
  13         12  
  13         1461  
4 13     13   7276 use BalanceOfPower::Constants ":all";
  13         768  
  13         6400  
5              
6              
7             extends 'BalanceOfPower::Commands::TargetNation';
8              
9             sub IA
10             {
11 8     8 0 10 my $self = shift;
12 8         17 my $actor = $self->get_nation();
13              
14 8         51 my @friends = $self->world->shuffle("Choosing nation to military aid for " . $actor->name, $self->world->get_friends($actor->name));
15 8         21 for(@friends)
16             {
17 10         12 my $f = $_;
18 10 100       33 if($self->world->get_nation($f)->army < MINIMUM_ARMY_FOR_AID)
19             {
20 8         22 return "MILITARY AID FOR $f";
21             }
22             }
23 0           return undef;
24             }
25              
26             1;