=begin RGSS3 ★ 衝撃回数解除ステート ★ 指定回数ダメージを受けた際に解除されるステートを作ることができます。 ● 仕様 ●========================================================== 衝撃カウントは1以上のダメージを与えた時に限り変動します。 -------------------------------------------------------------------- 解除確率はいまのところ一律100%となります。 ==================================================================== ● 使い方 ●======================================================== データベースのステートのメモ欄に 「衝撃回数解除:n」という文字列を含ませて下さい。nには整数値を。 ==================================================================== ver1.00 Last Update : 2011/12/17 12/17 : RGSS2からの移植 ろかん   http://kaisou-ryouiki.sakura.ne.jp/ =end $rsi ||= {} $rsi["衝撃回数解除ステート"] = true class RPG::State < RPG::BaseItem def get_remove_shockcount self.note.each_line{|line| return $1.to_i if line =~ /衝撃回数解除:(\d+)/i } 0 end end class Game_BattlerBase #-------------------------------------------------------------------------- # ● ステート情報をクリア #-------------------------------------------------------------------------- alias remove_shockcount_state_clear clear_states def clear_states remove_shockcount_state_clear @shockcount_states = {} end end class Game_Battler #-------------------------------------------------------------------------- # ● 新しいステートの付加 #-------------------------------------------------------------------------- alias add_shockcount_state add_new_state def add_new_state(state_id) add_shockcount_state(state_id) set_count_state(state_id) end #-------------------------------------------------------------------------- # ● ステートの解除 #-------------------------------------------------------------------------- alias remove_shockcount_state remove_state def remove_state(state_id) remove_shockcount_state(state_id) out_count_state(state_id) end #-------------------------------------------------------------------------- # ● 新しく付加されたステートに解除衝撃回数がある場合、専用ハッシュに加える #-------------------------------------------------------------------------- def set_count_state(state_id) shock_count = $data_states[state_id].get_remove_shockcount @shockcount_states[state_id] = shock_count unless shock_count.zero? end #-------------------------------------------------------------------------- # ● 解除されたステートが専用ハッシュに存在する場合に削除 #-------------------------------------------------------------------------- def out_count_state(state_id) @shockcount_states.delete(state_id) if @shockcount_states.include?(state_id) end #-------------------------------------------------------------------------- # ● ダメージによるステート解除 #-------------------------------------------------------------------------- alias shockcount_state_remove_states_by_damage remove_states_by_damage def remove_states_by_damage shockcount_state_remove_states_by_damage @shockcount_states.each_key{|key| @shockcount_states[key] -= 1 if @shockcount_states[key].zero? remove_state(key) @result.removed_states << key end } end end