156 lines
No EOL
6.3 KiB
Ruby
156 lines
No EOL
6.3 KiB
Ruby
|
||
|
||
=begin
|
||
|
||
トリス ステボーナス2 ver1
|
||
|
||
ROBF1で作った「ステボーナス」と「命中率の仕様変更 by 白雪レイカ」の競合解決版
|
||
|
||
「ステボーナス」は抜いてください。
|
||
「命中率の仕様変更 by 白雪レイカ」は入れたままにしてください。
|
||
「命中率の仕様変更 by 白雪レイカ」より下に、このスクリプトを入れてください。
|
||
|
||
ver1内容
|
||
・「ステボーナス の機能全て」と「命中率の仕様変更 の回避率計算のみ」を統合
|
||
・回避率計算 回避率と「命中率の余剰分で回避率を減算」の命中率に、ボーナス適用
|
||
・それらを加味した「実際の命中判定と回避判定」の段階での数値を表示
|
||
|
||
=end
|
||
|
||
|
||
module PB
|
||
|
||
# 命中率にボーナスが入る魔法防御の値
|
||
HIT_BONUS = 1
|
||
# 回避率にボーナスが入る敏捷性の値
|
||
EVA_BONUS = 2.5
|
||
# 会心率にボーナスが入る運の値
|
||
CRI_BONUS = 2
|
||
|
||
|
||
# 命中率・回避率・会心率のボーナス計算の表示
|
||
# 競合の心配はないが、邪魔なら false にする
|
||
SHOW_BONUS = true
|
||
|
||
# ステボーナス2で追加 以下の3つを表示 命中率と回避率はボーナス込みのもの
|
||
# ・相手の回避率
|
||
# ・命中判定の確率 つまり命中率そのまま
|
||
# ・回避判定の確率 つまり回避率から「命中率の余剰分」を減算したもの
|
||
# 他のスクリプトと競合した場合は false にする
|
||
#
|
||
# 「実際の命中判定と回避判定」の段階での数値を表示するので、
|
||
# 今回「命中率の仕様変更」との間に発生したような不具合も発見できる
|
||
SHOW_ON_APPLY = true
|
||
|
||
|
||
end
|
||
|
||
#==============================================================================
|
||
# ■ Game_Actor
|
||
#==============================================================================
|
||
class Game_Actor < Game_Battler
|
||
def hit_with_bonus
|
||
param = (hit * 100).to_i # 命中率
|
||
bonus = param_for_bonus(5) / PB::HIT_BONUS # 能力値5:魔法防御
|
||
result = param + bonus
|
||
p sprintf("%s 通常の命中率=%s% 結果命中率=%s% 魔法防御=%s",
|
||
name, param, result, param_for_bonus(5)) if PB::SHOW_BONUS
|
||
return result * 0.01
|
||
end
|
||
def eva_with_bonus
|
||
param = (eva * 100).to_i # 物理回避率
|
||
bonus = param_for_bonus(6) / PB::EVA_BONUS # 能力値6:敏捷性
|
||
result = param + bonus
|
||
p sprintf("%s 通常の回避率=%s% 結果回避率=%s% 敏捷性=%s",
|
||
name, param, result, param_for_bonus(6)) if PB::SHOW_BONUS
|
||
return result * 0.01
|
||
end
|
||
def cri_with_bonus
|
||
param = (cri * 100).to_i # 会心率
|
||
bonus = param_for_bonus(7) / PB::CRI_BONUS # 能力値7:運
|
||
result = param + bonus
|
||
p sprintf("%s 通常の会心率=%s% 結果会心率=%s% 運=%s",
|
||
name, param, result, param_for_bonus(7)) if PB::SHOW_BONUS
|
||
return result * 0.01
|
||
end
|
||
end
|
||
#==============================================================================
|
||
# ■ Game_Enemy
|
||
#==============================================================================
|
||
class Game_Enemy < Game_Battler
|
||
def hit_with_bonus
|
||
return hit
|
||
end
|
||
def eva_with_bonus
|
||
return eva
|
||
end
|
||
def cri_with_bonus
|
||
return cri
|
||
end
|
||
end
|
||
|
||
#==============================================================================
|
||
# ■ Game_Battler
|
||
#==============================================================================
|
||
class Game_Battler < Game_BattlerBase
|
||
#--------------------------------------------------------------------------
|
||
# ● ボーナスに利用するパラメータ取得
|
||
#--------------------------------------------------------------------------
|
||
def param_for_bonus(param_id)
|
||
param(param_id) # param:実際の値
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ● スキル/アイテムの命中率計算
|
||
#--------------------------------------------------------------------------
|
||
def item_hit(user, item)
|
||
rate = item.success_rate * 0.01 # 成功率を取得
|
||
rate *= user.hit_with_bonus if item.physical? # 物理攻撃:命中率を乗算
|
||
return rate # 計算した命中率を返す
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ● スキル/アイテムの回避率計算
|
||
#--------------------------------------------------------------------------
|
||
def item_eva(user, item)
|
||
if item.physical?
|
||
return eva_with_bonus if user.hit_with_bonus <= 1
|
||
return eva_with_bonus - (user.hit_with_bonus - 1)
|
||
end
|
||
return mev - user.magical_hit if item.magical?
|
||
return 0
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ● スキル/アイテムの会心率計算
|
||
#--------------------------------------------------------------------------
|
||
def item_cri(user, item)
|
||
item.damage.critical ? user.cri_with_bonus * (1 - cev) : 0
|
||
end
|
||
end
|
||
|
||
if PB::SHOW_ON_APPLY
|
||
#==============================================================================
|
||
# ■ Game_Battler
|
||
#==============================================================================
|
||
class Game_Battler < Game_BattlerBase
|
||
#--------------------------------------------------------------------------
|
||
# ● スキル/アイテムの効果適用
|
||
#--------------------------------------------------------------------------
|
||
def item_apply(user, item)
|
||
@result.clear
|
||
@result.used = item_test(user, item)
|
||
p_eva = (item.physical? ? eva_with_bonus : mev) * 100
|
||
p sprintf("●回避率=%3d% <命中判定:%3d% 回避判定:%3d%>",
|
||
p_eva, item_hit(user, item) * 100, item_eva(user, item) * 100)
|
||
@result.missed = (@result.used && rand >= item_hit(user, item))
|
||
@result.evaded = (!@result.missed && rand < item_eva(user, item))
|
||
if @result.hit?
|
||
unless item.damage.none?
|
||
@result.critical = (rand < item_cri(user, item))
|
||
make_damage_value(user, item)
|
||
execute_damage(user)
|
||
end
|
||
item.effects.each {|effect| item_effect_apply(user, item, effect) }
|
||
item_user_effect(user, item)
|
||
end
|
||
end
|
||
end
|
||
end |