ayame-of-the-night-shadow/Scripts/_MPTP_.rb
2025-04-13 13:17:39 -05:00

171 lines
No EOL
6.7 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 被弾時MP・TP増減特徴Ver2.00 by 星潟
#------------------------------------------------------------------------------
# HPダメージを1以上受けた際に下記の形式でMP・TPを増減させる特徴を作成します。
#
# 1.固定値での増減
# 2.最大MP・TPに対しての割合での増減
# 3.現在MP・TPに対しての割合での増減
# 4.ダメージに対しての割合での増減
#==============================================================================
# 特徴のメモ欄に記述。
#------------------------------------------------------------------------------
# <被弾時MP固定増減:50,50>
#
# 50の確率でMPが50回復します。
#------------------------------------------------------------------------------
# <被弾時MP固定増減:-30>
#
# MPが30減少します。
#------------------------------------------------------------------------------
# <被弾時最大MP割合増減:40>
#
# MPが最大MPの40分回復します。
#------------------------------------------------------------------------------
# <被弾時最大MP割合増減:-20,25>
#
# 25の確率でMPが最大MPの20分減少します。
#------------------------------------------------------------------------------
# <被弾時現在MP割合増減:70,10>
#
# 10の確率でMPが現在MPの70分回復します。
#------------------------------------------------------------------------------
# <被弾時現在MP割合増減:-80>
#
# MPが現在MPの80分減少します。
#------------------------------------------------------------------------------
# <被ダメージMP割合増減:10>
#
# MPが被ダメージの10分回復します。
#------------------------------------------------------------------------------
# <被ダメージMP割合増減:-60>
#
# MPが被ダメージの60分減少します。
#------------------------------------------------------------------------------
# 上の設定用ワード内のMP部分をTPに変えれば
# 同様の処理がTPに行われます。
#==============================================================================
module DAM_MAG_P
#本スクリプトによるMP増減効果時
#MP増加メッセージを表示せず回復SEも鳴らさない
#true……表示SEあり false……表示SEなし
MPSE = false
#本スクリプトによるTP増減効果時
#TP増加メッセージを表示せず回復SEも鳴らさない
#true……表示SEあり false……表示SEなし
TPSE = true
#設定用キーワードを指定。
Words = {}
Words[0] = ["被弾時MP固定増減","被弾時最大MP割合増減",
"被弾時現在MP割合増減","被ダメージMP割合増減"]
Words[1] = ["被弾時TP固定増減","被弾時最大TP割合増減",
"被弾時現在TP割合増減","被ダメージTP割合増減"]
end
class Game_ActionResult
attr_accessor :mp_damage_ex # 特殊TPダメージ
attr_accessor :tp_damage_ex # 特殊TPダメージ
#--------------------------------------------------------------------------
# ダメージ値のクリア
#--------------------------------------------------------------------------
alias clear_damage_values_tpdex clear_damage_values
def clear_damage_values
clear_damage_values_tpdex
@mp_damage_ex = 0
@tp_damage_ex = 0
end
#--------------------------------------------------------------------------
# ダメージの作成
#--------------------------------------------------------------------------
alias make_damage_t_ex make_damage
def make_damage(value, item)
make_damage_t_ex(value, item)
@mp_damage_ex = 0
@tp_damage_ex = 0
end
end
class Game_Battler
#--------------------------------------------------------------------------
# ダメージの反映処理内に被弾時MP・TP増減ステート処理を追加
#--------------------------------------------------------------------------
alias execute_damage_mpd execute_damage
def execute_damage(user)
if @result.hp_damage > 0
dam_m_plus
dam_t_plus
end
execute_damage_mpd(user)
self.mp -= @result.mp_damage_ex unless DAM_MAG_P::MPSE
self.tp -= @result.tp_damage_ex
end
#--------------------------------------------------------------------------
# 被弾時MP増減特徴処理
#--------------------------------------------------------------------------
def dam_m_plus
mpse = DAM_MAG_P::MPSE
feature_objects.each {|f| 4.times {|n| a = f.dam_m_plus[n]
next if a.empty? or eval(a[1]) <= rand(100)
case n
when 0;i = eval(a[0])
when 1;i = mmp * eval(a[0]) / 100
when 2;i = self.mp * eval(a[0]) / 100
when 3;i = @result.hp_damage * eval(a[0]) / 100
end
mpse ? (@result.mp_damage -= i) : (@result.mp_damage_ex -= i)}}
end
#--------------------------------------------------------------------------
# 被弾時TP増減特徴処理
#--------------------------------------------------------------------------
def dam_t_plus
tpse = DAM_MAG_P::TPSE
feature_objects.each {|f| 4.times {|n| a = f.dam_t_plus[n]
next if a.empty? or eval(a[1]) <= rand(100)
case n
when 0;i = eval(a[0])
when 1;i = max_tp * eval(a[0]) / 100
when 2;i = self.tp * eval(a[0]) / 100
when 3;i = @result.hp_damage * eval(a[0]) / 100
end
i = i.to_i
@result.tp_damage_ex -= i
@result.tp_damage -= i if tpse}}
end
end
class RPG::BaseItem
#--------------------------------------------------------------------------
# 被弾時MP増減特徴データ
#--------------------------------------------------------------------------
def dam_m_plus
@dam_m_plus ||= create_dam_mt_plus(0)
end
#--------------------------------------------------------------------------
# 被弾時TP増減特徴データ
#--------------------------------------------------------------------------
def dam_t_plus
@dam_t_plus ||= create_dam_mt_plus(1)
end
#--------------------------------------------------------------------------
# 被弾時MP/TP増減特徴データ作成
#--------------------------------------------------------------------------
def create_dam_mt_plus(type)
h = {}
ws = DAM_MAG_P::Words[type]
ws.each_with_index {|w,index| a = (/<#{w}[:](\S+)>/ =~ note ? $1.to_s : "").split(
/\s*,\s*/).inject ([]) {|r,t| r.push(t)}
h[index] = (
case a.size
when 1;[a[0],"100"]
when 2;a
else;[]
end)}
h
end
end