comparison warfare.pl @ 155:1499b0d496b6

merged.
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Sat, 01 Nov 2008 05:09:02 +0800
parents 25dcc1fffeef
children ba7a805b3fe4
comparison
equal deleted inserted replaced
154:637314cc57ed 155:1499b0d496b6
58 return ($city->{army}->{Swordsman} >= 2 ) ? 1 : 0; 58 return ($city->{army}->{Swordsman} >= 2 ) ? 1 : 0;
59 } 59 }
60 60
61 sub locateVictim { 61 sub locateVictim {
62 my ($self, $city, $x, $y, $tradegood) = @_; 62 my ($self, $city, $x, $y, $tradegood) = @_;
63
64 my $user = Ikariam::User->search('name' => $::user);
65
63 my @cities = Ikariam::Cities->search_sheeps(($x + 6), ($x - 6), ($y + 6), ($y - 6)); 66 my @cities = Ikariam::Cities->search_sheeps(($x + 6), ($x - 6), ($y + 6), ($y - 6));
64
65 foreach my $city (@cities) { 67 foreach my $city (@cities) {
66 my $sheep = $city->user; 68 my $sheep = $city->user;
67 my $island = $city->island; 69 my $island = $city->island;
68 70
71 # we don't fight with members in same ally.
72 next if($sheep->allyId == $user->allyId);
69 # we fight for island which ownes differnet trade goods. 73 # we fight for island which ownes differnet trade goods.
70 next if($island->tradegood == $tradegood); 74 next if($island->tradegood == $tradegood);
71 # Ignore the user in vacation which we can not attack. 75 # Ignore the user in vacation which we can not attack.
72 next if($city->status eq 'v'); 76 next if($city->status eq 'v');
73 unless ($city->status eq 'i') { 77 unless ($city->status eq 'i') {