Mercurial > eagle-eye
diff warfare.pl @ 156:ba7a805b3fe4
added new feature - don't fight with friends.
author | "Rex Tsai <chihchun@kalug.linux.org.tw>" |
---|---|
date | Sat, 01 Nov 2008 05:13:17 +0800 |
parents | 1499b0d496b6 |
children | 4b5e1d3a5198 |
line wrap: on
line diff
--- 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.