#============================================================================== # ■状态剩余回合数显示 for RGSS3 Ver1.01-β # □作成者 kure #============================================================================== # # 状态备注: <不显示剩余回合数> 则不会显示剩余回合数 # #============================================================================== # ■ RPG::State(追加定義) #============================================================================== class RPG::State < RPG::BaseItem #-------------------------------------------------------------------------- # ☆残りターン非表示の定義(追加定義) #-------------------------------------------------------------------------- def view_turns? return true unless @note return false if @note.include?("<不显示剩余回合数>") return true end end #============================================================================== # ■ Window_Base #============================================================================== class Window_Base < Window #-------------------------------------------------------------------------- # ● ステートおよび強化/弱体のアイコンを描画(再定義) #-------------------------------------------------------------------------- def draw_actor_icons(actor, x, y, width = 96) icons = (actor.state_icons_adv + actor.buff_icons_adv)[0, width / 24] last = contents.font.size contents.font.size = 18 change_color(crisis_color) icons.each_with_index {|n, i| draw_state_icon_turns(n, x + 24 * i, y) } change_color(normal_color) contents.font.size = last end #-------------------------------------------------------------------------- # ● 残りのターンを加えたアイコンの描画(追加定義) #-------------------------------------------------------------------------- def draw_state_icon_turns(data, x, y) draw_icon(data[0], x, y) draw_text(x + 12, y + 8, 12, 18, data[1],2) end end #============================================================================== # ■ Game_BattlerBase #============================================================================== class Game_BattlerBase #-------------------------------------------------------------------------- # ● 現在のステートをアイコンINDEX、残りターン、ステートIDで取得(追加定義) #-------------------------------------------------------------------------- def state_icons_adv icons = states.collect {|state| [state.icon_index, @state_turns[state.id], state.id] } for i in 0..icons.size - 1 if icons[i][0] == 0 icons[i] = nil else icons[i][1] = "" if $data_states[icons[i][2]].auto_removal_timing == 0 icons[i][1] = "" unless $data_states[icons[i][2]].view_turns? end end icons.compact! return icons end #-------------------------------------------------------------------------- # ● 現在の強化/弱体をアイコンINDEX、残りターンで取得(追加定義) #-------------------------------------------------------------------------- def buff_icons_adv icons = [] @buffs.each_with_index {|lv, i| [icons.push(buff_icon_index(lv, i)),@buff_turns[i]] } for i in 0..icons.size - 1 icons[i] = nil if icons[i][0] == 0 end icons.compact! return icons end end
4.png (4.98 KB, 下载次数: 32)
cinderelmini 发表于 2019-5-13 14:42
总觉得 def buff_icons_adv 这个方法里的第二行怪怪的,
尝试改成这样看看?
...
leontonydz 发表于 2019-5-13 21:30
感谢大佬!现在图标解决了,只是显示的数字后面多了个‘.0’,能否再修改只显示个位数?
...
cinderelmini 发表于 2019-5-13 21:38
在 def draw_state_icon_turns(data, x, y) 方法里,
在data[1]后面加上.to_i应该可以:
draw_text(x + 1 ...
4.png (11.82 KB, 下载次数: 31)
leontonydz 发表于 2019-5-13 22:22
再次感谢大佬!
但是常驻buff上多了数字感觉不美观,能删除吗?
leontonydz 发表于 2019-5-13 22:22
再次感谢大佬!
但是常驻buff上多了数字感觉不美观,能删除吗?
cinderelmini 发表于 2019-5-14 13:43
好像装状态图标数据的那个数组后面还有带了个状态ID,那么利用一下的话……
可以获取到这个ID的状态实例 ...
shencao 发表于 2019-5-14 13:54
在不需要的状态备注这个就可以了吧?
# 状态备注: 则不会显示剩余回合数
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |