comparison warfare.pl @ 251:5527133b7c7e

we don't attack same city twice at same time.
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Mon, 17 Nov 2008 01:10:50 +0800
parents 64549ddddf4a
children 689c4c9fa56b
comparison
equal deleted inserted replaced
250:a654d43731f0 251:5527133b7c7e
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);
109 # counting for both leaving and coming back. 111 # counting for both leaving and coming back.
110 $c++ if($_->{to} == $city->cityId || $_->{from} == $city->cityId); 112 $c++ if($_->{to} == $city->cityId || $_->{from} == $city->cityId);
111 } 113 }
112 # we attack one city maximum 4 times a day. 114 # we attack one city maximum 4 times a day.
113 next if($c >= 4); 115 next if($c >= 4);