Erweiterung der Parameter

- bei den Attribut kann man nun sagen auf welchen Char sich das Attribut bezieht
 - Char-Parameter ist rausgeflogen
diverse Bugs gefixt
main
radiskull 10 years ago
parent c96b1c7b5f
commit 5d77461dd6

@ -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 '<br>'.print_r($stat);
echo '<br>'.print_r($stat);
//echo '<br>dauer: '.$stat['dauer'].'/'.$stat['maxdauer'];
//echo '<br>wert: '.$stat['dauer'];
//echo '<br>operator: ';
//echo '<br>wert: '.$stat['wert'];
//echo '<br>attribut: '.getVariableName($stat['attribut'], $stat['char'], $charPos).' ('.$stat['attribut'].')';
//echo '<br>value: '.$GLOBALS['kampf'][getVariableName($stat['attribut'], $stat['char'], $charPos)][getCharVariable($stat['attribut'], $stat['char'], $charPos)];
//echo '<br>zAttribut: '.getVariableName($stat['zattribut'], $stat['char'], $charPos).' ('.$stat['zattribut'].')';
// echo '<br>value: '.$GLOBALS['kampf'][getVariableName($stat['zattribut'], $stat['char'], $charPos)][getCharVariable($stat['zattribut'], $stat['char'], $charPos)];
//echo '<br>variabel-index: '.getCharVariable($stat['attribut'], $charPos);
//echo '<br>attribut: '.getVariableName($stat['attribut'], $charPos).' ('.$stat['attribut'].')';
//echo '<br>value: '.$GLOBALS['kampf'][getVariableName($stat['attribut'], $charPos)][getCharVariable($stat['attribut'], $charPos)];
//echo '<br>zAttribut: '.getVariableName($stat['zattribut'], $charPos).' ('.$stat['zattribut'].')';
//echo '<br>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 '<br>operator: "'.$stat['operator'].'"';
if(($stat['wirkung'] == 'always' || $stat['dauer'] == $stat['maxdauer']) && ($stat['unblockbar'] || !$GLOBALS['kampf']['aussetzen'])) {
switch ($stat['operator']) {
case '+':
//echo '+<br>';
$stat['akk_schaden'] += getCalculatedValue($stat['formel'], $stat['wert'], $attributWert);
$zAttributWert += getCalculatedValue($stat['formel'], $stat['wert'], $attributWert);
break;
case '-':
//echo '-<br>';
$stat['akk_schaden'] -= getCalculatedValue($stat['formel'], $stat['wert'], $attributWert);
$zAttributWert -= getCalculatedValue($stat['formel'], $stat['wert'], $attributWert);
break;
case '*':
//echo '*<br>';
//vorherigen wert merken um später gegen rechnen zu können
$tmp_wert = $attributWert;
//echo 'tmp_wert: '.$tmp_wert.'<br>';
@ -127,47 +129,46 @@ if (!function_exists('processStatChanges')) {
$stat['akk_schaden'] += $attributWert - $tmp_wert;
break;
case '/':
//echo '/<br>';
//vorherigen wert merken um später gegen rechnen zu können
$tmp_wert = $attributWert;
//echo 'tmp_wert: '.$tmp_wert.'<br>';
$zAttributWert /= getCalculatedValue($stat['formel'], $stat['wert'], $attributWert);
$stat['akk_schaden'] += $attributWert - $tmp_wert;
break;
default:
echo '<br>kein operator gefunden!';
}
}
//echo '<br>ber. value: '.$zAttributWert;
//echo '<br>akk_schaden: '.$stat['akk_schaden'].'<br>';
//echo 'Varname: '.getVariableName($stat['attribut'], $stat['char']).'<br>';
//echo 'Vartyp: '.getCharVariable($stat['attribut'], $stat['attribut']).'<br>';
//echo 'Schaden: '.getCalculatedValue($stat['schaden'], $stat['wert'], $stat['attribut']).'<br>';
//echo 'Varname: '.getVariableName($stat['attribut'], $charPos).'<br>';
//echo 'Schaden: '.getCalculatedValue($stat['schaden'], $stat['wert'], $attributWert).'<br>';
//echo '<br>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 '<br>wiederherstellbar: '.$stat['wiederherstellbar'];
if($stat['dauer'] < 1) {
if($stat['wiederherstellbar'] == true) {
//echo 'resette stat '.$stat['attribut'].' um den wert '.$stat['akk_schaden'].'<br>';
//echo 'resette stat '.$zAttributWert.' um den wert '.$stat['akk_schaden'].'<br>';
$zAttributWert -= $stat['akk_schaden'];
}
$statsCounter--;

@ -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'])];
}
}

Loading…
Cancel
Save