Mercurial > eagle-eye
changeset 192:d6dc50b64f06
rules to fix corruption
author | "Rex Tsai <chihchun@kalug.linux.org.tw>" |
---|---|
date | Sun, 02 Nov 2008 23:39:49 +0800 |
parents | 8705eaa33210 |
children | a6a4a48d5fda |
files | agent.pl city.yaml |
diffstat | 2 files changed, 14 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/agent.pl Sun Nov 02 22:47:55 2008 +0800 +++ b/agent.pl Sun Nov 02 23:39:49 2008 +0800 @@ -45,9 +45,17 @@ return ($city->{space}->{total} <= ($city->{space}->{occupied} + ($city->{growth}*6)) ? 0 : 1) } +sub is_warehouse_enougn_for_governorsresidence { + my ($self, $city) = @_; + my @warehouse = (qw/undef 0 4 9 16 18 19 20 21 22 23 24 25/); + my @cities = keys(%{$::i->{cities}}); + + return ($city->{buildings}->{warehouse} < $warehouse[$#cities]) ? 0 : 1; +} + sub is_corruption { my ($self, $city) = @_; - return 0; + return $city->{corruption}; } sub is_happiness {
--- a/city.yaml Sun Nov 02 22:47:55 2008 +0800 +++ b/city.yaml Sun Nov 02 23:39:49 2008 +0800 @@ -11,14 +11,17 @@ # XXX: 這樣會一口氣買同等城市數量的船耶 # - is_gold_enoughforcargo: # 1: increaseTransporter + - is_corruption: + 1: + - is_warehouse_enougn_for_governorsresidence: + 0: build_warehouse + 1: build_governorsresidence - is_space_enough: 0: - is_resource_enoghforHall: 1: build_townHall - is_wall_enough: 0: build_wall - - is_corruption: - 1: build_governorsresidence # 倉庫庫存量 - is_warehouse_enough: 0: build_warehouse