#============================================================================== # [ZTBS] -Zenith Tactical Battle System- タクティカルバトルシステム #  〜+2:エネミー通常攻撃範囲設定〜   by 水夜 #  ver1.10  Zenith Creation (http://zenith.ifdef.jp/) #------------------------------------------------------------------------------ # マップ上での戦略的なバトルを実現。 #============================================================================== ENEMY_RANGE = true class Game_Enemy < Game_Battler def attack_range case self.id #============================================================================== # ↓↓設定箇所は説明の下にあります↓↓ #============================================================================== #------------------------------------------------------------------------------ # when エネミーID # 範囲 = [形状, 距離, 障害物無視, 近接不可] # 効果範囲 = [形状, 距離, アニメ全員分表示, カーソル位置の対象の存在を問う] #------------------------------------------------------------------------------ # # ※単体対象にしたい場合、効果範囲の設定は必要ありません。 # # ※「形状」 # 0 : ひし形(移動と同じ形) # 1 : 十字形 # 2 : 四角形 # 3 : ドーナツ型四角形 # # ※「障害物無視」 # true : 障害物を乗り越えて範囲を設定する。 # false : 障害物がある場合、その先には範囲が設定されない。 # # ※「近接不可」 # true : 行動者の上下左右 1 マスを範囲から除外する。 # false : 通常通り。 # # ※「アニメ全員分表示」 # true : ターゲットが複数の場合、全員に対してアニメーションを表示。 # false : ターゲットが複数の場合、カーソルに1番近いターゲットに # 代表してアニメーションを1つだけ表示。 # # ※「カーソル位置の対象の存在を問う」 # true : カーソル位置に対象が存在しない場合、効果範囲内に対象がいても # 攻撃できない。 # false : カーソル位置に対象が存在しない場合でも、 # 効果範囲内に対象がいれば攻撃できる。 # #============================================================================== # ここより下が設定箇所です #============================================================================== when 1 # ゴースト 範囲 = [1, 2, false, false] # 十字形 2 #============================================================================== # ここより上で設定してください #============================================================================== end 範囲 = [0, 1, false, false] if 範囲 == nil 効果範囲 = [0, 0, true, true] if 効果範囲 == nil return [範囲, 効果範囲] end end class Scene_Map #-------------------------------------------------------------------------- # ● 攻撃ターゲット判定 (エネミー用) #-------------------------------------------------------------------------- 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 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]) 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 return target_battlers end end