« blib/lib/BalanceOfPower/Role/Reporter.pm
↑ Summary
blib/lib/BalanceOfPower/Commands/MilitarySupport.pm »
| 1 | package BalanceOfPower::Commands::BuildTroops; | ||||||||||||||
| 2 | 11 | $BalanceOfPower::Commands::BuildTroops::VERSION = '0.300010'; | |||||||||||||
| 3 | 11 | ▶ | use Moo; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 4 | |||||||||||||||
| 5 | 11 | ▶ | use BalanceOfPower::Constants ':all'; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 6 | |||||||||||||||
| 7 | 11 | extends 'BalanceOfPower::Commands::NoArgs'; | |||||||||||||
| 8 | |||||||||||||||
| 9 | sub allowed | ||||||||||||||
| 10 | { | ||||||||||||||
| 11 | 0 | ▶ | my $self = shift; | ||||||||||||
|
Subroutine
allowed: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||
| 12 | 0 | my $nation = $self->world->get_nation($self->actor); | |||||||||||||
| 13 | 0 | my $other_checks = $self->SUPER::allowed(); | |||||||||||||
| 14 | 0 | ▶ | if($other_checks) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 15 | { | ||||||||||||||
| 16 | 0 | my $export_cost = $nation->build_troops_cost(); | |||||||||||||
| 17 | 0 | return $nation->production_for_export >= $export_cost; | |||||||||||||
| 18 | } | ||||||||||||||
| 19 | else | ||||||||||||||
| 20 | { | ||||||||||||||
| 21 | 0 | return 0; | |||||||||||||
| 22 | } | ||||||||||||||
| 23 | } | ||||||||||||||
| 24 | |||||||||||||||
| 25 | sub IA | ||||||||||||||
| 26 | { | ||||||||||||||
| 27 | 0 | ▶ | my $self = shift; | ||||||||||||
|
Subroutine
IA: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||
| 28 | 0 | my $actor = $self->get_nation(); | |||||||||||||
| 29 | 0 | ▶ | if($actor->army < MAX_ARMY_FOR_SIZE->[ $actor->size ]) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 30 | { | ||||||||||||||
| 31 | 0 | ▶ | if($actor->army < MINIMUM_ARMY_LIMIT) | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 32 | { | ||||||||||||||
| 33 | 0 | return "BUILD TROOPS"; | |||||||||||||
| 34 | } | ||||||||||||||
| 35 | elsif($actor->army < MEDIUM_ARMY_LIMIT) | ||||||||||||||
| 36 | { | ||||||||||||||
| 37 | 0 | ▶ | if($actor->production_for_export > MEDIUM_ARMY_BUDGET) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 38 | { | ||||||||||||||
| 39 | 0 | return "BUILD TROOPS"; | |||||||||||||
| 40 | } | ||||||||||||||
| 41 | } | ||||||||||||||
| 42 | else | ||||||||||||||
| 43 | { | ||||||||||||||
| 44 | 0 | ▶ | if($actor->production_for_export > MAX_ARMY_BUDGET) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 45 | { | ||||||||||||||
| 46 | 0 | return "BUILD TROOPS"; | |||||||||||||
| 47 | } | ||||||||||||||
| 48 | } | ||||||||||||||
| 49 | } | ||||||||||||||
| 50 | 0 | return undef; | |||||||||||||
| 51 | } | ||||||||||||||
| 52 | |||||||||||||||
| 53 | 11 | 1; | |||||||||||||