comparison warfare.pl @ 135:4194f261798b

check for transporters is available
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Fri, 31 Oct 2008 02:04:52 +0800
parents 2ff3704cca0e
children 25dcc1fffeef
comparison
equal deleted inserted replaced
134:21df8eb17a52 135:4194f261798b
19 AND user.army_score_main = 0 19 AND user.army_score_main = 0
20 AND cities.island IN (SELECT island.id FROM island WHERE island.x <= ? AND island.x >= ? AND island.y <= ? AND island.y >= ? ) 20 AND cities.island IN (SELECT island.id FROM island WHERE island.x <= ? AND island.x >= ? AND island.y <= ? AND island.y >= ? )
21 ORDER BY cities.citylevel * (cities.citylevel - 1) * user.trader_score_secondary / 10000 DESC 21 ORDER BY cities.citylevel * (cities.citylevel - 1) * user.trader_score_secondary / 10000 DESC
22 } 22 }
23 ); 23 );
24 # $island->tradegood, 24
25 # qw/NULL 葡萄酒 大理石 水晶 硫磺/;
26 # 不打與自己相同的資源
27 Ikariam::Report->set_sql(victim => qq { 25 Ikariam::Report->set_sql(victim => qq {
28 SELECT report.id 26 SELECT report.id
29 FROM report 27 FROM report
30 WHERE report.city = ? 28 WHERE report.city = ?
31 AND report.date >= ? 29 AND report.date >= ?
46 } 44 }
47 45
48 sub is_actionPoint_enough { 46 sub is_actionPoint_enough {
49 my ($self, $city) = @_; 47 my ($self, $city) = @_;
50 return ($city->{actionPoints} > ($city->{maxActionPoints}/2) ) ? 1 : 0; 48 return ($city->{actionPoints} > ($city->{maxActionPoints}/2) ) ? 1 : 0;
49 }
50
51 sub is_transporters_available {
52 my ($self, $city) = @_;
53 return ($city->{transporters}->{avail} > 0) ? 1 : 0;
51 } 54 }
52 55
53 sub is_army_available { 56 sub is_army_available {
54 my ($self, $city) = @_; 57 my ($self, $city) = @_;
55 return ($city->{army}->{Swordsman} >= 2 ) ? 1 : 0; 58 return ($city->{army}->{Swordsman} >= 2 ) ? 1 : 0;