changeset 206:b7af307a222d

added build safehouse
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Mon, 03 Nov 2008 17:52:28 +0800
parents d9f17bcbf1f1
children 48ea8222782a
files agent.pl city.yaml scan.pl
diffstat 3 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/agent.pl	Mon Nov 03 17:20:51 2008 +0800
+++ b/agent.pl	Mon Nov 03 17:52:28 2008 +0800
@@ -45,6 +45,12 @@
     return ($city->{space}->{total} <= ($city->{space}->{occupied} + ($city->{growth}*8)) ?  0 : 1)
 }
 
+sub is_safehouse_enough {
+    my ($self, $city) = @_;
+    return 0 if(!defined($city->{building}->{safehouse}));
+    return (($city->{building}->{townHall} <= ($city->{building}->{safehouse} + 4)) ? 0 : 1);
+}
+
 sub is_warehouse_enough {
     my ($self, $city) = @_;
     my @warehouse = (qw/undef undef 0 4 9 16 18 19 20 21 22 23 24 25/);
--- a/city.yaml	Mon Nov 03 17:20:51 2008 +0800
+++ b/city.yaml	Mon Nov 03 17:52:28 2008 +0800
@@ -46,8 +46,11 @@
                            1:
                               - is_barracks_level_enough:
                                  0: build_barracks
+                  - is_safehouse_enough:
+                     0: build_safehouse
                   - is_warehouse_enough:
                      0: build_warehouse
+
             # TODO
             # build_safehouse
             # is_espionage_researched
--- a/scan.pl	Mon Nov 03 17:20:51 2008 +0800
+++ b/scan.pl	Mon Nov 03 17:52:28 2008 +0800
@@ -107,7 +107,7 @@
 
     foreach my $h_island (@islands)
     {
-        printf("checking island %d\n", $h_island->{id});
+        # printf("checking island %d\n", $h_island->{id});
 
         my $island;
         if($island = Ikariam::Island->retrieve($h_island->{id})) {