# # Mosaic System (Applicable with MOG_Monogatari by Moghunter) # 属性镶嵌系统 # Esp 2016.04.16 by 影月千秋 # # Mosaic module Mosaic # 镶嵌场景中帮助窗口, 装备窗口, 宝石窗口, 提示窗口 的 [x, y, 宽, 高] HelpWindow = [Graphics.width * 2 / 3, 0, Graphics.width / 3, Graphics.height] EquipWindow = [0, 0, Graphics.width / 3, Graphics.height] GemWindow = [Graphics.width / 3, 0, Graphics.width / 3, Graphics.height] PromptWindow = [Graphics.width * 0.4, Graphics.height * 0.4, Graphics.width * 0.2, Graphics.height * 0.15] # 镶嵌确认窗口的宽度 # 高度是自适应的 ConfirmWidth = 0.65 * Graphics.width # 确认窗口的显示格式 # 用<equip>代替当前镶嵌装备 <gem>代表当前镶嵌宝石 <gold>当前持有金钱 # <cost>镶嵌费用 ConfirmFormat = %w! <equip> <gem> 持有金钱: <gold> 需要金钱: <cost> ! # 确认窗口的两个按钮的名字 ConfirmText = "确认" CancelText = "取消" # 提示窗口出现的时间 PromptCount = 60 # 镶嵌成功或者失败(金钱不足)时的提示文字 MosaicSucceed = "镶嵌成功" MosaicFail = "金钱不足" # 致菜单脚本作者: # 镶嵌装备的说明(description)是在 Mosaicked#description 里实现的 # 如果你打算拓展帮助 可以从这里入手 # 镶嵌的宝石属性类型的最大数目 # 这个数目不包括装备掉落时随机生成的属性数目 MaxNewGemCount = 2 # 用于在数据库备注匹配识别宝石id的正则式 # 在物品的备注栏加上 <gem XX> XX表示属性编号 #例如 <gem 0> 表示是HP的宝石 <gem 1> MP宝石 …………以此类推 GemTypeRegexp = /<gem (\d+)>/i # NewParamChance: 掉落装备产生新属性的概率 # EquipColor: 拥有几种属性的装备的颜色 数字和显示文字里面的颜色id一样的意义 NewParamChance = [60, 55, 50, 45, 40, 30, 25]#掉落各个颜色装备的概率 EquipColor = [0,1, 3, 2, 26, 27, 14, 18] # \c表示的颜色 #0白色 #1蓝色 3绿色 2橙色 27粉红色 14金黄色 18深红色 #掉落的装备会根据设置的几率出现下面的颜色,白板请无视 # 默认的参数值 DefaultParamValue = { name: "NoName", # 名字 percentage: false, # 显示的时候是否要加一个百分号 state: -1, # 附加状态 -1表示无 party: -1, # 团队能力 -1:无 0:遇敌减半 1:随机遇敌无效 2:敌人偷袭无效 3:先制攻击率上升 # 4:掉落金钱双倍 5:掉落物品双倍 increase_gold: false, # 是否导致金钱增加 increase_critical: false, # 是否导致暴击伤害加成率(对敌) decrease_critical: false, # 是否导致暴击伤害减少率(对己) more_params_rate: false, # 是否导致多属性出现几率加成 action_plus_set: false, # 是否导致行动次数增加几率加成 max_level: 10, # 该属性的最大等级 random_range: 1..3, # 掉落的时候 如果产生了该属性 属性的等级范围 range: 10..30, # 属性的值的范围 cost: [2000, 2500, 3500, 4500, 5500, 6500, 7500, 8500, 10000, 15000], # 强化该属性耗费的基础金钱,实际金钱会加上装备的价格 equip: [], # 可以装备在哪些栏位 etype 0:武器 1:盾 2:头盔 3:盔甲 4:装饰品 weapon: nil, # 可以装备的武器类型 wtype armor: nil # 可以装备的防具类型 atype } #0:武器 1:盾 2:头盔 3:盔甲 4:装饰品 #左边装备类型,右边则是属性编号,属性编号不必全部都填,可选择性地填 EType = { 0 => [ 0, 1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 15, 16, 17, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,41], 1 => [ 0, 1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 15, 16, 17, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,41], 2 => [ 0, 1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 15, 16, 17, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,41], 3 => [ 0, 1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 15, 16, 17, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,41], 4 => [ 0, 1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 15, 16, 17, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,41] } WType = {} AType = {} # 在这里设置具体的属性和参数 # 未设置的参数会自动应用默认值的 Params = [] # 40号之前的属性都对应了特定含义 # 0:hp上限 1:mp上限 2:攻击 3:防御 4:魔攻 5:魔防 6:敏捷 7:幸运 # 名字会从数据库里读取 Params[0] = { #HP上限 range: 10..30 #增加量随机10-30点(可随意设置,如需固定增加量则range: 10..10) } Params[1] = { #MP上限 range: 10..30 #增加量随机10-30点 } Params[2] = { #物理攻击力 range: 10..30 #增加量随机10-30点 } Params[3] = { #物理防御力 range: 10..30 #增加量随机10-30点 } Params[4] = { #魔法攻击力 range: 10..30 #增加量随机10-30点 } Params[5] = { #魔法防御力 range: 10..30 #增加量随机10-30点 } Params[6] = { #敏捷 range: 10..30 #增加量随机10-30点 } Params[7] = { #幸运 range: 10..30 #增加量随机10-30点 } # (按百分比) 10:hp上限 11:mp上限 12:攻击 13:防御 14:魔攻 15:魔防 16:敏捷 17:幸运 # 名字会从数据库里读取 Params[10] = { #HP上限百分比 percentage: true, #添加百分号 range: 1..5 #随机1%-5% } Params[11] = { #MP上限百分比 percentage: true, #添加百分号 range: 1..5 #随机1%-5% } Params[12] = { #攻击力百分比 percentage: true, #添加百分号 range: 1..5 #随机1%-5% } Params[13] = { #防御力百分比 percentage: true, #添加百分号 range: 1..5 #随机1%-5% } Params[14] = { #魔法攻击力百分比 percentage: true, #添加百分号 range: 1..5 #随机1%-5% } Params[15] = { #魔法防御力百分比 percentage: true, #添加百分号 range: 1..5 #随机1%-5% } Params[16] = { #敏捷百分比 percentage: true, #添加百分号 range: 1..5 #随机1%-5% } Params[17] = { #幸运百分比 percentage: true, #添加百分号 range: 1..5 #随机1%-5% } # 20:物理命中率 21:物理回避率 22:暴击率 23:暴击闪避率 24:魔法闪避率 25:魔法反射率 26:物理反击率 27:生命回复 28:魔法回复 29:TP回复 Params[20] = { name: "物理命中率", #属性名称:物理命中率,随意改名字 percentage: true, #添加百分号 range: 1..5 #随机1%-5% } Params[21] = { name: "物理回避率", #物理回避率 percentage: true, #添加百分号 range: 1..5 #随机1%-5% } Params[22] = { name: "暴击几率", #暴击几率 percentage: true, #添加百分号 range: 1..5 #随机1%-5% } Params[23] = { name: "暴击闪避率", #暴击闪避率 percentage: true, #添加百分号 range: 1..5 #随机1%-5% } Params[24] = { name: "魔法闪避率", #魔法闪避率 percentage: true, #添加百分号 range: 1..5 #随机1%-5% } Params[25] = { name: "魔法反射率", #魔法反射率 percentage: true, #添加百分号 range: 1..5 #随机1%-5% } Params[26] = { name: "物理反射率", #物理反射率 percentage: true, #添加百分号 range: 1..5 #随机1%-5% } Params[27] = { name: "体力再生", #HP再生 percentage: true, #添加百分号 range: 1..5 #随机1%-5% } Params[28] = { name: "魔力再生", #MP再生 percentage: true, #添加百分号 range: 1..5 #随机1%-5% } Params[29] = { name: "TP再生", #TP再生 percentage: true, #添加百分号 range: 1..5 #随机1%-5% } # 30:受到攻击的几率 31:防御效果 32:恢复效果 33:药理知识 34:魔法消耗 35:TP增长 36:物理伤害加成 37:魔法伤害加成 38:地形伤害加成 39:经验获得 Params[30] = { name: "受到攻击几率", #吸引仇恨……………… percentage: true, #添加百分号 range: 1..5 #随机1%-5% } Params[31] = { name: "防御效果", #这些都是VA默认下有的东西,具体请看 Game_BattlerBase percentage: true, #添加百分号 range: 1..5 #随机1%-5% } Params[32] = { name: "恢复效果", #恢复效果 percentage: true, #添加百分号 range: 1..5 #随机1%-5% } Params[33] = { name: "药理知识", #药理知识 percentage: true, #添加百分号 range: 1..5 #随机1%-5% } Params[34] = { name: "魔法消耗", #魔法消耗 percentage: true, #添加百分号 range: 1..5 #随机1%-5% } Params[35] = { name: "TP增长", #TP增长 percentage: true, #添加百分号 range: 1..5 #随机1%-5% } Params[36] = { name: "物理伤害加成", #物理伤害加成 percentage: true, #添加百分号 range: 1..5 #随机1%-5% } Params[37] = { name: "魔法伤害加成", #魔法伤害加成 percentage: true, #添加百分号 range: 1..5 #随机1%-5% } Params[38] = { name: "地形伤害加成", #地形伤害加成 percentage: true, #添加百分号 range: 1..5 #随机1%-5% } Params[39] = { name: "经验获得加成", #经验获得加成 percentage: true, #添加百分号 range: 1..5 #随机1%-5% } #新添加属性 # 40及以后的属性可以随意设置 Params[40] = { name: "金钱增加", #属性名称 percentage: true, #添加百分号 increase_gold: true, #金钱增加开启 range: 1..5 #随机1%-5% } Params[41] = { name: "再次行动几率", #属性名称 percentage: true, #添加百分号 action_plus_set: true, #增加行动次数开启(不是攻击次数,别搞混了) range: 1..5 #随机1%-5% } #Params[40] = { #name: "掉落物品双倍", #party: 5, #max_level: 1 #} #Params[41] = { #name: "攻击附加状态", #percentage: true, #state: 6, #数据库状态编号 #range: 5..7 #} EType.each do |k, v| v.each do |i| next unless Params[i] Params[i][:equip] ||= [] Params[i][:equip].push k end end WType.each do |k, v| v.each do |i| next unless Params[i] Params[i][:weapon] ||= [] Params[i][:weapon].push k end end AType.each do |k, v| v.each do |i| next unless Params[i] Params[i][:armor] ||= [] Params[i][:armor].push k end end Params.compact.each do |h| DefaultParamValue.each do |k, v| h[k] ||= v end end end # Mosaic Gem module MosaicGem # gem type def gem_type @gem_type ||= begin Mosaic::GemTypeRegexp.match @note $1 ? $1.to_i : -1 end end end RPG::Item.send :include, MosaicGem # Mosaicked module Mosaicked # readers def data_id @data_id ||= @id end def generated_gems @generated_gems ||= {} end def mosaicked_gems @mosaicked_gems ||= {} end def mosaic_effects @mosaic_effects ||= {} end # get gems def gems r = Marshal.load Marshal.dump generated_gems mosaicked_gems.each do |k, v| r[k] = v end r end # mosaic def mosaic gem if generated_gems[gem.gem_type] generated_gems[gem.gem_type] += 1 else mosaicked_gems[gem.gem_type] ||= 0 mosaicked_gems[gem.gem_type] += 1 end apply_mosaicked_params gem.gem_type @id = $game_system.new_mosaic_item_id self end # can mosaic? def can_mosaic? item return if item.gem_type < 0 type = item.gem_type; params = Mosaic::Params[type] return unless params return unless gems[type] ? gems[type] < params[:max_level] : mosaicked_gems.size < Mosaic::MaxNewGemCount case self when RPG::Weapon params[:weapon] ? params[:weapon].include?(wtype_id) : params[:equip].include?(etype_id) when RPG::Armor params[:armor] ? params[:armor].include?(atype_id) : params[:equip].include?(etype_id) else params[:equip].include? etype_id end end # mosaic cost def mosaic_cost gem Mosaic::Params[gem.gem_type][:cost][gems[gem.gem_type] || 0] + price end # mosaic base equal? def mosaic_base_equal? rhs self.class == rhs.class && self.data_id == rhs.data_id end # apply mosaicked params def apply_mosaicked_params type mosaic_effects[type] ||= 0 mosaic_effects[type] += Mosaic::Params[type][:range].to_a.sample end # allowed params def allowed_params Mosaic::Params.each_with_index.map do |k, i| next unless k ((is_a?(RPG::Weapon) && k[:weapon] && k[:weapon].include?(wtype_id)) || (is_a?(RPG::Armor) && k[:armor] && k[:armor].include?(atype_id)) || k[:equip].include?(etype_id)) ? i : nil end.compact end # mosaic random generate def mosaic_random_generate item = Marshal.load Marshal.dump self item.instance_exec do while (t = Mosaic::NewParamChance[generated_gems.size] + $game_party.all_members.flat_map(&:equips).compact.inject(0){|r, item| item.mosaic_effects.inject(r){|s, (k, v)| s + (Mosaic::Params[k][ :more_params_rate] ? v : 0) }}) && rand < t / 100.0 param = allowed_params.sample break unless param level = Mosaic::Params[param][:random_range].to_a.sample generated_gems[param] = level level.times{ apply_mosaicked_params param } end self.id = $game_system.new_mosaic_item_id(self) if generated_gems.size > 0 end item end # quality def quality generated_gems.size end # description def description super + "\n" + gems.map do |gid, level| "Lv.#{level} #{Mosaic::Params[gid][:name]}+#{mosaic_effects[gid]}#{ Mosaic::Params[gid][:percentage] ? '%' : nil}" end.join("\n") end end RPG::EquipItem.send :include, Mosaicked # Data Manager class << DataManager # init alias mosaic_system_init init def init mosaic_system_init (0..7).each{|i| Mosaic::Params[i][:name] = Vocab.param(i)} (10..17).each{|i| Mosaic::Params[i][:name] = Vocab.param(i - 10)} end end # Battle Manager class << BattleManager # gain drop items def gain_drop_items $game_troop.make_drop_items.each do |item| item = item.mosaic_random_generate $game_party.gain_item(item, 1) $game_message.add(sprintf("\\C[#{Mosaic::EquipColor[item.quality]}]"+ #Vocab::ObtainItem+"\\C[0]", item.name)) Vocab::ObtainItem, item.name)) end wait_for_message end end # Game System class Game_System # initialize alias mosaic_system_initialize initialize def initialize mosaic_system_initialize @mosaicked_items = [] end # reader def mosaicked_items id @mosaicked_items[id - $data_weapons.size - $data_armors.size] end # new mosaic item id def new_mosaic_item_id item id = $data_weapons.size + $data_armors.size + @mosaicked_items.size item = Marshal.load Marshal.dump item item.id = id @mosaicked_items.push item id end end # Game BaseItem class Game_BaseItem # object def object return $data_skills[@item_id] if is_skill? return $data_items[@item_id] if is_item? return $data_weapons[@item_id] || $game_system.mosaicked_items(@item_id) if is_weapon? return $data_armors[@item_id] || $game_system.mosaicked_items(@item_id) if is_armor? return nil end end # Game Actor class Game_Actor # param plus alias mosaic_system_param_plus param_plus def param_plus param_id equips.compact.inject(mosaic_system_param_plus param_id){|r, item| r + (item.mosaic_effects[param_id] || 0) } end # param rate def param_rate param_id equips.compact.inject(super){|r, item| r + (item.mosaic_effects[param_id + 10] || 0) / 100.0 } end # xparam def xparam xparam_id equips.compact.inject(super){|r, item| r + (item.mosaic_effects[xparam_id + 20] || 0) / 100.0 } end # sparam def sparam sparam_id [0, equips.compact.inject(super){|r, item| r + (item.mosaic_effects[ sparam_id + 30] || 0) / 100.0 }].max end # party ability def party_ability ability_id super || equips.compact.any?{|item| item.gems.keys.any?{|k| Mosaic::Params[ k][:party] == ability_id }} end # atk states def atk_states a = equips.compact.inject(super){|r, item| item.gems.keys.inject(r){|s, k| s << Mosaic::Params[k][:state] }} a.delete(-1) a.uniq end # atk states rate def atk_states_rate state_id equips.compact.inject(super){|r, item| item.gems.keys.inject(r){|s, k| s + (Mosaic::Params[k][:state] == state_id ? item.mosaic_effects[k] : 0)/100.0}} end # apply critical def apply_critical value super * (100 - equips.compact.inject(0){|r, item| item.mosaic_effects.inject(r){|s, (k, v)| s + (Mosaic::Params[k][ :decrease_critical] ? v : 0) }}) / 100.0 end # action plus set def action_plus_set equips.compact.inject(super){|r, item| item.mosaic_effects.inject(r){ |s, (k, v)| s + (Mosaic::Params[k][:action_plus_set] ? (v / 100.0) : 0) }} end end # Game Enemy class Game_Enemy # apply critical def apply_critical value super * (100 + $game_party.battle_members.flat_map(&:equips).compact.inject( 0){|r, item| item.mosaic_effects.inject(r){|s, (k, v)| s + (Mosaic::Params[ k][:increase_critical] ? v : 0) }}) / 100.0 end end # Game Party class Game_Party # weapons def weapons @weapons.keys.sort.collect{|id| $data_weapons[id] || $game_system.mosaicked_items(id) } end # armors def armors @armors.keys.sort.collect{|id| $data_armors[id] || $game_system.mosaicked_items(id) } end end # Game Troop class Game_Troop # gold rate alias mosaic_system_gold_rate gold_rate def gold_rate rate = $game_party.members.inject(0) do |r, x| r + x.equips.compact.inject(0) do |s, y| s + y.mosaic_effects.inject(0) do |t, (k, v)| t + (Mosaic::Params[k][:increase_gold] ? v : 0) end end end mosaic_system_gold_rate * (1 + rate) end end # Window Base class Window_Base # draw item name def draw_item_name item, x, y, enabled = true, width = 172 return unless item draw_icon item.icon_index, x, y, enabled color = item.is_a?(Mosaicked) ? text_color(Mosaic::EquipColor[item.quality]) : normal_color change_color color, enabled draw_text x + 24, y, width, line_height, item.name end end # Mosaic Help Window class Window_MosaicHelp < Window_Base # initialize def initialize x, y, width, height super @text = "" end # set text def set_text text return if @text == text @text = text refresh end # set item def set_item item set_text item ? item.description : "" end # clear def clear set_text "" end # refresh def refresh contents.clear draw_text_ex 4, 0, @text end # process character def process_character c, text, pos case c when "\n" process_new_line text, pos when "\f" process_new_page text, pos when "\e" if text[0] == 'n' text.slice! 0, 1 process_new_line text, pos else process_escape_character obtain_escape_code(text), text, pos end else process_normal_character c, pos end end end # Mosaic Confirm Window class Window_MosaicConfirm < Window_Command # initialize def initialize super (Graphics.width - window_width) / 2, (Graphics.height - window_height) / 2 deactivate hide close end # window width def window_width Mosaic::ConfirmWidth end # visible line number def visible_line_number Mosaic::ConfirmFormat.size + 1 end # set item def set_item equip, g text = Mosaic::ConfirmFormat.join(?\n) text.gsub! '<equip>', "\\I[#{equip.icon_index}] #{equip.name}" text.gsub! '<gem>', "\\I[#{g.icon_index}] #{g.name}" text.gsub! '<gold>', "#{$game_party.gold}\\G" text.gsub! '<cost>', "#{equip.mosaic_cost(g)}\\G" refresh draw_text_ex 4, 0, text end # make command list def make_command_list add_command Mosaic::ConfirmText, :confirm add_command Mosaic::CancelText, :cancel end # col max def col_max 2 end # item width def item_width contents_width / 2 - standard_padding * 2 end # item_rect alias mosaic_system_item_rect item_rect def item_rect index rect = mosaic_system_item_rect index rect.y += Mosaic::ConfirmFormat.size * line_height rect end end # Mosaic Gem List Window class Window_MosaicGemList < Window_ItemList # initialize def initialze x, y, width, height super deactivate [url=home.php?mod=space&uid=457221]@Filter[/url] = ->(*){} end # filter def filter filter @filter = filter end # include? def include? item item.is_a?(RPG::Item) && @filter[item] end # col max def col_max 1 end # enable? def enable? item !@data.empty? end # activate def activate super self.index = @data.size - 1 if @index > @data.size - 1 end end # Mosaic Equip List Window class Window_MosaicEquipList < Window_ItemList attr_accessor :gem_window # update cursor def update_cursor super call_update_gem_window end # call update gem window def call_update_gem_window update_gem_window if active && @gem_window end # update gem window def update_gem_window @gem_window.filter(item ? item.method(:can_mosaic?) : ->(*){}) @gem_window.refresh end # refresh def refresh super call_update_gem_window call_update_help end # include? def include? item item.is_a?(Mosaicked) && enable?(item) end # col max def col_max 1 end # enable? def enable? item item && $game_party.all_items.any?{|i| i.is_a?(RPG::Item) && item.can_mosaic?(i) } end end # Mosaic Prompt Window class Window_MosaicPrompt < Window_Base # initialize def initialize x, y, width, height super hide close end # prompt def prompt text show open @count = 0 draw_text_ex 4, 0, text end # update def update super if open? @count += 1 close if @count > Mosaic::PromptCount end end end # Mosaic Scene class Scene_Mosaic < Scene_Base # initialize def initialize super create_background create_all_windows end # create all windows def create_all_windows create_equip_window create_gem_window create_help_window create_confirm_window create_prompt_window setup_all_windows end # create equip window def create_equip_window @equip_window = Window_MosaicEquipList.new *Mosaic::EquipWindow end # create gem window def create_gem_window @gem_window = Window_MosaicGemList.new *Mosaic::GemWindow @equip_window.gem_window = @gem_window end # create help window def create_help_window @help_window = Window_MosaicHelp.new *Mosaic::HelpWindow @equip_window.help_window = @help_window @gem_window.help_window = @help_window end # create confirm window def create_confirm_window @confirm_window = Window_MosaicConfirm.new end # create prompt window def create_prompt_window @prompt_window = Window_MosaicPrompt.new *Mosaic::PromptWindow end # setup all windows def setup_all_windows @equip_window.set_handler(:ok, method(:on_equip_ok)) @equip_window.set_handler(:cancel, method(:return_scene)) @gem_window.set_handler(:ok, method(:on_gem_ok)) @gem_window.set_handler(:cancel, method(:on_gem_cancel)) @confirm_window.set_handler(:confirm, method(:on_confirm_ok)) @confirm_window.set_handler(:cancel, method(:on_confirm_cancel)) @equip_window.refresh @equip_window.activate @equip_window.select 0 @gem_window.select 0 end # on equip ok def on_equip_ok @equip_window.deactivate @gem_window.activate end # on gem ok def on_gem_ok @confirm_window.set_item @equip_window.item, @gem_window.item @confirm_window.show @confirm_window.open @gem_window.deactivate @confirm_window.activate end # on gem cancel def on_gem_cancel @gem_window.deactivate @equip_window.activate end # on confirm ok def on_confirm_ok equip = @equip_window.item gem = @gem_window.item if $game_party.gold >= equip.mosaic_cost(gem) $game_party.lose_gold equip.mosaic_cost(gem) $game_party.lose_item equip, 1 $game_party.lose_item gem, 1 equip = Marshal.load Marshal.dump equip equip.mosaic gem $game_party.gain_item equip, 1 @prompt_window.prompt Mosaic::MosaicSucceed @equip_window.activate @equip_window.refresh @confirm_window.close else @prompt_window.prompt Mosaic::MosaicFail @confirm_window.activate end end # on confirm cancel def on_confirm_cancel @confirm_window.deactivate @confirm_window.close @gem_window.activate end # create background def create_background @background_sprite = Sprite.new @background_sprite.bitmap = SceneManager.background_bitmap @background_sprite.color.set 16, 16, 16, 128 end # terminate def terminate dispose_background super end # dispose background def dispose_background @background_sprite.dispose end end
#============================================================================== # ■装備拡張 for RGSS3 Ver1.10 # □author kure # # 呼び出し方法 SceneManager.call(Scene_Equip) #============================================================================== module KURE module ExEquip #画面の表示設定 #装備品のステータス補正表示(0=表示しない 1=表示する) VIEW_EQUIP_STATUS = 1 #装備スロット欄の表示設定---------------------------------------------------- #装備スロット表示名を設定(EQUIP_SLOT_NAME = [スロット5表示名,…] EQUIP_SLOT_NAME = ["黑魔法书","白魔法书","坐骑",] #装備スロットを設定 #通常のスロット EQUIP_SLOT = [0,1,2,3,4,7,5,6] #二刀流のスロット EQUIP_SLOT_DUAL = [0,0,2,3,4,7,5,6] #ステータス欄の表示設定------------------------------------------------------- #ステータス変化に表示する文字列 #Vocab_Ex1 = [命中率,回避率,会心率] Vocab_Ex1 = ["命中率","回避率","会心率"] #装備重量システム------------------------------------------------------------- #装備重量システムを利用する(0=利用しない 1=利用する) USE_WEIGHT_SYSTEM = 1 #最大装備重量設定------------------------------------------------------------ #基礎最大重量(全てのアクターが最低限もてる重量を設定します) MAX_WEIGHT_BASE = 50 #レベル補正(レベルが上がるごとに増える最大重量を設定します) MAX_WEIGHT_Lv = 2 #アクター毎、装備重量補正 #MAX_WEIGHT_ACTOR = [アクターID1,アクターID2,アクターID3,…] #MAX_WEIGHT_ACTOR = [20,20,20,20,20,20,20,20,20,20] MAX_WEIGHT_ACTOR = [0] #職業ごとの装備重量補正 #MAX_WEIGHT_JOB = [職業ID1,職業ID2,職業ID3,…] #MAX_WEIGHT_JOB = [10,10,10,10,10,10,10,10,10,10] MAX_WEIGHT_JOB = [0] #スキル補正 #MAX_WEIGHT_SKILL = [[スキルID,重量補正],[スキルID,重量補正],…] #MAX_WEIGHT_SKILL = [[1,10],[3,5],[84,100]] MAX_WEIGHT_SKILL = [[1,0],[3,0],[84,0]] #装備重量の名称 WEIGHT_NAME = "重量" #重量0のアイテムの重量表示(0=表示する 1=表示しない) WEIGHT_0_ITEM = 1 end end #============================================================================== # ■ RPG::BaseItem #============================================================================== class RPG::BaseItem #-------------------------------------------------------------------------- # ● 装備重量の定義(追加定義) #-------------------------------------------------------------------------- def weight cheack_note = @note cheack_note.match(/^<装備重量\s?(\d+)>/) if $1 == nil return 0 else return type = $1.to_i end end #-------------------------------------------------------------------------- # ● 装備重量の定義(追加定義) #-------------------------------------------------------------------------- def gain_weight cheack_note = @note cheack_note.match(/^<最大重量増加\s?(\d+)>/) if $1 == nil return 0 else return type = $1.to_i end end end #============================================================================== # ■ RPG::EquipItem(再定義) #============================================================================== class RPG::EquipItem < RPG::BaseItem #-------------------------------------------------------------------------- # ● 装備タイプの定義(再定義) #-------------------------------------------------------------------------- def etype_id if @note != "" cheack_note = @note cheack_note.match(/^<装備タイプ\s?(\d+)>/) if $1 == nil return @etype_id else return type = $1.to_i end else return @etype_id end end #-------------------------------------------------------------------------- # ● 装備タイプの定義(再定義) #-------------------------------------------------------------------------- def etype_id=(etype_id) @etype_id = etype_id end end #============================================================================== # ■ Game_BaseItem(追加定義) #============================================================================== class Game_BaseItem def id @item_id end end #============================================================================== # ■ Game_Actor #============================================================================== class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # ● 装備スロットの配列を取得(再定義) #-------------------------------------------------------------------------- def equip_slots return KURE::ExEquip::EQUIP_SLOT_DUAL if dual_wield? return KURE::ExEquip::EQUIP_SLOT # 通常 end #-------------------------------------------------------------------------- # ● 装備総重量(追加定義) #-------------------------------------------------------------------------- def all_weight weight = 0 for i in [email]0..@equips.size[/email] - 1 #オブジェクトが存在している場合 if @equips[i].object != nil if equip_slots[i] == 0 weight = weight + $data_weapons[@equips[i].id].weight else weight = weight + $data_armors[@equips[i].id].weight end end end return weight end #-------------------------------------------------------------------------- # ● 重量増加量(追加定義) #-------------------------------------------------------------------------- def all_gain_weight gain_weight = 0 for i in [email]0..@equips.size[/email] - 1 #オブジェクトが存在している場合 if @equips[i].object != nil if equip_slots[i] == 0 gain_weight = gain_weight + $data_weapons[@equips[i].id].gain_weight else gain_weight = gain_weight + $data_armors[@equips[i].id].gain_weight end end end return gain_weight end #-------------------------------------------------------------------------- # ● 重量最大量(追加定義) #-------------------------------------------------------------------------- def max_weight max_weight = 0 #追加重量 plus_weight = all_gain_weight #基礎値 max_weight = max_weight + plus_weight + KURE::ExEquip::MAX_WEIGHT_BASE + KURE::ExEquip::MAX_WEIGHT_Lv * @level #アクター補正 if KURE::ExEquip::MAX_WEIGHT_ACTOR[@actor_id] != nil max_weight = max_weight + KURE::ExEquip::MAX_WEIGHT_ACTOR[@actor_id] end #職業補正 if KURE::ExEquip::MAX_WEIGHT_JOB[@class_id] != nil max_weight = max_weight + KURE::ExEquip::MAX_WEIGHT_JOB[@class_id] end #スキル補正を加算 for i in 0..KURE::ExEquip::MAX_WEIGHT_SKILL.size-1 if KURE::ExEquip::MAX_WEIGHT_SKILL[i] != nil #スキルを設定していればスキルを保存 cheack_skill = $data_skills[KURE::ExEquip::MAX_WEIGHT_SKILL[i][0]] #念のためnilではないか確認 if cheack_skill != nil #スキルを覚えていれば補正値を加算 if skill_learn?(cheack_skill) if KURE::ExEquip::MAX_WEIGHT_SKILL[i][1] != nil max_weight = max_weight + KURE::ExEquip::MAX_WEIGHT_SKILL[i][1] end end end end end return max_weight end end #============================================================================== # ■ Scene_Equip(再定義) #------------------------------------------------------------------------------ # 装備画面の処理を行うクラスです。 #============================================================================== class Scene_Equip < Scene_MenuBase #-------------------------------------------------------------------------- # ● 開始処理 #-------------------------------------------------------------------------- def start super @max_weight = @actor.max_weight create_help_window create_small_status_window create_command_window create_slot_window create_status_window create_item_window @save_item = 0 end #-------------------------------------------------------------------------- # ● コマンドウィンドウの作成 #-------------------------------------------------------------------------- def create_command_window @command_window = Window_Ex_EquipCommand.new(0,@help_window.height + @small_status_window.height, @small_status_window.width) @command_window.viewport = @viewport @command_window.help_window = @help_window @command_window.set_handler(:equip, method(:command_equip)) @command_window.set_handler(:optimize, method(:command_optimize)) @command_window.set_handler(:clear, method(:command_clear)) @command_window.set_handler(:cancel, method(:return_scene)) @command_window.set_handler(:pagedown, method(:next_actor)) @command_window.set_handler(:pageup, method(:prev_actor)) @command_window.activate end #-------------------------------------------------------------------------- # ● スロットウィンドウの作成 #-------------------------------------------------------------------------- def create_slot_window @slot_window = Window_Ex_EquipSlot.new(0, @command_window.height + @help_window.height + 120, 305,Graphics.height - @command_window.height - @help_window.height - 120) @slot_window.viewport = @viewport @slot_window.help_window = @help_window @slot_window.status_window = @status_window @slot_window.actor = @actor @slot_window.set_handler(:ok, method(:on_slot_ok)) @slot_window.set_handler(:cancel, method(:on_slot_cancel)) @slot_window.set_handler(:pagedown, method(:next_actor)) @slot_window.set_handler(:pageup, method(:prev_actor)) @slot_window.deactivate end #-------------------------------------------------------------------------- # ● ステータスウィンドウの作成 #-------------------------------------------------------------------------- def create_status_window @status_window = Window_Ex_EquipStatus.new(@slot_window.width, @help_window.height,Graphics.width - @slot_window.width,Graphics.height - @help_window.height) @status_window.viewport = @viewport @status_window.actor = @actor end #-------------------------------------------------------------------------- # ● ステータスウィンドウの作成 #-------------------------------------------------------------------------- def create_small_status_window @small_status_window = Window_Equip_Small_Status.new(0,@help_window.height,305,120) @small_status_window.viewport = @viewport @small_status_window.weight = @actor.all_weight @small_status_window.max_weight = @max_weight @small_status_window.refresh end #-------------------------------------------------------------------------- # ● アイテムウィンドウの作成 #-------------------------------------------------------------------------- def create_item_window @item_window = Window_Ex_EquipItem.new(0,@command_window.height + @help_window.height + 120, 305,Graphics.height - @command_window.height - @help_window.height - 120) @item_window.viewport = @viewport @item_window.help_window = @help_window @item_window.status_window = @status_window @item_window.actor = @actor @item_window.set_handler(:ok, method(:on_item_ok)) @item_window.set_handler(:cancel, method(:on_item_cancel)) @slot_window.item_window = @item_window @item_window.visible = false @item_window.weight = @actor.all_weight @item_window.max_weight = @max_weight end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update update_basic update_ex_status_window end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update_ex_status_window if @item_window.visible == true if @item_window.item != @save_item @save_item = @item_window.item temp_actor = Marshal.load(Marshal.dump(@actor)) temp_actor.force_change_equip(@item_window.slot_id, @save_item) @status_window.set_temp_actor(temp_actor) @status_window.set_select_item2(@save_item) @status_window.refresh end end end #-------------------------------------------------------------------------- # ● コマンド[装備変更] #-------------------------------------------------------------------------- def command_equip slot_window_set_focus end #-------------------------------------------------------------------------- # ● コマンド[全て外す] #-------------------------------------------------------------------------- def command_clear Sound.play_equip @actor.clear_equipments @status_window.refresh @slot_window.refresh @command_window.activate if KURE::ExEquip::USE_WEIGHT_SYSTEM == 1 update_weight end end #-------------------------------------------------------------------------- # ● スロット[決定] #-------------------------------------------------------------------------- def on_slot_ok @save_item = 0 @slot_window.visible = false @item_window.visible = true @status_window.draw_index = 1 @status_window.set_select_item(@slot_window.index) #装備アイテムがあれば重量を渡す if @actor.equips[@slot_window.index] != nil @item_window.chage_item_weight = @actor.equips[@slot_window.index].weight @item_window.chaged_item_gain_weight = @actor.equips[@slot_window.index].gain_weight else @item_window.chage_item_weight = 0 @item_window.chaged_item_gain_weight = 0 end update_weight @item_window.refresh @slot_window.deactivate @item_window.activate @item_window.select(0) end #-------------------------------------------------------------------------- # ● スロット[キャンセル] #-------------------------------------------------------------------------- def on_slot_cancel @slot_window.unselect @slot_window.deactivate @command_window.activate @command_window.select(0) end #-------------------------------------------------------------------------- # ● アイテム[決定] #-------------------------------------------------------------------------- def on_item_ok Sound.play_equip index = @slot_window.index @actor.change_equip(@slot_window.index, @item_window.item) #二刀流両手剣問題対応 if @actor.dual_wield? if @slot_window.index == 0 @actor.change_equip(1, nil) if @actor.features_set(54).include?(1) elsif @slot_window.index == 1 @actor.change_equip(0, nil) if @actor.features_set(54).include?(1) end end @item_window.chaged_item_gain_weight = 0 @status_window.draw_index = 0 slot_window_set_focus delete_plus_status @slot_window.index = index update_weight end #-------------------------------------------------------------------------- # ● アイテム[キャンセル] #-------------------------------------------------------------------------- def on_item_cancel @status_window.draw_index = 0 index = @slot_window.index slot_window_set_focus @slot_window.index = index delete_plus_status end #-------------------------------------------------------------------------- # ● アクターの切り替え #-------------------------------------------------------------------------- def on_actor_change update_weight @status_window.actor = @actor @slot_window.actor = @actor @item_window.actor = @actor @command_window.activate @command_window.select(0) @slot_windowdeactivate @slot_window.unselect end #-------------------------------------------------------------------------- # ● ステータスウィンドウ項目消去 #-------------------------------------------------------------------------- def delete_plus_status @status_window.set_temp_actor(nil) @status_window.set_select_item(nil) @status_window.set_select_item2(nil) @status_window.refresh end #-------------------------------------------------------------------------- # ● スロットウィンドウにカーソルセット #-------------------------------------------------------------------------- def slot_window_set_focus @item_window.visible = false @item_window.unselect @item_window.refresh @slot_window.visible = true @slot_window.activate @slot_window.select(0) @slot_window.refresh @command_window.unselect @command_window.deactivate end #-------------------------------------------------------------------------- # ● 装備重量更新 #-------------------------------------------------------------------------- def update_weight @max_weight = @actor.max_weight @small_status_window.weight = @actor.all_weight @small_status_window.max_weight = @max_weight @item_window.weight = @actor.all_weight @item_window.max_weight = @max_weight @small_status_window.refresh end end #============================================================================== # ■ Window_Ex_EquipSlot #============================================================================== class Window_Ex_EquipSlot < Window_EquipSlot #-------------------------------------------------------------------------- # ● 公開インスタンス変数 #-------------------------------------------------------------------------- attr_reader :status_window # ステータスウィンドウ attr_reader :item_window # アイテムウィンドウ #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(x, y, width, height) @height = height super(x, y, width) @actor = nil refresh end #-------------------------------------------------------------------------- # ● ウィンドウ高さの取得 #-------------------------------------------------------------------------- def window_height return @height end #-------------------------------------------------------------------------- # ● 項目の描画 #-------------------------------------------------------------------------- def draw_item(index) return unless @actor rect = item_rect_for_text(index) change_color(system_color, enable?(index)) if @actor.equip_slots[index] <= 4 draw_text(rect.x, rect.y, 75, line_height, slot_name(index)) else draw_index = KURE::ExEquip::EQUIP_SLOT[index] draw_text(rect.x, rect.y, 75, line_height, KURE::ExEquip::EQUIP_SLOT_NAME[draw_index-5]) end draw_item_name(@actor.equips[index], rect.x + 75, rect.y, enable?(index)) if KURE::ExEquip::USE_WEIGHT_SYSTEM == 1 if @actor.equips[index] != nil if @actor.equips[index].gain_weight != 0 change_color(power_up_color) draw_text(rect.x, rect.y, rect.width, line_height, @actor.equips[index].gain_weight.to_s,2) else if KURE::ExEquip::WEIGHT_0_ITEM == 1 if @actor.equips[index].weight != 0 change_color(power_down_color) draw_text(rect.x, rect.y, rect.width, line_height, @actor.equips[index].weight.to_s,2) end else change_color(power_down_color) draw_text(rect.x, rect.y, rect.width, line_height, @actor.equips[index].weight.to_s,2) end end end end end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh #フォントの設定 last_font = contents.font.size contents.font.size = 20 contents.clear create_contents draw_all_items #フォントを戻す contents.font.size = last_font end #-------------------------------------------------------------------------- # ● ヘルプテキスト更新 #-------------------------------------------------------------------------- def update_help @help_window.clear @help_window.set_item(item) if @help_window end end #============================================================================== # ■ Window_Ex_EquipItem #============================================================================== class Window_Ex_EquipItem < Window_EquipItem attr_reader :status_window attr_accessor :weight attr_accessor :max_weight attr_accessor :chage_item_weight attr_accessor :chaged_item_gain_weight #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(x, y, width, height) super(x, y, width, height) @weight = 0 @max_weight = 0 @chage_item_weight = 0 @chaged_item_gain_weight = 0 end #-------------------------------------------------------------------------- # ● 桁数の取得 #-------------------------------------------------------------------------- def col_max return 1 end #-------------------------------------------------------------------------- # ● →キー入力時動作 #-------------------------------------------------------------------------- def cursor_right(wrap = false) if @status_window.draw_index == 1 @status_window.draw_index = 2 else @status_window.draw_index = 1 end @status_window.refresh end #-------------------------------------------------------------------------- # ● ←キー入力時操作 #-------------------------------------------------------------------------- def cursor_left(wrap = false) if @status_window.draw_index == 1 @status_window.draw_index = 2 else @status_window.draw_index = 1 end @status_window.refresh end #-------------------------------------------------------------------------- # ● アイテムを許可状態で表示するかどうか #-------------------------------------------------------------------------- def enable?(item) #重量システムを利用時だけ判定を行う if KURE::ExEquip::USE_WEIGHT_SYSTEM == 1 #アイテムが存在する時 if item !=nil #総重量 total_weight = item.weight + @weight - @chage_item_weight if total_weight > @max_weight - @chaged_item_gain_weight return false else return true end else if @weight > @max_weight - @chaged_item_gain_weight return false else return true end end end #重量システム非利用時であればtureを返す return true end #-------------------------------------------------------------------------- # ● 桁数の取得 #-------------------------------------------------------------------------- def slot_id return @slot_id end #-------------------------------------------------------------------------- # ● ヘルプテキスト更新 #-------------------------------------------------------------------------- def update_help @help_window.set_item(item) 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, enable?(item)) draw_item_number(rect, item) #重量システムを利用時は重量を表示する if KURE::ExEquip::USE_WEIGHT_SYSTEM == 1 if item.gain_weight != 0 change_color(power_up_color) draw_text(rect.x - 50, rect.y, rect.width - 30, line_height, item.gain_weight.to_s,2) else #重量0をチェック if KURE::ExEquip::WEIGHT_0_ITEM == 1 if item.weight != 0 change_color(power_down_color) draw_text(rect.x - 50, rect.y, rect.width - 30, line_height, item.weight.to_s,2) end else change_color(power_down_color) draw_text(rect.x - 50, rect.y, rect.width - 30, line_height, item.weight.to_s,2) end end end end end end #============================================================================== # ■ Window_Small_Status #------------------------------------------------------------------------------ # メニュー画面でパーティメンバーのステータスを表示するウィンドウです。 #============================================================================== class Window_Equip_Small_Status < Window_Selectable #-------------------------------------------------------------------------- # ● 公開インスタンス変数 #-------------------------------------------------------------------------- attr_reader :pending_index # 保留位置(並び替え用) attr_accessor :weight attr_accessor :max_weight #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(x, y,width,height) super(x, y, width, height) refresh end #-------------------------------------------------------------------------- # ● 項目の描画 #-------------------------------------------------------------------------- def draw_status @actor = $game_party.menu_actor draw_actor_face(@actor, 0, 0) draw_actor_name(@actor, 130, line_height * 0) draw_actor_icons(@actor, 230-50, line_height * 0) draw_actor_hp(@actor, 130, line_height * 1) draw_actor_mp(@actor, 130, line_height * 2) if KURE::ExEquip::USE_WEIGHT_SYSTEM == 1 if @max_weight != nil draw_actor_weight(@actor, 130, line_height * 3) end end end #-------------------------------------------------------------------------- # ● 装備重量の描画 #-------------------------------------------------------------------------- def draw_actor_weight(actor, x, y, width = 124) weight_rate = @weight.to_f / @max_weight draw_gauge(x, y, width, weight_rate, tp_gauge_color1, tp_gauge_color2) change_color(system_color) draw_text(x, y, 30, line_height, KURE::ExEquip::WEIGHT_NAME) draw_current_and_max_values(x, y, width, @weight, @max_weight, mp_color(actor), normal_color) end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh contents.clear draw_status end end #============================================================================== # ■ Window_Ex_EquipStatus #------------------------------------------------------------------------------ # 装備画面で、アクターの能力値変化を表示するウィンドウです。 #============================================================================== class Window_Ex_EquipStatus < Window_EquipStatus attr_accessor :draw_index #-------------------------------------------------------------------------- # ◎ オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(x, y,width,height) @draw_index = 0 @width = width @height = height super(x, y) end #-------------------------------------------------------------------------- # ◎ ウィンドウ幅の取得 #-------------------------------------------------------------------------- def window_width return @width end #-------------------------------------------------------------------------- # ◎ ウィンドウ高さの取得 #-------------------------------------------------------------------------- def window_height return @height end #-------------------------------------------------------------------------- # ◎ リフレッシュ #-------------------------------------------------------------------------- def refresh contents.clear #フォントの設定 last_font = contents.font.size contents.font.size = 20 draw_gauge(5,0, contents.width, 1, mp_gauge_color2,crisis_color) change_color(normal_color) case @draw_index when 0,1 draw_text(5, 0, 126, contents.font.size, "能力属性栏") draw_equip_befor(5,line_height * 1) draw_right_arrow(0, line_height * 2) draw_equip_after(65,line_height * 2) when 2 draw_text(5, 0, 126, contents.font.size, "装备属性") draw_equip_after(5,line_height * 1) end case @draw_index when 0,1 11.times {|i| draw_item(0, line_height * 2 + contents.font.size * (1 + i), i) } when 2 draw_features(5,line_height * 2) end case @draw_index when 1,2 change_color(normal_color) draw_text(0, line_height * 12, contents.width, contents.font.size, "",1) end contents.font.size = last_font end #-------------------------------------------------------------------------- # ◎ 装備変更のアイテム表示 #-------------------------------------------------------------------------- def draw_equip_befor(x,y) return unless @actor if @base_item_index != nil draw_item_name(@actor.equips[@base_item_index], x, y) end end #-------------------------------------------------------------------------- # ◎ 装備変更のアイテム表示 #-------------------------------------------------------------------------- def draw_equip_after(x,y) return unless @actor if @change_item != nil draw_item_name(@change_item, x, y) end end #-------------------------------------------------------------------------- # ◎ 装備アイテム描画の変数を設定 #-------------------------------------------------------------------------- def set_select_item(index) return if @base_item_index == index @base_item_index = index refresh end #-------------------------------------------------------------------------- # ◎ 変更装備アイテムの変数を設定 #-------------------------------------------------------------------------- def set_select_item2(index) return if @change_item == index @change_item = index refresh end #-------------------------------------------------------------------------- # ◎ 項目の描画 #-------------------------------------------------------------------------- def draw_item(x, y, param_id) case param_id when 0,1,2,3,4,5,6,7 draw_param_name(x + 4, y, param_id) draw_current_param(x + 84+20, y, param_id) if @actor draw_right_arrow(x + 116, y) draw_new_param(x + 140+ 140, y, param_id) if @temp_actor if KURE::ExEquip::VIEW_EQUIP_STATUS == 1 change_color(param_change_color(@change_item.params[param_id])) if @change_item draw_text(x + 172, y, 40, line_height, @change_item.params[param_id], 2) if @change_item end when 8,9,10 value = 0 value2 = 0 value = (@actor.xparam(param_id - 8) * 100).to_i if @actor value2 = (@temp_actor.xparam(param_id - 8) * 100).to_i if @temp_actor change_color(system_color) draw_text(x + 4, y, 80, line_height, KURE::ExEquip::Vocab_Ex1[param_id - 8]) change_color(normal_color) draw_text(x + 84+30, y, 32, line_height, value, 2) if @actor draw_right_arrow(x + 116, y) change_color(param_change_color(value2 - value)) if @temp_actor draw_text(x + 140+ 140, y, 32, line_height, value2, 2) if @temp_actor if KURE::ExEquip::VIEW_EQUIP_STATUS == 1 change_color(param_change_color(value2 - value)) draw_text(x + 172, y, 40, line_height, value2 - value, 2) if @change_item end end end #-------------------------------------------------------------------------- # ◎ 特徴の描画 #-------------------------------------------------------------------------- def draw_features(x,y) return if @change_item == nil #特徴を描画 change_color(system_color) draw_text(5, y, 126, contents.font.size, "属性特效") #配列数取得変数を初期化 features_max = 0 #描画用配列を作成 draw_list = Array.new(100) #配列用カウンターをセット @draw_counter = 0 #装備品が有れば特徴最大数を取得 features_max = @change_item.features.size - 1 #項目をチェックして描画用配列に入れる for l in 0..features_max #攻撃属性がある場合 if @change_item.features[l].code == 31 draw_str = $data_system.elements[@change_item.features[l].data_id] draw_list[@draw_counter] = draw_str + "属性 " @draw_counter += 1 end #属性耐性がある場合 if @change_item.features[l].code == 11 #属性名取得 draw_str = $data_system.elements[@change_item.features[l].data_id]+ "耐性" value = 100 - (@change_item.features[l].value * 100).to_i draw_list[@draw_counter] = draw_str + value.to_s + "% " @draw_counter += 1 end #弱体有効度がある場合 if @change_item.features[l].code == 12 #属性名取得 draw_str = "耐"+Vocab::param(@change_item.features[l].data_id)+ "减少" value = 100 - (@change_item.features[l].value * 100).to_i draw_list[@draw_counter] = draw_str + value.to_s + "% " @draw_counter += 1 end #ステート耐性がある場合 if @change_item.features[l].code == 13 #ステート名取得 draw_str = $data_states[@change_item.features[l].data_id].name + "耐性" value = 100 - (@change_item.features[l].value * 100).to_i draw_list[@draw_counter] = draw_str + value.to_s + "% " @draw_counter += 1 end #ステート無効化がある場合 if @change_item.features[l].code == 14 #ステート名取得 draw_str = $data_states[@change_item.features[l].data_id].name draw_list[@draw_counter] = draw_str + "无效 " @draw_counter += 1 end #通常能力値判定がある場合 if @change_item.features[l].code == 21 #ステータス名取得 draw_str = Vocab::param(@change_item.features[l].data_id) value = (@change_item.features[l].value * 100).to_i - 100 if value > 0 value = "+" + value.to_s end draw_list[@draw_counter] = draw_str + value.to_s + "% " @draw_counter += 1 end #通常能力値判定がある場合 if @change_item.features[l].code == 22 #ステータス名取得 draw_str = @change_item.features[l].data_id case draw_str when 0 draw_str = "命中率" when 1 draw_str = "回避率" when 2 draw_str = "会心率" when 3 draw_str = "会心回避" when 4 draw_str = "兵法回避" when 5 draw_str = "兵法反射" when 6 draw_str = "反击率" when 7 draw_str = "每回合兵力回复" when 8 draw_str = "每回合谋点回复" when 9 draw_str = "每回合气力回复" end value = (@change_item.features[l].value * 100).to_i if value > 0 value = "+" + value.to_s end draw_list[@draw_counter] = draw_str + value.to_s + "% " @draw_counter += 1 end #特殊能力値判定がある場合 if @change_item.features[l].code == 23 #ステート名取得 draw_str = @change_item.features[l].data_id case draw_str when 0 draw_str = "被打几率" when 1 draw_str = "防御効果" when 2 draw_str = "回复效果" when 3 draw_str = "药草知识" when 4 draw_str = "谋点消费率" when 5 draw_str = "气力增加率" when 6 draw_str = "受物理伤害" when 7 draw_str = "受兵法伤害" when 8 draw_str = "受地图伤害" when 9 draw_str = "经验值" end value = (@change_item.features[l].value * 100).to_i - 100 if value > 0 value = "+" + value.to_s end draw_list[@draw_counter] = draw_str + value.to_s + "% " @draw_counter += 1 end #攻撃時ステート判定がある場合 if @change_item.features[l].code == 32 #ステート名取得 draw_str = $data_states[@change_item.features[l].data_id].name + "追加" value = (@change_item.features[l].value * 100).to_i draw_list[@draw_counter] = draw_str + value.to_s + "% " @draw_counter += 1 end #攻撃追加がある場合 if @change_item.features[l].code == 34 #攻撃回数を取得 value = (@change_item.features[l].value + 1).to_i draw_list[@draw_counter] = value.to_s + "回攻击 " @draw_counter += 1 end #スキルタイプ追加がある場合 if @change_item.features[l].code == 41 #項目を取得 value = $data_system.skill_types[@change_item.features[l].data_id] draw_list[@draw_counter] = value + "可使用 " @draw_counter += 1 end #スキルタイプ削除がある場合 if @change_item.features[l].code == 42 #項目を取得 value = $data_system.skill_types[@change_item.features[l].data_id] draw_list[@draw_counter] = value + "使用不可 " @draw_counter += 1 end #スキル追加がある場合 if @change_item.features[l].code == 43 #項目を取得 value = $data_skills[@change_item.features[l].data_id].name draw_list[@draw_counter] = "“" +value + "”可使用 " @draw_counter += 1 end #スキル削除がある場合 if @change_item.features[l].code == 44 #項目を取得 value = $data_skills[@change_item.features[l].data_id].name draw_list[@draw_counter] = "“" +value + "”不可使用 " @draw_counter += 1 end #行動追加がある場合 if @change_item.features[l].code == 61 #項目を取得 value = (@change_item.features[l].value * 100).to_i draw_list[@draw_counter] = "追加行动"+ value.to_s + "% " @draw_counter += 1 end #特殊フラグがある場合 if @change_item.features[l].code == 62 #項目を取得 value = @change_item.features[l].data_id case value when 0 value = "自动战斗" when 1 value = "自动防御" when 2 value = "自动援护" when 3 value = "TP持越" end draw_list[@draw_counter] = value @draw_counter += 1 end #パーティー能力がある場合 if @change_item.features[l].code == 64 #項目を取得 value = @change_item.features[l].data_id case value when 0 value = "遇敌率↓" when 1 value = "遇敌率0" when 2 value = "不会被偷袭" when 3 value = "偷袭率上升" when 4 value = "金钱双倍" when 5 value = "掉宝双倍" when 6 end draw_list[@draw_counter] = value @draw_counter += 1 end end #実際の描画処理 for j in 0..@draw_counter if draw_list[j] != nil or 0 case j when 0..10 change_color(normal_color) draw_text(x, y + contents.font.size * (j + 1) , contents.width / 2, contents.font.size, draw_list[j]) when 11..21 change_color(normal_color) draw_text(x + contents.width / 2, y + contents.font.size * (j - 10) , contents.width / 2, contents.font.size, draw_list[j]) end end end end end #============================================================================== # ■ Window_Ex_EquipCommand #------------------------------------------------------------------------------ # スキル画面で、コマンド(装備変更、最強装備など)を選択するウィンドウです。 #============================================================================== class Window_Ex_EquipCommand < Window_HorzCommand #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(x, y, width) @window_width = width super(x, y) end #-------------------------------------------------------------------------- # ● ウィンドウ幅の取得 #-------------------------------------------------------------------------- def window_width @window_width end #-------------------------------------------------------------------------- # ● 桁数の取得 #-------------------------------------------------------------------------- def col_max if KURE::ExEquip::USE_WEIGHT_SYSTEM == 0 return 3 else return 2 end end #-------------------------------------------------------------------------- # ● コマンドリストの作成 #-------------------------------------------------------------------------- def make_command_list add_command(Vocab::equip2, :equip) if KURE::ExEquip::USE_WEIGHT_SYSTEM == 0 add_command(Vocab::optimize, :optimize) end add_command(Vocab::clear, :clear) end end
QQ图片20170429210118.png (2.93 KB, 下载次数: 32)
guoxiaomi 发表于 2017-4-29 21:16
根据多年经验,应该是调用了个id=0的武器/防具,结果报了nil。
devil033 发表于 2017-4-29 21:27
根据目前的经验,表示参不透
1.44 MB, 下载次数: 141
芯☆淡茹水 发表于 2017-4-29 22:30
把装备扩展 161 到 167
QQ图片20170429224756.png (7.73 KB, 下载次数: 35)
芯☆淡茹水 发表于 2017-4-29 22:30
把装备扩展 161 到 167
if @equips[i].object != nil if equip_slots[i] == 0 weight = weight + $data_weapons[@equips[i].id].weight else weight = weight + $data_armors[@equips[i].id].weight end end
if @equips[i].object != nil xr_equip = equip_slots[i] == 0 ? $data_weapons[@equips[i].id] : $data_armors[@equips[i].id] next if xr_equip.nil? weight += xr_equip.gain_weight end
QQ图片20170429230626.png (159.64 KB, 下载次数: 35)
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |