battle-maiden-mizuki/Scripts/_.6.rb
2025-06-17 11:57:06 -05:00

154 lines
No EOL
6.6 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.

#==============================================================================
# ☆ ポケモン風猛毒・麻痺ステート by白雪レイカ
#------------------------------------------------------------------------------
# ターン経過でスリップダメージの増加する毒ステート、および
# 一定確率でそのターンの行動入力が無効になる麻痺ステートを製作できます。
#------------------------------------------------------------------------------
#
# ◆使い方
# ステートのメモ欄に"<猛毒ステート>","<特殊麻痺ステート>と記述
# →前者:ターン経過ごとにスリップダメージが (設定項目のレート)倍 されます。
# HPダメージにのみ適用されます。回復には適用されません。
# ターン経過による解除を"なし"にすると正常に動作しません。
# 100でも9999でもいいので何らかの数字を入れておいてください。
# 後者: (設定項目のレート)% の確率で行動できなくなります。
# 特殊麻痺ステートの行動制約は"なし"に設定してください。
# ポケモンのように最後行動にしたい場合は 特徴 > 敏捷性 * 0%
# などのようにしてください。
#
# ◆おことわり
# 改造・再配布等自由です。
# 再配布の際は作者の明示をお願いします。
# そこそこ再定義項目が多いので、素材の上のほうに入れてください。
# このスクリプト単体でのバグを発見した際は、速やかにご報告ください。
# なお、猛毒ステートにかかっていると他のスリップダメージの効果も
# 増幅されてしまうのは仕様とさせていただきます。
#
#==============================================================================
# ■ 設定項目
#==============================================================================
module WhiteSnow
VENOM_DAMAGE_RATE = 1.2 # 猛毒ステートのダメージ増加率
EX_PARALYZE_RATE = 50 # 特殊麻痺ステートの行動封じ率
EX_PARALYZE_MESSAGE = "%sは身体が痺れて動けない" # 特殊麻痺発動時のメッセージ
end
class Game_BattlerBase
#--------------------------------------------------------------------------
# ● ステート情報をクリア
#--------------------------------------------------------------------------
alias venom_clear_states clear_states
def clear_states
venom_clear_states
@venom_state_count = 0
end
#--------------------------------------------------------------------------
# ● 特殊麻痺の調査
#--------------------------------------------------------------------------
def ex_paralyze?
flag = false
unless self.states == []
self.states.each do |state|
flag = true if state.note.include?("<特殊麻痺ステート>")
flag = false if state.restriction == 4
break if state.restriction == 4
end
end
return flag
end
end
class Game_Battler
attr_accessor :venom_state_count
#--------------------------------------------------------------------------
# ● ステートのターンカウント更新 (再定義)
#--------------------------------------------------------------------------
def update_state_turns
@venom_state_count ||= 0
states.each do |state|
@state_turns[state.id] -= 1 if @state_turns[state.id] > 0
if state.note.include?("<猛毒ステート>")
@venom_state_count += 1
end
end
end
#--------------------------------------------------------------------------
# ● HP の再生 (再定義)
#--------------------------------------------------------------------------
def regenerate_hp
@venom_state_count ||= 0
damage = -(mhp * hrg * (WhiteSnow::VENOM_DAMAGE_RATE ** @venom_state_count)).to_i
if damage < 0
damage = -(mhp * hrg).to_i
end
perform_map_damage_effect if $game_party.in_battle && damage > 0
@result.hp_damage = [damage, max_slip_damage].min
self.hp -= @result.hp_damage
end
#--------------------------------------------------------------------------
# ● ステートの解除 (再定義)
#--------------------------------------------------------------------------
def remove_state(state_id)
if state?(state_id)
revive if state_id == death_state_id
@venom_state_count = 0 if $data_states[state_id].note.include?("<猛毒ステート>")
erase_state(state_id)
refresh
@result.removed_states.push(state_id).uniq!
end
end
#--------------------------------------------------------------------------
# ● ターン終了処理
#--------------------------------------------------------------------------
alias ex_paralyze_on_turn_end on_turn_end
def on_turn_end
ex_paralyze_on_turn_end
self.states.each do |state|
state.restriction = 0 if state.note.include?("<特殊麻痺ステート>")
end
end
end
class Game_Action
#--------------------------------------------------------------------------
# ● 特殊麻痺を設定
#--------------------------------------------------------------------------
def set_ex_paralyze
subject.states.each do |state|
state.restriction = 4 if state.note.include?("<特殊麻痺ステート>")
end
end
#--------------------------------------------------------------------------
# ● 行動準備
#--------------------------------------------------------------------------
alias ex_paralyze_prepare prepare
def prepare
ex_paralyze_prepare
set_ex_paralyze if subject.ex_paralyze? and rand(99) + 1 < WhiteSnow::EX_PARALYZE_RATE
end
end
class Window_BattleLog
#--------------------------------------------------------------------------
# ● 特殊麻痺の表示
#--------------------------------------------------------------------------
def display_ex_paralyze(target)
target.states.each do |state|
if state.restriction == 4
add_text(sprintf(WhiteSnow::EX_PARALYZE_MESSAGE, target.name)) if state.note.include?("<特殊麻痺ステート>")
wait
end
end
end
end
class Scene_Battle
#--------------------------------------------------------------------------
# ● 戦闘行動の処理
#--------------------------------------------------------------------------
alias ex_paralyze_process_action process_action
def process_action
ex_paralyze_process_action
@log_window.display_ex_paralyze(@subject) unless @subject.nil?
end
end