#============================================================================== # ■ RGSS3 アイテム使用効果をまとめる Ver1.00 by 星潟 #------------------------------------------------------------------------------ # 通常、HPを200%回復させたり15000回復させる等の処理を行う際 # HP100%を2つ入力したり、HP7500を2つ入力したりしますが # 内容次第では、片方に薬の効果が適用されない場合があったり # 特定スクリプトと併用時に表示が冗長になる場合があります。 # このスクリプト導入時、HP回復・MP回復・TP回復・成長の4つの効果を # それぞれ1アイテムにつき1効果にまとめます。 #============================================================================== class RPG::UsableItem < RPG::BaseItem alias effects_hmtp_grow_collect effects unless $! def effects unless @effects_collected_flag a = [] h = { :hpr => 0, :hpv => 0, :mpr => 0, :mpv => 0, :tpv => 0, :plus => [0] * 8} f = {:plus => [nil] * 8} @effects.each {|e| case e.code when 11 h[:hpr] += (e.value1 * 100).to_i if e.value1 != 0 h[:hpv] += e.value2 if e.value2 != 0 f[:hp] = 1 when 12 h[:mpr] += (e.value1 * 100).to_i if e.value1 != 0 h[:mpv] += e.value2 if e.value2 != 0 f[:mp] = 1 when 13 h[:tpv] += e.value1 if e.value1 != 0 f[:tp] = 1 when 42 h[:plus][e.data_id] += e.value1 f[:plus][e.data_id] = 1 end } @effects.each {|e| case e.code when 11 unless f[:hp] > 1 e.value1 = h[:hpr].to_f / 100 e.value2 = h[:hpv] f[:hp] = 2 a.push(e) end when 12 unless f[:mp] > 1 e.value1 = h[:mpr].to_f / 100 e.value2 = h[:mpv] f[:mp] = 2 a.push(e) end when 13 unless f[:tp] > 1 e.value1 = h[:tpv] f[:tp] = 2 a.push(e) end when 42 unless f[:plus][e.data_id] > 1 e.value1 = h[:plus][e.data_id] f[:plus][e.data_id] = 2 a.push(e) end else a.push(e) end } @effects = a @effects_collected_flag = true end effects_hmtp_grow_collect end end