changeset 131:bb7ac505f5e7

merged.
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Fri, 31 Oct 2008 01:54:33 +0800
parents 2ff3704cca0e (diff) dbefe10550cb (current diff)
children 2bf64daa8a5e
files
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/warfare.pl	Fri Oct 31 01:54:12 2008 +0800
+++ b/warfare.pl	Fri Oct 31 01:54:33 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, 
@@ -57,13 +56,15 @@
 }
 
 sub locateVictim {
-    my ($self, $city, $x, $y) = @_;
-    my @cities = Ikariam::Cities->search_sheeps(($x + 6), ($x - 6), ($y + 6), ($y - 6), $tradegood);
+    my ($self, $city, $x, $y, $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();