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

filter: Statementstmt 0.0% 0 / 26 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 3 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 37 CC 4 SCAR 21.2
CC
4
Cov
0%
get_available_targets
12.0
IA
6.0
BEGIN
2.0
CRAP 8.3
1 package BalanceOfPower::Commands::RebelMilitarySupport;
2 $BalanceOfPower::Commands::RebelMilitarySupport::VERSION = '0.300010';
3 use Moo;
4  
5 extends 'BalanceOfPower::Commands::TargetNation';
6  
7 sub get_available_targets
8 {
9 my $self = shift;
10 my $player = $self->actor;
11 my @ns = grep { $self->world->at_civil_war($_) } @{$self->world->nation_names};
12 my @out = ();
13 for(@ns)
14 {
15 my $rebsup = $self->world->rebel_supported($_);
16 if($rebsup)
17 {
18 if($rebsup->node1 eq $player)
19 {
20 push @out, $_;
21 }
22 }
23 else
24 {
25 push @out, $_;
26 }
27 }
28 return @out;
29 }
30  
31 sub IA
32 {
33 my $self = shift;
34 my $player = $self->actor;
35 my @enemies = $self->world->get_hates($self->actor);
36 @enemies = $self->world->shuffle("Choosing enemy for rebel support for " . $self->actor, @enemies);
37 foreach my $e (@enemies)
38 {
39 my $target = $e->destination($self->actor);
40 if($self->good_target($target))
41 {
42 return "REBEL MILITARY SUPPORT " . $e->destination($self->actor);
43 }
44 }
45 }
46  
47 1;