sacred-ritual-academy/Scripts/TP_.1.rb
2025-03-18 19:45:34 -05:00

286 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 TP関連機能諸々追加 Ver2.01 by 星潟
#------------------------------------------------------------------------------
# 最大TPを一定割合もしくは一定値増減させる特徴と
# 消費TPを一定割合もしくは一定値増減させる特徴と
# そのそれぞれの増減の加算と乗算の順序を指定できます。
# また、行動時のTPチャージ率を強制的に0にする特徴と
# 行動時のTPチャージ率をマイナスにする特徴を作成できるようになる他
# TP消費101以上のスキルの作成を可能にします。
#
# 使用例
#
# ★アクター・職業・ステート・装備・エネミーのメモ欄用
# PS_AVの項目がtrueの時、スキルでも有効となり、パッシブスキルとして使用可能になる
#
# <最大TP割合:10>
#
# 最大TP +10
#
# <最大TP割合:-10>
#
# 最大TP -10
#
# <最大TP割合:$game_variables[1]>
#
# 最大TPが変数ID1の値分増加。
#
# <最大TP加算:15>
#
# 最大TP +15。
#
# <最大TP加算:-15>
#
# 最大TP -15。
#
# <最大TP加算:self.level*self.level+1>
#
# 最大TPを使用者レベル分の2乗+1分加算。
#
# <消費TP割合:20>
#
# 消費TP +20マイナスになってもTPは増えない
#
# <消費TP割合:-20>
#
# 消費TP -20通常攻撃等にも効果を及ぼすので注意。設定変更可能
#
# <消費TP減算:25>
#
# 消費TP -25。消費TP0のスキルも変化。マイナスになってもTPは増えない
#
# <消費TP減算:-25>
#
# 消費TP +25。消費TP0のスキルも変化。通常攻撃等にも効果を及ぼすので注意。設定変更可能
#
# <TPチャージ無効>
#
# 行動したりダメージを受けてもTPが増加しない。
#
# <TPチャージ反転>
#
# 行動したりダメージを受けるとTP減少。無効が優先される
#
# ★スキルのメモ欄用
#
# <追加消費TP:100>
#
# 該当スキルの消費TP + 100
#
# <消費TP増減除外>
#
# このスクリプトの効果によって消費TPの変化が発生しないスキルになります。
# (攻撃・防御等にセットしておくべきでしょう)
#==============================================================================
# Ver1.01 処理方法を変更。
# Ver2.00 リニューアル。
# Ver2.01 設定内容の誤字を修正。
# 消費TP割合の基礎計算を減算でなく加算に変更。
# 最大TP割合と消費TP割合の計算方法を加算と乗算で選べるように変更。
#==============================================================================
module TP_PLUS
#最大TPを指定します。nilの場合は、デフォルトの100になります
MAXTP = 100
#最大TP増減時の計算方法を選択します。0……加算→乗算 1……乗算→加算
TYPE1 = 1
#消費TP増減時の計算方法を選択します。0……加算→乗算 1……乗算→加算
TYPE2 = 1
#最大TP割合の計算処理を選択します。
#(0……全て加算してから基礎値に乗算 1……全て乗算してから基礎値に乗算。
# 参考材料として、通常は最大MP割合は全て乗算してから基礎値に乗算)
TYPE3 = 1
#消費TP割合の計算処理を選択します。
#(0……全て加算してから消費量に乗算 1……全て乗算してから消費量に乗算。
# 参考材料として、通常は消費MP軽減処理は全て乗算してから消費量に乗算)
TYPE4 = 0
#空の配列を用意。
WORDs = []
#最大TPの乗算用のキーワードを設定します。
WORDs[0] = "最大TP割合"
#最大TPの加算用のキーワードを設定します。
WORDs[1] = "最大TP加算"
#消費TPの乗算用のキーワードを設定します。
WORDs[2] = "消費TP割合"
#消費TPの減算用のキーワードを設定します。
WORDs[3] = "消費TP減算"
#スキルの消費TP増加用のキーワードを設定します。
WORDs[4] = "追加消費TP"
#行動によるTP増加を無効化する為のキーワードを設定します。
WORDs[5] = "TPチャージ無効"
#行動によるTP増加値をマイナスの値に変える為のキーワードを設定します。
WORDs[6] = "TPチャージ反転"
#消費TP増減効果から除外するスキル用のキーワードを設定します。
WORDs[7] = "消費TP増減除外"
#このスクリプトにより追加された特徴を
#パッシブスキルに使用するかどうかを決定します。true……使用可 false……使用不可
PS_AV = true
end
class Game_BattlerBase
#--------------------------------------------------------------------------
# パッシブスキル特徴判定
#--------------------------------------------------------------------------
def tp_feature_objects
feature_objects.select {|f| f.tp_plus_features(8)}
end
#--------------------------------------------------------------------------
# TP の最大値を取得
#--------------------------------------------------------------------------
alias max_tp_plus max_tp
def max_tp
data = 0
if TP_PLUS::MAXTP == nil
data = max_tp_plus
else
data = TP_PLUS::MAXTP
end
if TP_PLUS::TYPE1 == 0
data = (data * mted_ex1 / 100).to_i + mted_ex2
else
data = ((data + mted_ex2) * mted_ex1 / 100).to_i
end
return data
end
#--------------------------------------------------------------------------
# TP の割合を取得
#--------------------------------------------------------------------------
def tp_rate
@tp.to_f / max_tp
end
#--------------------------------------------------------------------------
# 最大TPの増加割合を習得
#--------------------------------------------------------------------------
def mted_ex1
if TP_PLUS::TYPE3 == 0
tp_feature_objects.inject(100) {|r,f| r += eval(f.tp_plus_features(0))}
else
tp_feature_objects.inject(100) {|r,f| r *= (100 + eval(f.tp_plus_features(0))).to_f / 100}
end
end
#--------------------------------------------------------------------------
# 最大TPの加算値を習得
#--------------------------------------------------------------------------
def mted_ex2
tp_feature_objects.inject(0) {|r,f| r += eval(f.tp_plus_features(1))}
end
#--------------------------------------------------------------------------
# スキルの消費 TP 計算
#--------------------------------------------------------------------------
alias skill_tp_cost_plus skill_tp_cost
def skill_tp_cost(skill)
data = skill_tp_cost_plus(skill) + eval(skill.tp_plus_features(4))
return data if skill.voidgtp?
if TP_PLUS::TYPE2 == 0
data = (data * tp_cost_plus1 / 100).to_i - tp_cost_plus2
else
data = ((data - tp_cost_plus2) * tp_cost_plus1 / 100).to_i
end
data < 0 ? 0 : data
end
#--------------------------------------------------------------------------
# TP消費軽減の割合を取得
#--------------------------------------------------------------------------
def tp_cost_plus1
if TP_PLUS::TYPE4 == 0
tp_feature_objects.inject(100) {|r,f| r += eval(f.tp_plus_features(2))}
else
tp_feature_objects.inject(100) {|r,f| r *= (100 + eval(f.tp_plus_features(2))).to_f / 100}
end
end
#--------------------------------------------------------------------------
# TP消費軽減値を取得
#--------------------------------------------------------------------------
def tp_cost_plus2
tp_feature_objects.inject(0) {|r,f| r += eval(f.tp_plus_features(3))}
end
#--------------------------------------------------------------------------
# TPチャージ率を習得
#--------------------------------------------------------------------------
alias tcr_plus tcr
def tcr
tpcbreak? ? 0 : (tcr_plus * (tpcminus? ? -1 : 1))
end
#--------------------------------------------------------------------------
# 取得TP無効化用データを習得
#--------------------------------------------------------------------------
def tpcbreak?
tp_feature_objects.any? {|f| f.tp_plus_features(5)}
end
#--------------------------------------------------------------------------
# 取得TPマイナス化用データを習得
#--------------------------------------------------------------------------
def tpcminus?
tp_feature_objects.any? {|f| f.tp_plus_features(6)}
end
end
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# パッシブスキル特徴判定
#--------------------------------------------------------------------------
def tp_feature_objects
super + (TP_PLUS::PS_AV ? skills.select {|s| s.tp_plus_features(8)} : [])
end
end
class RPG::BaseItem
#--------------------------------------------------------------------------
# TP特徴データ群
#--------------------------------------------------------------------------
def tp_plus_features(type)
(@tp_plus_features ||= create_tp_plus_features)[type]
end
#--------------------------------------------------------------------------
# TP特徴データ群作成
#--------------------------------------------------------------------------
def create_tp_plus_features
h = {}
a = TP_PLUS::WORDs
5.times {|i|
w = a[i]
h[i] = /<#{w}[:](\S+)>/ =~ note ? $1.to_s : "0"
h[8] = true if h[i] != "0"}
h[5] = /<#{a[5]}>/ =~ note ? true : false
h[6] = /<#{a[6]}>/ =~ note ? true : false
h[7] = /<#{a[7]}>/ =~ note ? true : false
h[8] = true if h[5] or h[6] or h[7]
h
end
end
class RPG::Skill < RPG::UsableItem
#--------------------------------------------------------------------------
# 消費TP増減無効データを習得
#--------------------------------------------------------------------------
def voidgtp?
tp_plus_features(7)
end
end