| 1 | package BalanceOfPower::Commands::ComTreaty; | ||||||||||||||||||||||||||||
| 2 | 11 | $BalanceOfPower::Commands::ComTreaty::VERSION = '0.200000'; | |||||||||||||||||||||||||||
| 3 | 11 | ▶ | use Moo; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 11 | ▶ | use BalanceOfPower::Utils qw( prev_turn ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 11 | extends 'BalanceOfPower::Commands::TargetRoute'; | |||||||||||||||||||||||||||
| 8 | 11 | with 'BalanceOfPower::Commands::Role::TreatiesUnderLimit'; | |||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | sub get_available_targets | ||||||||||||||||||||||||||||
| 11 | { | ||||||||||||||||||||||||||||
| 12 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
get_available_targets: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 13 | 0 | my @targets = $self->SUPER::get_available_targets(); | |||||||||||||||||||||||||||
| 14 | 0 | my $nation = $self->actor; | |||||||||||||||||||||||||||
| 15 | 0 | @targets = grep {! $self->world->exists_treaty($nation, $_) } @targets; | |||||||||||||||||||||||||||
| 16 | 0 | @targets = grep {! $self->world->diplomacy_status($nation, $_) ne 'HATE' } @targets; | |||||||||||||||||||||||||||
| 17 | 0 | return $self->nations_under_treaty_limit(@targets); | |||||||||||||||||||||||||||
| 18 | } | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | sub IA | ||||||||||||||||||||||||||||
| 21 | { | ||||||||||||||||||||||||||||
| 22 | 13 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
IA: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 23 | 13 | my $actor = $self->get_nation(); | |||||||||||||||||||||||||||
| 24 | 13 | my $prev_year = prev_turn($actor->current_year); | |||||||||||||||||||||||||||
| 25 | 13 | my @trade_ok = $actor->get_events("TRADE OK", $prev_year); | |||||||||||||||||||||||||||
| 26 | 13 | for(@trade_ok) | |||||||||||||||||||||||||||
| 27 | { | ||||||||||||||||||||||||||||
| 28 | 4 | my $route = $_; | |||||||||||||||||||||||||||
| 29 | 4 | $route =~ s/^TRADE OK //; | |||||||||||||||||||||||||||
| 30 | 4 | $route =~ s/ \[.*$//; | |||||||||||||||||||||||||||
| 31 | 4 | my $status = $self->world->diplomacy_status($actor->name, $route); | |||||||||||||||||||||||||||
| 32 | 4 | ▶ | if(! $self->world->exists_treaty($actor->name, $route) && $status ne 'HATE') | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not $self->world->exists_treaty($actor->name, $route) and $status ne "HATE"
MC/DC50%1/2
not $self->world->exists_treaty($actor->name, $route) and $status ne "HATE"
not $self->world->exists_treaty($actor->name, $route)
$status ne "HATE"
Truth table66%2/3
not(A) and B
A= not $self->world->exists_treaty($actor->name, $route)B= $status ne "HATE"
| |||||||||||||||||||||||||||||
| 33 | { | ||||||||||||||||||||||||||||
| 34 | 1 | return "TREATY COM WITH " . $route; | |||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||
| 37 | 12 | return undef; | |||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | 11 | 1; | |||||||||||||||||||||||||||