class Game_Battler < Game_BattlerBase
STATE_UPGRADE = {
21 => [21, 22, 23],#~*********************
97 => [97, 98, 99, 100, 101], # 11、12、13号状态为三个等级。通过添加10号状态来叠加升级。
205 => [205, 206, 207, 208, 209],
566 => [566, 567, 568, 569, 570],
}
def state_addable?(state_id)
alive? && $data_states[state_id] && !state_resist?(state_id) &&
#~ !state_removed?(state_id) && !state_restrict?(state_id)
!state_restrict?(state_id)
end
alias as_20141212 add_state
def add_state(id)
return as_20141212(id) if @removing_state
levels = STATE_UPGRADE[id]
return as_20141212(id) unless levels
index = levels.index { |state| state?(state) } # 当前等级
return as_20141212(id) unless index
return if index == levels.size - 1 # 已经达到最高等级
@adding_state = true
remove_state levels[index]
@adding_state = false
as_20141212 levels[index + 1]
end
alias rs_20211117 remove_state
def remove_state(state_id)
return rs_20211117(state_id) if @adding_state
for i in STATE_UPGRADE
levels = i[1] if i[1].include?(state_id)
end
return rs_20211117(state_id) unless levels
index = levels.index { |state| state?(state) }
return rs_20211117(state_id) unless index
rs_20211117(levels[index])
return if index == 0
@removing_state = true
add_state(levels[index - 1])
@removing_state = false
end
end