#==============================================================================
#[仿大话梦幻]多体攻击(俗称秒2~秒7,非全体攻击)Ver0.01b
#
#by SixRice = 66fan
#RTAB适应性改造 by MogStar
#==============================================================================
module SXR
#==============================================================================
#属性名称(同时存在的话,取最大值)
#==============================================================================
ADD_TARGET2 = "秒2"
ADD_TARGET3 = "秒3"
ADD_TARGET4 = "秒4"
ADD_TARGET5 = "秒5"
ADD_TARGET6 = "秒6"
ADD_TARGET7 = "秒7"
#-------------------
ADD_TARGET8 = "秒8"
#-------------------
end
#==============================================================================
# ■ Game_BattleAction
#==============================================================================
class Game_BattleAction
attr_accessor :add_target
#------------------------------------------------------------------------------
# ○ clear
#------------------------------------------------------------------------------
alias sxr_clear clear
def clear
sxr_clear
clear_sxr_add_target
end
#------------------------------------------------------------------------------
# ○ 特殊效果clear
#------------------------------------------------------------------------------
def clear_sxr_add_target
self.add_target = 0
end
#------------------------------------------------------------------------------
# ○ 无效化特殊效果
#------------------------------------------------------------------------------
def nillize_sxr_add_target
self.add_target = nil
end
end
#==============================================================================
# ■ Game_Battler
#==============================================================================
class Game_Battler
#------------------------------------------------------------------------------
# ○追加目标范围设定
#------------------------------------------------------------------------------
def set_sxr_add_target(set)
# 追加目标范围强制值
self.current_action.add_target =
#-------------------------------------------------
XRXS.element_include?(set, SXR::ADD_TARGET8) ? 8 :
#-------------------------------------------------
XRXS.element_include?(set, SXR::ADD_TARGET7) ? 7 :
XRXS.element_include?(set, SXR::ADD_TARGET6) ? 6 :
XRXS.element_include?(set, SXR::ADD_TARGET5) ? 5 :
XRXS.element_include?(set, SXR::ADD_TARGET4) ? 4 :
XRXS.element_include?(set, SXR::ADD_TARGET3) ? 3 :
XRXS.element_include?(set, SXR::ADD_TARGET2) ? 2 :
0
end
end
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
alias sxr_main main
def main
# recall
sxr_main
# 清空角色的特殊效果设置
for actor in $game_party.actors
actor.current_action.clear_sxr_add_target
actor.current_action.nillize_sxr_add_target
end
end
def set_target_battlers(scope, battler)
target_battlers = []
battler.set_sxr_add_target(battler.skill_element_set(@skill))
battler.target = []
#====================================================================
#修改的部分总而言之就是加入了一大堆敌我方判断……(只保留了单体)
#====================================================================
#行动方战斗者是敌方的情况
if battler.is_a?(Game_Enemy)
# 效果范围的分歧
case scope
when 1 # 敌单体
battler.target.push(battler) if battler.current_action.self_inclusion
index = battler.current_action.target_index
if battler.current_action.side == 0
main_target = $game_party.actors[index]
for actor in $game_party.actors
if actor.exist? and actor != main_target
target_battlers.push(actor)
end
end
elsif battler.current_action.side == 1
main_target = $game_troop.enemies[index]
for enemy in $game_troop.enemies
if enemy.exist? and enemy != main_target
target_battlers.push(enemy)
end
end
end
battler.target = target_battlers[0, 1] if battler.current_action.add_target == 2
battler.target = target_battlers[0, 2] if battler.current_action.add_target == 3
battler.target = target_battlers[0, 3] if battler.current_action.add_target == 4
battler.target = target_battlers[0, 4] if battler.current_action.add_target == 5
battler.target = target_battlers[0, 5] if battler.current_action.add_target == 6
battler.target = target_battlers[0, 6] if battler.current_action.add_target == 7
battler.target = target_battlers[0, 7] if battler.current_action.add_target == 8
battler.target.push(main_target)
#=============================================================================
when 2 # 敌全体
battler.target.push(battler) if battler.current_action.self_inclusion
for actor in $game_party.actors
if actor.exist?
battler.target.push(actor)
end
end
when 3 # 己方单体
index = battler.current_action.target_index
if battler.current_action.side == 0
main_target = $game_party.actors[index]
for actor in $game_party.actors
if actor.exist? and actor != main_target
target_battlers.push(actor)
end
end
elsif battler.current_action.side == 1
main_target = $game_troop.enemies[index]
for enemy in $game_troop.enemies
if enemy.exist? and enemy != main_target
target_battlers.push(enemy)
end
end
end
battler.target = target_battlers[0, 1] if battler.current_action.add_target == 2
battler.target = target_battlers[0, 2] if battler.current_action.add_target == 3
battler.target = target_battlers[0, 3] if battler.current_action.add_target == 4
battler.target = target_battlers[0, 4] if battler.current_action.add_target == 5
battler.target = target_battlers[0, 5] if battler.current_action.add_target == 6
battler.target = target_battlers[0, 6] if battler.current_action.add_target == 7
battler.target = target_battlers[0, 7] if battler.current_action.add_target == 8
battler.target.push(main_target)
#=============================================================================
when 4 # 己方全体
for enemy in $game_troop.enemies
if enemy.exist?
battler.target.push(enemy)
end
end
battler.target -=[battler] if battler.current_action.self_exclusion
when 5 # 己方单体 (HP 0)
index = battler.current_action.target_index
enemy = $game_troop.enemies[index]
actor = $game_party.actors[index]
if battler.current_action.side == 0
battler.target.push(actor) if actor != nil
elsif battler.current_action.side == 1
battler.target.push(enemy) if enemy != nil
end
when 6 # 己方全体 (HP 0)
for enemy in $game_troop.enemies
if enemy != nil# and enemy.hp0?# 复活类特技/道具对生存者有效
battler.target.push(enemy)
end
end
battler.target -=[battler] if battler.current_action.self_exclusion
when 7 # 使用者
battler.target.push(battler)
when 8 # 全域化
for enemy in $game_troop.enemies
if enemy.exist?
battler.target.push(enemy)
end
end
for actor in $game_party.actors
if actor.exist?
battler.target.push(actor)
end
end
battler.target -=[battler] if battler.current_action.self_exclusion
when 9 # 敌方随机
battler.target.push(battler) if battler.current_action.self_inclusion
for actor in $game_party.actors
if actor.exist?
battler.target = [$game_party.random_target_actor]
end
end
when 10 # 己方随机
for enemy in $game_troop.enemies
if enemy.exist?
battler.target.push(enemy)
end
end
battler.target -=[battler] if battler.current_action.self_exclusion
battler.target = [battler.target[rand(battler.target.size)]]
when 11 #对象随机
battler.target = []
for enemy in $game_troop.enemies
if enemy.exist?
battler.target.push(enemy)
end
end
for actor in $game_party.actors
if actor.exist?
battler.target.push(actor)
end
end
battler.target -=[battler] if battler.current_action.self_exclusion
battler.target = [battler.target[rand(battler.target.size)]]
end
end
#行动方战斗者是己方的情况
if battler.is_a?(Game_Actor)
# 效果范围的分歧
case scope
when 1 # 敌单体
index = battler.current_action.target_index
if battler.current_action.side == 0
main_target = $game_party.actors[index]
for actor in $game_party.actors
if actor.exist? and actor != main_target
target_battlers.push(actor)
end
end
elsif battler.current_action.side == 1
main_target = $game_troop.enemies[index]
for enemy in $game_troop.enemies
if enemy.exist? and enemy != main_target
target_battlers.push(enemy)
end
end
end
battler.target = target_battlers[0, 1] if battler.current_action.add_target == 2
battler.target = target_battlers[0, 2] if battler.current_action.add_target == 3
battler.target = target_battlers[0, 3] if battler.current_action.add_target == 4
battler.target = target_battlers[0, 4] if battler.current_action.add_target == 5
battler.target = target_battlers[0, 5] if battler.current_action.add_target == 6
battler.target = target_battlers[0, 6] if battler.current_action.add_target == 7
battler.target = target_battlers[0, 7] if battler.current_action.add_target == 8
battler.target.push(main_target)
#=============================================================================
battler.target.push(battler) if battler.current_action.self_inclusion
when 2 # 敌全体
for enemy in $game_troop.enemies
if enemy.exist?
battler.target.push(enemy)
end
end
battler.target.push(battler) if battler.current_action.self_inclusion
when 3 # 己方单体
index = battler.current_action.target_index
if battler.current_action.side == 0
main_target = $game_party.actors[index]
for actor in $game_party.actors
if actor.exist? and actor != main_target
target_battlers.push(actor)
end
end
elsif battler.current_action.side == 1
main_target = $game_troop.enemies[index]
for enemy in $game_troop.enemies
if enemy.exist? and enemy != main_target
target_battlers.push(enemy)
end
end
end
battler.target = target_battlers[0, 1] if battler.current_action.add_target == 2
battler.target = target_battlers[0, 2] if battler.current_action.add_target == 3
battler.target = target_battlers[0, 3] if battler.current_action.add_target == 4
battler.target = target_battlers[0, 4] if battler.current_action.add_target == 5
battler.target = target_battlers[0, 5] if battler.current_action.add_target == 6
battler.target = target_battlers[0, 6] if battler.current_action.add_target == 7
battler.target = target_battlers[0, 7] if battler.current_action.add_target == 8
battler.target.push(main_target)
#=============================================================================
when 4 # 己方全体
for actor in $game_party.actors
if actor.exist?
battler.target.push(actor)
end
end
battler.target -=[battler] if battler.current_action.self_exclusion
when 5 # 己方单体 (HP 0)
index = battler.current_action.target_index
enemy = $game_troop.enemies[index]
actor = $game_party.actors[index]
if battler.current_action.side == 0
battler.target.push(actor) if actor != nil
elsif battler.current_action.side == 1
battler.target.push(enemy) if enemy != nil
end
when 6 # 己方全体 (HP 0)
for actor in $game_party.actors
if actor != nil# and actor.hp0?# 复活类特技/道具对生存者有效
battler.target.push(actor)
end
end
battler.target -=[battler] if battler.current_action.self_exclusion
when 7 # 使用者
battler.target.push(battler)
when 8 # 全域化
for enemy in $game_troop.enemies
if enemy.exist?
battler.target.push(enemy)
end
end
for actor in $game_party.actors
if actor.exist?
battler.target.push(actor)
end
end
battler.target -=[battler] if battler.current_action.self_exclusion
when 9 # 敌方随机
for enemy in $game_troop.enemies
if enemy.exist?
battler.target = [$game_troop.random_target_enemy]
end
end
battler.target.push(battler) if battler.current_action.self_inclusion
when 10 # 己方随机
for actor in $game_party.actors
if actor.exist?
battler.target.push(actor)
end
end
battler.target -=[battler] if battler.current_action.self_exclusion
battler.target = [battler.target[rand(battler.target.size)]]
when 11 #对象随机
battler.target = []
for enemy in $game_troop.enemies
if enemy.exist?
battler.target.push(enemy)
end
end
for actor in $game_party.actors
if actor.exist?
battler.target.push(actor)
end
end
battler.target -=[battler] if battler.current_action.self_exclusion
battler.target = [battler.target[rand(battler.target.size)]]
end
end
battler.target.compact!
end
end
代码复制
系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~
提问8次,8次没有结果RPG XP 制作进度地图:■■□□□□□□□□ 20%剧情:■□□□□□□□□□ 10%任务:□□□□□□□□□□ 0%动画:■■■■■■□□□□ 60%系统:■■■■■■■■□□ 80%