diff warfare.pl @ 259:a4e52feec5a5

fixed a typo in is_attacked. fixed actionPoint number.
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Wed, 19 Nov 2008 01:35:47 +0800
parents 689c4c9fa56b
children a5bd0050dd12
line wrap: on
line diff
--- a/warfare.pl	Tue Nov 18 02:28:45 2008 +0800
+++ b/warfare.pl	Wed Nov 19 01:35:47 2008 +0800
@@ -40,12 +40,12 @@
 
 sub is_attacked {
     my ($self, $city) = @_;
-    return ($self->{'ikariam'}->{'military'}->{attacks} > 0 ) ? 1 : 0;
+    return ($self->{'ikariam'}->{'military'}->{attack} > 0 ) ? 1 : 0;
 }
 
 sub is_actionPoint_enough {
     my ($self, $city) = @_;
-    return ($city->{actionPoints} > ($city->{maxActionPoints}/2) ) ? 1 : 0;
+    return ($city->{actionPoints} > ($city->{maxActionPoints}/3) ) ? 1 : 0;
 }
 
 sub is_transporters_available {
@@ -89,7 +89,8 @@
         next if($sheep->allyId == $user->allyId);
 
         # we fight for island which ownes differnet trade goods.
-        next if($island->tradegood == $tradegood);
+        next if($island->tradegood == $tradegood) unless ($city->status eq 'i');
+
         # Ignore the user in vacation which we can not attack.
         next if($city->status eq 'v');
         unless ($city->status eq 'i') {
@@ -97,8 +98,9 @@
                 my $ally = Ikariam::Ally->retrieve($user->allyId);
                 my $targetAlly = Ikariam::Ally->retrieve($sheep->allyId);
                 # We don't want to piss off the big team.
+                next if($ally->score == 0);
                 next if($targetAlly->score > $ally->score);
-                # next if(defined($ally) && $ally->members > 10);
+                next if(defined($ally) && $ally->members > 12);
             }
         }
 
@@ -154,6 +156,8 @@
 $i->checkFriends();
 
 foreach my $cityId (keys(%$cities)) {
+    # next if($cityId == 12345);
+
     print Dump($i->{'military'});
     # build and upgrade for cities
     my $tree  = LoadFile('warfare.yaml');