Project1
标题:
怎么把这个详情帮助脚本里添加装备武器等级限制的显示?
[打印本页]
作者:
有求必应
时间:
2011-8-25 12:21
标题:
怎么把这个详情帮助脚本里添加装备武器等级限制的显示?
本帖最后由 有求必应 于 2011-8-25 12:25 编辑
详情帮助脚本:
#==============================================================================
# ■ Window_Help
#------------------------------------------------------------------------------
# 原作:xuelong
# 修正:水迭澜
# 移植:禾西
#==============================================================================
class Window_Help < Window_Base
#--------------------------------------------------------------------------
# ● 定義
#--------------------------------------------------------------------------
def set
@phrase,@y= {}, 0
@scope, @parameter_type = [], []
=begin
@name_size = 名字文字大小
@size = 描述文字大小
@word = 每行的描述文字數
=end
@name_size = 18
@size = 14
@word = 11
# 不顯示的 屬性 與 狀態 ID
@unshow_elements = [17, 18]
@unshow_states = []
# 基本文字設定
@phrase[:price] = "价格"
@phrase[:elements] = "攻击属性"
@phrase[:states] = "复交状态"
@phrase[:guard_elements] = "减半状态"
@phrase[:guard_states] = "无效化状态"
#------------------#
# 物品效果語句 #
#------------------#
@phrase[:recover] = "回复"
@phrase[:hp] = "HP"
@phrase[:mp] = "MP"
@phrase[:plus_states] = "状态附加"
@phrase[:minus_states] = "状态解除"
@phrase[:speed] = "速度補正"
@phrase[:consumable] = "消耗品"
@phrase[:base_damage] = "基本伤害"
#------------------#
# 特殊效果語句 #
#------------------#
@phrase[:special] = "特殊"
@phrase[:two_handed] = "两手武器"
@phrase[:fast_attack] = "回合内先制"
@phrase[:dual_attack] = "连续攻击"
@phrase[:critical_bonus] = "会心频发"
@phrase[:prevent_critical] = "会心防止"
@phrase[:half_mp_cost] = "消费MP半分"
@phrase[:double_exp_gain] = "取得经验值2倍"
@phrase[:auto_hp_recover] = "HP自动回复"
@phrase[:physical_attack] = "物理攻击"
@phrase[:damage_to_mp] = "MP伤害"
@phrase[:absorb_damage] = "伤害吸收"
@phrase[:ignore_defense] = "无视防御"
#------------------#
# 技能描述語句 #
#------------------#
@phrase[:recovery] = "回复力"
@phrase[:mp_cost] = "消耗SP"
@phrase[:hit] = "命中率"
#------------------#
# 效果範圍語句 #
#------------------#
@phrase[:scope] = "効果范围"
@scope[0] = "特殊"
@scope[1] = "敌单体"
@scope[2] = "敌全体"
@scope[3] = "敌単体 连续"
@scope[4] = "敌単体 随机"
@scope[5] = "敌二体 随机"
@scope[6] = "敌三体 随机"
@scope[7] = "我方单体"
@scope[8] = "我方全体"
@scope[9] = "我方战斗不能(单)"
@scope[10] = "我方战斗不能(全)"
@scope[11] = "使用者"
#------------------#
# 效果範圍語句 #
#------------------#
@parameter_type[1] = "MaxHP"
@parameter_type[2] = "MaxMP"
@parameter_type[3] = $data_system.terms.atk
@parameter_type[4] = $data_system.terms.def
@parameter_type[5] = $data_system.terms.spi
@parameter_type[6] = $data_system.terms.agi
end
#--------------------------------------------------------------------------
# ● 初始化對象
#--------------------------------------------------------------------------
def initialize
super(0, 0, 544, WLH + 32)
self.opacity = 200
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)
draw_string(data,align)
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
set
draw_data(data)
else
return
end
end
#--------------------------------------------------------------------------
# ● 更新帮助窗口
#--------------------------------------------------------------------------
def draw_string(data,align)
self.width = 544 #修正寬度
self.height = WLH + 32 #修正高度
self.x=0 #修正 x 坐標
self.y=0 #修正 y 坐標
@text = data #記錄文本資料
@align = align #記錄對齊方式
@actor = nil #清空角色資料
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)
self.visible = true
end
#--------------------------------------------------------------------------
# ● 更新帮助窗口
#--------------------------------------------------------------------------
def draw_data(data=@data)
self.width = 186 #修正寬度
self.height = 430 #修正高度
self.x=0 #修正 x 坐標
self.y=150 #修正 y 坐標
@data = data #記錄 data 資料
case @data
when RPG::Item
set_item_text(@data)
when RPG::Weapon, RPG::Armor
set_equipment_text(@data)
when RPG::Skill
set_skill_text(@data)
end
end
#--------------------------------------------------------------------------
# ● 修正窗口位置
#--------------------------------------------------------------------------
def set_pos(x,y,width,oy,index,column_max)
cursor_width = width / column_max - 32
xx = index % column_max * (cursor_width + WLH)
yy = index / column_max * WLH - oy
self.x=xx+x+140
self.y=yy+y+35
if self.x+self.width>544
self.x=544-self.width
end
if self.y+self.height>416
self.y=416-self.height
end
end
#------------------------------------------------------------------------
# ● 文字描繪
#------------------------------------------------------------------------
def draw_text(text, increase, move=0)
@y += increase
self.contents.font.color = normal_color
self.contents.font.size = @size
self.contents.draw_text(0+move, @y*@size+5, text.size*6, @size, text, 0)
end
#-------------------------------------#
# 子方法
#-------------------------------------#
#--------------------------------------------------------------------------
# ● 裝備幫助窗口
#--------------------------------------------------------------------------
def set_equipment_text(equipment)
#------------------------------------------------------------------------
# ● 取得基本質料
#------------------------------------------------------------------------
#----------------------------#
# 取得屬性、狀態、說明之副本 #
#----------------------------#
element_set = equipment.element_set.clone
state_set = equipment.state_set.clone
description = equipment.description.clone
phrase = @phrase
#----------------------------#
# 過濾不顯示的屬性與狀態描述 #
#----------------------------#
element_set -= @unshow_elements
state_set -= @unshow_states
#----------------#
# 初始化數據設定 #
#----------------#
x, h, move = 0, 0, 0
#------------------#
# 取得特殊效果數據 #
#------------------#
special = []
case equipment
when RPG::Weapon
special << phrase[:two_handed] if equipment.two_handed
special << phrase[:fast_attack] if equipment.fast_attack
special << phrase[:dual_attack] if equipment.dual_attack
special << phrase[:critical_bonus] if equipment.critical_bonus
when RPG::Armor
special << phrase[:prevent_critical]if equipment.prevent_critical
special << phrase[:half_mp_cost] if equipment.half_mp_cost
special << phrase[:double_exp_gain] if equipment.double_exp_gain
special << phrase[:auto_hp_recover] if equipment.auto_hp_recover
end
#------------------------------------------------------------------------
# ● 確定背景圖片的高度
#------------------------------------------------------------------------
h += (description.size/3/@word)
h += 1 if (description.size/3%@word) > 0
now_h = h
h += 1 #價格
h += 1 unless equipment.atk.zero? #攻擊力
h += 1 unless equipment.def.zero? #防禦力
h += 1 unless equipment.spi.zero? #精神力
h += 1 unless equipment.agi.zero? #敏捷力
h += 1 unless equipment.nodur ## 耐久度
h += element_set.size + 1 if element_set.size > 0 #屬性
h += state_set.size + 1 if state_set.size > 0 #狀態
h += special.size + 1 if special.size > 0 #特殊效果
#------------------------------------------------------------------------
# ● 圖片顯示保證高度
#------------------------------------------------------------------------
#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)
if x == @word
x=0
@y+=1
end
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
end
#------------------------------------------------------------------------
# ● 圖標描繪
#------------------------------------------------------------------------
#bitmap = Cache.system("Iconset")
#rect = Rect.new(equipment.icon_index % 16 * 24, equipment.icon_index / 16 * 24, 24, 24)
#self.contents.blt(0, y*size + 20, bitmap, rect, 255)
#------------------------------------------------------------------------
# ● 價格描繪
#------------------------------------------------------------------------
unless equipment.price.zero?
text = phrase[:price] + ":" + equipment.price.to_s
draw_text(text, 1, move)
end
#------------------------------------------------------------------------
# ● 攻擊力
#------------------------------------------------------------------------
unless equipment.atk.zero?
text = $data_system.terms.atk + ":" + equipment.atk.to_s
draw_text(text, 1, move)
end
#------------------------------------------------------------------------
# ● 防禦力
#------------------------------------------------------------------------
unless equipment.def.zero?
text = $data_system.terms.def + ":" + equipment.def.to_s
draw_text(text, 1, move)
end
#------------------------------------------------------------------------
# ● 精神力
#------------------------------------------------------------------------
unless equipment.spi.zero?
text = $data_system.terms.spi + ":" + equipment.spi.to_s
draw_text(text, 1, move)
end
#------------------------------------------------------------------------
# ● 敏捷力
#------------------------------------------------------------------------
unless equipment.agi.zero?
text = $data_system.terms.agi + ":" + equipment.agi.to_s
draw_text(text, 1, move)
end
#------------------------------------------------------------------------
# ● 屬性
#------------------------------------------------------------------------
if element_set.size > 0
case equipment
when RPG::Weapon
text=phrase[:elements]+":"
when RPG::Armor
text=phrase[:guard_elements]+":"
end
draw_text(text, 1, move)
element_set.each do |i|
text = $data_system.elements[i]
draw_text(text, 1, move + @size)
end
end
#------------------------------------------------------------------------
# ** 耐久度
#------------------------------------------------------------------------
unless equipment.nodur
unless equipment.indesctructible
text = "耐久度: #{equipment.dur} / #{equipment.maxdur}"
else
text = "耐久度:无法破坏"
end
draw_text(text, 1, move)
end
#------------------------------------------------------------------------
# ● 狀態
#------------------------------------------------------------------------
if state_set.size > 0
case equipment
when RPG::Weapon
text=phrase[:states]+":"
when RPG::Armor
text=phrase[:guard_states]+":"
end
draw_text(text, 1, move)
state_set.each do |i|
text = $data_states[i].name
draw_text(text, 1, move + @size)
end
end
#------------------------------------------------------------------------
# ● 特殊效果
#------------------------------------------------------------------------
if special.size > 0
text = phrase[:special]+":"
draw_text(text, 1, move)
special.each {|text| draw_text(text, 1, move + @size)}
end
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, h, move = 0, 0, 0
phrase = @phrase
scope = @scope
parameter_type = @parameter_type
occasion = @occasion
# 基本文字設定
#------------------#
# 取得特殊效果數據 #
#------------------#
special = []
special << phrase[:physical_attack] if item.physical_attack #物理攻撃
special << phrase[:damage_to_mp] if item.damage_to_mp #MPにダメージ
special << phrase[:absorb_damage] if item.absorb_damage #ダメージを吸収
special << phrase[:ignore_defense] if item.ignore_defense #防御力無視
#------------------------------------------------------------------------
# ● 確定背景圖片的高度
#------------------------------------------------------------------------
h += (description.size/3/@word)
h += 1 if (description.size/3%@word) > 0
now_h = h
h += 2 #効果範囲,價格
h += 1 if item.consumable #消耗品
h += 1 unless item.speed.zero? #速度補正値
h += 1 unless item.hp_recovery_rate==0 and item.hp_recovery==0 #HP 回復
h += 1 unless item.mp_recovery_rate==0 and item.mp_recovery==0 #MP 回復
h += 1 unless item.parameter_type.zero? #能力値
h += 1 unless item.base_damage.zero? #基本ダメージ
h += element_set.size + 1 if element_set.size > 0 #屬性
h += plus_state_set.size + 1 if plus_state_set.size > 0 #附加狀態
h += minus_state_set.size + 1 if minus_state_set.size > 0 #解除狀態
h += special.size + 1 if special.size > 0 #特殊效果
#------------------------------------------------------------------------
# ● 圖片顯示保證高度
#------------------------------------------------------------------------
##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)
if x == @word
x = 0
@y += 1
end
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
end
#------------------------------------------------------------------------
# ● 圖標描繪
#------------------------------------------------------------------------
#bitmap = Cache.system("Iconset")
#rect = Rect.new(item.icon_index % 16 * 24, equipment.icon_index / 16 * 24, 24, 24)
#self.contents.blt(0, y*size + 20, bitmap, rect, 255)
#------------------------------------------------------------------------
# ● 效果範圍
#------------------------------------------------------------------------
text = phrase[:scope] +":"
draw_text(text, 1, move)
text = scope[item.scope]
draw_text(text, 1, move + @size)
#------------------------------------------------------------------------
# ● 價格
#------------------------------------------------------------------------
text = phrase[:price] + item.price.to_s
draw_text(text, 1, move)
#------------------------------------------------------------------------
# ● 消耗品
#------------------------------------------------------------------------
if item.consumable
text = phrase[:consumable]
draw_text(text, 1, move)
end
#------------------------------------------------------------------------
# ● 速度補正値
#------------------------------------------------------------------------
unless item.speed.zero?
text = phrase[:speed]
draw_text(text, 1, move)
end
#------------------------------------------------------------------------
# ● HP回復
#------------------------------------------------------------------------
unless item.hp_recovery_rate.zero? and item.hp_recovery.zero?
if item.hp_recovery_rate > 0 and item.hp_recovery > 0
text = " + "
else
text = ""
end
unless item.hp_recovery_rate.zero?
text = item.hp_recovery_rate.to_s + "%" + text
end
unless item.hp_recovery.zero?
text += item.hp_recovery.to_s
end
text = phrase[:recover] +":" + phrase[:hp] + text
draw_text(text, 1, move)
end
#------------------------------------------------------------------------
# ● SP回復
#------------------------------------------------------------------------
unless item.mp_recovery_rate.zero? and item.mp_recovery.zero?
if item.mp_recovery_rate > 0 and item.mp_recovery > 0
text = " + "
else
text = ""
end
unless item.mp_recovery_rate.zero?
text = item.mp_recovery_rate.to_s + "%" + text
end
unless item.mp_recovery.zero?
text += item.mp_recovery.to_s
end
text = phrase[:recover] +":" + phrase[:mp] + text
draw_text(text, 1, move)
end
#------------------------------------------------------------------------
# ● 能力值增加
#------------------------------------------------------------------------
unless item.parameter_type.zero?
text= parameter_type[item.parameter_type]+" +"+item.parameter_points.to_s
draw_text(text, 1, move)
end
#------------------------------------------------------------------------
# ● 基本ダメージ
#------------------------------------------------------------------------
unless item.base_damage.zero?
text = phrase[:base_damage] +":" + item.base_damage.to_s
draw_text(text, 1, move)
end
#------------------------------------------------------------------------
# ● 屬性
#------------------------------------------------------------------------
if element_set.size > 0
text = phrase[:elements]+":"
draw_text(text, 1, move)
element_set.each do |i|
text = $data_system.elements[i]
draw_text(text, 1, move + @size)
end
end
#------------------------------------------------------------------------
# ● 添加狀態
#------------------------------------------------------------------------
unless plus_state_set.empty?
text = phrase[:plus_states]+":"
draw_text(text, 1, move)
plus_state_set.each do |i|
text = $data_states[i].name
draw_text(text, 1, move + @size)
end
end
#------------------------------------------------------------------------
# ● 解除狀態
#------------------------------------------------------------------------
unless minus_state_set.empty?
text = phrase[:minus_states]+":"
draw_text(text, 1, move)
minus_state_set.each do |i|
text = $data_states[i].name
draw_text(text, 1, move + @size)
end
end
#------------------------------------------------------------------------
# ● 特殊效果
#------------------------------------------------------------------------
if special.size > 0
text = phrase[:special]+":"
draw_text(text, 1, move)
special.each {|text| draw_text(text, 1, move + @size)}
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 ,h, move = 0, 0, 0
phrase = @phrase
scope = @scope
#------------------#
# 取得特殊效果數據 #
#------------------#
special = []
special << phrase[:physical_attack] if skill.physical_attack #物理攻撃
special << phrase[:damage_to_mp] if skill.damage_to_mp #MPにダメージ
special << phrase[:absorb_damage] if skill.absorb_damage #ダメージを吸収
special << phrase[:ignore_defense] if skill.ignore_defense #防御力無視
#------------------------------------------------------------------------
# ● 確定背景圖片的高度
#------------------------------------------------------------------------
h += (description.size/3/@word)
h += 1 if (description.size/3%@word) > 0
now_h = h
h += 4 #効果範囲,消費MP,命中率
h += 1 unless skill.speed.zero? #速度補正値
h += 1 unless skill.base_damage.zero? #基本ダメージ
h += element_set.size + 1 if element_set.size > 0 #屬性
h += plus_state_set.size + 1 if plus_state_set.size > 0 #附加狀態
h += minus_state_set.size + 1 if minus_state_set.size > 0 #解除狀態
h += special.size + 1 if special.size > 0 #特殊效果
#------------------------------------------------------------------------
# ● 換算高度
#------------------------------------------------------------------------
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)
if x==@word
x = 0
@y += 1
end
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
end
#------------------------------------------------------------------------
# ● 攻擊範圍
#------------------------------------------------------------------------
text = phrase[:scope] +":"
draw_text(text, 1, move)
text = scope[skill.scope]
draw_text(text, 1, move + @size)
#------------------------------------------------------------------------
# ● 基本ダメージ
#------------------------------------------------------------------------
unless skill.base_damage .zero?
text = skill.base_damage > 0 ? phrase[:base_damage] : phrase[:recovery]
text += ":" + skill.base_damage.abs.to_s
draw_text(text, 1, move)
end
#------------------------------------------------------------------------
# ● 消費SP描述
#------------------------------------------------------------------------
text = phrase[:mp_cost] +":"+ skill.mp_cost.to_s
draw_text(text, 1, move)
#------------------------------------------------------------------------
# ● 命中率描述
#------------------------------------------------------------------------
text = phrase[:hit] + ":" + skill.hit.to_s + "%"
draw_text(text, 1, move)
#------------------------------------------------------------------------
# ● 屬性
#------------------------------------------------------------------------
if element_set.size > 0
text = phrase[:elements]+":"
draw_text(text, 1, move)
element_set.each do |i|
text = $data_system.elements[i]
draw_text(text, 1, move + @size)
end
end
#------------------------------------------------------------------------
# ● 添加狀態
#------------------------------------------------------------------------
unless plus_state_set.empty?
text = phrase[:plus_states]+":"
draw_text(text, 1, move)
plus_state_set.each do |i|
text = $data_states[i].name
draw_text(text, 1, move + @size)
end
end
#------------------------------------------------------------------------
# ● 解除狀態
#------------------------------------------------------------------------
unless minus_state_set.empty?
text = phrase[:minus_states]+":"
draw_text(text, 1, move)
minus_state_set.each do |i|
text = $data_states[i].name
draw_text(text, 1, move + @size)
end
end
#------------------------------------------------------------------------
# ● 特殊效果
#------------------------------------------------------------------------
if special.size > 0
text = phrase[:special]+":"
draw_text(text, 1, move)
special.each {|text| draw_text(text, 1, move + @size)}
end
end
end
#==============================================================================
# ■ Window_Item
#------------------------------------------------------------------------------
# アイテム画面などで、所持アイテムの一覧を表示するウィンドウです。
#==============================================================================
class Window_Item < Window_Selectable
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
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
#------------------------------------------------------------------------------
# スキル画面などで、使用できるスキルの一覧を表示するウィンドウです。
#==============================================================================
class Window_Skill < Window_Selectable
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(skill)
#修正窗口位置
@help_window.set_pos(self.x,self.y,self.width,self.oy,self.index,@column_max)
end
end
#==============================================================================
# ■ Window_Equip
#------------------------------------------------------------------------------
# 装備画面で、アクターが現在装備しているアイテムを表示するウィンドウです。
#==============================================================================
class Window_Equip < Window_Selectable
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
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_ShopBuy
#------------------------------------------------------------------------------
# ショップ画面で、購入できる商品の一覧を表示するウィンドウです。
#==============================================================================
class Window_ShopBuy < Window_Selectable
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
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
复制代码
等级限制脚本:
============================================================================
# BY drgdrg (感谢snstar2006提供的提取[]内容代码)
#定义装备等级限制方法:在数据库装备备注里写上[LV n] ,LV后有空格,n为等级,
#同理,定义装备能力值限制方法:备注里写上[ATK n][DEF n][SPI n][AGI n]。
#若某项限制不写则没有装备限制。
#注意这里限制的能力值是人物原始的能力值,不考虑装备、状态的影响,
#但是考虑事件对能力值的影响。
#==============================================================================
#==============================================================================
# ■ RPG::BaseItem
#==============================================================================
class RPG::BaseItem
def LVlimit #物品要求最低等级
m = 0
self.note.split(/[\r\n]+/).each { |line|
m = $1.to_i if line =~ /\[LV (\d+)\]/
}
return m
end
def ATKlimit #物品要求最低个人攻击力
m = 0
self.note.split(/[\r\n]+/).each { |line|
m = $1.to_i if line =~ /\[ATK (\d+)\]/
}
return m
end
def DEFlimit #物品要求最低个人防御力
m = 0
self.note.split(/[\r\n]+/).each { |line|
m = $1.to_i if line =~ /\[DEF (\d+)\]/
}
return m
end
def SPIlimit #物品要求最低个人精神力
m = 0
self.note.split(/[\r\n]+/).each { |line|
m = $1.to_i if line =~ /\[SPI (\d+)\]/
}
return m
end
def AGIlimit #物品要求最低个人敏捷性
m = 0
self.note.split(/[\r\n]+/).each { |line|
m = $1.to_i if line =~ /\[AGI (\d+)\]/
}
return m
end
end
#==============================================================================
# ■ Game_Actor
#------------------------------------------------------------------------------
# 处理角色的类。本类在 Game_Actors 类 ($game_actors)
# 的内部使用、Game_Party 类请参考 ($game_party) 。
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● 判断是否可以装备
# item : 物品
#--------------------------------------------------------------------------
def equippable?(item)
return false if self.level < item.LVlimit #等级限制
return false if actor.parameters[2, @level] + @atk_plus < item.ATKlimit #攻击力限制
return false if actor.parameters[3, @level] + @def_plus < item.DEFlimit #防御力限制
return false if actor.parameters[4, @level] + @spi_plus < item.SPIlimit #精神力限制
return false if actor.parameters[5, @level] + @agi_plus < item.AGIlimit #敏捷性限制
if item.is_a?(RPG::Weapon)
return self.class.weapon_set.include?(item.id)
elsif item.is_a?(RPG::Armor)
return false if two_swords_style and item.kind == 0
return self.class.armor_set.include?(item.id)
end
return false
end
end
#==============================================================================
# ■ Window_Item
#------------------------------------------------------------------------------
# 物品画面、战斗画面、显示浏览物品的窗口。
#==============================================================================
class Window_Item < Window_Selectable
#--------------------------------------------------------------------------
# ● 更新帮助文本(自动显示使用物品的等级能力限制)
#--------------------------------------------------------------------------
def update_help
if item != nil
newdes = item.description
newdes += " 要求:" if(item.LVlimit !=0 or item.ATKlimit !=0 or item.DEFlimit != 0 or item.SPIlimit != 0 or item.AGIlimit != 0)
newdes += " LV" + item.LVlimit.to_s if item.LVlimit != 0
newdes += " 攻" + item.ATKlimit.to_s if item.ATKlimit != 0
newdes += " 防" + item.DEFlimit.to_s if item.DEFlimit != 0
newdes += " 精" + item.SPIlimit.to_s if item.SPIlimit != 0
newdes += " 敏" + item.AGIlimit.to_s if item.AGIlimit != 0
@help_window.set_text(newdes)
else
@help_window.set_text("")
end
end
end
复制代码
因为如果不把等级限制的显示添加到详情帮助里就会出现这样的事情很难看:
[attach]76535[/attach][attach]76534[/attach]
前面或许没什么问题但是装备后会转到详情帮助的显示状态而且没有显示等级限制了
[attach]76537[/attach]
这道还可以接受但是当武器装备完再卸下再装备的时候问题出现了:
[attach]76536[/attach]
所以请问怎么把武器等级限制脚本的等级限制显示移植到详情帮助里显示 dsu_plus_rewardpost_czw
有求必应于2011-8-25 12:26补充以下内容:
图片怎么没出来?
有求必应于2011-8-25 12:34补充以下内容:
[attachimg]76540[/attachimg]
[attachimg]76539[/attachimg]
[attachimg]76538[/attachimg]
[attachimg]76541[/attachimg]
有求必应于2011-8-25 12:34补充以下内容:
{:4_132:}{:4_132:}{:4_132:}怎么没有图片啊?我上传了啊
作者:
feizhaodan
时间:
2011-8-25 13:35
额,刷新了两次确定不是我网络不行后,我吐:
你不给那个详情帮助和装备武器等级限制给我让我做什么!!!!!!!
作者:
昔日辉煌灬
时间:
2011-8-25 13:40
表示你什么都不写会被干掉的
脚本的话这里:
#=====================================================================
# 装备限制 兼容 物品分类 补丁 by DRG
#=====================================================================
class Window_Item < Window_Selectable
def update_help
if item != nil
newdes = item.description
newdes += " 要求:" if(item.LVlimit !=0 or item.ATKlimit !=0 or item.DEFlimit != 0 or item.SPIlimit != 0 or item.AGIlimit != 0)
newdes += " LV" + item.LVlimit.to_s if item.LVlimit != 0
newdes += " 攻" + item.ATKlimit.to_s if item.ATKlimit != 0
newdes += " 防" + item.DEFlimit.to_s if item.DEFlimit != 0
newdes += " 精" + item.SPIlimit.to_s if item.SPIlimit != 0
newdes += " 敏" + item.AGIlimit.to_s if item.AGIlimit != 0
@help_window.set_text(newdes)
end
end
end
复制代码
#=====================================================================
# 装备物品限制 兼容 物品分类 补丁 by DRG
#=====================================================================
class Window_Item < Window_Selectable
def update_help
if item != nil
newdes = item.description
if(item.LVlimit !=0 or item.ATKlimit !=0 or item.DEFlimit != 0 or item.SPIlimit != 0 or item.AGIlimit != 0)
newdes += " 要求"
case item.LimitType
when 0
newdes += "使用者:"
when 1
newdes += "使用目标:"
when 2
newdes += "使用者和目标:"
end
newdes += " LV" + item.LVlimit.to_s if item.LVlimit != 0
newdes += " 攻" + item.ATKlimit.to_s if item.ATKlimit != 0
newdes += " 防" + item.DEFlimit.to_s if item.DEFlimit != 0
newdes += " 精" + item.SPIlimit.to_s if item.SPIlimit != 0
newdes += " 敏" + item.AGIlimit.to_s if item.AGIlimit != 0
end
@help_window.set_text(newdes)
else
@help_window.set_text("")
end
end
end
复制代码
作者:
有求必应
时间:
2011-8-25 15:39
本帖最后由 有求必应 于 2011-8-25 16:37 编辑
我说的是这两个脚本显示的帮助能显示在一起(就是把武器限制的要求LV xx 显示在详情帮助脚本的小框框里不要上面那个长条了):
#============================================================================
# BY drgdrg (感谢snstar2006提供的提取[]内容代码)
#定义装备等级限制方法:在数据库装备备注里写上[LV n] ,LV后有空格,n为等级,
#同理,定义装备能力值限制方法:备注里写上[ATK n][DEF n][SPI n][AGI n]。
#若某项限制不写则没有装备限制。
#注意这里限制的能力值是人物原始的能力值,不考虑装备、状态的影响,
#但是考虑事件对能力值的影响。
#==============================================================================
#==============================================================================
# ■ RPG::BaseItem
#==============================================================================
class RPG::BaseItem
def LVlimit #物品要求最低等级
m = 0
self.note.split(/[\r\n]+/).each { |line|
m = $1.to_i if line =~ /\[LV (\d+)\]/
}
return m
end
def ATKlimit #物品要求最低个人攻击力
m = 0
self.note.split(/[\r\n]+/).each { |line|
m = $1.to_i if line =~ /\[ATK (\d+)\]/
}
return m
end
def DEFlimit #物品要求最低个人防御力
m = 0
self.note.split(/[\r\n]+/).each { |line|
m = $1.to_i if line =~ /\[DEF (\d+)\]/
}
return m
end
def SPIlimit #物品要求最低个人精神力
m = 0
self.note.split(/[\r\n]+/).each { |line|
m = $1.to_i if line =~ /\[SPI (\d+)\]/
}
return m
end
def AGIlimit #物品要求最低个人敏捷性
m = 0
self.note.split(/[\r\n]+/).each { |line|
m = $1.to_i if line =~ /\[AGI (\d+)\]/
}
return m
end
end
#==============================================================================
# ■ Game_Actor
#------------------------------------------------------------------------------
# 处理角色的类。本类在 Game_Actors 类 ($game_actors)
# 的内部使用、Game_Party 类请参考 ($game_party) 。
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● 判断是否可以装备
# item : 物品
#--------------------------------------------------------------------------
def equippable?(item)
return false if self.level < item.LVlimit #等级限制
return false if actor.parameters[2, @level] + @atk_plus < item.ATKlimit #攻击力限制
return false if actor.parameters[3, @level] + @def_plus < item.DEFlimit #防御力限制
return false if actor.parameters[4, @level] + @spi_plus < item.SPIlimit #精神力限制
return false if actor.parameters[5, @level] + @agi_plus < item.AGIlimit #敏捷性限制
if item.is_a?(RPG::Weapon)
return self.class.weapon_set.include?(item.id)
elsif item.is_a?(RPG::Armor)
return false if two_swords_style and item.kind == 0
return self.class.armor_set.include?(item.id)
end
return false
end
end
#==============================================================================
# ■ Window_Item
#------------------------------------------------------------------------------
# 物品画面、战斗画面、显示浏览物品的窗口。
#==============================================================================
class Window_Item < Window_Selectable
#--------------------------------------------------------------------------
# ● 更新帮助文本(自动显示使用物品的等级能力限制)
#--------------------------------------------------------------------------
def update_help
if item != nil
newdes = item.description
newdes += " 要求:" if(item.LVlimit !=0 or item.ATKlimit !=0 or item.DEFlimit != 0 or item.SPIlimit != 0 or item.AGIlimit != 0)
newdes += " LV" + item.LVlimit.to_s if item.LVlimit != 0
newdes += " 攻" + item.ATKlimit.to_s if item.ATKlimit != 0
newdes += " 防" + item.DEFlimit.to_s if item.DEFlimit != 0
newdes += " 精" + item.SPIlimit.to_s if item.SPIlimit != 0
newdes += " 敏" + item.AGIlimit.to_s if item.AGIlimit != 0
@help_window.set_text(newdes)
else
@help_window.set_text("")
end
end
end
复制代码
#==============================================================================
# ■ Window_Help
#------------------------------------------------------------------------------
# 原作:xuelong
# 修正:水迭澜
# 移植:禾西
#==============================================================================
class Window_Help < Window_Base
#--------------------------------------------------------------------------
# ● 定義
#--------------------------------------------------------------------------
def set
@phrase,@y= {}, 0
@scope, @parameter_type = [], []
=begin
@name_size = 名字文字大小
@size = 描述文字大小
@word = 每行的描述文字數
=end
@name_size = 18
@size = 14
@word = 11
# 不顯示的 屬性 與 狀態 ID
@unshow_elements = [17, 18]
@unshow_states = []
# 基本文字設定
@phrase[:price] = "价格"
@phrase[:elements] = "攻击属性"
@phrase[:states] = "复交状态"
@phrase[:guard_elements] = "减半状态"
@phrase[:guard_states] = "无效化状态"
#------------------#
# 物品效果語句 #
#------------------#
@phrase[:recover] = "回复"
@phrase[:hp] = "HP"
@phrase[:mp] = "MP"
@phrase[:plus_states] = "状态附加"
@phrase[:minus_states] = "状态解除"
@phrase[:speed] = "速度補正"
@phrase[:consumable] = "消耗品"
@phrase[:base_damage] = "基本伤害"
#------------------#
# 特殊效果語句 #
#------------------#
@phrase[:special] = "特殊"
@phrase[:two_handed] = "两手武器"
@phrase[:fast_attack] = "回合内先制"
@phrase[:dual_attack] = "连续攻击"
@phrase[:critical_bonus] = "会心频发"
@phrase[:prevent_critical] = "会心防止"
@phrase[:half_mp_cost] = "消费MP半分"
@phrase[:double_exp_gain] = "取得经验值2倍"
@phrase[:auto_hp_recover] = "HP自动回复"
@phrase[:physical_attack] = "物理攻击"
@phrase[:damage_to_mp] = "MP伤害"
@phrase[:absorb_damage] = "伤害吸收"
@phrase[:ignore_defense] = "无视防御"
#------------------#
# 技能描述語句 #
#------------------#
@phrase[:recovery] = "回复力"
@phrase[:mp_cost] = "消耗SP"
@phrase[:hit] = "命中率"
#------------------#
# 效果範圍語句 #
#------------------#
@phrase[:scope] = "効果范围"
@scope[0] = "特殊"
@scope[1] = "敌单体"
@scope[2] = "敌全体"
@scope[3] = "敌単体 连续"
@scope[4] = "敌単体 随机"
@scope[5] = "敌二体 随机"
@scope[6] = "敌三体 随机"
@scope[7] = "我方单体"
@scope[8] = "我方全体"
@scope[9] = "我方战斗不能(单)"
@scope[10] = "我方战斗不能(全)"
@scope[11] = "使用者"
#------------------#
# 效果範圍語句 #
#------------------#
@parameter_type[1] = "MaxHP"
@parameter_type[2] = "MaxMP"
@parameter_type[3] = $data_system.terms.atk
@parameter_type[4] = $data_system.terms.def
@parameter_type[5] = $data_system.terms.spi
@parameter_type[6] = $data_system.terms.agi
end
#--------------------------------------------------------------------------
# ● 初始化對象
#--------------------------------------------------------------------------
def initialize
super(0, 0, 544, WLH + 32)
self.opacity = 200
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)
draw_string(data,align)
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
set
draw_data(data)
else
return
end
end
#--------------------------------------------------------------------------
# ● 更新帮助窗口
#--------------------------------------------------------------------------
def draw_string(data,align)
self.width = 544 #修正寬度
self.height = WLH + 32 #修正高度
self.x=0 #修正 x 坐標
self.y=0 #修正 y 坐標
@text = data #記錄文本資料
@align = align #記錄對齊方式
@actor = nil #清空角色資料
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)
self.visible = true
end
#--------------------------------------------------------------------------
# ● 更新帮助窗口
#--------------------------------------------------------------------------
def draw_data(data=@data)
self.width = 186 #修正寬度
self.height = 430 #修正高度
self.x=0 #修正 x 坐標
self.y=150 #修正 y 坐標
@data = data #記錄 data 資料
case @data
when RPG::Item
set_item_text(@data)
when RPG::Weapon, RPG::Armor
set_equipment_text(@data)
when RPG::Skill
set_skill_text(@data)
end
end
#--------------------------------------------------------------------------
# ● 修正窗口位置
#--------------------------------------------------------------------------
def set_pos(x,y,width,oy,index,column_max)
cursor_width = width / column_max - 32
xx = index % column_max * (cursor_width + WLH)
yy = index / column_max * WLH - oy
self.x=xx+x+140
self.y=yy+y+35
if self.x+self.width>544
self.x=544-self.width
end
if self.y+self.height>416
self.y=416-self.height
end
end
#------------------------------------------------------------------------
# ● 文字描繪
#------------------------------------------------------------------------
def draw_text(text, increase, move=0)
@y += increase
self.contents.font.color = normal_color
self.contents.font.size = @size
self.contents.draw_text(0+move, @y*@size+5, text.size*6, @size, text, 0)
end
#-------------------------------------#
# 子方法
#-------------------------------------#
#--------------------------------------------------------------------------
# ● 裝備幫助窗口
#--------------------------------------------------------------------------
def set_equipment_text(equipment)
#------------------------------------------------------------------------
# ● 取得基本質料
#------------------------------------------------------------------------
#----------------------------#
# 取得屬性、狀態、說明之副本 #
#----------------------------#
element_set = equipment.element_set.clone
state_set = equipment.state_set.clone
description = equipment.description.clone
phrase = @phrase
#----------------------------#
# 過濾不顯示的屬性與狀態描述 #
#----------------------------#
element_set -= @unshow_elements
state_set -= @unshow_states
#----------------#
# 初始化數據設定 #
#----------------#
x, h, move = 0, 0, 0
#------------------#
# 取得特殊效果數據 #
#------------------#
special = []
case equipment
when RPG::Weapon
special << phrase[:two_handed] if equipment.two_handed
special << phrase[:fast_attack] if equipment.fast_attack
special << phrase[:dual_attack] if equipment.dual_attack
special << phrase[:critical_bonus] if equipment.critical_bonus
when RPG::Armor
special << phrase[:prevent_critical]if equipment.prevent_critical
special << phrase[:half_mp_cost] if equipment.half_mp_cost
special << phrase[:double_exp_gain] if equipment.double_exp_gain
special << phrase[:auto_hp_recover] if equipment.auto_hp_recover
end
#------------------------------------------------------------------------
# ● 確定背景圖片的高度
#------------------------------------------------------------------------
h += (description.size/3/@word)
h += 1 if (description.size/3%@word) > 0
now_h = h
h += 1 #價格
h += 1 unless equipment.atk.zero? #攻擊力
h += 1 unless equipment.def.zero? #防禦力
h += 1 unless equipment.spi.zero? #精神力
h += 1 unless equipment.agi.zero? #敏捷力
h += 1 unless equipment.nodur ## 耐久度
h += element_set.size + 1 if element_set.size > 0 #屬性
h += state_set.size + 1 if state_set.size > 0 #狀態
h += special.size + 1 if special.size > 0 #特殊效果
#------------------------------------------------------------------------
# ● 圖片顯示保證高度
#------------------------------------------------------------------------
#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)
if x == @word
x=0
@y+=1
end
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
end
#------------------------------------------------------------------------
# ● 圖標描繪
#------------------------------------------------------------------------
#bitmap = Cache.system("Iconset")
#rect = Rect.new(equipment.icon_index % 16 * 24, equipment.icon_index / 16 * 24, 24, 24)
#self.contents.blt(0, y*size + 20, bitmap, rect, 255)
#------------------------------------------------------------------------
# ● 價格描繪
#------------------------------------------------------------------------
unless equipment.price.zero?
text = phrase[:price] + ":" + equipment.price.to_s
draw_text(text, 1, move)
end
#------------------------------------------------------------------------
# ● 攻擊力
#------------------------------------------------------------------------
unless equipment.atk.zero?
text = $data_system.terms.atk + ":" + equipment.atk.to_s
draw_text(text, 1, move)
end
#------------------------------------------------------------------------
# ● 防禦力
#------------------------------------------------------------------------
unless equipment.def.zero?
text = $data_system.terms.def + ":" + equipment.def.to_s
draw_text(text, 1, move)
end
#------------------------------------------------------------------------
# ● 精神力
#------------------------------------------------------------------------
unless equipment.spi.zero?
text = $data_system.terms.spi + ":" + equipment.spi.to_s
draw_text(text, 1, move)
end
#------------------------------------------------------------------------
# ● 敏捷力
#------------------------------------------------------------------------
unless equipment.agi.zero?
text = $data_system.terms.agi + ":" + equipment.agi.to_s
draw_text(text, 1, move)
end
#------------------------------------------------------------------------
# ● 屬性
#------------------------------------------------------------------------
if element_set.size > 0
case equipment
when RPG::Weapon
text=phrase[:elements]+":"
when RPG::Armor
text=phrase[:guard_elements]+":"
end
draw_text(text, 1, move)
element_set.each do |i|
text = $data_system.elements[i]
draw_text(text, 1, move + @size)
end
end
#------------------------------------------------------------------------
# ** 耐久度
#------------------------------------------------------------------------
unless equipment.nodur
unless equipment.indesctructible
text = "耐久度: #{equipment.dur} / #{equipment.maxdur}"
else
text = "耐久度:无法破坏"
end
draw_text(text, 1, move)
end
#------------------------------------------------------------------------
# ● 狀態
#------------------------------------------------------------------------
if state_set.size > 0
case equipment
when RPG::Weapon
text=phrase[:states]+":"
when RPG::Armor
text=phrase[:guard_states]+":"
end
draw_text(text, 1, move)
state_set.each do |i|
text = $data_states[i].name
draw_text(text, 1, move + @size)
end
end
#------------------------------------------------------------------------
# ● 特殊效果
#------------------------------------------------------------------------
if special.size > 0
text = phrase[:special]+":"
draw_text(text, 1, move)
special.each {|text| draw_text(text, 1, move + @size)}
end
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, h, move = 0, 0, 0
phrase = @phrase
scope = @scope
parameter_type = @parameter_type
occasion = @occasion
# 基本文字設定
#------------------#
# 取得特殊效果數據 #
#------------------#
special = []
special << phrase[:physical_attack] if item.physical_attack #物理攻撃
special << phrase[:damage_to_mp] if item.damage_to_mp #MPにダメージ
special << phrase[:absorb_damage] if item.absorb_damage #ダメージを吸収
special << phrase[:ignore_defense] if item.ignore_defense #防御力無視
#------------------------------------------------------------------------
# ● 確定背景圖片的高度
#------------------------------------------------------------------------
h += (description.size/3/@word)
h += 1 if (description.size/3%@word) > 0
now_h = h
h += 2 #効果範囲,價格
h += 1 if item.consumable #消耗品
h += 1 unless item.speed.zero? #速度補正値
h += 1 unless item.hp_recovery_rate==0 and item.hp_recovery==0 #HP 回復
h += 1 unless item.mp_recovery_rate==0 and item.mp_recovery==0 #MP 回復
h += 1 unless item.parameter_type.zero? #能力値
h += 1 unless item.base_damage.zero? #基本ダメージ
h += element_set.size + 1 if element_set.size > 0 #屬性
h += plus_state_set.size + 1 if plus_state_set.size > 0 #附加狀態
h += minus_state_set.size + 1 if minus_state_set.size > 0 #解除狀態
h += special.size + 1 if special.size > 0 #特殊效果
#------------------------------------------------------------------------
# ● 圖片顯示保證高度
#------------------------------------------------------------------------
##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)
if x == @word
x = 0
@y += 1
end
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
end
#------------------------------------------------------------------------
# ● 圖標描繪
#------------------------------------------------------------------------
#bitmap = Cache.system("Iconset")
#rect = Rect.new(item.icon_index % 16 * 24, equipment.icon_index / 16 * 24, 24, 24)
#self.contents.blt(0, y*size + 20, bitmap, rect, 255)
#------------------------------------------------------------------------
# ● 效果範圍
#------------------------------------------------------------------------
text = phrase[:scope] +":"
draw_text(text, 1, move)
text = scope[item.scope]
draw_text(text, 1, move + @size)
#------------------------------------------------------------------------
# ● 價格
#------------------------------------------------------------------------
text = phrase[:price] + item.price.to_s
draw_text(text, 1, move)
#------------------------------------------------------------------------
# ● 消耗品
#------------------------------------------------------------------------
if item.consumable
text = phrase[:consumable]
draw_text(text, 1, move)
end
#------------------------------------------------------------------------
# ● 速度補正値
#------------------------------------------------------------------------
unless item.speed.zero?
text = phrase[:speed]
draw_text(text, 1, move)
end
#------------------------------------------------------------------------
# ● HP回復
#------------------------------------------------------------------------
unless item.hp_recovery_rate.zero? and item.hp_recovery.zero?
if item.hp_recovery_rate > 0 and item.hp_recovery > 0
text = " + "
else
text = ""
end
unless item.hp_recovery_rate.zero?
text = item.hp_recovery_rate.to_s + "%" + text
end
unless item.hp_recovery.zero?
text += item.hp_recovery.to_s
end
text = phrase[:recover] +":" + phrase[:hp] + text
draw_text(text, 1, move)
end
#------------------------------------------------------------------------
# ● SP回復
#------------------------------------------------------------------------
unless item.mp_recovery_rate.zero? and item.mp_recovery.zero?
if item.mp_recovery_rate > 0 and item.mp_recovery > 0
text = " + "
else
text = ""
end
unless item.mp_recovery_rate.zero?
text = item.mp_recovery_rate.to_s + "%" + text
end
unless item.mp_recovery.zero?
text += item.mp_recovery.to_s
end
text = phrase[:recover] +":" + phrase[:mp] + text
draw_text(text, 1, move)
end
#------------------------------------------------------------------------
# ● 能力值增加
#------------------------------------------------------------------------
unless item.parameter_type.zero?
text= parameter_type[item.parameter_type]+" +"+item.parameter_points.to_s
draw_text(text, 1, move)
end
#------------------------------------------------------------------------
# ● 基本ダメージ
#------------------------------------------------------------------------
unless item.base_damage.zero?
text = phrase[:base_damage] +":" + item.base_damage.to_s
draw_text(text, 1, move)
end
#------------------------------------------------------------------------
# ● 屬性
#------------------------------------------------------------------------
if element_set.size > 0
text = phrase[:elements]+":"
draw_text(text, 1, move)
element_set.each do |i|
text = $data_system.elements[i]
draw_text(text, 1, move + @size)
end
end
#------------------------------------------------------------------------
# ● 添加狀態
#------------------------------------------------------------------------
unless plus_state_set.empty?
text = phrase[:plus_states]+":"
draw_text(text, 1, move)
plus_state_set.each do |i|
text = $data_states[i].name
draw_text(text, 1, move + @size)
end
end
#------------------------------------------------------------------------
# ● 解除狀態
#------------------------------------------------------------------------
unless minus_state_set.empty?
text = phrase[:minus_states]+":"
draw_text(text, 1, move)
minus_state_set.each do |i|
text = $data_states[i].name
draw_text(text, 1, move + @size)
end
end
#------------------------------------------------------------------------
# ● 特殊效果
#------------------------------------------------------------------------
if special.size > 0
text = phrase[:special]+":"
draw_text(text, 1, move)
special.each {|text| draw_text(text, 1, move + @size)}
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 ,h, move = 0, 0, 0
phrase = @phrase
scope = @scope
#------------------#
# 取得特殊效果數據 #
#------------------#
special = []
special << phrase[:physical_attack] if skill.physical_attack #物理攻撃
special << phrase[:damage_to_mp] if skill.damage_to_mp #MPにダメージ
special << phrase[:absorb_damage] if skill.absorb_damage #ダメージを吸収
special << phrase[:ignore_defense] if skill.ignore_defense #防御力無視
#------------------------------------------------------------------------
# ● 確定背景圖片的高度
#------------------------------------------------------------------------
h += (description.size/3/@word)
h += 1 if (description.size/3%@word) > 0
now_h = h
h += 4 #効果範囲,消費MP,命中率
h += 1 unless skill.speed.zero? #速度補正値
h += 1 unless skill.base_damage.zero? #基本ダメージ
h += element_set.size + 1 if element_set.size > 0 #屬性
h += plus_state_set.size + 1 if plus_state_set.size > 0 #附加狀態
h += minus_state_set.size + 1 if minus_state_set.size > 0 #解除狀態
h += special.size + 1 if special.size > 0 #特殊效果
#------------------------------------------------------------------------
# ● 換算高度
#------------------------------------------------------------------------
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)
if x==@word
x = 0
@y += 1
end
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
end
#------------------------------------------------------------------------
# ● 攻擊範圍
#------------------------------------------------------------------------
text = phrase[:scope] +":"
draw_text(text, 1, move)
text = scope[skill.scope]
draw_text(text, 1, move + @size)
#------------------------------------------------------------------------
# ● 基本ダメージ
#------------------------------------------------------------------------
unless skill.base_damage .zero?
text = skill.base_damage > 0 ? phrase[:base_damage] : phrase[:recovery]
text += ":" + skill.base_damage.abs.to_s
draw_text(text, 1, move)
end
#------------------------------------------------------------------------
# ● 消費SP描述
#------------------------------------------------------------------------
text = phrase[:mp_cost] +":"+ skill.mp_cost.to_s
draw_text(text, 1, move)
#------------------------------------------------------------------------
# ● 命中率描述
#------------------------------------------------------------------------
text = phrase[:hit] + ":" + skill.hit.to_s + "%"
draw_text(text, 1, move)
#------------------------------------------------------------------------
# ● 屬性
#------------------------------------------------------------------------
if element_set.size > 0
text = phrase[:elements]+":"
draw_text(text, 1, move)
element_set.each do |i|
text = $data_system.elements[i]
draw_text(text, 1, move + @size)
end
end
#------------------------------------------------------------------------
# ● 添加狀態
#------------------------------------------------------------------------
unless plus_state_set.empty?
text = phrase[:plus_states]+":"
draw_text(text, 1, move)
plus_state_set.each do |i|
text = $data_states[i].name
draw_text(text, 1, move + @size)
end
end
#------------------------------------------------------------------------
# ● 解除狀態
#------------------------------------------------------------------------
unless minus_state_set.empty?
text = phrase[:minus_states]+":"
draw_text(text, 1, move)
minus_state_set.each do |i|
text = $data_states[i].name
draw_text(text, 1, move + @size)
end
end
#------------------------------------------------------------------------
# ● 特殊效果
#------------------------------------------------------------------------
if special.size > 0
text = phrase[:special]+":"
draw_text(text, 1, move)
special.each {|text| draw_text(text, 1, move + @size)}
end
end
end
#==============================================================================
# ■ Window_Item
#------------------------------------------------------------------------------
# アイテム画面などで、所持アイテムの一覧を表示するウィンドウです。
#==============================================================================
class Window_Item < Window_Selectable
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
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
#------------------------------------------------------------------------------
# スキル画面などで、使用できるスキルの一覧を表示するウィンドウです。
#==============================================================================
class Window_Skill < Window_Selectable
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(skill)
#修正窗口位置
@help_window.set_pos(self.x,self.y,self.width,self.oy,self.index,@column_max)
end
end
#==============================================================================
# ■ Window_Equip
#------------------------------------------------------------------------------
# 装備画面で、アクターが現在装備しているアイテムを表示するウィンドウです。
#==============================================================================
class Window_Equip < Window_Selectable
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
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_ShopBuy
#------------------------------------------------------------------------------
# ショップ画面で、購入できる商品の一覧を表示するウィンドウです。
#==============================================================================
class Window_ShopBuy < Window_Selectable
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
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
复制代码
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1