diff agent.pl @ 173:e8a244ce5a1d

update the tavern setting
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Sun, 02 Nov 2008 04:12:00 +0800
parents 60a09758a885
children 2362c8c8909e
line wrap: on
line diff
--- a/agent.pl	Sun Nov 02 00:30:02 2008 +0800
+++ b/agent.pl	Sun Nov 02 04:12:00 2008 +0800
@@ -52,10 +52,7 @@
 
 sub is_happiness {
     my ($self, $city) = @_;
-    # FIXME.
-    # we should update the tavern setting.
 
-    # we should update the travl
     return ($city->{growth} >= 5 ?  1 : 0) 
         if($city->{buildings}->{townHall} <= 10);
 
@@ -64,6 +61,16 @@
     return ($city->{happiness} >= 2 ?  1 : 0);
 }
 
+sub is_tavern_available {
+    my ($self, $city) = @_;
+    return (defined($city->{buildings}->{tavern}) ? 1 : 0);
+}
+
+sub is_bacchanal {
+    my ($self, $city) = @_;
+    return ($city->{tavern}->{maxValue} == $city->{tavern}->{iniValue} ? 1 : 0);
+}
+
 sub is_warehouse_enough {
     my ($self, $city) = @_;
     # TODO 以速率計算容納率
@@ -162,7 +169,6 @@
     return (defined($self->{'ikariam'}->{research}->{4010}) ?  1 : 0);
 }
 
-
 sub is_barracks_level_enough {
     my ($self, $city) = @_;
     return 0 if(!defined($city->{buildings}->{barracks}));
@@ -246,7 +252,6 @@
 
 our $i = new Ikariam($::server, $::user, $::pass);
 $i->login;
-$i->checkMilitaryAdvisorCombatReports();
 my $cities = $i->check;
 
 # Genereic rules for both overall and city level arranagement.