Mercurial > eagle-eye
comparison agent.pl @ 67:6eccb3a95df5
refiended the research of tech tree, and added many todos
author | "Rex Tsai <chihchun@kalug.linux.org.tw>" |
---|---|
date | Wed, 22 Oct 2008 06:24:01 +0800 |
parents | b40f87f16263 |
children | 2af91e80353e |
comparison
equal
deleted
inserted
replaced
66:9356eafcdde7 | 67:6eccb3a95df5 |
---|---|
14 my ( $class ) = @_; | 14 my ( $class ) = @_; |
15 my $self = {}; | 15 my $self = {}; |
16 return bless $self, $class; | 16 return bless $self, $class; |
17 } | 17 } |
18 | 18 |
19 sub is_Attacked { | 19 sub is_attacked { |
20 my ($self, $city) = @_; | 20 my ($self, $city) = @_; |
21 return ($city->{force}->{attacks} > 0 ) ? 1 : 0; | 21 return ($city->{force}->{attacks} > 0 ) ? 1 : 0; |
22 } | 22 } |
23 | 23 |
24 sub is_constructing { | 24 sub is_constructing { |
119 } | 119 } |
120 | 120 |
121 sub is_winepress_researched { | 121 sub is_winepress_researched { |
122 my ($self, $city) = @_; | 122 my ($self, $city) = @_; |
123 return (defined($city->{research}->{2040}) ? 1 : 0); | 123 return (defined($city->{research}->{2040}) ? 1 : 0); |
124 } | |
125 | |
126 sub is_invention_researched { | |
127 my ($self, $city) = @_; | |
128 return (defined($city->{research}->{3040}) ? 1 : 0); | |
129 } | |
130 | |
131 sub is_barracks_level_enough { | |
132 my ($self, $city) = @_; | |
133 return 0 if(!defined($city->{building}->{barracks})); | |
134 return ($city->{building}->{barracks} >= 3 ? 1 : 0); | |
135 return 0; | |
136 } | |
137 | |
138 sub is_shipyard_level_enough { | |
139 my ($self, $city) = @_; | |
140 return 0 if(!defined($city->{building}->{shipyard})); | |
141 return ($city->{building}->{shipyard} >= 2 ? 1 : 0); | |
142 return 0; | |
124 } | 143 } |
125 | 144 |
126 sub rule_engagement | 145 sub rule_engagement |
127 { | 146 { |
128 my ($self, $city) = @_; | 147 my ($self, $city) = @_; |
175 } else { | 194 } else { |
176 | 195 |
177 } | 196 } |
178 } | 197 } |
179 # Debug | 198 # Debug |
180 print(Dumper($cities->{$cityId}->{parse_path})); | 199 # print(Dumper($cities->{$cityId}->{parse_path})); |
181 } | 200 } |
182 | 201 |
183 $i->logout; | 202 $i->logout; |
184 | 203 |
185 | 204 |