comparison agent.pl @ 311:6aeedda23e3a

refined the level of barracks and shipyard
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Mon, 05 Jan 2009 00:18:25 +0800
parents f6f56a47f383
children a5d85719155d 2e0e47895148
comparison
equal deleted inserted replaced
310:68138c99ee16 311:6aeedda23e3a
42 # return ($city->{buildings}->{academy} >= 16 ? 1 : 0); 42 # return ($city->{buildings}->{academy} >= 16 ? 1 : 0);
43 } 43 }
44 44
45 sub is_embassy_enough { 45 sub is_embassy_enough {
46 my ($self, $city) = @_; 46 my ($self, $city) = @_;
47 return ($city->{buildings}->{embassy} >= 1 ? 1 : 0);
47 return ($city->{buildings}->{embassy} >= 6 ? 1 : 0); 48 return ($city->{buildings}->{embassy} >= 6 ? 1 : 0);
48 } 49 }
49 50
50 sub is_museum_enough { 51 sub is_museum_enough {
51 my ($self, $city) = @_; 52 my ($self, $city) = @_;
181 sub is_greekfire_researched { 182 sub is_greekfire_researched {
182 my ($self) = @_; 183 my ($self) = @_;
183 return (defined($self->{'ikariam'}->{research}->{1060}) ? 1 : 0); 184 return (defined($self->{'ikariam'}->{research}->{1060}) ? 1 : 0);
184 } 185 }
185 186
187 sub is_paddlewheelengine_researched {
188 my ($self) = @_;
189 return (defined($self->{'ikariam'}->{research}->{1100}) ? 1 : 0);
190 }
191
186 sub is_conservation_researched { 192 sub is_conservation_researched {
187 my ($self) = @_; 193 my ($self) = @_;
188 return (defined($self->{'ikariam'}->{research}->{2010}) ? 1 : 0); 194 return (defined($self->{'ikariam'}->{research}->{2010}) ? 1 : 0);
189 } 195 }
190 196
226 sub is_drydock_researched { 232 sub is_drydock_researched {
227 my ($self) = @_; 233 my ($self) = @_;
228 return (defined($self->{'ikariam'}->{research}->{4010}) ? 1 : 0); 234 return (defined($self->{'ikariam'}->{research}->{4010}) ? 1 : 0);
229 } 235 }
230 236
237 sub is_robotics_researched {
238 my ($self) = @_;
239 return (defined($self->{'ikariam'}->{research}->{4110}) ? 1 : 0);
240 }
241
242
231 sub is_barracks_level_enough { 243 sub is_barracks_level_enough {
232 my ($self, $city) = @_; 244 my ($self, $city) = @_;
233 return 0 if(!defined($city->{buildings}->{barracks})); 245 return 0 if(!defined($city->{buildings}->{barracks}));
246 if($self->is_robotics_researched() eq 1) {
247 return ($city->{buildings}->{barracks} >= 16 ? 1 : 0);
248 }
249
234 if($city->{buildings}->{townHall} >= 10) { 250 if($city->{buildings}->{townHall} >= 10) {
235 # optimum is 5 251 # optimum is 5
236 return ($city->{buildings}->{barracks} >= 5 ? 1 : 0); 252 return ($city->{buildings}->{barracks} >= 5 ? 1 : 0);
237 } else { 253 } else {
238 # 方陣兵需要 level 4 254 # 方陣兵需要 level 4
247 } 263 }
248 264
249 sub is_shipyard_level_enough { 265 sub is_shipyard_level_enough {
250 my ($self, $city) = @_; 266 my ($self, $city) = @_;
251 return 0 if(!defined($city->{buildings}->{shipyard})); 267 return 0 if(!defined($city->{buildings}->{shipyard}));
252 if ($self->is_greekfire_researched() eq 1) { 268 if ($self->is_paddlewheelengine_researched() eq 1) {
269 return ($city->{buildings}->{shipyard} >= 10 ? 1 : 0);
270 } elsif ($self->is_greekfire_researched() eq 1) {
253 return ($city->{buildings}->{shipyard} >= 5 ? 1 : 0); 271 return ($city->{buildings}->{shipyard} >= 5 ? 1 : 0);
254 } else { 272 } else {
255 return ($city->{buildings}->{shipyard} >= 3 ? 1 : 0); 273 return ($city->{buildings}->{shipyard} >= 3 ? 1 : 0);
256 } 274 }
257 } 275 }