# ———————————————————————————————————— # 本脚本来自[url]http://rpg.blue/web/[/url],转载请保留此信息 # ———————————————————————————————————— #============================================================================== # ■ Game_Actor #------------------------------------------------------------------------------ # 处理角色的类。本类在 Game_Actors 类 ($game_actors) # 的内部使用、Game_Party 类请参考 ($game_party) 。 #============================================================================== class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # ● 取得战斗画面的 X 坐标 #-------------------------------------------------------------------------- def screen_x case self.index when 0 return 370 when 1 return 450 when 2 return 530 when 3 return 580 else return 600 end end #-------------------------------------------------------------------------- # ● 取得战斗画面的 Y 坐标 #-------------------------------------------------------------------------- def screen_y case self.index when 0 return 475 when 1 return 395 when 2 return 360 when 3 return 325 else return 1000 end end #-------------------------------------------------------------------------- # ● 取得战斗画面的 Z 坐标 #-------------------------------------------------------------------------- def screen_z case self.index when 0 return 10 when 1 return 9 when 2 return 8 when 3 return 7 else return 0 end end end #============================================================================== # ■ Window_Base #------------------------------------------------------------------------------ # 游戏中全部窗口的超级类。 #============================================================================== class Window_Base < Window #-------------------------------------------------------------------------- # ● 描绘 HP # actor : 角色 # x : 描画目标 X 坐标 # y : 描画目标 Y 坐标 # width : 描画目标的宽 #-------------------------------------------------------------------------- def draw_actor_hp1(actor, x, y, width = 72) # 描绘字符串 "HP" self.contents.font.color = system_color self.contents.draw_text(x, y, 24, 24, $data_system.words.hp) # 计算描绘 MaxHP 所需的空间 if width - 24 >= 32 hp_x = x + 32# + width - 24 end # 描绘 HP self.contents.font.color = actor.hp == 0 ? knockout_color : actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color self.contents.draw_text(hp_x, y, 32, 24, actor.hp.to_s, 2) end end #============================================================================== # ■ Window_BattleStatus #------------------------------------------------------------------------------ # 显示战斗画面同伴状态的窗口。 #============================================================================== class Window_BattleStatus < Window_Base #-------------------------------------------------------------------------- # ● 初始化对像 #-------------------------------------------------------------------------- #$data_system_level_up_me = "Audio/ME/升级音乐" def initialize super(0, 0, 640, 480) self.contents = Bitmap.new(width - 10, height - 32) self.opacity = 0 @level_up_flags = [false, false, false, false] refresh end #-------------------------------------------------------------------------- # ● 释放 #-------------------------------------------------------------------------- def dispose super end #-------------------------------------------------------------------------- # ● 设置升级标志 # actor_index : 角色索引 #-------------------------------------------------------------------------- def level_up(actor_index) @level_up_flags[actor_index] = true end #-------------------------------------------------------------------------- # ● 刷新 #-------------------------------------------------------------------------- def refresh self.contents.clear @item_max = $game_party.actors.size for i in 0...$game_party.actors.size actor = $game_party.actors[i] case i when 0 x = 310 y = 390 when 1 x = 390 y = 340 when 2 x = 480 y = 300 when 3 x = 550 y = 270 end if @level_up_flags[i] self.contents.font.color = normal_color self.contents.draw_text(x, y, 80, 24, "LEVEL UP!") Audio.me_stop # Audio.me_play($data_system_level_up_me) else draw_actor_hp1(actor, x-15, y-15, 80) end end end #-------------------------------------------------------------------------- # ● 刷新画面 #-------------------------------------------------------------------------- def update super # 主界面的不透明度下降 if $game_temp.battle_main_phase self.contents_opacity -= 50 if self.contents_opacity > 1 else self.contents_opacity += 50 if self.contents_opacity < 255 end end end #============================================================================== # ■ Window_BattleStatus #============================================================================== class Window_BattleStatus < Window_Base #-------------------------------------------------------------------------- # ● 初始化 #-------------------------------------------------------------------------- alias xrxs_bp2_refresh refresh def refresh xrxs_bp2_refresh @item_max = $game_party.actors.size for i in 0...$game_party.actors.size actor = $game_party.actors[i] case i when 0 x = 310 y = 390 when 1 x = 390 y = 340 when 2 x = 480 y = 300 when 3 x = 550 y = 270 end draw_actor_hp_meter(actor, x, y, 50) end end end #============================================================================== # ■ Window_Base #============================================================================== class Window_Base < Window #-------------------------------------------------------------------------- # ● HP描画 #-------------------------------------------------------------------------- def draw_actor_hp_meter(actor, x, y, width = 156, type = 0) if type == 1 and actor.hp == 0 return end self.contents.font.color = system_color self.contents.fill_rect(x-1, y+27, width+2,6, Color.new(150, 0, 0, 150)) w = width * actor.hp / actor.maxhp self.contents.fill_rect(x, y+28, w,1, Color.new(255, 96, 96, 255)) self.contents.fill_rect(x, y+29, w,1, Color.new(255, 0, 0, 255)) self.contents.fill_rect(x, y+30, w,1, Color.new(128, 0, 0, 255)) self.contents.fill_rect(x, y+31, w,1, Color.new(0, 0, 0, 255)) end end
#============================================================================== # Date 12-31-2005 # 重定义类:Window_Base, Window_Help #============================================================================== # 脚本功能: # 实现战斗中和菜单中用图标显示状态,代替原来的文字显示。 # 默认最多同时显示5个状态 #------------------------------------------------------------------------------ # 设置方法: # 一个状态对应的图标文件名为“状态的动画ID.png” # 例如某状态的动画ID为50,那么它的图标就是“Icons\50.png” # 如果找不到对应的文件,会报错 #============================================================================== # 注意,在ICON_STATE_IDS中写上需要带图标的状态ID # ICON_STATE_IDS是一个数组,数组的方法请参考帮助文件 # 例如: # 只要1,5,8号状态带图标,就这样:ICON_STATE_IDS = [1,5,8] # 要20到50号状态带图标:ICON_STATE_IDS = 20..50 ICON_STATE_IDS = [40..79] #============================================================================== # ■ Window_Base #------------------------------------------------------------------------------ # 游戏中全部窗口的超级类。 #============================================================================== class Window_Base < Window #-------------------------------------------------------------------------- # ● 描绘状态 # actor : 角色 # x : 描画目标 X 坐标 # y : 描画目标 Y 坐标 # width : 描画目标的宽 #-------------------------------------------------------------------------- def draw_actor_state(actor, x, y, width = 120) state_size = 0 for state in actor.states # 图标数量超出宽度就中断循环 if state_size >= width / 24 - 1 break end # 此状态不带图标就跳过 if !ICON_STATE_IDS.include?(state) next end bitmap = RPG::Cache.icon($data_states[state].name + ".png") if actor.states_turn[state] >= $data_states[state].hold_turn/2 opacity = 255 else opacity = 100 end # 这里的图标大小默认是24x24,要改就改下面那个Rect.new(0, 0, 24, 24) self.contents.blt(x + 24 * state_size ,y ,bitmap, Rect.new(0, 0, 24, 24), opacity) state_size += 1 end end end #============================================================================== # ■ Window_Help #------------------------------------------------------------------------------ # 特技及物品的说明、角色的状态显示的窗口。 #============================================================================== class Window_Help < Window_Base #-------------------------------------------------------------------------- # ● 设置敌人 # enemy : 要显示名字和状态的敌人 #-------------------------------------------------------------------------- def set_enemy(enemy) # 描绘状态图标 state_size = 0 for state in enemy.states # 图标数量超出宽度就中断循环 if state_size >= width / 16 break end # 此状态不带图标就跳过 if !ICON_STATE_IDS.include?(state) next end bitmap = RPG::Cache.icon($data_states[state].name + "_sta.png") if enemy.states_turn[state] >= $data_states[state].hold_turn/2 opacity = 255 else opacity = 100 end self.contents.blt(70 + 16 * state_size, 0, bitmap, Rect.new(0, 0, 24, 24), opacity) state_size += 1 end # 描绘敌人名字 set_text(enemy.name, 1) end end class Game_Battler attr_reader :states_turn # 声明状态剩余回合 end
203.92 KB, 下载次数: 30
就这个
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |