Mercurial > eagle-eye
comparison agent.pl @ 342:f3bdbc706a37
merged
author | "Rex Tsai <chihchun@kalug.linux.org.tw>" |
---|---|
date | Thu, 12 Feb 2009 21:13:46 +0800 |
parents | fe740b1c6f94 |
children | 20b8826655ab |
comparison
equal
deleted
inserted
replaced
341:6296a9cd6878 | 342:f3bdbc706a37 |
---|---|
72 } | 72 } |
73 | 73 |
74 sub is_space_enough { | 74 sub is_space_enough { |
75 my ($self, $city) = @_; | 75 my ($self, $city) = @_; |
76 # The maximum town hall is level 20, then we build new town | 76 # The maximum town hall is level 20, then we build new town |
77 return 1 if($city->{buildings}->{townHall} >= 20); | 77 return 1 if($city->{buildings}->{townHall} >= 15); |
78 # TODO 應該以 成長率 * 升級所需時間計算 | 78 # TODO 應該以 成長率 * 升級所需時間計算 |
79 # 6 hours earlier, we upgrade the twonHall. | 79 # 6 hours earlier, we upgrade the twonHall. |
80 return ($city->{space}->{total} <= ($city->{space}->{occupied} + ($city->{growth}*12)) ? 0 : 1) | 80 return ($city->{space}->{total} <= ($city->{space}->{occupied} + ($city->{growth}*12)) ? 0 : 1) |
81 } | 81 } |
82 | 82 |
111 } | 111 } |
112 | 112 |
113 | 113 |
114 sub is_warehouse_enougn_for_governorsresidence { | 114 sub is_warehouse_enougn_for_governorsresidence { |
115 my ($self, $city) = @_; | 115 my ($self, $city) = @_; |
116 return (($city->{buildings}->{warehouse} >= 5) ? 0 : 1); | |
117 | |
116 my @warehouse = (qw/undef undef 0 4 9 16 18 19 20 21 22 23 24 25/); | 118 my @warehouse = (qw/undef undef 0 4 9 16 18 19 20 21 22 23 24 25/); |
117 my @cities = keys(%{$self->{ikariam}->{cities}}); | 119 my @cities = keys(%{$self->{ikariam}->{cities}}); |
118 my $citiesNumber = $#cities + 1; | 120 my $citiesNumber = $#cities + 1; |
119 | 121 |
120 Carp::carp(sprintf("Required warehouse level %s for %s cities, current is %s\n", $warehouse[$citiesNumber], $citiesNumber, $city->{buildings}->{warehouse})); | 122 Carp::carp(sprintf("Required warehouse level %s for %s cities, current is %s\n", $warehouse[$citiesNumber], $citiesNumber, $city->{buildings}->{warehouse})); |