Game_Battler第567行附近
#-------------------------------------------------------------------------- # ● 計算技能/物品的成功幾率 #-------------------------------------------------------------------------- def item_hit(user, item) rate = item.success_rate * 0.01 # 獲取成功幾率 rate *= user.hit if item.physical? # 物理攻擊:計算成功幾率的乘積 if item.is_a?(RPG::Skill) and item.id == 3 if $game_variables[1] == 1 return 1 end if $game_variables[1] == 2 return 0 end end return rate # 返回計算后的成功幾率 end
#--------------------------------------------------------------------------
# ● 計算技能/物品的成功幾率
#--------------------------------------------------------------------------
def item_hit(user, item)
rate = item.success_rate * 0.01 # 獲取成功幾率
rate *= user.hit if item.physical? # 物理攻擊:計算成功幾率的乘積
if item.is_a?(RPG::Skill) and item.id == 3
if $game_variables[1] == 1
return 1
end
if $game_variables[1] == 2
return 0
end
end
return rate # 返回計算后的成功幾率
end
#-------------------------------------------------------------------------- # ● 計算技能/物品的閃避幾率 #-------------------------------------------------------------------------- def item_eva(user, item) if item.is_a?(RPG::Skill) and item.id == 3 if $game_variables[1] == 1 return 0 end if $game_variables[1] == 2 return 1 end end return eva if item.physical? # 是物理攻擊則返回閃避幾率 return mev if item.magical? # 是魔法攻擊則返回閃避魔法幾率 return 0 end
#--------------------------------------------------------------------------
# ● 計算技能/物品的閃避幾率
#--------------------------------------------------------------------------
def item_eva(user, item)
if item.is_a?(RPG::Skill) and item.id == 3
if $game_variables[1] == 1
return 0
end
if $game_variables[1] == 2
return 1
end
end
return eva if item.physical? # 是物理攻擊則返回閃避幾率
return mev if item.magical? # 是魔法攻擊則返回閃避魔法幾率
return 0
end
#-------------------------------------------------------------------------- # ● 應用技能/物品的效果 #-------------------------------------------------------------------------- def item_apply(user, item) @result.clear @result.used = item_test(user, item) @result.missed = (@result.used && rand >= item_hit(user, item)) @result.evaded = (!@result.missed && rand < item_eva(user, item)) if item.is_a?(RPG::Skill) and item.id == 3 if @result.hit? $game_variables[1] = 1 else $game_variables[1] = 2 end end 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
#--------------------------------------------------------------------------
# ● 應用技能/物品的效果
#--------------------------------------------------------------------------
def item_apply(user, item)
@result.clear
@result.used = item_test(user, item)
@result.missed = (@result.used && rand >= item_hit(user, item))
@result.evaded = (!@result.missed && rand < item_eva(user, item))
if item.is_a?(RPG::Skill) and item.id == 3
if @result.hit?
$game_variables[1] = 1
else
$game_variables[1] = 2
end
end
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
Scene_Battle第615附近
#-------------------------------------------------------------------------- # ● 戰斗行動結束時的處理 #-------------------------------------------------------------------------- def process_action_end @subject.on_action_end refresh_status @log_window.display_auto_affected_status(@subject) @log_window.wait_and_clear @log_window.display_current_state(@subject) @log_window.wait_and_clear $game_variables[1] = 0 BattleManager.judge_win_loss end
#--------------------------------------------------------------------------
# ● 戰斗行動結束時的處理
#--------------------------------------------------------------------------
def process_action_end
@subject.on_action_end
refresh_status
@log_window.display_auto_affected_status(@subject)
@log_window.wait_and_clear
@log_window.display_current_state(@subject)
@log_window.wait_and_clear
$game_variables[1] = 0
BattleManager.judge_win_loss
end
|