# HG changeset patch # User "Rex Tsai " # Date 1225487597 -28800 # Node ID ba7a805b3fe44bff8be7dc8bd1347f0203691128 # Parent 1499b0d496b68fbdaa215db18cdab151a17a288d added new feature - don't fight with friends. diff -r 1499b0d496b6 -r ba7a805b3fe4 warfare.pl --- a/warfare.pl Sat Nov 01 05:09:02 2008 +0800 +++ b/warfare.pl Sat Nov 01 05:13:17 2008 +0800 @@ -64,12 +64,20 @@ 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) { +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.