king-exit/Scripts/_.73.rb
2024-08-31 14:17:23 -05:00

252 lines
10 KiB
Ruby
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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.

#==============================================================================
# ★ RGSS3_スコープ拡張 Ver1.11
#==============================================================================
=begin
作者tomoaky
webサイトひきも記は閉鎖しました。 (http://hikimoki.sakura.ne.jp/)
通常攻撃の効果範囲にランダム化、全体化などを追加します、
アクター、職業、武器、防具のメモ欄に以下のタグを書き込んでください。
<通常攻撃全体化>
通常攻撃の効果範囲が敵全体になります
<通常攻撃ランダム化>
通常攻撃の効果範囲が敵 1 体ランダムになります
ただし、攻撃追加回数が設定されている場合は、ランダムなターゲットへ
追加攻撃が発生します。
以下はスキル(アイテム)のメモ欄に書き込むことで設定できます。
 <敵味方全体>
スキル(アイテム)の効果範囲を『敵味方全体』にする
<使用者除外>
スキル(アイテム)の効果範囲から使用者を除外する
<身代わり可能>
<身代わり不可>
スキル(アイテム)の身代わり判定を命中タイプを無視して強制的に変更する
<反撃可能>
<反撃不可>
スキル(アイテム)の反撃判定を命中タイプを無視して強制的に変更する
<魔法反射可能>
<魔法反射不可>
スキル(アイテム)の魔法反射判定を命中タイプを無視して強制的に変更する
2015/09/20 Ver1.11
通常攻撃全体化のキャラクターが混乱時にエラー落ちする不具合を修正
2013/07/30 Ver1.1
身代わり、反撃、魔法反射の判定方法をスキルごとに指定する機能を追加
2012/01/11 Ver1.01
混乱時にエラー落ちする不具合を修正
2011/12/19 Ver1.0
公開
=end
#==============================================================================
# □ 設定項目
#==============================================================================
module TMSCOPEEX
# 全体化に攻撃追加回数の設定を適用するかどうか、false にすれば
# 全体化攻撃はすべての敵に1回だけダメージを与えるようになります。
# 『攻撃追加回数8の武器』と『通常攻撃全体化の装飾品』などを
# 組み合わせられるとまずい場合は false にしてください。
APPLY_ALL_REPEATS = true
# 混乱時にも全体化を適用するかどうか、false なら混乱時は単体攻撃になります
APPLY_ALL_CONFUSION = true
end
#==============================================================================
# ■ RPG::UsableItem
#==============================================================================
class RPG::UsableItem
#--------------------------------------------------------------------------
# ● 対象の選択操作が必要か否かを判定する
#--------------------------------------------------------------------------
alias tmscopeex_usable_item_need_selection? need_selection?
def need_selection?
tmscopeex_usable_item_need_selection? && !for_field?
end
#--------------------------------------------------------------------------
# ○ 敵味方全体スキルかどうかを返す
#--------------------------------------------------------------------------
def for_field?
/<敵味方全体>/ =~ @note
end
#--------------------------------------------------------------------------
# ○ 使用者除外スキルかどうかを返す
#--------------------------------------------------------------------------
def for_not_user?
/<使用者除外>/ =~ @note
end
end
#==============================================================================
# ■ Game_Action
#==============================================================================
class Game_Action
#--------------------------------------------------------------------------
# ● ターゲットの配列作成
#--------------------------------------------------------------------------
alias tmscopeex_game_action_make_targets make_targets
def make_targets
if !forcing && subject.confusion?
targets = confusion_target
if targets.is_a?(Array)
targets
else
[targets]
end
else
tmscopeex_game_action_make_targets
end
end
#--------------------------------------------------------------------------
# ● 混乱時のターゲット
#--------------------------------------------------------------------------
alias tmscopeex_game_action_confusion_target confusion_target
def confusion_target
if subject.actor? && attack? &&
TMSCOPEEX::APPLY_ALL_CONFUSION && subject.attack_for_all?
case subject.confusion_level
when 1
opponents_unit.alive_members
when 2
if rand(2) == 0
opponents_unit.alive_members
else
friends_unit.alive_members
end
else
friends_unit.alive_members
end
else
tmscopeex_game_action_confusion_target
end
end
#--------------------------------------------------------------------------
# ● 敵に対するターゲット
#--------------------------------------------------------------------------
alias tmscopeex_game_action_targets_for_opponents targets_for_opponents
def targets_for_opponents
if item.for_field? # 敵味方全体
opponents_unit.alive_members + friends_unit.alive_members -
(item.for_not_user? ? [subject] : [])
elsif subject.actor? && attack?
if subject.attack_for_all? # 全体化
num = 1
num += subject.atk_times_add.to_i if TMSCOPEEX::APPLY_ALL_REPEATS
opponents_unit.alive_members * num
elsif subject.attack_for_random? # ランダム化
Array.new(1 + subject.atk_times_add.to_i) { opponents_unit.random_target }
else
num = 1 + subject.atk_times_add.to_i
if @target_index < 0
[opponents_unit.random_target] * num
else
[opponents_unit.smooth_target(@target_index)] * num
end
end
else
tmscopeex_game_action_targets_for_opponents
end
end
#--------------------------------------------------------------------------
# ● 味方に対するターゲット
#--------------------------------------------------------------------------
alias tmscopeex_game_action_targets_for_friends targets_for_friends
def targets_for_friends
tmscopeex_game_action_targets_for_friends -
(item.for_not_user? ? [subject] : [])
end
end
#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor
#--------------------------------------------------------------------------
# ● スキル/アイテムの反撃率計算
#--------------------------------------------------------------------------
alias tmscopeex_game_battler_item_cnt item_cnt
def item_cnt(user, item)
return 0.0 unless opposite?(user) # 味方には反撃しない
return 0.0 if /<反撃不可>/ =~ item.note
return cnt if /<反撃可能>/ =~ item.note
return tmscopeex_game_battler_item_cnt(user, item)
end
#--------------------------------------------------------------------------
# ● スキル/アイテムの反射率計算
#--------------------------------------------------------------------------
alias tmscopeex_game_battler_item_mrf item_mrf
def item_mrf(user, item)
return 0.0 if /<魔法反射不可>/ =~ item.note
return mrf if /<魔法反射可能>/ =~ item.note
return tmscopeex_game_battler_item_mrf(user, item)
end
end
#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor
#--------------------------------------------------------------------------
# ○ 通常攻撃が全体化されているかを返す
#--------------------------------------------------------------------------
def attack_for_all?
text = self.actor.note + self.class.note
equips.compact.each {|item| text += item.note }
states.each {|state| text += state.note }
/<通常攻撃\s*全体化>/ =~ text
end
#--------------------------------------------------------------------------
# ○ 通常攻撃がランダム化されているかを返す
#--------------------------------------------------------------------------
def attack_for_random?
text = self.actor.note + self.class.note
equips.compact.each {|item| text += item.note }
states.each {|state| text += state.note }
/<通常攻撃\s*ランダム化>/ =~ text
end
#--------------------------------------------------------------------------
# ○ 通常攻撃のターゲット選択が必要かどうかを返す
#--------------------------------------------------------------------------
def need_attack_selection?
(!attack_for_all? && !attack_for_random?)
end
end
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ● コマンド[攻撃] 【再定義】
#--------------------------------------------------------------------------
def command_attack
BattleManager.actor.input.set_attack
if BattleManager.actor.need_attack_selection?
select_enemy_selection
else
next_command
end
end
#--------------------------------------------------------------------------
# ● 身代わり条件チェック
#--------------------------------------------------------------------------
alias tmscopeex_scene_battle_check_substitute check_substitute
def check_substitute(target, item)
return false if /<身代わり不可>/ =~ item.note
return (target.hp < target.mhp) / 4 if /<身代わり可能>/ =~ item.note
tmscopeex_scene_battle_check_substitute(target, item)
end
end