comparison warfare.pl @ 107:554bdd49c703

we should also count the force which is coming back
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Wed, 29 Oct 2008 15:21:15 +0800
parents c86e2182d3b8
children d3bece9b06b2
comparison
equal deleted inserted replaced
106:31803acb9c5f 107:554bdd49c703
73 } 73 }
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 $c++ if($_->{to} eq $city->cityId); 79 $c++ if($_{to} eq $city->cityId);
80 $c++ if($_{from} eq $city->cityId);
80 } 81 }
81 next if($c >= 4); 82 next if($c >= 4);
82 83
83 # { 84 # {
84 # if(1) { 85 # if(1) {
85 my $capture = $city->citylevel * ($city->citylevel - 1) * $sheep->trader_score_secondary / 10000; 86 my $capture = $city->citylevel * ($city->citylevel - 1) * $sheep->trader_score_secondary / 10000;
86 my $line = sprintf("%d %s [%d,%d] %s (%d) %s/%s", 87 my $line = sprintf("%d %s [%d,%d] %s (%d) %s/%s",
87 $capture, $city->status, 88 $capture, $city->status,
116 117
117 $i->login; 118 $i->login;
118 my $cities = $i->check; 119 my $cities = $i->check;
119 $i->checkMilitaryAdvisorCombatReports(); 120 $i->checkMilitaryAdvisorCombatReports();
120 121
122
121 foreach my $cityId (keys(%$cities)) { 123 foreach my $cityId (keys(%$cities)) {
122 print Dump($i->{'military'}); 124 print Dump($i->{'military'});
123 # build and upgrade for cities 125 # build and upgrade for cities
124 my $tree = LoadFile('warfare.yaml'); 126 my $tree = LoadFile('warfare.yaml');
125 $cities->{$cityId}->{parse_path} = []; 127 $cities->{$cityId}->{parse_path} = [];