#138 eingebaut
parent
28c4bad8c6
commit
f899b2fcff
@ -0,0 +1,198 @@
|
||||
<?php
|
||||
/*
|
||||
* Created on 07.03.2009
|
||||
*
|
||||
* @copyright (c) 2009 animegame.eu
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public Licence
|
||||
*
|
||||
*/
|
||||
|
||||
if (!function_exists('getVariableName')) {
|
||||
function getVariableName($attribute, $char, $pos) {
|
||||
switch($attribute) {
|
||||
case 'hp_cur':
|
||||
return 'k_hp';
|
||||
case 'hp_max':
|
||||
if($char == 'self') {
|
||||
if($pos == 1) {
|
||||
return 'k_hp1';
|
||||
} else {
|
||||
return 'k_hp2';
|
||||
}
|
||||
} else {
|
||||
if($pos == 1) {
|
||||
return 'k_hp2';
|
||||
} else {
|
||||
return 'k_hp1';
|
||||
}
|
||||
}
|
||||
case 'mp_cur':
|
||||
return 'k_mp';
|
||||
case 'mp_max':
|
||||
if($char == 'self') {
|
||||
if($pos == 1) {
|
||||
return 'k_mp1';
|
||||
} else {
|
||||
return 'k_mp2';
|
||||
}
|
||||
} else {
|
||||
if($pos == 1) {
|
||||
return 'k_mp2';
|
||||
} else {
|
||||
return 'k_mp1';
|
||||
}
|
||||
}
|
||||
case 'str':
|
||||
return 'k_starke';
|
||||
case 'def':
|
||||
return 'k_ver';
|
||||
case 'spd':
|
||||
return 'k_speed';
|
||||
case 'heal':
|
||||
return 'tmp_hp';
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('getCharVariable')) {
|
||||
function getCharVariable($attribute, $char, $pos) {
|
||||
switch ($attribute) {
|
||||
case 'hp_max':
|
||||
case 'mp_max':
|
||||
return 1;
|
||||
default:
|
||||
if($char == 'self') {
|
||||
return $pos - 1;
|
||||
} else {
|
||||
return 2 - $pos;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('getCalculatedValue')) {
|
||||
function getCalculatedValue($schaden, $wert, $attWert) {
|
||||
if($schaden == '%') {
|
||||
return ($attWert * $wert) / 100;
|
||||
} else {
|
||||
return $wert;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('processStatChanges')) {
|
||||
function processStatChanges(&$statChanges, $charPos) {
|
||||
foreach ($statChanges as $statKey => &$attacke) {
|
||||
//echo '<br>attackenstats: '.count($attacke).'<br>';
|
||||
$statsCounter = 0;
|
||||
foreach ($attacke as $attKey => &$stat) {
|
||||
if(is_array($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)];
|
||||
$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 '+<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>';
|
||||
$zAttributWert *= getCalculatedValue($stat['formel'], $stat['wert'], $attributWert);
|
||||
$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;
|
||||
}
|
||||
}
|
||||
//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 '<br>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'].'<br>';
|
||||
$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.'<br>';
|
||||
//echo 'attackenstats: '.count($attacke).'<br>';
|
||||
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);
|
||||
?>
|
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
/*
|
||||
* Created on 07.03.2009
|
||||
*
|
||||
* @copyright (c) 2009 animegame.eu
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public Licence
|
||||
*
|
||||
*/
|
||||
|
||||
if (!function_exists('getTechniqueAttributeName')) {
|
||||
function getTechniqueAttributeName($attribute) {
|
||||
switch ($attribute) {
|
||||
case 'hp_cur':
|
||||
case 'hp_max':
|
||||
return 'hp';
|
||||
case 'mp_cur':
|
||||
case 'mp_max':
|
||||
return 'mp';
|
||||
case 'str':
|
||||
return 'starke';
|
||||
case 'def':
|
||||
return 'verteidigung';
|
||||
case 'spd':
|
||||
return 'speed';
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
################### Spieler 1
|
||||
|
||||
if ($technick1['type'] == 'generic') {
|
||||
$k_mp[0] = $k_mp[0] - $technick1['mp'];
|
||||
if ($k_mp[0] >= 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';
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/*
|
||||
*
|
||||
* @copyright (c) 2009 animegame.eu
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public Licence
|
||||
*
|
||||
*/
|
||||
?>
|
||||
<?php
|
||||
####################KAMPF HP SPIELER 1
|
||||
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];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
####################KAMPF HP SPIELER 2
|
||||
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];
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
Loading…
Reference in new issue