Mercurial > eagle-eye
comparison agent.pl @ 243:dc93eb48a926
we build both museum and tavern at same time.
build cityHall 12 hours agao.
author | "Rex Tsai <chihchun@kalug.linux.org.tw>" |
---|---|
date | Wed, 12 Nov 2008 15:52:06 +0800 |
parents | a254fb798eb9 |
children | 1b435cd26a7b |
comparison
equal
deleted
inserted
replaced
242:5f6f845bbb1d | 243:dc93eb48a926 |
---|---|
46 return ($city->{buildings}->{embassy} >= 6 ? 1 : 0); | 46 return ($city->{buildings}->{embassy} >= 6 ? 1 : 0); |
47 } | 47 } |
48 | 48 |
49 sub is_museum_enough { | 49 sub is_museum_enough { |
50 my ($self, $city) = @_; | 50 my ($self, $city) = @_; |
51 return ($city->{buildings}->{museum} >= 2 ? 1 : 0); | 51 return ($city->{buildings}->{museum} >= ($city->{buildings}->{tavern}/2) ? 1 : 0); |
52 } | 52 } |
53 | 53 |
54 sub is_branchOffice_enough { | 54 sub is_branchOffice_enough { |
55 my ($self, $city) = @_; | 55 my ($self, $city) = @_; |
56 return ($city->{buildings}->{branchOffice} >= 6 ? 1 : 0); | 56 return ($city->{buildings}->{branchOffice} >= 6 ? 1 : 0); |
60 my ($self, $city) = @_; | 60 my ($self, $city) = @_; |
61 # The maximum town hall is level 20, then we build new town | 61 # The maximum town hall is level 20, then we build new town |
62 return 1 if($city->{buildings}->{townHall} >= 20); | 62 return 1 if($city->{buildings}->{townHall} >= 20); |
63 # TODO 應該以 成長率 * 升級所需時間計算 | 63 # TODO 應該以 成長率 * 升級所需時間計算 |
64 # 6 hours earlier, we upgrade the twonHall. | 64 # 6 hours earlier, we upgrade the twonHall. |
65 return ($city->{space}->{total} <= ($city->{space}->{occupied} + ($city->{growth}*8)) ? 0 : 1) | 65 return ($city->{space}->{total} <= ($city->{space}->{occupied} + ($city->{growth}*12)) ? 0 : 1) |
66 } | 66 } |
67 | 67 |
68 sub is_safehouse_enough { | 68 sub is_safehouse_enough { |
69 my ($self, $city) = @_; | 69 my ($self, $city) = @_; |
70 return 0 if(!defined($city->{buildings}->{safehouse})); | 70 return 0 if(!defined($city->{buildings}->{safehouse})); |
288 | 288 |
289 # TODO, 依照升級比例算 CP 值最高 | 289 # TODO, 依照升級比例算 CP 值最高 |
290 my $assault = 'Swordsman'; | 290 my $assault = 'Swordsman'; |
291 my $resistance = 'Phalanx'; | 291 my $resistance = 'Phalanx'; |
292 | 292 |
293 # ok, we can build Flamethrower. | |
294 if(($city->{'army'}->{$assault} / $city->{'army'}->{$resistance}) <= (2/1)) { | 293 if(($city->{'army'}->{$assault} / $city->{'army'}->{$resistance}) <= (2/1)) { |
295 return 302; # Swordsman | 294 return 302; # Swordsman |
296 } else { | 295 } else { |
297 return 303; # Phalanx | 296 return 303; # Phalanx |
298 } | 297 } |