#============================================================================== # [ZTBS] -Zenith Tactical Battle System- タクティカルバトルシステム #  〜+B3:攻撃範囲拡張〜 by 水夜 #  ver0.90 Zenith Creation (http://zenith.ifdef.jp/) #------------------------------------------------------------------------------ # マップ上での戦略的なバトルを実現。 #============================================================================== #============================================================================== # ■ Game_Character #============================================================================== class Game_Character #-------------------------------------------------------------------------- # ● 指定方向を向く #-------------------------------------------------------------------------- def turn(direct) unless @direction_fix @direction = direct @stop_count = 0 end end end #============================================================================== # ■ Game_Player #============================================================================== class Game_Player < Game_Character #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- alias ztbsb3_update update def update if $game_system.in_tactics # ローカル変数に移動中かどうかを記憶 last_moving = moving? # 移動中、イベント実行中、移動ルート強制中、 # メッセージウィンドウ表示中のいずれでもない場合 unless moving? or $game_system.map_interpreter.running? or @move_route_forcing or $game_temp.message_window_showing # 方向ボタンが押されていれば、その方向へプレイヤーを移動 case Input.dir8 when 1 move_lower_left when 2 move_down when 3 move_lower_right when 4 move_left when 6 move_right when 7 move_upper_left when 8 move_up when 9 move_upper_right end end # ローカル変数に座標を記憶 last_real_x = @real_x last_real_y = @real_y super # キャラクターが下に移動し、かつ画面上の位置が中央より下の場合 if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y # マップを下にスクロール $game_map.scroll_down(@real_y - last_real_y) end # キャラクターが左に移動し、かつ画面上の位置が中央より左の場合 if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X # マップを左にスクロール $game_map.scroll_left(last_real_x - @real_x) end # キャラクターが右に移動し、かつ画面上の位置が中央より右の場合 if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X # マップを右にスクロール $game_map.scroll_right(@real_x - last_real_x) end # キャラクターが上に移動し、かつ画面上の位置が中央より上の場合 if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y # マップを上にスクロール $game_map.scroll_up(last_real_y - @real_y) end # 移動中ではない場合 unless moving? # 前回プレイヤーが移動中だった場合 if last_moving # 同位置のイベントとの接触によるイベント起動判定 result = check_event_trigger_here([1,2]) # 起動したイベントがない場合 if result == false # デバッグモードが ON かつ CTRL キーが押されている場合を除き unless $DEBUG and Input.press?(Input::CTRL) # エンカウント カウントダウン if @encounter_count > 0 @encounter_count -= 1 end end end end # C ボタンが押された場合 if Input.trigger?(Input::C) # 同位置および正面のイベント起動判定 check_event_trigger_here([0]) check_event_trigger_there([0,1,2]) end end else ztbsb3_update end end end #============================================================================== # ■ Scene_Map #============================================================================== class Scene_Map #-------------------------------------------------------------------------- # ● 公開インスタンス変数 #-------------------------------------------------------------------------- attr_reader :spriteset # スプライトセットの参照 #-------------------------------------------------------------------------- # ● フレーム更新 (アクターフェーズ ステップ 6 : 対象選択) #-------------------------------------------------------------------------- def update_phase1_step6 # カーソル位置のバトラー(イベント)取得 get_cursor_battler # ヘルプウィンドウにアクター or エネミーをセット set_battler_info # 座標から向きを変える sx = $game_player.x - @active_battler.x sy = $game_player.y - @active_battler.y # 横の距離のほうが長い場合 if sx.abs > sy.abs # 左右方向で指定イベントのいるほうを向く result = sx > 0 ? 6 : 4 # 縦の距離のほうが長い場合 elsif sx.abs < sy.abs # 上下方向で指定イベントのいるほうを向く result = sy > 0 ? 2 : 8 # 同じ場合 else # 右下 if sx > 0 and sy > 0 if @active_battler.direction == 4 or @active_battler.direction == 8 result = 6 else result = @active_battler.direction end # 右上 elsif sx > 0 if @active_battler.direction == 2 or @active_battler.direction == 4 result = 6 else result = @active_battler.direction end # 左下 elsif sy > 0 if @active_battler.direction == 6 or @active_battler.direction == 8 result = 4 else result = @active_battler.direction end # 左上 elsif sx < 0 and sx < 0 if @active_battler.direction == 2 or @active_battler.direction == 6 result = 4 else result = @active_battler.direction end # 中心 else result = @active_battler.direction end end if @active_battler.direction != result @active_battler.turn(result) @battler = @active_battler set_attack_area(0) end # C ボタンが押された場合 if Input.trigger?(Input::C) and !$game_player.moving? # 発動可能な場合 if possible_action? @back_step2 = nil # 決定 SE を演奏 $game_system.se_play($data_system.decision_se) # カーソルを固定 $game_player.not_update = true # エリアを解放 dispose_area # ステップ 7 へ移行 $game_system.tactics_step = 7 @select = nil if @revival == nil # ターゲットを取得 @targets = {} for i in @can_attack if $game_system.tactics_actors.keys.include?(i) @targets[i] = $game_system.tactics_actors[i] $game_map.events[i].turn_toward_event(@active_battler.id) else @targets[i] = $game_system.tactics_enemies[i] $game_map.events[i].turn_toward_event(@active_battler.id) end end @active_battler.turn_toward_position($game_player.x, $game_player.y) # 戦闘不能回復の場合 else $game_map.events[@targets.keys[0]].moveto($game_player.x, $game_player.y) @active_battler.turn_toward_position($game_player.x, $game_player.y) $game_map.events[@targets.keys[0]].turn_toward_event(@active_battler.id) end @revival = nil @can_attack = nil # アクション結果作成 case @attacker.current_action.kind when 0 if @attacker.current_action.basic != 4 make_basic_action_result else event_id = cando_id($game_player.x, $game_player.y) common_id = @talk_events[event_id][1] $game_system.map_interpreter.setup($data_common_events[common_id].list, 0) @talk_events.delete(event_id) # ステップ 10 へ移行 $game_system.tactics_step = 10 end when 1 make_skill_action_result when 2 make_item_action_result end else # ブザー SE を演奏 $game_system.se_play($data_system.buzzer_se) end end # B ボタンが押された場合 if Input.trigger?(Input::B) and !$game_player.moving? @targets = nil @revival = nil # キャンセル SE を演奏 $game_system.se_play($data_system.cancel_se) # エリアを解放 dispose_area # カーソル位置を戻す back_cursor # カーソルを固定 $game_player.not_update = true if @back_step2 != nil and @back_step2 # ステップ 2 へ移行 $game_system.tactics_step = 2 if @select != nil case @attacker.current_action.kind when 1 # セレクトウィンドウを作成 make_select_window(1, @attacker, @skill) @select = 2 when 2 # セレクトウィンドウを作成 make_select_window(2, nil, @item) @select = 3 end else @back_step2 = nil # コマンドウィンドウを作成 make_command_window(1) end else # ステップ 5 へ移行 $game_system.tactics_step = 5 if @select != nil case @attacker.current_action.kind when 1 # セレクトウィンドウを作成 make_select_window(1, @attacker, @skill) @select = 1 when 2 # セレクトウィンドウを作成 make_select_window(2, nil, @item) @select = 2 end else # コマンドウィンドウを作成 make_command_window end end end end #-------------------------------------------------------------------------- # ○ エネミー回転 #-------------------------------------------------------------------------- def turn_enemy(position) if position[0].nil? or position[1].nil? return @active_battler.direction end # 座標から向きを変える sx = position[0] - @active_battler.x sy = position[1] - @active_battler.y # 横の距離のほうが長い場合 if sx.abs > sy.abs # 左右方向で指定イベントのいるほうを向く result = sx > 0 ? 6 : 4 # 縦の距離のほうが長い場合 elsif sx.abs < sy.abs # 上下方向で指定イベントのいるほうを向く result = sy > 0 ? 2 : 8 # 同じ場合 else # 右下 if sx > 0 and sy > 0 if @active_battler.direction == 4 or @active_battler.direction == 8 result = 6 else result = @active_battler.direction end # 右上 elsif sx > 0 if @active_battler.direction == 2 or @active_battler.direction == 4 result = 6 else result = @active_battler.direction end # 左下 elsif sy > 0 if @active_battler.direction == 6 or @active_battler.direction == 8 result = 4 else result = @active_battler.direction end # 左上 elsif sx < 0 and sx < 0 if @active_battler.direction == 2 or @active_battler.direction == 6 result = 4 else result = @active_battler.direction end # 中心 else result = @active_battler.direction end end return result end #-------------------------------------------------------------------------- # ● 攻撃エリア検索 #-------------------------------------------------------------------------- def search_attack_area(x = @battler.x, y = @battler.y) position = [[@battler.x, @battler.y]] if $game_system.tactics_actors.keys.include?(@battler.id) battler = $game_system.tactics_actors[@battler.id] else battler = $game_system.tactics_enemies[@battler.id] end case battler.current_action.kind when 0 if battler.current_action.basic != 4 if (defined? ACTOR_RANGE and @attacker.is_a?(Game_Actor)) or (defined? ENEMY_RANGE and @attacker.is_a?(Game_Enemy)) form = battler.attack_range[0][0] max = battler.attack_range[0][1] through = battler.attack_range[0][2] cannot_near = battler.attack_range[0][3] if cannot_near == nil cannot_near = false end else form = 0 max = 1 through = false cannot_near = false end if battler.is_a?(Game_Actor) type = 1 else type = 0 end else form = 0 max = 1 through = true cannot_near = false type = 1 end when 1 skill = $data_skills[battler.current_action.skill_id] form = skill.range[0][0] max = skill.range[0][1] through = skill.range[0][2] cannot_near = skill.range[0][3] if cannot_near == nil cannot_near = false end return position if max == 0 case skill.scope when 0, 5, 6 type = 4 when 1, 2 if battler.is_a?(Game_Actor) type = 1 else type = 0 end when 3, 4 if battler.is_a?(Game_Actor) type = 0 else type = 1 end when 7 return position end when 2 item = $data_items[battler.current_action.item_id] form = item.range[0][0] max = item.range[0][1] through = item.range[0][2] cannot_near = item.range[0][3] if cannot_near == nil cannot_near = false end case item.scope when 0, 5, 6 type = 4 when 1, 2 if battler.is_a?(Game_Actor) type = 1 else type = 0 end when 3, 4 if battler.is_a?(Game_Actor) type = 0 else type = 1 end when 7 return position end end more_step = [0] route = [[]] case form # ひし形の場合 when 0, 2, 3 max *= 2 if form > 0 for i in more_step x = position[i][0] y = position[i][1] # 障害物無視の場合 if through # 下 if !position.include?([x, y + 1]) position.push([x, y + 1]) route.push(route[i] + [2]) if route[i].size + 1 < max more_step.push(route.index(route[i] + [2])) end end # 左 if !position.include?([x - 1, y]) position.push([x - 1, y]) route.push(route[i] + [4]) if route[i].size + 1 < max more_step.push(route.index(route[i] + [4])) end end # 右 if !position.include?([x + 1, y]) position.push([x + 1, y]) route.push(route[i] + [6]) if route[i].size + 1 < max more_step.push(route.index(route[i] + [6])) end end # 上 if !position.include?([x, y - 1]) position.push([x, y - 1]) route.push(route[i] + [8]) if route[i].size + 1 < max more_step.push(route.index(route[i] + [8])) end end # 障害物無視でない場合 else # 下 if !position.include?([x, y + 1]) and !on_area?(x, y, type) and (@battler.passable?(x, y, 2) or (on_area?(x, y + 1, type) and type != 4)) position.push([x, y + 1]) route.push(route[i] + [2]) if route[i].size + 1 < max more_step.push(route.index(route[i] + [2])) end end # 左 if !position.include?([x - 1, y]) and !on_area?(x, y, type) and (@battler.passable?(x, y, 4) or (on_area?(x - 1, y, type) and type != 4)) position.push([x - 1, y]) route.push(route[i] + [4]) if route[i].size + 1 < max more_step.push(route.index(route[i] + [4])) end end # 右 if !position.include?([x + 1, y]) and !on_area?(x, y, type) and (@battler.passable?(x, y, 6) or (on_area?(x + 1, y, type) and type != 4)) position.push([x + 1, y]) route.push(route[i] + [6]) if route[i].size + 1 < max more_step.push(route.index(route[i] + [6])) end end # 上 if !position.include?([x, y - 1]) and !on_area?(x, y, type) and (@battler.passable?(x, y, 8) or (on_area?(x, y - 1, type) and type != 4)) position.push([x, y - 1]) route.push(route[i] + [8]) if route[i].size + 1 < max more_step.push(route.index(route[i] + [8])) end end end case form # 四角形の場合 when 2 delete = [] for pos in position if (pos[0] - @battler.x).abs > max / 2 or (pos[1] - @battler.y).abs > max / 2 delete.push(pos) end end for i in delete position.delete(i) end # 円形の場合 when 3 delete = [] for pos in position if Math.hypot(pos[0] - @battler.x, pos[1] - @battler.y) - 0.5 > max / 2 delete.push(pos) end end for i in delete position.delete(i) end end end # 十字形の場合 when 1 if @dash x = @active_battler.x y = @active_battler.y for d in [2, 4, 6, 8] result = @active_battler.dash_passable?(x, y, d) case result when 1 case d when 2 position.push([x, y + 1]) when 4 position.push([x - 1, y]) when 6 position.push([x + 1, y]) when 8 position.push([x, y - 1]) end when 2 case d when 2 y += 1 when 4 x -= 1 when 6 x += 1 when 8 y -= 1 end redo end end position.shift unless ZTBS.const_defined?("ZTBSB4_DEFINED") return position end for i in 1..max x = position[0][0] y = position[0][1] # 障害物無視の場合 if through position.push([x, y + i]) position.push([x - i, y]) position.push([x + i, y]) position.push([x, y - i]) # 障害物無視でない場合 else if position.include?([x, y + i - 1]) and !on_area?(x, y + i - 1, type) and (@battler.passable?(x, y + i - 1, 2) or on_area?(x, y + i, type)) position.push([x, y + i]) end if position.include?([x - i + 1, y]) and !on_area?(x - i + 1, y, type) and (@battler.passable?(x - i + 1, y, 4) or on_area?(x - i, y, type)) position.push([x - i, y]) end if position.include?([x + i - 1, y]) and !on_area?(x + i - 1, y, type) and (@battler.passable?(x + i - 1, y, 6) or on_area?(x + i, y, type)) position.push([x + i, y]) end if position.include?([x, y - i + 1]) and !on_area?(x, y - i + 1, type) and (@battler.passable?(x, y - i + 1, 8) or on_area?(x, y - i, type)) position.push([x, y - i]) end end end # 斜十字の場合 when 4 for i in 1..max x = position[0][0] y = position[0][1] # 障害物無視の場合 if through position.push([x + i, y + i]) position.push([x - i, y + i]) position.push([x + i, y - i]) position.push([x - i, y - i]) # 障害物無視でない場合 else if position.include?([x + i - 1, y + i - 1]) and !on_area?(x + i - 1, y + i - 1, type) and (@battler.passable?(x + i - 1, y + i - 1, 2) or on_area?(x + i, y + i, type)) position.push([x + i, y + i]) end if position.include?([x - i + 1, y + i - 1]) and !on_area?(x - i + 1, y + i - 1, type) and (@battler.passable?(x - i + 1, y + i - 1, 4) or on_area?(x - i, y + i, type)) position.push([x - i, y + i]) end if position.include?([x + i - 1, y - i + 1]) and !on_area?(x + i - 1, y - i + 1, type) and (@battler.passable?(x + i - 1, y - i + 1, 6) or on_area?(x + i, y - i, type)) position.push([x + i, y]) end if position.include?([x - i + 1, y - i + 1]) and !on_area?(x - i + 1, y - i + 1, type) and (@battler.passable?(x - i + 1, y - i + 1, 8) or on_area?(x - i, y - i, type)) position.push([x, y - i]) end end end end unless ZTBS.const_defined?("ZTBSB4_DEFINED") # 自分を除くかどうか case battler.current_action.kind when 0 position.shift when 1 if [1, 2, 5, 6].include?(skill.scope) position.shift end when 2 if [1, 2, 5, 6].include?(item.scope) position.shift end end end # 近接不可の場合 if cannot_near case form when 0, 1, 3 position.delete([@battler.x, @battler.y + 1]) position.delete([@battler.x - 1, @battler.y]) position.delete([@battler.x + 1, @battler.y]) position.delete([@battler.x, @battler.y - 1]) when 2 position.delete([@battler.x + 1, @battler.y + 1]) position.delete([@battler.x - 1, @battler.y + 1]) position.delete([@battler.x + 1, @battler.y - 1]) position.delete([@battler.x - 1, @battler.y - 1]) position.delete([@battler.x, @battler.y + 1]) position.delete([@battler.x - 1, @battler.y]) position.delete([@battler.x + 1, @battler.y]) position.delete([@battler.x, @battler.y - 1]) end end return position end #-------------------------------------------------------------------------- # ● 対象エリア検索 #-------------------------------------------------------------------------- def search_target_area(x = @battler.x, y = @battler.y, d = 0) position = [[x, y]] d = (d == 0 ? @battler.direction : d) if $game_system.tactics_actors.keys.include?(@battler.id) battler = $game_system.tactics_actors[@battler.id] else battler = $game_system.tactics_enemies[@battler.id] end case battler.current_action.kind when 0 if (defined? ACTOR_RANGE and @attacker.is_a?(Game_Actor)) or (defined? ENEMY_RANGE and @attacker.is_a?(Game_Enemy)) form = battler.attack_range[1][0] max = battler.attack_range[1][1] else max = 0 end if Game_Battler.method_defined?("multy_element_set") set = battler.multy_element_set else set = battler.equip_element_set end return position if max == 0 when 1 skill = $data_skills[battler.current_action.skill_id] form = skill.range[1][0] max = skill.range[1][1] if Game_Battler.method_defined?("skill_element_set") set = battler.skill_element_set(skill) else set = skill.element_set end return position if max == 0 when 2 item = $data_items[battler.current_action.item_id] form = item.range[1][0] max = item.range[1][1] return position if max == 0 end more_step = [0] route = [[]] case form # ひし形の場合 when 0 for i in more_step x = position[i][0] y = position[i][1] # 下 if !position.include?([x, y + 1]) position.push([x, y + 1]) route.push(route[i] + [2]) if route[i].size + 1 < max more_step.push(route.index(route[i] + [2])) end end # 左 if !position.include?([x - 1, y]) position.push([x - 1, y]) route.push(route[i] + [4]) if route[i].size + 1 < max more_step.push(route.index(route[i] + [4])) end end # 右 if !position.include?([x + 1, y]) position.push([x + 1, y]) route.push(route[i] + [6]) if route[i].size + 1 < max more_step.push(route.index(route[i] + [6])) end end # 上 if !position.include?([x, y - 1]) position.push([x, y - 1]) route.push(route[i] + [8]) if route[i].size + 1 < max more_step.push(route.index(route[i] + [8])) end end end # 十字型の場合 when 1 for i in 1..max x = position[0][0] y = position[0][1] position.push([x, y + i]) position.push([x - i, y]) position.push([x + i, y]) position.push([x, y - i]) end # 正面の場合 when 2 x = position[0][0] y = position[0][1] if @dash if $game_player.x == @active_battler.x and $game_player.y == @active_battler.y return position end x = @active_battler.x y = @active_battler.y while @active_battler.dash_passable?(x, y, d) == 2 case d when 2 position.push([x, y + 1]) y += 1 when 4 position.push([x - 1, y]) x -= 1 when 6 position.push([x + 1, y]) x += 1 when 8 position.push([x, y - 1]) y -= 1 end end else for i in 1..max case d when 2 position.push([x, y + i]) when 4 position.push([x - i, y]) when 6 position.push([x + i, y]) when 8 position.push([x, y - i]) end end end # 横型の場合 when 3 x = position[0][0] y = position[0][1] for i in 1..max if d == 4 or d == 6 position.push([x, y + i]) position.push([x, y - i]) elsif d == 2 or d == 8 position.push([x + i, y]) position.push([x - i, y]) end end # 縦型の場合 when 4 x = position[0][0] y = position[0][1] for i in 1..max if d == 2 or d == 8 position.push([x, y + i]) position.push([x, y - i]) elsif d == 4 or d == 6 position.push([x + i, y]) position.push([x - i, y]) end end # 正方形の場合 when 5 x = position[0][0] y = position[0][1] for i in -max..max for j in -max..max position.push([x + i, y + j]) end end # 放射線の場合 when 6 x = position[0][0] y = position[0][1] for i in 1..max case d when 2 for j in -i..i position.push([x + j, y + i]) end when 4 for j in -i..i position.push([x - i, y + j]) end when 6 for j in -i..i position.push([x + i, y + j]) end when 8 for j in -i..i position.push([x + j, y - i]) end end end # 斜十字の場合 when 7 x = position[0][0] y = position[0][1] for i in 1..max position.push([x + i, y + i]) position.push([x - i, y + i]) position.push([x + i, y - i]) position.push([x - i, y - i]) end # 円形の場合 when 8 x = position[0][0] y = position[0][1] for i in -max..max for j in -max..max if Math.hypot(i, j) - 0.5 <= max position.push([x + i, y + j]) end end end # カスタムの場合 when 9 center = max.index2(nil) x = position[0][0] y = position[0][1] if center != nil center_x = center[1] center_y = center[0] else center_x = 0 center_y = 0 end case d when 2 for i in 0...max.size for j in 0...max[i].size position.push([x - j + center_x, y - i + center_y]) if max[i][j] end end when 4 for i in 0...max.size for j in 0...max[i].size position.push([x + i - center_y, y - j + center_x]) if max[i][j] end end when 6 for i in 0...max.size for j in 0...max[i].size position.push([x - i + center_y, y + j - center_x]) if max[i][j] end end when 8 for i in 0...max.size for j in 0...max[i].size position.push([x + j - center_x, y + i - center_y]) if max[i][j] end end end end return position end #-------------------------------------------------------------------------- # ● 攻撃ターゲット判定 (エネミー用) #-------------------------------------------------------------------------- def check_attack_target(position_list) # 対象の種類取得 n = $game_system.tactics_actors.keys type = 0 battlers = [] for i in n battlers.push($game_map.events[i]) end if @attacker.attack_range[1][3] on_target = true else on_target = false end # 対象エリア検索 target_battlers = [[], [], false] for position in position_list d = turn_enemy(position) next_position = 0 for target in battlers if (target.x != position[0] or target.y != position[1]) and on_target next_position += 1 end end if next_position == battlers.size next end target_positions = search_target_area(position[0], position[1], d) battler_count = [] for area in target_positions for target in battlers if target.x == area[0] and target.y == area[1] battler_count.push(target.id) end end # まず、対象が多いところを優先 if battler_count.size > target_battlers[1].size target_battlers[0] = position target_battlers[1] = battler_count target_battlers[2] = on_area?(position[0], position[1], type) # 次に、カーソル位置にバトラーがいるところを優先 elsif battler_count.size == target_battlers[1].size if on_area?(position[0], position[1], type) if target_battlers[2] if rand(2) == 0 target_battlers[0] = position target_battlers[1] = battler_count target_battlers[2] = true end else target_battlers[0] = position target_battlers[1] = battler_count target_battlers[2] = true end end end end end d = turn_enemy(target_battlers[0]) if @active_battler.direction != d @active_battler.turn(d) end return target_battlers end #-------------------------------------------------------------------------- # ● スキルターゲット判定 (エネミー用) #-------------------------------------------------------------------------- def check_skill_target(skill, position_list) # 対象の種類取得 battlers = [] case skill.scope when 1, 2 n = $game_system.tactics_actors.keys type = 0 for i in n battlers.push($game_map.events[i]) end when 3, 4, 7 n = $game_system.tactics_enemies.keys type = 1 for i in n battlers.push($game_map.events[i]) end end if skill.range[1][3] on_target = true else on_target = false end # 対象エリア検索 target_battlers = [[], [], false] for position in position_list next_position = 0 d = turn_enemy(position) for target in battlers if (target.x != position[0] or target.y != position[1]) and on_target next_position += 1 end end if next_position == battlers.size next end target_positions = search_target_area(position[0], position[1], d) battler_count = [] for area in target_positions for target in battlers if target.x == area[0] and target.y == area[1] battler_count.push(target.id) end end # まず、対象が多いところを優先 if battler_count.size > target_battlers[1].size target_battlers[0] = position target_battlers[1] = battler_count target_battlers[2] = on_area?(position[0], position[1], type) # 次に、カーソル位置にバトラーがいるところを優先 elsif battler_count.size == target_battlers[1].size if on_area?(position[0], position[1], type) if target_battlers[2] if rand(2) == 0 target_battlers[0] = position target_battlers[1] = battler_count target_battlers[2] = true end else target_battlers[0] = position target_battlers[1] = battler_count target_battlers[2] = true end end end end end d = turn_enemy(target_battlers[0]) if @active_battler.direction != d @active_battler.turn(d) end return target_battlers end #-------------------------------------------------------------------------- # ● 攻撃エリアセット #-------------------------------------------------------------------------- def set_attack_area(type, invisible = false) dispose_area position = search_attack_area for i in 0...position.size x = position[i][0] y = position[i][1] sprite = Sprite_Area.new(@spriteset.viewport1, type, x, y, invisible) @spriteset.area_sprites.push(sprite) end position = search_target_area($game_player.x, $game_player.y) for i in 0...position.size x = position[i][0] y = position[i][1] sprite = Sprite_Range.new(@spriteset.viewport1, type, x, y, invisible) @spriteset.range_sprites.push(sprite) end end end