|
|
@ -8,23 +8,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
if (!function_exists('getKTChance')) {
|
|
|
|
if (!function_exists('getKTChance')) {
|
|
|
|
|
|
|
|
|
|
|
|
function getKTChance($ktuser_luck, $ktvictim_luck) {
|
|
|
|
if(!function_exists('calculateChance')) {
|
|
|
|
$chance = 50;
|
|
|
|
|
|
|
|
$ktvictim_luck= mt_rand(0, $ktvictim_luck);
|
|
|
|
function calculateChance($char1_luck, $char2_luck) {
|
|
|
|
$ktuser_luck = mt_rand(0, $ktuser_luck);
|
|
|
|
$max = max($char1_luck, $char2_luck);
|
|
|
|
if($ktvictim_luck < ($ktuser_luck*0.25)) {
|
|
|
|
$min = min($char1_luck, $char2_luck);
|
|
|
|
$chance = 75;
|
|
|
|
if($max == 0) {
|
|
|
|
}
|
|
|
|
$max = 1;
|
|
|
|
if($ktvictim_luck > ($ktuser_luck*1.75)) {
|
|
|
|
}
|
|
|
|
$chance = 25;
|
|
|
|
return (($max - $min) / $max) * 50;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $chance;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function getKTChance($ktuser_luck, $ktvictim_luck) {
|
|
|
|
|
|
|
|
//bei gleichem glück ist die chance 50%
|
|
|
|
|
|
|
|
$chance = 50;
|
|
|
|
|
|
|
|
if($ktuser_luck >= $ktvictim_luck) {
|
|
|
|
|
|
|
|
//hat der angreifer mehr glück wird der errechnete wert auf die 50% addiert
|
|
|
|
|
|
|
|
$chance += calculateChance($ktuser_luck, $ktvictim_luck);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
//hat der verteidiger mehr glück wird der errechnete wert auf die 50% subtrahiert
|
|
|
|
|
|
|
|
$chance -= calculateChance($ktuser_luck, $ktvictim_luck);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return $chance;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
################### Spieler 1
|
|
|
|
################### Spieler 1
|
|
|
|
$chance = getKTChance($k_glueck[0], $k_glueck[1]);
|
|
|
|
$char1_luck = mt_rand(0, $k_glueck[0]);
|
|
|
|
|
|
|
|
$char2_luck = mt_rand(0, $k_glueck[1]);
|
|
|
|
|
|
|
|
$chance = round(getKTChance($char1_luck, $char2_luck));
|
|
|
|
$random = mt_rand(0,100);
|
|
|
|
$random = mt_rand(0,100);
|
|
|
|
|
|
|
|
|
|
|
|
if ($technick1['type'] == tausch) {
|
|
|
|
if ($technick1['type'] == tausch) {
|
|
|
@ -56,30 +69,33 @@ if ($technick1['type'] == tausch) {
|
|
|
|
$k_hp[1] = $k_hp_alt[0];
|
|
|
|
$k_hp[1] = $k_hp_alt[0];
|
|
|
|
|
|
|
|
|
|
|
|
$k_mp[0] = $k_mp[0] - $technick1['mp'];
|
|
|
|
$k_mp[0] = $k_mp[0] - $technick1['mp'];
|
|
|
|
$schaden_1 = "Körpertausch";
|
|
|
|
$schaden_1 = "Chance: ".$chance."%<br>Körpertausch";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$k_mp[0] = $k_mp[0] - $technick1['mp'];
|
|
|
|
$k_mp[0] = $k_mp[0] - $technick1['mp'];
|
|
|
|
if ($k_mp[0] < 0) {
|
|
|
|
$schaden_1 = "Chance: ".$chance."%<br>Körpertausch fehlgeschlagen";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($k_mp[0] < 0) {
|
|
|
|
$k_mp[0] = 0;
|
|
|
|
$k_mp[0] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
$schaden_1 = "Körpertausch fehlgeschlagen";
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
$schaden_1 = "Körpertausch fehlgeschlagen";
|
|
|
|
$schaden_1 = "Körpertausch fehlgeschlagen";
|
|
|
|
|
|
|
|
$k_mp[0] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$aktion_AV1[$x] = "nein";
|
|
|
|
$aktion_AV1[$x] = "nein";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
################### Spieler 2
|
|
|
|
################### Spieler 2
|
|
|
|
$chance = getKTChance($k_glueck[1], $k_glueck[0]);
|
|
|
|
$char1_luck = mt_rand(0, $k_glueck[0]);
|
|
|
|
|
|
|
|
$char2_luck = mt_rand(0, $k_glueck[1]);
|
|
|
|
|
|
|
|
$chance = round(getKTChance($char2_luck, $char1_luck));
|
|
|
|
$random = mt_rand(0,100);
|
|
|
|
$random = mt_rand(0,100);
|
|
|
|
|
|
|
|
|
|
|
|
if ($technick2['type'] == tausch) {
|
|
|
|
if ($technick2['type'] == tausch) {
|
|
|
|
if ($k_mp[1] >= $technick2['mp']) {
|
|
|
|
if ($k_mp[1] >= $technick2['mp']) {
|
|
|
|
if($random <= $chance) { //Trefferchance abhängig vom ausgewürfeltem Glück
|
|
|
|
if($random <= $chance) { //Trefferchance abhängig vom ausgewürfeltem Glück
|
|
|
|
|
|
|
|
if ($kampf_info['rasse'] != "NPC") {
|
|
|
|
$k_starke_alt[0] = $k_starke[0];
|
|
|
|
$k_starke_alt[0] = $k_starke[0];
|
|
|
|
$k_speed_alt[0] = $k_speed[0];
|
|
|
|
$k_speed_alt[0] = $k_speed[0];
|
|
|
|
$k_ver_alt[0] = $k_ver[0];
|
|
|
|
$k_ver_alt[0] = $k_ver[0];
|
|
|
@ -105,17 +121,19 @@ if ($technick2['type'] == tausch) {
|
|
|
|
$k_hp[1] = $k_hp_alt[0];
|
|
|
|
$k_hp[1] = $k_hp_alt[0];
|
|
|
|
|
|
|
|
|
|
|
|
$k_mp[1] = $k_mp[1] - $technick2['mp'];
|
|
|
|
$k_mp[1] = $k_mp[1] - $technick2['mp'];
|
|
|
|
$schaden_2 = "Körpertausch";
|
|
|
|
$schaden_2 = "Chance: ".$chance."%<br>Körpertausch";
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$k_mp[1] = $k_mp[1] - $technick2['mp'];
|
|
|
|
|
|
|
|
if ($k_mp[1] < 0) {
|
|
|
|
|
|
|
|
$k_mp[1] = 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$schaden_1 = "Körpertausch fehlgeschlagen";
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$k_mp[1] = $k_mp[1] - $technick2['mp'];
|
|
|
|
|
|
|
|
$schaden_2 = "Chance: ".$chance."%<br>Körpertausch fehlgeschlagen";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($k_mp[1] < 0) {
|
|
|
|
|
|
|
|
$k_mp[1] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
$schaden_2 = "Körpertausch fehlgeschlagen";
|
|
|
|
$schaden_2 = "Körpertausch fehlgeschlagen";
|
|
|
|
|
|
|
|
$k_mp[1] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$aktion_AV2[$x] = "nein";
|
|
|
|
$aktion_AV2[$x] = "nein";
|
|
|
|
|
|
|
|
|
|
|
|