[問題]阿呆式水怪新增技能測試結果
發表於 : 2004-01-01 00:00
以三種技能測試\r
1.僧侶的補血技能
2.戰士的攻擊
3.弓箭的設擊
經過我明察按法的結果
技能是在 phpbb_rpg_item裡\r
僧侶補血技能如下
`phpbb_rpg_items` VALUES (109, '初級回復咒文', '回復10% / 50 * 職業Lv', 3, 3, 0, '3', NULL, NULL, 10000000, 0, 0, 0, 0, 0, '0.0', '0.0', '0.0', '0.0', '0.0', '0.0', 'PL', '50');
土法煉鋼 不知道為什麼314號加不進去所以就加315號
INSERT INTO `phpbb_rpg_items` VALUES (315, '小朋友回復咒文', '回復5% / 50 * 職業Lv', 3, 1, 0, '3', NULL, NULL, 50000, 0, 0, 0, 0, 0, '0.0', '0.0', '0.0', '0.0', '0.0', '0.0', 'PL', '30');
然後function_eol.php裡有這一段\r
[php]<?php
case 109: // HP 10%
$sql = "update phpbb_users set rpg_cur_hp = rpg_cur_hp + floor(rpg_max_hp * 0.1) where user_id = " . $profiledata['user_id'];
$db->sql_query($sql);
$sql = "update phpbb_users set rpg_cur_hp = rpg_max_hp where rpg_cur_hp > rpg_max_hp and user_id = " . $profiledata['user_id'];
$db->sql_query($sql);
$ret_msg = "施咒完成, HP 恢復 10% :: " . floor($profiledata['rpg_max_hp'] * 0.1) . "點";
break;
?>[/php]
土法煉鋼在她前面加了
[php]<?php
case 315: // HP 5%
$sql = "update phpbb_users set rpg_cur_hp = rpg_cur_hp + floor(rpg_max_hp * 0.05) where user_id = " . $profiledata['user_id'];
$db->sql_query($sql);
$sql = "update phpbb_users set rpg_cur_hp = rpg_max_hp where rpg_cur_hp > rpg_max_hp and user_id = " . $profiledata['user_id'];
$db->sql_query($sql);
$ret_msg = "施咒完成, HP 恢復 5% :: " . floor($profiledata['rpg_max_hp'] * 0.1) . "點";
break;
?>[/php]
測試結果
成功 可以補血5%
接下來是戰士的
`phpbb_rpg_items` VALUES (167, '疾風斬', '100%命中, ATT - 對方DEF / 5 * LV', 3, 3, 0, '1', NULL, NULL, 500000, 0, 0, 0, 0, 0, '0.0', '0.0', '0.0', '0.0', '0.0', '0.0', '5', 'LV');
土法煉鋼\r
INSERT INTO `phpbb_rpg_items` VALUES (316, '狂擊', '100%命中, ATT - 對方DEF*2 / 3 * LV', 3, 1, 0, '1', NULL, NULL, 50000, 0, 0, 0, 0, 0, '0.0', '0.0', '0.0', '0.0', '0.0', '0.0', '3', 'LV');
然後function_eol.php裡有這一段\r
[php]<?php
case 167: // 疾風斬\r
case 168: // 龍擊破\r
case 169: // 霸皇神擊
case 170: // 爆炸鐵金剛
switch ( $next_act )
{
case 167:
$hp_deduct = $profiledata['rpg_attack'] - $row['rpg_defense'];
$ret_msg = $profiledata['username'] . '使出 疾風斬 ';
$dead_cause = '疾風斬';
break;
case 168:
$hp_deduct = $profiledata['rpg_attack'] * 2 - $row['rpg_defense'];
$ret_msg = $profiledata['username'] . '使出 龍擊破 ';
$dead_cause = '龍擊破';
break;
case 169:
$hp_deduct = $profiledata['rpg_attack'] * 3 - $row['rpg_defense'];
$ret_msg = $profiledata['username'] . '使出 霸皇神擊 ';
$dead_cause = '霸皇神擊';
break;
case 170:
$hp_deduct = $profiledata['rpg_cur_hp'] - 1;
$ret_msg = $profiledata['username'] . '使出 爆炸鐵金剛(淚) ';
$dead_cause = '爆炸鐵金剛(淚\\)';
$sql = "update phpbb_users set rpg_cur_hp = 1 where user_id = " . $profiledata['user_id'];
$db->sql_query($sql);
$profiledata['rpg_cur_hp'] = 1;
break;
}
if ( $hp_deduct < 0 ) $hp_deduct = 0;
$sql = "update " . ($is_npc ? "phpbb_rpg_npc" : "phpbb_users") .
" set rpg_cur_hp = rpg_cur_hp - $hp_deduct where " . ($is_npc ? "npc_id = " . $row['npc_id'] : "user_id = " . $row['user_id']);
$db->sql_query($sql);
$dead_cause .= "($hp_deduct)";
$ret_msg .= "擊中 " . ($is_npc ? ($row['npc_name'] == '' ? "" . $row['npc_id'] : $row['npc_name']) : $row['username']) . " 損傷 $hp_deduct 點。";
// 對手反擊
// $row['rpg_cur_hp'] -= $hp_deduct;
$ret_msg .= CounterAttack($am_i_dead, $profiledata, $row, $is_npc);
if ( $is_npc )
{
if ( $is_normal_npc )
$ret_msg .= UserIsDead("npc_id = " . $row['npc_id'], '', $profiledata['user_id'], '', 0, $dead_cause, true);
}
else
{
$ret_msg .= UserIsDead("user_id = " . $row['user_id'], "u.user_id = " . $row['user_id'], $profiledata['user_id'], $profiledata['username'], $profiledata['rpg_level'], $dead_cause);
}
break;
?>[/php]
我給他這樣改
[php]<?php
case 316: // 狂擊
case 167: // 疾風斬\r
case 168: // 龍擊破\r
case 169: // 霸皇神擊
case 170: // 爆炸鐵金剛
switch ( $next_act )
{
case 316:
$hp_deduct = $profiledata['rpg_attack'] - $row['rpg_defense'] * 2;
$ret_msg = $profiledata['username'] . '使出 狂擊 ';
$dead_cause = '狂擊';
break;
case 168:
$hp_deduct = $profiledata['rpg_attack'] * 2 - $row['rpg_defense'];
$ret_msg = $profiledata['username'] . '使出 龍擊破 ';
$dead_cause = '龍擊破';
break;
case 169:
$hp_deduct = $profiledata['rpg_attack'] * 3 - $row['rpg_defense'];
$ret_msg = $profiledata['username'] . '使出 霸皇神擊 ';
$dead_cause = '霸皇神擊';
break;
case 170:
$hp_deduct = $profiledata['rpg_cur_hp'] - 1;
$ret_msg = $profiledata['username'] . '使出 爆炸鐵金剛(淚) ';
$dead_cause = '爆炸鐵金剛(淚\\)';
$sql = "update phpbb_users set rpg_cur_hp = 1 where user_id = " . $profiledata['user_id'];
$db->sql_query($sql);
$profiledata['rpg_cur_hp'] = 1;
break;
}
if ( $hp_deduct < 0 ) $hp_deduct = 0;
$sql = "update " . ($is_npc ? "phpbb_rpg_npc" : "phpbb_users") .
" set rpg_cur_hp = rpg_cur_hp - $hp_deduct where " . ($is_npc ? "npc_id = " . $row['npc_id'] : "user_id = " . $row['user_id']);
$db->sql_query($sql);
$dead_cause .= "($hp_deduct)";
$ret_msg .= "擊中 " . ($is_npc ? ($row['npc_name'] == '' ? "" . $row['npc_id'] : $row['npc_name']) : $row['username']) . " 損傷 $hp_deduct 點。";
// 對手反擊
// $row['rpg_cur_hp'] -= $hp_deduct;
$ret_msg .= CounterAttack($am_i_dead, $profiledata, $row, $is_npc);
if ( $is_npc )
{
if ( $is_normal_npc )
$ret_msg .= UserIsDead("npc_id = " . $row['npc_id'], '', $profiledata['user_id'], '', 0, $dead_cause, true);
}
else
{
$ret_msg .= UserIsDead("user_id = " . $row['user_id'], "u.user_id = " . $row['user_id'], $profiledata['user_id'], $profiledata['username'], $profiledata['rpg_level'], $dead_cause);
}
break;
?>[/php]
測試結果
失敗
會跳過選擇攻擊角色 而直接顯示出攻擊結果
再來是弓箭手
`phpbb_rpg_items` VALUES (166, '射擊', '學會這個才能射箭哦! / 30 * 職業Lv', 3, 1, 0, '2', NULL, NULL, 50000, 0, 0, 0, 0, 0, '0.0', '0.0', '0.0', '0.0', '0.0', '0.0', '30', 'PL');
土法煉鋼\r
INSERT INTO `phpbb_rpg_items` VALUES (317, '二連矢', '連射2箭! / 50 * 職業Lv', 3, 2, 0, '2', NULL, NULL, 100000, 0, 0, 0, 0, 0, '0.0', '0.0', '0.0', '0.0', '0.0', '0.0', '50', 'PL');
然後function_eol.php裡有這一段\r
[php]<?php
case 166: // 射擊
case 172: // 弩弓
$sql1 = '';
$sql2 = '';
$sql3 = '';
if ( $next_x == $now_x ) // 直線射擊
{
if ($next_y > $now_y + 1)
{
$sql1 = "left(right(rpg_eol_data, 6), 3) = $now_x and right(rpg_eol_data, 3) > $now_y and right(rpg_eol_data, 3) < $next_y and right(rpg_eol_data, 6) <> '000086'";
$sql2 = "now_x = $now_x and now_y > $now_y and now_y < $next_y and (now_x <> 0 or now_y <> 86)";
$sql3 = "left(right(u.rpg_eol_data, 6), 3) = $now_x and right(u.rpg_eol_data, 3) > $now_y and right(u.rpg_eol_data, 3) < $next_y and right(u.rpg_eol_data, 6) <> '000086'";
}
else if ($next_y < $now_y - 1)
{
$sql1 = "left(right(rpg_eol_data, 6), 3) = $now_x and right(rpg_eol_data, 3) > $next_y and right(rpg_eol_data, 3) < $now_y and right(rpg_eol_data, 6) <> '000086'";
$sql2 = "now_x = $now_x and now_y > $next_y and now_y < $now_y and (now_x <> 0 or now_y <> 86)";
$sql3 = "left(right(u.rpg_eol_data, 6), 3) = $now_x and right(u.rpg_eol_data, 3) > $next_y and right(u.rpg_eol_data, 3) < $now_y and right(u.rpg_eol_data, 6) <> '000086'";
}
}
else if ( $next_y == $now_y )
{
if ($next_x > $now_x + 1)
{
$sql1 = "right(rpg_eol_data, 3) = $now_y and left(right(rpg_eol_data, 6), 3) > $now_x and left(right(rpg_eol_data, 6), 3) < $next_x and right(rpg_eol_data, 6) <> '000086'";
$sql2 = "now_y = $now_y and now_x > $now_x and now_x < $next_x and (now_x <> 0 or now_y <> 86)";
$sql3 = "right(u.rpg_eol_data, 3) = $now_y and left(right(u.rpg_eol_data, 6), 3) > $now_x and left(right(u.rpg_eol_data, 6), 3) < $next_x and right(u.rpg_eol_data, 6) <> '000086'";
}
else if ($next_x < $now_x - 1)
{
$sql1 = "right(rpg_eol_data, 3) = $now_y and left(right(rpg_eol_data, 6), 3) > $next_x and left(right(rpg_eol_data, 6), 3) < $now_x and right(rpg_eol_data, 6) <> '000086'";
$sql2 = "now_y = $now_y and now_x > $next_x and now_x < $now_x and (now_x <> 0 or now_y <> 86)";
$sql3 = "right(u.rpg_eol_data, 3) = $now_y and left(right(u.rpg_eol_data, 6), 3) > $now_x and left(right(u.rpg_eol_data, 6), 3) < $next_x and right(u.rpg_eol_data, 6) <> '000086'";
}
}
if ( $sql1 != '' )
{
$dead_cause = '';
$hp_deduct = rand(10, 50) * $max_point;
if ($next_act == 172) $hp_deduct *= 3;
$sql = "select username from phpbb_users where $sql1";
$result = $db->sql_query($sql);
if ( $row2 = $db->sql_fetchrow($result) )
{
do
{
$dead_cause .= $row2['username'] . ' ';
}
while ( $row2 = $db->sql_fetchrow($result) );
}
$sql = "select npc_id, npc_name from phpbb_rpg_npc where $sql2";
$result = $db->sql_query($sql);
if ( $row2 = $db->sql_fetchrow($result) )
{
do
{
$dead_cause .= ($row2['npc_name'] == '' ? '' . $row2['npc_id'] : $row2['npc_name']) . ' ';
}
while ( $row2 = $db->sql_fetchrow($result) );
}
$sql = "update phpbb_users set rpg_cur_hp = rpg_cur_hp - $hp_deduct where $sql1";
$db->sql_query($sql);
$sql = "update phpbb_rpg_npc set rpg_cur_hp = rpg_cur_hp - $hp_deduct where $sql2";
$db->sql_query($sql);
if ( $dead_cause != '' )
{
$ret_msg .= " 流彈受傷點數: $hp_deduct 流彈受傷人員: " . $dead_cause;
$ret_msg .= UserIsDead($sql1, $sql3, $profiledata['user_id'], $profiledata['username'], $profiledata['rpg_level'], ($next_act == 172 ? "弩" : "射" ) . "擊流彈($hp_deduct)");
if ( $is_normal_npc && $is_npc )
$ret_msg .= UserIsDead($sql2, "", $profiledata['user_id'], $profiledata['username'], $profiledata['rpg_level'], ($next_act == 172 ? "弩" : "射" ) . "擊流彈($hp_deduct)", true);
}
}
unset($sql1);
unset($sql2);
unset($sql3);
if ( rand(1, 100) > AttackPercent($profiledata['rpg_speed'] * 2, $row['rpg_speed']) )
{
$ret_msg = "太遜了,沒射中目標人物...." . $ret_msg;
}
else
{
if ( $profiledata['rpg_attack'] > $row['rpg_defense'] )
{
$hp_deduct = rand( ( ($profiledata['rpg_attack'] / 2 - $row['rpg_defense']) > 0 ? floor($profiledata['rpg_attack'] / 2 - $row['rpg_defense']) : 1) , $profiledata['rpg_attack'] - $row['rpg_defense']);
}
else
{
$hp_deduct = 10;
}\r
if ( $hp_deduct < $max_point * 10 )
$hp_deduct = rand($max_point * 10, $max_point * 20);
if ($next_act == 172) $hp_deduct *= 3;
$sql = "update " . ($is_npc ? "phpbb_rpg_npc" : "phpbb_users") .
" set rpg_cur_hp = rpg_cur_hp - $hp_deduct where " .
($is_npc ? "npc_id = " . $row['npc_id'] : "user_id = " . $row['user_id']);
$db->sql_query($sql);
$ret_msg = "射中 " . ($is_npc ? ($row['npc_name'] == '' ? "" . $row['npc_id'] : $row['npc_name']) : $row['username']) . " 損傷 $hp_deduct 點 " . $ret_msg;
$dead_cause = ($next_act == 172 ? "弩" : "射" ) . "擊($hp_deduct)";
}
// 反擊
$row['rpg_cur_hp'] -= $hp_deduct;
if ( $row['rpg_cur_hp'] > 0 )
{
if ( $is_npc )
{
if ( rand(1, 100) <= 40 )
{
if ( $row['rpg_attack'] - $profiledata['rpg_defense'] > 100 )
{
$hp_deduct = rand(100, $row['rpg_attack'] - $profiledata['rpg_defense']);
}
else
{
$hp_deduct = 100;
}
$hp_deduct = floor($hp_deduct / rand(2, 10));
$sql = "update phpbb_users set rpg_cur_hp = rpg_cur_hp - $hp_deduct where user_id = " . $profiledata['user_id'];
$db->sql_query($sql);
$ret_msg .= " 對手 " . ($row['npc_name'] == '' ? "" . $row['npc_id'] : $row['npc_name']) . " 反擊,損傷 $hp_deduct 點。";
$am_i_dead = CheckMyDead($profiledata['user_id']);
}
}
else
{
$sql = "select max(position_order) as max_point from phpbb_rpg_medals where position_class = 2 and user_id = " . $row['user_id'];
$result = $db->sql_query($sql);
if ( $row2 = $db->sql_fetchrow($result) )
{
if ( (abs($next_x - $now_x) + abs($next_y - $now_y) <= $row2['max_point'] + 1) && (rand(1, 100) <= 50) )
{
if ( $row['rpg_attack'] - $profiledata['rpg_defense'] > 10 * ($row2['max_point'] + 1) )
{
$hp_deduct = rand(10 * ($row2['max_point'] + 1), $row['rpg_attack'] - $profiledata['rpg_defense']);
}
else
{
$hp_deduct = 10 * ($row2['max_point'] + 1);
}
$hp_deduct = floor($hp_deduct / rand(2, 10));
$sql = "update phpbb_users set rpg_cur_hp = rpg_cur_hp - $hp_deduct where user_id = " . $profiledata['user_id'];
$db->sql_query($sql);
$ret_msg .= " 對手 " . $row['username'] . " 反擊,損傷 $hp_deduct 點。";
$am_i_dead = CheckMyDead($profiledata['user_id']);
UserIsDead("user_id = " . $profiledata['user_id'], "u.user_id = " . $profiledata['user_id'], $row['user_id'], $row['username'], $profiledata['rpg_level'], "射擊反擊($hp_deduct)");
}
}
}
}
if ( $is_npc )
{
if ( $is_normal_npc )
$ret_msg .= UserIsDead("npc_id = " . $row['npc_id'], '', $profiledata['user_id'], '', 0, $dead_cause, true);
}
else
{
$ret_msg .= UserIsDead("user_id = " . $row['user_id'], "u.user_id = " . $row['user_id'], $profiledata['user_id'], $profiledata['username'], $profiledata['rpg_level'], $dead_cause);
}
break;
?>[/php]
土法煉鋼在她後面加上
[php]<?php
case 317: // 2連矢\r
$sql1 = '';
$sql2 = '';
$sql3 = '';
if ( $next_x == $now_x ) // 直線射擊
{
if ($next_y > $now_y + 1)
{
$sql1 = "left(right(rpg_eol_data, 6), 3) = $now_x and right(rpg_eol_data, 3) > $now_y and right(rpg_eol_data, 3) < $next_y and right(rpg_eol_data, 6) <> '000086'";
$sql2 = "now_x = $now_x and now_y > $now_y and now_y < $next_y and (now_x <> 0 or now_y <> 86)";
$sql3 = "left(right(u.rpg_eol_data, 6), 3) = $now_x and right(u.rpg_eol_data, 3) > $now_y and right(u.rpg_eol_data, 3) < $next_y and right(u.rpg_eol_data, 6) <> '000086'";
}
else if ($next_y < $now_y - 1)
{
$sql1 = "left(right(rpg_eol_data, 6), 3) = $now_x and right(rpg_eol_data, 3) > $next_y and right(rpg_eol_data, 3) < $now_y and right(rpg_eol_data, 6) <> '000086'";
$sql2 = "now_x = $now_x and now_y > $next_y and now_y < $now_y and (now_x <> 0 or now_y <> 86)";
$sql3 = "left(right(u.rpg_eol_data, 6), 3) = $now_x and right(u.rpg_eol_data, 3) > $next_y and right(u.rpg_eol_data, 3) < $now_y and right(u.rpg_eol_data, 6) <> '000086'";
}
}
else if ( $next_y == $now_y )
{
if ($next_x > $now_x + 1)
{
$sql1 = "right(rpg_eol_data, 3) = $now_y and left(right(rpg_eol_data, 6), 3) > $now_x and left(right(rpg_eol_data, 6), 3) < $next_x and right(rpg_eol_data, 6) <> '000086'";
$sql2 = "now_y = $now_y and now_x > $now_x and now_x < $next_x and (now_x <> 0 or now_y <> 86)";
$sql3 = "right(u.rpg_eol_data, 3) = $now_y and left(right(u.rpg_eol_data, 6), 3) > $now_x and left(right(u.rpg_eol_data, 6), 3) < $next_x and right(u.rpg_eol_data, 6) <> '000086'";
}
else if ($next_x < $now_x - 1)
{
$sql1 = "right(rpg_eol_data, 3) = $now_y and left(right(rpg_eol_data, 6), 3) > $next_x and left(right(rpg_eol_data, 6), 3) < $now_x and right(rpg_eol_data, 6) <> '000086'";
$sql2 = "now_y = $now_y and now_x > $next_x and now_x < $now_x and (now_x <> 0 or now_y <> 86)";
$sql3 = "right(u.rpg_eol_data, 3) = $now_y and left(right(u.rpg_eol_data, 6), 3) > $now_x and left(right(u.rpg_eol_data, 6), 3) < $next_x and right(u.rpg_eol_data, 6) <> '000086'";
}
}
if ( $sql1 != '' )
{
$dead_cause = '';
$hp_deduct = rand(10, 50) * $max_point * 2;
if ($next_act == 317) $hp_deduct *= 3;
$sql = "select username from phpbb_users where $sql1";
$result = $db->sql_query($sql);
if ( $row2 = $db->sql_fetchrow($result) )
{
do
{
$dead_cause .= $row2['username'] . ' ';
}
while ( $row2 = $db->sql_fetchrow($result) );
}
$sql = "select npc_id, npc_name from phpbb_rpg_npc where $sql2";
$result = $db->sql_query($sql);
if ( $row2 = $db->sql_fetchrow($result) )
{
do
{
$dead_cause .= ($row2['npc_name'] == '' ? '' . $row2['npc_id'] : $row2['npc_name']) . ' ';
}
while ( $row2 = $db->sql_fetchrow($result) );
}
$sql = "update phpbb_users set rpg_cur_hp = rpg_cur_hp - $hp_deduct where $sql1";
$db->sql_query($sql);
$sql = "update phpbb_rpg_npc set rpg_cur_hp = rpg_cur_hp - $hp_deduct where $sql2";
$db->sql_query($sql);
if ( $dead_cause != '' )
{
$ret_msg .= " 流彈受傷點數: $hp_deduct 流彈受傷人員: " . $dead_cause;
$ret_msg .= UserIsDead($sql1, $sql3, $profiledata['user_id'], $profiledata['username'], $profiledata['rpg_level'], ($next_act == 317 ? "弩" : "射" ) . "擊流彈($hp_deduct)");
if ( $is_normal_npc && $is_npc )
$ret_msg .= UserIsDead($sql2, "", $profiledata['user_id'], $profiledata['username'], $profiledata['rpg_level'], ($next_act == 317 ? "弩" : "射" ) . "擊流彈($hp_deduct)", true);
}
}
unset($sql1);
unset($sql2);
unset($sql3);
if ( rand(1, 100) > AttackPercent($profiledata['rpg_speed'] * 2, $row['rpg_speed']) )
{
$ret_msg = "太遜了,沒射中目標人物...." . $ret_msg;
}
else
{
if ( $profiledata['rpg_attack'] > $row['rpg_defense'] )
{
$hp_deduct = rand( ( ($profiledata['rpg_attack'] / 2 - $row['rpg_defense']) > 0 ? floor($profiledata['rpg_attack'] / 2 - $row['rpg_defense']) : 1) , $profiledata['rpg_attack'] - $row['rpg_defense']);
}
else
{
$hp_deduct = 10;
}
if ( $hp_deduct < $max_point * 10 )
$hp_deduct = rand($max_point * 10, $max_point * 20);
if ($next_act == 317) $hp_deduct *= 3;
$sql = "update " . ($is_npc ? "phpbb_rpg_npc" : "phpbb_users") .
" set rpg_cur_hp = rpg_cur_hp - $hp_deduct where " .
($is_npc ? "npc_id = " . $row['npc_id'] : "user_id = " . $row['user_id']);
$db->sql_query($sql);
$ret_msg = "射中 " . ($is_npc ? ($row['npc_name'] == '' ? "" . $row['npc_id'] : $row['npc_name']) : $row['username']) . " 損傷 $hp_deduct 點 " . $ret_msg;
$dead_cause = ($next_act == 317 ? "弩" : "射" ) . "擊($hp_deduct)";
}
// 反擊
$row['rpg_cur_hp'] -= $hp_deduct;
if ( $row['rpg_cur_hp'] > 0 )
{
if ( $is_npc )
{
if ( rand(1, 100) <= 40 )
{
if ( $row['rpg_attack'] - $profiledata['rpg_defense'] > 100 )
{
$hp_deduct = rand(100, $row['rpg_attack'] - $profiledata['rpg_defense']);
}
else
{
$hp_deduct = 100;
}
$hp_deduct = floor($hp_deduct / rand(2, 10));
$sql = "update phpbb_users set rpg_cur_hp = rpg_cur_hp - $hp_deduct where user_id = " . $profiledata['user_id'];
$db->sql_query($sql);
$ret_msg .= " 對手 " . ($row['npc_name'] == '' ? "" . $row['npc_id'] : $row['npc_name']) . " 反擊,損傷 $hp_deduct 點。";
$am_i_dead = CheckMyDead($profiledata['user_id']);
}
}
else
{
$sql = "select max(position_order) as max_point from phpbb_rpg_medals where position_class = 2 and user_id = " . $row['user_id'];
$result = $db->sql_query($sql);
if ( $row2 = $db->sql_fetchrow($result) )
{
if ( (abs($next_x - $now_x) + abs($next_y - $now_y) <= $row2['max_point'] + 1) && (rand(1, 100) <= 50) )
{
if ( $row['rpg_attack'] - $profiledata['rpg_defense'] > 10 * ($row2['max_point'] + 1) )
{
$hp_deduct = rand(10 * ($row2['max_point'] + 1), $row['rpg_attack'] - $profiledata['rpg_defense']);
}
else
{
$hp_deduct = 10 * ($row2['max_point'] + 1);
}
$hp_deduct = floor($hp_deduct / rand(2, 10));
$sql = "update phpbb_users set rpg_cur_hp = rpg_cur_hp - $hp_deduct where user_id = " . $profiledata['user_id'];
$db->sql_query($sql);
$ret_msg .= " 對手 " . $row['username'] . " 反擊,損傷 $hp_deduct 點。";
$am_i_dead = CheckMyDead($profiledata['user_id']);
UserIsDead("user_id = " . $profiledata['user_id'], "u.user_id = " . $profiledata['user_id'], $row['user_id'], $row['username'], $profiledata['rpg_level'], "射擊反擊($hp_deduct)");
}
}
}
}
if ( $is_npc )
{
if ( $is_normal_npc )
$ret_msg .= UserIsDead("npc_id = " . $row['npc_id'], '', $profiledata['user_id'], '', 0, $dead_cause, true);
}
else
{
$ret_msg .= UserIsDead("user_id = " . $row['user_id'], "u.user_id = " . $row['user_id'], $profiledata['user_id'], $profiledata['username'], $profiledata['rpg_level'], $dead_cause);
}
break;
?>[/php]
測試結果
失敗 跟戰士一樣直接顯示打多少血或是沒射中\r
並且有錯誤
function_eol.php 471行-497行是這樣的
[php]<?php
function AttackPercent($self, $target)
{
if ( $self == 0 ) return 95;
if ( $target == $self ) return 80;
if ( $target > $self )
{
if ( ($target - $self) / $self * 8 > 75 )
{
return 5;
}
else
{
return 80 - floor( ($target - $self) / $self * 8 );
}
}
else
{
if ( ($self - $target) / $target * 2 > 15 )
{
return 95;
}
else
{
return 80 + floor( ($self - $target) / $target * 2 );
}
}
}
?>[/php]
攻擊的技能到底要怎麼做呢???
1.僧侶的補血技能
2.戰士的攻擊
3.弓箭的設擊
經過我明察按法的結果
技能是在 phpbb_rpg_item裡\r
僧侶補血技能如下
`phpbb_rpg_items` VALUES (109, '初級回復咒文', '回復10% / 50 * 職業Lv', 3, 3, 0, '3', NULL, NULL, 10000000, 0, 0, 0, 0, 0, '0.0', '0.0', '0.0', '0.0', '0.0', '0.0', 'PL', '50');
土法煉鋼 不知道為什麼314號加不進去所以就加315號
INSERT INTO `phpbb_rpg_items` VALUES (315, '小朋友回復咒文', '回復5% / 50 * 職業Lv', 3, 1, 0, '3', NULL, NULL, 50000, 0, 0, 0, 0, 0, '0.0', '0.0', '0.0', '0.0', '0.0', '0.0', 'PL', '30');
然後function_eol.php裡有這一段\r
[php]<?php
case 109: // HP 10%
$sql = "update phpbb_users set rpg_cur_hp = rpg_cur_hp + floor(rpg_max_hp * 0.1) where user_id = " . $profiledata['user_id'];
$db->sql_query($sql);
$sql = "update phpbb_users set rpg_cur_hp = rpg_max_hp where rpg_cur_hp > rpg_max_hp and user_id = " . $profiledata['user_id'];
$db->sql_query($sql);
$ret_msg = "施咒完成, HP 恢復 10% :: " . floor($profiledata['rpg_max_hp'] * 0.1) . "點";
break;
?>[/php]
土法煉鋼在她前面加了
[php]<?php
case 315: // HP 5%
$sql = "update phpbb_users set rpg_cur_hp = rpg_cur_hp + floor(rpg_max_hp * 0.05) where user_id = " . $profiledata['user_id'];
$db->sql_query($sql);
$sql = "update phpbb_users set rpg_cur_hp = rpg_max_hp where rpg_cur_hp > rpg_max_hp and user_id = " . $profiledata['user_id'];
$db->sql_query($sql);
$ret_msg = "施咒完成, HP 恢復 5% :: " . floor($profiledata['rpg_max_hp'] * 0.1) . "點";
break;
?>[/php]
測試結果
成功 可以補血5%
接下來是戰士的
`phpbb_rpg_items` VALUES (167, '疾風斬', '100%命中, ATT - 對方DEF / 5 * LV', 3, 3, 0, '1', NULL, NULL, 500000, 0, 0, 0, 0, 0, '0.0', '0.0', '0.0', '0.0', '0.0', '0.0', '5', 'LV');
土法煉鋼\r
INSERT INTO `phpbb_rpg_items` VALUES (316, '狂擊', '100%命中, ATT - 對方DEF*2 / 3 * LV', 3, 1, 0, '1', NULL, NULL, 50000, 0, 0, 0, 0, 0, '0.0', '0.0', '0.0', '0.0', '0.0', '0.0', '3', 'LV');
然後function_eol.php裡有這一段\r
[php]<?php
case 167: // 疾風斬\r
case 168: // 龍擊破\r
case 169: // 霸皇神擊
case 170: // 爆炸鐵金剛
switch ( $next_act )
{
case 167:
$hp_deduct = $profiledata['rpg_attack'] - $row['rpg_defense'];
$ret_msg = $profiledata['username'] . '使出 疾風斬 ';
$dead_cause = '疾風斬';
break;
case 168:
$hp_deduct = $profiledata['rpg_attack'] * 2 - $row['rpg_defense'];
$ret_msg = $profiledata['username'] . '使出 龍擊破 ';
$dead_cause = '龍擊破';
break;
case 169:
$hp_deduct = $profiledata['rpg_attack'] * 3 - $row['rpg_defense'];
$ret_msg = $profiledata['username'] . '使出 霸皇神擊 ';
$dead_cause = '霸皇神擊';
break;
case 170:
$hp_deduct = $profiledata['rpg_cur_hp'] - 1;
$ret_msg = $profiledata['username'] . '使出 爆炸鐵金剛(淚) ';
$dead_cause = '爆炸鐵金剛(淚\\)';
$sql = "update phpbb_users set rpg_cur_hp = 1 where user_id = " . $profiledata['user_id'];
$db->sql_query($sql);
$profiledata['rpg_cur_hp'] = 1;
break;
}
if ( $hp_deduct < 0 ) $hp_deduct = 0;
$sql = "update " . ($is_npc ? "phpbb_rpg_npc" : "phpbb_users") .
" set rpg_cur_hp = rpg_cur_hp - $hp_deduct where " . ($is_npc ? "npc_id = " . $row['npc_id'] : "user_id = " . $row['user_id']);
$db->sql_query($sql);
$dead_cause .= "($hp_deduct)";
$ret_msg .= "擊中 " . ($is_npc ? ($row['npc_name'] == '' ? "" . $row['npc_id'] : $row['npc_name']) : $row['username']) . " 損傷 $hp_deduct 點。";
// 對手反擊
// $row['rpg_cur_hp'] -= $hp_deduct;
$ret_msg .= CounterAttack($am_i_dead, $profiledata, $row, $is_npc);
if ( $is_npc )
{
if ( $is_normal_npc )
$ret_msg .= UserIsDead("npc_id = " . $row['npc_id'], '', $profiledata['user_id'], '', 0, $dead_cause, true);
}
else
{
$ret_msg .= UserIsDead("user_id = " . $row['user_id'], "u.user_id = " . $row['user_id'], $profiledata['user_id'], $profiledata['username'], $profiledata['rpg_level'], $dead_cause);
}
break;
?>[/php]
我給他這樣改
[php]<?php
case 316: // 狂擊
case 167: // 疾風斬\r
case 168: // 龍擊破\r
case 169: // 霸皇神擊
case 170: // 爆炸鐵金剛
switch ( $next_act )
{
case 316:
$hp_deduct = $profiledata['rpg_attack'] - $row['rpg_defense'] * 2;
$ret_msg = $profiledata['username'] . '使出 狂擊 ';
$dead_cause = '狂擊';
break;
case 168:
$hp_deduct = $profiledata['rpg_attack'] * 2 - $row['rpg_defense'];
$ret_msg = $profiledata['username'] . '使出 龍擊破 ';
$dead_cause = '龍擊破';
break;
case 169:
$hp_deduct = $profiledata['rpg_attack'] * 3 - $row['rpg_defense'];
$ret_msg = $profiledata['username'] . '使出 霸皇神擊 ';
$dead_cause = '霸皇神擊';
break;
case 170:
$hp_deduct = $profiledata['rpg_cur_hp'] - 1;
$ret_msg = $profiledata['username'] . '使出 爆炸鐵金剛(淚) ';
$dead_cause = '爆炸鐵金剛(淚\\)';
$sql = "update phpbb_users set rpg_cur_hp = 1 where user_id = " . $profiledata['user_id'];
$db->sql_query($sql);
$profiledata['rpg_cur_hp'] = 1;
break;
}
if ( $hp_deduct < 0 ) $hp_deduct = 0;
$sql = "update " . ($is_npc ? "phpbb_rpg_npc" : "phpbb_users") .
" set rpg_cur_hp = rpg_cur_hp - $hp_deduct where " . ($is_npc ? "npc_id = " . $row['npc_id'] : "user_id = " . $row['user_id']);
$db->sql_query($sql);
$dead_cause .= "($hp_deduct)";
$ret_msg .= "擊中 " . ($is_npc ? ($row['npc_name'] == '' ? "" . $row['npc_id'] : $row['npc_name']) : $row['username']) . " 損傷 $hp_deduct 點。";
// 對手反擊
// $row['rpg_cur_hp'] -= $hp_deduct;
$ret_msg .= CounterAttack($am_i_dead, $profiledata, $row, $is_npc);
if ( $is_npc )
{
if ( $is_normal_npc )
$ret_msg .= UserIsDead("npc_id = " . $row['npc_id'], '', $profiledata['user_id'], '', 0, $dead_cause, true);
}
else
{
$ret_msg .= UserIsDead("user_id = " . $row['user_id'], "u.user_id = " . $row['user_id'], $profiledata['user_id'], $profiledata['username'], $profiledata['rpg_level'], $dead_cause);
}
break;
?>[/php]
測試結果
失敗
會跳過選擇攻擊角色 而直接顯示出攻擊結果
再來是弓箭手
`phpbb_rpg_items` VALUES (166, '射擊', '學會這個才能射箭哦! / 30 * 職業Lv', 3, 1, 0, '2', NULL, NULL, 50000, 0, 0, 0, 0, 0, '0.0', '0.0', '0.0', '0.0', '0.0', '0.0', '30', 'PL');
土法煉鋼\r
INSERT INTO `phpbb_rpg_items` VALUES (317, '二連矢', '連射2箭! / 50 * 職業Lv', 3, 2, 0, '2', NULL, NULL, 100000, 0, 0, 0, 0, 0, '0.0', '0.0', '0.0', '0.0', '0.0', '0.0', '50', 'PL');
然後function_eol.php裡有這一段\r
[php]<?php
case 166: // 射擊
case 172: // 弩弓
$sql1 = '';
$sql2 = '';
$sql3 = '';
if ( $next_x == $now_x ) // 直線射擊
{
if ($next_y > $now_y + 1)
{
$sql1 = "left(right(rpg_eol_data, 6), 3) = $now_x and right(rpg_eol_data, 3) > $now_y and right(rpg_eol_data, 3) < $next_y and right(rpg_eol_data, 6) <> '000086'";
$sql2 = "now_x = $now_x and now_y > $now_y and now_y < $next_y and (now_x <> 0 or now_y <> 86)";
$sql3 = "left(right(u.rpg_eol_data, 6), 3) = $now_x and right(u.rpg_eol_data, 3) > $now_y and right(u.rpg_eol_data, 3) < $next_y and right(u.rpg_eol_data, 6) <> '000086'";
}
else if ($next_y < $now_y - 1)
{
$sql1 = "left(right(rpg_eol_data, 6), 3) = $now_x and right(rpg_eol_data, 3) > $next_y and right(rpg_eol_data, 3) < $now_y and right(rpg_eol_data, 6) <> '000086'";
$sql2 = "now_x = $now_x and now_y > $next_y and now_y < $now_y and (now_x <> 0 or now_y <> 86)";
$sql3 = "left(right(u.rpg_eol_data, 6), 3) = $now_x and right(u.rpg_eol_data, 3) > $next_y and right(u.rpg_eol_data, 3) < $now_y and right(u.rpg_eol_data, 6) <> '000086'";
}
}
else if ( $next_y == $now_y )
{
if ($next_x > $now_x + 1)
{
$sql1 = "right(rpg_eol_data, 3) = $now_y and left(right(rpg_eol_data, 6), 3) > $now_x and left(right(rpg_eol_data, 6), 3) < $next_x and right(rpg_eol_data, 6) <> '000086'";
$sql2 = "now_y = $now_y and now_x > $now_x and now_x < $next_x and (now_x <> 0 or now_y <> 86)";
$sql3 = "right(u.rpg_eol_data, 3) = $now_y and left(right(u.rpg_eol_data, 6), 3) > $now_x and left(right(u.rpg_eol_data, 6), 3) < $next_x and right(u.rpg_eol_data, 6) <> '000086'";
}
else if ($next_x < $now_x - 1)
{
$sql1 = "right(rpg_eol_data, 3) = $now_y and left(right(rpg_eol_data, 6), 3) > $next_x and left(right(rpg_eol_data, 6), 3) < $now_x and right(rpg_eol_data, 6) <> '000086'";
$sql2 = "now_y = $now_y and now_x > $next_x and now_x < $now_x and (now_x <> 0 or now_y <> 86)";
$sql3 = "right(u.rpg_eol_data, 3) = $now_y and left(right(u.rpg_eol_data, 6), 3) > $now_x and left(right(u.rpg_eol_data, 6), 3) < $next_x and right(u.rpg_eol_data, 6) <> '000086'";
}
}
if ( $sql1 != '' )
{
$dead_cause = '';
$hp_deduct = rand(10, 50) * $max_point;
if ($next_act == 172) $hp_deduct *= 3;
$sql = "select username from phpbb_users where $sql1";
$result = $db->sql_query($sql);
if ( $row2 = $db->sql_fetchrow($result) )
{
do
{
$dead_cause .= $row2['username'] . ' ';
}
while ( $row2 = $db->sql_fetchrow($result) );
}
$sql = "select npc_id, npc_name from phpbb_rpg_npc where $sql2";
$result = $db->sql_query($sql);
if ( $row2 = $db->sql_fetchrow($result) )
{
do
{
$dead_cause .= ($row2['npc_name'] == '' ? '' . $row2['npc_id'] : $row2['npc_name']) . ' ';
}
while ( $row2 = $db->sql_fetchrow($result) );
}
$sql = "update phpbb_users set rpg_cur_hp = rpg_cur_hp - $hp_deduct where $sql1";
$db->sql_query($sql);
$sql = "update phpbb_rpg_npc set rpg_cur_hp = rpg_cur_hp - $hp_deduct where $sql2";
$db->sql_query($sql);
if ( $dead_cause != '' )
{
$ret_msg .= " 流彈受傷點數: $hp_deduct 流彈受傷人員: " . $dead_cause;
$ret_msg .= UserIsDead($sql1, $sql3, $profiledata['user_id'], $profiledata['username'], $profiledata['rpg_level'], ($next_act == 172 ? "弩" : "射" ) . "擊流彈($hp_deduct)");
if ( $is_normal_npc && $is_npc )
$ret_msg .= UserIsDead($sql2, "", $profiledata['user_id'], $profiledata['username'], $profiledata['rpg_level'], ($next_act == 172 ? "弩" : "射" ) . "擊流彈($hp_deduct)", true);
}
}
unset($sql1);
unset($sql2);
unset($sql3);
if ( rand(1, 100) > AttackPercent($profiledata['rpg_speed'] * 2, $row['rpg_speed']) )
{
$ret_msg = "太遜了,沒射中目標人物...." . $ret_msg;
}
else
{
if ( $profiledata['rpg_attack'] > $row['rpg_defense'] )
{
$hp_deduct = rand( ( ($profiledata['rpg_attack'] / 2 - $row['rpg_defense']) > 0 ? floor($profiledata['rpg_attack'] / 2 - $row['rpg_defense']) : 1) , $profiledata['rpg_attack'] - $row['rpg_defense']);
}
else
{
$hp_deduct = 10;
}\r
if ( $hp_deduct < $max_point * 10 )
$hp_deduct = rand($max_point * 10, $max_point * 20);
if ($next_act == 172) $hp_deduct *= 3;
$sql = "update " . ($is_npc ? "phpbb_rpg_npc" : "phpbb_users") .
" set rpg_cur_hp = rpg_cur_hp - $hp_deduct where " .
($is_npc ? "npc_id = " . $row['npc_id'] : "user_id = " . $row['user_id']);
$db->sql_query($sql);
$ret_msg = "射中 " . ($is_npc ? ($row['npc_name'] == '' ? "" . $row['npc_id'] : $row['npc_name']) : $row['username']) . " 損傷 $hp_deduct 點 " . $ret_msg;
$dead_cause = ($next_act == 172 ? "弩" : "射" ) . "擊($hp_deduct)";
}
// 反擊
$row['rpg_cur_hp'] -= $hp_deduct;
if ( $row['rpg_cur_hp'] > 0 )
{
if ( $is_npc )
{
if ( rand(1, 100) <= 40 )
{
if ( $row['rpg_attack'] - $profiledata['rpg_defense'] > 100 )
{
$hp_deduct = rand(100, $row['rpg_attack'] - $profiledata['rpg_defense']);
}
else
{
$hp_deduct = 100;
}
$hp_deduct = floor($hp_deduct / rand(2, 10));
$sql = "update phpbb_users set rpg_cur_hp = rpg_cur_hp - $hp_deduct where user_id = " . $profiledata['user_id'];
$db->sql_query($sql);
$ret_msg .= " 對手 " . ($row['npc_name'] == '' ? "" . $row['npc_id'] : $row['npc_name']) . " 反擊,損傷 $hp_deduct 點。";
$am_i_dead = CheckMyDead($profiledata['user_id']);
}
}
else
{
$sql = "select max(position_order) as max_point from phpbb_rpg_medals where position_class = 2 and user_id = " . $row['user_id'];
$result = $db->sql_query($sql);
if ( $row2 = $db->sql_fetchrow($result) )
{
if ( (abs($next_x - $now_x) + abs($next_y - $now_y) <= $row2['max_point'] + 1) && (rand(1, 100) <= 50) )
{
if ( $row['rpg_attack'] - $profiledata['rpg_defense'] > 10 * ($row2['max_point'] + 1) )
{
$hp_deduct = rand(10 * ($row2['max_point'] + 1), $row['rpg_attack'] - $profiledata['rpg_defense']);
}
else
{
$hp_deduct = 10 * ($row2['max_point'] + 1);
}
$hp_deduct = floor($hp_deduct / rand(2, 10));
$sql = "update phpbb_users set rpg_cur_hp = rpg_cur_hp - $hp_deduct where user_id = " . $profiledata['user_id'];
$db->sql_query($sql);
$ret_msg .= " 對手 " . $row['username'] . " 反擊,損傷 $hp_deduct 點。";
$am_i_dead = CheckMyDead($profiledata['user_id']);
UserIsDead("user_id = " . $profiledata['user_id'], "u.user_id = " . $profiledata['user_id'], $row['user_id'], $row['username'], $profiledata['rpg_level'], "射擊反擊($hp_deduct)");
}
}
}
}
if ( $is_npc )
{
if ( $is_normal_npc )
$ret_msg .= UserIsDead("npc_id = " . $row['npc_id'], '', $profiledata['user_id'], '', 0, $dead_cause, true);
}
else
{
$ret_msg .= UserIsDead("user_id = " . $row['user_id'], "u.user_id = " . $row['user_id'], $profiledata['user_id'], $profiledata['username'], $profiledata['rpg_level'], $dead_cause);
}
break;
?>[/php]
土法煉鋼在她後面加上
[php]<?php
case 317: // 2連矢\r
$sql1 = '';
$sql2 = '';
$sql3 = '';
if ( $next_x == $now_x ) // 直線射擊
{
if ($next_y > $now_y + 1)
{
$sql1 = "left(right(rpg_eol_data, 6), 3) = $now_x and right(rpg_eol_data, 3) > $now_y and right(rpg_eol_data, 3) < $next_y and right(rpg_eol_data, 6) <> '000086'";
$sql2 = "now_x = $now_x and now_y > $now_y and now_y < $next_y and (now_x <> 0 or now_y <> 86)";
$sql3 = "left(right(u.rpg_eol_data, 6), 3) = $now_x and right(u.rpg_eol_data, 3) > $now_y and right(u.rpg_eol_data, 3) < $next_y and right(u.rpg_eol_data, 6) <> '000086'";
}
else if ($next_y < $now_y - 1)
{
$sql1 = "left(right(rpg_eol_data, 6), 3) = $now_x and right(rpg_eol_data, 3) > $next_y and right(rpg_eol_data, 3) < $now_y and right(rpg_eol_data, 6) <> '000086'";
$sql2 = "now_x = $now_x and now_y > $next_y and now_y < $now_y and (now_x <> 0 or now_y <> 86)";
$sql3 = "left(right(u.rpg_eol_data, 6), 3) = $now_x and right(u.rpg_eol_data, 3) > $next_y and right(u.rpg_eol_data, 3) < $now_y and right(u.rpg_eol_data, 6) <> '000086'";
}
}
else if ( $next_y == $now_y )
{
if ($next_x > $now_x + 1)
{
$sql1 = "right(rpg_eol_data, 3) = $now_y and left(right(rpg_eol_data, 6), 3) > $now_x and left(right(rpg_eol_data, 6), 3) < $next_x and right(rpg_eol_data, 6) <> '000086'";
$sql2 = "now_y = $now_y and now_x > $now_x and now_x < $next_x and (now_x <> 0 or now_y <> 86)";
$sql3 = "right(u.rpg_eol_data, 3) = $now_y and left(right(u.rpg_eol_data, 6), 3) > $now_x and left(right(u.rpg_eol_data, 6), 3) < $next_x and right(u.rpg_eol_data, 6) <> '000086'";
}
else if ($next_x < $now_x - 1)
{
$sql1 = "right(rpg_eol_data, 3) = $now_y and left(right(rpg_eol_data, 6), 3) > $next_x and left(right(rpg_eol_data, 6), 3) < $now_x and right(rpg_eol_data, 6) <> '000086'";
$sql2 = "now_y = $now_y and now_x > $next_x and now_x < $now_x and (now_x <> 0 or now_y <> 86)";
$sql3 = "right(u.rpg_eol_data, 3) = $now_y and left(right(u.rpg_eol_data, 6), 3) > $now_x and left(right(u.rpg_eol_data, 6), 3) < $next_x and right(u.rpg_eol_data, 6) <> '000086'";
}
}
if ( $sql1 != '' )
{
$dead_cause = '';
$hp_deduct = rand(10, 50) * $max_point * 2;
if ($next_act == 317) $hp_deduct *= 3;
$sql = "select username from phpbb_users where $sql1";
$result = $db->sql_query($sql);
if ( $row2 = $db->sql_fetchrow($result) )
{
do
{
$dead_cause .= $row2['username'] . ' ';
}
while ( $row2 = $db->sql_fetchrow($result) );
}
$sql = "select npc_id, npc_name from phpbb_rpg_npc where $sql2";
$result = $db->sql_query($sql);
if ( $row2 = $db->sql_fetchrow($result) )
{
do
{
$dead_cause .= ($row2['npc_name'] == '' ? '' . $row2['npc_id'] : $row2['npc_name']) . ' ';
}
while ( $row2 = $db->sql_fetchrow($result) );
}
$sql = "update phpbb_users set rpg_cur_hp = rpg_cur_hp - $hp_deduct where $sql1";
$db->sql_query($sql);
$sql = "update phpbb_rpg_npc set rpg_cur_hp = rpg_cur_hp - $hp_deduct where $sql2";
$db->sql_query($sql);
if ( $dead_cause != '' )
{
$ret_msg .= " 流彈受傷點數: $hp_deduct 流彈受傷人員: " . $dead_cause;
$ret_msg .= UserIsDead($sql1, $sql3, $profiledata['user_id'], $profiledata['username'], $profiledata['rpg_level'], ($next_act == 317 ? "弩" : "射" ) . "擊流彈($hp_deduct)");
if ( $is_normal_npc && $is_npc )
$ret_msg .= UserIsDead($sql2, "", $profiledata['user_id'], $profiledata['username'], $profiledata['rpg_level'], ($next_act == 317 ? "弩" : "射" ) . "擊流彈($hp_deduct)", true);
}
}
unset($sql1);
unset($sql2);
unset($sql3);
if ( rand(1, 100) > AttackPercent($profiledata['rpg_speed'] * 2, $row['rpg_speed']) )
{
$ret_msg = "太遜了,沒射中目標人物...." . $ret_msg;
}
else
{
if ( $profiledata['rpg_attack'] > $row['rpg_defense'] )
{
$hp_deduct = rand( ( ($profiledata['rpg_attack'] / 2 - $row['rpg_defense']) > 0 ? floor($profiledata['rpg_attack'] / 2 - $row['rpg_defense']) : 1) , $profiledata['rpg_attack'] - $row['rpg_defense']);
}
else
{
$hp_deduct = 10;
}
if ( $hp_deduct < $max_point * 10 )
$hp_deduct = rand($max_point * 10, $max_point * 20);
if ($next_act == 317) $hp_deduct *= 3;
$sql = "update " . ($is_npc ? "phpbb_rpg_npc" : "phpbb_users") .
" set rpg_cur_hp = rpg_cur_hp - $hp_deduct where " .
($is_npc ? "npc_id = " . $row['npc_id'] : "user_id = " . $row['user_id']);
$db->sql_query($sql);
$ret_msg = "射中 " . ($is_npc ? ($row['npc_name'] == '' ? "" . $row['npc_id'] : $row['npc_name']) : $row['username']) . " 損傷 $hp_deduct 點 " . $ret_msg;
$dead_cause = ($next_act == 317 ? "弩" : "射" ) . "擊($hp_deduct)";
}
// 反擊
$row['rpg_cur_hp'] -= $hp_deduct;
if ( $row['rpg_cur_hp'] > 0 )
{
if ( $is_npc )
{
if ( rand(1, 100) <= 40 )
{
if ( $row['rpg_attack'] - $profiledata['rpg_defense'] > 100 )
{
$hp_deduct = rand(100, $row['rpg_attack'] - $profiledata['rpg_defense']);
}
else
{
$hp_deduct = 100;
}
$hp_deduct = floor($hp_deduct / rand(2, 10));
$sql = "update phpbb_users set rpg_cur_hp = rpg_cur_hp - $hp_deduct where user_id = " . $profiledata['user_id'];
$db->sql_query($sql);
$ret_msg .= " 對手 " . ($row['npc_name'] == '' ? "" . $row['npc_id'] : $row['npc_name']) . " 反擊,損傷 $hp_deduct 點。";
$am_i_dead = CheckMyDead($profiledata['user_id']);
}
}
else
{
$sql = "select max(position_order) as max_point from phpbb_rpg_medals where position_class = 2 and user_id = " . $row['user_id'];
$result = $db->sql_query($sql);
if ( $row2 = $db->sql_fetchrow($result) )
{
if ( (abs($next_x - $now_x) + abs($next_y - $now_y) <= $row2['max_point'] + 1) && (rand(1, 100) <= 50) )
{
if ( $row['rpg_attack'] - $profiledata['rpg_defense'] > 10 * ($row2['max_point'] + 1) )
{
$hp_deduct = rand(10 * ($row2['max_point'] + 1), $row['rpg_attack'] - $profiledata['rpg_defense']);
}
else
{
$hp_deduct = 10 * ($row2['max_point'] + 1);
}
$hp_deduct = floor($hp_deduct / rand(2, 10));
$sql = "update phpbb_users set rpg_cur_hp = rpg_cur_hp - $hp_deduct where user_id = " . $profiledata['user_id'];
$db->sql_query($sql);
$ret_msg .= " 對手 " . $row['username'] . " 反擊,損傷 $hp_deduct 點。";
$am_i_dead = CheckMyDead($profiledata['user_id']);
UserIsDead("user_id = " . $profiledata['user_id'], "u.user_id = " . $profiledata['user_id'], $row['user_id'], $row['username'], $profiledata['rpg_level'], "射擊反擊($hp_deduct)");
}
}
}
}
if ( $is_npc )
{
if ( $is_normal_npc )
$ret_msg .= UserIsDead("npc_id = " . $row['npc_id'], '', $profiledata['user_id'], '', 0, $dead_cause, true);
}
else
{
$ret_msg .= UserIsDead("user_id = " . $row['user_id'], "u.user_id = " . $row['user_id'], $profiledata['user_id'], $profiledata['username'], $profiledata['rpg_level'], $dead_cause);
}
break;
?>[/php]
測試結果
失敗 跟戰士一樣直接顯示打多少血或是沒射中\r
並且有錯誤
代碼: 選擇全部
Warning: Division by zero in c:\appserv\www\bs
pg\function_eol.php on line 488
Warning: Division by zero in c:\appserv\www\bs
pg\function_eol.php on line 494
[php]<?php
function AttackPercent($self, $target)
{
if ( $self == 0 ) return 95;
if ( $target == $self ) return 80;
if ( $target > $self )
{
if ( ($target - $self) / $self * 8 > 75 )
{
return 5;
}
else
{
return 80 - floor( ($target - $self) / $self * 8 );
}
}
else
{
if ( ($self - $target) / $target * 2 > 15 )
{
return 95;
}
else
{
return 80 + floor( ($self - $target) / $target * 2 );
}
}
}
?>[/php]
攻擊的技能到底要怎麼做呢???