赞 | 1 |
VIP | 0 |
好人卡 | 2 |
积分 | 1 |
经验 | 12813 |
最后登录 | 2019-12-2 |
在线时间 | 219 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 129
- 在线时间
- 219 小时
- 注册时间
- 2011-1-19
- 帖子
- 108
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 xingxing991219 于 2015-8-4 14:21 编辑
嗯……第一次正儿八经地写一个脚本,第一次在发布区发布我的作品,心情还是很激动很忐忑的{:2_285:}
其实说这是我写的吧,也不完全算是,基本上还是用默认脚本改的,另外Window_Base类中几个新方法的定义也是引用了其他大神的脚本里的内容。总共改动了9个类,Game一个,Window4个,Scene4个,主要是对Scene_Menu类和Window_MenuStatus类的改写。可能在高手看来,真的好蠢好蠢……不过看在我是第一次的份上,就宽容一下嘛{:2_251:} 希望可以给我提出一些宝贵意见,不论是脚本结构方面、算法方面和效果方面,都可以尽情地提出来,如果发现什么bug,也希望可以第一时间告诉我~
下面放出效果截图、代码内容和范例工程(范例工程里什么也没做,只是放了几张头像图而已。。头像图来自66rpg整合素材包,不会告我侵权吧= =)
另外,注释里写的by 飞云,飞云就是我啦…………只不过当时注册论坛号的时候不知道可以打中文,只好用xingxing991219,现在知道了也没法改= =很郁闷的说,其实飞云才是我的真正艺名~_~
好吧,就扯这么多。
#============================================================== # 菜单界面大调整脚本 by 飞云 #============================================================== # 本脚本大幅度调整了Esc菜单界面的结构,窗口为半透明状态,各文字内容 # 可在下方修改,具体对应关系可在游戏测试中查看。 # # 本脚本兼容性较差,重新定义了Scene_Menu脚本的大部分方法,如果您 # 使用了其他修改菜单界面的脚本,请慎重使用本脚本,如有冲突,请自 # 行整合。 # # 使用方法:将全部内容插入到Main上方,并在Graphics目录下新建一个 # Heads文件夹,将头像文件放入,格式为Actorx.png(注:x为该角色在数 # 据库内的编号,1、2、3、4……11、12、13…… 比如一号角色的头像文件名 # 为Actor001,二十号角色的头像文件名为Actor020,128号角色的头像文 # 件名为Actor128,如果序号超过999,请自行修改脚本= =) # # 转载和使用请保留本信息,谢谢合作! # # (已知本脚本不与柳柳大人的技能分类脚本、小翼的值槽脚本冲突,其他 # 脚本一概请大家自行测试,带来的不便请谅解~) # 菜单栏选项文字 ITEM = "查看背包" SKILL = "功夫武学" EQUIP = "更换装备" STATUS = "角色状态" SAVE = "保存记录" EXIT = "离开游戏" # 金钱窗口的标题 GOLD = "银两" # 等级的前缀,如Lv Lv. Level等 LEVEL = "等级" class Game_Actor #-------------------------------------------------------------------------- # ★ 2个 EXP 字符串函数 by 小翼 [FDU]alwing #-------------------------------------------------------------------------- def now_exp return @exp - @exp_list[@level] end def next_exp return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0 end end class Window_Base < Window #-------------------------------------------------------------------------- # ★ 获取文字色 by 小翼 [FDU]alwing WOW # n : 颜色编号 #-------------------------------------------------------------------------- def rec_color(n) case n # 蓝色 when 0 return Color.new(0, 16, 65, 255) when 1 return Color.new(0, 40, 160, 255) when 2 return Color.new(0, 54, 215, 255) when 3 return Color.new(0, 49, 195, 255) when 4 return Color.new(0, 41, 165, 255) when 5 return Color.new(0, 35, 140, 255) when 6 return Color.new(0, 26, 105, 255) when 7 return Color.new(0, 10, 40, 255) # 橙色 when 10 return Color.new(65, 32, 0, 255) when 11 return Color.new(160, 80, 0, 255) when 12 return Color.new(215, 107, 0, 255) when 13 return Color.new(195, 97, 0, 255) when 14 return Color.new(165, 82, 0, 255) when 15 return Color.new(140, 70, 0, 255) when 16 return Color.new(105, 52, 0, 255) when 17 return Color.new(40, 20, 0, 255) # 青色 when 20 return Color.new(0, 65, 65, 255) when 21 return Color.new(0, 160, 160, 255) when 22 return Color.new(0, 215, 215, 255) when 23 return Color.new(0, 195, 195, 255) when 24 return Color.new(0, 165, 165, 255) when 25 return Color.new(0, 140, 140, 255) when 26 return Color.new(0, 105, 105, 255) when 27 return Color.new(0, 40, 40, 255) # 紫红 when 30 return Color.new(65, 0, 32, 255) when 31 return Color.new(160, 0, 80, 255) when 32 return Color.new(215, 0, 107, 255) when 33 return Color.new(195, 0, 97, 255) when 34 return Color.new(165, 0, 82, 255) when 35 return Color.new(140, 0, 70, 255) when 36 return Color.new(105, 0, 52, 255) when 37 return Color.new(40, 0, 20, 255) end end #-------------------------------------------------------------------------- # ● 职业的描绘 # actor : 角色 # x : 描画目标 X 坐标 # y : 描画目标 Y 坐标 #-------------------------------------------------------------------------- def draw_actor_class(actor, x, y) self.contents.font.color = normal_color self.contents.draw_text(x, y, 236, 32, "[" + actor.class_name + "]") end #-------------------------------------------------------------------------- # ● 描画 EXP ★主菜单 # actor : 角色 # x : 描画目标 X 坐标 # y : 描画目标 Y 坐标 #-------------------------------------------------------------------------- def draw_actor_exp(actor, x, y) self.contents.font.size = 20 self.contents.font.color = system_color self.contents.draw_text(x+1, y, 80, 32, "EXP") self.contents.font.color = normal_color self.contents.draw_text(x - 10 , y, 84, 32, actor.exp_s, 2) self.contents.draw_text(x + 74, y, 12, 32, "/", 1) self.contents.draw_text(x + 88, y, 84, 32, actor.next_exp_s) end #-------------------------------------------------------------------------- # ● 描画 EXP ★状态窗口 # actor : 角色 # x : 描画目标 X 坐标 # y : 描画目标 Y 坐标 #-------------------------------------------------------------------------- def draw_actor_exp_status(actor, x, y) self.contents.font.size = 20 self.contents.font.color = system_color self.contents.draw_text(x+1, y, 80, 32, "EXP") self.contents.font.color = normal_color self.contents.draw_text(x + 108, y, 84, 32, actor.exp_s, 2) self.contents.draw_text(x + 192, y, 12, 32, "/", 1) self.contents.draw_text(x + 204, y, 84, 32, actor.next_exp_s) end #-------------------------------------------------------------------------- # ★ 描绘 EXP 矩形 by 小翼 [FDU]alwing # actor : 角色 # x : 描画目标 X 坐标 # y : 描画目标 Y 坐标 # width : 描画目标的宽 #-------------------------------------------------------------------------- def EXP(actor,x,y,width = 128) self.contents.fill_rect(x+26, y+60, width+4,9, Color.new(0,0,0,255)) self.contents.fill_rect(x+27, y+61, width+2,7, Color.new(255,255,255,255)) self.contents.fill_rect(x+28, y+62, width,5, Color.new(0,0,0,255)) if actor.next_exp > 0 @EXPw = width * actor.now_exp/actor.next_exp self.contents.fill_rect(x+28, y+62, @EXPw,1, Color.new(100,50,150,255)) self.contents.fill_rect(x+28, y+63, @EXPw,1, Color.new(150,100,200,255)) self.contents.fill_rect(x+28, y+64, @EXPw,1, Color.new(200,150,255,255)) self.contents.fill_rect(x+28, y+65, @EXPw,1, Color.new(150,100,200,255)) self.contents.fill_rect(x+28, y+66, @EXPw,1, Color.new(100,50,150,255)) else self.contents.fill_rect(x+28, y+62, width,1, Color.new(50,150,150,255)) self.contents.fill_rect(x+28, y+63, width,1, Color.new(100,200,200,255)) self.contents.fill_rect(x+28, y+64, width,1, Color.new(150,255,255,255)) self.contents.fill_rect(x+28, y+65, width,1, Color.new(100,200,200,255)) self.contents.fill_rect(x+28, y+66, width,1, Color.new(50,150,150,255)) end end #-------------------------------------------------------------------------- # ● 描绘 HP # actor : 角色 # x : 描画目标 X 坐标 # y : 描画目标 Y 坐标 # width : 描画目标的宽 #-------------------------------------------------------------------------- def draw_actor_hp(actor, x, y, width = 144) # 描绘字符串 "HP" self.contents.font.color = system_color self.contents.font.size = 20 self.contents.draw_text(x+16, y, 32, 32, "体") # 计算描绘 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 if flag 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, 48, 32, actor.hp.to_s, 2) else self.contents.font.color = actor.hp == 0 ? knockout_color : actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color self.contents.draw_text(hp_x-36, y, 48, 32, actor.hp.to_s, 0) end # 描绘 MaxHP if flag self.contents.font.color = normal_color 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) else self.contents.font.color = normal_color self.contents.draw_text(hp_x, y, 12, 32, "/", 1) self.contents.draw_text(hp_x + 12, y, 48, 32, actor.maxhp.to_s) end end #-------------------------------------------------------------------------- # ● 描绘 SP # actor : 角色 # x : 描画目标 X 坐标 # y : 描画目标 Y 坐标 # width : 描画目标的宽 #-------------------------------------------------------------------------- def draw_actor_sp(actor, x, y, width = 144) # 描绘字符串 "SP" self.contents.font.color = system_color self.contents.draw_text(x+16, y, 32, 32, "气") # 计算描绘 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 if flag self.contents.font.color = actor.sp == 0 ? knockout_color : actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color self.contents.draw_text(sp_x, y, 48, 32, actor.sp.to_s, 2) else self.contents.font.color = actor.sp == 0 ? knockout_color : actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color self.contents.draw_text(sp_x-36, y, 48, 32, actor.sp.to_s, 0) end # 描绘 MaxSP if flag self.contents.font.color = normal_color 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) else self.contents.font.color = normal_color self.contents.draw_text(sp_x, y, 12, 32, "/", 1) self.contents.draw_text(sp_x + 12, y, 48, 32, actor.maxsp.to_s) end end #-------------------------------------------------------------------------- # ● 描绘能力值 # actor : 角色 # x : 描画目标 X 坐标 # y : 描画目标 Y 坐标 # type : 能力值种类 (0~6) #-------------------------------------------------------------------------- def draw_actor_parameter(actor, x, y, type) case type when 0 parameter_name = $data_system.words.atk parameter_value = actor.atk when 1 parameter_name = $data_system.words.pdef parameter_value = actor.pdef when 2 parameter_name = $data_system.words.mdef parameter_value = actor.mdef when 3 parameter_name = $data_system.words.str parameter_value = actor.str when 4 parameter_name = $data_system.words.dex parameter_value = actor.dex when 5 parameter_name = $data_system.words.agi parameter_value = actor.agi when 6 parameter_name = $data_system.words.int parameter_value = actor.int end self.contents.font.color = system_color self.contents.draw_text(x, y, 120, 32, parameter_name) self.contents.font.color = normal_color self.contents.draw_text(x + 160, y, 36, 32, parameter_value.to_s, 2) end #-------------------------------------------------------------------------- # ● 描绘能力值 ★装备窗口 # actor : 角色 # x : 描画目标 X 坐标 # y : 描画目标 Y 坐标 # type : 能力值种类 (0~6) #-------------------------------------------------------------------------- def draw_actor_parameter_equip(actor, x, y, type) case type when 0 parameter_name = $data_system.words.atk parameter_value = actor.atk when 1 parameter_name = $data_system.words.pdef parameter_value = actor.pdef when 2 parameter_name = $data_system.words.mdef parameter_value = actor.mdef when 3 parameter_name = $data_system.words.str parameter_value = actor.str when 4 parameter_name = $data_system.words.dex parameter_value = actor.dex when 5 parameter_name = $data_system.words.agi parameter_value = actor.agi when 6 parameter_name = $data_system.words.int parameter_value = actor.int end self.contents.font.color = system_color self.contents.draw_text(x, y, 120, 32, parameter_name) self.contents.font.color = normal_color self.contents.draw_text(x + 196, y, 36, 32, parameter_value.to_s, 2) end #-------------------------------------------------------------------------- # ● 描绘物品名 # item : 物品 # x : 描画目标 X 坐标 # y : 描画目标 Y 坐标 #-------------------------------------------------------------------------- def draw_item_name(item, x, y) if item == nil return end bitmap = RPG::Cache.icon(item.icon_name) self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24)) self.contents.font.color = normal_color self.contents.draw_text(x + 28, y, 212, 32, item.name) end #-------------------------------------------------------------------------- # ● 等级的描绘 # actor : 角色 # x : 描画目标 X 坐标 # y : 描画目标 Y 坐标 #-------------------------------------------------------------------------- def draw_actor_level(actor, x, y) self.contents.font.color = system_color self.contents.draw_text(x, y, 64, 32, LEVEL) self.contents.font.color = normal_color self.contents.draw_text(x + 32, y, 24, 32, actor.level.to_s, 2) end #-------------------------------------------------------------------------- # ★ 描绘 HP 矩形 by 小翼 [FDU]alwing # actor : 角色 # x : 描画目标 X 坐标 # y : 描画目标 Y 坐标 # width : 描画目标的宽 #-------------------------------------------------------------------------- # HP定义 def HP(actor,x,y,width=96) #底色定义 self.contents.fill_rect(x+26, y+13, width+4,12, Color.new(0,0,0,255)) self.contents.fill_rect(x+27, y+14, width+2,10, Color.new(255,255,255,255)) self.contents.fill_rect(x+28, y+15, width,8, Color.new(0,0,0,255)) #HP宽度定义 @HPw = width * actor.hp/actor.maxhp #中 if actor.hp > actor.maxhp/2 @HPcg0 = 65 @HPcg1 = 160 @HPcg2 = 215 @HPcg3 = 195 @HPcg4 = 165 @HPcg5 = 140 @HPcg6 = 105 @HPcg7 = 40 @HPcr0 = 65 * (actor.maxhp - actor.hp)/(actor.maxhp/2) @HPcr1 = 160 * (actor.maxhp - actor.hp)/(actor.maxhp/2) @HPcr2 = 215 * (actor.maxhp - actor.hp)/(actor.maxhp/2) @HPcr3 = 195 * (actor.maxhp - actor.hp)/(actor.maxhp/2) @HPcr4 = 165 * (actor.maxhp - actor.hp)/(actor.maxhp/2) @HPcr5 = 140 * (actor.maxhp - actor.hp)/(actor.maxhp/2) @HPcr6 = 105 * (actor.maxhp - actor.hp)/(actor.maxhp/2) @HPcr7 = 40 * (actor.maxhp - actor.hp)/(actor.maxhp/2) else @HPcr0 = 65 @HPcr1 = 160 @HPcr2 = 215 @HPcr3 = 195 @HPcr4 = 165 @HPcr5 = 140 @HPcr6 = 105 @HPcr7 = 40 @HPcg0 = 65 * actor.hp/(actor.maxhp/2) @HPcg1 = 160 * actor.hp/(actor.maxhp/2) @HPcg2 = 215 * actor.hp/(actor.maxhp/2) @HPcg3 = 195 * actor.hp/(actor.maxhp/2) @HPcg4 = 165 * actor.hp/(actor.maxhp/2) @HPcg5 = 140 * actor.hp/(actor.maxhp/2) @HPcg6 = 105 * actor.hp/(actor.maxhp/2) @HPcg7 = 40 * actor.hp/(actor.maxhp/2) end #HP条定义 self.contents.fill_rect(x+28, y+15, @HPw,1, Color.new(@HPcr0,@HPcg0,0,255)) self.contents.fill_rect(x+28, y+16, @HPw,1, Color.new(@HPcr1,@HPcg1,0,255)) self.contents.fill_rect(x+28, y+17, @HPw,1, Color.new(@HPcr2,@HPcg2,0,255)) self.contents.fill_rect(x+28, y+18, @HPw,1, Color.new(@HPcr3,@HPcg3,0,255)) self.contents.fill_rect(x+28, y+19, @HPw,1, Color.new(@HPcr4,@HPcg4,0,255)) self.contents.fill_rect(x+28, y+20, @HPw,1, Color.new(@HPcr5,@HPcg5,0,255)) self.contents.fill_rect(x+28, y+21, @HPw,1, Color.new(@HPcr6,@HPcg6,0,255)) self.contents.fill_rect(x+28, y+22, @HPw,1, Color.new(@HPcr7,@HPcg7,0,255)) end #-------------------------------------------------------------------------- # ★ 描绘 SP 矩形 by 小翼 [FDU]alwing # actor : 角色 # x : 描画目标 X 坐标 # y : 描画目标 Y 坐标 # width : 描画目标的宽 #-------------------------------------------------------------------------- def MP(actor,x,y,width=96) self.contents.fill_rect(x+26, y+45, width+4,12, Color.new(0,0,0,255)) self.contents.fill_rect(x+27, y+46, width+2,10, Color.new(255,255,255,255)) self.contents.fill_rect(x+28, y+47, width,8, Color.new(0,0,0,255)) @MPw = width * actor.sp/actor.maxsp self.contents.fill_rect(x+28, y+47, @MPw,1, rec_color(0)) self.contents.fill_rect(x+28, y+48, @MPw,1, rec_color(1)) self.contents.fill_rect(x+28, y+49, @MPw,1, rec_color(2)) self.contents.fill_rect(x+28, y+50, @MPw,1, rec_color(3)) self.contents.fill_rect(x+28, y+51, @MPw,1, rec_color(4)) self.contents.fill_rect(x+28, y+52, @MPw,1, rec_color(5)) self.contents.fill_rect(x+28, y+53, @MPw,1, rec_color(6)) self.contents.fill_rect(x+28, y+54, @MPw,1, rec_color(7)) end end class Window_Gold < Window_Base #-------------------------------------------------------------------------- # ● 初始化对像 #-------------------------------------------------------------------------- def initialize super(0, 0, 160, 96) self.contents = Bitmap.new(width - 32, height - 32) refresh end #-------------------------------------------------------------------------- # ● 刷新 #-------------------------------------------------------------------------- def refresh self.contents.clear self.contents.font.color = system_color self.contents.draw_text(4, 0, 120, 32, GOLD) self.contents.font.color = normal_color self.contents.draw_text(4, 32, 120, 32, $game_party.gold.to_s) self.contents.font.color = system_color self.contents.draw_text(4, 32, 120, 32, $data_system.words.gold, 2) end end class Window_MenuList < Window_Selectable #-------------------------------------------------------------------------- # ● 初始化对像 # width : 窗口的宽 # commands : 命令字符串序列 #-------------------------------------------------------------------------- def initialize(width, commands) # 由命令的个数计算出窗口的高 super(0, 0, 480, 96) @item_max = commands.size @commands = [ITEM, SKILL, EQUIP, STATUS, SAVE, EXIT] self.contents = Bitmap.new(width - 32, 64) refresh self.index = 0 @column_max = 3 end #-------------------------------------------------------------------------- # ● 刷新 #-------------------------------------------------------------------------- def refresh self.contents.clear for i in 0...@item_max draw_item(i, normal_color) end end #-------------------------------------------------------------------------- # ● 描绘项目 # index : 项目编号 # color : 文字色 #-------------------------------------------------------------------------- def draw_item(index, color) self.contents.font.color = color if index >= 0 && index <= 2 rect = Rect.new(160 * index + 4, 0, self.contents.width - 8, 32) elsif index >= 3 && index <= 5 rect = Rect.new(160 * (index - 3) + 4, 32, self.contents.width - 8, 32) end self.contents.fill_rect(rect, Color.new(0, 0, 0, 0)) self.contents.draw_text(rect, @commands[index]) end #-------------------------------------------------------------------------- # ● 项目无效化 # index : 项目编号 #-------------------------------------------------------------------------- def disable_item(index) draw_item(index, disabled_color) end end class Window_MenuStatus < Window_Selectable #-------------------------------------------------------------------------- # ● 初始化目标 #actor_id: 角色编号 (0号为第一个角色,依此类推) #-------------------------------------------------------------------------- def initialize(actor_id) super(0, 0, 160, 384) @actor_id = actor_id self.contents = Bitmap.new(width - 32, height - 32) refresh self.active = false self.index = -1 end #-------------------------------------------------------------------------- # ● 刷新 #-------------------------------------------------------------------------- def refresh self.contents.clear @item_max = 1 actor = $game_party.actors[@actor_id] #------------------------------------------------------------------------ # ★ 头像调用 #------------------------------------------------------------------------ if actor.id < 10 testname = "Actor00"+actor.id.to_s elsif actor.id >= 10 && actor.id < 100 testname = "Actor0"+ actor.id.to_s elsif actor.id >= 100 && actor.id <= 999 testname = "Actor" + actor.id.to_s end bitmap = Bitmap.new("Graphics/Heads/#{testname}") src_rect = Rect.new(0, 0, bitmap.width, bitmap.height) self.contents.blt(14, y + 10, bitmap, src_rect) draw_actor_name(actor, 22, 115) HP(actor, 0, 200) MP(actor, 0, 214) draw_actor_hp(actor, 0, 180) draw_actor_sp(actor, 0, 227) EXP(actor, 0, 238, 96) draw_actor_exp(actor, 10, 270) draw_actor_level(actor, 36, 315) #$game_party.actors.size #for i in 0...$game_party.actors.size #x = 64 #y = 116 #actor = $game_party.actors[@actor_id] #draw_actor_graphic(actor, x - 40, y + 80) #draw_actor_name(actor, x, y) draw_actor_class(actor, 22,115 + 32)#x + 144, y) #draw_actor_level(actor, x, y + 32) #draw_actor_state(actor, 22, 180)#x + 90, y + 32) #draw_actor_exp(actor, x, y + 64) #draw_actor_hp(actor, x + 236, y + 32) #draw_actor_sp(actor, x + 236, y + 64) #end end #-------------------------------------------------------------------------- # ● 刷新光标矩形 #-------------------------------------------------------------------------- def update_cursor_rect if @index < 0 self.cursor_rect.empty else self.cursor_rect.set(0, @index * 116, self.width - 32, self.height - 32) end end end class Scene_Menu #-------------------------------------------------------------------------- # ● 主处理 #-------------------------------------------------------------------------- def main @status_index = 0 @spriteset = Spriteset_Map.new # 生成命令窗口 s1 = ITEM s2 = SKILL s3 = EQUIP s4 = STATUS s5 = SAVE s6 = EXIT @command_window = Window_MenuList.new(480, [s1, s2, s3, s4, s5, s6]) @command_window.index = @menu_index @command_window.opacity = 160 #@command_window.height = 196 # 同伴人数为 0 的情况下 if $game_party.actors.size == 0 # 物品、特技、装备、状态无效化 @command_window.disable_item(0) @command_window.disable_item(1) @command_window.disable_item(2) @command_window.disable_item(3) end # 禁止存档的情况下 if $game_system.save_disabled # 存档无效 @command_window.disable_item(4) end # 生成金钱窗口 @gold_window = Window_Gold.new @gold_window.x = 480 @gold_window.y = 0 @gold_window.opacity = 160 # 生成状态窗口 @status_window = [] for i in 0...$game_party.actors.size @status_window[i] = Window_MenuStatus.new(i) @status_window[i].x = 160 * i @status_window[i].y = 96 @status_window[i].opacity = 160 end # 执行过渡 Graphics.transition # 主循环 loop do # 刷新游戏画面 Graphics.update # 刷新输入信息 Input.update # 刷新画面 update # 如果切换画面就中断循环 if $scene != self break end end # 准备过渡 Graphics.freeze # 释放窗口 @command_window.dispose @gold_window.dispose for i in 0...$game_party.actors.size @status_window[i].dispose end end #-------------------------------------------------------------------------- # ● 刷新画面 #-------------------------------------------------------------------------- def update # 刷新窗口 @command_window.update @gold_window.update #@status_window.update for i in 0...$game_party.actors.size @status_window[i].update end if $cancel @command_window.active = false @status_window[$index].active = true @status_window[$index].index = 0 @status_index = $index $cancel = false end # 命令窗口被激活的情况下: 调用 update_command if @command_window.active update_command return end # 状态窗口被激活的情况下: 调用 update_status if @status_window[@status_index]#@status_window[0].active || @status_window[1].active || @status_window[2].active || @status_window[3].active update_status return end end #-------------------------------------------------------------------------- # ● 刷新画面 (命令窗口被激活的情况下) #-------------------------------------------------------------------------- def update_command # 按下 B 键的情况下 if Input.trigger?(Input::B) # 演奏取消 SE $game_system.se_play($data_system.cancel_se) # 切换的地图画面 $scene = Scene_Map.new return end # 按下 C 键的情况下 if Input.trigger?(Input::C) # 同伴人数为 0、存档、游戏结束以外的场合 if $game_party.actors.size == 0 and @command_window.index < 4 # 演奏冻结 SE $game_system.se_play($data_system.buzzer_se) return end # 命令窗口的光标位置分支 case @command_window.index when 0 # 物品 # 演奏确定 SE $game_system.se_play($data_system.decision_se) # 切换到物品画面 $scene = Scene_Item.new when 1 # 特技 # 演奏确定 SE $game_system.se_play($data_system.decision_se) # 激活状态窗口 @command_window.active = false @status_window[0].active = true @status_window[0].index = 0 when 2 # 装备 # 演奏确定 SE $game_system.se_play($data_system.decision_se) # 激活状态窗口 @command_window.active = false @status_window[0].active = true @status_window[0].index = 0 when 3 # 状态 # 演奏确定 SE $game_system.se_play($data_system.decision_se) # 激活状态窗口 @command_window.active = false @status_window[0].active = true @status_window[0].index = 0 when 4 # 存档 # 禁止存档的情况下 if $game_system.save_disabled # 演奏冻结 SE $game_system.se_play($data_system.buzzer_se) return end # 演奏确定 SE $game_system.se_play($data_system.decision_se) # 切换到存档画面 $scene = Scene_Save.new when 5 # 游戏结束 # 演奏确定 SE $game_system.se_play($data_system.decision_se) # 切换到游戏结束画面 $scene = Scene_End.new end return end end #-------------------------------------------------------------------------- # ● 刷新画面 (状态窗口被激活的情况下) #-------------------------------------------------------------------------- def update_status #p @status_index #for i in 0..3 # p @status_window[i].active #end for i in 0...$game_party.actors.size @status_window[i].update end if Input.trigger?(Input::LEFT) $game_system.se_play($data_system.cursor_se) if @status_index == 0 @status_index = $game_party.actors.size - 1 else @status_index -= 1 end end if Input.trigger?(Input::RIGHT) $game_system.se_play($data_system.cursor_se) if @status_index == $game_party.actors.size - 1 @status_index = 0 else @status_index += 1 end end case @status_index when 0 @status_window[0].active = true @status_window[0].index = 0 if $game_party.actors.size >= 2 @status_window[1].active = false @status_window[1].index = -1 if $game_party.actors.size >= 3 @status_window[2].active = false @status_window[2].index = -1 if $game_party.actors.size >= 4 @status_window[3].active = false @status_window[3].index = -1 end end end when 1 @status_window[0].active = false @status_window[0].index = -1 if $game_party.actors.size >= 2 @status_window[1].active = true @status_window[1].index = 0 if $game_party.actors.size >= 3 @status_window[2].active = false @status_window[2].index = -1 if $game_party.actors.size >= 4 @status_window[3].active = false @status_window[3].index = -1 end end end when 2 @status_window[0].active = false @status_window[0].index = -1 if $game_party.actors.size >= 2 @status_window[1].active = false @status_window[1].index = -1 if $game_party.actors.size >= 3 @status_window[2].active = true @status_window[2].index = 0 if $game_party.actors.size >= 4 @status_window[3].active = false @status_window[3].index = -1 end end end @status_window[0].active = false @status_window[0].index = -1 @status_window[1].active = false @status_window[1].index = -1 @status_window[2].active = true @status_window[2].index = 0 @status_window[3].active = false @status_window[3].index = -1 when 3 @status_window[0].active = false @status_window[0].index = -1 if $game_party.actors.size >= 2 @status_window[1].active = false @status_window[1].index = -1 if $game_party.actors.size >= 3 @status_window[2].active = false @status_window[2].index = -1 if $game_party.actors.size >= 4 @status_window[3].active = true @status_window[3].index = 0 end end end end # 按下 B 键的情况下 if Input.trigger?(Input::B) # 演奏取消 SE $game_system.se_play($data_system.cancel_se) # 激活命令窗口 @command_window.active = true @status_window[@status_index].active = false @status_window[@status_index].index = -1 @status_index = 0 return end # 按下 C 键的情况下 if Input.trigger?(Input::C) # 命令窗口的光标位置分支 case @command_window.index when 1 # 特技 # 本角色的行动限制在 2 以上的情况下 if $game_party.actors[@status_index].restriction >= 2 # 演奏冻结 SE $game_system.se_play($data_system.buzzer_se) return end # 演奏确定 SE $game_system.se_play($data_system.decision_se) # 切换到特技画面 $scene = Scene_Skill.new(@status_index)#window.index) when 2 # 装备 # 演奏确定 SE $game_system.se_play($data_system.decision_se) # 切换的装备画面 $scene = Scene_Equip.new(@status_index)#@status_window.index) when 3 # 状态 # 演奏确定 SE $game_system.se_play($data_system.decision_se) # 切换到状态画面 $scene = Scene_Status.new(@status_index)#@status_window.index) end return end end end class Scene_Skill def update_skill # 按下 B 键的情况下 $cancel = true $index = @actor_index if Input.trigger?(Input::B) # 演奏取消 SE $game_system.se_play($data_system.cancel_se) # 切换到菜单画面 $scene = Scene_Menu.new(1) return end # 按下 C 键的情况下 if Input.trigger?(Input::C) # 获取特技窗口现在选择的特技的数据 @skill = @skill_window.skill # 不能使用的情况下 if @skill == nil or not @actor.skill_can_use?(@skill.id) # 演奏冻结 SE $game_system.se_play($data_system.buzzer_se) return end # 演奏确定 SE $game_system.se_play($data_system.decision_se) # 效果范围是我方的情况下 if @skill.scope >= 3 # 激活目标窗口 @skill_window.active = false @target_window.x = (@skill_window.index + 1) % 2 * 304 @target_window.visible = true @target_window.active = true # 设置效果范围 (单体/全体) 的对应光标位置 if @skill.scope == 4 || @skill.scope == 6 @target_window.index = -1 elsif @skill.scope == 7 @target_window.index = @actor_index - 10 else @target_window.index = 0 end # 效果在我方以外的情况下 else # 公共事件 ID 有效的情况下 if @skill.common_event_id > 0 # 预约调用公共事件 $game_temp.common_event_id = @skill.common_event_id # 演奏特技使用时的 SE $game_system.se_play(@skill.menu_se) # 消耗 SP @actor.sp -= @skill.sp_cost # 再生成各窗口的内容 @status_window.refresh @skill_window.refresh @target_window.refresh # 切换到地图画面 $scene = Scene_Map.new return end end return end # 按下 R 键的情况下 if Input.trigger?(Input::R) # 演奏光标 SE $game_system.se_play($data_system.cursor_se) # 移至下一位角色 @actor_index += 1 @actor_index %= $game_party.actors.size # 切换到别的特技画面 $scene = Scene_Skill.new(@actor_index) return end # 按下 L 键的情况下 if Input.trigger?(Input::L) # 演奏光标 SE $game_system.se_play($data_system.cursor_se) # 移至上一位角色 @actor_index += $game_party.actors.size - 1 @actor_index %= $game_party.actors.size # 切换到别的特技画面 $scene = Scene_Skill.new(@actor_index) return end end end class Scene_Equip def update_right # 按下 B 键的情况下 if Input.trigger?(Input::B) $cancel = true $index = @actor_index # 演奏取消 SE $game_system.se_play($data_system.cancel_se) # 切换到菜单画面 $scene = Scene_Menu.new(2) return end # 按下 C 键的情况下 if Input.trigger?(Input::C) # 固定装备的情况下 if @actor.equip_fix?(@right_window.index) # 演奏冻结 SE $game_system.se_play($data_system.buzzer_se) return end # 演奏确定 SE $game_system.se_play($data_system.decision_se) # 激活物品窗口 @right_window.active = false @item_window.active = true @item_window.index = 0 return end # 按下 R 键的情况下 if Input.trigger?(Input::R) # 演奏光标 SE $game_system.se_play($data_system.cursor_se) # 移至下一位角色 @actor_index += 1 @actor_index %= $game_party.actors.size # 切换到别的装备画面 $scene = Scene_Equip.new(@actor_index, @right_window.index) return end # 按下 L 键的情况下 if Input.trigger?(Input::L) # 演奏光标 SE $game_system.se_play($data_system.cursor_se) # 移至上一位角色 @actor_index += $game_party.actors.size - 1 @actor_index %= $game_party.actors.size # 切换到别的装备画面 $scene = Scene_Equip.new(@actor_index, @right_window.index) return end end end class Scene_Status def update # 按下 B 键的情况下 if Input.trigger?(Input::B) $cancel = true $index = @actor_index # 演奏取消 SE $game_system.se_play($data_system.cancel_se) # 切换到菜单画面 $scene = Scene_Menu.new(3) return end # 按下 R 键的情况下 if Input.trigger?(Input::R) # 演奏光标 SE $game_system.se_play($data_system.cursor_se) # 移至下一位角色 @actor_index += 1 @actor_index %= $game_party.actors.size # 切换到别的状态画面 $scene = Scene_Status.new(@actor_index) return end # 按下 L 键的情况下 if Input.trigger?(Input::L) # 演奏光标 SE $game_system.se_play($data_system.cursor_se) # 移至上一位角色 @actor_index += $game_party.actors.size - 1 @actor_index %= $game_party.actors.size # 切换到别的状态画面 $scene = Scene_Status.new(@actor_index) return end end end
#==============================================================
# 菜单界面大调整脚本 by 飞云
#==============================================================
# 本脚本大幅度调整了Esc菜单界面的结构,窗口为半透明状态,各文字内容
# 可在下方修改,具体对应关系可在游戏测试中查看。
#
# 本脚本兼容性较差,重新定义了Scene_Menu脚本的大部分方法,如果您
# 使用了其他修改菜单界面的脚本,请慎重使用本脚本,如有冲突,请自
# 行整合。
#
# 使用方法:将全部内容插入到Main上方,并在Graphics目录下新建一个
# Heads文件夹,将头像文件放入,格式为Actorx.png(注:x为该角色在数
# 据库内的编号,1、2、3、4……11、12、13…… 比如一号角色的头像文件名
# 为Actor001,二十号角色的头像文件名为Actor020,128号角色的头像文
# 件名为Actor128,如果序号超过999,请自行修改脚本= =)
#
# 转载和使用请保留本信息,谢谢合作!
#
# (已知本脚本不与柳柳大人的技能分类脚本、小翼的值槽脚本冲突,其他
# 脚本一概请大家自行测试,带来的不便请谅解~)
# 菜单栏选项文字
ITEM = "查看背包"
SKILL = "功夫武学"
EQUIP = "更换装备"
STATUS = "角色状态"
SAVE = "保存记录"
EXIT = "离开游戏"
# 金钱窗口的标题
GOLD = "银两"
# 等级的前缀,如Lv Lv. Level等
LEVEL = "等级"
class Game_Actor
#--------------------------------------------------------------------------
# ★ 2个 EXP 字符串函数 by 小翼 [FDU]alwing
#--------------------------------------------------------------------------
def now_exp
return @exp - @exp_list[@level]
end
def next_exp
return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
end
end
class Window_Base < Window
#--------------------------------------------------------------------------
# ★ 获取文字色 by 小翼 [FDU]alwing WOW
# n : 颜色编号
#--------------------------------------------------------------------------
def rec_color(n)
case n
# 蓝色
when 0
return Color.new(0, 16, 65, 255)
when 1
return Color.new(0, 40, 160, 255)
when 2
return Color.new(0, 54, 215, 255)
when 3
return Color.new(0, 49, 195, 255)
when 4
return Color.new(0, 41, 165, 255)
when 5
return Color.new(0, 35, 140, 255)
when 6
return Color.new(0, 26, 105, 255)
when 7
return Color.new(0, 10, 40, 255)
# 橙色
when 10
return Color.new(65, 32, 0, 255)
when 11
return Color.new(160, 80, 0, 255)
when 12
return Color.new(215, 107, 0, 255)
when 13
return Color.new(195, 97, 0, 255)
when 14
return Color.new(165, 82, 0, 255)
when 15
return Color.new(140, 70, 0, 255)
when 16
return Color.new(105, 52, 0, 255)
when 17
return Color.new(40, 20, 0, 255)
# 青色
when 20
return Color.new(0, 65, 65, 255)
when 21
return Color.new(0, 160, 160, 255)
when 22
return Color.new(0, 215, 215, 255)
when 23
return Color.new(0, 195, 195, 255)
when 24
return Color.new(0, 165, 165, 255)
when 25
return Color.new(0, 140, 140, 255)
when 26
return Color.new(0, 105, 105, 255)
when 27
return Color.new(0, 40, 40, 255)
# 紫红
when 30
return Color.new(65, 0, 32, 255)
when 31
return Color.new(160, 0, 80, 255)
when 32
return Color.new(215, 0, 107, 255)
when 33
return Color.new(195, 0, 97, 255)
when 34
return Color.new(165, 0, 82, 255)
when 35
return Color.new(140, 0, 70, 255)
when 36
return Color.new(105, 0, 52, 255)
when 37
return Color.new(40, 0, 20, 255)
end
end
#--------------------------------------------------------------------------
# ● 职业的描绘
# actor : 角色
# x : 描画目标 X 坐标
# y : 描画目标 Y 坐标
#--------------------------------------------------------------------------
def draw_actor_class(actor, x, y)
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 236, 32, "[" + actor.class_name + "]")
end
#--------------------------------------------------------------------------
# ● 描画 EXP ★主菜单
# actor : 角色
# x : 描画目标 X 坐标
# y : 描画目标 Y 坐标
#--------------------------------------------------------------------------
def draw_actor_exp(actor, x, y)
self.contents.font.size = 20
self.contents.font.color = system_color
self.contents.draw_text(x+1, y, 80, 32, "EXP")
self.contents.font.color = normal_color
self.contents.draw_text(x - 10 , y, 84, 32, actor.exp_s, 2)
self.contents.draw_text(x + 74, y, 12, 32, "/", 1)
self.contents.draw_text(x + 88, y, 84, 32, actor.next_exp_s)
end
#--------------------------------------------------------------------------
# ● 描画 EXP ★状态窗口
# actor : 角色
# x : 描画目标 X 坐标
# y : 描画目标 Y 坐标
#--------------------------------------------------------------------------
def draw_actor_exp_status(actor, x, y)
self.contents.font.size = 20
self.contents.font.color = system_color
self.contents.draw_text(x+1, y, 80, 32, "EXP")
self.contents.font.color = normal_color
self.contents.draw_text(x + 108, y, 84, 32, actor.exp_s, 2)
self.contents.draw_text(x + 192, y, 12, 32, "/", 1)
self.contents.draw_text(x + 204, y, 84, 32, actor.next_exp_s)
end
#--------------------------------------------------------------------------
# ★ 描绘 EXP 矩形 by 小翼 [FDU]alwing
# actor : 角色
# x : 描画目标 X 坐标
# y : 描画目标 Y 坐标
# width : 描画目标的宽
#--------------------------------------------------------------------------
def EXP(actor,x,y,width = 128)
self.contents.fill_rect(x+26, y+60, width+4,9, Color.new(0,0,0,255))
self.contents.fill_rect(x+27, y+61, width+2,7, Color.new(255,255,255,255))
self.contents.fill_rect(x+28, y+62, width,5, Color.new(0,0,0,255))
if actor.next_exp > 0
@EXPw = width * actor.now_exp/actor.next_exp
self.contents.fill_rect(x+28, y+62, @EXPw,1, Color.new(100,50,150,255))
self.contents.fill_rect(x+28, y+63, @EXPw,1, Color.new(150,100,200,255))
self.contents.fill_rect(x+28, y+64, @EXPw,1, Color.new(200,150,255,255))
self.contents.fill_rect(x+28, y+65, @EXPw,1, Color.new(150,100,200,255))
self.contents.fill_rect(x+28, y+66, @EXPw,1, Color.new(100,50,150,255))
else
self.contents.fill_rect(x+28, y+62, width,1, Color.new(50,150,150,255))
self.contents.fill_rect(x+28, y+63, width,1, Color.new(100,200,200,255))
self.contents.fill_rect(x+28, y+64, width,1, Color.new(150,255,255,255))
self.contents.fill_rect(x+28, y+65, width,1, Color.new(100,200,200,255))
self.contents.fill_rect(x+28, y+66, width,1, Color.new(50,150,150,255))
end
end
#--------------------------------------------------------------------------
# ● 描绘 HP
# actor : 角色
# x : 描画目标 X 坐标
# y : 描画目标 Y 坐标
# width : 描画目标的宽
#--------------------------------------------------------------------------
def draw_actor_hp(actor, x, y, width = 144)
# 描绘字符串 "HP"
self.contents.font.color = system_color
self.contents.font.size = 20
self.contents.draw_text(x+16, y, 32, 32, "体")
# 计算描绘 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
if flag
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, 48, 32, actor.hp.to_s, 2)
else
self.contents.font.color = actor.hp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
self.contents.draw_text(hp_x-36, y, 48, 32, actor.hp.to_s, 0)
end
# 描绘 MaxHP
if flag
self.contents.font.color = normal_color
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)
else
self.contents.font.color = normal_color
self.contents.draw_text(hp_x, y, 12, 32, "/", 1)
self.contents.draw_text(hp_x + 12, y, 48, 32, actor.maxhp.to_s)
end
end
#--------------------------------------------------------------------------
# ● 描绘 SP
# actor : 角色
# x : 描画目标 X 坐标
# y : 描画目标 Y 坐标
# width : 描画目标的宽
#--------------------------------------------------------------------------
def draw_actor_sp(actor, x, y, width = 144)
# 描绘字符串 "SP"
self.contents.font.color = system_color
self.contents.draw_text(x+16, y, 32, 32, "气")
# 计算描绘 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
if flag
self.contents.font.color = actor.sp == 0 ? knockout_color :
actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
self.contents.draw_text(sp_x, y, 48, 32, actor.sp.to_s, 2)
else
self.contents.font.color = actor.sp == 0 ? knockout_color :
actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
self.contents.draw_text(sp_x-36, y, 48, 32, actor.sp.to_s, 0)
end
# 描绘 MaxSP
if flag
self.contents.font.color = normal_color
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)
else
self.contents.font.color = normal_color
self.contents.draw_text(sp_x, y, 12, 32, "/", 1)
self.contents.draw_text(sp_x + 12, y, 48, 32, actor.maxsp.to_s)
end
end
#--------------------------------------------------------------------------
# ● 描绘能力值
# actor : 角色
# x : 描画目标 X 坐标
# y : 描画目标 Y 坐标
# type : 能力值种类 (0~6)
#--------------------------------------------------------------------------
def draw_actor_parameter(actor, x, y, type)
case type
when 0
parameter_name = $data_system.words.atk
parameter_value = actor.atk
when 1
parameter_name = $data_system.words.pdef
parameter_value = actor.pdef
when 2
parameter_name = $data_system.words.mdef
parameter_value = actor.mdef
when 3
parameter_name = $data_system.words.str
parameter_value = actor.str
when 4
parameter_name = $data_system.words.dex
parameter_value = actor.dex
when 5
parameter_name = $data_system.words.agi
parameter_value = actor.agi
when 6
parameter_name = $data_system.words.int
parameter_value = actor.int
end
self.contents.font.color = system_color
self.contents.draw_text(x, y, 120, 32, parameter_name)
self.contents.font.color = normal_color
self.contents.draw_text(x + 160, y, 36, 32, parameter_value.to_s, 2)
end
#--------------------------------------------------------------------------
# ● 描绘能力值 ★装备窗口
# actor : 角色
# x : 描画目标 X 坐标
# y : 描画目标 Y 坐标
# type : 能力值种类 (0~6)
#--------------------------------------------------------------------------
def draw_actor_parameter_equip(actor, x, y, type)
case type
when 0
parameter_name = $data_system.words.atk
parameter_value = actor.atk
when 1
parameter_name = $data_system.words.pdef
parameter_value = actor.pdef
when 2
parameter_name = $data_system.words.mdef
parameter_value = actor.mdef
when 3
parameter_name = $data_system.words.str
parameter_value = actor.str
when 4
parameter_name = $data_system.words.dex
parameter_value = actor.dex
when 5
parameter_name = $data_system.words.agi
parameter_value = actor.agi
when 6
parameter_name = $data_system.words.int
parameter_value = actor.int
end
self.contents.font.color = system_color
self.contents.draw_text(x, y, 120, 32, parameter_name)
self.contents.font.color = normal_color
self.contents.draw_text(x + 196, y, 36, 32, parameter_value.to_s, 2)
end
#--------------------------------------------------------------------------
# ● 描绘物品名
# item : 物品
# x : 描画目标 X 坐标
# y : 描画目标 Y 坐标
#--------------------------------------------------------------------------
def draw_item_name(item, x, y)
if item == nil
return
end
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.font.color = normal_color
self.contents.draw_text(x + 28, y, 212, 32, item.name)
end
#--------------------------------------------------------------------------
# ● 等级的描绘
# actor : 角色
# x : 描画目标 X 坐标
# y : 描画目标 Y 坐标
#--------------------------------------------------------------------------
def draw_actor_level(actor, x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 64, 32, LEVEL)
self.contents.font.color = normal_color
self.contents.draw_text(x + 32, y, 24, 32, actor.level.to_s, 2)
end
#--------------------------------------------------------------------------
# ★ 描绘 HP 矩形 by 小翼 [FDU]alwing
# actor : 角色
# x : 描画目标 X 坐标
# y : 描画目标 Y 坐标
# width : 描画目标的宽
#--------------------------------------------------------------------------
# HP定义
def HP(actor,x,y,width=96)
#底色定义
self.contents.fill_rect(x+26, y+13, width+4,12, Color.new(0,0,0,255))
self.contents.fill_rect(x+27, y+14, width+2,10, Color.new(255,255,255,255))
self.contents.fill_rect(x+28, y+15, width,8, Color.new(0,0,0,255))
#HP宽度定义
@HPw = width * actor.hp/actor.maxhp
#中
if actor.hp > actor.maxhp/2
@HPcg0 = 65
@HPcg1 = 160
@HPcg2 = 215
@HPcg3 = 195
@HPcg4 = 165
@HPcg5 = 140
@HPcg6 = 105
@HPcg7 = 40
@HPcr0 = 65 * (actor.maxhp - actor.hp)/(actor.maxhp/2)
@HPcr1 = 160 * (actor.maxhp - actor.hp)/(actor.maxhp/2)
@HPcr2 = 215 * (actor.maxhp - actor.hp)/(actor.maxhp/2)
@HPcr3 = 195 * (actor.maxhp - actor.hp)/(actor.maxhp/2)
@HPcr4 = 165 * (actor.maxhp - actor.hp)/(actor.maxhp/2)
@HPcr5 = 140 * (actor.maxhp - actor.hp)/(actor.maxhp/2)
@HPcr6 = 105 * (actor.maxhp - actor.hp)/(actor.maxhp/2)
@HPcr7 = 40 * (actor.maxhp - actor.hp)/(actor.maxhp/2)
else
@HPcr0 = 65
@HPcr1 = 160
@HPcr2 = 215
@HPcr3 = 195
@HPcr4 = 165
@HPcr5 = 140
@HPcr6 = 105
@HPcr7 = 40
@HPcg0 = 65 * actor.hp/(actor.maxhp/2)
@HPcg1 = 160 * actor.hp/(actor.maxhp/2)
@HPcg2 = 215 * actor.hp/(actor.maxhp/2)
@HPcg3 = 195 * actor.hp/(actor.maxhp/2)
@HPcg4 = 165 * actor.hp/(actor.maxhp/2)
@HPcg5 = 140 * actor.hp/(actor.maxhp/2)
@HPcg6 = 105 * actor.hp/(actor.maxhp/2)
@HPcg7 = 40 * actor.hp/(actor.maxhp/2)
end
#HP条定义
self.contents.fill_rect(x+28, y+15, @HPw,1, Color.new(@HPcr0,@HPcg0,0,255))
self.contents.fill_rect(x+28, y+16, @HPw,1, Color.new(@HPcr1,@HPcg1,0,255))
self.contents.fill_rect(x+28, y+17, @HPw,1, Color.new(@HPcr2,@HPcg2,0,255))
self.contents.fill_rect(x+28, y+18, @HPw,1, Color.new(@HPcr3,@HPcg3,0,255))
self.contents.fill_rect(x+28, y+19, @HPw,1, Color.new(@HPcr4,@HPcg4,0,255))
self.contents.fill_rect(x+28, y+20, @HPw,1, Color.new(@HPcr5,@HPcg5,0,255))
self.contents.fill_rect(x+28, y+21, @HPw,1, Color.new(@HPcr6,@HPcg6,0,255))
self.contents.fill_rect(x+28, y+22, @HPw,1, Color.new(@HPcr7,@HPcg7,0,255))
end
#--------------------------------------------------------------------------
# ★ 描绘 SP 矩形 by 小翼 [FDU]alwing
# actor : 角色
# x : 描画目标 X 坐标
# y : 描画目标 Y 坐标
# width : 描画目标的宽
#--------------------------------------------------------------------------
def MP(actor,x,y,width=96)
self.contents.fill_rect(x+26, y+45, width+4,12, Color.new(0,0,0,255))
self.contents.fill_rect(x+27, y+46, width+2,10, Color.new(255,255,255,255))
self.contents.fill_rect(x+28, y+47, width,8, Color.new(0,0,0,255))
@MPw = width * actor.sp/actor.maxsp
self.contents.fill_rect(x+28, y+47, @MPw,1, rec_color(0))
self.contents.fill_rect(x+28, y+48, @MPw,1, rec_color(1))
self.contents.fill_rect(x+28, y+49, @MPw,1, rec_color(2))
self.contents.fill_rect(x+28, y+50, @MPw,1, rec_color(3))
self.contents.fill_rect(x+28, y+51, @MPw,1, rec_color(4))
self.contents.fill_rect(x+28, y+52, @MPw,1, rec_color(5))
self.contents.fill_rect(x+28, y+53, @MPw,1, rec_color(6))
self.contents.fill_rect(x+28, y+54, @MPw,1, rec_color(7))
end
end
class Window_Gold < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 96)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 120, 32, GOLD)
self.contents.font.color = normal_color
self.contents.draw_text(4, 32, 120, 32, $game_party.gold.to_s)
self.contents.font.color = system_color
self.contents.draw_text(4, 32, 120, 32, $data_system.words.gold, 2)
end
end
class Window_MenuList < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
# width : 窗口的宽
# commands : 命令字符串序列
#--------------------------------------------------------------------------
def initialize(width, commands)
# 由命令的个数计算出窗口的高
super(0, 0, 480, 96)
@item_max = commands.size
@commands = [ITEM, SKILL, EQUIP, STATUS, SAVE, EXIT]
self.contents = Bitmap.new(width - 32, 64)
refresh
self.index = 0
@column_max = 3
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i, normal_color)
end
end
#--------------------------------------------------------------------------
# ● 描绘项目
# index : 项目编号
# color : 文字色
#--------------------------------------------------------------------------
def draw_item(index, color)
self.contents.font.color = color
if index >= 0 && index <= 2
rect = Rect.new(160 * index + 4, 0, self.contents.width - 8, 32)
elsif index >= 3 && index <= 5
rect = Rect.new(160 * (index - 3) + 4, 32, self.contents.width - 8, 32)
end
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index])
end
#--------------------------------------------------------------------------
# ● 项目无效化
# index : 项目编号
#--------------------------------------------------------------------------
def disable_item(index)
draw_item(index, disabled_color)
end
end
class Window_MenuStatus < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化目标 #actor_id: 角色编号 (0号为第一个角色,依此类推)
#--------------------------------------------------------------------------
def initialize(actor_id)
super(0, 0, 160, 384)
@actor_id = actor_id
self.contents = Bitmap.new(width - 32, height - 32)
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@item_max = 1
actor = $game_party.actors[@actor_id]
#------------------------------------------------------------------------
# ★ 头像调用
#------------------------------------------------------------------------
if actor.id < 10
testname = "Actor00"+actor.id.to_s
elsif actor.id >= 10 && actor.id < 100
testname = "Actor0"+ actor.id.to_s
elsif actor.id >= 100 && actor.id <= 999
testname = "Actor" + actor.id.to_s
end
bitmap = Bitmap.new("Graphics/Heads/#{testname}")
src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
self.contents.blt(14, y + 10, bitmap, src_rect)
draw_actor_name(actor, 22, 115)
HP(actor, 0, 200)
MP(actor, 0, 214)
draw_actor_hp(actor, 0, 180)
draw_actor_sp(actor, 0, 227)
EXP(actor, 0, 238, 96)
draw_actor_exp(actor, 10, 270)
draw_actor_level(actor, 36, 315)
#$game_party.actors.size
#for i in 0...$game_party.actors.size
#x = 64
#y = 116
#actor = $game_party.actors[@actor_id]
#draw_actor_graphic(actor, x - 40, y + 80)
#draw_actor_name(actor, x, y)
draw_actor_class(actor, 22,115 + 32)#x + 144, y)
#draw_actor_level(actor, x, y + 32)
#draw_actor_state(actor, 22, 180)#x + 90, y + 32)
#draw_actor_exp(actor, x, y + 64)
#draw_actor_hp(actor, x + 236, y + 32)
#draw_actor_sp(actor, x + 236, y + 64)
#end
end
#--------------------------------------------------------------------------
# ● 刷新光标矩形
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(0, @index * 116, self.width - 32, self.height - 32)
end
end
end
class Scene_Menu
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
def main
@status_index = 0
@spriteset = Spriteset_Map.new
# 生成命令窗口
s1 = ITEM
s2 = SKILL
s3 = EQUIP
s4 = STATUS
s5 = SAVE
s6 = EXIT
@command_window = Window_MenuList.new(480, [s1, s2, s3, s4, s5, s6])
@command_window.index = @menu_index
@command_window.opacity = 160
#@command_window.height = 196
# 同伴人数为 0 的情况下
if $game_party.actors.size == 0
# 物品、特技、装备、状态无效化
@command_window.disable_item(0)
@command_window.disable_item(1)
@command_window.disable_item(2)
@command_window.disable_item(3)
end
# 禁止存档的情况下
if $game_system.save_disabled
# 存档无效
@command_window.disable_item(4)
end
# 生成金钱窗口
@gold_window = Window_Gold.new
@gold_window.x = 480
@gold_window.y = 0
@gold_window.opacity = 160
# 生成状态窗口
@status_window = []
for i in 0...$game_party.actors.size
@status_window[i] = Window_MenuStatus.new(i)
@status_window[i].x = 160 * i
@status_window[i].y = 96
@status_window[i].opacity = 160
end
# 执行过渡
Graphics.transition
# 主循环
loop do
# 刷新游戏画面
Graphics.update
# 刷新输入信息
Input.update
# 刷新画面
update
# 如果切换画面就中断循环
if $scene != self
break
end
end
# 准备过渡
Graphics.freeze
# 释放窗口
@command_window.dispose
@gold_window.dispose
for i in 0...$game_party.actors.size
@status_window[i].dispose
end
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
# 刷新窗口
@command_window.update
@gold_window.update
#@status_window.update
for i in 0...$game_party.actors.size
@status_window[i].update
end
if $cancel
@command_window.active = false
@status_window[$index].active = true
@status_window[$index].index = 0
@status_index = $index
$cancel = false
end
# 命令窗口被激活的情况下: 调用 update_command
if @command_window.active
update_command
return
end
# 状态窗口被激活的情况下: 调用 update_status
if @status_window[@status_index]#@status_window[0].active || @status_window[1].active || @status_window[2].active || @status_window[3].active
update_status
return
end
end
#--------------------------------------------------------------------------
# ● 刷新画面 (命令窗口被激活的情况下)
#--------------------------------------------------------------------------
def update_command
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 切换的地图画面
$scene = Scene_Map.new
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 同伴人数为 0、存档、游戏结束以外的场合
if $game_party.actors.size == 0 and @command_window.index < 4
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 命令窗口的光标位置分支
case @command_window.index
when 0 # 物品
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 切换到物品画面
$scene = Scene_Item.new
when 1 # 特技
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 激活状态窗口
@command_window.active = false
@status_window[0].active = true
@status_window[0].index = 0
when 2 # 装备
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 激活状态窗口
@command_window.active = false
@status_window[0].active = true
@status_window[0].index = 0
when 3 # 状态
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 激活状态窗口
@command_window.active = false
@status_window[0].active = true
@status_window[0].index = 0
when 4 # 存档
# 禁止存档的情况下
if $game_system.save_disabled
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 切换到存档画面
$scene = Scene_Save.new
when 5 # 游戏结束
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 切换到游戏结束画面
$scene = Scene_End.new
end
return
end
end
#--------------------------------------------------------------------------
# ● 刷新画面 (状态窗口被激活的情况下)
#--------------------------------------------------------------------------
def update_status
#p @status_index
#for i in 0..3
# p @status_window[i].active
#end
for i in 0...$game_party.actors.size
@status_window[i].update
end
if Input.trigger?(Input::LEFT)
$game_system.se_play($data_system.cursor_se)
if @status_index == 0
@status_index = $game_party.actors.size - 1
else
@status_index -= 1
end
end
if Input.trigger?(Input::RIGHT)
$game_system.se_play($data_system.cursor_se)
if @status_index == $game_party.actors.size - 1
@status_index = 0
else
@status_index += 1
end
end
case @status_index
when 0
@status_window[0].active = true
@status_window[0].index = 0
if $game_party.actors.size >= 2
@status_window[1].active = false
@status_window[1].index = -1
if $game_party.actors.size >= 3
@status_window[2].active = false
@status_window[2].index = -1
if $game_party.actors.size >= 4
@status_window[3].active = false
@status_window[3].index = -1
end
end
end
when 1
@status_window[0].active = false
@status_window[0].index = -1
if $game_party.actors.size >= 2
@status_window[1].active = true
@status_window[1].index = 0
if $game_party.actors.size >= 3
@status_window[2].active = false
@status_window[2].index = -1
if $game_party.actors.size >= 4
@status_window[3].active = false
@status_window[3].index = -1
end
end
end
when 2
@status_window[0].active = false
@status_window[0].index = -1
if $game_party.actors.size >= 2
@status_window[1].active = false
@status_window[1].index = -1
if $game_party.actors.size >= 3
@status_window[2].active = true
@status_window[2].index = 0
if $game_party.actors.size >= 4
@status_window[3].active = false
@status_window[3].index = -1
end
end
end
@status_window[0].active = false
@status_window[0].index = -1
@status_window[1].active = false
@status_window[1].index = -1
@status_window[2].active = true
@status_window[2].index = 0
@status_window[3].active = false
@status_window[3].index = -1
when 3
@status_window[0].active = false
@status_window[0].index = -1
if $game_party.actors.size >= 2
@status_window[1].active = false
@status_window[1].index = -1
if $game_party.actors.size >= 3
@status_window[2].active = false
@status_window[2].index = -1
if $game_party.actors.size >= 4
@status_window[3].active = true
@status_window[3].index = 0
end
end
end
end
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 激活命令窗口
@command_window.active = true
@status_window[@status_index].active = false
@status_window[@status_index].index = -1
@status_index = 0
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 命令窗口的光标位置分支
case @command_window.index
when 1 # 特技
# 本角色的行动限制在 2 以上的情况下
if $game_party.actors[@status_index].restriction >= 2
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 切换到特技画面
$scene = Scene_Skill.new(@status_index)#window.index)
when 2 # 装备
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 切换的装备画面
$scene = Scene_Equip.new(@status_index)#@status_window.index)
when 3 # 状态
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 切换到状态画面
$scene = Scene_Status.new(@status_index)#@status_window.index)
end
return
end
end
end
class Scene_Skill
def update_skill
# 按下 B 键的情况下
$cancel = true
$index = @actor_index
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 切换到菜单画面
$scene = Scene_Menu.new(1)
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 获取特技窗口现在选择的特技的数据
@skill = @skill_window.skill
# 不能使用的情况下
if @skill == nil or not @actor.skill_can_use?(@skill.id)
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 效果范围是我方的情况下
if @skill.scope >= 3
# 激活目标窗口
@skill_window.active = false
@target_window.x = (@skill_window.index + 1) % 2 * 304
@target_window.visible = true
@target_window.active = true
# 设置效果范围 (单体/全体) 的对应光标位置
if @skill.scope == 4 || @skill.scope == 6
@target_window.index = -1
elsif @skill.scope == 7
@target_window.index = @actor_index - 10
else
@target_window.index = 0
end
# 效果在我方以外的情况下
else
# 公共事件 ID 有效的情况下
if @skill.common_event_id > 0
# 预约调用公共事件
$game_temp.common_event_id = @skill.common_event_id
# 演奏特技使用时的 SE
$game_system.se_play(@skill.menu_se)
# 消耗 SP
@actor.sp -= @skill.sp_cost
# 再生成各窗口的内容
@status_window.refresh
@skill_window.refresh
@target_window.refresh
# 切换到地图画面
$scene = Scene_Map.new
return
end
end
return
end
# 按下 R 键的情况下
if Input.trigger?(Input::R)
# 演奏光标 SE
$game_system.se_play($data_system.cursor_se)
# 移至下一位角色
@actor_index += 1
@actor_index %= $game_party.actors.size
# 切换到别的特技画面
$scene = Scene_Skill.new(@actor_index)
return
end
# 按下 L 键的情况下
if Input.trigger?(Input::L)
# 演奏光标 SE
$game_system.se_play($data_system.cursor_se)
# 移至上一位角色
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
# 切换到别的特技画面
$scene = Scene_Skill.new(@actor_index)
return
end
end
end
class Scene_Equip
def update_right
# 按下 B 键的情况下
if Input.trigger?(Input::B)
$cancel = true
$index = @actor_index
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 切换到菜单画面
$scene = Scene_Menu.new(2)
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 固定装备的情况下
if @actor.equip_fix?(@right_window.index)
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 激活物品窗口
@right_window.active = false
@item_window.active = true
@item_window.index = 0
return
end
# 按下 R 键的情况下
if Input.trigger?(Input::R)
# 演奏光标 SE
$game_system.se_play($data_system.cursor_se)
# 移至下一位角色
@actor_index += 1
@actor_index %= $game_party.actors.size
# 切换到别的装备画面
$scene = Scene_Equip.new(@actor_index, @right_window.index)
return
end
# 按下 L 键的情况下
if Input.trigger?(Input::L)
# 演奏光标 SE
$game_system.se_play($data_system.cursor_se)
# 移至上一位角色
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
# 切换到别的装备画面
$scene = Scene_Equip.new(@actor_index, @right_window.index)
return
end
end
end
class Scene_Status
def update
# 按下 B 键的情况下
if Input.trigger?(Input::B)
$cancel = true
$index = @actor_index
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 切换到菜单画面
$scene = Scene_Menu.new(3)
return
end
# 按下 R 键的情况下
if Input.trigger?(Input::R)
# 演奏光标 SE
$game_system.se_play($data_system.cursor_se)
# 移至下一位角色
@actor_index += 1
@actor_index %= $game_party.actors.size
# 切换到别的状态画面
$scene = Scene_Status.new(@actor_index)
return
end
# 按下 L 键的情况下
if Input.trigger?(Input::L)
# 演奏光标 SE
$game_system.se_play($data_system.cursor_se)
# 移至上一位角色
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
# 切换到别的状态画面
$scene = Scene_Status.new(@actor_index)
return
end
end
end
(o゚ω゚o)( ゚ω゚)(o゚ω゚o) |
评分
-
查看全部评分
|