comparison agent.pl @ 308:f6f56a47f383

implemented is_tavern_enough
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Sun, 04 Jan 2009 23:49:41 +0800
parents cdbb428b464c
children 6aeedda23e3a
comparison
equal deleted inserted replaced
306:2f36120aba83 308:f6f56a47f383
48 } 48 }
49 49
50 sub is_museum_enough { 50 sub is_museum_enough {
51 my ($self, $city) = @_; 51 my ($self, $city) = @_;
52 return 1 if($city->{buildings}->{museum} >= 8); 52 return 1 if($city->{buildings}->{museum} >= 8);
53 return ($city->{buildings}->{museum} >= ($city->{buildings}->{tavern}/2) ? 1 : 0); 53 }
54
55 sub is_tavern_enough {
56 my ($self, $city) = @_;
57 return 0 if(!defined($city->{buildings}->{tavern}));
58 return 1 if($city->{buildings}->{museum} >= 12);
54 } 59 }
55 60
56 sub is_branchOffice_enough { 61 sub is_branchOffice_enough {
57 my ($self, $city) = @_; 62 my ($self, $city) = @_;
58 return ($city->{buildings}->{branchOffice} >= 6 ? 1 : 0); 63 return ($city->{buildings}->{branchOffice} >= 6 ? 1 : 0);
130 if($city->{buildings}->{townHall} <= 15); 135 if($city->{buildings}->{townHall} <= 15);
131 136
132 return 1 if($city->{buildings}->{townHall} >= 20); 137 return 1 if($city->{buildings}->{townHall} >= 20);
133 } 138 }
134 139
135 sub is_tavern_available {
136 my ($self, $city) = @_;
137 return (defined($city->{buildings}->{tavern}) ? 1 : 0);
138 }
139 140
140 sub is_bacchanal { 141 sub is_bacchanal {
141 my ($self, $city) = @_; 142 my ($self, $city) = @_;
142 return ($city->{tavern}->{maxValue} == $city->{tavern}->{iniValue} ? 1 : 0); 143 return ($city->{tavern}->{maxValue} == $city->{tavern}->{iniValue} ? 1 : 0);
143 } 144 }