赞 | 3 |
VIP | 0 |
好人卡 | 0 |
积分 | 23 |
经验 | 2892 |
最后登录 | 2024-7-10 |
在线时间 | 275 小时 |
Lv3.寻梦者
- 梦石
- 0
- 星屑
- 2333
- 在线时间
- 275 小时
- 注册时间
- 2017-7-25
- 帖子
- 163
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 骷髅岛遗老 于 2021-3-7 12:38 编辑
- # 状态详细确认窗口
- #
- # 戦闘時、パーティコマンドに付与されているステートの詳細を確認するためのコマンド
- # を追加します。
-
- $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] = "无法战斗:HP为0,无法继续战斗。"
- States[3] = "挑衅:受到攻击的概率×200%"
- States[4] = "保护:保护技能发动中,将替代指定队友承受伤害。"
- States[5] = "被保护:受到保护中,受到的伤害将转移给发动保护的队友。"
- States[7] = ""
- States[8] = "不死:不会死亡。"
- States[12] = "中毒:HP每回合减少50%魔法伤害,同时降低攻击力10%"
- States[13] = "出血:HP每回合减少50%物理伤害,同时降低防御力10%"
- States[14] = "灼伤:HP每回合减少50%魔法伤害,同时受到的伤害增加10%。"
- States[15] = "衰亡:HP每回合减少5%。"
- States[10] = "石化\n行動できない。回避と防御、狙われ率が下がる"
- States[36] = "自身5回合内敏捷+50%,命中率+20%。"
-
-
- end
-
- class Game_BattlerBase
- attr_reader :buffs
- 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 - 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
复制代码
这个脚本会开一个小窗显示敌我双方状态和预设里写的说明,像这样
然而用了几下发现一个奇怪的BUG,就是当我方只有一个角色出战的时候中间的小窗就什么都不显示了,必须有2人以上出战时才正常显示
有没有大佬帮忙看看是哪里出了问题? |
|