« blib/lib/BalanceOfPower/Commands/MilitarySupport.pm
↑ Summary
blib/lib/BalanceOfPower/Commands/DeleteRoute.pm »
| 1 | package BalanceOfPower::Commands::InMilitaryRange; | ||
| 2 | $BalanceOfPower::Commands::InMilitaryRange::VERSION = '0.200000'; | ||
| 3 | use Moo; | ||
| 4 | |||
| 5 | extends 'BalanceOfPower::Commands::TargetNation'; | ||
| 6 | |||
| 7 | has crisis_needed => ( | ||
| 8 | is => 'ro', | ||
| 9 | default => 0 | ||
| 10 | ); | ||
| 11 | |||
| 12 | sub get_available_targets | ||
| 13 | { | ||
| 14 | my $self = shift; | ||
| 15 | my $player = $self->actor; | ||
| 16 | my @out = (); | ||
| 17 | for($self->SUPER::get_available_targets()) | ||
| 18 | { | ||
| 19 | my $n = $_; | ||
| 20 | my $push = 0; | ||
| 21 | if($self->world->in_military_range($player, $n)) | ||
| 22 | { | ||
| 23 | if($self->crisis_needed) | ||
| 24 | { | ||
| 25 | if($self->world->crisis_exists($player, $n)) | ||
| 26 | { | ||
| 27 | $push = 1; | ||
| 28 | } | ||
| 29 | } | ||
| 30 | else | ||
| 31 | { | ||
| 32 | $push = 1; | ||
| 33 | } | ||
| 34 | } | ||
| 35 | if($push) | ||
| 36 | { | ||
| 37 | push @out, $n; | ||
| 38 | } | ||
| 39 | } | ||
| 40 | return @out; | ||
| 41 | } | ||
| 42 | |||
| 43 | 1; |