diff 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
line wrap: on
line diff
--- a/warfare.pl	Sun Nov 02 04:12:23 2008 +0800
+++ b/warfare.pl	Sun Nov 02 21:15:51 2008 +0800
@@ -53,6 +53,14 @@
     return ($city->{transporters}->{avail} > 0) ? 1 : 0;
 }
 
+sub is_port_available {
+    my ($self, $city) = @_;
+    foreach(1..2) {
+        return 1 if($city->{locations}[$_] eq 'port');
+    }
+    return 0;
+}
+
 sub is_army_available {
     my ($self, $city) = @_;
     return ($city->{army}->{Swordsman} >= 2 ) ? 1 : 0;