line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package BalanceOfPower::Commands::DeclareWar; |
2
|
|
|
|
|
|
|
$BalanceOfPower::Commands::DeclareWar::VERSION = '0.400115'; |
3
|
13
|
|
|
13
|
|
130
|
use v5.10; |
|
13
|
|
|
|
|
37
|
|
4
|
13
|
|
|
13
|
|
76
|
use Moo; |
|
13
|
|
|
|
|
16
|
|
|
13
|
|
|
|
|
64
|
|
5
|
|
|
|
|
|
|
|
6
|
13
|
|
|
13
|
|
2936
|
use Array::Utils qw(intersect); |
|
13
|
|
|
|
|
24
|
|
|
13
|
|
|
|
|
666
|
|
7
|
|
|
|
|
|
|
|
8
|
13
|
|
|
13
|
|
61
|
use BalanceOfPower::Constants ":all"; |
|
13
|
|
|
|
|
17
|
|
|
13
|
|
|
|
|
6954
|
|
9
|
13
|
|
|
13
|
|
74
|
use BalanceOfPower::Utils qw( prev_turn ); |
|
13
|
|
|
|
|
14
|
|
|
13
|
|
|
|
|
3737
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
extends 'BalanceOfPower::Commands::InMilitaryRange'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub get_available_targets |
14
|
|
|
|
|
|
|
{ |
15
|
29
|
|
|
29
|
0
|
30
|
my $self = shift; |
16
|
29
|
|
|
|
|
114
|
my @targets = $self->SUPER::get_available_targets(); |
17
|
29
|
|
|
|
|
37
|
my @out = (); |
18
|
29
|
|
|
|
|
65
|
for(@targets) |
19
|
|
|
|
|
|
|
{ |
20
|
10
|
|
|
|
|
19
|
my $t = $_; |
21
|
10
|
50
|
33
|
|
|
40
|
if((! $self->world->is_under_influence($t) || $self->world->is_under_influence($t) ne $self->actor) && |
|
|
|
33
|
|
|
|
|
22
|
|
|
|
|
|
|
! $self->world->war_busy($t)) |
23
|
|
|
|
|
|
|
{ |
24
|
10
|
|
|
|
|
29
|
push @out, $t; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
} |
27
|
29
|
|
|
|
|
517
|
return @out; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub IA |
32
|
|
|
|
|
|
|
{ |
33
|
29
|
|
|
29
|
0
|
54
|
my $self = shift; |
34
|
29
|
|
|
|
|
70
|
my $actor = $self->get_nation(); |
35
|
29
|
|
|
|
|
141
|
my @choose = $self->world->shuffle("Choosing someone to declare war to for ". $actor->name , $self->get_available_targets()); |
36
|
29
|
|
|
|
|
79
|
for(@choose) |
37
|
|
|
|
|
|
|
{ |
38
|
10
|
|
|
|
|
58
|
my $enemy = $self->world->get_nation($_); |
39
|
10
|
100
|
|
|
|
50
|
if($actor->good_prey($enemy, $self->world)) |
40
|
|
|
|
|
|
|
{ |
41
|
1
|
|
|
|
|
6
|
return "DECLARE WAR TO " . $enemy->name; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
} |
44
|
28
|
|
|
|
|
83
|
return undef; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |