diff agent.pl @ 192:d6dc50b64f06

rules to fix corruption
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Sun, 02 Nov 2008 23:39:49 +0800
parents 2362c8c8909e
children a6a4a48d5fda
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 {