def draw_icons(subject, x, y, width = 96)
icons = (subject.state_icons + subject.buff_icons)[0, width / item_width]
icons.each_with_index {|n, i| draw_icon(n, x + item_width * i, y) }
end
def item_rect(index)
rect = Rect.new
rect.width = item_width
rect.height = item_height
rect.x = index % col_max * item_width + 143
rect.y = index / col_max * item_height
rect
end
def update_help
@help_window.set_text(description)
end
def make_data
@data = all_battle_members.inject([]){|r,m|
a = []
a += m.states.select{|st| st.icon_index != 0 }
bf = []
m.buffs.each_with_index{|b,i| bf.push([i,b > 0 ? :up : :down]) if b != 0}
a += bf
a += Array.new(col_max - a.size){nil} if col_max > a.size
r += a
}
end
def description
return "" unless @data[index]
if @data[index].is_a?(Array)
return StateHelp::Buffs[@data[index]]
else
return StateHelp::States[@data[index].id]
end
end
def cursor_down(wrap = false)
return if @data.compact.empty?
loop do
select((index + col_max) % item_max)
break if @data[index]
end
end
def cursor_up(wrap = false)
return if @data.compact.empty?
loop do
select((index - col_max + item_max) % item_max)
break if @data[index]
end
end
def cursor_right(wrap = false)
return if @data.compact.empty?
loop do
select((index + 1) % item_max)
break if @data[index]
end
end
def cursor_left(wrap = false)
return if @data.compact.empty?
loop do
select((index - 1 + item_max) % item_max)
break if @data[index]
end
end
def smooth_select
return select(0) if @data.compact.empty?
@data.each_with_index{|d,i|
if d
select(i)
return
end
}
end
end
class Window_PartyCommand < Window_Command
alias _ex_state_make_command_list make_command_list
def make_command_list
_ex_state_make_command_list
add_command("状态信息", :state)
end
end
class Scene_Battle < Scene_Base
alias _ex_state_create_all_windows create_all_windows
def create_all_windows
_ex_state_create_all_windows
create_state_window
end
alias _ex_state_create_party_command_window create_party_command_window
def create_party_command_window
_ex_state_create_party_command_window
@party_command_window.set_handler(:state, method(:command_state))
end