mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-08-29 06:37:15 +00:00
format by hand
This commit is contained in:
+91
-130
@@ -52,9 +52,11 @@ class Battle {
|
|||||||
}
|
}
|
||||||
if(isset($post['wall3']) && $post['wall3'] == "") {
|
if(isset($post['wall3']) && $post['wall3'] == "") {
|
||||||
$post['wall3'] = 0;
|
$post['wall3'] = 0;
|
||||||
}if(isset($post['wall4']) && $post['wall4'] == "") {
|
}
|
||||||
|
if(isset($post['wall4']) && $post['wall4'] == "") {
|
||||||
$post['wall4'] = 0;
|
$post['wall4'] = 0;
|
||||||
}if(isset($post['wall5']) && $post['wall5'] == "") {
|
}
|
||||||
|
if(isset($post['wall5']) && $post['wall5'] == "") {
|
||||||
$post['wall5'] = 0;
|
$post['wall5'] = 0;
|
||||||
}
|
}
|
||||||
$post['tribe'] = $target[0];
|
$post['tribe'] = $target[0];
|
||||||
@@ -86,8 +88,7 @@ class Battle {
|
|||||||
for($i=$start;$i<=($start+9);$i++) {
|
for($i=$start;$i<=($start+9);$i++) {
|
||||||
$attacker['u'.$i] = $post['a1_'.$index];
|
$attacker['u'.$i] = $post['a1_'.$index];
|
||||||
if($index <=8) {
|
if($index <=8) {
|
||||||
${
|
${att_ab.$index} = $post['f1_'.$index];
|
||||||
att_ab.$index} = $post['f1_'.$index];
|
|
||||||
}
|
}
|
||||||
$index += 1;
|
$index += 1;
|
||||||
}
|
}
|
||||||
@@ -105,32 +106,27 @@ class Battle {
|
|||||||
switch($deftribe) {
|
switch($deftribe) {
|
||||||
case 1:
|
case 1:
|
||||||
for($i=1;$i<=8;$i++) {
|
for($i=1;$i<=8;$i++) {
|
||||||
${
|
${def_ab.$i} = $post['f2_'.$i];
|
||||||
def_ab.$i} = $post['f2_'.$i];
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
for($i=11;$i<=18;$i++) {
|
for($i=11;$i<=18;$i++) {
|
||||||
${
|
${def_ab.$i-10} = $post['f2_'.$i];
|
||||||
def_ab.$i-10} = $post['f2_'.$i];
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
for($i=21;$i<=28;$i++) {
|
for($i=21;$i<=28;$i++) {
|
||||||
${
|
${def_ab.$i-20} = $post['f2_'.$i];
|
||||||
def_ab.$i-20} = $post['f2_'.$i];
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
for($i=31;$i<=38;$i++) {
|
for($i=31;$i<=38;$i++) {
|
||||||
${
|
${def_ab.$i-30} = $post['f2_'.$i];
|
||||||
def_ab.$i-30} = $post['f2_'.$i];
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
for($i=41;$i<=48;$i++) {
|
for($i=41;$i<=48;$i++) {
|
||||||
${
|
${def_ab.$i-40} = $post['f2_'.$i];
|
||||||
def_ab.$i-40} = $post['f2_'.$i];
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -294,87 +290,69 @@ class Battle {
|
|||||||
if($type == 1)
|
if($type == 1)
|
||||||
{
|
{
|
||||||
for($i=$start;$i<=$end;$i++) {
|
for($i=$start;$i<=$end;$i++) {
|
||||||
global ${
|
global ${'u'.$i};
|
||||||
'u'.$i};
|
$j = $i-$start+1;
|
||||||
$j = $i-$start+1;
|
if($abcount <= 8 && ${att_ab.$abcount} > 0) {
|
||||||
if($abcount <= 8 && ${
|
$ap += (35 + ( 35 + 300 * ${'u'.$i}['pop'] / 7) * (pow(1.007, ${att_ab.$abcount}) - 1)) * $Attacker['u'.$i] * $attacker_artefact;
|
||||||
att_ab.$abcount} > 0) {
|
$att_foolartefact = $database->getFoolArtefactInfo(3,$AttackerWref,$AttackerID);
|
||||||
|
if(count($att_foolartefact) > 0){
|
||||||
$ap += (35 + ( 35 + 300 * ${
|
foreach($att_foolartefact as $arte){
|
||||||
'u'.$i}['pop'] / 7) * (pow(1.007, ${
|
if($arte['bad_effect'] == 1){
|
||||||
att_ab.$abcount}) - 1)) * $Attacker['u'.$i] * $attacker_artefact;
|
$ap *= $arte['effect2'];
|
||||||
$att_foolartefact = $database->getFoolArtefactInfo(3,$AttackerWref,$AttackerID);
|
}else{
|
||||||
if(count($att_foolartefact) > 0){
|
$ap /= $arte['effect2'];
|
||||||
foreach($att_foolartefact as $arte){
|
$ap = round($ap);
|
||||||
if($arte['bad_effect'] == 1){
|
}
|
||||||
$ap *= $arte['effect2'];
|
|
||||||
}else{
|
|
||||||
$ap /= $arte['effect2'];
|
|
||||||
$ap = round($ap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$ap += ($Attacker['u'.$i] * $Attacker['u'.$i] * $Attacker['u'.$i])/3;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$ap += ($Attacker['u'.$i] * $Attacker['u'.$i] * $Attacker['u'.$i])/3;
|
||||||
|
}
|
||||||
|
|
||||||
|
$units['Att_unit'][$i] = $Attacker['u'.$i];
|
||||||
$units['Att_unit'][$i] = $Attacker['u'.$i];
|
|
||||||
}
|
}
|
||||||
if ($Attacker['uhero'] != 0){
|
if ($Attacker['uhero'] != 0){
|
||||||
$ap += $atkhero['atk'] * 35;
|
$ap += $atkhero['atk'] * 35;
|
||||||
$ap = $ap * $atkhero['ob'];
|
$ap = $ap * $atkhero['ob'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$abcount = 1;
|
$abcount = 1;
|
||||||
for($i=$start;$i<=$end;$i++) {
|
for($i=$start;$i<=$end;$i++) {
|
||||||
global ${
|
global ${'u'.$i};
|
||||||
'u'.$i};
|
$j = $i-$start+1;
|
||||||
$j = $i-$start+1;
|
if($abcount <= 8 && ${att_ab.$abcount} > 0) {
|
||||||
if($abcount <= 8 && ${
|
if(in_array($i,$calvary)) {
|
||||||
att_ab.$abcount} > 0) {
|
$cap += (${'u'.$i}['atk'] + (${'u'.$i}['atk'] + 300 * ${'u'.$i}['pop'] / 7) * (pow(1.007, ${att_ab.$abcount}) - 1)) * $Attacker['u'.$i];
|
||||||
if(in_array($i,$calvary)) {
|
}
|
||||||
$cap += (${
|
else {
|
||||||
'u'.$i}['atk'] + (${
|
$ap += (${'u'.$i}['atk'] + (${'u'.$i}['atk'] + 300 * ${'u'.$i}['pop'] / 7) * (pow(1.007, ${att_ab.$abcount}) - 1)) * $Attacker['u'.$i];
|
||||||
'u'.$i}['atk'] + 300 * ${
|
}
|
||||||
'u'.$i}['pop'] / 7) * (pow(1.007, ${
|
}
|
||||||
att_ab.$abcount}) - 1)) * $Attacker['u'.$i];
|
else {
|
||||||
}
|
if(in_array($i,$calvary)) {
|
||||||
else {
|
$cap += $Attacker['u'.$i]*${'u'.$i}['atk'];
|
||||||
$ap += (${
|
}
|
||||||
'u'.$i}['atk'] + (${
|
else {
|
||||||
'u'.$i}['atk'] + 300 * ${
|
$ap += $Attacker['u'.$i]*${'u'.$i}['atk'];
|
||||||
'u'.$i}['pop'] / 7) * (pow(1.007, ${
|
}
|
||||||
att_ab.$abcount}) - 1)) * $Attacker['u'.$i];
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(in_array($i,$calvary)) {
|
|
||||||
$cap += $Attacker['u'.$i]*${
|
|
||||||
'u'.$i}['atk'];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$ap += $Attacker['u'.$i]*${
|
|
||||||
'u'.$i}['atk'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$abcount +=1;
|
$abcount +=1;
|
||||||
// catapult attack
|
// catapult attack
|
||||||
if(in_array($i,$catapult)) {
|
if(in_array($i,$catapult)) {
|
||||||
$catp += $Attacker['u'.$i];
|
$catp += $Attacker['u'.$i];
|
||||||
}
|
}
|
||||||
// ram
|
// ram
|
||||||
if(in_array($i,$rams))
|
if(in_array($i,$rams))
|
||||||
{
|
{
|
||||||
$ram += $Attacker['u'.$i];
|
$ram += $Attacker['u'.$i];
|
||||||
}
|
}
|
||||||
$involve += $Attacker['u'.$i];
|
$involve += $Attacker['u'.$i];
|
||||||
$units['Att_unit'][$i] = $Attacker['u'.$i];
|
$units['Att_unit'][$i] = $Attacker['u'.$i];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($Attacker['uhero'] != 0)
|
if ($Attacker['uhero'] != 0)
|
||||||
@@ -401,30 +379,26 @@ class Battle {
|
|||||||
for($y=4;$y<=44;$y++) {
|
for($y=4;$y<=44;$y++) {
|
||||||
if($y == 4 || $y == 14 || $y == 23 || $y == 44)
|
if($y == 4 || $y == 14 || $y == 23 || $y == 44)
|
||||||
{
|
{
|
||||||
global ${
|
global ${'u'.$y};
|
||||||
'u'.$y};
|
if($y >= $start && $y <= ($end-2) && ${def_ab.$abcount} > 0) {
|
||||||
if($y >= $start && $y <= ($end-2) && ${
|
$dp += (20 + (20 + 300 * ${'u'.$y}['pop'] / 7) * (pow(1.007, ${def_ab.$abcount}) - 1)) * (($Defender['u'.$y]*$Defender['u'.$y]*$Defender['u'.$y])/4) * $defender_artefact;
|
||||||
def_ab.$abcount} > 0) {
|
$abcount +=1;
|
||||||
$dp += (20 + (20 + 300 * ${
|
$def_foolartefact = $database->getFoolArtefactInfo(3,$AttackerWref,$AttackerID);
|
||||||
'u'.$y}['pop'] / 7) * (pow(1.007, ${
|
if(count($def_foolartefact) > 0){
|
||||||
def_ab.$abcount}) - 1)) * (($Defender['u'.$y]*$Defender['u'.$y]*$Defender['u'.$y])/4) * $defender_artefact;
|
foreach($def_foolartefact as $arte){
|
||||||
$abcount +=1;
|
if($arte['bad_effect'] == 1){
|
||||||
$def_foolartefact = $database->getFoolArtefactInfo(3,$AttackerWref,$AttackerID);
|
$dp *= $arte['effect2'];
|
||||||
if(count($def_foolartefact) > 0){
|
}else{
|
||||||
foreach($def_foolartefact as $arte){
|
$dp /= $arte['effect2'];
|
||||||
if($arte['bad_effect'] == 1){
|
$dp = round($dp);
|
||||||
$dp *= $arte['effect2'];
|
|
||||||
}else{
|
|
||||||
$dp /= $arte['effect2'];
|
|
||||||
$dp = round($dp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
}
|
||||||
$dp += ($Defender['u'.$y]*$Defender['u'.$y]*$Defender['u'.$y])/4;
|
else {
|
||||||
}
|
$dp += ($Defender['u'.$y]*$Defender['u'.$y]*$Defender['u'.$y])/4;
|
||||||
$units['Def_unit'][$y] = $Defender['u'.$y];
|
}
|
||||||
|
$units['Def_unit'][$y] = $Defender['u'.$y];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($Defender['hero'] != 0){
|
if ($Defender['hero'] != 0){
|
||||||
@@ -444,30 +418,18 @@ class Battle {
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
for($y=1;$y<=50;$y++) {
|
for($y=1;$y<=50;$y++) {
|
||||||
global ${
|
global ${'u'.$y};
|
||||||
'u'.$y};
|
if($y >= $start && $y <= ($end-2) && ${def_ab.$abcount} > 0) {
|
||||||
if($y >= $start && $y <= ($end-2) && ${
|
$dp += (${'u'.$y}['di'] + (${'u'.$y}['di'] + 300 * ${'u'.$y}['pop'] / 7) * (pow(1.007, ${def_ab.$abcount}) - 1)) * $Defender['u'.$y];
|
||||||
def_ab.$abcount} > 0) {
|
$cdp += (${'u'.$y}['dc'] + (${'u'.$y}['dc'] + 300 * ${'u'.$y}['pop'] / 7) * (pow(1.007, ${def_ab.$abcount}) - 1)) * $Defender['u'.$y];
|
||||||
$dp += (${
|
}
|
||||||
'u'.$y}['di'] + (${
|
else {
|
||||||
'u'.$y}['di'] + 300 * ${
|
$dp += $Defender['u'.$y]*${'u'.$y}['di'];
|
||||||
'u'.$y}['pop'] / 7) * (pow(1.007, ${
|
$cdp += $Defender['u'.$y]*${'u'.$y}['dc'];
|
||||||
def_ab.$abcount}) - 1)) * $Defender['u'.$y];
|
}
|
||||||
$cdp += (${
|
$involve += $Defender['u'.$y];
|
||||||
'u'.$y}['dc'] + (${
|
$units['Def_unit'][$y] = $Defender['u'.$y];
|
||||||
'u'.$y}['dc'] + 300 * ${
|
$abcount +=1;
|
||||||
'u'.$y}['pop'] / 7) * (pow(1.007, ${
|
|
||||||
def_ab.$abcount}) - 1)) * $Defender['u'.$y];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$dp += $Defender['u'.$y]*${
|
|
||||||
'u'.$y}['di'];
|
|
||||||
$cdp += $Defender['u'.$y]*${
|
|
||||||
'u'.$y}['dc'];
|
|
||||||
}
|
|
||||||
$involve += $Defender['u'.$y];
|
|
||||||
$units['Def_unit'][$y] = $Defender['u'.$y];
|
|
||||||
$abcount +=1;
|
|
||||||
}
|
}
|
||||||
if($Defender['hero'] != 0)
|
if($Defender['hero'] != 0)
|
||||||
{
|
{
|
||||||
@@ -814,8 +776,7 @@ class Battle {
|
|||||||
$j = $i-$start+1;
|
$j = $i-$start+1;
|
||||||
$y = $i-(($att_tribe-1)*10);
|
$y = $i-(($att_tribe-1)*10);
|
||||||
|
|
||||||
$max_bounty += ($Attacker['u'.$i]-$result['casualties_attacker'][$y])*${
|
$max_bounty += ($Attacker['u'.$i]-$result['casualties_attacker'][$y])*${'u'.$i}['cap'];
|
||||||
'u'.$i}['cap'];
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user