| 1 | package BalanceOfPower::Commands::DeclareWar; | ||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 11 | $BalanceOfPower::Commands::DeclareWar::VERSION = '0.300010'; | |||||||||||||||||||||||||||||||||||||||||||||
| 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 | sub get_available_targets | ||||||||||||||||||||||||||||||||||||||||||||||
| 14 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_available_targets: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 0 | my @targets = $self->SUPER::get_available_targets(); | |||||||||||||||||||||||||||||||||||||||||||||
| 17 | 0 | my @out = (); | |||||||||||||||||||||||||||||||||||||||||||||
| 18 | 0 | for(@targets) | |||||||||||||||||||||||||||||||||||||||||||||
| 19 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 0 | my $t = $_; | |||||||||||||||||||||||||||||||||||||||||||||
| 21 | 0 | ▶ | if((! $self->world->is_under_influence($t) || $self->world->is_under_influence($t) ne $self->actor) && | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
!$self->world->is_under_influence($t) || $self->world->is_under_influence($t) ne $self->actor and not $self->world->war_busy($t)
not $self->world->is_under_influence($t) or $self->world->is_under_influence($t) ne $self->actor
MC/DC0%0/3
!$self->world->is_under_influence($t) || $self->world->is_under_influence($t) ne $self->actor and not $self->world->war_busy($t)
not $self->world->is_under_influence($t)
$self->world->is_under_influence($t) ne $self->actor
not $self->world->war_busy($t)
Truth table0%0/5
not(A) or B and not(C)
A= not $self->world->is_under_influence($t)B= $self->world->is_under_influence($t) ne $self->actorC= not $self->world->war_busy($t)
| |||||||||||||||||||||||||||||||||||||||||||||||
| 22 | ! $self->world->war_busy($t)) | ||||||||||||||||||||||||||||||||||||||||||||||
| 23 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 0 | push @out, $t; | |||||||||||||||||||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | return @out; | |||||||||||||||||||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||
| 31 | sub IA | ||||||||||||||||||||||||||||||||||||||||||||||
| 32 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
IA: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | my $actor = $self->get_nation(); | |||||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | my @choose = $self->world->shuffle("Choosing someone to declare war to for ". $actor->name , $self->get_available_targets()); | |||||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | for(@choose) | |||||||||||||||||||||||||||||||||||||||||||||
| 37 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | my $enemy = $self->world->get_nation($_); | |||||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | ▶ | if($actor->good_prey($enemy, $self->world)) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 40 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | return "DECLARE WAR TO " . $enemy->name; | |||||||||||||||||||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 11 | 1; | |||||||||||||||||||||||||||||||||||||||||||||