File Coverage

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


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