Mercurial > eagle-eye
diff agent.pl @ 236:cf08e01f5713
merged.
author | "Rex Tsai <chihchun@kalug.linux.org.tw>" |
---|---|
date | Thu, 06 Nov 2008 20:36:24 +0800 |
parents | a89e049d1d31 b7ea7c43dbad |
children | a254fb798eb9 |
line wrap: on
line diff
--- a/agent.pl Thu Nov 06 20:32:52 2008 +0800 +++ b/agent.pl Thu Nov 06 20:36:24 2008 +0800 @@ -63,12 +63,22 @@ sub is_safehouse_enough { my ($self, $city) = @_; return 0 if(!defined($city->{buildings}->{safehouse})); - return (($city->{buildings}->{townHall} <= ($city->{buildings}->{safehouse} + 4)) ? 0 : 1); + + # 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); } 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 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 @cities = keys(%{$self->{ikariam}->{cities}}); my $nextCities = ($#cities + 1) + 1; @@ -107,7 +117,7 @@ my ($self, $city) = @_; return ($city->{growth} >= 5 ? 1 : 0) - if($city->{buildings}->{townHall} <= 10); + if($city->{buildings}->{townHall} <= 16); return 1 if($city->{buildings}->{townHall} >= 20); @@ -379,6 +389,9 @@ # build spy $i->buildSpy('spy', $cityId); + # enlarge the scientist number. + $i->set("academy", $cityId); + $i->set("tavern", $cityId); # build military! $tree = LoadFile('military.yaml');