Mercurial > eagle-eye
comparison agent.pl @ 340:fe740b1c6f94
changed town and warehouse level for 0.3.0
author | "Rex Tsai <chihchun@kalug.linux.org.tw>" |
---|---|
date | Thu, 12 Feb 2009 21:12:16 +0800 |
parents | c29c8dad0673 |
children | 20b8826655ab |
comparison
equal
deleted
inserted
replaced
338:824f949bc484 | 340:fe740b1c6f94 |
---|---|
72 } | 72 } |
73 | 73 |
74 sub is_space_enough { | 74 sub is_space_enough { |
75 my ($self, $city) = @_; | 75 my ($self, $city) = @_; |
76 # The maximum town hall is level 20, then we build new town | 76 # The maximum town hall is level 20, then we build new town |
77 return 1 if($city->{buildings}->{townHall} >= 20); | 77 return 1 if($city->{buildings}->{townHall} >= 15); |
78 # TODO 應該以 成長率 * 升級所需時間計算 | 78 # TODO 應該以 成長率 * 升級所需時間計算 |
79 # 6 hours earlier, we upgrade the twonHall. | 79 # 6 hours earlier, we upgrade the twonHall. |
80 return ($city->{space}->{total} <= ($city->{space}->{occupied} + ($city->{growth}*12)) ? 0 : 1) | 80 return ($city->{space}->{total} <= ($city->{space}->{occupied} + ($city->{growth}*12)) ? 0 : 1) |
81 } | 81 } |
82 | 82 |
111 } | 111 } |
112 | 112 |
113 | 113 |
114 sub is_warehouse_enougn_for_governorsresidence { | 114 sub is_warehouse_enougn_for_governorsresidence { |
115 my ($self, $city) = @_; | 115 my ($self, $city) = @_; |
116 return (($city->{buildings}->{warehouse} >= 5) ? 0 : 1); | |
117 | |
116 my @warehouse = (qw/undef undef 0 4 9 16 18 19 20 21 22 23 24 25/); | 118 my @warehouse = (qw/undef undef 0 4 9 16 18 19 20 21 22 23 24 25/); |
117 my @cities = keys(%{$self->{ikariam}->{cities}}); | 119 my @cities = keys(%{$self->{ikariam}->{cities}}); |
118 my $citiesNumber = $#cities + 1; | 120 my $citiesNumber = $#cities + 1; |
119 | 121 |
120 Carp::carp(sprintf("Required warehouse level %s for %s cities, current is %s\n", $warehouse[$citiesNumber], $citiesNumber, $city->{buildings}->{warehouse})); | 122 Carp::carp(sprintf("Required warehouse level %s for %s cities, current is %s\n", $warehouse[$citiesNumber], $citiesNumber, $city->{buildings}->{warehouse})); |