Mercurial > eagle-eye
comparison warfare.pl @ 258:689c4c9fa56b
fixed loop
author | "Rex Tsai <chihchun@kalug.linux.org.tw>" |
---|---|
date | Tue, 18 Nov 2008 02:28:45 +0800 |
parents | 5527133b7c7e |
children | a4e52feec5a5 |
comparison
equal
deleted
inserted
replaced
257:2d205c539688 | 258:689c4c9fa56b |
---|---|
104 | 104 |
105 # check if we over-attacked | 105 # check if we over-attacked |
106 my $c = Ikariam::Report->search_victim($city->cityId, time - 24*60*60 - 7*60*60)->count(); | 106 my $c = Ikariam::Report->search_victim($city->cityId, time - 24*60*60 - 7*60*60)->count(); |
107 # check the current plunders | 107 # check the current plunders |
108 foreach (@{$self->{ikariam}->{'military'}->{'homeland'}}) { | 108 foreach (@{$self->{ikariam}->{'military'}->{'homeland'}}) { |
109 # we don't attack same city twice at same time. | |
110 next if($_->{to} == $city->cityId); | |
111 # counting for both leaving and coming back. | 109 # counting for both leaving and coming back. |
112 $c++ if($_->{to} == $city->cityId || $_->{from} == $city->cityId); | 110 $c++ if($_->{to} == $city->cityId || $_->{from} == $city->cityId); |
111 | |
112 # we don't attack same city twice at same time. | |
113 next CITY if($_->{to} == $city->cityId); | |
113 } | 114 } |
114 # we attack one city maximum 4 times a day. | 115 # we attack one city maximum 4 times a day. |
115 next if($c >= 4); | 116 next if($c >= 4); |
116 | 117 |
117 my $capture = $city->citylevel * ($city->citylevel - 1) * $sheep->trader_score_secondary / 10000; | 118 my $capture = $city->citylevel * ($city->citylevel - 1) * $sheep->trader_score_secondary / 10000; |