本帖最后由 Sion 于 2013-5-31 18:25 编辑 要提问的话请重新开贴,把脚本整理好再传上来。脚本太多,建议传工程。 此贴太乱,影响阅读。因此作关闭下沉处理 |
=begin ================================================ 道具提示系统 版本 1.01 By 804173948 QQ:同上 ================================================ 修正BUG: 1.读取游戏后获取道具错误 更新: 1.添加音效(本人觉得很难听) 使用方法: 在事件-脚本里输入 1、获得/失去物品 获得: get_item($data_items[物品id],数量) 失去: lost_item($data_items[物品id],数量) 例如: get_item($data_items[10],4) 获得10号物品 4个 lost_item($data_items[1],3) 丢失1号物品 3个 2、获得/失去武器 获得: get_item($data_weapons[物品id],数量) 失去: lost_item($data_weapons[物品id],数量,是否包括装备) 是否包括装备:是则 True 否则 false 或不写 下同 3、获得/失去防具 获得: get_item($data_armors[物品id],数量) 失去: lost_item($data_armors[物品id],数量,是否包括装备) 注意:最后要加一句 show_window 否则不显示提示窗口 详情看范例…… 有疑问或BUG之类的 欢迎提出 =end class Game_Interpreter alias old_initialize initialize def initialize(depth = 0) old_initialize @get_item_var =[] @get_amount =[] end def show_window Audio.se_play("Audio/SE/Shop",80,100) SceneManager.call(Scene_Get_Item) SceneManager.scene.show_window(@get_item_var,@get_amount) @get_item_var =[] @get_amount =[] end def get_item(item,amount) amount = 99 if amount > 99 @get_item_var = [] if @get_item_var == nil @get_amount = [] if @get_amount == nil @get_item_var.push(item) @get_amount.push(amount) $game_party.gain_item(item,amount) end def lost_item(item,amount,include_equip = false) amount = 99 if amount > 99 @get_item_var = [] if @get_item_var == nil @get_amount = [] if @get_amount == nil @get_item_var.push(item) @get_amount.push(-amount) $game_party.gain_item(item,-amount,include_equip) end end class Scene_Get_Item < Scene_MenuBase def start super @get_item_var = [] @get_amount = [] end def show_window(get_item_var,get_amount) @get_item_var = get_item_var @get_amount = get_amount create_show_get_window create_category_window end def create_show_get_window @show_get_window = Window_Show_GetItem.new(120,88,300,200,@get_item_var,@get_amount) #窗口位置 @show_get_window.set_handler(:ok, method(:return_scene)) @show_get_window.set_handler(:cancel, method(:on_item_cancel)) end def create_category_window @show_getItem_category = Window_GetItem_Category.new(120,40,300,48) @show_getItem_category.item_window = @show_get_window @show_getItem_category.set_handler(:ok, method(:on_category_ok)) @show_getItem_category.set_handler(:cancel, method(:return_scene)) end def on_category_ok @show_get_window.activate end def on_item_cancel @show_getItem_category.activate end end class Window_GetItem_Category < Window_HorzCommand #-------------------------------------------------------------------------- # ● 定义实例变量 #-------------------------------------------------------------------------- attr_reader :item_window #-------------------------------------------------------------------------- # ● 初始化对象 #-------------------------------------------------------------------------- def initialize(x,y,width,height) super(x, y) self.width = width self.height = height end #-------------------------------------------------------------------------- # ● 窗口宽度 #-------------------------------------------------------------------------- def window_width return 300 end #-------------------------------------------------------------------------- # ● 获取列数 #-------------------------------------------------------------------------- def col_max return 2 end #-------------------------------------------------------------------------- # ● 更新画面 #-------------------------------------------------------------------------- def update super @item_window.category = current_symbol if @item_window end #-------------------------------------------------------------------------- # ● 生成指令列表 #-------------------------------------------------------------------------- def make_command_list add_command(" 获得物品", :get) add_command(" 失去物品", :lost) end #-------------------------------------------------------------------------- # ● 设置物品窗口 #-------------------------------------------------------------------------- def item_window=(item_window) @item_window = item_window update end end class Window_Show_GetItem < Window_ItemList def initialize(x, y, width, height,data,amount) super(x, y, width, height) @category = :get @data_save = data @amount_save = amount refresh end def col_max return 1 end def spacing return 32 end def include?(index) if index case @category when :get if index >= 0 true else false end when :lost if index < 0 true else false end else false end end end def draw_item(index) item = @data[index] if item rect = item_rect(index) rect.width -= 4 draw_item_name(item, rect.x, rect.y) draw_item_number(rect, index) end end def draw_item_number(rect, item) if @amount[item] < 0 s1 = -@amount[item] else s1 = @amount[item] end draw_text(rect, sprintf(":%2d", s1), 2) end #-------------------------------------------------------------------------- # ● 查询此物品是否可用 #-------------------------------------------------------------------------- def enable?(item) return true end #-------------------------------------------------------------------------- # ● 生成物品列表 #-------------------------------------------------------------------------- def make_item_list @data = Array.new(@data_save) @amount = Array.new(@amount_save) for i in 0 ... @data.size @data[i] = nil if include?(@amount_save[i]) == false @amount[i] = nil if include?(@amount_save[i]) == false end @data.delete(nil) @amount.delete(nil) end end 最后一个^^^^^^^^^^^^^^^ |
#============================================================================== # ■ Scene_Making_Imformation #------------------------------------------------------------------------------ # 开发装备(子类) #============================================================================== class Scene_Making_Imformation < Scene_Make_Item #-------------------------------------------------------------------------- # ● 开始 #-------------------------------------------------------------------------- def start get_ie super @choosed = 0 @makers = [] end #-------------------------------------------------------------------------- # ● 添加窗口 #-------------------------------------------------------------------------- def create_window create_making_scroll create_making_window create_actorimformation_window create_choose_actor_to_make end #-------------------------------------------------------------------------- # ● 获取父类选定好的装备武器 #-------------------------------------------------------------------------- def get_ie s1 = MakeEquip::get_or_save_ie(true,nil,nil) @item = s1[0] @equip = s1[1] end #-------------------------------------------------------------------------- # ● 开发进度条(我的英文水平很无语) #-------------------------------------------------------------------------- def create_making_scroll @scroll_window = Window_Making_Scroll.new end #-------------------------------------------------------------------------- # ● 选择角色 #-------------------------------------------------------------------------- def create_choose_actor_to_make @choose_actor_window = Window_Choose_Actor.new(0,0) @choose_actor_window.help_window = @actorimformation_window @choose_actor_window.set_handler(:ok , method(:begin_to_make)) @choose_actor_window.set_handler(:cancel, method(:return_scene)) @choose_actor_window.activate end #-------------------------------------------------------------------------- # ● 开发窗口 #-------------------------------------------------------------------------- def create_making_window @making_window = Window_Making.new(160,0,384,371,item,equip) @making_window.hide end #-------------------------------------------------------------------------- # ● 承接Makers的窗口 #-------------------------------------------------------------------------- def create_makers_window @makers_window = Window_Makers.new(@makers) @begin_make = Window_sure_make.new @begin_make.x = 14 @begin_make.y = 291 @begin_make.set_handler(:yes_make ,method(:honton_to_make)) @begin_make.set_handler(:no_make, method(:return_scene)) @begin_make.set_handler(:cancel, method(:return_scene)) end #-------------------------------------------------------------------------- # ● 成功开发窗口 #-------------------------------------------------------------------------- def create_succeed_to_make_window(equip,item,new_name,new_params) @succeed_to_make = Window_Succeed_Make.new(100,0,item,equip,new_name,new_params,@makers) @succeed_to_make.set_handler(:ok , method(:return_scene)) @succeed_to_make.set_handler(:cancel, method(:return_scene)) end #-------------------------------------------------------------------------- # ● 角色资料 #-------------------------------------------------------------------------- def create_actorimformation_window @actorimformation_window = Window_Actor_Imformation.new(160,0,384,371) end #-------------------------------------------------------------------------- # ● 貌似没用,但别删 #-------------------------------------------------------------------------- def on_actor_change @actorimformation_window.actor = @actor end #-------------------------------------------------------------------------- # ● 开始开发 #-------------------------------------------------------------------------- def begin_to_make if @makers.include?(@choose_actor_window.item) @choosed -= 1 @makers.delete(@choose_actor_window.item) @choose_actor_window.clear_item(@choose_actor_window.index) @choose_actor_window.draw_item(@choose_actor_window.index) @making_window.del_actor(@choose_actor_window.item) else @choosed += 1 @makers.push(@choose_actor_window.item) @choose_actor_window.draw_item_background(@choose_actor_window.index) @making_window.actor = @choose_actor_window.item end @choose_actor_window.activate if @choosed == $game_make_item.max_maker @actorimformation_window.close @choose_actor_window.close @making_window.show create_makers_window @making_window.refresh end end #-------------------------------------------------------------------------- # ● 真的要开始开发了!!!(我用了日文……) #-------------------------------------------------------------------------- def honton_to_make @begin_make.close @begin_make.hide @making_window.activate $game_party.lose_gold(@equip.price + @item.price) $game_party.gain_item(@item,-1) i = 0 while i < 100 @making_window.up_param i += 1 @scroll_window.stime = i Graphics.wait(6) end @making_window.finish_up Graphics.wait(90) hot = @making_window.get_hot(@equip) new_params = @making_window.params new_name = @making_window.add_name new_equip = @equip.dup if new_equip.is_a?(RPG::Weapon) new_equip.id = $data_weapons.size $data_weapons.insert $data_weapons.size,new_equip $data_weapons[new_equip.id].name = new_name + @equip.name $data_weapons[new_equip.id].params = new_params $data_weapons[new_equip.id].note = make_note(@equip) $data_weapons[new_equip.id].lock = true $data_weapons[new_equip.id].exp = 0 $data_weapons[new_equip.id].price *= 1 + hot * 0.01 $data_weapons[new_equip.id].price += @item.price * hot * 0.01 * 1.5 $data_weapons[new_equip.id].price = $data_weapons[new_equip.id].price.to_i else new_equip.id = $data_armors.size $data_armors.insert $data_armors.size,new_equip $data_armors[new_equip.id].name = new_name + @equip.name $data_armors[new_equip.id].params = new_params $data_armors[new_equip.id].note = make_note(@equip) $data_armors[new_equip.id].lock = true $data_armors[new_equip.id].exp = 0 $data_armors[new_equip.id].price *= 1 + hot * 0.01 $data_armors[new_equip.id].price += @item.price * hot * 0.01 * 1.5 $data_armors[new_equip.id].price = $data_armors[new_equip.id].price.to_i end $game_party.gain_item(new_equip,1) create_succeed_to_make_window(@equip,@item,new_name,new_params) @succeed_to_make.show @succeed_to_make.activate end #-------------------------------------------------------------------------- # ● 生成新备注 #-------------------------------------------------------------------------- include MakeEquip def make_note(equip) note = "<"+CLASS+" "+equip.class_id.to_s+">" return note end end #============================================================================== # ■ Window_Making_Scroll #------------------------------------------------------------------------------ # 开发进度条 #============================================================================== class Window_Making_Scroll < Window_Base def initialize super(0,371,window_width,window_height) @stime = 0 refresh end def window_width return 544 end def window_height return 45 end def stime=(stime) @stime = stime refresh end def draw_scroll(stime) contents.clear rate = stime.to_f / 100 make_font_smaller draw_gauge(90, -7, 412, rate, tp_cost_color, tp_cost_color) draw_text(4, 0, 200, line_height, "开发进度:") make_font_bigger end def refresh draw_scroll(@stime) end end #============================================================================== # ■ (懒得打了) #------------------------------------------------------------------------------ # 选择角色 #============================================================================== class Window_Choose_Actor < Window_MenuStatus def initialize(x,y) super(x,y) refresh end def window_width return 160 end def window_height return 371 end #-------------------------------------------------------------------------- # ● 获取项目的高度 #-------------------------------------------------------------------------- def item_height (height - standard_padding * 2) / 4 end #-------------------------------------------------------------------------- # ● 获取显示行数 #-------------------------------------------------------------------------- def visible_line_number return 4 end def item $game_party.members[index] end def draw_item(index) actor = $game_party.members[index] enabled = $game_party.battle_members.include?(actor) rect = item_rect(index) draw_actor_graphic(actor, rect.x+15, rect.y+45) draw_simple_status(actor, rect.x + 35, rect.y + line_height / 6) end def draw_item_background(index) contents.fill_rect(item_rect(index), pending_color) draw_item(index) end def update_help @help_window.actor = $game_party.members[index] end def refresh contents.clear draw_all_items self.index = 0 end end #============================================================================== # ■ (懒得打了) #------------------------------------------------------------------------------ # 角色资料 #============================================================================== class Window_Actor_Imformation < Window_Status def initialize(x,y,width,height) super(nil) self.x = x self.y = y self.width = width self.height = height @actor = nil refresh end def actor=(actor) @actor = actor refresh end def refresh if @actor show contents.clear draw_block1 (line_height * 0) draw_horz_line(line_height * 1) draw_block2 (line_height * 2) draw_horz_line(line_height * 6) draw_block3 (line_height * 7) else hide end end #-------------------------------------------------------------------------- # ● 绘制区域 1 #-------------------------------------------------------------------------- def draw_block1(y) draw_actor_name(@actor, 4, y) draw_actor_class(@actor, 128, y) # 职业 end #-------------------------------------------------------------------------- # ● 绘制区域 2 #-------------------------------------------------------------------------- def draw_block2(y) draw_actor_face(@actor, 4, y) draw_basic_info(120, y) draw_exp_info(150, y+line_height * 5) end #-------------------------------------------------------------------------- # ● 绘制区域 3 #-------------------------------------------------------------------------- def draw_block3(y) draw_parameters(4, y) end end #============================================================================== # ■ (懒得打了) #------------------------------------------------------------------------------ # 开发装备窗口 #============================================================================== class Window_Making < Window_Selectable include MakeEquip attr_writer :equip attr_writer :item attr_reader :params attr_reader :add_name #-------------------------------------------------------------------------- # ● 初始化 #-------------------------------------------------------------------------- def initialize(x,y,width,height,item=nil,equip=nil) super(x,y,width,height) @item = item # 获取用来开发的物品 @equip = equip # 获取被开发的武器 @params = [] # 属性(武器) @add_params = [] # 道具增加属性 @add_name = "" # 名称前缀 @sum_params = [0,0,0,0,0,0] # 总计属性(角色) @avg_params = [0,0,0,0,0,0] # 平均属性(角色) @actor = [] # 角色们 if @equip && @item init_imformation # 初始化资料 refresh end end include MakeEquip #-------------------------------------------------------------------------- # ● 设置角色 #-------------------------------------------------------------------------- def actor=(actor) @actor.push(actor) end def del_actor(actor) @actor.delete(actor) end #-------------------------------------------------------------------------- # ● 初始化资料 #-------------------------------------------------------------------------- def init_imformation for i in 0..7 @params = @equip.params end for i in 0..7 @add_params = @item.add_params(i) end @add_name = @item.addname end #-------------------------------------------------------------------------- # ● 行高 #-------------------------------------------------------------------------- def line_height return 19 end #-------------------------------------------------------------------------- # ● 刷新 #-------------------------------------------------------------------------- def refresh contents.clear draw_ie_icon(4,0) draw_horz_line(line_height) draw_params(4,line_height) draw_horz_line(line_height * 9) draw_actors_imformation(4,line_height * 10) end #-------------------------------------------------------------------------- # ● 描绘物品装备图片 #-------------------------------------------------------------------------- def draw_ie_icon(x,y) make_font_smaller draw_icon(@equip.icon_index,x,y) draw_text(x+25, y+2, 100, line_height, @equip.name) draw_text(x+125, y+2, 100, line_height, "开发材料:") draw_icon(@item.icon_index,x+225,y) draw_text(x+250, y+2, 100, line_height, @item.name) make_font_bigger end #-------------------------------------------------------------------------- # ● 描绘能力值 #-------------------------------------------------------------------------- def draw_params(x,y) if @equip && @item make_font_smaller for i in 0..7 s2 = i < 2? $game_make_item.hmp_max : $game_make_item.params_max draw_gauge(x+88, y+18 * i+5, 265, @params / s2.to_f, text_color(14), text_color(11),true) change_color(system_color) draw_text(x, y+18 *i+5, 100, 32, ParamName) change_color(normal_color) draw_text(x+250, y+18 * i+5, 80, 32, @params.to_s+"/"+s2.to_s) end make_font_bigger end end #-------------------------------------------------------------------------- # ● 描绘参与角色能力值 #-------------------------------------------------------------------------- def draw_actors_imformation(x,y) if @actor != [] @sum_params = [0,0,0,0,0,0] @avg_params = [0,0,0,0,0,0] make_font_smaller change_color(system_color) draw_text(x, y, 80, line_height,"参与角色") change_color(normal_color) for i in 0 ... @actor.size for a in 0 .. 5 @sum_params[a] += @actor.param(a+2) @avg_params[a] = @actor.param(a+2) end draw_text(x, y+18 * (i+1), 100, line_height, @actor.name) end for i in 0 ... @avg_params.size @avg_params = @sum_params / @actor.size change_color(text_color(i*2+1)) draw_text(x+210, y+18 * (i+1), 50, line_height, @avg_params.to_s) end change_color(system_color) draw_text(x+150, y, 60, line_height,"总计:") for i in 0 ... @sum_params.size change_color(system_color) draw_text(x+80, y+18 * (i+1), 70, line_height, Vocab::param(i+2)) change_color(text_color(i*2+1)) draw_text(x+155, y+18 * (i+1), 50, line_height, @sum_params.to_s) end change_color(system_color) draw_text(x+205, y, 60, line_height,"平均:") change_color(normal_color) make_font_bigger end end #-------------------------------------------------------------------------- # ● 获取装备类型 #-------------------------------------------------------------------------- def equip_kind case MakeEquip::get_classes when 1 if MakeEquip::get_class != 4 then kind = 0 else kind = 2 end when 2 if MakeEquip::get_class != 2 then kind = 1 else kind = 3 end when 3 kind = 4 else kind = nil end return kind end #-------------------------------------------------------------------------- # ● 计算能力提升 #-------------------------------------------------------------------------- def up_param kind = equip_kind # 获取增加几率 i = rand(1000) i *= [1.0 + @sum_params[kind] * 0.001, 0.0].max i *= [1.0 + @avg_params[kind] * 0.001, 0.0].max a = 800 * [@avg_params[5] * 0.001, 0.0].max if i >= 850 - a # 获取增加的属性 sum = 0 new_params = Array.new(@add_params) for i in 0..7 new_params = -new_params if new_params < 0 sum += new_params end a = 100.0 / sum for i in 0 .. 7 new_params *= a new_params += new_params[i-1] if i > 0 end s = rand(100) ap = -1 for i in 0 .. 7 if i == 0 if s >= 0 && s < new_params[0] ap = 0 end else if s >= new_params[i-1] && s < new_params ap = i end end end ap = rand(7) if ap == -1 # 获取增加点数 相性度 = get_xx(@equip,@item) amount = @add_params[ap] / 5.0 amount = 1 if amount < 1 && amount > 0 amount = -1 if amount > -1 && amount < 0 amount *= [1.0 + 相性度 * 0.001, 0.0].max amount *= [1.0 + @avg_params[kind] * 0.001, 0.0].max draw_params_levelup(ap,amount.to_i) end refresh end #-------------------------------------------------------------------------- # ● 描绘能力提升图样 #-------------------------------------------------------------------------- def draw_params_levelup(paramid,amount,show = true) s1 = paramid < 2? $game_make_item.hmp_max : $game_make_item.params_max case amount when 0..50 icon_model = 0 when 51..10000 icon_model = 1 when -20..-1 icon_model = 2 when -10000..-20 icon_model = 3 end @params[paramid] += amount @params[paramid] = s1 if @params[paramid] > s1 if show for i in 0 .. 10 refresh case icon_model when 0 draw_icon(UP_FLAG+paramid,200,18 * (paramid+1) +5-i) when 1 draw_icon(UP_FLAG+paramid+8,200,18 * (paramid+1) +5-i) when 2 draw_icon(UP_FLAG+paramid+16,200,18 * (paramid+1) +5+i) when 3 draw_icon(UP_FLAG+paramid+24,200,18 * (paramid+1) +5+i) end Graphics.wait(1) end else refresh end end #-------------------------------------------------------------------------- # ● 完成开发(收尾工序) #-------------------------------------------------------------------------- def finish_up 相性度 = get_xx(@equip,@item) 相性度 -= 100 相性度 /= 100.0 for i in 0 .. 7 amount = @params * 相性度 if @params >= 0 r = rand(1000) if r <= @avg_params[5] amount += 1 amount *= (1.5 + @avg_params[5] * 0.01) end draw_params_levelup(i,amount.to_i,false) end end end #============================================================================== # ■ (懒得打了) #------------------------------------------------------------------------------ # 参与者窗口 #============================================================================== class Window_Makers < Window_Choose_Actor def initialize(makers) super(0,0) @actor = makers refresh end def item_max return 3 end def draw_item(index) if @actor && @actor[index] actor = @actor[index] enabled = $game_party.battle_members.include?(actor) rect = item_rect(index) draw_actor_graphic(actor, rect.x+15, rect.y+45) draw_simple_status(actor, rect.x + 35, rect.y + line_height / 6) end end def draw_item_background(index) end def update_help end def refresh contents.clear draw_all_items self.index = -1 end end #============================================================================== # ■ (懒得打了) #------------------------------------------------------------------------------ # 成功开发窗口 #============================================================================== class Window_Succeed_Make < Window_Selectable def initialize(x, y, item, equip, new_name,new_params,makers) super(x, y, window_width, window_height) @item = item @equip = equip @new_name = new_name @params = new_params @makers = makers @exp = [] refresh end def window_width return 444 end def window_height return 416 end include MakeEquip #-------------------------------------------------------------------------- # ● 绘制信息 #-------------------------------------------------------------------------- def draw_imformation draw_text(4,0,400,line_height,"开发装备成功:") draw_icon(@equip.icon_index,4,line_height+5) draw_text(27,line_height+5,200,line_height,@equip.name) draw_icon(@item.icon_index,210,line_height+5) draw_text(235,line_height+5,200,line_height,@item.name) draw_text(4,line_height*2+10,400,line_height,"开发为:") draw_icon(@equip.icon_index,4,line_height*3+10) draw_text(27,line_height*3+10,400,line_height,@[email protected]) make_font_smaller for i in 0..7 s2 = i < 2? $game_make_item.hmp_max : $game_make_item.params_max draw_gauge(95, line_height*4+8+18 * i, 275, @params / s2.to_f, text_color(14), text_color(11),true) change_color(system_color) draw_text(4, line_height*4+8+18 *i, 100, 32, ParamName) change_color(normal_color) s1 = @params - @equip.params s1 = "+"+s1.to_s if s1 >= 0 if @params > 0 s3 = -(@equip.params-@params) / @params.to_f * 100 s3 = s3.to_i else s3 = "-- " end draw_text(250, line_height*4+8+18 * i, 60, 32, s1.to_s) draw_text(315, line_height*4+8+18 * i, 60, 32, s3.to_s+"%") end cost = @item.price + @equip.price a = @equip.exp add_exp = @equip.add_exp change_color(normal_color) draw_text(4,line_height*6+133,300,32,"花费:" + cost.to_s + Vocab::currency_unit) draw_text(4,line_height*5+133,200,32,"熟练度增加:"+add_exp.to_s) if @equip.need_exp == 0 change_color(text_color(2)) draw_text(190, line_height*5+133, 180, 32, "已是最高级!") else for i in 0...add_exp a += 1 draw_gauge(125, line_height*5+132, 245, a.to_f / @equip.need_exp, text_color(14), text_color(11)) break if a >= @equip.need_exp Graphics.wait(2) end draw_text(300, line_height*5+133, 60, 32, a.to_s + "/" + @equip.need_exp.to_s) if a >= @equip.need_exp change_color(text_color(2)) draw_text(168, line_height*5+133, 100, 32, "解锁新装备!") s_last = @equip.next_level kind = 0 if @equip.is_a?(RPG::Weapon) kind = 1 if @equip.is_a?(RPG::Armor) for i in 0...s_last.size n = s_last kind == 0 ? $data_weapons[n].lock = false : $data_armors[n].lock = false end end @equip.exp = a end make_font_bigger change_color(normal_color) end #-------------------------------------------------------------------------- # ● 绘制增加经验 #-------------------------------------------------------------------------- def draw_addexp(exp) make_font_smaller change_color(system_color) draw_text(4, line_height*7+133, 300, 32, "增加经验:") change_color(normal_color) for i in 0 ... @makers.size draw_text(4, line_height*7+133+18 * (i+1), 100, 32, @makers.name) change_color(text_color(11)) s1 = @makers.max_level? ? nil : @makers.exp s2 = @makers.max_level? ? nil : @makers.next_level_exp - @makers.exp s3 = @makers.max_level? ? nil : @makers.next_level_exp if s1 && s2 a = 0 while a < exp if exp <= 360 add = 1 elsif exp > 360 && exp <= 999 add = 3 elsif exp >= 1000 && exp < 5000 add = 10 elsif exp >= 5000 && exp <= 20000 add = 50 elsif exp > 20000 && exp <= 50000 add = 100 elsif exp > 50000 add = 500 end if (a + add) <= exp a += add @makers.change_exp(@makers.exp + add, false) else s = exp - a a = exp @makers.change_exp(@makers.exp + s, false) end draw_gauge(110, line_height*7+133+18 * (i+1), 265, @makers.exp / @makers.next_level_exp.to_f, text_color(10), text_color(11)) Graphics.wait(1) end if @makers.exp >= s3 draw_text(280, line_height*7+133+18 * (i+1), 100, 32, "Level UP!!") end else draw_gauge(110, line_height*7+133+18 * (i+1), 265, 1.0, text_color(10), text_color(11)) change_color(text_color(2)) draw_text(280, line_height*7+133+18 * (i+1), 100, 32, "Max Level") change_color(text_color(11)) end draw_text(110, line_height*7+133+18 * (i+1), 50, 32, "+" + @exp.to_s) change_color(normal_color) end make_font_bigger end #-------------------------------------------------------------------------- # ● 刷新 #-------------------------------------------------------------------------- def refresh contents.clear 相性度 = get_xx(@equip,@item) sum_exp = rand(200) * 相性度 - @makers.size * rand(100) for i in 0 ... @makers.size @exp = @makers.level * sum_exp / 90 + rand(10) end draw_imformation draw_addexp(@exp) end end module DataManager #-------------------------------------------------------------------------- # ● 生成存档内容 #-------------------------------------------------------------------------- def self.make_save_contents contents = {} contents[:system] = $game_system contents[:timer] = $game_timer contents[:message] = $game_message contents[:switches] = $game_switches contents[:variables] = $game_variables contents[:self_switches] = $game_self_switches contents[:actors] = $game_actors contents[:party] = $game_party contents[:troop] = $game_troop contents[:map] = $game_map contents[:player] = $game_player contents[:make_item] = $game_make_item contents[:weapons] = $data_weapons contents[:armors] = $data_armors contents end #-------------------------------------------------------------------------- # ● 展开存档内容 #-------------------------------------------------------------------------- def self.extract_save_contents(contents) $game_system = contents[:system] $game_timer = contents[:timer] $game_message = contents[:message] $game_switches = contents[:switches] $game_variables = contents[:variables] $game_self_switches = contents[:self_switches] $game_actors = contents[:actors] $game_party = contents[:party] $game_troop = contents[:troop] $game_map = contents[:map] $game_player = contents[:player] $game_make_item = contents[:make_item] $data_weapons = contents[:weapons] $data_armors = contents[:armors] end end 第三个 |
=begin ================================================ 装备开发系统 版本 1.32 By 804173948 QQ:同上 ================================================ 更新: 优化画面美观度 与“装备扩展”结合 装备里备注与原脚本相同(类别用 class 数值 与 @type[数值] 功能相同) 自制分类道具栏(可能会发生冲突) Command 可拥有图标、上色 注意: 本系统只是测试版,可能会有BUG之类的,会不定期更新 使用说明: 1、物品备注填写: 如果这个物品能够被用来开发装备,请按以下要求填写备注—— 1、前缀名:<name 名称> 说明:装备开发成功后装备的名称会加上前缀名,如果不填,则取此物品名称的第一个字作为前缀名 如:<name 铁> 开发“剑”武器,成功后就会变成“铁剑” 2、增加能力:<mhp\mmp\atk\def\mat\mdf\agi\luk 数值> 说明:用来提升被开发的装备的各项能力 如:<mhp 100> <atk 25> <def 2> <mat -1> 3、物品类别:<class 数值> 说明:物品的类别(把相近的物品划分为同一类) 注意:数值最好为 0 ~ 15 区间内 如需增加,请修改相性 简单的例子: 物品 1 名称是“铁” 物品 2 名称是“铜” 这两个物品都是金属,所以应该分为同一类 我们把他们分为 第 4 类(<class 4>),那么第四类就是“金属类” 每类物品与每种装备装备对应的相性值请搜索“设置相性”修改 4、能被开发的标志:<useable> 说明:只有写上“<useable>”才能被选择开发材料的窗口显示 备注填写例子: <name 木> <atk 1> <def 1> <class 3> <useable> 武器、防具备注填写: 如果这个装备能够被开发,请按以下要求填写备注—— 1、熟练度:<exp 数值> 说明:开发这个装备的熟练度,如果此装备无法升级则不填 2、熟练度增加:<add 数值> 说明:每次开发成功增加的熟练度,如果熟练度满了则解锁新装备,如果此装备无法升级则不填 提示:n号武器的熟练度存储在变量 $game_make_item.weapon_exp[n] 中 n号防具的熟练度存储在变量 $game_make_item.armor_exp[n] 中 直接修改熟练度方法: 武器 $data_weapons[id].exp = 新数量 防具 $data_armors[id].exp = 新数量 3、下一级装备:<next 装备ID> 说明:熟练度满了之后解锁的装备,如果此装备无法升级则不填 如:<next 100> (解锁100号装备(武器或防具)) <next 31,38,40> (同时解锁31、38、40号装备(武器或防具)) 注意:最多只能同时解锁4个装备 4、装备种类:<class 数值> 说明:装备的类别(子类型) 注意:数值最好为 0 ~ 7 区间内(武器则是 0 ~ 6) 如需增加,请按要求修改子类型(极度不建议) 每类物品与每种装备装备对应的相性值请搜索“设置相性”修改 5、一开始就解锁的标志:<BASIC>(又名“基础装备”) 说明:只有写上“<BASIC>”才能被一开始解锁 6、神秘装备的标志:<lock> 说明:即使上一级的熟练度满了也不一定解锁,需要满足一定的条件才解锁 提示:解锁武器:脚本:$data_weapons[id].lock = false(解锁)/ true(上锁) 解锁防具:脚本:$data_armors[id].lock = false(解锁)/ true(上锁) 提示: <BASIC> 和 <lock> 可写在同一装备的备注上,但不是一开始就解锁 能力上限可更改,详情请见101行 备注填写例子: <exp 80> <add 4> <next 20> <class 1> <BASIC> 注意:判断防具是否饰品: 把防具的装备位置改为“饰品” 2、其他: 修改 最大参加开发人数 方法 $game_make_item.max_maker = 数值(1~3) 如: $game_make_item.max_maker = 2 那么开发时就可以2个人一起开发了! (为什么最大是3? 因为太多 1、界面显示不了 ; 2、游戏的不平衡) 修改 各种属性开发最大值 方法 $game_make_item.hmp_max = 数值 (HP、MP最大值修改)默认值是1000 $game_make_item.params_max = 数值 (六种属性最大值修改)默认值是100 说明有待补充 各种冲突: 1、与“物品颜色描绘”脚本 可能发生冲突! 冲突症状:1、直接弹出错误 2、“物品颜色描绘”功能失效 解决方法:去掉“重新定义”的 218~250 行 注释,再删掉 251~258行 其他暂未发现 BUG: 暂无 备注: 本脚本可以简化的(本人偷懒) (有待简化) 范例的数据库只做了武器 防具还是懒得做了 不要问我数据库里空了的装备是什么,这是国家机密 还有……本人英文水平不好 开始写的时候才刚初二 有许多单词拼写不规范(如:饰品 写成 earring) =end #============================================================================== # ■ MakeEquip #------------------------------------------------------------------------------ # 模块:开发装备 #============================================================================== module MakeEquip # 子类型(可自由修改) $weapon = ["刀刃","钝器","弓箭","拳套","法杖","其它"] # 武器 $armor = ["头盔","铠甲","魔甲","护腕","战靴","盾牌"] # 防具 $earring = ["头巾","耳环","项链","手鞠","戒指","腰饰","其它"] # 饰品 # 物品类别 $kind_of_item = ["普通布料","魔法布料","岩石","木料","金属","重金属","魔法金属","羽","宝石","其他"] # 人气值(用途:开发成功后增加售价)(百分比) $weapon_hot = [45,23,34,18,39,0 ,17] $armor_hot = [21,51,43,37,19,30,0,9] $earring_hot = [21,18,27,21,38,13,0,19] # 设置相性(不会修改者可无视) $weapon_xx = { # 类 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 …… "刀刃" => [25 ,20 ,110 ,110 ,135 ,160 ,125 ,15 ,150 ,120 ,140 ,85 ,25 ,30 ], "钝器" => [10 ,5 ,120 ,130 ,140 ,180 ,120 ,5 ,160 ,105 ,200 ,100 ,50 ,60 ], "弓箭" => [50 ,50 ,30 ,120 ,45 ,40 ,60 ,140 ,145 ,150 ,135 ,145 ,120 ,140 ], "拳套" => [105 ,110 ,120 ,72 ,120 ,145 ,140 ,35 ,165 ,175 ,125 ,35 ,15 ,25 ], "法杖" => [10 ,20 ,30 ,120 ,25 ,15 ,150 ,65 ,180 ,70 ,100 ,135 ,135 ,165 ], "其它" => [50 ,50 ,120 ,100 ,100 ,95 ,125 ,150 ,200 ,115 ,125 ,120 ,70 ,100 ], #如需增加子类型 #从这里增加(格式:"子类型名称" => [相性1,2,3...15,16(或更多)]) #相性:对于物品的类型的相性 #例如:相性1 = 对1类别的物品的相性度 如此类推 #注意:"子类型名称" 要与 $weapon 同步 #下同:$armor_xx、$earring_xx 分别是“防具的相性”、“饰品的相性” } $armor_xx = { # 类 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 …… "头盔" => [120 ,40 ,60 ,100 ,140 ,155 ,145 ,40 ,180 ,15 ,70 ,55 ,20 ,20 ], "铠甲" => [110 ,85 ,50 ,90 ,150 ,160 ,165 ,5 ,200 ,10 ,75 ,50 ,15 ,20 ], "魔甲" => [150 ,100 ,30 ,45 ,50 ,45 ,180 ,65 ,200 ,20 ,75 ,60 ,20 ,30 ], "护腕" => [145 ,70 ,60 ,80 ,115 ,135 ,140 ,25 ,175 ,25 ,75 ,40 ,15 ,25 ], "战靴" => [150 ,90 ,10 ,50 ,65 ,15 ,120 ,110 ,175 ,30 ,105 ,30 ,50 ,55 ], "盾牌" => [25 ,5 ,50 ,60 ,140 ,180 ,125 ,5 ,160 ,5 ,115 ,100 ,110,125], } $earring_xx = { # 类 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 …… "头巾" => [105,110,15 ,20 ,50 ,35 ,55 ,140 ,135 ,70 ,60 ,40 ,20 ,15 ], "耳环" => [5 ,15 ,20 ,60 ,80 ,70 ,100,100 ,180 ,70 ,125 ,110,20 ,25 ], "项链" => [10 ,15 ,10 ,50 ,120 ,115 ,150,115 ,170 ,60 ,100 ,95 ,25 ,20 ], "手鞠" => [30 ,40 ,15 ,80 ,115 ,140 ,145,75 ,180 ,55 ,105 ,80 ,25 ,25 ], "戒指" => [25 ,40 ,10 ,35 ,100 ,135 ,145,95 ,200 ,35 ,125 ,55 ,30 ,35 ], "腰饰" => [70 ,80 ,20 ,50 ,70 ,45 ,90 ,155 ,135 ,30 ,120 ,60 ,35 ,35 ], "其它" => [40 ,40 ,10 ,35 ,90 ,75 ,115,120 ,150 ,25 ,115 ,50 ,10 ,20 ], } @class = 0 @classes = 0 @item = nil @equip = nil UP_FLAG = 32 # 能力上升标志图片 ADDNAME = "name" CLASS = "class" USEABLE = "useable" NEED_EXP = "exp" ADD_EXP = "add" NEXT_LEVEL = "next" LOCK = "lock" BASIC = "BASIC" ADDPARAM = ["mhp","mmp","atk","def","mat","mdf","agi","luk"] # 每个能力的名称(可修改) ParamName = ["血量上限","魔法上限","物理破坏力","物理防御力","魔法破坏力","魔法防御力","灵巧值","幸运值"] def self.get_or_save_ie(type=true,item,equip) if type ie = [@item,@equip] return ie else @item = item @equip = equip return end end def self.save_class(value) @class = value end def self.get_class return @class end def self.save_classes(value) @classes = value end def self.get_classes return @classes end end class Scene_Title < Scene_Base #-------------------------------------------------------------------------- # ● 指令“开始游戏” #-------------------------------------------------------------------------- alias old command_new_game def command_new_game old for i in 1...$data_weapons.size $game_party.gain_item($data_weapons,-99,true) end for i in 1...$data_armors.size $game_party.gain_item($data_armors,-99,true) end end end #============================================================================== # ■ Scene_Make_Item #------------------------------------------------------------------------------ # 开发装备 #============================================================================== class Scene_Make_Item < Scene_MenuBase include MakeEquip attr_reader :equip attr_reader :item #-------------------------------------------------------------------------- # ● 开始 #-------------------------------------------------------------------------- def start super create_window end #-------------------------------------------------------------------------- # ● 生成指令窗口 #-------------------------------------------------------------------------- def create_window create_make_choose_window end #-------------------------------------------------------------------------- # ● 帮助窗口 #-------------------------------------------------------------------------- def create_help_window @help_window = Window_equip_imformation.new(@make_item_window.x,@make_choose_window.height,@make_item_window.width,Graphics.height - @make_choose_window.height - @make_item_window.height) @help_window.viewport = @viewport @make_item_window.help_window = @help_window end #-------------------------------------------------------------------------- # ● 选择类型窗口 #-------------------------------------------------------------------------- def create_make_choose_window @make_choose_window = Window_make_choose.new(0,0) @make_choose_window.height = 48 @make_choose_window.set_handler(:weapon ,method(:makeweapon)) @make_choose_window.set_handler(:armor ,method(:makearmor)) @make_choose_window.set_handler(:earring,method(:makeearring)) @make_choose_window.set_handler(:cancel ,method(:return_scene)) end #-------------------------------------------------------------------------- # ● 选择子类型窗口 #-------------------------------------------------------------------------- def create_make_weapon_window @make_window = Window_make_weapon.new(0,@make_choose_window.height,@make_item_window.x,Graphics.height - @make_choose_window.height) @make_window.set_handler(:ok ,method(:choose_sonkind)) @make_window.set_handler(:cancel ,method(:return_to_choose_mainkind)) @make_window.help_window = @make_item_window end def create_make_armor_window @make_window = Window_make_armor.new(0,@make_choose_window.height,@make_item_window.x,Graphics.height - @make_choose_window.height) @make_window.set_handler(:ok ,method(:choose_sonkind)) @make_window.set_handler(:cancel ,method(:return_to_choose_mainkind)) @make_window.help_window = @make_item_window end def create_make_earring_window @make_window = Window_make_earring.new(0,@make_choose_window.height,@make_item_window.x,Graphics.height - @make_choose_window.height) @make_window.set_handler(:ok ,method(:choose_sonkind)) @make_window.set_handler(:cancel ,method(:return_to_choose_mainkind)) @make_window.help_window = @make_item_window end #-------------------------------------------------------------------------- # ● 装备列表 #-------------------------------------------------------------------------- def create_make_item_window # 装备列表 @make_item_window = Window_make_item.new#(@actor) @make_item_window.x = 135 #@make_window.width #Graphics.width - @make_item_window.width @make_item_window.y = Graphics.height - @make_item_window.height @make_item_window.set_handler(:ok ,method(:make_item)) @make_item_window.set_handler(:cancel ,method(:close_make_item)) end #-------------------------------------------------------------------------- # ● 物品列表 #-------------------------------------------------------------------------- def create_item_window # 物品列表 @item_window_help_text = Window_Text_Help.new(325,0,219,48) @item_window_help_text.draw_help_text("选择材料开发装备") @item_window = Window_item.new(325,48,219,368)#(@actor) @item_window.set_handler(:ok ,method(:call_sure_make)) @item_window.set_handler(:cancel ,method(:back_to_equip_list)) @item_window.activate end #-------------------------------------------------------------------------- # ● 钱不够了 #-------------------------------------------------------------------------- def create_no_enough_gold @no_gold_window = Window_Text_Help.new(162,182,220,48) @no_gold_window.draw_help_text(" 金钱不足! ") @no_gold_window.set_handler(:ok ,method(:return_scene)) @no_gold_window.set_handler(:cancel ,method(:return_scene)) @no_gold_window.activate end #-------------------------------------------------------------------------- # ● 确认框(是 则Call 另一场景) #-------------------------------------------------------------------------- def create_sure_make_window # 确认 @sure_make_window = Window_sure_make.new#(@actor) @sure_make_window.set_handler(:yes_make,method(:sure_make)) @sure_make_window.set_handler(:no_make ,method(:back_to_choose_item)) @sure_make_window.set_handler(:cancel ,method(:back_to_choose_item)) @sure_make_window.activate end #-------------------------------------------------------------------------- # ● 相性及详细窗口 #-------------------------------------------------------------------------- def create_make_imformation_window # 相性及详细窗口 @make_imformation_window = Window_make_imformation.new#(@actor) @item_window.help_window = @make_imformation_window @item_window.equip = @make_item_window.get_item end #-------------------------------------------------------------------------- # ● 关闭所有类型窗口 #-------------------------------------------------------------------------- def all_close @make_window.hide @make_window.deactivate @make_choose_window.hide @make_choose_window.deactivate end #-------------------------------------------------------------------------- # ● 选择类型 #-------------------------------------------------------------------------- def makeweapon MakeEquip::save_classes(1) @make_window.hide if @make_window makeoneitem create_make_weapon_window @make_window.activate end def makearmor MakeEquip::save_classes(2) @make_window.hide if @make_window makeoneitem create_make_armor_window @make_window.activate end def makeearring MakeEquip::save_classes(3) @make_window.hide if @make_window makeoneitem create_make_earring_window @make_window.activate end #-------------------------------------------------------------------------- # ● 进入选择装备 #-------------------------------------------------------------------------- def makeoneitem create_make_item_window create_help_window end #-------------------------------------------------------------------------- # ● 选择装备 #-------------------------------------------------------------------------- def choose_sonkind @make_item_window.activate @make_item_window.index = 0 end #-------------------------------------------------------------------------- # ● 选择父类型 #-------------------------------------------------------------------------- def return_to_choose_mainkind @make_window.hide @make_item_window.hide @help_window.hide @make_choose_window.activate end #-------------------------------------------------------------------------- # ● 关闭选择装备窗口? #-------------------------------------------------------------------------- def close_make_item @make_window.activate end #-------------------------------------------------------------------------- # ● 确认MakeItem? #-------------------------------------------------------------------------- def make_item # 确认MakeItem if @make_item_window.get_item equip = @make_item_window.get_item if equip.price > $game_party.gold create_no_enough_gold @help_window.hide else all_close create_item_window create_make_imformation_window @help_window.hide @make_item_window.hide end else @make_item_window.activate end end #-------------------------------------------------------------------------- # ● 选择好装备以及物品,call #-------------------------------------------------------------------------- def call_sure_make item = @item_window.item if item equip = @make_item_window.get_item if equip.price + item.price > $game_party.gold create_no_enough_gold else create_sure_make_window end else $data_system.sounds[3].play @item_window.activate end end #-------------------------------------------------------------------------- # ● goto : Scene_Making_Imformation #-------------------------------------------------------------------------- def sure_make @item = @item_window.item @equip = @item_window.equip MakeEquip::get_or_save_ie(false,@item,@equip) @make_item_window.deactivate @make_item_window.close @help_window.close @sure_make_window.close @make_window.close @make_choose_window.close SceneManager.goto(Scene_Making_Imformation) end #-------------------------------------------------------------------------- # ● 看英文 #-------------------------------------------------------------------------- def back_to_choose_item @sure_make_window.deactivate @sure_make_window.hide @item_window.activate end #-------------------------------------------------------------------------- # ● 继续看英文 #-------------------------------------------------------------------------- def back_to_equip_list @item_window.deactivate @item_window.hide @item_window_help_text.hide @make_imformation_window.hide @help_window.show @make_item_window.show @make_window.show @make_choose_window.show @make_item_window.activate end #-------------------------------------------------------------------------- # ● ???(貌似作废) #-------------------------------------------------------------------------- def make_new_equip(equip_id, equip_kind) if /<#{LOCK}>/i =~ equip_id.note eid = equip_id.data_id case equip_kind when 1 return if @unluckw[eid] = false when 2 return if @unlucka[eid] = false end end return equip_id end end #============================================================================== # ■ Get_Item_P #------------------------------------------------------------------------------ # 获取道具信息 #============================================================================== class RPG::Item < RPG::UsableItem include MakeEquip def addname if @note =~ /<#{ADDNAME}\s*(\S+?)>/i return $1 ? $1.to_s : @name[0,1] end return @name[0,1] end def add_params(param_id) if @note =~ /<#{ADDPARAM[param_id]} (\d+)\>/i return $1 ? $1.to_i : 0 elsif @note =~ /<#{ADDPARAM[param_id]} -(\d+)\>/i i = $1 ? $1.to_i : 0 return -i end return 0 end def class_id if @note =~ /<#{CLASS} (\d+)\>/i return $1 ? $1.to_i : -1 end return -1 end def is_useable? return true if @note =~ /<#{USEABLE}>/i return false end end #============================================================================== # ■ Get_Weapon_P #------------------------------------------------------------------------------ # 获取武器信息 #============================================================================== class RPG::Weapon < RPG::EquipItem include MakeEquip attr_accessor :lock attr_accessor :exp alias old initialize def initialize old is_lock? @exp = 0 end def is_lock? if @note =~ /<#{BASIC}>/i && @note !~ /<#{LOCK}>/i @lock = false else @lock = true end return @lock end def need_exp if @note =~ /<#{NEED_EXP} (\d+)\>/i return $1 ? $1.to_i : 1 end return 0 end def add_exp if @note =~ /<#{ADD_EXP} (\d+)\>/i return $1 ? $1.to_i : 1 end return 0 end def next_level unlock_level = [] if @note =~ /<#{NEXT_LEVEL} (\d+)\>/i or @note =~ /<#{NEXT_LEVEL} (\d+)\, (\d+)>/i unlock_level[0] = $1.to_i if $1 unlock_level[1] = $2.to_i if $2 elsif @note =~ /<#{NEXT_LEVEL} (\d+)\, (\d+)\, (\d+)\>/i or @note =~ /<#{NEXT_LEVEL} (\d+)\, (\d+), (\d+), (\d+)>/i unlock_level[0] = $1.to_i if $1 unlock_level[1] = $2.to_i if $2 unlock_level[2] = $3.to_i if $3 unlock_level[3] = $4.to_i if $4 end return unlock_level end def class_id if @note =~ /<#{CLASS} (\d+)\>/i return $1 ? $1.to_i : -1 elsif /@etype\[(.+?)\]/ =~ @note return $1 ? $1.to_i : -1 end return -1 end end #============================================================================== # ■ Get_Armor_P #------------------------------------------------------------------------------ # 获取防具信息 #============================================================================== class RPG::Armor < RPG::EquipItem include MakeEquip attr_accessor :lock attr_accessor :exp alias old initialize def initialize old @etype_id = class_id is_lock? @exp = 0 end def is_lock? if @note =~ /<#{BASIC}>/i && @note !~ /<#{LOCK}>/i @lock = false else @lock = true end return @lock end def need_exp if @note =~ /<#{NEED_EXP} (\d+)\>/i return $1 ? $1.to_i : 1 end return 0 end def add_exp if @note =~ /<#{ADD_EXP} (\d+)\>/i return $1 ? $1.to_i : 1 end return 0 end def next_level unlock_level = [] if @note =~ /<#{NEXT_LEVEL} (\d+)\>/i or @note =~ /<#{NEXT_LEVEL} (\d+)\, (\d+)>/i unlock_level[0] = $1.to_i if $1 unlock_level[1] = $2.to_i if $2 elsif @note =~ /<#{NEXT_LEVEL} (\d+)\, (\d+)\, (\d+)\>/i or @note =~ /<#{NEXT_LEVEL} (\d+)\, (\d+), (\d+), (\d+)>/i unlock_level[0] = $1.to_i if $1 unlock_level[1] = $2.to_i if $2 unlock_level[2] = $3.to_i if $3 unlock_level[3] = $4.to_i if $4 end return unlock_level end def class_id if @note =~ /<#{CLASS} (\d+)\>/i return $1 ? $1.to_i : @etype_id elsif /@etype\[(.+?)\]/ =~ @note return $1 ? $1.to_i : @etype_id end return @etype_id end end class Window_make_choose < Window_HorzCommand def window_width return Graphics.width end def col_max return 3 end #-------------------------------------------------------------------------- # ● 生成指令列表 #-------------------------------------------------------------------------- def make_command_list add_command("开发武器", :weapon) add_command("开发防具", :armor) add_command("开发饰品", :earring) end end class Window_make_weapon < Window_Selectable def initialize(x, y, width, height) super(x, y, width, height) refresh end #-------------------------------------------------------------------------- # ● 获取项目数 #-------------------------------------------------------------------------- def item_max return $weapon.size end #-------------------------------------------------------------------------- # ● 生成指令列表 #-------------------------------------------------------------------------- def draw_item(index) draw_text(item_rect(index),$weapon[index],1) end #-------------------------------------------------------------------------- # ● 更新帮助内容 #-------------------------------------------------------------------------- def update_help @help_window.contents.clear @help_window.make_command_list(@index) @help_window.update_help end end class Window_make_armor < Window_Selectable def initialize(x, y, width, height) super(x, y, width, height) refresh end #-------------------------------------------------------------------------- # ● 获取项目数 #-------------------------------------------------------------------------- def item_max return $armor.size end #-------------------------------------------------------------------------- # ● 生成指令列表 #-------------------------------------------------------------------------- def draw_item(index) draw_text(item_rect(index),$armor[index],1) end #-------------------------------------------------------------------------- # ● 更新帮助内容 #-------------------------------------------------------------------------- def update_help @help_window.contents.clear @help_window.make_command_list(@index) @help_window.update_help end end class Window_make_earring < Window_Selectable def initialize(x, y, width, height) super(x, y, width, height) refresh end #-------------------------------------------------------------------------- # ● 获取项目数 #-------------------------------------------------------------------------- def item_max return $earring.size end #-------------------------------------------------------------------------- # ● 生成指令列表 #-------------------------------------------------------------------------- def draw_item(index) draw_text(item_rect(index),$earring[index],1) end #-------------------------------------------------------------------------- # ● 更新帮助内容 #-------------------------------------------------------------------------- def update_help @help_window.contents.clear @help_window.make_command_list(@index) @help_window.update_help end end class Window_make_item < Window_Selectable include MakeEquip #-------------------------------------------------------------------------- # ● 初始化对象 #-------------------------------------------------------------------------- def initialize super(0, 0,window_width,fitting_height(3)) @itemkind = 0 @itemid = [] @item_max = 0 @hot = 0 make_command_list end def visible_line_number return 3 end def clear_data @itemkind = 0 @itemid = [] @item_max = 0 @hot = 0 end def item_max if @item_max return @item_max else return 0 end end def row_max [(item_max + col_max - 1) / col_max, 1].max end def col_max return 2 end #-------------------------------------------------------------------------- # ● 获取窗口的宽度 #-------------------------------------------------------------------------- def window_width return Graphics.width - 135 end #-------------------------------------------------------------------------- # ● 获取装备 #-------------------------------------------------------------------------- def get_item if item return @itemkind == 0 ? $data_weapons[item] : $data_armors[item] end return nil end def item @itemid && self.index >= 0 ? @itemid[self.index] : nil end #-------------------------------------------------------------------------- # ● 获取道具 #-------------------------------------------------------------------------- def make_command_list(kind_class = MakeEquip::get_class - 1) MakeEquip::save_class(kind_class + 1) clear_data case MakeEquip::get_classes when 1 @hot = $weapon_hot[MakeEquip::get_class - 1] a = 0 for i in 1...$data_weapons.size di = $data_weapons if di.class_id == MakeEquip::get_class - 1 next if di.lock @itemid[a] = i a += 1 @itemkind = 0 @item_max = a draw_item(a - 1) end end if item_max != 0 @index = 0 end when 2 @hot = $armor_hot[MakeEquip::get_class - 1] a = 0 for i in 1...$data_armors.size di = $data_armors if di.etype_id == MakeEquip::get_class && di.etype_id <= HzhjEquip::ETYPE_ADD_NAME.size next if di.lock @itemid[a] = i a += 1 @itemkind = 1 @item_max = a draw_item(a - 1) end end if item_max != 0 @index = 0 end when 3 @hot = $earring_hot[MakeEquip::get_class - 1] a = 0 for i in 1...$data_armors.size di = $data_armors if di.etype_id == MakeEquip::get_class + $earring.size && di.etype_id > HzhjEquip::ETYPE_ADD_NAME2.size next if di.lock @itemid[a] = i a += 1 @itemkind = 1 @item_max = a draw_item(a - 1) end end if item_max != 0 @index = 0 end end end #-------------------------------------------------------------------------- # ● 更新帮助 #-------------------------------------------------------------------------- def update_help @help_window.contents.clear @help_window.draw_item_imformation(@itemid[self.index] ,@itemkind, 4, 0,@hot)#, window_width - 150) end #-------------------------------------------------------------------------- # ● 绘制项目 #-------------------------------------------------------------------------- def draw_item(index) item = @itemid[index] if item rect = item_rect(index) rect.width -= 4 if @itemkind == 0 draw_item_name($data_weapons[item], rect.x, rect.y, true,item_width) else draw_item_name($data_armors[item], rect.x, rect.y, true,item_width) end end end end #============================================================================== # ■ Window_equip_imformation #------------------------------------------------------------------------------ # 装备资料画面 #============================================================================== class Window_equip_imformation < Window_Base #-------------------------------------------------------------------------- # ● 初始化对象 #-------------------------------------------------------------------------- def initialize(x, y,width,height) super(x, y, width, height) end #-------------------------------------------------------------------------- # ● 获取窗口的宽度 #-------------------------------------------------------------------------- def window_width return Graphics.width - 135 end #-------------------------------------------------------------------------- # ● 获取窗口的高度 #-------------------------------------------------------------------------- def window_height return Graphics.height - 172 end #-------------------------------------------------------------------------- # ● 绘制装备资料 #-------------------------------------------------------------------------- def draw_item_imformation(itemid ,itemkind, x, y,hot) draw_item_all(itemid ,itemkind, x, y,width,hot) end #-------------------------------------------------------------------------- # ● 刷新 #-------------------------------------------------------------------------- def refresh end #-------------------------------------------------------------------------- # ● 打开窗口 #-------------------------------------------------------------------------- def open refresh super end end #============================================================================== # ■ Window_item #------------------------------------------------------------------------------ # 选择用来开发的材料 #============================================================================== class Window_item < Window_ItemList attr_accessor :equip def initialize(x, y, width, height) super @category = :item @data = [] refresh end #-------------------------------------------------------------------------- # ● 获取列数 #-------------------------------------------------------------------------- def col_max return 1 end #-------------------------------------------------------------------------- # ● 获取间隔 #-------------------------------------------------------------------------- def spacing return 32 end #-------------------------------------------------------------------------- # ● 能否使用? #-------------------------------------------------------------------------- def current_item_enabled? return true end #-------------------------------------------------------------------------- # ● 获取道具 #-------------------------------------------------------------------------- def make_item_list @data = $game_party.all_items.select {|item| include?(item) } # 获取某类型的持有道具 @data.push(nil) if include?(nil) @data = @data.select {|item| item.is_useable? } # 获取能用的道具 end #-------------------------------------------------------------------------- # ● 绘制项目 #-------------------------------------------------------------------------- def draw_item(index) item = @data[index] if item show rect = item_rect(index) rect.width -= 4 draw_item_name(item, rect.x, rect.y, true,172) draw_item_number(rect, item) else hide end end #-------------------------------------------------------------------------- # ● 更新帮助 #-------------------------------------------------------------------------- def update_help @help_window.contents.clear @help_window.set_item(item,@equip) end #-------------------------------------------------------------------------- # ● 刷新 #-------------------------------------------------------------------------- def refresh make_item_list create_contents draw_all_items end end #============================================================================== # ■ Window_Text_Help #------------------------------------------------------------------------------ # 帮助文本 #============================================================================== class Window_Text_Help < Window_Selectable def initialize(x, y, width, height) super refresh end #-------------------------------------------------------------------------- # ● 设置文本 #-------------------------------------------------------------------------- def draw_help_text(text = "") draw_text_ex(2,0,text,width - 4) end def refresh draw_help_text end end #============================================================================== # ■ Window_make_imformation #------------------------------------------------------------------------------ # 选择道具窗口帮助 #============================================================================== class Window_make_imformation < Window_Base def initialize super(0,0,325,416) refresh end #-------------------------------------------------------------------------- # ● 设置物品 # item : 技能、物品等 #-------------------------------------------------------------------------- def set_item(item,equip) draw_ie_imformation(item,equip) end #-------------------------------------------------------------------------- # ● 刷新 #-------------------------------------------------------------------------- def refresh end end #============================================================================== # ■ Window_sure_make #------------------------------------------------------------------------------ # 开发装备(选择角色开发) #============================================================================== class Window_sure_make < Window_Command def initialize super(0, 0) update_placement self.openness = 0 open end #-------------------------------------------------------------------------- # ● 获取窗口的宽度 #-------------------------------------------------------------------------- def window_width return 140 end #-------------------------------------------------------------------------- # ● 更新窗口的位置 #-------------------------------------------------------------------------- def update_placement self.x = 544 - window_width self.y = 416 - window_height end #-------------------------------------------------------------------------- # ● 生成指令列表 #-------------------------------------------------------------------------- def make_command_list add_command("开发装备",:yes_make) add_command(" 返回 ",:no_make) end end 第二个 |
#encoding:utf-8 #============================================================================== # ■ Game_Make_Item #------------------------------------------------------------------------------ # 管理开发装备的类。保存有熟练度、解锁等的信息。本类的实例请参考 $game_make_item 。 #============================================================================== class Game_Make_Item attr_accessor :hmp_max # MHP、MMP的上限 attr_accessor :params_max # ATK、DEF、MAT、MDF、AGI、LUK的上限 attr_accessor :max_maker # 最大参加开发 #-------------------------------------------------------------------------- # ● 初始化对象 #-------------------------------------------------------------------------- def initialize @max_maker = 1 @hmp_max = 1000 @params_max = 100 init_exp_and_lock end #-------------------------------------------------------------------------- # ● 初始化信息 #-------------------------------------------------------------------------- def init_exp_and_lock for i in 1 ... $data_weapons.size $data_weapons[i].is_lock? $data_weapons[i].exp = 0 end for i in 1 ... $data_armors.size $data_armors[i].is_lock? $data_armors[i].exp = 0 end end end 第一个{:2_270:} |
LZ先问一句你的脚本真的全部复制上来了么……你的脚本我这里直接报错,连打开都没办法打开还谈什么修改字体颜色………… |
站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作
GMT+8, 2024-5-5 00:00
Powered by Discuz! X3.1
© 2001-2013 Comsenz Inc.