changeset 212:5f94d8d8370a

build embassy, museum, academy
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Tue, 04 Nov 2008 01:14:39 +0800
parents 541bc1fba446
children 550e20dd7573 f6836ef11203
files agent.pl city.yaml
diffstat 2 files changed, 44 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/agent.pl	Mon Nov 03 23:02:36 2008 +0800
+++ b/agent.pl	Tue Nov 04 01:14:39 2008 +0800
@@ -36,6 +36,21 @@
     return ($city->{buildings}->{wall} >= $city->{buildings}->{townHall} ?  1 : 0);
 }
 
+sub is_academy_enough {
+    my ($self, $city) = @_;
+    return ($city->{buildings}->{academy} >= 6 ?  1 : 0);
+}
+
+sub is_embassy_enough {
+    my ($self, $city) = @_;
+    return ($city->{buildings}->{embassy} >= 6 ?  1 : 0);
+}
+
+sub is_museum_enough {
+    my ($self, $city) = @_;
+    return ($city->{buildings}->{museum} >= 2 ?  1 : 0);
+}
+
 sub is_space_enough {
     my ($self, $city) = @_;
     # The maximum town hall is level 20, then we build new town
@@ -139,7 +154,7 @@
     return (defined($self->{'ikariam'}->{research}->{1030}) ?  1 : 0);
 }
 
-sub is_culturalexchange_researched {
+sub is_foreigncultures_researched {
     my ($self) = @_;
     return (defined($self->{'ikariam'}->{research}->{1040}) ?  1 : 0);
 }
@@ -149,6 +164,11 @@
     return (defined($self->{'ikariam'}->{research}->{1060}) ?  1 : 0);
 }
 
+sub is_conservation_researched {
+    my ($self) = @_;
+    return (defined($self->{'ikariam'}->{research}->{2010}) ?  1 : 0);
+}
+
 sub is_wealth_researched {
     my ($self) = @_;
     return (defined($self->{'ikariam'}->{research}->{2030}) ?  1 : 0);
--- a/city.yaml	Mon Nov 03 23:02:36 2008 +0800
+++ b/city.yaml	Tue Nov 04 01:14:39 2008 +0800
@@ -43,25 +43,28 @@
                         - is_professionalarmy_researched:
                            1: build_barracks
                   - is_safehouse_enough:
-                     0: build_safehouse
+                     0:
+                        - is_espionage_researched:
+                           1: build_safehouse
                   - is_warehouse_enough:
-                     0: build_warehouse
-
-            # TODO
-            # build_safehouse
-            # is_espionage_researched
-            #    1: 
-            #       - build_hideout
+                     0:
+                        - is_conservation_researched:
+                          1: build_warehouse
+                          0: build_academy
+                  - is_academy_enough:
+                     0: build_academy
+                  # 大使館
+                  - is_embassy_enough:
+                     0:
+                        - is_foreigncultures_researched:
+                           1: build_embassy 
+                  - is_museum_enough:
+                     0:
+                        - is_culturalexchange_resaerched:
+                           1: 
+                              - build_museum
 
-            # 水晶島應該建設 
-            # is_invention_researched
-            #    1: 
-            #       - build_workshop 
-            # build_academy
-
-            # 大使館
-            # build_embassy 
-
-            # is_culturalexchange_resaerched
-            #    1: 
-            #       - build_museum
+# 水晶島應該建設 
+# is_invention_researched
+#    1: 
+#       - build_workshop