赞 | 1 |
VIP | 0 |
好人卡 | 3 |
积分 | 6 |
经验 | 16134 |
最后登录 | 2022-10-7 |
在线时间 | 310 小时 |
Lv2.观梦者
- 梦石
- 0
- 星屑
- 582
- 在线时间
- 310 小时
- 注册时间
- 2016-2-29
- 帖子
- 210
|
# ステ―ト詳細確認ウィンドウ
#
# 戦闘時、パーティコマンドに付与されているステートの詳細を確認するためのコマンド
# を追加します。
$imported_yana_scripts ||= {}
$imported_yana_scripts["StateHelpWindow"] = true
module StateHelp
Buffs = {}
States = []
# 请按照下面的描写进行备注
Buffs[[0,:up]] = "HP+25%,最高5级\n持续5回合"
Buffs[[1,:up]] = "MP+25%,最高5级\n持续5回合"
Buffs[[2,:up]] = "物攻+25%,最高5级\n持续5回合"
Buffs[[3,:up]] = "物防+25%,最高5级\n持续5回合"
Buffs[[4,:up]] = "魔攻+25%,最高5级\n持续5回合"
Buffs[[5,:up]] = "魔防+25%,最高5级\n持续5回合"
Buffs[[6,:up]] = "敏捷+25%,最高5级\n持续5回合"
Buffs[[7,:up]] = "幸运+25%,最高5级\n持续5回合"
Buffs[[0,:down]] = "HP-25%,最高5级\n持续5回合"
Buffs[[1,:down]] = "MP-25%,最高5级\n持续5回合"
Buffs[[2,:down]] = "物攻-25%,最高5级\n持续5回合"
Buffs[[3,:down]] = "物防-25%,最高5级\n持续5回合"
Buffs[[4,:down]] = "魔攻-25%,最高5级\n持续5回合"
Buffs[[5,:down]] = "魔防-25%,最高5级\n持续5回合"
Buffs[[6,:down]] = "敏捷-25%,最高5级\n持续5回合"
Buffs[[7,:down]] = "幸运-25%,最高5级\n持续5回合"
States[1] = "无法战斗:死亡。"
States[2] = "毒:生命再生-10%\n永续。"
States[3] = "致盲:物理命中率-60%\n2~4回合。"
States[4] = "沉默:无法使用技能\n2~3回合。"
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 = [Graphics.height / 2 - self.height / 2,help_window.height].max
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*2
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
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
|
|