comparison agent.pl @ 304:cdbb428b464c

new rules for safehouse and academy
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Tue, 09 Dec 2008 03:16:31 +0800
parents 4c1eb583b97c
children f6f56a47f383
comparison
equal deleted inserted replaced
303:50cff2eee239 304:cdbb428b464c
36 return ($city->{buildings}->{wall} >= $city->{buildings}->{townHall} ? 1 : 0); 36 return ($city->{buildings}->{wall} >= $city->{buildings}->{townHall} ? 1 : 0);
37 } 37 }
38 38
39 sub is_academy_enough { 39 sub is_academy_enough {
40 my ($self, $city) = @_; 40 my ($self, $city) = @_;
41 return ($city->{buildings}->{academy} >= 6 ? 1 : 0); 41 return ($city->{buildings}->{academy} >= 12 ? 1 : 0);
42 return ($city->{buildings}->{academy} >= 16 ? 1 : 0); 42 # return ($city->{buildings}->{academy} >= 16 ? 1 : 0);
43 } 43 }
44 44
45 sub is_embassy_enough { 45 sub is_embassy_enough {
46 my ($self, $city) = @_; 46 my ($self, $city) = @_;
47 return ($city->{buildings}->{embassy} >= 6 ? 1 : 0); 47 return ($city->{buildings}->{embassy} >= 6 ? 1 : 0);
68 } 68 }
69 69
70 sub is_safehouse_enough { 70 sub is_safehouse_enough {
71 my ($self, $city) = @_; 71 my ($self, $city) = @_;
72 return 0 if(!defined($city->{buildings}->{safehouse})); 72 return 0 if(!defined($city->{buildings}->{safehouse}));
73 return 1 if(($city->{buildings}->{townHall} - $city->{buildings}->{wall}) > 2);
73 return 1 if($city->{buildings}->{townHall} >= 20); 74 return 1 if($city->{buildings}->{townHall} >= 20);
74 75
75 # build the higgest safehouse. 76 # build the higgest safehouse.
76 # maybe we should have more then 4 towns, then we consider that we should upgrade safehouse at level 20. 77 # maybe we should have more then 4 towns, then we consider that we should upgrade safehouse at level 20.
77 # return (($city->{buildings}->{townHall} > $city->{buildings}->{safehouse}) ? 0 : 1) 78 # return (($city->{buildings}->{townHall} > $city->{buildings}->{safehouse}) ? 0 : 1)