Mercurial > eagle-eye
comparison agent.pl @ 74:27b16506231f
improved the tech trees
author | "Rex Tsai <chihchun@kalug.linux.org.tw>" |
---|---|
date | Wed, 22 Oct 2008 20:49:29 +0800 |
parents | 2af91e80353e |
children | 9d92e8c12f58 |
comparison
equal
deleted
inserted
replaced
72:2af91e80353e | 74:27b16506231f |
---|---|
26 return ($city->{construction} > 0 ) ? 1 : 0; | 26 return ($city->{construction} > 0 ) ? 1 : 0; |
27 } | 27 } |
28 | 28 |
29 sub is_wall_enough { | 29 sub is_wall_enough { |
30 my ($self, $city) = @_; | 30 my ($self, $city) = @_; |
31 # TODO 應該以防禦力計算 | 31 # http://ikariam.wikia.com/wiki/Wall_Defense |
32 return ($city->{buildings}->{wall} >= $city->{buildings}->{townHall} ? 1 : 0); | 32 return ($city->{buildings}->{wall} >= $city->{buildings}->{townHall} ? 1 : 0); |
33 } | 33 } |
34 | 34 |
35 sub is_space_enough { | 35 sub is_space_enough { |
36 my ($self, $city) = @_; | 36 my ($self, $city) = @_; |
50 } | 50 } |
51 | 51 |
52 sub is_warehouse_enough { | 52 sub is_warehouse_enough { |
53 my ($self, $city) = @_; | 53 my ($self, $city) = @_; |
54 # TODO 以速率計算容納率 | 54 # TODO 以速率計算容納率 |
55 # XXX: not implemented yet. | |
56 return 1; | 55 return 1; |
57 } | 56 } |
58 | 57 |
59 sub is_risk { | 58 sub is_risk { |
60 my ($self, $city) = @_; | 59 my ($self, $city) = @_; |
61 # TODO 計算可搶劫比例, 城牆防護, 軍事分數 | 60 # TODO 計算可搶劫比例, 城牆防護, 軍事分數 |
61 # | |
62 # my $capture = $city->{buildings}->{townHall} * ($city->{buildings}->{townHall} - 1) * $city->{resource}->gold / 10000; | |
63 # 計算軍人消耗 | |
64 # | |
65 # 方陣兵, 1.58 軍分, 24 維護費 | |
66 # 劍士, 4.64 軍分, 16 維護費 | |
67 # army_score_main > (occupied * 0.3) | |
62 return 0; | 68 return 0; |
63 } | 69 } |
64 | 70 |
65 sub is_gold_enoughforcargo { | 71 sub is_gold_enoughforcargo { |
66 my ($self, $city) = @_; | 72 my ($self, $city) = @_; |
89 sub is_expansion_researched { | 95 sub is_expansion_researched { |
90 my ($self, $city) = @_; | 96 my ($self, $city) = @_; |
91 return (defined($city->{research}->{1030}) ? 1 : 0); | 97 return (defined($city->{research}->{1030}) ? 1 : 0); |
92 } | 98 } |
93 | 99 |
100 sub is_culturalexchange_researched { | |
101 my ($self, $city) = @_; | |
102 return (defined($city->{research}->{1040}) ? 1 : 0); | |
103 } | |
104 | |
94 sub is_wealth_researched { | 105 sub is_wealth_researched { |
95 my ($self, $city) = @_; | 106 my ($self, $city) = @_; |
96 return (defined($city->{research}->{2030}) ? 1 : 0); | 107 return (defined($city->{research}->{2030}) ? 1 : 0); |
97 } | 108 } |
98 | 109 |
110 sub is_winepress_researched { | |
111 my ($self, $city) = @_; | |
112 return (defined($city->{research}->{2040}) ? 1 : 0); | |
113 } | |
114 | |
115 sub is_paper_researched { | |
116 my ($self, $city) = @_; | |
117 return (defined($city->{research}->{3020}) ? 1 : 0); | |
118 } | |
119 | |
120 sub is_espionage_researched { | |
121 my ($self, $city) = @_; | |
122 return (defined($city->{research}->{3030}) ? 1 : 0); | |
123 } | |
124 | |
125 sub is_invention_researched { | |
126 my ($self, $city) = @_; | |
127 return (defined($city->{research}->{3040}) ? 1 : 0); | |
128 } | |
129 | |
99 sub is_professionalarmy_researched { | 130 sub is_professionalarmy_researched { |
100 my ($self, $city) = @_; | 131 my ($self, $city) = @_; |
101 return (defined($city->{research}->{4030}) ? 1 : 0); | 132 return (defined($city->{research}->{4030}) ? 1 : 0); |
102 } | 133 } |
103 | 134 |
104 sub is_paper_researched { | |
105 my ($self, $city) = @_; | |
106 return (defined($city->{research}->{3020}) ? 1 : 0); | |
107 } | |
108 | |
109 sub is_drydock_researched { | 135 sub is_drydock_researched { |
110 my ($self, $city) = @_; | 136 my ($self, $city) = @_; |
111 return (defined($city->{research}->{4010}) ? 1 : 0); | 137 return (defined($city->{research}->{4010}) ? 1 : 0); |
112 } | 138 } |
113 | 139 |
114 sub is_winepress_researched { | |
115 my ($self, $city) = @_; | |
116 return (defined($city->{research}->{2040}) ? 1 : 0); | |
117 } | |
118 | |
119 sub is_invention_researched { | |
120 my ($self, $city) = @_; | |
121 return (defined($city->{research}->{3040}) ? 1 : 0); | |
122 } | |
123 | |
124 sub is_barracks_level_enough { | 140 sub is_barracks_level_enough { |
125 my ($self, $city) = @_; | 141 my ($self, $city) = @_; |
126 return 0 if(!defined($city->{building}->{barracks})); | 142 return 0 if(!defined($city->{buildings}->{barracks})); |
127 return ($city->{building}->{barracks} >= 3 ? 1 : 0); | 143 # 方陣兵需要 level 4 |
144 # optimum is 5 | |
145 return ($city->{buildings}->{barracks} >= 3 ? 1 : 0); | |
128 } | 146 } |
129 | 147 |
130 sub is_shipyard_level_enough { | 148 sub is_shipyard_level_enough { |
131 my ($self, $city) = @_; | 149 my ($self, $city) = @_; |
132 return 0 if(!defined($city->{building}->{shipyard})); | 150 return 0 if(!defined($city->{buildings}->{shipyard})); |
133 return ($city->{building}->{shipyard} >= 2 ? 1 : 0); | 151 # optimum is 5 |
152 return ($city->{buildings}->{shipyard} >= 3 ? 1 : 0); | |
134 return 0; | 153 return 0; |
135 } | 154 } |
136 | 155 |
137 sub rule_engagement | 156 sub rule_engagement |
138 { | 157 { |