changeset 72:2af91e80353e

fixed a typo in is_space_enough, and fixed the rules format.
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Wed, 22 Oct 2008 06:49:42 +0800
parents 9fd33f9d7207
children 27b16506231f f2a7de8ac5c1 a344c54f15c7
files agent.pl building.yaml
diffstat 2 files changed, 7 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/agent.pl	Wed Oct 22 06:35:07 2008 +0800
+++ b/agent.pl	Wed Oct 22 06:49:42 2008 +0800
@@ -35,7 +35,7 @@
 sub is_space_enough {
     my ($self, $city) = @_;
     # TODO 應該以消耗率/時間計算
-    return ($city->{space}->{total} <= ($city->{space}->{occupied}+6) ?  1 : 0)
+    return ($city->{space}->{total} <= ($city->{space}->{occupied}+6) ?  0 : 1)
 }
 
 sub is_corruption {
@@ -49,26 +49,19 @@
     return ($city->{happiness} >= 2 ?  1 : 0)
 }
 
-sub is_warehouse_enough
-{
+sub is_warehouse_enough {
     my ($self, $city) = @_;
     # TODO 以速率計算容納率
     # XXX: not implemented yet.
     return 1;
 }
 
-sub is_risk
-{
+sub is_risk {
     my ($self, $city) = @_;
     # TODO 計算可搶劫比例, 城牆防護, 軍事分數
     return 0;
 }
 
-sub is_shipyard
-{
-    return 1;
-}
-
 sub is_gold_enoughforcargo {
     my ($self, $city) = @_;
     my @cargoCost = qw/160 244 396 812 1240 1272 1832 1888 3848 3972 5204 5384 6868 7120 8864 9200 11268 11712 14108 14680 23320 24288 28664 29880 34956 36468 42348 44212 51024 53308 61236 64024 73096 76468 87020 91088 103224 116524 122072 137432 180060 202132 211964 237444 249108 278276 292076 306623 321963 338138 355198 373191 392171 412195 433320 455612 479135 503962 530166 557828 587031 617863 650420 684802 721113 759466 799981 842783 888005 935790 986286 1039654 1096062 1155689 1218724 1285369 1355837 1430353 1509159 1592508 1680670 1773932 1872597 1976989 2087448 2204338 2328045 2458976 2597567 2744276 2899594 3064040 3238163 3422550 3617820 3824635 4043693 4275738 4521561 4782000 5057946 5350345 5660202 5988585 6336630 6705540 7096598 7511164 7950683 8416694 8910828 9434823 9990523 10579889 11205006 11868090 12571498 13317734 14109462 14949514/;
@@ -132,7 +125,6 @@
     my ($self, $city) = @_;
     return 0 if(!defined($city->{building}->{barracks}));
     return ($city->{building}->{barracks} >= 3 ? 1 : 0);
-    return 0;
 }
 
 sub is_shipyard_level_enough {
--- a/building.yaml	Wed Oct 22 06:35:07 2008 +0800
+++ b/building.yaml	Wed Oct 22 06:49:42 2008 +0800
@@ -69,11 +69,13 @@
             - is_professionalarmy_researched:
                1:
                   - is_shipyard_level_enough:
-                     - build_shipyard
+                     1:
+                        - build_shipyard
             - is_professionalarmy_researched:
                1:
                   - is_barracks_level_enough:
-                     - build_barracks
+                     1: 
+                        - build_barracks
             # is_invention_researched
             # biuld_workshop 
             # biuld_hideout