開啟檔案 src\AI\Attack.pm
=====修改(1)=====
原程式碼- } elsif (
- $config{attackCheckLOS} && $args->{attackMethod}{distance} > 2
- && (($config{attackCanSnipe} && !checkLineSnipable($realMyPos, $realMonsterPos))
- || (!$config{attackCanSnipe} && $realMonsterDist <= $args->{attackMethod}{maxDistance} && !checkLineWalkable($realMyPos, $realMonsterPos, 1)))
- ) {
複製代碼 複製代碼
修改成- } elsif (
- $config{attackCheckLOS} && $realMonsterDist > 1
- && (($config{attackCanSnipe} && !checkLineSnipable($realMyPos, $realMonsterPos))
- || (!$config{attackCanSnipe} && $realMonsterDist <= $args->{attackMethod}{maxDistance} && !checkLineWalkable($realMyPos, $realMonsterPos, 0)))
- ) {
複製代碼 複製代碼
修改 02 ,05 行~
=====修改(1-1)===== PUN_DI 大大 && 11225s 大大提供
原程式碼- my @stand = calcRectArea2($realMonsterPos->{x}, $realMonsterPos->{y},
- $args->{attackMethod}{distance},
複製代碼 複製代碼
修改成- my @stand = calcRectArea2($realMonsterPos->{x}, $realMonsterPos->{y},
- round($args->{attackMethod}{maxDistance}),
複製代碼 複製代碼
將 {distance} 修改成 {maxDistance} 並 四捨五入計算
=====修改(2)=====
原程式碼- if (
- (($config{attackCanSnipe} && checkLineSnipable($spot, $realMonsterPos))
- || checkLineWalkable($spot, $realMonsterPos))
- && $field->isWalkable($spot->{x}, $spot->{y})
- && ($realMyPos->{x} != $spot->{x} && $realMyPos->{y} != $spot->{y})
- && (!$master || round(distance($spot, $masterPos)) <= $config{followDistanceMax})
- ) {
複製代碼 複製代碼
修改成- if (
- (($config{attackCanSnipe} && checkLineSnipable($spot, $realMonsterPos))
- || checkLineWalkable($spot, $realMonsterPos, 0))
- && $field->isWalkable($spot->{x}, $spot->{y})
- && ($realMyPos->{x} != $spot->{x} && $realMyPos->{y} != $spot->{y})
- && (!$master || round(distance($spot, $masterPos)) <= $config{followDistanceMax})
- ) {
複製代碼 複製代碼
修改 03 行增加 , 0
開啟檔案 src\Misc.pm
=====修改(3)=====
原程式碼- use Time::HiRes qw(time usleep);
- use Translation;
複製代碼 複製代碼
修改成- use Time::HiRes qw(time usleep);
- use Task::Route;
- use Translation;
複製代碼 複製代碼
=====修改(4)=====
原程式碼- # Check whether character comes earlier or at the same time
- if ($timeCharWalks <= $timeMonsterWalks ) {
- return \%charStep;
- }
複製代碼 複製代碼
修改成- # Check whether character comes earlier or at the same time
- if ($timeCharWalks <= $timeMonsterWalks && $field->isWalkable($charStep{x}, $charStep{y}) ) {
- return \%charStep;
- }
複製代碼 複製代碼
=====修改(5)=====
原程式碼- # Check whether the distance is fine
- if (round(distance(\%charStep, \%monsterPosTo)) <= $attackMaxDistance) {
- last;
- }
複製代碼 複製代碼
修改成- # Check whether the distance is fine
- if (round(distance(\%charStep, \%monsterPosTo)) <= $attackMaxDistance && $field->isWalkable($charStep{x}, $charStep{y})) {
- last;
- }
複製代碼 複製代碼
=====修改(6)=====
原程式碼- if (
- !($accountID eq $targetID ? $attackTarget->{dmgToYou} : $attackTarget->{dmgToPlayer}{$targetID})
- && !($accountID eq $targetID ? $attackTarget->{dmgToYou} : $attackTarget->{dmgFromPlayer}{$targetID})
- && distance($monster->{pos_to}, calcPosition($player)) <= $attackSeq->{attackMethod}{distance}
- ) {
複製代碼 複製代碼
修改成- if (
- !($accountID eq $targetID ? $attackTarget->{dmgToYou} : $attackTarget->{dmgToPlayer}{$targetID})
- && !($accountID eq $targetID ? $attackTarget->{dmgFromYou} : $attackTarget->{dmgFromPlayer}{$targetID})
- && distance($monster->{pos_to}, calcPosition($player)) <= $attackSeq->{attackMethod}{maxDistance}
- ) {
複製代碼 複製代碼
修改 03,04 行~
=====修改(7)=====
原程式碼- my ($highestPri, $smallestDist, $bestTarget);
- # First of all we check monsters in LOS, then the rest of monsters
複製代碼
複製代碼
修改成- my ($highestPri, $smallestDist, $bestTarget);
- my $MaxSteps = $config{attackMaxRouteDistance} || 40;
- # First of all we check monsters in LOS, then the rest of monsters
複製代碼 複製代碼
=====修改(8)=====- if ($config{'attackCanSnipe'}) {
- if (!checkLineSnipable($myPos, $pos)) {
- push(@noLOSMonsters, $_);
- next;
- }
- } else {
- if (!checkLineWalkable($myPos, $pos)) {
- push(@noLOSMonsters, $_);
- next;
- }
- }
- my $name = lc $monster->{name};
- my $dist = round(distance($myPos, $pos));
複製代碼 複製代碼
修改成- my $name = lc $monster->{name};
- my $dist = distance($myPos, $pos);
- if ($config{attackCheckRouteDistance} && $field) {
- my @solution;
- if ($dist >= 2 && (!$config{'attackCanSnipe'} || !checkLineSnipable($myPos, $pos)) ) {
- my $ret = Task::Route->getRoute( \@solution, $field, $myPos, $pos, 1 );
- unless ($ret) {
- $monster->{ignore} = 1;
- next;
- }
- my $Steps = scalar @solution;
- if ($Steps < $MaxSteps) {
- $dist = $Steps;
- } else {
- next;
- }
- }
- } else {
- if ($config{'attackCanSnipe'}) {
- if (!checkLineSnipable($myPos, $pos)) {
- push(@noLOSMonsters, $_);
- next;
- }
- } else {
- if (!checkLineWalkable($myPos, $pos)) {
- push(@noLOSMonsters, $_);
- next;
- }
- }
- }
複製代碼
複製代碼
開啟檔案 src\AI\CoreLogic.pm
=====修改(9)=====
原程式碼- # List party monsters
- foreach (@monstersID) {
- next if (!$_ || !checkMonsterCleanness($_));
- my $monster = $monsters{$_};
複製代碼 複製代碼
修改成- # List party monsters
- foreach (@monstersID) {
- next if (!$_ || !checkMonsterCleanness($_));
- my $monster = $monsters{$_};
- next if $monster->{ignore};
複製代碼 複製代碼
=====修改(10)=====clover1524 大大提供
原程式碼- if ($LOSSubRoute && $attackTarget) {
- Log::message("New target was choosen\n");
- # Remove all unnecessary actions (attacks and movements but the main route)
- my $i = scalar(@ai_seq);
- my (@ai_seq_temp, @ai_seq_args_temp);
- for(my $c=0;$c<$i;$c++) {
- if (($ai_seq[$c] ne "route")
- && ($ai_seq[$c] ne "move")
- && ($ai_seq[$c] ne "attack")) {
- push(@ai_seq_temp, $ai_seq[$c]);
- push(@ai_seq_args_temp, $ai_seq_args[$c]);
- }
- }
- # Add the main route and rewrite the sequence
- push(@ai_seq_temp, $ai_seq[$i-1]);
- push(@ai_seq_args_temp, $ai_seq_args[$i-1]);
- @ai_seq = @ai_seq_temp;
- @ai_seq_args = @ai_seq_args_temp;
- # We need this timeout not to have attack started many times
- $timeout{'ai_attack_auto'}{'time'} = time;
- }
- }
複製代碼 複製代碼
修改成- if ($LOSSubRoute && $attackTarget) {
- if ($attackTarget ne AI::args(AI::findAction("attack"))->{ID} ) {
- Log::message("New target was choosen\n");
- # Remove all unnecessary actions (attacks and movements but the main route)
- my $i = scalar(@ai_seq);
- my (@ai_seq_temp, @ai_seq_args_temp);
- for(my $c=0;$c<$i;$c++) {
- if (($ai_seq[$c] ne "route")
- && ($ai_seq[$c] ne "move")
- && ($ai_seq[$c] ne "attack")) {
- push(@ai_seq_temp, $ai_seq[$c]);
- push(@ai_seq_args_temp, $ai_seq_args[$c]);
- }
- }
- # Add the main route and rewrite the sequence
- push(@ai_seq_temp, $ai_seq[$i-1]);
- push(@ai_seq_args_temp, $ai_seq_args[$i-1]);
- @ai_seq = @ai_seq_temp;
- @ai_seq_args = @ai_seq_args_temp;
- # We need this timeout not to have attack started many times
- $timeout{'ai_attack_auto'}{'time'} = time;
- } else {
- undef $attackTarget;
- }
- }
- }
複製代碼 複製代碼
=====注意!!以上要在 config.txt 設定=====- attackCheckLOS 1
- # 0 = 不使用 ,1 = 使用
- # 是否判斷魔物與角色中間有無障礙物阻礙攻擊,自動閃避障礙物
- # 這可以避免因為障礙物阻隔打不到怪物,而原地發呆。
- attackChangeTarget 1
- # 是否使用智慧型變換攻擊目標
- # 0=不使用、1=使用,且出現 LOS 時,尋找更佳的目標來攻擊、2=使用。
- # 說明:
- # 鎖定某非主動怪物後,還沒開打,此時附近有高危險的主動怪靠近,
- # 這種情況下,kore 可以自動變換攻擊目標,
- # 捨棄原先鎖定的非主動怪,改成先打靠近中的高危險主動怪。
- # LOS 是指 attackCheckLOS 設為 1 時,正在自動閃避障礙物的情況,
- # 若此時附近剛好出現「沒被障礙物阻擋」的怪物,
- # 就不浪費時間 LOS 了,直接先打沒被阻擋的怪物。
- attackCheckRouteDistance 1
- # 0 = 不使用 ,1 = 使用
- # 偵測人物跟魔物之間的「步數」
- # 說明:人物跟魔物之間有障礙物時,繞過去需要的「步數」,
- # 若超過 attackMaxRouteDistance 設定值,會略過不打
- # 附加功能:魔物站在無法到達的地方會略過不打
- # 但因為要計算「步數」,CPU 負擔會加重,自行決定是否使用。
- attackMaxRouteDistance 30
- # 計算攻擊路徑的距離 這依地圖複雜性設定 或人物發呆
- # 如金字塔這種地圖建議調低一點來防止輔助發呆等問題
- # 狹窄、複雜地圖可設定15~20;一般地圖30;開闊的40
複製代碼
複製代碼
所有站內附件皆會附上安全掃描報告 請會員查看純淨度百分比後判斷使用
相關檔案須知: 取得檔案前,請先詳細閱讀文章內容 避免不必要錯誤與誤會發生。 也可多參考文章討論樓層內容 了解附件檔案相關討論資訊。
|