Mercurial > eagle-eye
diff warfare.pl @ 128:2ff3704cca0e
fixed for ignore same tradegood.
author | "Rex Tsai <chihchun@kalug.linux.org.tw>" |
---|---|
date | Fri, 31 Oct 2008 01:50:05 +0800 |
parents | a5517f0abb85 |
children | 4194f261798b |
line wrap: on
line diff
--- a/warfare.pl Fri Oct 31 01:35:34 2008 +0800 +++ b/warfare.pl Fri Oct 31 01:50:05 2008 +0800 @@ -18,8 +18,7 @@ WHERE user.id = cities.user AND user.army_score_main = 0 AND cities.island IN (SELECT island.id FROM island WHERE island.x <= ? AND island.x >= ? AND island.y <= ? AND island.y >= ? ) - AND cities.tradegood != ? - ORDER BY cities.citylevel * (cities.citylevel - 1) * user.trader_score_secondary / 10000 DESC LIMIT 30 + ORDER BY cities.citylevel * (cities.citylevel - 1) * user.trader_score_secondary / 10000 DESC } ); # $island->tradegood, @@ -58,12 +57,14 @@ sub locateVictim { my ($self, $city, $x, $y, $tradegood) = @_; - my @cities = Ikariam::Cities->search_sheeps(($x + 6), ($x - 6), ($y + 6), ($y - 6), $tradegood); + 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 fight for island which ownes differnet trade goods. + next if($island->tradegood == $tradegood); # Ignore the user in vacation which we can not attack. next if($city->status eq 'v'); unless ($city->status eq 'i') { @@ -127,7 +128,7 @@ $cities->{$cityId}->{parse_path} = []; $cities->{$cityId}->{parse_answer} = undef; if(ParseTree($tree, $rules, $cities->{$cityId}) eq 'engagement') { - my $island = Ikariam::Island->retrive($cities->{$cityId}->{island}->{id}); + my $island = Ikariam::Island->retrieve($cities->{$cityId}->{island}->{id}); $rules->engagement($cityId, $island->{x}, $island->{y}, $island->tradegood); sleep(30); $i->checkMilitaryAdvisorMilitaryMovements();