Update Battle.php

This commit is contained in:
Shadow
2013-11-29 13:52:57 +02:00
parent 3f0f767297
commit a0b8d91c44
+25 -24
View File
@@ -86,7 +86,7 @@ class Battle {
global $database; global $database;
$heroarray = $database->getHero($uid); $heroarray = $database->getHero($uid);
$herodata = $GLOBALS["h".$heroarray[0]['unit']]; $herodata = $GLOBALS["h".$heroarray[0]['unit']];
$h_atk = $herodata['atk'] + ($heroarray[0]['attack'] * $herodata['atkp']);
$h_atk = $herodata['atk'] + 5 * floor($heroarray[0]['attack'] * $herodata['atkp'] / 5); $h_atk = $herodata['atk'] + 5 * floor($heroarray[0]['attack'] * $herodata['atkp'] / 5);
$h_di = $herodata['di'] + 5 * floor($heroarray[0]['defence'] * $herodata['dip'] / 5); $h_di = $herodata['di'] + 5 * floor($heroarray[0]['defence'] * $herodata['dip'] / 5);
$h_dc = $herodata['dc'] + 5 * floor($heroarray[0]['defence'] * $herodata['dcp'] / 5); $h_dc = $herodata['dc'] + 5 * floor($heroarray[0]['defence'] * $herodata['dcp'] / 5);
@@ -155,10 +155,10 @@ class Battle {
if(!$scout) if(!$scout)
return $this->calculateBattle($attacker,$defender,$wall,$post['a1_v'],$deftribe,$post['palast'],$post['ew1'],$post['ew2'],$post['ktyp']+3,$def_ab,$att_ab1,$att_ab2,$att_ab3,$att_ab4,$att_ab5,$att_ab6,$att_ab7,$att_ab8,$post['kata'],$post['stonemason'],$walllevel,$offhero,0,0,0,0,0); return $this->calculateBattle($attacker,$defender,$wall,$post['a1_v'],$deftribe,$post['palast'],$post['ew1'],$post['ew2'],$post['ktyp']+3,$def_ab,$att_ab1,$att_ab2,$att_ab3,$att_ab4,$att_ab5,$att_ab6,$att_ab7,$att_ab8,$post['kata'],$post['stonemason'],$walllevel,$offhero,$post['h_off'],0,0,0,0,0);
else else
return $this->calculateBattle($attacker,$defender,$wall,$post['a1_v'],$deftribe,$post['palast'],$post['ew1'],$post['ew2'],1,$def_ab,$att_ab1,$att_ab2,$att_ab3,$att_ab4,$att_ab5,$att_ab6,$att_ab7,$att_ab8,$post['kata'],$post['stonemason'],$walllevel,0,0,0,0,0,0); return $this->calculateBattle($attacker,$defender,$wall,$post['a1_v'],$deftribe,$post['palast'],$post['ew1'],$post['ew2'],1,$def_ab,$att_ab1,$att_ab2,$att_ab3,$att_ab4,$att_ab5,$att_ab6,$att_ab7,$att_ab8,$post['kata'],$post['stonemason'],$walllevel,0,0,0,0,0,0,0);
} }
public function getTypeLevel($tid,$vid) { public function getTypeLevel($tid,$vid) {
@@ -209,7 +209,7 @@ class Battle {
} }
//1 raid 0 normal //1 raid 0 normal
function calculateBattle($Attacker,$Defender,$def_wall,$att_tribe,$def_tribe,$residence,$attpop,$defpop,$type,$def_ab,$att_ab1,$att_ab2,$att_ab3,$att_ab4,$att_ab5,$att_ab6,$att_ab7,$att_ab8,$tblevel,$stonemason,$walllevel,$offhero,$AttackerID,$DefenderID,$AttackerWref,$DefenderWref,$conqureby) { function calculateBattle($Attacker,$Defender,$def_wall,$att_tribe,$def_tribe,$residence,$attpop,$defpop,$type,$def_ab,$att_ab1,$att_ab2,$att_ab3,$att_ab4,$att_ab5,$att_ab6,$att_ab7,$att_ab8,$tblevel,$stonemason,$walllevel,$offhero,$hero_strenght,$AttackerID,$DefenderID,$AttackerWref,$DefenderWref,$conqureby) {
global $bid34,$bid35,$database; global $bid34,$bid35,$database;
//fix by ronix //fix by ronix
@@ -322,14 +322,14 @@ class Battle {
} }
$reinfowner = $database->getVillageField($fromvillage,"owner"); $reinfowner = $database->getVillageField($fromvillage,"owner");
$defhero[$fromvillage] = $this->getBattleHero($reinfowner); $defhero = $this->getBattleHero($reinfowner);
//calculate def hero from enforcement //calculate def hero from enforcement
if($defenders['hero'] != 0){ if($defenders['hero'] != 0){
$cdp += $defhero[$fromvillage]['dc']; $cdp += $defhero['dc'];
$dp += $defhero[$fromvillage]['di']; $dp += $defhero['di'];
$dp = $dp * $defhero[$fromvillage]['db']; $dp = $dp * $defhero['db'];
$cdp = $cdp * $defhero[$fromvillage]['db']; $cdp = $cdp * $defhero['db'];
} }
} }
} }
} }
@@ -425,18 +425,19 @@ class Battle {
$units['Att_unit'][$i] = $Attacker['u'.$i]; $units['Att_unit'][$i] = $Attacker['u'.$i];
} }
if ($Attacker['uhero'] != 0) if ($Attacker['uhero'] != 0){
{ $units['Att_unit']['hero'] = $Attacker['uhero'];
$units['Att_unit']['hero'] = $Attacker['uhero']; $ap += $atkhero['atk'];
$ap = $ap * $atkhero['ob']; $ap = $ap * $atkhero['ob'];
$cap = $cap * $atkhero['ob']; $cap = $cap * $atkhero['ob'];
} }
if ($offhero!=0) { if ($offhero!=0 || $hero_strenght!=0) {
$atkhero=$this->getBattleHeroSim($offhero); $atkhero=$this->getBattleHeroSim($offhero);
$ap = $ap * $atkhero['ob']; $ap += $hero_strenght;
$cap = $cap * $atkhero['ob']; $ap = $ap * $atkhero['ob'];
} $cap = $cap * $atkhero['ob'];
}
} }