changeset 343:85d60a0569bf

fixed travel time for 0.3.0
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Thu, 12 Feb 2009 21:14:47 +0800
parents f3bdbc706a37
children 20b8826655ab
files planner.pl sheep.pl
diffstat 2 files changed, 7 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/planner.pl	Thu Feb 12 21:13:46 2009 +0800
+++ b/planner.pl	Thu Feb 12 21:14:47 2009 +0800
@@ -45,7 +45,7 @@
     }
 }
 
-#
+
 package main;
 getopts('w');
 if($#ARGV < 2) {
--- a/sheep.pl	Thu Feb 12 21:13:46 2009 +0800
+++ b/sheep.pl	Thu Feb 12 21:14:47 2009 +0800
@@ -41,8 +41,12 @@
 
 sub travelTime {
     my ($x1, $y1, $x2, $y2, $speed) = @_;
-    $speed = 20 unless(defined($speed));
-    return int( (sqrt((abs($x1 - $x2) * abs($x1 - $x2)) + (abs($y1 - $y2) * abs($y1 - $y2)))+1) * (400/$speed));
+    $speed = 60 unless(defined($speed));
+    if($x1 == $x2 && $y1 == $y2) {
+        return 600/$speed;
+    } else {
+        return int( (sqrt((abs($x1 - $x2) * abs($x1 - $x2)) + (abs($y1 - $y2) * abs($y1 - $y2)))) * (1200/$speed));
+    }
 }
 
 sub listSheeps
@@ -73,14 +77,7 @@
 
             my $island = Ikariam::Island->retrieve($c->island);
 
-            # 所得金錢 = 對方城鎮等級x(對方城鎮等級-1)x對方金錢/10000
-            my $capture = $c->citylevel * ($c->citylevel - 1) * $sheep->trader_score_secondary / 10000;
 
-            next if($capture < 200);
-
-            # 測試風險評估
-            # $capture = $capture - ($sheep->army_score_main*100);
-                        
             $line = sprintf("%d %s score %d army %d risk %d %s/%s,", 
                 travelTime($::x, $::y, $island->x, $island->y),
                 # $capture,