Mercurial > eagle-eye
comparison 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 |
comparison
equal
deleted
inserted
replaced
155:1499b0d496b6 | 156:ba7a805b3fe4 |
---|---|
62 my ($self, $city, $x, $y, $tradegood) = @_; | 62 my ($self, $city, $x, $y, $tradegood) = @_; |
63 | 63 |
64 my $user = Ikariam::User->search('name' => $::user); | 64 my $user = Ikariam::User->search('name' => $::user); |
65 | 65 |
66 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)); |
67 foreach my $city (@cities) { | 67 CITY: foreach my $city (@cities) { |
68 my $sheep = $city->user; | 68 my $sheep = $city->user; |
69 my $island = $city->island; | 69 my $island = $city->island; |
70 | 70 |
71 | |
72 # we don't fight friends. | |
73 # FIXME: This is very dirty for accessing to $::i directly. | |
74 foreach (keys(%{$::i->{friends}})) { | |
75 next CITY if ($sheep->id == $_); | |
76 } | |
77 | |
71 # we don't fight with members in same ally. | 78 # we don't fight with members in same ally. |
72 next if($sheep->allyId == $user->allyId); | 79 next if($sheep->allyId == $user->allyId); |
80 | |
73 # we fight for island which ownes differnet trade goods. | 81 # we fight for island which ownes differnet trade goods. |
74 next if($island->tradegood == $tradegood); | 82 next if($island->tradegood == $tradegood); |
75 # Ignore the user in vacation which we can not attack. | 83 # Ignore the user in vacation which we can not attack. |
76 next if($city->status eq 'v'); | 84 next if($city->status eq 'v'); |
77 unless ($city->status eq 'i') { | 85 unless ($city->status eq 'i') { |