Kampfscript für ss gefixt

main
radiskull 13 years ago
parent 51c757e3f6
commit 685a1d4b10

@ -27,14 +27,14 @@ function getMonsterCount($ort){
function getMonster($char_level, $city_id, $min, $max){ function getMonster($char_level, $city_id, $min, $max){
$bottom = round($char_level * 0.75); $top = round($char_level * 1.25); $min_l = min($top,$char_level+20); $bottom = round($char_level * 0.75); $top = round($char_level * 1.25); $min_l = min($top,$char_level+20);
// echo 'Char mit Level '.$char_level.' will auf Schatzsuche lower='.$bottom.', upper='.$top.'<br>'; // echo 'Char mit Level '.$char_level.' will auf Schatzsuche lower='.$bottom.', upper='.$top.'<br>';
// Excel-Formel = RUNDEN(1/WURZEL(PI()*2) * EXP(-1/(($D141-$C141)*2,5) *POTENZ((H$1 -ABRUNDEN(($C141 +MIN($D141; $E141))/2));2))*250) // Excel-Formel = RUNDEN(1/WURZEL(PI()*2) * EXP(-1/(($D141-$C141)*2,5) *POTENZ((H$1 -ABRUNDEN(($C141 +MIN($D141; $E141))/2));2))*250)
// SQL-Formel ROUND( 1/SQRT( PI()*2) * EXP(-1/(($top-$bottom)*2.5)*POW ((level- floor(($bottom+MIN($top ,levl+20))/2)),2) *250) // SQL-Formel ROUND( 1/SQRT( PI()*2) * EXP(-1/(($top-$bottom)*2.5)*POW ((level- floor(($bottom+MIN($top ,levl+20))/2)),2) *250)
$rechnung = 'ROUND(1/SQRT(PI()*2) * EXP(-1/(('.$top.'-'.$bottom.')*2.5)*POW((level-floor(('.$bottom.'+'.$min_l.')/2)),2))*250) as guete'; $rechnung = 'ROUND(1/SQRT(PI()*2) * EXP(-1/(('.$top.'-'.$bottom.')*2.5)*POW((level-floor(('.$bottom.'+'.$min_l.')/2)),2))*250) as guete';
$sql = 'select *, '.$rechnung.' from quest_monster as qm inner join quest_monster_orte as qmo on qm.id = qmo.monsterid where ortid = '.$city_id.' and level <= 20 + '.$char_level.' order by rand()'; $sql = 'select *, '.$rechnung.' from quest_monster as qm inner join quest_monster_orte as qmo on qm.id = qmo.monsterid where ortid = '.$city_id.' and level <= 20 + '.$char_level.' order by rand()';
// echo $sql.'<br>'; // echo $sql.'<br>';
$qry = mysql_query($sql); // Lade alle Monster $qry = mysql_query($sql); // Lade alle Monster
// while($monster[] = mysql_fetch_assoc($qry)); // Lade alle monster in einen Array // while($monster[] = mysql_fetch_assoc($qry)); // Lade alle monster in einen Array
$gesamtguete = 0; $gesamtguete = 0;
while($row = mysql_fetch_assoc($qry)){ while($row = mysql_fetch_assoc($qry)){
if($row['guete'] == 0){ if($row['guete'] == 0){
@ -84,7 +84,7 @@ function getMonster($char_level, $city_id, $min, $max){
function monsterfight_neu($chara_1, $fight_monster, $std, $ort){ function monsterfight_neu($chara_1, $fight_monster, $std, $ort){
if($chara_1['kampf_item'] != NULL && $chara_1['kampf_item'] != ',,,,'){ if($chara_1['kampf_item'] != NULL && $chara_1['kampf_item'] != ',,,,'){
// echo 'Problematic Entry = '.$chara_1['kampf_item'].'<br>'; // echo 'Problematic Entry = '.$chara_1['kampf_item'].'<br>';
$char1_buffs = mysql_fetch_assoc(mysql_query('SELECT sum(i.hp) as hp, sum(i.mp) as mp, sum(i.starke) as starke, sum(i.verteidigung) as verteidigung, sum(i.speed) as speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id IN (' . $chara_1['kampf_item'] . ')')); $char1_buffs = mysql_fetch_assoc(mysql_query('SELECT sum(i.hp) as hp, sum(i.mp) as mp, sum(i.starke) as starke, sum(i.verteidigung) as verteidigung, sum(i.speed) as speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id IN (' . $chara_1['kampf_item'] . ')'));
} }
@ -111,26 +111,26 @@ function monsterfight_neu($chara_1, $fight_monster, $std, $ort){
$sql = 'Insert into quests(charid, dauer, ortid, st, sp, ver, gl, aus, hp, mp)' . $sql = 'Insert into quests(charid, dauer, ortid, st, sp, ver, gl, aus, hp, mp)' .
' values('.$chara_1['id'].', ' . ' values('.$chara_1['id'].', ' .
'TIMESTAMPADD(HOUR, '.$std.', now()), ' . 'TIMESTAMPADD(HOUR, '.$std.', now()), ' .
$ort.', '. $ort.', '.
$in_starke.', '. $in_starke.', '.
$in_speed.', '. $in_speed.', '.
$in_ver.', '. $in_ver.', '.
$in_glueck.', '. $in_glueck.', '.
$chara_1['ausdauer'].', '. $chara_1['ausdauer'].', '.
$in_hp_max.', '. $in_hp_max.', '.
$in_mp_max.')'; $in_mp_max.')';
// echo 'Debug-Message: '.$sql.'<br>'; // echo 'Debug-Message: '.$sql.'<br>';
mysql_query($sql); mysql_query($sql);
$Dead1 = 0; $Dead1 = 0;
// while ($chara_2 = mysql_fetch_assoc($fight_monster)) { // Schleife in monsterfight.inc.php rein!!! // while ($chara_2 = mysql_fetch_assoc($fight_monster)) { // Schleife in monsterfight.inc.php rein!!!
for($i=0;$i<count($fight_monster) && $Dead1 == 0;$i++){ for($i=0;$i<count($fight_monster) && $Dead1 == 0;$i++){
$sql = 'Insert into quest_fights(charid, fightnr, monsterid)' . $sql = 'Insert into quest_fights(charid, fightnr, monsterid)' .
' values(' . ' values(' .
$chara_1['id'].', ' . $chara_1['id'].', ' .
$i.', ' . $i.', ' .
$fight_monster[$i]['id'].')'; $fight_monster[$i]['id'].')';
// echo $sql.'<br>'; // echo $sql.'<br>';
mysql_query($sql); mysql_query($sql);
// Werte uebernehmen // Werte uebernehmen
$k_starke[0] = $in_starke; $k_starke[0] = $in_starke;
@ -171,11 +171,11 @@ function monsterfight_neu($chara_1, $fight_monster, $std, $ort){
$x = 0; $x = 0;
$sql = 'Insert into quest_rounds(charid, fightnr, roundnr, c_st, c_sp, c_ver, c_hp, c_mp, c_aus, c_gl, m_st, m_sp, m_ver, m_hp, m_mp, m_aus, m_gl) values(' . $sql = 'Insert into quest_rounds(charid, fightnr, roundnr, c_st, c_sp, c_ver, c_hp, c_mp, c_aus, c_gl, m_st, m_sp, m_ver, m_hp, m_mp, m_aus, m_gl) values(' .
$chara_1['id'].', '.$i . ','.$x.','. $chara_1['id'].', '.$i . ','.$x.','.
$k_starke[0].','.$k_speed[0].','.$k_ver[0].','.$k_hp[0].','.$k_mp[0].','.$k_ausdauer[0].','.$k_glueck[0].','. $k_starke[0].','.$k_speed[0].','.$k_ver[0].','.$k_hp[0].','.$k_mp[0].','.$k_ausdauer[0].','.$k_glueck[0].','.
$k_starke[1].','.$k_speed[1].','.$k_ver[1].','.$k_hp[1].','.$k_mp[1].','.$k_ausdauer[1].','.$k_glueck[1]. $k_starke[1].','.$k_speed[1].','.$k_ver[1].','.$k_hp[1].','.$k_mp[1].','.$k_ausdauer[1].','.$k_glueck[1].
')'; ')';
// echo 'Debug Message: '.$sql.'<br>'; // echo 'Debug Message: '.$sql.'<br>';
mysql_query($sql); mysql_query($sql);
while ($k_hp[0] > $k_aufgabe[0] AND $k_hp[1] > 0 AND $x < 10) { while ($k_hp[0] > $k_aufgabe[0] AND $k_hp[1] > 0 AND $x < 10) {
@ -194,14 +194,16 @@ function monsterfight_neu($chara_1, $fight_monster, $std, $ort){
$aussetzten_runde = ""; ////// MUSS SO BLEIBEN WICHTIG $aussetzten_runde = ""; ////// MUSS SO BLEIBEN WICHTIG
##################################MP, SSJ Verwandlungen, HP, Koerper Tausch Technicken ##################################MP, SSJ Verwandlungen, HP, Koerper Tausch Technicken
$tmp_hp[0] = 0;
$tmp_hp[1] = 0;
##################################MP, SSJ Verwandlungen, HP, Koerper Tausch Technicken
include (ROOT_PATH . '/include/kampf/majin.php'); include (ROOT_PATH . '/include/kampf/majin.php');
if (!$aussetzten_runde) { /////DAS FueR MAJIN ATTACKEN if (!$aussetzten_runde) { /////DAS FUER MAJIN ATTACKEN
include (ROOT_PATH . '/include/kampf/atk_wert.php'); include (ROOT_PATH . '/include/kampf/atk_wert.php');
include (ROOT_PATH . '/include/kampf/tausch2.php'); include (ROOT_PATH . '/include/kampf/tausch2.php'); //////////////////Muss ganz oben sein wegen technik Tauschen
include (ROOT_PATH . '/include/kampf/gift.php'); include (ROOT_PATH . '/include/kampf/gift.php');
include (ROOT_PATH . '/include/kampf/frucht.php'); include (ROOT_PATH . '/include/kampf/frucht.php');
include (ROOT_PATH . '/include/kampf/runde.php');
include (ROOT_PATH . '/include/kampf/mp.php'); include (ROOT_PATH . '/include/kampf/mp.php');
include (ROOT_PATH . '/include/kampf/hp.php'); include (ROOT_PATH . '/include/kampf/hp.php');
include (ROOT_PATH . '/include/kampf/hp2.php'); include (ROOT_PATH . '/include/kampf/hp2.php');
@ -213,24 +215,29 @@ function monsterfight_neu($chara_1, $fight_monster, $std, $ort){
include (ROOT_PATH . '/include/kampf/lose2.php'); include (ROOT_PATH . '/include/kampf/lose2.php');
include (ROOT_PATH . '/include/kampf/ausdauer.php'); include (ROOT_PATH . '/include/kampf/ausdauer.php');
include (ROOT_PATH . '/include/kampf/mpv.php'); include (ROOT_PATH . '/include/kampf/mpv.php');
include (ROOT_PATH . '/include/kampf/tausch.php');
include (ROOT_PATH . '/include/kampf/hpmp.php'); include (ROOT_PATH . '/include/kampf/hpmp.php');
//Als letztes um alle HP-Attacken zu kontern (in $tmp_hp gespeichert)
include (ROOT_PATH . '/include/kampf/konter_heal.php');
//Nach Konterheal, damit überstehende HP bleibt
include (ROOT_PATH . '/include/kampf/tausch.php');
//include "kampf/summon.php";
} }
include (ROOT_PATH . '/include/kampf/atk_wert.php'); include (ROOT_PATH . '/include/kampf/atk_wert.php');
if (!$aussetzten_runde) { /////DAS FueR MAJIN ATTACKEN if (!$aussetzten_runde) { /////DAS FUER MAJIN ATTACKEN
include (ROOT_PATH . '/include/kampf/schatten.php'); include (ROOT_PATH . '/include/kampf/schatten.php');
include (ROOT_PATH . '/include/kampf/runde.php');
} }
#####################################KAMPF SYSTEM #####################################KAMPF SYSTEM
include (ROOT_PATH . '/include/kampf/kampf_rechnung.php'); include (ROOT_PATH . '/include/kampf/kampf_rechnung.php');
// schaden1='$db_query[schaden1],$schaden_1', schaden2='$db_query[schaden2],$schaden_2', attacke1='$db_query[attacke1],$technick1[name]', attacke2='$db_query[attacke2],$technick2[name]' // schaden1='$db_query[schaden1],$schaden_1', schaden2='$db_query[schaden2],$schaden_2', attacke1='$db_query[attacke1],$technick1[name]', attacke2='$db_query[attacke2],$technick2[name]'
$x++; $x++;
$sql = 'Insert into quest_rounds(charid, fightnr, roundnr, c_attack, c_dmg, m_attack, m_dmg, c_st, c_sp, c_ver, c_hp, c_mp, c_aus, c_gl, m_st, m_sp, m_ver, m_hp, m_mp, m_aus, m_gl) values(' . $sql = 'Insert into quest_rounds(charid, fightnr, roundnr, c_attack, c_dmg, m_attack, m_dmg, c_st, c_sp, c_ver, c_hp, c_mp, c_aus, c_gl, m_st, m_sp, m_ver, m_hp, m_mp, m_aus, m_gl) values(' .
$chara_1['id'].', '.$i . ','.$x.',\''.$technick1['name'].'\',\''.$schaden_1.'\',\''.$technick2['name'].'\',\''.$schaden_2.'\','. $chara_1['id'].', '.$i . ','.$x.',\''.$technick1['name'].'\',\''.$schaden_1.'\',\''.$technick2['name'].'\',\''.$schaden_2.'\','.
$k_starke[0].','.$k_speed[0].','.$k_ver[0].','.$k_hp[0].','.$k_mp[0].','.$k_ausdauer[0].','.$k_glueck[0].','. $k_starke[0].','.$k_speed[0].','.$k_ver[0].','.$k_hp[0].','.$k_mp[0].','.$k_ausdauer[0].','.$k_glueck[0].','.
$k_starke[1].','.$k_speed[1].','.$k_ver[1].','.$k_hp[1].','.$k_mp[1].','.$k_ausdauer[1].','.$k_glueck[1]. $k_starke[1].','.$k_speed[1].','.$k_ver[1].','.$k_hp[1].','.$k_mp[1].','.$k_ausdauer[1].','.$k_glueck[1].
')'; ')';
// echo $sql.'<br>'; // echo $sql.'<br>';
mysql_query($sql); mysql_query($sql);
} }
###########################EXP VERTEILUNG ###########################EXP VERTEILUNG
@ -246,19 +253,19 @@ function monsterfight_neu($chara_1, $fight_monster, $std, $ort){
$exp *= 9; // Mal Faktor $exp *= 9; // Mal Faktor
//$exp *= 30; // Mal Faktor //$exp *= 30; // Mal Faktor
// Hier ist sie auch schon zu Ende // Hier ist sie auch schon zu Ende
// $geld = ($exp / 15) * 2; // $geld = ($exp / 15) * 2;
$geld = 0; $geld = 0;
} else { } else {
// echo 'Debug Message: Verloren Hp war '.$k_hp[0].'. Aufgabe war '.$k_aufgabe[0].'. HP des Gegners '.$k_hp[1].'<br>'; // echo 'Debug Message: Verloren Hp war '.$k_hp[0].'. Aufgabe war '.$k_aufgabe[0].'. HP des Gegners '.$k_hp[1].'<br>';
$Dead1 = 1; $Dead1 = 1;
$sieger = $chara_2['id']; $sieger = $chara_2['id'];
$verlierer = $chara_1['id']; $verlierer = $chara_1['id'];
$exp = 0; $exp = 0;
$geld = 0; $geld = 0;
} }
// With money on SS // With money on SS
// mysql_query('Update quest_fights set exp = '.$exp.', geld = '.$geld.', sieger = '.$sieger.' where charid = '.$chara_1['id'].' and fightnr = '.$i); // mysql_query('Update quest_fights set exp = '.$exp.', geld = '.$geld.', sieger = '.$sieger.' where charid = '.$chara_1['id'].' and fightnr = '.$i);
// No money // No money
mysql_query('Update quest_fights set exp = '.$exp.', geld = 0, sieger = '.$sieger.' where charid = '.$chara_1['id'].' and fightnr = '.$i); mysql_query('Update quest_fights set exp = '.$exp.', geld = 0, sieger = '.$sieger.' where charid = '.$chara_1['id'].' and fightnr = '.$i);
} }
} }
@ -274,7 +281,7 @@ function getSchatzItems($monster_count){
$divisor = 2/(1+exp(-$monster_count/5+2)); // Je hoeher desto besser $divisor = 2/(1+exp(-$monster_count/5+2)); // Je hoeher desto besser
$items = array(); $items = array();
$sql = 'SELECT * FROM sp_item where FLOOR(RAND()*wert/'.$divisor.') = 0'; $sql = 'SELECT * FROM sp_item where FLOOR(RAND()*wert/'.$divisor.') = 0';
// echo $sql.' ('.$monster_count.')<br>'; // echo $sql.' ('.$monster_count.')<br>';
$qry = mysql_query($sql); $qry = mysql_query($sql);
while($items[] = mysql_fetch_assoc($qry)); while($items[] = mysql_fetch_assoc($qry));
return $items; return $items;
@ -313,14 +320,14 @@ function submitCharChanges($charid, $items, $exp, $geld, $ort, $hp, $mp, $attack
// Schaden und den neuen Ort eintragen (und den Status nicht vergessen :) // Schaden und den neuen Ort eintragen (und den Status nicht vergessen :)
$sql = 'Update chars set hp=\''.$hp[0].','.$hp[1].'\', mp=\''.$mp[0].','.$mp[1].'\', ort = '.$ort.', status = \'Frei\' where id = '.$charid; $sql = 'Update chars set hp=\''.$hp[0].','.$hp[1].'\', mp=\''.$mp[0].','.$mp[1].'\', ort = '.$ort.', status = \'Frei\' where id = '.$charid;
// echo $sql.'<br>'; // echo $sql.'<br>';
mysql_query($sql); mysql_query($sql);
// // Kohle gibts ja nichmehr :) // // Kohle gibts ja nichmehr :)
// $sql = 'Update user set geld = geld + '.$geld.' where id = '.$char['besitzer']; // $sql = 'Update user set geld = geld + '.$geld.' where id = '.$char['besitzer'];
//// echo $sql.'<br>'; //// echo $sql.'<br>';
// mysql_query($sql); // mysql_query($sql);
// Nun gehts zum auffinden der Items :) // Nun gehts zum auffinden der Items :)
@ -335,7 +342,7 @@ function submitCharChanges($charid, $items, $exp, $geld, $ort, $hp, $mp, $attack
mysql_query($sql); mysql_query($sql);
} else{ } else{
$sql = 'Insert into sp_ware(item, user) values('.$items[$i]['id'].','.$char['besitzer'].')'; $sql = 'Insert into sp_ware(item, user) values('.$items[$i]['id'].','.$char['besitzer'].')';
// echo $sql.'<br>'; // echo $sql.'<br>';
mysql_query($sql); mysql_query($sql);
} }
} }

Loading…
Cancel
Save