From 28c4bad8c6e0b25f91d591e54e1d16f8704763c6 Mon Sep 17 00:00:00 2001 From: radiskull Date: Sun, 10 Aug 2014 15:50:51 +0000 Subject: [PATCH] #138 eingebaut --- cronjob/kampf/generic_rechnung.php | 198 +++++++++++++++++++++++++++++ cronjob/kampf/generic_technik.php | 81 ++++++++++++ cronjob/kampf/heilung.php | 27 ++++ cronjob/kampf/konter_heal.php | 26 +--- cronjob/kampf_include.php | 3 + cronjob/liga_kampf.php | 18 ++- cronjob/turnier_kampf.php | 18 +++ cronjob/wanted_kampf.php | 18 ++- 8 files changed, 366 insertions(+), 23 deletions(-) create mode 100644 cronjob/kampf/generic_rechnung.php create mode 100644 cronjob/kampf/generic_technik.php create mode 100644 cronjob/kampf/heilung.php diff --git a/cronjob/kampf/generic_rechnung.php b/cronjob/kampf/generic_rechnung.php new file mode 100644 index 0000000..64dcf05 --- /dev/null +++ b/cronjob/kampf/generic_rechnung.php @@ -0,0 +1,198 @@ + &$attacke) { + //echo '
attackenstats: '.count($attacke).'
'; + $statsCounter = 0; + foreach ($attacke as $attKey => &$stat) { + if(is_array($stat)) { + //echo '
'.print_r($stat); + //echo '
dauer: '.$stat['dauer'].'/'.$stat['maxdauer']; + //echo '
wert: '.$stat['dauer']; + //echo '
operator: '; + //echo '
wert: '.$stat['wert']; + //echo '
attribut: '.getVariableName($stat['attribut'], $stat['char'], $charPos).' ('.$stat['attribut'].')'; + //echo '
value: '.$GLOBALS['kampf'][getVariableName($stat['attribut'], $stat['char'], $charPos)][getCharVariable($stat['attribut'], $stat['char'], $charPos)]; + //echo '
zAttribut: '.getVariableName($stat['zattribut'], $stat['char'], $charPos).' ('.$stat['zattribut'].')'; +// echo '
value: '.$GLOBALS['kampf'][getVariableName($stat['zattribut'], $stat['char'], $charPos)][getCharVariable($stat['zattribut'], $stat['char'], $charPos)]; + $statsCounter++; + $attributWert = &$GLOBALS['kampf'][getVariableName($stat['attribut'], $stat['char'], $charPos)][getCharVariable($stat['attribut'], $stat['char'], $charPos)]; + if($stat['attribut'] != $stat['zattribut']) { + $zAttributWert = &$GLOBALS['kampf'][getVariableName($stat['zattribut'], $stat['char'], $charPos)][getCharVariable($stat['zattribut'], $stat['char'], $charPos)]; + } else { + $zAttributWert = &$attributWert; + } + + if(($stat['wirkung'] == 'always' || $stat['dauer'] == $stat['maxdauer']) && ($stat['unblockbar'] || !$GLOBALS['kampf']['aussetzen'])) { + switch ($stat['operator']) { + case '+': + //echo '+
'; + $stat['akk_schaden'] += getCalculatedValue($stat['formel'], $stat['wert'], $attributWert); + $zAttributWert += getCalculatedValue($stat['formel'], $stat['wert'], $attributWert); + break; + case '-': + //echo '-
'; + $stat['akk_schaden'] -= getCalculatedValue($stat['formel'], $stat['wert'], $attributWert); + $zAttributWert -= getCalculatedValue($stat['formel'], $stat['wert'], $attributWert); + break; + case '*': + //echo '*
'; + //vorherigen wert merken um später gegen rechnen zu können + $tmp_wert = $attributWert; + //echo 'tmp_wert: '.$tmp_wert.'
'; + $zAttributWert *= getCalculatedValue($stat['formel'], $stat['wert'], $attributWert); + $stat['akk_schaden'] += $attributWert - $tmp_wert; + break; + case '/': + //echo '/
'; + //vorherigen wert merken um später gegen rechnen zu können + $tmp_wert = $attributWert; + //echo 'tmp_wert: '.$tmp_wert.'
'; + $zAttributWert /= getCalculatedValue($stat['formel'], $stat['wert'], $attributWert); + $stat['akk_schaden'] += $attributWert - $tmp_wert; + break; + } + } + //echo '
ber. value: '.$zAttributWert; + //echo '
akk_schaden: '.$stat['akk_schaden'].'
'; + //echo 'Varname: '.getVariableName($stat['attribut'], $stat['char']).'
'; + //echo 'Vartyp: '.getCharVariable($stat['attribut'], $stat['attribut']).'
'; + //echo 'Schaden: '.getCalculatedValue($stat['schaden'], $stat['wert'], $stat['attribut']).'
'; + //echo '
zattribut: '.$stat['zattribut']; + + if(getVariableName($stat['zattribut'], $stat['char'], $charPos) == 'tmp_hp') { + //hier extra den weiteren parameter für healkonter setzen + $index = 3; + if($charPos == 1) { + if($stat['char'] == 'self') { + $index = 3; + } else { + $index = 2; + } + } else { + if($stat['char'] == 'self') { + $index = 2; + } else { + $index = 3; + } + } + $GLOBALS['kampf'][getVariableName($stat['zattribut'], $stat['char'], $charPos)][$index] = true; + } + + + $stat['dauer']--; + if($stat['dauer'] < 1) { + if($stat['wiederherstellbar'] == 'yes') { + //echo 'resette stat '.$stat['attribut'].' um den wert '.$stat['akk_schaden'].'
'; + $zAttributWert -= $stat['akk_schaden']; + } + $statsCounter--; + if($charPos == 1) { + $GLOBALS['kampf']['schaden1'] = $attacke['text']; + } else { + $GLOBALS['kampf']['schaden2'] = $attacke['text']; + } + unset($attacke[$attKey]); + } + } + } + //echo 'Statscounter: '.$statsCounter.'
'; + //echo 'attackenstats: '.count($attacke).'
'; + if($statsCounter == 0) { + unset($statChanges[$statKey]); + } + } + } +} + +################### Spieler 1 +//char auf der linken Seite +processStatChanges($statChange_Char1, 1); + +################### Spieler 2 +//char auf der rechten Seite +processStatChanges($statChange_Char2, 2); +?> \ No newline at end of file diff --git a/cronjob/kampf/generic_technik.php b/cronjob/kampf/generic_technik.php new file mode 100644 index 0000000..1f03d78 --- /dev/null +++ b/cronjob/kampf/generic_technik.php @@ -0,0 +1,81 @@ += 0) { + $options = json_decode($technick1['options'], true); + $statChange_Char1[] = $options; + + foreach ($statChange_Char1 as &$attacke) { + foreach ($attacke as &$stat) { + if(is_array($stat)) { + $stat['maxdauer'] = $stat['dauer']; + $stat['wert'] = $technick1[getTechniqueAttributeName($stat['attribut'])]; + } + } + } + + } else { + $schaden_1 = 'Technik Fehlgeschlagen'; + $k_mp[0] = 0; + } + + $aktion_AV1[$x] = 'nein'; +} + +################### Spieler 2 + +if ($technick2['type'] == 'generic') { + $k_mp[1] = $k_mp[1] - $technick2['mp']; + + if ($k_mp[1] >= 0) { + $options = json_decode($technick2['options'], true); + $statChange_Char2[] = $options; + + foreach ($statChange_Char2 as &$attacke) { + foreach ($attacke as &$stat) { + if(is_array($stat)) { + $stat['dauer'] = $technick2['runden']; + $stat['maxdauer'] = $technick2['runden']; + $stat['wert'] = $technick2[getTechniqueAttributeName($stat['attribut'])]; + } + } + } + + } else { + $schaden_2 = 'Technik Fehlgeschlagen'; + $k_mp[1] = 0; + } + + $aktion_AV2[$x] = 'nein'; +} diff --git a/cronjob/kampf/heilung.php b/cronjob/kampf/heilung.php new file mode 100644 index 0000000..8769b9f --- /dev/null +++ b/cronjob/kampf/heilung.php @@ -0,0 +1,27 @@ + + \ No newline at end of file diff --git a/cronjob/kampf/konter_heal.php b/cronjob/kampf/konter_heal.php index bfef4d1..4b4fc5a 100644 --- a/cronjob/kampf/konter_heal.php +++ b/cronjob/kampf/konter_heal.php @@ -5,6 +5,8 @@ * @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public Licence * */ +?> + 0) { - $schaden_2 = "Konter!"; - } $aktion_AV1[$x] = "nein"; - } -} else { - if($tmp_hp[2] == true) { - $k_hp[1] = $k_hp[1] + $tmp_hp[1]; - if ($k_hp2[1] < $k_hp[1]) { - $k_hp[1] = $k_hp2[1]; - } + $tmp_hp[2] = false; } } @@ -40,17 +33,8 @@ if ($technick2['type'] == "konterhp") { } else { $k_hp[0] -= $tmp_hp[0]; $schaden_2 = "$tmp_hp[0]"; - if($tmp_hp[0] > 0) { - $schaden_1 = "Konter!"; - } $aktion_AV2[$x] = "nein"; - } -} else { - if($tmp_hp[3] == true) { - $k_hp[0] = $k_hp[0] + $tmp_hp[0]; - if ($k_hp1[1] < $k_hp[0]) { - $k_hp[0] = $k_hp1[1]; - } + $tmp_hp[3] = false; } } - +?> \ No newline at end of file diff --git a/cronjob/kampf_include.php b/cronjob/kampf_include.php index 9947e88..a12f6c2 100644 --- a/cronjob/kampf_include.php +++ b/cronjob/kampf_include.php @@ -20,6 +20,8 @@ $tmp_hp[2] = false; $tmp_hp[3] = false; ##################################MP, SSJ Verwandlungen, HP, Koerper Tausch Technicken include ('kampf/majin.php'); +include ('kampf/generic_technik.php'); +include ('kampf/generic_rechnung.php'); if (!$aussetzten_runde) { /////DAS FUER MAJIN ATTACKEN include ('kampf/tausch2.php'); //////////////////Muss ganz oben sein wegen technik Tauschen @@ -45,6 +47,7 @@ if (!$aussetzten_runde) { /////DAS FUER MAJIN ATTACKEN //include "kampf/summon.php"; } +include ('kampf/heilung.php'); include ('kampf/atk_wert.php'); if (!$aussetzten_runde) { /////DAS FUER MAJIN ATTACKEN include ('kampf/schatten.php'); diff --git a/cronjob/liga_kampf.php b/cronjob/liga_kampf.php index bf500a5..c5d10cd 100644 --- a/cronjob/liga_kampf.php +++ b/cronjob/liga_kampf.php @@ -61,7 +61,23 @@ $k_mp[1] = round($k_mp2[0]); $k_aufgabe_a_2 = $k_hp2[1] / 100; $k_aufgabe[1] = $k_aufgabe_a_2 * $chara_2[aufgeben]; - +$statChange_Char1 = array(); +$statChange_Char2 = array(); +$tmp_hp = array(); +//globals erstellen für den generic-typ +$GLOBALS['kampf']['k_starke'] = &$k_starke; +$GLOBALS['kampf']['k_speed'] = &$k_speed; +$GLOBALS['kampf']['k_ver'] = &$k_ver; +$GLOBALS['kampf']['k_hp'] = &$k_hp; +$GLOBALS['kampf']['k_hp1'] = &$k_hp1; +$GLOBALS['kampf']['k_hp2'] = &$k_hp2; +$GLOBALS['kampf']['k_mp'] = &$k_mp; +$GLOBALS['kampf']['k_mp1'] = &$k_mp1; +$GLOBALS['kampf']['k_mp2'] = &$k_mp2; +$GLOBALS['kampf']['tmp_hp'] = &$tmp_hp; +$GLOBALS['kampf']['schaden1'] = &$schaden_1; +$GLOBALS['kampf']['schaden2'] = &$schaden_2; +$GLOBALS['kampf']['aussetzen'] = &$aussetzten_runde; $x=0; diff --git a/cronjob/turnier_kampf.php b/cronjob/turnier_kampf.php index c3c1a39..5957e86 100644 --- a/cronjob/turnier_kampf.php +++ b/cronjob/turnier_kampf.php @@ -69,6 +69,24 @@ $k_aufgabe[1] = $k_aufgabe_a_2 * $chara_2[aufgeben]; $x = 0; +$statChange_Char1 = array(); +$statChange_Char2 = array(); +$tmp_hp = array(); +//globals erstellen für den generic-typ +$GLOBALS['kampf']['k_starke'] = &$k_starke; +$GLOBALS['kampf']['k_speed'] = &$k_speed; +$GLOBALS['kampf']['k_ver'] = &$k_ver; +$GLOBALS['kampf']['k_hp'] = &$k_hp; +$GLOBALS['kampf']['k_hp1'] = &$k_hp1; +$GLOBALS['kampf']['k_hp2'] = &$k_hp2; +$GLOBALS['kampf']['k_mp'] = &$k_mp; +$GLOBALS['kampf']['k_mp1'] = &$k_mp1; +$GLOBALS['kampf']['k_mp2'] = &$k_mp2; +$GLOBALS['kampf']['tmp_hp'] = &$tmp_hp; +$GLOBALS['kampf']['schaden1'] = &$schaden_1; +$GLOBALS['kampf']['schaden2'] = &$schaden_2; +$GLOBALS['kampf']['aussetzen'] = &$aussetzten_runde; + $sql = "INSERT turnier_kampf SET hp1='$k_hp[0]', hp2='$k_hp[1]', mp1='$k_mp[0]', mp2='$k_mp[1]', schaden1='$schaden_1', schaden2='$schaden_2', attacke1='$technick1[name]', attacke2='$technick2[name]', char1='$chara_1[id]', char2='$chara_2[id]', starke1='$k_starke[0]', starke2='$k_starke[1]', ver1='$k_ver[0]', ver2='$k_ver[1]', speed1='$k_speed[0]', speed2='$k_speed[1]', ausdauer1='$k_ausdauer[0]', ausdauer2='$k_ausdauer[1]', glueck1='$k_glueck[0]', glueck2='$k_glueck[1]'"; if(mysql_query($sql) === false){ echo $sql.' Failed!!
'; diff --git a/cronjob/wanted_kampf.php b/cronjob/wanted_kampf.php index 9f430a4..804ba87 100644 --- a/cronjob/wanted_kampf.php +++ b/cronjob/wanted_kampf.php @@ -61,7 +61,23 @@ $k_mp[1] = round($k_mp2[0]); $k_aufgabe_a_2 = $k_hp2[1] / 100; $k_aufgabe[1] = $k_aufgabe_a_2 * $chara_2[aufgeben]; - +$statChange_Char1 = array(); +$statChange_Char2 = array(); +$tmp_hp = array(); +//globals erstellen für den generic-typ +$GLOBALS['kampf']['k_starke'] = &$k_starke; +$GLOBALS['kampf']['k_speed'] = &$k_speed; +$GLOBALS['kampf']['k_ver'] = &$k_ver; +$GLOBALS['kampf']['k_hp'] = &$k_hp; +$GLOBALS['kampf']['k_hp1'] = &$k_hp1; +$GLOBALS['kampf']['k_hp2'] = &$k_hp2; +$GLOBALS['kampf']['k_mp'] = &$k_mp; +$GLOBALS['kampf']['k_mp1'] = &$k_mp1; +$GLOBALS['kampf']['k_mp2'] = &$k_mp2; +$GLOBALS['kampf']['tmp_hp'] = &$tmp_hp; +$GLOBALS['kampf']['schaden1'] = &$schaden_1; +$GLOBALS['kampf']['schaden2'] = &$schaden_2; +$GLOBALS['kampf']['aussetzen'] = &$aussetzten_runde; $x=0;