diff agent.pl @ 234:b7ea7c43dbad

merged.
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Thu, 06 Nov 2008 20:34:27 +0800
parents afd3f5cb8597 978a949602e5
children cf08e01f5713
line wrap: on
line diff
--- a/agent.pl	Thu Nov 06 20:32:17 2008 +0800
+++ b/agent.pl	Thu Nov 06 20:34:27 2008 +0800
@@ -63,7 +63,16 @@
 sub is_safehouse_enough {
     my ($self, $city) = @_;
     return 0 if(!defined($city->{buildings}->{safehouse}));
-    return (($city->{buildings}->{townHall} <= ($city->{buildings}->{safehouse} + 4)) ? 0 : 1);
+
+    # build the higgest safehouse.
+    # maybe we should have more then 4 towns, then we consider that we should upgrade safehouse at level 20.
+    # return (($city->{buildings}->{townHall} > $city->{buildings}->{safehouse}) ? 0 : 1) 
+        # if($$city->{buildings}->{townHall} >= 20);
+    # return (($city->{buildings}->{townHall} <= ($city->{buildings}->{safehouse} + 4)) ? 0 : 1);
+
+    # Safehouse must be same level as townHall,
+    # Maybe one level higher is better.
+    return (($city->{buildings}->{townHall} > $city->{buildings}->{safehouse}) ? 0 : 1);
 }
 
 sub is_warehouse_enough {
@@ -108,7 +117,7 @@
     my ($self, $city) = @_;
 
     return ($city->{growth} >= 5 ?  1 : 0) 
-        if($city->{buildings}->{townHall} <= 10);
+        if($city->{buildings}->{townHall} <= 16);
 
     return 1 if($city->{buildings}->{townHall} >= 20);
  
@@ -380,6 +389,9 @@
  
     # build spy
     $i->buildSpy('spy', $cityId);
+    # enlarge the scientist number.
+    $i->set("academy", $cityId);
+    $i->set("tavern", $cityId);
 
     # build military!
     $tree  = LoadFile('military.yaml');