#==============================================================================
# ■ 特定属性攻击移除状态
#------------------------------------------------------------------------------
# 状态备注中写<移除属性 n,移除率 x%>
# 例 <移除属性 3,移除率 90%>
#
# 遗憾的是,目前只能设置一个移除属性
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# ● [别名修改]受到伤害时解除状态
#--------------------------------------------------------------------------
alias remove_states_by_element_damage remove_states_by_damage
def remove_states_by_damage
remove_states_by_element_damage # 调用原方法
element_id = @result.item.damage.element_id # 所受伤害属性
states.each do |state|
next unless state.remove_by_element? # 由属性攻击移除?
next unless state.remove_element == element_id # 是所受伤害属性?
next unless rand(100) < state.remove_rate # 概率符合?
remove_state(state.id) # 移除状态
end
end
end
class Game_ActionResult
#--------------------------------------------------------------------------
# ● [别名修改]生成伤害
#--------------------------------------------------------------------------
alias :make_damage_for_item :make_damage
def make_damage(value, item)
@item = item
make_damage_for_item(value, item)
end
#--------------------------------------------------------------------------
# ● [追加]物品/技能
#--------------------------------------------------------------------------
def item
@item
end
end
class RPG::State
attr_reader :remove_element, :remove_rate
#--------------------------------------------------------------------------
# ● [追加]由属性攻击移除?
#--------------------------------------------------------------------------
def remove_by_element?
if note =~ /<移除属性[ :=]*(\d+)[ :=,]*移除率[ :=]*(\d+)%?>/
@remove_element, @remove_rate = $1.to_i, $2.to_i
return true
else
return false
end
end
end