changeset 135:4194f261798b

check for transporters is available
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Fri, 31 Oct 2008 02:04:52 +0800
parents 21df8eb17a52
children ac29596f39bf
files warfare.pl warfare.yaml
diffstat 2 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/warfare.pl	Fri Oct 31 01:59:33 2008 +0800
+++ b/warfare.pl	Fri Oct 31 02:04:52 2008 +0800
@@ -21,9 +21,7 @@
          ORDER BY cities.citylevel * (cities.citylevel - 1) * user.trader_score_secondary / 10000 DESC
     }
 );
-# $island->tradegood, 
-# qw/NULL 葡萄酒 大理石 水晶 硫磺/;
-# 不打與自己相同的資源
+
 Ikariam::Report->set_sql(victim => qq {
         SELECT report.id
           FROM report
@@ -50,6 +48,11 @@
     return ($city->{actionPoints} > ($city->{maxActionPoints}/2) ) ? 1 : 0;
 }
 
+sub is_transporters_available {
+    my ($self, $city) = @_;
+    return ($city->{transporters}->{avail} > 0) ? 1 : 0;
+}
+
 sub is_army_available {
     my ($self, $city) = @_;
     return ($city->{army}->{Swordsman} >= 2 ) ? 1 : 0;
--- a/warfare.yaml	Fri Oct 31 01:59:33 2008 +0800
+++ b/warfare.yaml	Fri Oct 31 02:04:52 2008 +0800
@@ -3,5 +3,7 @@
     0:
        - is_actionPoint_enough:
           1:
-             - is_army_available:
-                1: engagement
+             - is_transporters_available:
+                1:
+                   - is_army_available:
+                      1: engagement