mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-09-05 01:47:16 +00:00
Fixed some catapult/ram bugs
Battle.php: Fixed the blacksmith level formula for catapults and rams. Automation.php: +Catapults and rams now works better because of a new formula. Note: this formula isn't 100% accurate with the real Travian formula, i can't find that formula anywhere, so i created an approximate formula.
This commit is contained in:
@@ -1151,24 +1151,13 @@ class Automation {
|
|||||||
else
|
else
|
||||||
// building/field was damaged, let's calculate the actual damage
|
// building/field was damaged, let's calculate the actual damage
|
||||||
{
|
{
|
||||||
//TODO: MUST TO BE FIX This part goes also below 0 if u have a lot of catapults
|
$totallvl = round($tblevel-((pow(M_E, ($twoRowsCatapultSetup ? ($battlepart[4]/$battlepart[3])/2 : $battlepart[4]/$battlepart[3]))-1) * ($tblevel/2)));
|
||||||
// TODO: this whole math seems incorrect, it needs a revision, and potentially a rewrite
|
|
||||||
$totallvl = round( sqrt( pow( ( $tblevel + 0.5 ), 2 ) - ( ( !$twoRowsCatapultSetup ? (float) $battlepart[4] : (float) $battlepart[4] / 2 ) * 8 ) ) );
|
|
||||||
// sometimes this goes above the actual level, so in that case we just reverse everything
|
|
||||||
// and take the buiding down so many levels
|
|
||||||
if ($totallvl > $tblevel) {
|
|
||||||
$totallvl = $tblevel - ($totallvl - $tblevel);
|
|
||||||
}
|
|
||||||
|
|
||||||
// don't allow this to go below 0
|
|
||||||
if ($totallvl < 0) {
|
|
||||||
$totallvl = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// no damage to the building/field
|
// no damage to the building/field
|
||||||
if ($tblevel == $totallvl) {
|
if ($tblevel == $totallvl) {
|
||||||
$info_cata = " was not damaged.";
|
$info_cata = " was not damaged.";
|
||||||
} else // building/field damaged, damage calculations to follow
|
}
|
||||||
|
else // building/field damaged, damage calculations to follow
|
||||||
{
|
{
|
||||||
// update $bdo, so we don't have to reselect later
|
// update $bdo, so we don't have to reselect later
|
||||||
$bdo['f' . $catapultTarget] = $totallvl;
|
$bdo['f' . $catapultTarget] = $totallvl;
|
||||||
@@ -2295,7 +2284,7 @@ class Automation {
|
|||||||
|
|
||||||
$info_ram = "".$ram_pic.",Wall was not damaged.";
|
$info_ram = "".$ram_pic.",Wall was not damaged.";
|
||||||
}else{
|
}else{
|
||||||
$totallvl = round(sqrt(pow(($walllevel+0.5),2)-($battlepart[8]*8)));
|
$totallvl = round($walllevel-((pow(M_E, $battlepart[8]/$battlepart[7])-1) * ($walllevel/2)));
|
||||||
if($walllevel == $totallvl){
|
if($walllevel == $totallvl){
|
||||||
$info_ram = "".$ram_pic.",Wall was not damaged.";
|
$info_ram = "".$ram_pic.",Wall was not damaged.";
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
@@ -583,7 +583,7 @@ class Battle {
|
|||||||
if($catp > 0 && $tblevel != 0) {
|
if($catp > 0 && $tblevel != 0) {
|
||||||
$wctp = pow(($rap/$rdp),1.5);
|
$wctp = pow(($rap/$rdp),1.5);
|
||||||
$wctp = ($wctp >= 1)? 1-0.5/$wctp : 0.5*$wctp;
|
$wctp = ($wctp >= 1)? 1-0.5/$wctp : 0.5*$wctp;
|
||||||
$wctp *= $catp+($att_ab8/1.5);
|
$wctp *= $catp + (round(200 * pow(1.0205,$att_ab8))/200);
|
||||||
$artowner = $database->getVillageField( $DefenderWref, "owner" );
|
$artowner = $database->getVillageField( $DefenderWref, "owner" );
|
||||||
$bartefact = count($database->getOwnUniqueArtefactInfo2($artowner,1,3,0));
|
$bartefact = count($database->getOwnUniqueArtefactInfo2($artowner,1,3,0));
|
||||||
$bartefact1 = count($database->getOwnUniqueArtefactInfo2($DefenderWref,1,1,1));
|
$bartefact1 = count($database->getOwnUniqueArtefactInfo2($DefenderWref,1,1,1));
|
||||||
@@ -626,7 +626,7 @@ class Battle {
|
|||||||
if($ram > 0 && $walllevel != 0) {
|
if($ram > 0 && $walllevel != 0) {
|
||||||
$wctp = pow(($rap/$rdp),1.5);
|
$wctp = pow(($rap/$rdp),1.5);
|
||||||
$wctp = ($wctp >= 1)? 1-0.5/$wctp : 0.5*$wctp;
|
$wctp = ($wctp >= 1)? 1-0.5/$wctp : 0.5*$wctp;
|
||||||
$wctp *= ($ram/2) + ($att_ab7/1.5);
|
$wctp *= ($ram/2) + (round(200 * pow(1.0205,$att_ab7))/200);
|
||||||
$artowner = $database->getVillageField( $DefenderWref, "owner" );
|
$artowner = $database->getVillageField( $DefenderWref, "owner" );
|
||||||
$bartefact = count($database->getOwnUniqueArtefactInfo2($artowner,1,3,0));
|
$bartefact = count($database->getOwnUniqueArtefactInfo2($artowner,1,3,0));
|
||||||
$bartefact1 = count($database->getOwnUniqueArtefactInfo2($DefenderWref,1,1,1));
|
$bartefact1 = count($database->getOwnUniqueArtefactInfo2($DefenderWref,1,1,1));
|
||||||
|
|||||||
Reference in New Issue
Block a user