Mercurial > eagle-eye
changeset 198:2dfeb4371db7
fixed train_navy counting and corruption counting
author | "Rex Tsai <chihchun@kalug.linux.org.tw>" |
---|---|
date | Mon, 03 Nov 2008 11:42:59 +0800 |
parents | dbdd7dcc91c6 |
children | b33c8dbe9b04 |
files | agent.pl |
diffstat | 1 files changed, 4 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/agent.pl Mon Nov 03 03:17:43 2008 +0800 +++ b/agent.pl Mon Nov 03 11:42:59 2008 +0800 @@ -56,14 +56,14 @@ sub is_corruption { my ($self, $city) = @_; - return $city->{corruption}; + return ($city->{corruption} > 0) ? 1 : 0; } sub is_any_corruption { my ($self, $city) = @_; foreach (keys(%{$self->{ikariam}->{cities}})) { - return 1 if($self->{ikariam}->{cities}->{$_}->{corruption} == 1); + return ($self->{ikariam}->{cities}->{$_}->{corruption} > 0) ? 1 : 0; } return 0; } @@ -225,7 +225,8 @@ # TODO, 依照升級比例算 CP 值最高 if($self->is_greekfire_researched() eq 1 && $city->{buildings}->{shipyard} >= 5) { # ok, we can build Flamethrower. - if(($city->{'fleet'}->{BallistaShip} / $city->{'fleet'}->{Flamethrower}) <= (1.5/1)) { + if(defined($city->{'fleet'}->{Flamethrower}) && ($city->{'fleet'}->{Flamethrower} > 0) + && ($city->{'fleet'}->{BallistaShip} / $city->{'fleet'}->{Flamethrower}) <= (1.5/1)) { return 213; # 強弩船 } else { return 211; # 噴火船