<?php
#==============================================================================
# ** Game_Battler
#==============================================================================
class Game_Battler < Game_BattlerBase
#--------------------------------------------------------------------------
# * Add State
#--------------------------------------------------------------------------
def add_state(state_id)
if state_addable?(state_id)
# Order of functions altered
unless state?(state_id)
add_new_state(state_id)
@result.added_states.push(state_id).uniq!
end
reset_state_counts(state_id)
end
end
#--------------------------------------------------------------------------
# * Remove State
#--------------------------------------------------------------------------
def remove_state(state_id)
if state?(state_id)
# Order of functions altered
revive if state_id == death_state_id
if state?(state_id)
erase_state(state_id)
@result.removed_states.push(state_id).uniq!
end
refresh
end
end
#--------------------------------------------------------------------------
# * Add Buff
#--------------------------------------------------------------------------
def add_buff(param_id, turns)
return unless alive?
# Functions wrapped in condition
unless buff_max?(param_id)
@buffs[param_id] += 1
erase_buff(param_id) if debuff?(param_id)
@result.added_buffs.push(param_id).uniq!
end
overwrite_buff_turns(param_id, turns)
refresh
end
#--------------------------------------------------------------------------
# * Add Debuff
#--------------------------------------------------------------------------
def add_debuff(param_id, turns)
return unless alive?
# Functions wrapped in condition
unless debuff_max?(param_id)
@buffs[param_id] -= 1
erase_buff(param_id) if buff?(param_id)
@result.added_debuffs.push(param_id).uniq!
end
overwrite_buff_turns(param_id, turns)
refresh
end
#--------------------------------------------------------------------------
# * [Add State] Effect: Normal Attack
#--------------------------------------------------------------------------
def item_effect_add_state_attack(user, item, effect)
user.atk_states.each do |state_id|
chance = effect.value1
chance *= state_rate(state_id)
chance *= user.atk_states_rate(state_id)
chance *= luk_effect_rate(user)
if rand < chance
# Only success if valid action
@result.success = true if state_addable?(effect.data_id) && !state?(effect.data_id)
add_state(state_id)
end
end
end
#--------------------------------------------------------------------------
# * [Add State] Effect: Normal
#--------------------------------------------------------------------------
def item_effect_add_state_normal(user, item, effect)
chance = effect.value1
chance *= state_rate(effect.data_id) if opposite?(user)
chance *= luk_effect_rate(user) if opposite?(user)
if rand < chance
# Only success if valid action
@result.success = true if state_addable?(effect.data_id) && !state?(effect.data_id)
add_state(effect.data_id)
end
end
#--------------------------------------------------------------------------
# * [Remove State] Effect
#--------------------------------------------------------------------------
def item_effect_remove_state(user, item, effect)
chance = effect.value1
if rand < chance
# Only success if valid action
@result.success = true if state?(effect.data_id)
remove_state(effect.data_id)
end
end
#--------------------------------------------------------------------------
# * [Buff] Effect
#--------------------------------------------------------------------------
def item_effect_add_buff(user, item, effect)
@result.success = true if !buff_max?(effect.data_id)
add_buff(effect.data_id, effect.value1)
end
#--------------------------------------------------------------------------
# * [Debuff] Effect
#--------------------------------------------------------------------------
def item_effect_add_debuff(user, item, effect)
chance = debuff_rate(effect.data_id) * luk_effect_rate(user)
if rand < chance
@result.success = true if !debuff_max?(effect.data_id)
add_debuff(effect.data_id, effect.value1)
end
end
#--------------------------------------------------------------------------
# * [Remove Buff] Effect
#--------------------------------------------------------------------------
def item_effect_remove_buff(user, item, effect)
return unless @buffs[effect.data_id] > 0
remove_buff(effect.data_id)
@result.success = true
end
#--------------------------------------------------------------------------
# * [Remove Debuff] Effect
#--------------------------------------------------------------------------
def item_effect_remove_debuff(user, item, effect)
return unless @buffs[effect.data_id] < 0
remove_buff(effect.data_id)
@result.success = true
end
end
#==============================================================================
# ** Window_BattleLog
#==============================================================================
class Window_BattleLog < Window_Selectable
#--------------------------------------------------------------------------
# * Display Affected Status
#--------------------------------------------------------------------------
alias :tayruu_successfix_windowbattlelog_affectstatus :display_affected_status
def display_affected_status(target, item)
return if !target.result.success && target.result.used
tayruu_successfix_windowbattlelog_affectstatus(target, item)
end
end