# HG changeset patch # User Thinker K.F. Li # Date 1225528736 -28800 # Node ID e2956846ee98474c2aaf36411620b52ce7b82607 # Parent d4b7d8f51e9f511afb807d3e226cfedb91dc8129# Parent 4b5e1d3a5198e276d780e26273410def409e3f67 Merge diff -r d4b7d8f51e9f -r e2956846ee98 warfare.pl --- a/warfare.pl Sat Nov 01 16:35:24 2008 +0800 +++ b/warfare.pl Sat Nov 01 16:38:56 2008 +0800 @@ -61,15 +61,23 @@ sub locateVictim { my ($self, $city, $x, $y, $tradegood) = @_; - my $user = Ikariam::User->search('name' => $::user); + my $user = Ikariam::User->retrieve('name' => $::user); my @cities = Ikariam::Cities->search_sheeps(($x + 6), ($x - 6), ($y + 6), ($y - 6)); - foreach my $city (@cities) { +CITY: foreach my $city (@cities) { my $sheep = $city->user; my $island = $city->island; + + # we don't fight friends. + # FIXME: This is very dirty for accessing to $::i directly. + foreach (keys(%{$::i->{friends}})) { + next CITY if ($sheep->id == $_); + } + # 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.