# HG changeset patch # User "Rex Tsai " # Date 1225640389 -28800 # Node ID d6dc50b64f068d340c7a526a224ca7c48aeaa5cc # Parent 8705eaa3321063b4c03050d1109684592e835e82 rules to fix corruption diff -r 8705eaa33210 -r d6dc50b64f06 agent.pl --- 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 { diff -r 8705eaa33210 -r d6dc50b64f06 city.yaml --- 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