# HG changeset patch # User "Rex Tsai " # Date 1225683779 -28800 # Node ID 2dfeb4371db7dc29b9d3f99a2b7de415be4dda6d # Parent dbdd7dcc91c6e2a50eb30598ffb98203089bf501 fixed train_navy counting and corruption counting diff -r dbdd7dcc91c6 -r 2dfeb4371db7 agent.pl --- 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; # 噴火船