# 状态详细确认窗口
#
# 戦闘時、パーティコマンドに付与されているステートの詳細を確認するためのコマンド
# を追加します。
$imported_yana_scripts ||= {}
$imported_yana_scripts["StateHelpWindow"] = true
module StateHelp
Buffs = {}
States = []
# 请按照下面的描写进行备注
Buffs[[0,:up]] = "HPの強化効果\n最大10段階"
Buffs[[1,:up]] = "MPの強化効果\n最大10段階"
Buffs[[2,:up]] = "攻撃力の強化効果\n最大10段階"
Buffs[[3,:up]] = "防御力の強化効果\n最大10段階"
Buffs[[4,:up]] = "魔法力の強化効果\n最大10段階"
Buffs[[5,:up]] = "魔法防御の強化効果\n最大10段階"
Buffs[[6,:up]] = "敏捷の強化効果\n最大10段階"
Buffs[[7,:up]] = "運の強化効果\n最大10段階"
Buffs[[0,:down]] = "HPの弱体効果\n最大5段階"
Buffs[[1,:down]] = "MPの弱体効果\n最大5段階"
Buffs[[2,:down]] = "攻撃力の弱体効果\n最大5段階"
Buffs[[3,:down]] = "防御力の弱体効果\n最大5段階"
Buffs[[4,:down]] = "魔法力の弱体効果\n最大5段階"
Buffs[[5,:down]] = "魔法防御の弱体効果\n最大5段階"
Buffs[[6,:down]] = "敏捷の弱体効果\n最大5段階"
Buffs[[7,:down]] = "運の弱体効果\n最大5段階"
States[1] = "戦闘不能\nHPが0になり、すべての行動ができない。"
States[2] = "毒\n毎ターン、最大HPの5%のダメージを受ける。"
States[3] = "暗闇\n物理命中率が40%低下する。"
States[4] = "沈黙\n魔法に属するコマンドが使用できなくなる。"
States[5] = "混乱\n混乱し、敵味方の区別なく攻撃を繰り出す。"
States[6] = "睡眠\n行動できない、狙われ率が上がって回避が下がる。"
States[7] = "麻痺\n40%の確率で行動できない。回避が下がる"
States[8] = "スタン\nスタンしてしまって行動できない状態。"
States[9] = "防御\n被ダメージを減少する"
States[10] = "石化\n行動できない。回避と防御、狙われ率が下がる"
States[36] = "自身5回合内敏捷+50%,命中率+20%。"
end
class Game_BattlerBase
attr_reader :buffs
end
class Window_State < Window_Selectable
def initialize(help_window)
super(0,0,32,32)
self.x = [Graphics.width / 2 - self.width / 2,0].max
self.y = 65#[Graphics.height / 2 - self.height / 2,help_window.height].max - 91
self.openness = 0
@help_window = help_window
refresh
end
def all_battle_members;($game_party.battle_members + $game_troop.members).select{|m| m.exist? };end
def row_max;all_battle_members.size;end
def col_max
m = all_battle_members.max_by{|a| a.state_icons.size + a.buff_icons.size }
[m.state_icons.size + m.buff_icons.size,1].max
end
def item_max;row_max*col_max;end
def item_height; line_height + 2 ; end
def item_width; line_height + 2 ; end
def fitting_window #位置修正
self.height = item_height * row_max - standard_padding*4
self.width = 144+(col_max*item_width) + standard_padding*2
self.x = [Graphics.width / 2 - self.width / 2,0].max
self.y = [Graphics.height / 2 - self.height / 2,help_window.height].max - 28
end
def refresh
fitting_window
make_data
create_contents
all_battle_members.each_with_index{|a,i|
draw_actor_name(a,0,i*item_height+1)
draw_text(128,i*item_height+1,20,line_height,":")
draw_icons(a, 144, i*item_height+1, contents.width - 144)
}
end
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
def create_state_window
@state_window = Window_State.new(@help_window)
@state_window.set_handler(:ok, method(:command_state_cancel))
@state_window.set_handler(:cancel, method(:command_state_cancel))
@state_window.unselect
end
def command_state
@party_command_window.deactivate
@state_window.refresh
@state_window.open.activate.smooth_select
@help_window.show
end
def command_state_cancel
@state_window.deactivate.close.unselect
@party_command_window.activate
@help_window.hide
end
end