class Game_Battler
GUARD_ONCE_STATE = 30 # 状态ID
alias init0622 initialize
def initialize
init0622
@guard_times = 0
end
alias add_state_0622 add_state
def add_state(state_id)
@guard_times += 1 if state_id == GUARD_ONCE_STATE
add_state_0622(state_id)
end
alias remove_state_0622 remove_state
def remove_state(state_id)
@guard_times = 0 if state_id == GUARD_ONCE_STATE
remove_state_0622(state_id)
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))
return unless @result.hit?
if @guard_times > 0
remove_state(GUARD_ONCE_STATE) if (@guard_times -= 1) <= 0
return
end
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