diff warfare.pl @ 155:1499b0d496b6

merged.
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Sat, 01 Nov 2008 05:09:02 +0800
parents 25dcc1fffeef
children ba7a805b3fe4
line wrap: on
line diff
--- a/warfare.pl	Sat Nov 01 05:05:15 2008 +0800
+++ b/warfare.pl	Sat Nov 01 05:09:02 2008 +0800
@@ -60,12 +60,16 @@
 
 sub locateVictim {
     my ($self, $city, $x, $y, $tradegood) = @_;
+
+    my $user = Ikariam::User->search('name' => $::user);
+
     my @cities = Ikariam::Cities->search_sheeps(($x + 6), ($x - 6), ($y + 6), ($y - 6));
-
     foreach my $city (@cities) {
         my $sheep = $city->user;
         my $island = $city->island;
 
+        # we don't fight with members in same ally.
+        next if($sheep->allyId == $user->allyId);
         # we fight for island which ownes differnet trade goods.
         next if($island->tradegood == $tradegood);
         # Ignore the user in vacation which we can not attack.