| 赞 | 164 |
| VIP | |
| 好人卡 | |
| 积分 | 299 |
| 经验 | |
| 最后登录 | 2026-10-2 |
| 在线时间 | 5734 小时 |
- 梦石
- 0
- 星屑
- 29901
- 在线时间
- 5734 小时
- 注册时间
- 2016-3-8
- 回帖
- 1653
|
楼主 |
发表于 2020-1-3 23:08:39
|
显示全部楼层
Game_Battler第567行附近
[pre lang="ruby"] #--------------------------------------------------------------------------
# ● 計算技能/物品的成功幾率
#--------------------------------------------------------------------------
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[/pre]
[pre lang="ruby"] #--------------------------------------------------------------------------
# ● 計算技能/物品的閃避幾率
#--------------------------------------------------------------------------
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[/pre]
[pre lang="ruby"]
#--------------------------------------------------------------------------
# ● 應用技能/物品的效果
#--------------------------------------------------------------------------
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[/pre]
Scene_Battle第615附近
[pre lang="ruby"]
#--------------------------------------------------------------------------
# ● 戰斗行動結束時的處理
#--------------------------------------------------------------------------
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[/pre] |
|