Mercurial > eagle-eye
changeset 159:e2956846ee98
Merge
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Sat, 01 Nov 2008 16:38:56 +0800 |
parents | d4b7d8f51e9f (current diff) 4b5e1d3a5198 (diff) |
children | 7551342718b6 |
files | |
diffstat | 1 files changed, 10 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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.