diff disturb.pl @ 372:9f19fe8d189c

withdraw the ship 10 minutes first, we have only need 2 ships for blocking a town.
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Tue, 14 Apr 2009 17:00:05 +0800
parents 7274d8f41d5f
children
line wrap: on
line diff
--- a/disturb.pl	Tue Apr 14 16:59:14 2009 +0800
+++ b/disturb.pl	Tue Apr 14 17:00:05 2009 +0800
@@ -25,8 +25,12 @@
         if($from_city == $myCity && $to_city == $blockadeCity) {
             # Cancel the last attack
             $ikariam->{mech}->get(sprintf("http://%s/index.php%s", $::server, $extractor->find('//td[9]/a/@href')));
+            $ikariam->logout;
+
+            sleep(60);
 
             # Create a new one.
+            $ikariam->login;
             $ikariam->changeCity($myCity);
             $ikariam->blockadeCity($blockadeCity, {
                     blockadeDuration => 8*60*60,
@@ -34,7 +38,7 @@
                     });
             $ikariam->logout;
 
-            sleep($travelTime*60);
+            sleep(($travelTime-1)*60);
             next LOOP;
         }
     }