fix faster troops artefact

This commit is contained in:
unknown
2012-06-08 14:20:25 +03:00
parent 11c38531d2
commit 4efa1e205f
2 changed files with 78 additions and 8 deletions
+39 -3
View File
@@ -2080,7 +2080,19 @@ $crannyimg = "<img src=\"".GP_LOCATE."img/g/g23.gif\" height=\"20\" width=\"15\"
// If the dead units not equal the ammount sent they will return and report
if($unitsdead_att != $unitssend_att or $dead11 != $herosend_att)
{
$endtime = $this->procDistanceTime($from,$to,min($speeds),1) + $AttackArrivalTime;
$artefact = count($database->getOwnUniqueArtefactInfo2($from['owner'],2,3,0));
$artefact1 = count($database->getOwnUniqueArtefactInfo2($from['vref'],2,1,1));
$artefact2 = count($database->getOwnUniqueArtefactInfo2($from['owner'],2,2,0));
if($artefact > 0){
$fastertroops = 3;
}else if($artefact1 > 1){
$fastertroops = 2;
}else if($artefact2 > 1){
$fastertroops = 1.5;
}else{
$fastertroops = 1;
}
$endtime = round($this->procDistanceTime($from,$to,min($speeds),1)/$fastertroops) + $AttackArrivalTime;
//$endtime = $this->procDistanceTime($from,$to,min($speeds),1) + time();
if($type == 1) {
$database->addNotice($from['owner'],$to['wref'],$ownally,18,''.addslashes($from['name']).' scouts '.addslashes($to['name']).'',$data2,$AttackArrivalTime);
@@ -2186,7 +2198,19 @@ $crannyimg = "<img src=\"".GP_LOCATE."img/g/g23.gif\" height=\"20\" width=\"15\"
$hero_unit=$hero_f['unit'];
$speeds[] = $GLOBALS['u'.$hero_unit]['speed'];
}
$endtime = $this->procDistanceTime($from,$to,min($speeds),1) + time();
$artefact = count($database->getOwnUniqueArtefactInfo2($from['owner'],2,3,0));
$artefact1 = count($database->getOwnUniqueArtefactInfo2($from['vref'],2,1,1));
$artefact2 = count($database->getOwnUniqueArtefactInfo2($from['owner'],2,2,0));
if($artefact > 0){
$fastertroops = 3;
}else if($artefact1 > 1){
$fastertroops = 2;
}else if($artefact2 > 1){
$fastertroops = 1.5;
}else{
$fastertroops = 1;
}
$endtime = round($this->procDistanceTime($from,$to,min($speeds),1)/$fastertroops) + time();
$database->setMovementProc($data['moveid']);
$database->addMovement(4,$to['wref'],$from['wref'],$data['ref'],time(),$endtime);
$peace = PEACE;
@@ -2342,7 +2366,19 @@ $crannyimg = "<img src=\"".GP_LOCATE."img/g/g23.gif\" height=\"20\" width=\"15\"
} else {
$post['t11']='0';
}
$time = $generator->procDistanceTime($fromCor,$toCor,min($speeds),1);
$artefact = count($database->getOwnUniqueArtefactInfo2($from['owner'],2,3,0));
$artefact1 = count($database->getOwnUniqueArtefactInfo2($from['vref'],2,1,1));
$artefact2 = count($database->getOwnUniqueArtefactInfo2($from['owner'],2,2,0));
if($artefact > 0){
$fastertroops = 3;
}else if($artefact1 > 1){
$fastertroops = 2;
}else if($artefact2 > 1){
$fastertroops = 1.5;
}else{
$fastertroops = 1;
}
$time = round($generator->procDistanceTime($fromCor,$toCor,min($speeds),1)/$fastertroops);
$reference = $database->addAttack($enforce['from'],$post['t1'],$post['t2'],$post['t3'],$post['t4'],$post['t5'],$post['t6'],$post['t7'],$post['t8'],$post['t9'],$post['t10'],$post['t11'],2,0,0,0,0);
$database->addMovement(4,$village->wid,$enforce['from'],$reference,time(),($time+time()));
$technology->checkReinf($post['ckey']);
+39 -5
View File
@@ -306,8 +306,19 @@ class Units {
$speeds[] = $herodata['speed'];
}
}
$time = $generator->procDistanceTime($from,$to,min($speeds),1);
$artefact = count($database->getOwnUniqueArtefactInfo2($session->uid,2,3,0));
$artefact1 = count($database->getOwnUniqueArtefactInfo2($village->wid,2,1,1));
$artefact2 = count($database->getOwnUniqueArtefactInfo2($session->uid,2,2,0));
if($artefact > 0){
$fastertroops = 3;
}else if($artefact1 > 1){
$fastertroops = 2;
}else if($artefact2 > 1){
$fastertroops = 1.5;
}else{
$fastertroops = 1;
}
$time = round($generator->procDistanceTime($from,$to,min($speeds),1)/$fastertroops);
if (isset($post['ctar1'])){$post['ctar1'] = $post['ctar1'];}else{ $post['ctar1'] = 0;}
if (isset($post['ctar2'])){$post['ctar2'] = $post['ctar2'];}else{ $post['ctar2'] = 0;}
if (isset($post['spy'])){$post['spy'] = $post['spy'];}else{ $post['spy'] = 0;}
@@ -423,7 +434,19 @@ class Units {
} else {
$post['t11']='0';
}
$time = $generator->procDistanceTime($fromCor,$toCor,min($speeds),1);
$artefact = count($database->getOwnUniqueArtefactInfo2($session->uid,2,3,0));
$artefact1 = count($database->getOwnUniqueArtefactInfo2($village->wid,2,1,1));
$artefact2 = count($database->getOwnUniqueArtefactInfo2($session->uid,2,2,0));
if($artefact > 0){
$fastertroops = 3;
}else if($artefact1 > 1){
$fastertroops = 2;
}else if($artefact2 > 1){
$fastertroops = 1.5;
}else{
$fastertroops = 1;
}
$time = round($generator->procDistanceTime($fromCor,$toCor,min($speeds),1)/$fastertroops);
$reference = $database->addAttack($enforce['from'],$post['t1'],$post['t2'],$post['t3'],$post['t4'],$post['t5'],$post['t6'],$post['t7'],$post['t8'],$post['t9'],$post['t10'],$post['t11'],2,0,0,0,0);
$database->addMovement(4,$village->wid,$enforce['from'],$reference,time(),($time+time()));
$technology->checkReinf($post['ckey']);
@@ -452,10 +475,21 @@ class Units {
if($rallypoint['f39'] > 0){
if($cps >= $need_cps) {
$unit = ($session->tribe*10);
$artefact = count($database->getOwnUniqueArtefactInfo2($session->uid,2,3,0));
$artefact1 = count($database->getOwnUniqueArtefactInfo2($village->wid,2,1,1));
$artefact2 = count($database->getOwnUniqueArtefactInfo2($session->uid,2,2,0));
if($artefact > 0){
$fastertroops = 3;
}else if($artefact1 > 1){
$fastertroops = 2;
}else if($artefact2 > 1){
$fastertroops = 1.5;
}else{
$fastertroops = 1;
}
$database->modifyResource($village->wid,750,750,750,750,0);
$database->modifyUnit($village->wid,array($unit),array(3),array(0));
$database->addMovement(5,$village->wid,$post['s'],0,time(),$post['timestamp']);
$database->addMovement(5,$village->wid,$post['s'],0,time(),round(($post['timestamp']-time())/$fastertroops)+time());
header("Location: build.php?id=39");
if($form->returnErrors() > 0) {