comparison agent.pl @ 317:2e0e47895148

changed a little bit for 0.0.3
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Mon, 12 Jan 2009 22:25:46 +0800
parents 6aeedda23e3a
children e5e25d4a2c2f
comparison
equal deleted inserted replaced
311:6aeedda23e3a 317:2e0e47895148
31 31
32 sub is_wall_enough { 32 sub is_wall_enough {
33 my ($self, $city) = @_; 33 my ($self, $city) = @_;
34 # http://ikariam.wikia.com/wiki/Wall_Defense 34 # http://ikariam.wikia.com/wiki/Wall_Defense
35 # Basic rule - the wall level must equale or large then townHall level. 35 # Basic rule - the wall level must equale or large then townHall level.
36 return ($city->{buildings}->{wall} >= $city->{buildings}->{townHall} ? 1 : 0); 36 return ($city->{buildings}->{wall} >= 26 ? 1 : 0);
37 # return ($city->{buildings}->{wall} >= $city->{buildings}->{townHall} ? 1 : 0);
37 } 38 }
38 39
39 sub is_academy_enough { 40 sub is_academy_enough {
40 my ($self, $city) = @_; 41 my ($self, $city) = @_;
41 return ($city->{buildings}->{academy} >= 12 ? 1 : 0); 42 return ($city->{buildings}->{academy} >= 12 ? 1 : 0);
48 return ($city->{buildings}->{embassy} >= 6 ? 1 : 0); 49 return ($city->{buildings}->{embassy} >= 6 ? 1 : 0);
49 } 50 }
50 51
51 sub is_museum_enough { 52 sub is_museum_enough {
52 my ($self, $city) = @_; 53 my ($self, $city) = @_;
53 return 1 if($city->{buildings}->{museum} >= 8); 54 return 1 if($city->{buildings}->{museum} >= 9);
54 } 55 }
55 56
56 sub is_tavern_enough { 57 sub is_tavern_enough {
57 my ($self, $city) = @_; 58 my ($self, $city) = @_;
58 return 0 if(!defined($city->{buildings}->{tavern})); 59 return 0 if(!defined($city->{buildings}->{tavern}));
59 return 1 if($city->{buildings}->{museum} >= 12); 60 return 1 if($city->{buildings}->{tavern} >= 12);
60 } 61 }
61 62
62 sub is_branchOffice_enough { 63 sub is_branchOffice_enough {
63 my ($self, $city) = @_; 64 my ($self, $city) = @_;
64 return ($city->{buildings}->{branchOffice} >= 6 ? 1 : 0); 65 return ($city->{buildings}->{branchOffice} >= 6 ? 1 : 0);
73 return ($city->{space}->{total} <= ($city->{space}->{occupied} + ($city->{growth}*12)) ? 0 : 1) 74 return ($city->{space}->{total} <= ($city->{space}->{occupied} + ($city->{growth}*12)) ? 0 : 1)
74 } 75 }
75 76
76 sub is_safehouse_enough { 77 sub is_safehouse_enough {
77 my ($self, $city) = @_; 78 my ($self, $city) = @_;
79
80 return 1;
81
78 return 0 if(!defined($city->{buildings}->{safehouse})); 82 return 0 if(!defined($city->{buildings}->{safehouse}));
79 return 1 if(($city->{buildings}->{townHall} - $city->{buildings}->{wall}) > 2); 83 return 1 if(($city->{buildings}->{townHall} - $city->{buildings}->{wall}) > 2);
80 return 1 if($city->{buildings}->{townHall} >= 20); 84 return 1 if($city->{buildings}->{townHall} >= 20);
81 85
82 # build the higgest safehouse. 86 # build the higgest safehouse.