Mercurial > eagle-eye
comparison 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 |
comparison
equal
deleted
inserted
replaced
258:689c4c9fa56b | 259:a4e52feec5a5 |
---|---|
38 return bless $self, $class; | 38 return bless $self, $class; |
39 } | 39 } |
40 | 40 |
41 sub is_attacked { | 41 sub is_attacked { |
42 my ($self, $city) = @_; | 42 my ($self, $city) = @_; |
43 return ($self->{'ikariam'}->{'military'}->{attacks} > 0 ) ? 1 : 0; | 43 return ($self->{'ikariam'}->{'military'}->{attack} > 0 ) ? 1 : 0; |
44 } | 44 } |
45 | 45 |
46 sub is_actionPoint_enough { | 46 sub is_actionPoint_enough { |
47 my ($self, $city) = @_; | 47 my ($self, $city) = @_; |
48 return ($city->{actionPoints} > ($city->{maxActionPoints}/2) ) ? 1 : 0; | 48 return ($city->{actionPoints} > ($city->{maxActionPoints}/3) ) ? 1 : 0; |
49 } | 49 } |
50 | 50 |
51 sub is_transporters_available { | 51 sub is_transporters_available { |
52 my ($self, $city) = @_; | 52 my ($self, $city) = @_; |
53 # we keep 10 transporters for prize | 53 # we keep 10 transporters for prize |
87 | 87 |
88 # we don't fight with members in same ally. | 88 # we don't fight with members in same ally. |
89 next if($sheep->allyId == $user->allyId); | 89 next if($sheep->allyId == $user->allyId); |
90 | 90 |
91 # we fight for island which ownes differnet trade goods. | 91 # we fight for island which ownes differnet trade goods. |
92 next if($island->tradegood == $tradegood); | 92 next if($island->tradegood == $tradegood) unless ($city->status eq 'i'); |
93 | |
93 # Ignore the user in vacation which we can not attack. | 94 # Ignore the user in vacation which we can not attack. |
94 next if($city->status eq 'v'); | 95 next if($city->status eq 'v'); |
95 unless ($city->status eq 'i') { | 96 unless ($city->status eq 'i') { |
96 unless (!defined($sheep->allyId) || $sheep->allyId == 0) { | 97 unless (!defined($sheep->allyId) || $sheep->allyId == 0) { |
97 my $ally = Ikariam::Ally->retrieve($user->allyId); | 98 my $ally = Ikariam::Ally->retrieve($user->allyId); |
98 my $targetAlly = Ikariam::Ally->retrieve($sheep->allyId); | 99 my $targetAlly = Ikariam::Ally->retrieve($sheep->allyId); |
99 # We don't want to piss off the big team. | 100 # We don't want to piss off the big team. |
101 next if($ally->score == 0); | |
100 next if($targetAlly->score > $ally->score); | 102 next if($targetAlly->score > $ally->score); |
101 # next if(defined($ally) && $ally->members > 10); | 103 next if(defined($ally) && $ally->members > 12); |
102 } | 104 } |
103 } | 105 } |
104 | 106 |
105 # check if we over-attacked | 107 # check if we over-attacked |
106 my $c = Ikariam::Report->search_victim($city->cityId, time - 24*60*60 - 7*60*60)->count(); | 108 my $c = Ikariam::Report->search_victim($city->cityId, time - 24*60*60 - 7*60*60)->count(); |
152 my $cities = $i->check; | 154 my $cities = $i->check; |
153 $i->checkMilitaryAdvisorCombatReports(); | 155 $i->checkMilitaryAdvisorCombatReports(); |
154 $i->checkFriends(); | 156 $i->checkFriends(); |
155 | 157 |
156 foreach my $cityId (keys(%$cities)) { | 158 foreach my $cityId (keys(%$cities)) { |
159 # next if($cityId == 12345); | |
160 | |
157 print Dump($i->{'military'}); | 161 print Dump($i->{'military'}); |
158 # build and upgrade for cities | 162 # build and upgrade for cities |
159 my $tree = LoadFile('warfare.yaml'); | 163 my $tree = LoadFile('warfare.yaml'); |
160 $cities->{$cityId}->{parse_path} = []; | 164 $cities->{$cityId}->{parse_path} = []; |
161 $cities->{$cityId}->{parse_answer} = undef; | 165 $cities->{$cityId}->{parse_answer} = undef; |