From 5d77461dd6850ac81773ef2cbbac9d3f2ea87a94 Mon Sep 17 00:00:00 2001 From: radiskull Date: Sun, 10 Aug 2014 20:58:40 +0000 Subject: [PATCH] Erweiterung der Parameter - bei den Attribut kann man nun sagen auf welchen Char sich das Attribut bezieht - Char-Parameter ist rausgeflogen diverse Bugs gefixt --- ag/include/kampf/generic_rechnung.php | 111 +++++++++++++------------- ag/include/kampf/generic_technik.php | 24 +++--- 2 files changed, 71 insertions(+), 64 deletions(-) diff --git a/ag/include/kampf/generic_rechnung.php b/ag/include/kampf/generic_rechnung.php index 6c8befe..e636d2f 100644 --- a/ag/include/kampf/generic_rechnung.php +++ b/ag/include/kampf/generic_rechnung.php @@ -8,47 +8,49 @@ */ if (!function_exists('getVariableName')) { - function getVariableName($attribute, $char, $pos) { + function getVariableName($attribute, $pos) { switch($attribute) { - case 'hp_cur': + case 's_hp_cur': + case 'e_hp_cur': return 'k_hp'; - case 'hp_max': - if($char == 'self') { - if($pos == 1) { - return 'k_hp1'; - } else { - return 'k_hp2'; - } + case 's_hp_max': + if($pos == 1) { + return 'k_hp1'; } else { - if($pos == 1) { - return 'k_hp2'; - } else { - return 'k_hp1'; - } + return 'k_hp2'; } - case 'mp_cur': + case 'e_hp_max': + if($pos == 1) { + return 'k_hp2'; + } else { + return 'k_hp1'; + } + case 's_mp_cur': + case 'e_mp_cur': return 'k_mp'; + case 's_mp_max': + if($pos == 1) { + return 'k_mp1'; + } else { + return 'k_mp2'; + } case 'mp_max': - if($char == 'self') { - if($pos == 1) { - return 'k_mp1'; - } else { - return 'k_mp2'; - } + if($pos == 1) { + return 'k_mp2'; } else { - if($pos == 1) { - return 'k_mp2'; - } else { - return 'k_mp1'; - } + return 'k_mp1'; } - case 'str': + case 's_str': + case 'e_str': return 'k_starke'; - case 'def': + case 's_def': + case 'e_def': return 'k_ver'; - case 'spd': + case 's_spd': + case 'e_spd': return 'k_speed'; - case 'heal': + case 'e_heal': + case 's_heal': return 'tmp_hp'; default: return ''; @@ -57,13 +59,15 @@ if (!function_exists('getVariableName')) { } if (!function_exists('getCharVariable')) { - function getCharVariable($attribute, $char, $pos) { + function getCharVariable($attribute, $pos) { switch ($attribute) { - case 'hp_max': - case 'mp_max': + case 's_hp_max': + case 'e_hp_max': + case 's_mp_max': + case 'e_mp_max': return 1; default: - if($char == 'self') { + if($attribute[0] == 's') { return $pos - 1; } else { return 2 - $pos; @@ -89,37 +93,35 @@ if (!function_exists('processStatChanges')) { $statsCounter = 0; foreach ($attacke as $attKey => &$stat) { if(is_array($stat)) { - //echo '
'.print_r($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)]; + //echo '
variabel-index: '.getCharVariable($stat['attribut'], $charPos); + //echo '
attribut: '.getVariableName($stat['attribut'], $charPos).' ('.$stat['attribut'].')'; + //echo '
value: '.$GLOBALS['kampf'][getVariableName($stat['attribut'], $charPos)][getCharVariable($stat['attribut'], $charPos)]; + //echo '
zAttribut: '.getVariableName($stat['zattribut'], $charPos).' ('.$stat['zattribut'].')'; + //echo '
value: '.$GLOBALS['kampf'][getVariableName($stat['zattribut'], $charPos)][getCharVariable($stat['zattribut'], $charPos)]; $statsCounter++; - $attributWert = &$GLOBALS['kampf'][getVariableName($stat['attribut'], $stat['char'], $charPos)][getCharVariable($stat['attribut'], $stat['char'], $charPos)]; + $attributWert = &$GLOBALS['kampf'][getVariableName($stat['attribut'], $charPos)][getCharVariable($stat['attribut'], $charPos)]; if($stat['attribut'] != $stat['zattribut']) { - $zAttributWert = &$GLOBALS['kampf'][getVariableName($stat['zattribut'], $stat['char'], $charPos)][getCharVariable($stat['zattribut'], $stat['char'], $charPos)]; + $zAttributWert = &$GLOBALS['kampf'][getVariableName($stat['zattribut'], $charPos)][getCharVariable($stat['zattribut'], $charPos)]; } else { $zAttributWert = &$attributWert; } - + echo '
operator: "'.$stat['operator'].'"'; 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.'
'; @@ -127,47 +129,46 @@ if (!function_exists('processStatChanges')) { $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; + default: + echo '
kein operator gefunden!'; } } //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 'Varname: '.getVariableName($stat['attribut'], $charPos).'
'; + //echo 'Schaden: '.getCalculatedValue($stat['schaden'], $stat['wert'], $attributWert).'
'; //echo '
zattribut: '.$stat['zattribut']; - if(getVariableName($stat['zattribut'], $stat['char'], $charPos) == 'tmp_hp') { + if(getVariableName($stat['zattribut'], $charPos) == 'tmp_hp') { //hier extra den weiteren parameter für healkonter setzen $index = 3; if($charPos == 1) { - if($stat['char'] == 'self') { + if($stat['zattribut'][0] == 's') { $index = 3; } else { $index = 2; } } else { - if($stat['char'] == 'self') { + if($stat['zattribut'][0] == 's') { $index = 2; } else { $index = 3; } } - $GLOBALS['kampf'][getVariableName($stat['zattribut'], $stat['char'], $charPos)][$index] = true; + $GLOBALS['kampf'][getVariableName($stat['zattribut'], $charPos)][$index] = true; } $stat['dauer']--; - echo '
wiederherstellbar: '.$stat['wiederherstellbar']; if($stat['dauer'] < 1) { if($stat['wiederherstellbar'] == true) { - //echo 'resette stat '.$stat['attribut'].' um den wert '.$stat['akk_schaden'].'
'; + //echo 'resette stat '.$zAttributWert.' um den wert '.$stat['akk_schaden'].'
'; $zAttributWert -= $stat['akk_schaden']; } $statsCounter--; diff --git a/ag/include/kampf/generic_technik.php b/ag/include/kampf/generic_technik.php index 1f03d78..9fc7f7b 100644 --- a/ag/include/kampf/generic_technik.php +++ b/ag/include/kampf/generic_technik.php @@ -10,17 +10,24 @@ if (!function_exists('getTechniqueAttributeName')) { function getTechniqueAttributeName($attribute) { switch ($attribute) { - case 'hp_cur': - case 'hp_max': + case 's_hp_cur': + case 'e_hp_cur': + case 's_hp_max': + case 'e_hp_max': return 'hp'; - case 'mp_cur': - case 'mp_max': + case 's_mp_cur': + case 'e_mp_cur': + case 's_mp_max': + case 'e_mp_max': return 'mp'; - case 'str': + case 's_str': + case 'e_str': return 'starke'; - case 'def': + case 's_def': + case 'e_def': return 'verteidigung'; - case 'spd': + case 's_spd': + case 'e_spd': return 'speed'; default: return ''; @@ -65,8 +72,7 @@ if ($technick2['type'] == 'generic') { foreach ($statChange_Char2 as &$attacke) { foreach ($attacke as &$stat) { if(is_array($stat)) { - $stat['dauer'] = $technick2['runden']; - $stat['maxdauer'] = $technick2['runden']; + $stat['maxdauer'] = $stat['dauer']; $stat['wert'] = $technick2[getTechniqueAttributeName($stat['attribut'])]; } }