changeset 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 a654d43731f0
children d75f26fc1c69
files warfare.pl
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/warfare.pl	Mon Nov 17 00:26:44 2008 +0800
+++ b/warfare.pl	Mon Nov 17 01:10:50 2008 +0800
@@ -106,6 +106,8 @@
         my $c = Ikariam::Report->search_victim($city->cityId, time - 24*60*60 - 7*60*60)->count();
         # check the current plunders
         foreach (@{$self->{ikariam}->{'military'}->{'homeland'}}) {
+            # we don't attack same city twice at same time.
+            next if($_->{to} == $city->cityId);
             # counting for both leaving and coming back.
             $c++ if($_->{to} == $city->cityId || $_->{from} == $city->cityId);
         }