comparison agent.pl @ 192:d6dc50b64f06

rules to fix corruption
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Sun, 02 Nov 2008 23:39:49 +0800
parents 2362c8c8909e
children a6a4a48d5fda
comparison
equal deleted inserted replaced
191:8705eaa33210 192:d6dc50b64f06
43 # TODO 應該以 成長率 * 升級所需時間計算 43 # TODO 應該以 成長率 * 升級所需時間計算
44 # 6 hours earlier, we upgrade the twonHall. 44 # 6 hours earlier, we upgrade the twonHall.
45 return ($city->{space}->{total} <= ($city->{space}->{occupied} + ($city->{growth}*6)) ? 0 : 1) 45 return ($city->{space}->{total} <= ($city->{space}->{occupied} + ($city->{growth}*6)) ? 0 : 1)
46 } 46 }
47 47
48 sub is_warehouse_enougn_for_governorsresidence {
49 my ($self, $city) = @_;
50 my @warehouse = (qw/undef 0 4 9 16 18 19 20 21 22 23 24 25/);
51 my @cities = keys(%{$::i->{cities}});
52
53 return ($city->{buildings}->{warehouse} < $warehouse[$#cities]) ? 0 : 1;
54 }
55
48 sub is_corruption { 56 sub is_corruption {
49 my ($self, $city) = @_; 57 my ($self, $city) = @_;
50 return 0; 58 return $city->{corruption};
51 } 59 }
52 60
53 sub is_happiness { 61 sub is_happiness {
54 my ($self, $city) = @_; 62 my ($self, $city) = @_;
55 63