changeset 356:1ece3379f7a2

merged
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Sun, 15 Feb 2009 14:21:27 +0800
parents 84311fc6fe35 (diff) bf59bef30dfc (current diff)
children f9a6b226fb79
files
diffstat 4 files changed, 25 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/defend-network.pl	Sun Feb 15 14:21:27 2009 +0800
@@ -0,0 +1,1 @@
+../gamma/defend-network.pl
\ No newline at end of file
--- a/enemy.pl	Sun Feb 15 14:19:47 2009 +0800
+++ b/enemy.pl	Sun Feb 15 14:21:27 2009 +0800
@@ -13,8 +13,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 travelMatrix {
@@ -68,7 +72,7 @@
         my @cities = ();
         foreach (glob("city-*-dump.yaml")) {
             my $city = LoadFile($_);
-            $city->{distance} = travelTime($island->x, $island->y, $city->{island}->{x}, $city->{island}->{y}, 20);
+            $city->{distance} = travelTime($island->x, $island->y, $city->{island}->{x}, $city->{island}->{y}, 60);
             push (@cities, $city);
         }
         @cities = sort { $a->{distance} <=> $b->{distance}; } (@cities);
@@ -77,10 +81,10 @@
         for my $x (0..$n) {
             printf("%s (%d)\t- ", $cities[$x]->{name}, $cities[$x]->{id});
             printf("Land %3d Ship %3d Catapult %3d Ram %3d\n", 
-                    travelTime($cities[$x]->{island}->{x}, $cities[$x]->{island}->{y}, $island->x, $island->y),
-                    travelTime($cities[$x]->{island}->{x}, $cities[$x]->{island}->{y}, $island->x, $island->y, 8),
-                    travelTime($cities[$x]->{island}->{x}, $cities[$x]->{island}->{y}, $island->x, $island->y, 6),
-                    travelTime($cities[$x]->{island}->{x}, $cities[$x]->{island}->{y}, $island->x, $island->y, 10),
+                    travelTime($cities[$x]->{island}->{x}, $cities[$x]->{island}->{y}, $island->x, $island->y, 60),
+                    travelTime($cities[$x]->{island}->{x}, $cities[$x]->{island}->{y}, $island->x, $island->y, 33),
+                    travelTime($cities[$x]->{island}->{x}, $cities[$x]->{island}->{y}, $island->x, $island->y, 26),
+                    travelTime($cities[$x]->{island}->{x}, $cities[$x]->{island}->{y}, $island->x, $island->y, 40),
                   );
         }
     }
--- a/planner.pl	Sun Feb 15 14:19:47 2009 +0800
+++ b/planner.pl	Sun Feb 15 14:21:27 2009 +0800
@@ -61,7 +61,7 @@
 
 # NAVY
 my $city = LoadFile(sprintf("city-%s-dump.yaml", $navyCity));
-$city->{distance} = travelTime($targetCity->island->x, $targetCity->island->y, $city->{island}->{x}, $city->{island}->{y}, 33) + 25;
+$city->{distance} = travelTime($targetCity->island->x, $targetCity->island->y, $city->{island}->{x}, $city->{island}->{y}, 33) + 45;
 $city->{type} = "navy";
 push (@cities, $city);
 
--- a/sheep.pl	Sun Feb 15 14:19:47 2009 +0800
+++ b/sheep.pl	Sun Feb 15 14:21:27 2009 +0800
@@ -64,19 +64,19 @@
             # Ignore 假期模式
             next if($c->status eq 'v');
 
-            unless($c->status eq 'i') {
-                # 依照影響力區分
-                unless ($sheep->allyId == '0') {
-                    unless (!defined($sheep->allyId) || $sheep->allyId == 0) {
-                        my $ally = Ikariam::Ally->retrieve($sheep->allyId);
-                        next if(!defined($ally));
-                        next if($ally->score > $myAlly->score);
-                    }
-                }
-            }
+#            unless($c->status eq 'i') {
+#                # 依照影響力區分
+#                unless ($sheep->allyId == '0') {
+#                    unless (!defined($sheep->allyId) || $sheep->allyId == 0) {
+#                        my $ally = Ikariam::Ally->retrieve($sheep->allyId);
+#                        next if(!defined($ally));
+#                        next if($ally->score > $myAlly->score);
+#                    }
+#                }
+#            }
 
-            next if($c->citylevel le 10);
-            next if($c->risk ge 30);
+            next if($c->citylevel le 5);
+            next if($c->risk ge 50);
             my $island = Ikariam::Island->retrieve($c->island);