# HG changeset patch # User "Rex Tsai " # Date 1225484948 -28800 # Node ID 25dcc1fffeef33f226286a6bba338030902ad935 # Parent 60a09758a885a9a4419bc2e99ca99e8fb3e09b1a friend or foe identification diff -r 60a09758a885 -r 25dcc1fffeef warfare.pl --- a/warfare.pl Sat Nov 01 04:09:52 2008 +0800 +++ b/warfare.pl Sat Nov 01 04:29:08 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. @@ -106,6 +110,8 @@ sub engagement { my ($self, $cityId, $x, $y, $tradegood) = @_; + print($::i); + exit; my $victim = $self->locateVictim($cityId, $x, $y, $tradegood); if(defined($victim)) { $self->{ikariam}->changeCity($cityId);