lunariafantasia/Scripts/_.42.rb
2024-01-12 03:12:38 -06:00

182 lines
8.1 KiB
Ruby
Raw 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.

class RPG::UsableItem::Damage
#--------------------------------------------------------------------------
# ● 通常攻撃の計算式
#--------------------------------------------------------------------------
def normal_attack
#"a.atk * (100 + a.last_tp * 0.5) * 0.02 - b.def * (100 + b.tp * 0.5) * 0.01"
#"a.atk * (2.0 + a.last_tp * 0.001) - b.def * (1.0 + b.tp * 0.001)"
#"a.atk * (2.0 + a.b_tp_rate * 0.25) - b.def * (1.0 + b.tp_rate * 0.25)"
"a.atk * 2.0 - b.def * 1.0"
end
#--------------------------------------------------------------------------
# ● 物理攻撃倍率の計算式
#--------------------------------------------------------------------------
def attack_rate
"[[1.0 + (a.atk - b.def) * 0.01, 0.5].max, 3.0].min"
end
#--------------------------------------------------------------------------
# ● 防御力無視の息攻撃倍率の計算式
#--------------------------------------------------------------------------
def breath_rate
#"[[1.0 + a.atk * 0.001, 0.1].max * (1.0 + a.level * 0.05), 5.0].min"
"[1.0 + a.level * 0.04, 4.0].min"
end
#--------------------------------------------------------------------------
# ● 魔力殴打の計算式
#--------------------------------------------------------------------------
def magic_punch
#"(a.atk + a.mat * 0.5) * (2.0 + a.b_tp_rate * 0.25) - b.def * (1.0 + b.tp_rate * 0.25)"
"(a.atk + a.mat * 0.5) * 2.0 - b.def * 1.0"
end
#--------------------------------------------------------------------------
# ● 魔力ショットの計算式
#--------------------------------------------------------------------------
def magic_shot
"a.mat * 2.0 - b.mdf * 1.0"
end
#--------------------------------------------------------------------------
# ● 法力殴打の計算式
#--------------------------------------------------------------------------
def holy_punch
#"(a.atk + a.mat * 0.5) * (2.0 + a.b_tp_rate * 0.25) - b.def * (1.0 + b.tp_rate * 0.25)"
"(a.atk + a.mdf * 0.5) * 2.0 - b.def * 1.0"
end
#--------------------------------------------------------------------------
# ● 霊装攻撃の計算式
#--------------------------------------------------------------------------
def holy_naturalpunch
#"(a.atk + a.mat * 0.5) * (2.0 + a.b_tp_rate * 0.25) - b.def * (1.0 + b.tp_rate * 0.25)"
#"(a.atk * 0.25 + a.mdf) * 2.0 - b.def * 1.0"
"(a.atk * 0.5 + a.mdf * 1.5) - b.def * 1.0"
end
#--------------------------------------------------------------------------
# ● 魔術攻撃倍率の共通計算式
#--------------------------------------------------------------------------
def magic_attack
#"(100 + a.mat + a.last_tp - b.mdf - b.tp) * 0.01"
#"[1.0 + (a.mat * (1.0 + a.last_tp * 0.0015) - b.mdf * (1.0 + b.tp * 0.0015)) * 0.01, 0.1].max"
#"[1.0 + (a.mat * (1 + a.b_tp_rate * 0.5) - b.mdf * (1 + b.tp_rate * 0.25)) * 0.005, 0.1].max"
#"[1.0 + (a.mat * 1.5 - b.mdf * 1.5) * 0.005, 0.1].max"
#"[1.0 + (a.mat - b.mdf) * 0.01 * 0.9, 0.1].max"
#"[1.0 + (a.mat * 1.5 - b.mdf * 1.25) * 0.01 * 0.5, 0.1].max"
#"[1.0 + (a.mat - b.mdf) * 0.01 * 0.75, 0.1].max"
#"[1.0 + (a.mat - b.mdf) * 0.005, 0.25].max"
"[1.0 + (a.mat - b.mdf) * (b.mdf > a.mat ? 0.0025 : 0.005), 0.25].max"
end
#--------------------------------------------------------------------------
# ● 霊符攻撃の計算式 0.495 0.5025 0.5375 0.545 0.745 0.755
#--------------------------------------------------------------------------
def charm_attack
#"a.mat * (100 + a.last_tp * 0.5) * 0.02 - b.mdf * (100 + b.tp * 0.5) * 0.01"
#"a.mdf * (2.0 + a.b_tp_rate * 0.5) - b.mdf * (1.0 + b.tp_rate * 0.25)"
"a.mdf * (2.0 + a.charm_rate) - (b.def * 1.0 + b.mdf * 0.5)"
end
#--------------------------------------------------------------------------
# ● 魔法防御の共通計算式 ×
#--------------------------------------------------------------------------
def magic_guard
"b.mdf * (200 + b.tp) * 0.01"
end
#--------------------------------------------------------------------------
# ● 回復倍率の共通計算式 魔術・法術共通
#--------------------------------------------------------------------------
def magic_heal
#"(1.0 + (a.mdf * (1 + a.b_tp_rate * 0.05)) * 0.001)"
#"(1.0 + a.mdf * 0.0025)"
#"(1.0 + a.mdf * 0.001)"
"(1.0 + a.mdf * #{QuickHealActor::MAGIC_HEAL})"
end
#--------------------------------------------------------------------------
# ● 法術攻撃倍率の共通計算式
#--------------------------------------------------------------------------
def holy_attack
#"[1.0 + (a.mdf * 1.5 - b.mdf * 1.5) * 0.005, 0.1].max"
#"[1.0 + (a.mdf - b.mdf) * 0.01 * 0.9, 0.1].max"
"[1.0 + (a.mdf - b.mdf) * (b.mdf > a.mdf ? 0.0025 : 0.005), 0.25].max"
end
#--------------------------------------------------------------------------
# ● ターンアンデッドの攻撃+
#--------------------------------------------------------------------------
def turn_undead
"(b.element_rate(6) > 1.0 ? 1000 : 0 )"
end
#--------------------------------------------------------------------------
# ● 威力調整 ※強いスキルを敵が使った場合の敵用出力調整
#--------------------------------------------------------------------------
def power_adjust(power)
"(a.enemy? ? (0.01 * #{power}) : (1.0))"
end
#--------------------------------------------------------------------------
# ● 計算式の文字列置き換え
#--------------------------------------------------------------------------
def change_formula
result = @formula.clone
result.gsub!("n_a") { normal_attack }
result.gsub!("a_r") { attack_rate }
result.gsub!("b_r") { breath_rate }
result.gsub!("m_p") { magic_punch }
result.gsub!("m_s") { magic_shot }
result.gsub!("h_p") { holy_punch }
result.gsub!("h_np") { holy_naturalpunch }
result.gsub!("m_a") { magic_attack }
result.gsub!("c_a") { charm_attack }
result.gsub!("m_g") { magic_guard }
result.gsub!("m_h") { magic_heal }
result.gsub!("h_a") { holy_attack }
result.gsub!("t_u") { turn_undead }
result.gsub!(/p_a\[(\d+)\]/i) { power_adjust($1.to_i) }
result
end
#--------------------------------------------------------------------------
# ● 式計算 ※再定義 文字列の置き換え追加
#--------------------------------------------------------------------------
def eval(a, b, v)
form_result = change_formula
[Kernel.eval(form_result), 0].max * sign rescue 0
end
end
class Game_BattlerBase
#--------------------------------------------------------------------------
# ○
#--------------------------------------------------------------------------
def n_atk
param_base(2)
end
#--------------------------------------------------------------------------
# ○
#--------------------------------------------------------------------------
def charm_rate
0
end
end
#==============================================================================
# ■ Game_Actor
#------------------------------------------------------------------------------
#  アクターを扱うクラスです。このクラスは Game_Actors クラス($game_actors
# の内部で使用され、Game_Party クラス($game_partyからも参照されます。
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ○
#--------------------------------------------------------------------------
def n_atk
(super + equip_class_params(2)) * param_rate(2) * param_buff_rate(2)
end
#--------------------------------------------------------------------------
# ○
#--------------------------------------------------------------------------
def charm_rate
weapons[0] ? weapons[0].charm_rate : super
end
end
class RPG::Weapon < RPG::EquipItem
def charm_rate
return $1.to_f if self.note =~ /\<霊符プラス:(\d*?\.?\d+?)\>/
return 0
end
end