#============================================================================== # 禾西製作 / Created by Quarcy #============================================================================== class Window_Help < Window_Base attr_reader :materia #-------------------------------------------------------------------------- # ● 定義不顯示的屬性與狀態 #-------------------------------------------------------------------------- def unshown @unshow_elements = [17, 18] @unshow_states = [] end #-------------------------------------------------------------------------- # ● 初始化對象 #-------------------------------------------------------------------------- def initialize super(0, 0, 640, 64) self.opacity = 150 self.z=150 self.visible = false end #-------------------------------------------------------------------------- # ● 設置文本 # data : 窗口顯示的字符串/物品資料 # align : 對齊方式 (0..左對齊、1..中間對齊、2..右對齊) #-------------------------------------------------------------------------- def set_text(data, align=0) #------------------------------------------------------------------------ # ● 當資料爲文字時候 #------------------------------------------------------------------------ # 如果文本或對齊方式至少一方与上次的不同 if data != @text or align != @align if data.is_a?(String) # 再描繪文本 self.width = 640 self.height = 64 self.x=0 self.y=0 self.contents = Bitmap.new(width - 32, height - 32) if self.contents.nil? self.contents.clear self.contents.font.color = normal_color self.contents.font.size = 20 self.contents.draw_text(4, 0, self.width - 40, 32, data, align) @text = data @align = align [url=home.php?mod=space&uid=95897]@actor[/url] = nil self.visible = true end end return if data.is_a?(String) #------------------------------------------------------------------------ # ● 當沒有資料時候 #------------------------------------------------------------------------ if data.nil? self.visible=false else self.visible=true end #------------------------------------------------------------------------ # ● 當資料爲物品/技能時候 #------------------------------------------------------------------------ if data != nil && @data != data self.width = 210 self.height = 430 self.x=0 self.y=200 unshown non_auto_update(data) else return end end #-------------------------------------------------------------------------- # ● 更新帮助窗口 #-------------------------------------------------------------------------- def non_auto_update(data=@data) @data = data case @data when RPG::Item set_item_text(@data) when RPG::Weapon set_equipment_text(@data) when RPG::Armor set_equipment_text(@data) when RPG::Skill set_skill_text(@data) end end #-------------------------------------------------------------------------- # ● 裝備帮助窗口 #-------------------------------------------------------------------------- def set_equipment_text(equipment) #------------------------------------------------------------------------ # ● 取得基本質料 #------------------------------------------------------------------------ # 取得屬性、附加狀態、解除狀態之副本 case equipment when RPG::Weapon element_set = equipment.element_set.clone plus_state_set = equipment.plus_state_set.clone minus_state_set = equipment.minus_state_set.clone #----------------------# # 過濾不顯示的狀態描述 # #----------------------# plus_state_set -= @unshow_states minus_state_set -= @unshow_states when RPG::Armor element_set = equipment.guard_element_set.clone guard_state_set = equipment.guard_state_set.clone #----------------------# # 過濾不顯示的狀態描述 # #----------------------# auto_state_id = equipment.auto_state_id guard_state_set -= @unshow_states end #----------------------# # 過濾不顯示的屬性描述 # #----------------------# element_set -= @unshow_elements #--------------# # 取得說明文字 # #--------------# description = equipment.description.clone # 初始化數據設定 x = 0 y = 0 h = 0 phrase = {} # 基本文字設定 phrase["price"] = "价格:" phrase["elements"] = "属性:" phrase["minus_states"] = "解除状态:" phrase["plus_states"] = "附加状态:" phrase["guard_elements"] = "防御属性" phrase["guard_states"] = "防御状态" phrase["auto_state"] = "自动状态" # 基本數據設定 =begin name_size = 名字文字大小 size = 描述文字大小 word = 每行的描述文字數 move = 全體描述偏移幅度 =end name_size = 18 size = 14 word = 12 move = 80 #------------------------------------------------------------------------ # ● 確定背景圖片的高度 #------------------------------------------------------------------------ h += (description.size/3/word) h += 1 if (description.size/3%word) > 0 h += 1 if equipment.is_a?(RPG::Weapon) now_h = h h += 1 h += 1 unless equipment.pdef.zero? h += 1 unless equipment.mdef.zero? h += 1 if element_set.size > 0 h += 1 if element_set.size >= 5 case equipment when RPG::Weapon h += 1 unless minus_state_set.empty? h += minus_state_set.size h += 1 unless plus_state_set.empty? h += plus_state_set.size when RPG::Armor h += 1 unless guard_state_set.empty? h += guard_state_set.size h += 1 unless auto_state_id.zero? end h += 1 h += 1 unless equipment.str_plus.zero? h += 1 unless equipment.dex_plus.zero? h += 1 unless equipment.agi_plus.zero? h += 1 unless equipment.int_plus.zero? h += materia_height_plus(equipment) unless self.materia.nil? #------------------------------------------------------------------------ # ● 圖片顯示保證高度 #------------------------------------------------------------------------ h = 6 + now_h if (h - now_h) < 6 #------------------------------------------------------------------------ # ● 換算高度 #------------------------------------------------------------------------ self.height = h * size + name_size + 32 #------------------------------------------------------------------------ # ● 生成背景 #------------------------------------------------------------------------ self.contents = Bitmap.new(self.width - 32, self.height - 32) self.contents.clear #------------------------------------------------------------------------ # ● 名字描繪 #------------------------------------------------------------------------ text = equipment.name self.contents.font.color = normal_color self.contents.font.size = name_size if text.nil? self.visible = false else self.visible = true self.contents.draw_text(0, 0, text.size*7, name_size, text, 0) end #------------------------------------------------------------------------ # ● 說明描繪 #------------------------------------------------------------------------ x = 0 y += 1 while ((text = description.slice!(/./m)) != nil) self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x*size, y*size+5, size, size, text, 0) x+=1 if x == word x=0 y+=1 end end #------------------------------------------------------------------------ # ● 圖標描繪 #------------------------------------------------------------------------ bitmap = RPG::Cache.icon(equipment.icon_name) opacity = self.contents.font.color == normal_color ? 255 : 128 self.contents.blt(0 ,y*size + 20, bitmap, Rect.new(0, 0, 95, 100), 225) #------------------------------------------------------------------------ # ● 攻擊力描繪(武器) #------------------------------------------------------------------------ if equipment.is_a?(RPG::Weapon) x = 0 y += 1 text = $data_system.words.atk+":"+equipment.atk.to_s self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) end #------------------------------------------------------------------------ # ● 價格描繪 #------------------------------------------------------------------------ x = 0 y += 1 text = phrase["price"] + equipment.price.to_s self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) #------------------------------------------------------------------------ # ● 物理防禦 #------------------------------------------------------------------------ unless equipment.pdef.zero? x = 0 y += 1 text = $data_system.words.pdef+":"+equipment.pdef.to_s self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) end #------------------------------------------------------------------------ # ● 魔法防禦 #------------------------------------------------------------------------ unless equipment.mdef.zero? x = 0 y += 1 text=$data_system.words.mdef+":"+equipment.mdef.to_s self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) end #------------------------------------------------------------------------ # ● 屬性 #------------------------------------------------------------------------ if element_set.size > 0 x = 0 y += 1 text = phrase["elements"] for i in 0...element_set.size break if i > 4 text += $data_system.elements[element_set[i]] end self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) end if element_set.size >= 5 x = (phrase["elements"].size)*5-4 y += 1 text = "" for i in 4...element_set.size text += $data_system.elements[element_set[i]] end self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) end #------------------------------------------------------------------------ # ● 描述分流 武器/防具 #------------------------------------------------------------------------ case equipment when RPG::Weapon #------------------------------------------------------------------------ # ● 解除狀態(武器) #------------------------------------------------------------------------ unless minus_state_set.empty? x = 0 y += 1 text=phrase["minus_states"] text=phrase["guard_states"] self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) for i in 0...minus_state_set.size y += 1 text = $data_states[minus_state_set[i]].name self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) end end #------------------------------------------------------------------------ # ● 附加狀態(武器) #------------------------------------------------------------------------ unless plus_state_set.empty? x = 0 y += 1 text = phrase["plus_states"] self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) for i in 0...plus_state_set.size y += 1 text=$data_states[plus_state_set[i]].name self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) end end when RPG::Armor #------------------------------------------------------------------------ # ● 防禦狀態(防具) #------------------------------------------------------------------------ unless guard_state_set.empty? x = 0 y += 1 text=phrase["guard_states"] self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) for i in 0...guard_state_set.size y += 1 text = $data_states[guard_state_set[i]].name self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) end end #------------------------------------------------------------------------ # ● 自動狀態(防具) #------------------------------------------------------------------------ unless auto_state_id.zero? x = 0 y += 1 text = phrase["auto_state"] + $data_states[auto_state_id].name self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) end end #------------------------------------------------------------------------ # ● 空行 #------------------------------------------------------------------------ y+=1 #------------------------------------------------------------------------ # ● 力量 #------------------------------------------------------------------------ unless equipment.str_plus.zero? x = 0 y += 1 h += 1 if equipment.str_plus > 0 text=$data_system.words.str+" +"+ equipment.str_plus.to_s else text=$data_system.words.str+" -"+ (-equipment.str_plus).to_s end self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) end #------------------------------------------------------------------------ # ● 靈巧 #------------------------------------------------------------------------ unless equipment.dex_plus.zero? x = 0 y += 1 h += 1 if equipment.dex_plus > 0 text=$data_system.words.dex+" +"+ equipment.dex_plus.to_s else text=$data_system.words.dex+" -"+ (-equipment.dex_plus).to_s end self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) end #------------------------------------------------------------------------ # ● 速度 #------------------------------------------------------------------------ unless equipment.agi_plus.zero? x = 0 y += 1 h += 1 if equipment.agi_plus > 0 text=$data_system.words.agi+" +"+ equipment.agi_plus.to_s else text=$data_system.words.agi+" -"+ (-equipment.agi_plus).to_s end self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) end #------------------------------------------------------------------------ # ● 智力 #------------------------------------------------------------------------ unless equipment.int_plus.zero? x = 0 y += 1 h += 1 if equipment.int_plus > 0 text=$data_system.words.int+" +"+ equipment.int_plus.to_s else text=$data_system.words.int+" -"+ (-equipment.int_plus).to_s end self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) end #------------------------------------------------------------------------ # ● 魔力石描繪 #------------------------------------------------------------------------ y += draw_materia(equipment, move, y, size) unless self.materia.nil? end #-------------------------------------------------------------------------- # ● 物品幫助窗口 #-------------------------------------------------------------------------- def set_item_text(item) # 取得描述 description = item.description.clone # 取得屬性、附加狀態、解除狀態之副本 element_set = item.element_set.clone plus_state_set = item.plus_state_set.clone minus_state_set = item.minus_state_set.clone # 過濾不顯示的描述 element_set -= @unshow_elements plus_state_set -= @unshow_states minus_state_set -= @unshow_states # 初始化數據設定 x = 0 y = 0 h = 0 phrase = {} scope ={} parameter_type = {} # 基本數據設定 =begin name_size = 名字文字大小 size = 描述文字大小 word = 每行的描述文字數 move = 全體描述偏移幅度 =end name_size = 18 size = 14 word = 12 move = 80 # 基本文字設定 phrase["scope"] = "范围:" phrase["price"] = "价格:" phrase["recover_hp_rate"] = "HP 回复率:" phrase["recover_hp"] = "HP 回复量:" phrase["recover_sp_rate"] = "SP 回复率:" phrase["recover_sp"] = "SP 回复量:" phrase["elements"] = "属性:" phrase["plus"] = "附加" phrase["minus"] = "解除" phrase["states"] = "状态" scope[0] = "特殊物品" scope[1] = "特殊物品" scope[2] = "敌单体" scope[3] = "敌全体" scope[4] = "己方单体" scope[5] = "己方全体" scope[6] = "己方昏死单体" scope[7] = "己方昏死全体" scope[8] = "使用者" parameter_type[1] = "MaxHP" parameter_type[2] = "MaxSP" parameter_type[3] = $data_system.words.str parameter_type[4] = $data_system.words.dex parameter_type[5] = $data_system.words.agi parameter_type[6] = $data_system.words.int #依顯示内容確定自身高 h = (description.size/3/word) h +=1 if (description.size/3%word)> 0 now_h = h h +=3 # 空行,效果範圍,價格 h += 1 unless item.recover_hp_rate.zero? h += 1 unless item.recover_hp.zero? h += 1 unless item.recover_sp_rate.zero? h += 1 unless item.recover_sp.zero? h += 1 unless item.parameter_type.zero? h += 1 unless element_set[0].nil? h += 1 unless element_set[4].nil? h += (1+plus_state_set.size) unless plus_state_set.empty? h += (1+minus_state_set.size) unless minus_state_set.empty? #------------------------------------------------------------------------ # ● 圖片顯示保證高度 #------------------------------------------------------------------------ h = 6 + now_h if (h - now_h) < 6 #------------------------------------------------------------------------ # ● 換算高度 #------------------------------------------------------------------------ self.height = h * size + name_size + 32 #------------------------------------------------------------------------ # ● 生成背景 #------------------------------------------------------------------------ self.contents = Bitmap.new(self.width - 32, self.height - 32) self.contents.clear #------------------------------------------------------------------------ # ● 名字描繪 #------------------------------------------------------------------------ text = item.name self.contents.font.color = normal_color#顔色腳本 self.contents.font.size = name_size if text.nil? self.visible = false else self.visible = true self.contents.draw_text(0,0, text.size*7, 20, text, 0) end #------------------------------------------------------------------------ # ● 說明描繪 #------------------------------------------------------------------------ x = 0 y += 1 while ((text = description.slice!(/./m)) != nil) self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x*size, y*size+5, size, size, text, 0) x+=1 if x == word x = 0 y += 1 end end #------------------------------------------------------------------------ # ● 圖標描繪 #------------------------------------------------------------------------ bitmap = RPG::Cache.icon(item.icon_name) unless item.icon_name.nil? opacity = self.contents.font.color == normal_color ? 255 : 128 self.contents.blt(0 ,y*size + 20, bitmap, Rect.new(0, 0, 95, 100), 225) #------------------------------------------------------------------------ # ● 魔力石接口 #------------------------------------------------------------------------ unless self.materia.nil? return if is_materia?(item) end #------------------------------------------------------------------------ # ● 效果範圍 #------------------------------------------------------------------------ text= phrase["scope"] + scope[item.scope] x = 0 y += 1 self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) #------------------------------------------------------------------------ # ● 價格 #------------------------------------------------------------------------ x = 0 y += 1 text = phrase["price"] + item.price.to_s self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) #------------------------------------------------------------------------ # ● HP回復率 #------------------------------------------------------------------------ unless item.recover_hp_rate.zero? x = 0 y += 1 text = phrase["recover_hp_rate"] + item.recover_hp_rate.to_s+"%" self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) end #------------------------------------------------------------------------ # ● HP回復量 #------------------------------------------------------------------------ unless item.recover_hp.zero? x = 0 y += 1 text = phrase["recover_hp"] + item.recover_hp.to_s self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) end #------------------------------------------------------------------------ # ● SP回復率 #------------------------------------------------------------------------ unless item.recover_sp_rate.zero? x = 0 y += 1 text = phrase["recover_sp_rate"] + item.recover_sp_rate.to_s+"%" self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) end #------------------------------------------------------------------------ # ● SP回復量 #------------------------------------------------------------------------ unless item.recover_sp.zero? x = 0 y += 1 text = phrase["elements"] + item.recover_sp.to_s self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) end #------------------------------------------------------------------------ # ● 能力值增加 #------------------------------------------------------------------------ unless item.parameter_type.zero? x = 0 y += 1 text= parameter_type[item.parameter_type]+" +"+item.parameter_points.to_s self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) end #------------------------------------------------------------------------ # ● 屬性 #------------------------------------------------------------------------ if element_set.size > 0 x = 0 y += 1 text = phrase["elements"] for i in 0...element_set.size break if i > 4 text += $data_system.elements[element_set[i]] end self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) end if element_set.size >= 5 x = (phrase["elements"].size)*5-4 y += 1 text = "" for i in 4...element_set.size text += $data_system.elements[element_set[i]] end self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) end #------------------------------------------------------------------------ # ● 狀態添加 #------------------------------------------------------------------------ unless plus_state_set.empty? text = phrase["plus"] x = 0 y += 1 self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) plus_state_set.each do |plus_state| y += 1 text = $data_states[plus_state].name self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) end end #------------------------------------------------------------------------ # ● 狀態解除 #------------------------------------------------------------------------ unless minus_state_set.empty? text = phrase["minus"] x = 0 y += 1 self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) minus_state_set.each do |minus_state| y += 1 text = $data_states[minus_state].name self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) end end end #-------------------------------------------------------------------------- # ● 技能帮助窗口 #-------------------------------------------------------------------------- def set_skill_text(skill) # 取得描述 description = skill.description.clone # 取得屬性、附加狀態、解除狀態之副本 element_set = skill.element_set.clone plus_state_set = skill.plus_state_set.clone minus_state_set = skill.minus_state_set.clone # 過濾不顯示的描述 element_set -= @unshow_elements plus_state_set -= @unshow_states minus_state_set -= @unshow_states # 初始化設定 x = 0 y = 0 h = 0 phrase = {} scope = {} # 基本數據設定 =begin name_size = 名字文字大小 size = 描述文字大小 word = 每行的描述文字數 move = 全體描述偏移幅度 =end name_size = 18 size = 14 word = 12 move = 80 # 基本文字設定 phrase["scope"] = "范围:" # phrase["power"] = "威力:" phrase["cost_sp"] = "消耗SP:" phrase["hit_rate"] = "命中率:" phrase["elements"] = "攻击属性" # phrase["plus"] = "附加" phrase["minus"] = "解除" phrase["states"] = "状态" scope[0] = "特殊技能" scope[1] = "敌单体" scope[2] = "敌全体" scope[3] = "我方单体" scope[4] = "我方全体" scope[5] = "我方昏死(单体)" scope[6] = "我方昏死(全体)" scope[7] = "自身" #由描叙确定高 h =description.size/3/word h += 1 if (description.size%3/word) > 0 h += 4 #空行,效果范围,消费SP,命中率 h += 1 unless skill.power.zero? h += 1 unless element_set.empty? h += 1 unless element_set[4].nil? h += plus_state_set.size h += minus_state_set.size #------------------------------------------------------------------------ # ● 換算高度 #------------------------------------------------------------------------ self.height=h * size + name_size + 32 self.contents = Bitmap.new(self.width - 32,self.height - 32) self.contents.clear #------------------------------------------------------------------------ # ● 名字描述 #------------------------------------------------------------------------ text = skill.name self.contents.font.color = Color.new(255, 255, 128, 255) self.contents.font.size = name_size if text!=nil self.visible = true self.contents.draw_text(0,0, text.size*7, name_size, text, 0) else self.visible = false end #------------------------------------------------------------------------ # ● 說明描述 #------------------------------------------------------------------------ x = 0 y += 1 text = description while ((text = description.slice!(/./m)) != nil) self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x*size, y*size+5, size, size, text, 0) x+=1 if x==word#每行10个字 x = 0 y += 1 end end #------------------------------------------------------------------------ # ● 攻擊範圍 #------------------------------------------------------------------------ text = phrase["scope"] + scope[skill.scope] x = 0 y += 1 self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x, y*size+5, text.size*6, size, text, 0) #------------------------------------------------------------------------ # ● 空一行 #------------------------------------------------------------------------ y += 1 #------------------------------------------------------------------------ # ● 威力描述 #------------------------------------------------------------------------ unless skill.power.zero? power = skill.power > 0 ? skill.power : -1 * skill.power text = phrase["power"] + power.to_s x = 0 y += 1 self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x, y*size+5, text.size*6, size, text, 0) end #------------------------------------------------------------------------ # ● 消費SP描述 #------------------------------------------------------------------------ text = phrase["cost_sp"] + skill.sp_cost.to_s x = 0 y += 1 self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x, y*size+5, text.size*6, size, text, 0) #------------------------------------------------------------------------ # ● 命中率描述 #------------------------------------------------------------------------ text = phrase["hit_rate"] + skill.hit.to_s + "%" x = 0 y += 1 self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x, y*size+5, text.size*6, size, text, 0) #------------------------------------------------------------------------ # ● 攻擊屬性 #------------------------------------------------------------------------ if element_set.size > 0 text=phrase["elements"] for i in 0...element_set.size if i < 4 text+=$data_system.elements[element_set[i]] else break end end x = 0 y += 1 self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x, y*size+5, text.size*6, size, text, 0) end if element_set.size >= 5 text="" for i in 4...element_set.size text+=$data_system.elements[element_set[i]] end x= (phrase["elements"].size)*3 y += 1 self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x, y*size+5, text.size*6, size, text, 0) end #------------------------------------------------------------------------ # ● 狀態附加 #------------------------------------------------------------------------ unless plus_state_set.empty? text= phrase["plus"] x = 0 y += 1 self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x, y*size+5, text.size*6, size, text, 0) plus_state_set.each do |plus_state| y += 1 text=$data_states[plus_state].name self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x, y*size+5, text.size*6, size, text, 0) end end #------------------------------------------------------------------------ # ●狀態解除 #------------------------------------------------------------------------ unless minus_state_set.empty? text = phrase["minus"] x = 0 y += 1 self.contents.font.color = normal_color self.contents.font.size=size self.contents.draw_text(x, y*size+5, text.size*6, size, text, 0) minus_state_set.each do |minus_state| y += 1 text=$data_states[minus_state].name self.contents.font.color = normal_color self.contents.font.size=size self.contents.draw_text(x, y*size+5, text.size*6, size, text, 0) end end end #-------------------------------------------------------------------------- # ● 设置角色 # actor : 要显示状态的角色 #-------------------------------------------------------------------------- def set_actor(actor) if actor != @actor self.contents.clear draw_actor_name(actor, 4, 0) draw_actor_state(actor, 140, 0) draw_actor_hp(actor, 284, 0) draw_actor_sp(actor, 460, 0) @actor = actor @text = nil self.visible = true end end #-------------------------------------------------------------------------- # ● 設置角色 # actor : 要顯示狀態之角色 #-------------------------------------------------------------------------- def set_actor(actor) self.contents = Bitmap.new(width - 32, height - 32) if self.contents.nil? if actor != @actor self.contents.clear draw_actor_name(actor, 4, 0) draw_actor_state(actor, 140, 0) draw_actor_hp(actor, 284, 0) draw_actor_sp(actor, 460, 0) @actor = actor @text = nil self.visible = true end end #-------------------------------------------------------------------------- # ● 設置敵人 # enemy : 要顯示名字與狀態之敵人 #-------------------------------------------------------------------------- def set_enemy(enemy) self.contents = Bitmap.new(width - 32, height - 32) if self.contents.nil? text = enemy.name.sub(/\[Ff][([0-9]+)]/) {""} state_text = make_battler_state_text(enemy, 112, false) if state_text != "" text += " " + state_text end set_text(text, 1) self.visible = true end #-------------------------------------------------------------------------- # ● 校正帮助窗口位置 #-------------------------------------------------------------------------- def set_pos(x,y,width,oy,index,column_max) #光标坐标 cursor_width = width / column_max - 32 xx = index % column_max * (cursor_width + 32) yy = index / column_max * 32 - oy self.x=xx+x+150 self.y=yy+y+30 if self.x+self.width>640 self.x=640-self.width end if self.y+self.height>480 self.y=480-self.height end end #------------------------------------------------------------------------ # ● 裝備名字顔色變化 接口 #------------------------------------------------------------------------ def draw_name_color(equipment) return normal_color end #------------------------------------------------------------------------ # ● 自身身份確認 #------------------------------------------------------------------------ def original_help? return false end end #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ #============================================================================== # ■ Window_Item #------------------------------------------------------------------------------ # 物品画面、战斗画面、显示浏览物品的窗口。 #============================================================================== class Window_Item < Window_Selectable #-------------------------------------------------------------------------- # ● 初始化对像 #-------------------------------------------------------------------------- def initialize super(0, 64-64, 640, 416+64) @column_max = 2 refresh self.index = 0 # 战斗中的情况下将窗口移至中央并将其半透明化 if $game_temp.in_battle self.y = 64 self.height = 256 self.back_opacity = 160 end end #-------------------------------------------------------------------------- # ● 刷新帮助文本 #-------------------------------------------------------------------------- def update_help @help_window.set_text(item) #校正帮助窗口位置 @help_window.set_pos(self.x,self.y,self.width,self.oy,self.index,@column_max) end end #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ #============================================================================== # ■ Window_SkillStatus #------------------------------------------------------------------------------ # 显示特技画面、特技使用者的窗口。 #============================================================================== class Window_SkillStatus < Window_Base #-------------------------------------------------------------------------- # ● 初始化对像 # actor : 角色 #-------------------------------------------------------------------------- def initialize(actor) # ------------------- # 修改開始 super(0, 64-64, 640, 64+64)#★★★★★★★★★★★★★★★★★★★★ # 修改終了 # ------------------- self.contents = Bitmap.new(width - 32, height - 32) @actor = actor refresh end end #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ #============================================================================== # ■ Window_EquipLeft #------------------------------------------------------------------------------ # 装备画面的、显示角色能力值变化的窗口。 #============================================================================== class Window_EquipLeft < Window_Base #-------------------------------------------------------------------------- # ● 初始化对像 # actor : 角色 #-------------------------------------------------------------------------- def initialize(actor) # ------------------- # 修改開始 super(0, 64-64, 272, 416+64)#★★★★★★★★★★★★★★★★★★★★ # 修改終了 # ------------------- self.contents = Bitmap.new(width - 32, height - 32) @actor = actor refresh end end #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ #============================================================================== # ■ Window_EquipRight #------------------------------------------------------------------------------ # 装备画面、显示角色现在装备的物品的窗口。 #============================================================================== class Window_EquipRight < Window_Selectable #-------------------------------------------------------------------------- # ● 初始化对像 # actor : 角色 #-------------------------------------------------------------------------- def initialize(actor) # ------------------- # 修改開始 super(272, 64-64, 368, 256+64)#★★★★★★★★★★★★★★★★★★★★ # 修改終了 # ------------------- self.contents = Bitmap.new(width - 32, height - 32) @actor = actor refresh self.index = 0 end #-------------------------------------------------------------------------- # ● 刷新帮助文本 #-------------------------------------------------------------------------- def update_help @help_window.set_text(item) #校正帮助窗口位置 @help_window.set_pos(self.x,self.y,self.width,self.oy,self.index,@column_max) end end #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ #============================================================================== # ■ Window_EquipItem #------------------------------------------------------------------------------ # 装备画面、显示浏览变更装备的候补物品的窗口。 #============================================================================== class Window_EquipItem < Window_Selectable #-------------------------------------------------------------------------- # ● 初始化对像 # actor : 角色 # equip_type : 装备部位 (0~3) #-------------------------------------------------------------------------- def initialize(actor, equip_type) # ------------------- # 修改開始 super(272, 320, 368, 160)#★★★★★★★★★★★★★★★★★★★★ # 修改終了 # ------------------- @actor = actor @equip_type = equip_type @column_max = 1 refresh self.active = false self.index = -1 end def update_help @help_window.set_text(item) #校正帮助窗口位置 @help_window.set_pos(self.x,self.y,self.width,self.oy,self.index,@column_max) end end #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ #============================================================================== # ■ Scene_Equip #------------------------------------------------------------------------------ # 处理装备画面的类。 #============================================================================== class Scene_Equip #-------------------------------------------------------------------------- # ● 刷新画面 (右侧窗口被激活的情况下) #-------------------------------------------------------------------------- def update_right # ------------------- # 修改開始 if @right_window.item==nil @help_window.visible=false else @help_window.visible=true end # 修改終了 # ------------------- # 按下 B 键的情况下 if Input.trigger?(Input::B) # 演奏取消 SE $game_system.se_play($data_system.cancel_se) # 切换到菜单画面 $scene = Scene_Menu.new(2) return end # 按下 C 键的情况下 if Input.trigger?(Input::C) # 固定装备的情况下 if @actor.equip_fix?(@right_window.index) # 演奏冻结 SE $game_system.se_play($data_system.buzzer_se) return end # 演奏确定 SE $game_system.se_play($data_system.decision_se) # 激活物品窗口 @right_window.active = false @item_window.active = true @item_window.index = 0 return end # 按下 R 键的情况下 if Input.trigger?(Input::R) # 演奏光标 SE $game_system.se_play($data_system.cursor_se) # 移至下一位角色 @actor_index += 1 @actor_index %= $game_party.actors.size # 切换到别的装备画面 $scene = Scene_Equip.new(@actor_index, @right_window.index) return end # 按下 L 键的情况下 if Input.trigger?(Input::L) # 演奏光标 SE $game_system.se_play($data_system.cursor_se) # 移至上一位角色 @actor_index += $game_party.actors.size - 1 @actor_index %= $game_party.actors.size # 切换到别的装备画面 $scene = Scene_Equip.new(@actor_index, @right_window.index) return end end #-------------------------------------------------------------------------- # ● 刷新画面 (物品窗口被激活的情况下) #-------------------------------------------------------------------------- def update_item # ------------------- # 修改開始 if @item_window.item==nil @help_window.visible=false else @help_window.visible=true end # 修改終了 # ------------------- # 按下 B 键的情况下 if Input.trigger?(Input::B) # 演奏取消 SE $game_system.se_play($data_system.cancel_se) # 激活右侧窗口 @right_window.active = true @item_window.active = false @item_window.index = -1 return end # 按下 C 键的情况下 if Input.trigger?(Input::C) # 演奏装备 SE $game_system.se_play($data_system.equip_se) # 获取物品窗口现在选择的装备数据 item = @item_window.item # 变更装备 @actor.equip(@right_window.index, item == nil ? 0 : item.id) # 激活右侧窗口 @right_window.active = true @item_window.active = false @item_window.index = -1 # 再生成右侧窗口、物品窗口的内容 @right_window.refresh @item_window.refresh return end end end #------------------------------------------------------------------------------ #‘‘──eu国猪于2012-7-21 12:22补充以下内容: #============================================================================== # 禾西製作 / Created by Quarcy #============================================================================== class Window_Help < Window_Base attr_reader :materia #-------------------------------------------------------------------------- # ● 定義不顯示的屬性與狀態 #-------------------------------------------------------------------------- def unshown @unshow_elements = [17, 18] @unshow_states = [] end #-------------------------------------------------------------------------- # ● 初始化對象 #-------------------------------------------------------------------------- def initialize super(0, 0, 640, 64) self.opacity = 150 self.z=150 self.visible = false end #-------------------------------------------------------------------------- # ● 設置文本 # data : 窗口顯示的字符串/物品資料 # align : 對齊方式 (0..左對齊、1..中間對齊、2..右對齊) #-------------------------------------------------------------------------- def set_text(data, align=0) #------------------------------------------------------------------------ # ● 當資料爲文字時候 #------------------------------------------------------------------------ # 如果文本或對齊方式至少一方与上次的不同 if data != @text or align != @align if data.is_a?(String) # 再描繪文本 self.width = 640 self.height = 64 self.x=0 self.y=0 self.contents = Bitmap.new(width - 32, height - 32) if self.contents.nil? self.contents.clear self.contents.font.color = normal_color self.contents.font.size = 20 self.contents.draw_text(4, 0, self.width - 40, 32, data, align) @text = data @align = align @actor = nil self.visible = true end end return if data.is_a?(String) #------------------------------------------------------------------------ # ● 當沒有資料時候 #------------------------------------------------------------------------ if data.nil? self.visible=false else self.visible=true end #------------------------------------------------------------------------ # ● 當資料爲物品/技能時候 #------------------------------------------------------------------------ if data != nil && @data != data self.width = 210 self.height = 430 self.x=0 self.y=200 unshown non_auto_update(data) else return end end #-------------------------------------------------------------------------- # ● 更新帮助窗口 #-------------------------------------------------------------------------- def non_auto_update(data=@data) @data = data case @data when RPG::Item set_item_text(@data) when RPG::Weapon set_equipment_text(@data) when RPG::Armor set_equipment_text(@data) when RPG::Skill set_skill_text(@data) end end #-------------------------------------------------------------------------- # ● 裝備帮助窗口 #-------------------------------------------------------------------------- def set_equipment_text(equipment) #------------------------------------------------------------------------ # ● 取得基本質料 #------------------------------------------------------------------------ # 取得屬性、附加狀態、解除狀態之副本 case equipment when RPG::Weapon element_set = equipment.element_set.clone plus_state_set = equipment.plus_state_set.clone minus_state_set = equipment.minus_state_set.clone #----------------------# # 過濾不顯示的狀態描述 # #----------------------# plus_state_set -= @unshow_states minus_state_set -= @unshow_states when RPG::Armor element_set = equipment.guard_element_set.clone guard_state_set = equipment.guard_state_set.clone #----------------------# # 過濾不顯示的狀態描述 # #----------------------# auto_state_id = equipment.auto_state_id guard_state_set -= @unshow_states end #----------------------# # 過濾不顯示的屬性描述 # #----------------------# element_set -= @unshow_elements #--------------# # 取得說明文字 # #--------------# description = equipment.description.clone # 初始化數據設定 x = 0 y = 0 h = 0 phrase = {} # 基本文字設定 phrase["price"] = "价格:" phrase["elements"] = "属性:" phrase["minus_states"] = "解除状态:" phrase["plus_states"] = "附加状态:" phrase["guard_elements"] = "防御属性" phrase["guard_states"] = "防御状态" phrase["auto_state"] = "自动状态" # 基本數據設定 =begin name_size = 名字文字大小 size = 描述文字大小 word = 每行的描述文字數 move = 全體描述偏移幅度 =end name_size = 18 size = 14 word = 12 move = 80 #------------------------------------------------------------------------ # ● 確定背景圖片的高度 #------------------------------------------------------------------------ h += (description.size/3/word) h += 1 if (description.size/3%word) > 0 h += 1 if equipment.is_a?(RPG::Weapon) now_h = h h += 1 h += 1 unless equipment.pdef.zero? h += 1 unless equipment.mdef.zero? h += 1 if element_set.size > 0 h += 1 if element_set.size >= 5 case equipment when RPG::Weapon h += 1 unless minus_state_set.empty? h += minus_state_set.size h += 1 unless plus_state_set.empty? h += plus_state_set.size when RPG::Armor h += 1 unless guard_state_set.empty? h += guard_state_set.size h += 1 unless auto_state_id.zero? end h += 1 h += 1 unless equipment.str_plus.zero? h += 1 unless equipment.dex_plus.zero? h += 1 unless equipment.agi_plus.zero? h += 1 unless equipment.int_plus.zero? h += materia_height_plus(equipment) unless self.materia.nil? #------------------------------------------------------------------------ # ● 圖片顯示保證高度 #------------------------------------------------------------------------ h = 6 + now_h if (h - now_h) < 6 #------------------------------------------------------------------------ # ● 換算高度 #------------------------------------------------------------------------ self.height = h * size + name_size + 32 #------------------------------------------------------------------------ # ● 生成背景 #------------------------------------------------------------------------ self.contents = Bitmap.new(self.width - 32, self.height - 32) self.contents.clear #------------------------------------------------------------------------ # ● 名字描繪 #------------------------------------------------------------------------ text = equipment.name self.contents.font.color = Color.new(0, 6, 252) self.contents.font.size = name_size if text.nil? self.visible = false else self.visible = true self.contents.draw_text(0, 0, text.size*7, name_size, text, 0) end #------------------------------------------------------------------------ # ● 說明描繪 #------------------------------------------------------------------------ x = 0 y += 1 while ((text = description.slice!(/./m)) != nil) self.contents.font.color = Color.new(255, 255, 255) self.contents.font.size = size self.contents.draw_text(x*size, y*size+5, size, size, text, 0) x+=1 if x == word x=0 y+=1 end end #------------------------------------------------------------------------ # ● 圖標描繪 #------------------------------------------------------------------------ bitmap = RPG::Cache.icon(equipment.icon_name) opacity = self.contents.font.color == normal_color ? 255 : 128 self.contents.blt(0 ,y*size + 20, bitmap, Rect.new(0, 0, 95, 100), 225) #------------------------------------------------------------------------ # ● 攻擊力描繪(武器) #------------------------------------------------------------------------ if equipment.is_a?(RPG::Weapon) x = 0 y += 1 text = $data_system.words.atk+":"+equipment.atk.to_s self.contents.font.color = Color.new(6, 252, 0) self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) end #------------------------------------------------------------------------ # ● 價格描繪 #------------------------------------------------------------------------ x = 0 y += 1 text = phrase["price"] + equipment.price.to_s self.contents.font.color = Color.new(255, 19, 119) self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) #------------------------------------------------------------------------ # ● 物理防禦 #------------------------------------------------------------------------ unless equipment.pdef.zero? x = 0 y += 1 text = $data_system.words.pdef+":"+equipment.pdef.to_s self.contents.font.color = Color.new(6, 252, 0) self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) end #------------------------------------------------------------------------ # ● 魔法防禦 #------------------------------------------------------------------------ unless equipment.mdef.zero? x = 0 y += 1 text=$data_system.words.mdef+":"+equipment.mdef.to_s self.contents.font.color = Color.new(6, 252, 0) self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) end #------------------------------------------------------------------------ # ● 屬性 #------------------------------------------------------------------------ if element_set.size > 0 x = 0 y += 1 text = phrase["elements"] for i in 0...element_set.size break if i > 0 text += $data_system.elements[element_set[i]] end self.contents.font.color = Color.new(255, 0, 255) self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) end if element_set.size >= 0 x = (phrase["elements"].size)*0 y += 1 text = "" for i in 0...element_set.size text += $data_system.elements[element_set[i]] end self.contents.font.color = Color.new(71, 243, 229) self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) end #------------------------------------------------------------------------ # ● 描述分流 武器/防具 #------------------------------------------------------------------------ case equipment when RPG::Weapon #------------------------------------------------------------------------ # ● 解除狀態(武器) #------------------------------------------------------------------------ unless minus_state_set.empty? x = 0 y += 1 text=phrase["minus_states"] text=phrase["guard_states"] self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) for i in 0...minus_state_set.size y += 1 text = $data_states[minus_state_set[i]].name self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) end end #------------------------------------------------------------------------ # ● 附加狀態(武器) #------------------------------------------------------------------------ unless plus_state_set.empty? x = 0 y += 1 text = phrase["plus_states"] self.contents.font.color = Color.new(255, 0, 255) self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) for i in 0...plus_state_set.size y += 1 text=$data_states[plus_state_set[i]].name self.contents.font.color = Color.new(255, 240, 74) self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) end end when RPG::Armor #------------------------------------------------------------------------ # ● 防禦狀態(防具) #------------------------------------------------------------------------ unless guard_state_set.empty? x = 0 y += 1 text=phrase["guard_states"] self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) for i in 0...guard_state_set.size y += 1 text = $data_states[guard_state_set[i]].name self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) end end #------------------------------------------------------------------------ # ● 自動狀態(防具) #------------------------------------------------------------------------ unless auto_state_id.zero? x = 0 y += 1 text = phrase["auto_state"] + $data_states[auto_state_id].name self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) end end #------------------------------------------------------------------------ # ● 空行 #------------------------------------------------------------------------ y+=1 #------------------------------------------------------------------------ # ● 力量 #------------------------------------------------------------------------ unless equipment.str_plus.zero? x = 0 y += 1 h += 1 if equipment.str_plus > 0 text=$data_system.words.str+" +"+ equipment.str_plus.to_s else text=$data_system.words.str+" -"+ (-equipment.str_plus).to_s end self.contents.font.color = Color.new(255, 0, 0) self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) end #------------------------------------------------------------------------ # ● 靈巧 #------------------------------------------------------------------------ unless equipment.dex_plus.zero? x = 0 y += 1 h += 1 if equipment.dex_plus > 0 text=$data_system.words.dex+" +"+ equipment.dex_plus.to_s else text=$data_system.words.dex+" -"+ (-equipment.dex_plus).to_s end self.contents.font.color = Color.new(255, 0, 0) self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) end #------------------------------------------------------------------------ # ● 速度 #------------------------------------------------------------------------ unless equipment.agi_plus.zero? x = 0 y += 1 h += 1 if equipment.agi_plus > 0 text=$data_system.words.agi+" +"+ equipment.agi_plus.to_s else text=$data_system.words.agi+" -"+ (-equipment.agi_plus).to_s end self.contents.font.color = Color.new(255, 0, 0) self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) end #------------------------------------------------------------------------ # ● 智力 #------------------------------------------------------------------------ unless equipment.int_plus.zero? x = 0 y += 1 h += 1 if equipment.int_plus > 0 text=$data_system.words.int+" +"+ equipment.int_plus.to_s else text=$data_system.words.int+" -"+ (-equipment.int_plus).to_s end self.contents.font.color = Color.new(255, 0, 0) self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) end #------------------------------------------------------------------------ # ● 魔力石描繪 #------------------------------------------------------------------------ y += draw_materia(equipment, move, y, size) unless self.materia.nil? end #-------------------------------------------------------------------------- # ● 物品幫助窗口 #-------------------------------------------------------------------------- def set_item_text(item) # 取得描述 description = item.description.clone # 取得屬性、附加狀態、解除狀態之副本 element_set = item.element_set.clone plus_state_set = item.plus_state_set.clone minus_state_set = item.minus_state_set.clone # 過濾不顯示的描述 element_set -= @unshow_elements plus_state_set -= @unshow_states minus_state_set -= @unshow_states # 初始化數據設定 x = 0 y = 0 h = 0 phrase = {} scope ={} parameter_type = {} # 基本數據設定 =begin name_size = 名字文字大小 size = 描述文字大小 word = 每行的描述文字數 move = 全體描述偏移幅度 =end name_size = 18 size = 14 word = 12 move = 80 # 基本文字設定 phrase["scope"] = "范围:" phrase["price"] = "价格:" phrase["recover_hp_rate"] = "HP 回复率:" phrase["recover_hp"] = "HP 回复量:" phrase["recover_sp_rate"] = "SP 回复率:" phrase["recover_sp"] = "SP 回复量:" phrase["elements"] = "属性:" phrase["plus"] = "附加" phrase["minus"] = "解除" phrase["states"] = "状态" scope[0] = "特殊物品" scope[1] = "特殊物品" scope[2] = "敌单体" scope[3] = "敌全体" scope[4] = "己方单体" scope[5] = "己方全体" scope[6] = "己方昏死单体" scope[7] = "己方昏死全体" scope[8] = "使用者" parameter_type[1] = "MaxHP" parameter_type[2] = "MaxSP" parameter_type[3] = $data_system.words.str parameter_type[4] = $data_system.words.dex parameter_type[5] = $data_system.words.agi parameter_type[6] = $data_system.words.int #依顯示内容確定自身高 h = (description.size/3/word) h +=1 if (description.size/3%word)> 0 now_h = h h +=3 # 空行,效果範圍,價格 h += 1 unless item.recover_hp_rate.zero? h += 1 unless item.recover_hp.zero? h += 1 unless item.recover_sp_rate.zero? h += 1 unless item.recover_sp.zero? h += 1 unless item.parameter_type.zero? h += 1 unless element_set[0].nil? h += 1 unless element_set[4].nil? h += (1+plus_state_set.size) unless plus_state_set.empty? h += (1+minus_state_set.size) unless minus_state_set.empty? #------------------------------------------------------------------------ # ● 圖片顯示保證高度 #------------------------------------------------------------------------ h = 6 + now_h if (h - now_h) < 6 #------------------------------------------------------------------------ # ● 換算高度 #------------------------------------------------------------------------ self.height = h * size + name_size + 32 #------------------------------------------------------------------------ # ● 生成背景 #------------------------------------------------------------------------ self.contents = Bitmap.new(self.width - 32, self.height - 32) self.contents.clear #------------------------------------------------------------------------ # ● 名字描繪 #------------------------------------------------------------------------ text = item.name self.contents.font.color = normal_color#顔色腳本 self.contents.font.size = name_size if text.nil? self.visible = false else self.visible = true self.contents.draw_text(0,0, text.size*7, 20, text, 0) end #------------------------------------------------------------------------ # ● 說明描繪 #------------------------------------------------------------------------ x = 0 y += 1 while ((text = description.slice!(/./m)) != nil) self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x*size, y*size+5, size, size, text, 0) x+=1 if x == word x = 0 y += 1 end end #------------------------------------------------------------------------ # ● 圖標描繪 #------------------------------------------------------------------------ bitmap = RPG::Cache.icon(item.icon_name) unless item.icon_name.nil? opacity = self.contents.font.color == normal_color ? 255 : 128 self.contents.blt(0 ,y*size + 20, bitmap, Rect.new(0, 0, 95, 100), 225) #------------------------------------------------------------------------ # ● 魔力石接口 #------------------------------------------------------------------------ unless self.materia.nil? return if is_materia?(item) end #------------------------------------------------------------------------ # ● 效果範圍 #------------------------------------------------------------------------ text= phrase["scope"] + scope[item.scope] x = 0 y += 1 self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) #------------------------------------------------------------------------ # ● 價格 #------------------------------------------------------------------------ x = 0 y += 1 text = phrase["price"] + item.price.to_s self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) #------------------------------------------------------------------------ # ● HP回復率 #------------------------------------------------------------------------ unless item.recover_hp_rate.zero? x = 0 y += 1 text = phrase["recover_hp_rate"] + item.recover_hp_rate.to_s+"%" self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) end #------------------------------------------------------------------------ # ● HP回復量 #------------------------------------------------------------------------ unless item.recover_hp.zero? x = 0 y += 1 text = phrase["recover_hp"] + item.recover_hp.to_s self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) end #------------------------------------------------------------------------ # ● SP回復率 #------------------------------------------------------------------------ unless item.recover_sp_rate.zero? x = 0 y += 1 text = phrase["recover_sp_rate"] + item.recover_sp_rate.to_s+"%" self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) end #------------------------------------------------------------------------ # ● SP回復量 #------------------------------------------------------------------------ unless item.recover_sp.zero? x = 0 y += 1 text = phrase["elements"] + item.recover_sp.to_s self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) end #------------------------------------------------------------------------ # ● 能力值增加 #------------------------------------------------------------------------ unless item.parameter_type.zero? x = 0 y += 1 text= parameter_type[item.parameter_type]+" +"+item.parameter_points.to_s self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) end #------------------------------------------------------------------------ # ● 屬性 #------------------------------------------------------------------------ if element_set.size > 0 x = 0 y += 1 text = phrase["elements"] for i in 0...element_set.size break if i > 4 text += $data_system.elements[element_set[i]] end self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) end if element_set.size >= 5 x = (phrase["elements"].size)*5-4 y += 1 text = "" for i in 4...element_set.size text += $data_system.elements[element_set[i]] end self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) end #------------------------------------------------------------------------ # ● 狀態添加 #------------------------------------------------------------------------ unless plus_state_set.empty? text = phrase["plus"] x = 0 y += 1 self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) plus_state_set.each do |plus_state| y += 1 text = $data_states[plus_state].name self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) end end #------------------------------------------------------------------------ # ● 狀態解除 #------------------------------------------------------------------------ unless minus_state_set.empty? text = phrase["minus"] x = 0 y += 1 self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) minus_state_set.each do |minus_state| y += 1 text = $data_states[minus_state].name self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x+move, y*size+5, text.size*6, size, text, 0) end end end #-------------------------------------------------------------------------- # ● 技能帮助窗口 #-------------------------------------------------------------------------- def set_skill_text(skill) # 取得描述 description = skill.description.clone # 取得屬性、附加狀態、解除狀態之副本 element_set = skill.element_set.clone plus_state_set = skill.plus_state_set.clone minus_state_set = skill.minus_state_set.clone # 過濾不顯示的描述 element_set -= @unshow_elements plus_state_set -= @unshow_states minus_state_set -= @unshow_states # 初始化設定 x = 0 y = 0 h = 0 phrase = {} scope = {} # 基本數據設定 =begin name_size = 名字文字大小 size = 描述文字大小 word = 每行的描述文字數 move = 全體描述偏移幅度 =end name_size = 18 size = 14 word = 12 move = 80 # 基本文字設定 phrase["scope"] = "范围:" # phrase["power"] = "威力:" phrase["cost_sp"] = "消耗SP:" phrase["hit_rate"] = "命中率:" phrase["elements"] = "攻击属性" # phrase["plus"] = "附加" phrase["minus"] = "解除" phrase["states"] = "状态" scope[0] = "特殊技能" scope[1] = "敌单体" scope[2] = "敌全体" scope[3] = "我方单体" scope[4] = "我方全体" scope[5] = "我方昏死(单体)" scope[6] = "我方昏死(全体)" scope[7] = "自身" #由描叙确定高 h =description.size/3/word h += 1 if (description.size%3/word) > 0 h += 4 #空行,效果范围,消费SP,命中率 h += 1 unless skill.power.zero? h += 1 unless element_set.empty? h += 1 unless element_set[4].nil? h += plus_state_set.size h += minus_state_set.size #------------------------------------------------------------------------ # ● 換算高度 #------------------------------------------------------------------------ self.height=h * size + name_size + 32 self.contents = Bitmap.new(self.width - 32,self.height - 32) self.contents.clear #------------------------------------------------------------------------ # ● 名字描述 #------------------------------------------------------------------------ text = skill.name self.contents.font.color = normal_color self.contents.font.size = name_size if text!=nil self.visible = true self.contents.draw_text(0,0, text.size*7, name_size, text, 0) else self.visible = false end #------------------------------------------------------------------------ # ● 說明描述 #------------------------------------------------------------------------ x = 0 y += 1 text = description while ((text = description.slice!(/./m)) != nil) self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x*size, y*size+5, size, size, text, 0) x+=1 if x==word#每行10个字 x = 0 y += 1 end end #------------------------------------------------------------------------ # ● 攻擊範圍 #------------------------------------------------------------------------ text = phrase["scope"] + scope[skill.scope] x = 0 y += 1 self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x, y*size+5, text.size*6, size, text, 0) #------------------------------------------------------------------------ # ● 空一行 #------------------------------------------------------------------------ y += 1 #------------------------------------------------------------------------ # ● 威力描述 #------------------------------------------------------------------------ unless skill.power.zero? power = skill.power > 0 ? skill.power : -1 * skill.power text = phrase["power"] + power.to_s x = 0 y += 1 self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x, y*size+5, text.size*6, size, text, 0) end #------------------------------------------------------------------------ # ● 消費SP描述 #------------------------------------------------------------------------ text = phrase["cost_sp"] + skill.sp_cost.to_s x = 0 y += 1 self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x, y*size+5, text.size*6, size, text, 0) #------------------------------------------------------------------------ # ● 命中率描述 #------------------------------------------------------------------------ text = phrase["hit_rate"] + skill.hit.to_s + "%" x = 0 y += 1 self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x, y*size+5, text.size*6, size, text, 0) #------------------------------------------------------------------------ # ● 攻擊屬性 #------------------------------------------------------------------------ if element_set.size > 0 text=phrase["elements"] for i in 0...element_set.size if i < 4 text+=$data_system.elements[element_set[i]] else break end end x = 0 y += 1 self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x, y*size+5, text.size*6, size, text, 0) end if element_set.size >= 5 text="" for i in 4...element_set.size text+=$data_system.elements[element_set[i]] end x= (phrase["elements"].size)*3 y += 1 self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x, y*size+5, text.size*6, size, text, 0) end #------------------------------------------------------------------------ # ● 狀態附加 #------------------------------------------------------------------------ unless plus_state_set.empty? text= phrase["plus"] x = 0 y += 1 self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x, y*size+5, text.size*6, size, text, 0) plus_state_set.each do |plus_state| y += 1 text=$data_states[plus_state].name self.contents.font.color = normal_color self.contents.font.size = size self.contents.draw_text(x, y*size+5, text.size*6, size, text, 0) end end #------------------------------------------------------------------------ # ●狀態解除 #------------------------------------------------------------------------ unless minus_state_set.empty? text = phrase["minus"] x = 0 y += 1 self.contents.font.color = normal_color self.contents.font.size=size self.contents.draw_text(x, y*size+5, text.size*6, size, text, 0) minus_state_set.each do |minus_state| y += 1 text=$data_states[minus_state].name self.contents.font.color = normal_color self.contents.font.size=size self.contents.draw_text(x, y*size+5, text.size*6, size, text, 0) end end end #-------------------------------------------------------------------------- # ● 设置角色 # actor : 要显示状态的角色 #-------------------------------------------------------------------------- def set_actor(actor) if actor != @actor self.contents.clear draw_actor_name(actor, 4, 0) draw_actor_state(actor, 140, 0) draw_actor_hp(actor, 284, 0) draw_actor_sp(actor, 460, 0) @actor = actor @text = nil self.visible = true end end #-------------------------------------------------------------------------- # ● 設置角色 # actor : 要顯示狀態之角色 #-------------------------------------------------------------------------- def set_actor(actor) self.contents = Bitmap.new(width - 32, height - 32) if self.contents.nil? if actor != @actor self.contents.clear draw_actor_name(actor, 4, 0) draw_actor_state(actor, 140, 0) draw_actor_hp(actor, 284, 0) draw_actor_sp(actor, 460, 0) @actor = actor @text = nil self.visible = true end end #-------------------------------------------------------------------------- # ● 設置敵人 # enemy : 要顯示名字與狀態之敵人 #-------------------------------------------------------------------------- def set_enemy(enemy) self.contents = Bitmap.new(width - 32, height - 32) if self.contents.nil? text = enemy.name.sub(/\\[Ff]\[([0-9]+)\]/) {""} state_text = make_battler_state_text(enemy, 112, false) if state_text != "" text += " " + state_text end set_text(text, 1) self.visible = true end #-------------------------------------------------------------------------- # ● 校正帮助窗口位置 #-------------------------------------------------------------------------- def set_pos(x,y,width,oy,index,column_max) #光标坐标 cursor_width = width / column_max - 32 xx = index % column_max * (cursor_width + 32) yy = index / column_max * 32 - oy self.x=xx+x+150 self.y=yy+y+30 if self.x+self.width>640 self.x=640-self.width end if self.y+self.height>480 self.y=480-self.height end end #------------------------------------------------------------------------ # ● 裝備名字顔色變化 接口 #------------------------------------------------------------------------ def draw_name_color(equipment) return normal_color end #------------------------------------------------------------------------ # ● 自身身份確認 #------------------------------------------------------------------------ def original_help? return false end end #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ #============================================================================== # ■ Window_Item #------------------------------------------------------------------------------ # 物品画面、战斗画面、显示浏览物品的窗口。 #============================================================================== class Window_Item < Window_Selectable #-------------------------------------------------------------------------- # ● 初始化对像 #-------------------------------------------------------------------------- def initialize super(0, 64-64, 640, 416+64) @column_max = 2 refresh self.index = 0 # 战斗中的情况下将窗口移至中央并将其半透明化 if $game_temp.in_battle self.y = 64 self.height = 256 self.back_opacity = 160 end end #-------------------------------------------------------------------------- # ● 刷新帮助文本 #-------------------------------------------------------------------------- def update_help @help_window.set_text(item) #校正帮助窗口位置 @help_window.set_pos(self.x,self.y,self.width,self.oy,self.index,@column_max) end end #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ #============================================================================== # ■ Window_Skill #------------------------------------------------------------------------------ #============================================================================== # ■ Window_EquipLeft #------------------------------------------------------------------------------ # 装备画面的、显示角色能力值变化的窗口。 #============================================================================== class Window_EquipLeft < Window_Base #-------------------------------------------------------------------------- # ● 初始化对像 # actor : 角色 #-------------------------------------------------------------------------- def initialize(actor) # ------------------- # 修改開始 super(0, 64-64, 272, 416+64)#★★★★★★★★★★★★★★★★★★★★ # 修改終了 # ------------------- self.contents = Bitmap.new(width - 32, height - 32) @actor = actor refresh end end #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ #============================================================================== # ■ Window_EquipRight #------------------------------------------------------------------------------ # 装备画面、显示角色现在装备的物品的窗口。 #============================================================================== class Window_EquipRight < Window_Selectable #-------------------------------------------------------------------------- # ● 初始化对像 # actor : 角色 #-------------------------------------------------------------------------- def initialize(actor) # ------------------- # 修改開始 super(240, 24, 368, 256+64)#★★★★★★★★★★★★★★★★★★★★ # 修改終了 # ------------------- self.contents = Bitmap.new(width - 32, height - 32) self.opacity = 0 @actor = actor refresh self.index = 0 end #-------------------------------------------------------------------------- # ● 刷新帮助文本 #-------------------------------------------------------------------------- def update_help @help_window.set_text(item) #校正帮助窗口位置 @help_window.set_pos(self.x,self.y,self.width,self.oy,self.index,@column_max) end end #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ #============================================================================== # ■ Window_EquipItem #------------------------------------------------------------------------------ # 装备画面、显示浏览变更装备的候补物品的窗口。 #============================================================================== class Window_EquipItem < Window_Selectable #-------------------------------------------------------------------------- # ● 初始化对像 # actor : 角色 # equip_type : 装备部位 (0~3) #-------------------------------------------------------------------------- def initialize(actor, equip_type) # ------------------- # 修改開始 super(224, 254, 368, 160)#★★★★★★★★★★★★★★★★★★★★ # 修改終了 # ------------------- @actor = actor @equip_type = equip_type @column_max = 1 refresh self.active = false self.index = -1 end def update_help @help_window.set_text(item) #校正帮助窗口位置 @help_window.set_pos(self.x,self.y,self.width,self.oy,self.index,@column_max) end end #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ #============================================================================== # ■ Scene_Equip #------------------------------------------------------------------------------ # 处理装备画面的类。 #============================================================================== class Scene_Equip #-------------------------------------------------------------------------- # ● 刷新画面 (右侧窗口被激活的情况下) #-------------------------------------------------------------------------- def update_right # ------------------- # 修改開始 if @right_window.item==nil @help_window.visible=false else @help_window.visible=true end # 修改終了 # ------------------- # 按下 B 键的情况下 if Input.trigger?(Input::B) # 演奏取消 SE $game_system.se_play($data_system.cancel_se) # 切换到菜单画面 $scene = Scene_Map.new return end # 按下 C 键的情况下 if Input.trigger?(Input::C) # 固定装备的情况下 if @actor.equip_fix?(@right_window.index) # 演奏冻结 SE $game_system.se_play($data_system.buzzer_se) return end # 演奏确定 SE $game_system.se_play($data_system.decision_se) # 激活物品窗口 @right_window.active = false @item_window.active = true @item_window.index = 0 return end # 按下 R 键的情况下 if Input.trigger?(Input::R) # 演奏光标 SE $game_system.se_play($data_system.cursor_se) # 移至下一位角色 @actor_index += 1 @actor_index %= $game_party.actors.size # 切换到别的装备画面 $scene = Scene_Equip.new(@actor_index, @right_window.index) return end # 按下 L 键的情况下 if Input.trigger?(Input::L) # 演奏光标 SE $game_system.se_play($data_system.cursor_se) # 移至上一位角色 @actor_index += $game_party.actors.size - 1 @actor_index %= $game_party.actors.size # 切换到别的装备画面 $scene = Scene_Equip.new(@actor_index, @right_window.index) return end end #-------------------------------------------------------------------------- # ● 刷新画面 (物品窗口被激活的情况下) #-------------------------------------------------------------------------- def update_item # ------------------- # 修改開始 if @item_window.item==nil @help_window.visible=false else @help_window.visible=true end # 修改終了 # ------------------- # 按下 B 键的情况下 if Input.trigger?(Input::B) # 演奏取消 SE $game_system.se_play($data_system.cancel_se) # 激活右侧窗口 @right_window.active = true @item_window.active = false @item_window.index = -1 return end # 按下 C 键的情况下 if Input.trigger?(Input::C) # 演奏装备 SE $game_system.se_play($data_system.equip_se) # 获取物品窗口现在选择的装备数据 item = @item_window.item # 变更装备 @actor.equip(@right_window.index, item == nil ? 0 : item.id) # 激活右侧窗口 @right_window.active = true @item_window.active = false @item_window.index = -1 # 再生成右侧窗口、物品窗口的内容 @right_window.refresh @item_window.refresh return end end end #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ #======================================================================================================================== # ■ Scene_Battle (分割定义 3) #------------------------------------------------------------------------------ # 处理战斗画面的类。 #======================================================================================================================== class Scene_Battle #-------------------------------------------------------------------------- # ● 刷新画面 (角色命令回合 : 选择特技) #-------------------------------------------------------------------------- alias first_reupdate_phase3_skill_select update_phase3_skill_select def update_phase3_skill_select # ------------------- # 修改開始 @skill_window.help_window.visible = false#★★★★★★★★★★★★★ # 修改終了 # ------------------- first_reupdate_phase3_skill_select end #-------------------------------------------------------------------------- # ● 刷新画面 (角色命令回合 : 选择物品) #-------------------------------------------------------------------------- alias first_reupdate_phase3_item_select update_phase3_item_select def update_phase3_item_select # ------------------- # 修改開始 @item_window.help_window.visible = false#★★★★★★★★★★★★ # 修改終了 # ------------------- first_reupdate_phase3_item_select end #-------------------------------------------------------------------------- # ● 开始选择特技 #-------------------------------------------------------------------------- def start_skill_select @skill_window = Window_Skill.new(@active_battler) @skill_window.help_window = Window_Help.new @actor_command_window.active = false @actor_command_window.visible = false end #-------------------------------------------------------------------------- # ● 选择特技结束 #-------------------------------------------------------------------------- alias first_update_end_skill_select end_skill_select def end_skill_select # ------------------- # 修改開始 @skill_window.help_window.visible = false#★★★★★★★★★★★★ # 修改終了 # ------------------- first_update_end_skill_select end #-------------------------------------------------------------------------- # ● 开始选择物品 #-------------------------------------------------------------------------- def start_item_select # 生成物品窗口 @item_window = Window_Item.new # 关联帮助窗口 # ------------------- # 修改開始 @item_window.help_window = Window_Help.new#★★★★★★★★★★★★ # 修改終了 # ------------------- # 无效化角色指令窗口 @actor_command_window.active = false @actor_command_window.visible = false end #-------------------------------------------------------------------------- # ● 结束选择物品 #-------------------------------------------------------------------------- alias first_update_end_item_select end_item_select def end_item_select # ------------------- # 修改開始 @item_window.help_window.visible = false#★★★★★★★★★★★★ # 修改終了 # ------------------- first_update_end_item_select end end #------------------------------------------------------------------------------
无咯.png (49.17 KB, 下载次数: 6)
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |