comparison warfare.pl @ 105:c86e2182d3b8

..
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Wed, 29 Oct 2008 15:11:24 +0800
parents b369fe3c1992
children 554bdd49c703
comparison
equal deleted inserted replaced
104:b369fe3c1992 105:c86e2182d3b8
74 74
75 # check if we over-attacked 75 # check if we over-attacked
76 my $c = Ikariam::Report->search_attack($city->cityId, time - 24*60*60 - 7*60*60)->count(); 76 my $c = Ikariam::Report->search_attack($city->cityId, time - 24*60*60 - 7*60*60)->count();
77 # check the current plunders 77 # check the current plunders
78 foreach (@{$self->{ikariam}->{'military'}->{'homeland'}}) { 78 foreach (@{$self->{ikariam}->{'military'}->{'homeland'}}) {
79 printf(Dumper($_));
80 $c++ if($_->{to} eq $city->cityId); 79 $c++ if($_->{to} eq $city->cityId);
81 } 80 }
82 next if($c >= 4); 81 next if($c >= 4);
83 82
84 # { 83 # {
116 our $rules = Ikariam::Warfare::Rules->new($i); 115 our $rules = Ikariam::Warfare::Rules->new($i);
117 116
118 $i->login; 117 $i->login;
119 my $cities = $i->check; 118 my $cities = $i->check;
120 $i->checkMilitaryAdvisorCombatReports(); 119 $i->checkMilitaryAdvisorCombatReports();
121 print Dump($i->{'military'});
122 120
123 foreach my $cityId (keys(%$cities)) { 121 foreach my $cityId (keys(%$cities)) {
122 print Dump($i->{'military'});
124 # build and upgrade for cities 123 # build and upgrade for cities
125 my $tree = LoadFile('warfare.yaml'); 124 my $tree = LoadFile('warfare.yaml');
126 $cities->{$cityId}->{parse_path} = []; 125 $cities->{$cityId}->{parse_path} = [];
127 $cities->{$cityId}->{parse_answer} = undef; 126 $cities->{$cityId}->{parse_answer} = undef;
128 if(ParseTree($tree, $rules, $cities->{$cityId}) eq 'engagement') { 127 if(ParseTree($tree, $rules, $cities->{$cityId}) eq 'engagement') {