Mercurial > eagle-eye
comparison agent.pl @ 173:e8a244ce5a1d
update the tavern setting
author | "Rex Tsai <chihchun@kalug.linux.org.tw>" |
---|---|
date | Sun, 02 Nov 2008 04:12:00 +0800 |
parents | 60a09758a885 |
children | 2362c8c8909e |
comparison
equal
deleted
inserted
replaced
172:ba03aa8abdb2 | 173:e8a244ce5a1d |
---|---|
50 return 0; | 50 return 0; |
51 } | 51 } |
52 | 52 |
53 sub is_happiness { | 53 sub is_happiness { |
54 my ($self, $city) = @_; | 54 my ($self, $city) = @_; |
55 # FIXME. | 55 |
56 # we should update the tavern setting. | |
57 | |
58 # we should update the travl | |
59 return ($city->{growth} >= 5 ? 1 : 0) | 56 return ($city->{growth} >= 5 ? 1 : 0) |
60 if($city->{buildings}->{townHall} <= 10); | 57 if($city->{buildings}->{townHall} <= 10); |
61 | 58 |
62 return 1 if($city->{buildings}->{townHall} >= 20); | 59 return 1 if($city->{buildings}->{townHall} >= 20); |
63 | 60 |
64 return ($city->{happiness} >= 2 ? 1 : 0); | 61 return ($city->{happiness} >= 2 ? 1 : 0); |
62 } | |
63 | |
64 sub is_tavern_available { | |
65 my ($self, $city) = @_; | |
66 return (defined($city->{buildings}->{tavern}) ? 1 : 0); | |
67 } | |
68 | |
69 sub is_bacchanal { | |
70 my ($self, $city) = @_; | |
71 return ($city->{tavern}->{maxValue} == $city->{tavern}->{iniValue} ? 1 : 0); | |
65 } | 72 } |
66 | 73 |
67 sub is_warehouse_enough { | 74 sub is_warehouse_enough { |
68 my ($self, $city) = @_; | 75 my ($self, $city) = @_; |
69 # TODO 以速率計算容納率 | 76 # TODO 以速率計算容納率 |
159 | 166 |
160 sub is_drydock_researched { | 167 sub is_drydock_researched { |
161 my ($self) = @_; | 168 my ($self) = @_; |
162 return (defined($self->{'ikariam'}->{research}->{4010}) ? 1 : 0); | 169 return (defined($self->{'ikariam'}->{research}->{4010}) ? 1 : 0); |
163 } | 170 } |
164 | |
165 | 171 |
166 sub is_barracks_level_enough { | 172 sub is_barracks_level_enough { |
167 my ($self, $city) = @_; | 173 my ($self, $city) = @_; |
168 return 0 if(!defined($city->{buildings}->{barracks})); | 174 return 0 if(!defined($city->{buildings}->{barracks})); |
169 # 方陣兵需要 level 4 | 175 # 方陣兵需要 level 4 |
244 package main; | 250 package main; |
245 my $verbose = 1; | 251 my $verbose = 1; |
246 | 252 |
247 our $i = new Ikariam($::server, $::user, $::pass); | 253 our $i = new Ikariam($::server, $::user, $::pass); |
248 $i->login; | 254 $i->login; |
249 $i->checkMilitaryAdvisorCombatReports(); | |
250 my $cities = $i->check; | 255 my $cities = $i->check; |
251 | 256 |
252 # Genereic rules for both overall and city level arranagement. | 257 # Genereic rules for both overall and city level arranagement. |
253 my $rules = Ikariam::Cities::Rules->new($i); | 258 my $rules = Ikariam::Cities::Rules->new($i); |
254 # blanace resources, arrange defance | 259 # blanace resources, arrange defance |