changeset 74:27b16506231f

improved the tech trees
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Wed, 22 Oct 2008 20:49:29 +0800
parents 2af91e80353e
children 3d1784140009
files agent.pl building.yaml sheep.pl
diffstat 3 files changed, 68 insertions(+), 47 deletions(-) [+]
line wrap: on
line diff
--- a/agent.pl	Wed Oct 22 06:49:42 2008 +0800
+++ b/agent.pl	Wed Oct 22 20:49:29 2008 +0800
@@ -28,7 +28,7 @@
 
 sub is_wall_enough {
     my ($self, $city) = @_;
-    # TODO 應該以防禦力計算
+    # http://ikariam.wikia.com/wiki/Wall_Defense
     return ($city->{buildings}->{wall} >= $city->{buildings}->{townHall} ?  1 : 0);
 }
 
@@ -52,13 +52,19 @@
 sub is_warehouse_enough {
     my ($self, $city) = @_;
     # TODO 以速率計算容納率
-    # XXX: not implemented yet.
     return 1;
 }
 
 sub is_risk {
     my ($self, $city) = @_;
     # TODO 計算可搶劫比例, 城牆防護, 軍事分數
+    # 
+    # my $capture = $city->{buildings}->{townHall} * ($city->{buildings}->{townHall} - 1) * $city->{resource}->gold / 10000;
+    # 計算軍人消耗
+    #
+    # 方陣兵, 1.58 軍分, 24 維護費
+    # 劍士, 4.64 軍分, 16 維護費
+    # army_score_main > (occupied * 0.3)
     return 0;
 }
 
@@ -91,14 +97,19 @@
     return (defined($city->{research}->{1030}) ?  1 : 0);
 }
 
+sub is_culturalexchange_researched {
+    my ($self, $city) = @_;
+    return (defined($city->{research}->{1040}) ?  1 : 0);
+}
+
 sub is_wealth_researched {
     my ($self, $city) = @_;
     return (defined($city->{research}->{2030}) ?  1 : 0);
 }
 
-sub is_professionalarmy_researched {
+sub is_winepress_researched {
     my ($self, $city) = @_;
-    return (defined($city->{research}->{4030}) ?  1 : 0);
+    return (defined($city->{research}->{2040}) ?  1 : 0);
 }
 
 sub is_paper_researched {
@@ -106,31 +117,39 @@
     return (defined($city->{research}->{3020}) ?  1 : 0);
 }
 
+sub is_espionage_researched {
+    my ($self, $city) = @_;
+    return (defined($city->{research}->{3030}) ?  1 : 0);
+}
+
+sub is_invention_researched {
+    my ($self, $city) = @_;
+    return (defined($city->{research}->{3040}) ?  1 : 0);
+}
+
+sub is_professionalarmy_researched {
+    my ($self, $city) = @_;
+    return (defined($city->{research}->{4030}) ?  1 : 0);
+}
+
 sub is_drydock_researched {
     my ($self, $city) = @_;
     return (defined($city->{research}->{4010}) ?  1 : 0);
 }
 
-sub is_winepress_researched {
-    my ($self, $city) = @_;
-    return (defined($city->{research}->{2040}) ?  1 : 0);
-}
-
-sub is_invention_researched {
-    my ($self, $city) = @_;
-    return (defined($city->{research}->{3040}) ?  1 : 0);
-}
-
 sub is_barracks_level_enough {
     my ($self, $city) = @_;
-    return 0 if(!defined($city->{building}->{barracks}));
-    return ($city->{building}->{barracks} >= 3 ? 1 : 0);
+    return 0 if(!defined($city->{buildings}->{barracks}));
+    # 方陣兵需要 level 4
+    # optimum is 5
+    return ($city->{buildings}->{barracks} >= 3 ? 1 : 0);
 }
 
 sub is_shipyard_level_enough {
     my ($self, $city) = @_;
-    return 0 if(!defined($city->{building}->{shipyard}));
-    return ($city->{building}->{shipyard} >= 2 ? 1 : 0);
+    return 0 if(!defined($city->{buildings}->{shipyard}));
+    # optimum is 5
+    return ($city->{buildings}->{shipyard} >= 3 ? 1 : 0);
     return 0;
 }
 
--- a/building.yaml	Wed Oct 22 06:49:42 2008 +0800
+++ b/building.yaml	Wed Oct 22 20:49:29 2008 +0800
@@ -25,9 +25,12 @@
             # 釀酒
             - is_winepress_researched:
                0: research_economy
-            # 發明
+            # 發明 (兵工廠)
             - is_invention_researched:
                0: research_knowledge
+            # 異國文化
+            - is_culturalexchange_resaerched:
+               0: research_seafaring
          # let's find something to build up
          0:
             - is_gold_enoughforcargo:
@@ -43,18 +46,9 @@
             # 倉庫庫存量
             - is_warehouse_enough:
                0: build_warehouse
-            - is_risk:
-               1: 
-                  - is_shipyard:
-                     0: 
-                        - is_drydock_researched: 
-                           0: resaerch_military
-                           1: build_shipyard
-                           # build one board
             - is_happiness:
                0: 
                   - is_winepress_researched:
-                     # 0: research_economy
                      1: build_tavern
 
             # TODO
@@ -66,24 +60,31 @@
             # build_palace (Expansion, Capital only)
             # build_embassy (副城, 不建)
 
-            - is_professionalarmy_researched:
-               1:
-                  - is_shipyard_level_enough:
+            - is_risk:
+               1: 
+                  - is_professionalarmy_researched:
                      1:
-                        - build_shipyard
-            - is_professionalarmy_researched:
-               1:
-                  - is_barracks_level_enough:
-                     1: 
-                        - build_barracks
+                        - is_shipyard_level_enough:
+                           0: build_shipyard
+                        - is_barracks_level_enough:
+                           0: build_barracks
+                  - is_shipyard_level_enough:
+                     0: 
+                        - is_drydock_researched: 
+                           # requireed more army ?
+                           1: build_shipyard
+                     # 1:
+                     #    - build one board
+            # 要蓋到何種程度?
             # is_invention_researched
-            # biuld_workshop 
-            # biuld_hideout
-            #
-            # build_museum
-
-            # 皇宮
-            # 副城, 不建 ...
+            #    1: 
+            #       - build_workshop 
+            # is_espionage_researched
+            #    1: 
+            #       - build_hideout
+            # is_culturalexchange_resaerched
+            #    1: 
+            #       - build_museum
     # 採取防禦措施
     1: run_defense
     # 若軍分 0, 進行焦土政策 針對特定城市 錢全部買船 拆港
--- a/sheep.pl	Wed Oct 22 06:49:42 2008 +0800
+++ b/sheep.pl	Wed Oct 22 20:49:29 2008 +0800
@@ -83,14 +83,15 @@
 
             next if($capture < 100);
 
-            $line = sprintf("%d %s army %d %s/%s(%d),", 
+            $line = sprintf("%d %s score %d army %d %s/%s(%d),", 
                 $capture,
-                $c->status, $sheep->army_score_main, $sheep->name, $sheep->ally, $members);
+                $c->status, $sheep->score, $sheep->army_score_main, $sheep->name, $sheep->ally, $members);
 
-            $line .= sprintf("\"%s\" %d [%d,%d] %s http://s2.ikariam.tw/index.php?view=island&id=%d&selectCity=%d\n",
+            $line .= sprintf("\"%s\" %d [%d,%d] %s http://%s/index.php?view=island&id=%d&selectCity=%d\n",
                 $c->cityname, $c->citylevel, 
                 $island->x, $island->y,
                 $tradegoodText[$island->tradegood],
+                $::server,
                 $island->id,
                 $c->cityId
             );