bad-end-collector/Scripts/_.26.rb
2024-05-18 13:05:37 -05:00

101 lines
3.7 KiB
Ruby
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#------------------------------------------------------------------------------
# 通常攻撃 効果範囲設定
# バージョン1.0
# RGSS3 (RPGツクールVX ACE)
# 作成者project j
# 配布元http://jsgamesfactory.web.fc2.com/
#
# 使い方:武器(他装備含む)のメモ欄に <効果範囲 数値> を記述
# 例: <効果範囲 2> → 全体攻撃
# ※ 効果範囲の数値
# 0 : なし
# 1 : 敵単体
# 2 : 敵全体
# 3 : 敵 1 体 ランダム
# 4 : 敵 2 体 ランダム
# 5 : 敵 3 体 ランダム
# 6 : 敵 4 体 ランダム
# 7 : 味方単体
# 8 : 味方全体
# 9 : 味方単体 (戦闘不能)
# 10 : 味方全体 (戦闘不能)
# 11 : 使用者
#
#------------------------------------------------------------------------------
#==============================================================================
# ■ Game_Action
#------------------------------------------------------------------------------
#  戦闘行動を扱うクラスです。このクラスは Game_Battler クラスの内部で使用され
# ます。
#==============================================================================
class Game_Action
#--------------------------------------------------------------------------
# ● ターゲットの配列作成
#--------------------------------------------------------------------------
alias :jsscript_attack_scope_make_targets :make_targets
def make_targets
scope_bak = item.scope
item.scope = set_attack_scope if subject.actor? and self.attack?
targets = jsscript_attack_scope_make_targets
item.scope = scope_bak if subject.actor? and self.attack?
return targets
end
#--------------------------------------------------------------------------
# ○ 通常攻撃の効果範囲を設定
#--------------------------------------------------------------------------
def set_attack_scope
for equip in subject.equips.compact
equip.note.dup.gsub!(/<(?:効果範囲)[ ]*(\d+)>/i){ return $1.to_i }
end
return item.scope
end
#--------------------------------------------------------------------------
# ○ 対象選択の有無
#--------------------------------------------------------------------------
def attack_need_selection
return [1, 7, 9].include?(set_attack_scope)
end
#--------------------------------------------------------------------------
# ○ 対象選択の有無(味方)
#--------------------------------------------------------------------------
def attack_need_selection_actor?
return [7, 9].include?(set_attack_scope)
end
end
#==============================================================================
# ■ Scene_Battle
#------------------------------------------------------------------------------
#  バトル画面の処理を行うクラスです。
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# ● 敵キャラ選択の開始
#--------------------------------------------------------------------------
alias :jsscript_attack_scope_select_enemy_selection :select_enemy_selection
def select_enemy_selection
action = BattleManager.actor.input
if action.attack?
# 対象選択不要
if !action.attack_need_selection
next_command
return
end
# 味方から選択
if action.attack_need_selection_actor?
select_actor_selection
return
end
end
# 敵から選択
jsscript_attack_scope_select_enemy_selection
end
end