comparison warfare.pl @ 179:8afd380c20ac

do not fight with friends.
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Sun, 02 Nov 2008 21:15:51 +0800
parents 4b5e1d3a5198
children dbdd7dcc91c6
comparison
equal deleted inserted replaced
174:0cfc7a19a4d2 179:8afd380c20ac
49 } 49 }
50 50
51 sub is_transporters_available { 51 sub is_transporters_available {
52 my ($self, $city) = @_; 52 my ($self, $city) = @_;
53 return ($city->{transporters}->{avail} > 0) ? 1 : 0; 53 return ($city->{transporters}->{avail} > 0) ? 1 : 0;
54 }
55
56 sub is_port_available {
57 my ($self, $city) = @_;
58 foreach(1..2) {
59 return 1 if($city->{locations}[$_] eq 'port');
60 }
61 return 0;
54 } 62 }
55 63
56 sub is_army_available { 64 sub is_army_available {
57 my ($self, $city) = @_; 65 my ($self, $city) = @_;
58 return ($city->{army}->{Swordsman} >= 2 ) ? 1 : 0; 66 return ($city->{army}->{Swordsman} >= 2 ) ? 1 : 0;