# HG changeset patch # User "Rex Tsai " # Date 1227896195 -28800 # Node ID c7f4a6f0fbdee7a60beeb8bb8324d0414c866944 # Parent 285d5b39ef2c1b6ec959938ec672ad351a26042f added maxium level of buildings diff -r 285d5b39ef2c -r c7f4a6f0fbde agent.pl --- a/agent.pl Tue Nov 25 23:46:42 2008 +0800 +++ b/agent.pl Sat Nov 29 02:16:35 2008 +0800 @@ -39,6 +39,7 @@ sub is_academy_enough { my ($self, $city) = @_; return ($city->{buildings}->{academy} >= 6 ? 1 : 0); + return ($city->{buildings}->{academy} >= 16 ? 1 : 0); } sub is_embassy_enough { @@ -48,6 +49,7 @@ sub is_museum_enough { my ($self, $city) = @_; + return 1 if($city->{buildings}->{museum} >= 8); return ($city->{buildings}->{museum} >= ($city->{buildings}->{tavern}/2) ? 1 : 0); } @@ -68,22 +70,21 @@ sub is_safehouse_enough { my ($self, $city) = @_; return 0 if(!defined($city->{buildings}->{safehouse})); + return 1 if($$city->{buildings}->{townHall} >= 20); # 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); + return (($city->{buildings}->{townHall} >= $city->{buildings}->{safehouse}) ? 0 : 1); } sub is_warehouse_enough { my ($self, $city) = @_; # my @warehouse = (qw/undef undef 0 4 9 16 18 19 20 21 22 23 24 25/); - my @warehouse = (qw/undef undef 0 4 9 15 18 19 20 21 22 23 24 25/); + my @warehouse = (qw/undef undef 0 4 9 15 17 19 20 21 22 23 24 25/); my @cities = keys(%{$self->{ikariam}->{cities}}); my $nextCities = ($#cities + 1) + 1; @@ -396,6 +397,8 @@ $i->buildSpy('spy', $cityId); # enlarge the scientist number. $i->set("academy", $cityId); + + # Only when you are not happy. $i->set("tavern", $cityId); # build military!