comparison agent.pl @ 262:1b435cd26a7b

change the factor of happiness
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Thu, 20 Nov 2008 00:30:21 +0800
parents dc93eb48a926
children 06ee88d2bb2a
comparison
equal deleted inserted replaced
261:2488d31240b7 262:1b435cd26a7b
120 120
121 sub is_happiness { 121 sub is_happiness {
122 my ($self, $city) = @_; 122 my ($self, $city) = @_;
123 123
124 return ($city->{growth} >= 5 ? 1 : 0) 124 return ($city->{growth} >= 5 ? 1 : 0)
125 if($city->{buildings}->{townHall} <= 16); 125 if($city->{buildings}->{townHall} <= 10);
126
127 return ($city->{growth} >= 2 ? 1 : 0)
128 if($city->{buildings}->{townHall} <= 15);
126 129
127 return 1 if($city->{buildings}->{townHall} >= 20); 130 return 1 if($city->{buildings}->{townHall} >= 20);
128
129 return ($city->{happiness} >= 2 ? 1 : 0);
130 } 131 }
131 132
132 sub is_tavern_available { 133 sub is_tavern_available {
133 my ($self, $city) = @_; 134 my ($self, $city) = @_;
134 return (defined($city->{buildings}->{tavern}) ? 1 : 0); 135 return (defined($city->{buildings}->{tavern}) ? 1 : 0);