#============================================================================== # ■ Window_BattleStatus #------------------------------------------------------------------------------ # 显示战斗画面同伴状态的窗口。 #============================================================================== $battle_status_color = { # 所有数值为0~255 # 红 绿 蓝 透明度 :norm => Color.new( 0, 0, 0,200), # 普通文字颜色(角色名等) :lvup => Color.new(255, 0, 0,255), # 升级(LEVEL UP)文字颜色 :hp => Color.new(255, 0,255,200), # HP(HP)文字颜色 :mp => Color.new( 0,128, 0,200), # SP(SP)文字颜色 :stat => Color.new(255, 0, 0,255), # 战斗不能状态的颜色 :nohm => Color.new(128,128, 0,255), # 血量过少的颜色(HP/MP<MAXHP/MAXMP÷4) } class Window_BattleStatus < Window_Base #-------------------------------------------------------------------------- # ● 刷新 #-------------------------------------------------------------------------- def refresh self.contents.clear @item_max = $game_party.actors.size for i in 0...$game_party.actors.size actor = $game_party.actors[i] actor_x = i * 160 + 4 draw_actor_name2(actor,actor_x,0) draw_actor_hp2(actor,actor_x,32,120) draw_actor_sp2(actor,actor_x,64,120) if @level_up_flags[i] self.contents.font.color = $battle_status_color[:lvup] self.contents.draw_text(actor_x,96,120,32,"LEVEL UP!") else draw_actor_state2(actor,actor_x,96) end end end #-------------------------------------------------------------------------- # ● 新描画角色名 #-------------------------------------------------------------------------- def draw_actor_name2(actor,x,y) self.contents.font.color = $battle_status_color[:norm] self.contents.draw_text(x,y,120,32,actor.name) end #-------------------------------------------------------------------------- # ● 新描绘状态 #-------------------------------------------------------------------------- def draw_actor_state2(actor,x,y,width = 120) text = make_battler_state_text(actor,width,true) nor = $battle_status_color[:norm] kno = $battle_status_color[:stat] self.contents.font.color = (actor.hp == 0 ? kno : nor) self.contents.draw_text(x,y,width,32,text) end #-------------------------------------------------------------------------- # ● 新描绘 HP #-------------------------------------------------------------------------- def draw_actor_hp2(actor,x,y,width = 144) # 描绘字符串 "HP" self.contents.font.color = $battle_status_color[:hp] self.contents.draw_text(x,y,32,32,$data_system.words.hp) # 计算描绘 MaxHP 所需的空间 if width - 32 >= 108 hp_x = x + width - 108 flag = true elsif width - 32 >= 48 hp_x = x + width - 48 flag = false end # 描绘 HP nor = $battle_status_color[:norm] kno = $battle_status_color[:stat] cri = $battle_status_color[:nohm] self.contents.font.color = actor.hp == 0 ? kno : actor.hp <= actor.maxhp / 4 ? cri : nor self.contents.draw_text(hp_x,y,48,32,actor.hp.to_s,2) # 描绘 MaxHP if flag self.contents.font.color = nor self.contents.draw_text(hp_x + 48,y,12,32,"/",1) self.contents.draw_text(hp_x + 60,y,48,32,actor.maxhp.to_s) end end #-------------------------------------------------------------------------- # ● 新描画 SP #-------------------------------------------------------------------------- def draw_actor_sp2(actor,x,y,width = 144) # 描绘字符串 "SP" self.contents.font.color = $battle_status_color[:mp] self.contents.draw_text(x,y,32,32,$data_system.words.sp) # 计算描绘 MaxSP 所需的空间 if width - 32 >= 108 sp_x = x + width - 108 flag = true elsif width - 32 >= 48 sp_x = x + width - 48 flag = false end # 描绘 SP nor = $battle_status_color[:norm] kno = $battle_status_color[:stat] cri = $battle_status_color[:nohm] self.contents.font.color = actor.sp == 0 ? kno : actor.sp <= actor.maxsp / 4 ? cri : nor self.contents.draw_text(sp_x,y,48,32,actor.sp.to_s,2) # 描绘 MaxSP if flag self.contents.font.color = nor self.contents.draw_text(sp_x + 48,y,12,32,"/",1) self.contents.draw_text(sp_x + 60,y,48,32,actor.maxsp.to_s) end end end
TKIISRE@8`[RIV29]Q[TEMP.jpg (24.06 KB, 下载次数: 7)
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |