#==============================================================================
# 禾西製作 / 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 = draw_name_color(equipment)
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_Skill
#------------------------------------------------------------------------------
# 特技画面、战斗画面、显示可以使用的特技浏览的窗口。
#==============================================================================
class Window_Skill < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
# actor : 角色
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 128, 640, 352)
@actor = actor
@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(skill)
#校正帮助窗口位置
@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
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
#==============================================================================
# ■ Window_ShopCommand
#------------------------------------------------------------------------------
# 商店画面、选择要做的事的窗口
#==============================================================================
class Window_ShopCommand < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
# -------------------
# 修改開始
super(0, 64-64, 480, 64)#★★★★★★★★★★★★★★★★★
# 修改終了
# -------------------
self.contents = Bitmap.new(width - 32, height - 32)
@item_max = 3
@column_max = 3
@commands = ["买", "卖", "取消"]
refresh
self.index = 0
end
end
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
#========================================================================================================================
# ■ Window_ShopBuy
#------------------------------------------------------------------------------
# 商店画面、浏览显示可以购买的商品的窗口。
#==============================================================================
class Window_ShopBuy < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
# shop_goods : 商品
#--------------------------------------------------------------------------
def initialize(shop_goods)
# -------------------
# 修改開始
super(0, 128-64, 368, 352+64)#★★★★★★★★★★★★★★★★
# 修改終了
# -------------------
@shop_goods = shop_goods
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_ShopSell
#------------------------------------------------------------------------------
# 商店画面、浏览显示可以卖掉的商品的窗口。
#==============================================================================
class Window_ShopSell < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
# -------------------
# 修改開始
super(0, 128-64, 640, 352+64)#★★★★★★★★★★★★★★★★
# 修改終了
# -------------------
@column_max = 2
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_ShopNumber
#------------------------------------------------------------------------------
# 商店画面、输入买卖数量的窗口。
#==============================================================================
class Window_ShopNumber < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
# -------------------
# 修改開始
super(0, 128-64, 368, 352+64)#★★★★★★★★★★★★★★★★
# 修改終了
# -------------------
self.contents = Bitmap.new(width - 32, height - 32)
@item = nil
[url=home.php?mod=space&uid=25307]@Max[/url] = 1
@price = 0
@number = 1
end
end
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
#==============================================================================
# ■ Window_ShopStatus
#------------------------------------------------------------------------------
# 商店画面、显示物品所持数与角色装备的窗口。
#==============================================================================
class Window_ShopStatus < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
# -------------------
# 修改開始
super(368, 128-64, 272, 352+64)#★★★★★★★★★★★★
# 修改終了
# -------------------
self.contents = Bitmap.new(width - 32, height - 32)
@item = nil
refresh
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
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
#========================================================================================================================
# ■ 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
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
#==============================================================================
# ■ Scene_Shop
#------------------------------------------------------------------------------
# 处理商店画面的类。
#==============================================================================
class Scene_Shop
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
# --------------------
# 衝突可能
def main
# 生成帮助窗口
# -------------------
# 修改開始
@help_window = Window_Help.new#★★★★★★★★★★★★★★★★
# 修改終了
# -------------------
# 生成指令窗口
@command_window = Window_ShopCommand.new
# 生成金钱窗口
@gold_window = Window_Gold.new
@gold_window.x = 480
# -------------------
# 修改開始
@gold_window.y = 64-64#★★★★★★★★★★★★★
# 修改終了
# -------------------
# 生成时间窗口
# -------------------
# 修改開始
@dummy_window = Window_Base.new(0, 128-64, 640, 352+64)#★★★★★★★★★★★★★
# 修改終了
# -------------------
# 生成购买窗口
@buy_window = Window_ShopBuy.new($game_temp.shop_goods)
@buy_window.active = false
@buy_window.visible = false
@buy_window.help_window = @help_window
# 生成卖出窗口
@sell_window = Window_ShopSell.new
@sell_window.active = false
@sell_window.visible = false
@sell_window.help_window = @help_window
# 生成数量输入窗口
@number_window = Window_ShopNumber.new
@number_window.active = false
@number_window.visible = false
# 生成状态窗口
@status_window = Window_ShopStatus.new
@status_window.visible = false
# 执行过渡
Graphics.transition
# 主循环
loop do
# 刷新游戏画面
Graphics.update
# 刷新输入信息
Input.update
# 刷新画面
update
# 如果画面切换的话就中断循环
if $scene != self
break
end
end
# 准备过渡
Graphics.freeze
# 释放窗口
@help_window.dispose
@command_window.dispose
@gold_window.dispose
@dummy_window.dispose
@buy_window.dispose
@sell_window.dispose
@number_window.dispose
@status_window.dispose
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
# --------------------
# 衝突可能
def update
# 刷新窗口
@help_window.update
@command_window.update
@gold_window.update
@dummy_window.update
@buy_window.update
@sell_window.update
@number_window.update
@status_window.update
# 指令窗口激活的情况下: 调用 update_command
if @command_window.active
# -------------------
# 修改開始
@help_window.visible=false#★★★★★★★★★★★★★★★★
# 修改終了
# -------------------
update_command
return
end
# 购买窗口激活的情况下: 调用 update_buy
if @buy_window.active
# -------------------
# 修改開始
@help_window.visible=true#★★★★★★★★★★★★★★★★
if @buy_window.item==nil#★★★★★★★★★★★★★★★★
@help_window.visible=false#★★★★★★★★★★★★★★★★
end #★★★★★★★★★★★★★★★★
# 修改終了
# -------------------
update_buy
return
end
# 卖出窗口激活的情况下: 调用 update_sell
if @sell_window.active
# -------------------
# 修改開始
@help_window.visible=true#★★★★★★★★★★★★★★★★
if @sell_window.item==nil#★★★★★★★★★★★★★★★★
@help_window.visible=false#★★★★★★★★★★★★★★★★
end #★★★★★★★★★★★★★★★★
# 修改終了
# -------------------
update_sell
return
end
# 个数输入窗口激活的情况下: 调用 update_number
if @number_window.active
# -------------------
# 修改開始
@help_window.visible=false#★★★★★★★★★★★★★★★★
# 修改終了
# -------------------
update_number
return
end
end
end
#==============================================================================
# 禾西製作 / 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 = draw_name_color(equipment)
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_Skill
#------------------------------------------------------------------------------
# 特技画面、战斗画面、显示可以使用的特技浏览的窗口。
#==============================================================================
class Window_Skill < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
# actor : 角色
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 128, 640, 352)
@actor = actor
@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(skill)
#校正帮助窗口位置
@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
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
#==============================================================================
# ■ Window_ShopCommand
#------------------------------------------------------------------------------
# 商店画面、选择要做的事的窗口
#==============================================================================
class Window_ShopCommand < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
# -------------------
# 修改開始
super(0, 64-64, 480, 64)#★★★★★★★★★★★★★★★★★
# 修改終了
# -------------------
self.contents = Bitmap.new(width - 32, height - 32)
@item_max = 3
@column_max = 3
@commands = ["买", "卖", "取消"]
refresh
self.index = 0
end
end
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
#========================================================================================================================
# ■ Window_ShopBuy
#------------------------------------------------------------------------------
# 商店画面、浏览显示可以购买的商品的窗口。
#==============================================================================
class Window_ShopBuy < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
# shop_goods : 商品
#--------------------------------------------------------------------------
def initialize(shop_goods)
# -------------------
# 修改開始
super(0, 128-64, 368, 352+64)#★★★★★★★★★★★★★★★★
# 修改終了
# -------------------
@shop_goods = shop_goods
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_ShopSell
#------------------------------------------------------------------------------
# 商店画面、浏览显示可以卖掉的商品的窗口。
#==============================================================================
class Window_ShopSell < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
# -------------------
# 修改開始
super(0, 128-64, 640, 352+64)#★★★★★★★★★★★★★★★★
# 修改終了
# -------------------
@column_max = 2
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_ShopNumber
#------------------------------------------------------------------------------
# 商店画面、输入买卖数量的窗口。
#==============================================================================
class Window_ShopNumber < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
# -------------------
# 修改開始
super(0, 128-64, 368, 352+64)#★★★★★★★★★★★★★★★★
# 修改終了
# -------------------
self.contents = Bitmap.new(width - 32, height - 32)
@item = nil
@max = 1
@price = 0
@number = 1
end
end
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
#==============================================================================
# ■ Window_ShopStatus
#------------------------------------------------------------------------------
# 商店画面、显示物品所持数与角色装备的窗口。
#==============================================================================
class Window_ShopStatus < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
# -------------------
# 修改開始
super(368, 128-64, 272, 352+64)#★★★★★★★★★★★★
# 修改終了
# -------------------
self.contents = Bitmap.new(width - 32, height - 32)
@item = nil
refresh
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
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
#========================================================================================================================
# ■ 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
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
#==============================================================================
# ■ Scene_Shop
#------------------------------------------------------------------------------
# 处理商店画面的类。
#==============================================================================
class Scene_Shop
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
# --------------------
# 衝突可能
def main
# 生成帮助窗口
# -------------------
# 修改開始
@help_window = Window_Help.new#★★★★★★★★★★★★★★★★
# 修改終了
# -------------------
# 生成指令窗口
@command_window = Window_ShopCommand.new
# 生成金钱窗口
@gold_window = Window_Gold.new
@gold_window.x = 480
# -------------------
# 修改開始
@gold_window.y = 64-64#★★★★★★★★★★★★★
# 修改終了
# -------------------
# 生成时间窗口
# -------------------
# 修改開始
@dummy_window = Window_Base.new(0, 128-64, 640, 352+64)#★★★★★★★★★★★★★
# 修改終了
# -------------------
# 生成购买窗口
@buy_window = Window_ShopBuy.new($game_temp.shop_goods)
@buy_window.active = false
@buy_window.visible = false
@buy_window.help_window = @help_window
# 生成卖出窗口
@sell_window = Window_ShopSell.new
@sell_window.active = false
@sell_window.visible = false
@sell_window.help_window = @help_window
# 生成数量输入窗口
@number_window = Window_ShopNumber.new
@number_window.active = false
@number_window.visible = false
# 生成状态窗口
@status_window = Window_ShopStatus.new
@status_window.visible = false
# 执行过渡
Graphics.transition
# 主循环
loop do
# 刷新游戏画面
Graphics.update
# 刷新输入信息
Input.update
# 刷新画面
update
# 如果画面切换的话就中断循环
if $scene != self
break
end
end
# 准备过渡
Graphics.freeze
# 释放窗口
@help_window.dispose
@command_window.dispose
@gold_window.dispose
@dummy_window.dispose
@buy_window.dispose
@sell_window.dispose
@number_window.dispose
@status_window.dispose
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
# --------------------
# 衝突可能
def update
# 刷新窗口
@help_window.update
@command_window.update
@gold_window.update
@dummy_window.update
@buy_window.update
@sell_window.update
@number_window.update
@status_window.update
# 指令窗口激活的情况下: 调用 update_command
if @command_window.active
# -------------------
# 修改開始
@help_window.visible=false#★★★★★★★★★★★★★★★★
# 修改終了
# -------------------
update_command
return
end
# 购买窗口激活的情况下: 调用 update_buy
if @buy_window.active
# -------------------
# 修改開始
@help_window.visible=true#★★★★★★★★★★★★★★★★
if @buy_window.item==nil#★★★★★★★★★★★★★★★★
@help_window.visible=false#★★★★★★★★★★★★★★★★
end #★★★★★★★★★★★★★★★★
# 修改終了
# -------------------
update_buy
return
end
# 卖出窗口激活的情况下: 调用 update_sell
if @sell_window.active
# -------------------
# 修改開始
@help_window.visible=true#★★★★★★★★★★★★★★★★
if @sell_window.item==nil#★★★★★★★★★★★★★★★★
@help_window.visible=false#★★★★★★★★★★★★★★★★
end #★★★★★★★★★★★★★★★★
# 修改終了
# -------------------
update_sell
return
end
# 个数输入窗口激活的情况下: 调用 update_number
if @number_window.active
# -------------------
# 修改開始
@help_window.visible=false#★★★★★★★★★★★★★★★★
# 修改終了
# -------------------
update_number
return
end
end
end
=begin
#--------------------------------------------------------------------------
# ● 人物行走图做战斗图像(附加动画) ver1.02
#--------------------------------------------------------------------------
制作者 らい
翻译:忧郁的涟漪
图像文件的规格
● 巴特勒图像(似乎指的是战斗图像)
使用步行图片。
● 武器的图像
就是武器图标的图像(ICO图)
###############################################################################
行走图横版战斗:
------------------------------------------------------------------------------
经过了两次的修改,终于完全实现了远距离攻击的效果(弓箭、铳类)
另外,也实现了简单的回旋攻击(类似回力镖的攻击)和攻击道具(类似石头或炸弹)
这个脚本的更动分为2部分:
1)战斗动作 - 新加了数个动作,如:“弓箭攻击”、“远距离发动”等等
2)战斗动画 - 基本上是脚本原带的。只是这个功能被隐藏起来了。现在已恢复。
用法:
在相应的脚本行加入武器/技能/道具的数据库id(id之间要用“,”来分开)
如果不要某些功能的话就随便填一个外太空id就行了(没有用到的id)
1)战斗动作(角色/行走图的动作)
脚本355行: 远程武器的id (普通攻击时使用远程射击)
脚本357行: 回旋武器的id (普通攻击时会飞回手上的武器,如:回力镖)
脚本370行: 远程技能的id (使用技能时是远程射击)
脚本372行: 回旋技能的id (使用技能时,飞出的武器会飞回手上)
2)战斗动画(显示‘对象方的动画’之前先显示‘飞行武器射去敌人身上’的动画)
脚本453行: 回旋武器的id (攻击时会显示一段类似回力镖的动画)
脚本455行: 弓箭武器的id (攻击时会显示箭射去敌人身上的动画)
脚本457行: 铳类武器的id (攻击时会显示子弹射去敌人身上的动画)
脚本470行: 回旋技能的id (技能使用时会显示一段类似回力镖的动画)
脚本472行: 弓箭技能的id (技能使用时会显示箭射去敌人身上的动画)
脚本474行: 铳类技能的id (技能使用时会显示子弹射去敌人身上的动画)
脚本486行: 抛击道具的id (使用该道具时,道具被丢到敌人身上)
〉注意:
〉‘飞行武器射去敌人身上’的动画是在设定id之后的那句脚本里面设置
〉例子:(脚本第455和456行)
〉 when 17,18,19,20 #远程武器1(弓箭类)的id
〉 return [101,32,false,false]
〉这样,武器17~20(都是弓箭)在显示‘对象方的动画’之前会先显示第101号动画
〉而动画的轨道是从使用者身上直到敌人身上(实现子弹射出的效果)
还有:
战斗队伍的画面位置已经被修改过,
让角色的位置与默认的战斗背景图不会有视觉上的冲突。
如果要更改请去脚本第113-116行改改就行了。
脚本‘Arrow_Enemy’和‘Arrow_Actor’被稍微修改过(可以无视)
这个范例附带了
一张经过修改的战斗背景图(027-castle03),其他的战斗背景图可以使用默认的。
一套横版的默认敌人的战斗图(从行走图改过来的)
=end #modify by darkten
###############################################################################
module Side_view
#--------------------------------------------------------------------------
# ● 是否与RATB并用 ☆自动识别(这到是不错~省了~)
# 在Scene_Battle计算方法是否是方法synthe?
# 在自动不想认识的时候,请重写。
#--------------------------------------------------------------------------
if Scene_Battle.method_defined?("synthe?")
RTAB = true
else
RTAB = false
end
#--------------------------------------------------------------------------
# ● 改正RATB中的位置误差 ☆自动识别
# 在自动不想认识的时候,请重写。
#--------------------------------------------------------------------------
def camera_correctness
return false if !RTAB
begin
return $scene.drive
rescue
return false
end
end
#--------------------------------------------------------------------------
# ● 队伍中的最大人数
#--------------------------------------------------------------------------
Party_max = 4
#--------------------------------------------------------------------------
# ● 战斗图的扩大率(1.0的时候是保持原有大小)
#--------------------------------------------------------------------------
CHAR_ZOOM = 1.0
#--------------------------------------------------------------------------
# ● 光标的位置修正(基本不需要改~)
#--------------------------------------------------------------------------
ARROW_OX = 0
ARROW_OY = 64
#--------------------------------------------------------------------------
# ● 名状态作为飞行管理的排列(不知道什么意思....)
#--------------------------------------------------------------------------
FLY_STATES = ["飛行"]
#--------------------------------------------------------------------------
# ● 战斗画面的位置
#--------------------------------------------------------------------------
PARTY_X = 455 # 队伍 X 位置
PARTY_Y = 200 # 队伍 Y 位置
FORMATION_X = 15 # 各个角色之间的间隔 X
FORMATION_Y = 35 # 各个角色之间的间隔 Y
#--------------------------------------------------------------------------
# ● 自定义常数
#--------------------------------------------------------------------------
NORMAL = "NORMAL"
WALK_R = "WALK_R"
WALK_L = "WALK_L"
ATTACK = "ATTACK"
ATTACK_R = "ATTACK_R"
ATTACK_L = "ATTACK_L"
MAGIC = "MAGIC"
ITEM = "ITEM"
# 动画的设定
ANIME = {
# [画像ID,是否循环,アニメスピード,动画速度,不能指向动画,武器放在右手or左手]
NORMAL => [1,true , 0,false, true ,"" ], # 通常待击
WALK_R => [2,true , 2,false, false,"" ], # 右移动
WALK_L => [1,true , 2,false, false,"" ], # 左移动
ATTACK_R => [1,false, 2,true , false,"右手"], # 右手攻击
ATTACK_L => [1,false, 2,true , false,"左手"], # 左手攻击
MAGIC => [1,false, 2,false, false,"" ], # 右手攻击
ITEM => [1,false, 2,false, false,"" ], # 左手攻击
}
# 债务不履行声明价值的设定(一个字一个字翻译的,不知道啥意思)
ANIME.default = [1,false,12,false,"",""]
# 在行动设定的时候 右手攻击 or 左手攻击 辨别を(这个不知道什么意思)的ANIME
# "角色动画变更#ATTACK"在玩了と(还是不知道啥意思..)的时候,辨别ATTACK_R或者ATTACK_L
DUAL_WEAPONS_ANIME = [ATTACK]
#--------------------------------------------------------------------------
# ● 摇晃的设定
#--------------------------------------------------------------------------
SHAKE_FILE = "摇晃" # 文件名
SHAKE_POWER = 5 # 强度
SHAKE_SPEED = 5 # 速度
SHAKE_DURATION = 5 # 时间
#--------------------------------------------------------------------------
# ● 上下反转地的设定
#--------------------------------------------------------------------------
UPSIDE_DOWN_FILE = "上下反转" # 文件名
#--------------------------------------------------------------------------
# ● 左右反转地的设定
#--------------------------------------------------------------------------
REVERSE_FILE = "左右反转" # 文件名
#--------------------------------------------------------------------------
# ● 回转地的设定
#--------------------------------------------------------------------------
TURNING_FILE = "回转" # 文件名
TURNING_DIRECTION = 1 # 方向(1.逆时针,-1.顺时针)(|||-_-汗..怎么还有用-1做带入值的...)
TURNING_SPEED = 40 # 速度
TURNING_DURATION = 1 # 回转数
#--------------------------------------------------------------------------
# ● 移动的设定
#--------------------------------------------------------------------------
MOVE_FILE = "移动" # 文件名
MOVE_RETURN = 1 # 回到原来的位置吗?(光写了个1,也不知道不回到该怎么写?0?)
MOVE_SPEED = 32 # 速度
MOVE_COORDINATES = [0,-640] # 原来位置的相对坐标
#--------------------------------------------------------------------------
# ● 动画追加的设定
#--------------------------------------------------------------------------
ADD_ANIME_FILE = "动画追加" # 文件名
ADD_ANIME_ID = 0 # 动画的ID
#--------------------------------------------------------------------------
# ● 债务不履行声明和RTAB的数据转换
#--------------------------------------------------------------------------
def convert_battler
return RTAB ? @active_actor : @active_battler
end
#--------------------------------------------------------------------------
# ● 债务不履行声明和RTAB的数据转换2
#--------------------------------------------------------------------------
def convert_battler2(*arg)
return RTAB ? arg[0] : @active_battler
end
end
#--------------------------------------------------------------------------
# ● 行动設定
#--------------------------------------------------------------------------
module BattleActions
# 下のものはあくまでも一例なので
# 独自に作ってください。
Actions = {
"通常攻撃" => [
"閃きアニメ",
"アクターアニメ変更#WALK_L",
"移動#target,32,0,64,0",
"行動アニメ",
"アクターアニメ変更#ATTACK",
"遠距離アニメ",
"対象アニメ",
"アクターアニメ変更#WALK_L",
"SEの演奏#016-Jump02,80,100",
"移動#self,0,0,48,32",
"終了"
],
"エネミー攻撃" => [
"閃きアニメ",
"アクターアニメ変更#WALK_L",
"移動#self,-36,0,12,0",
"行動アニメ",
"アクターアニメ変更#ATTACK",
"遠距離アニメ",
"対象アニメ",
"アクターアニメ変更#WALK_L",
"移動#self,0,0,12,0",
"終了"
],
"術発動" => [
"閃きアニメ",
"アクターアニメ変更#WALK_L",
"移動#self,-32,0,4,0",
"アクターアニメ変更#MAGIC",
"行動アニメ",
"ウエイト#15",
"遠距離アニメ",
"対象アニメ",
"アクターアニメ変更#WALK_L",
"移動#self,0,0,4,2",
"終了"
],
"アイテム使用" => [
"閃きアニメ",
"アクターアニメ変更#WALK_L",
"移動#self,-32,0,4,0",
"行動アニメ",
"アクターアニメ変更#ITEM",
"ウエイト#15",
"遠距離アニメ",
"対象アニメ",
"アクターアニメ変更#WALK_L",
"移動#self,0,0,4,2",
"終了"
],
"払い抜け" => [
"閃きアニメ",
"アクターアニメ変更#WALK_L",
"移動#target_near,50,0,48,30",
"左右反転",
"アクターアニメ固定#ATTACK#3",
"行動アニメ",
"SEの演奏#135-Light01,100,100",
"アニメーションの表示#self,42",
"ウエイト#15",
"左右反転",
"残像表示",
"移動#target_far,-50,0,48,0",
"対象アニメ",
"残像消去",
"アニメ固定解除",
"アクターアニメ変更#WALK_L",
"移動#self,0,0,48,1,0",
"終了"
],
"弓箭攻撃" => [
"閃きアニメ",
"アクターアニメ変更#WALK_L",
"移動#self,-32,0,4,0",
"行動アニメ",
"アクターアニメ変更#ATTACK",
"遠距離アニメ",
"対象アニメ",
"アクターアニメ変更#WALK_L",
"移動#self,0,0,4,2",
"終了"
],
"回旋攻撃" => [
"閃きアニメ",
"アクターアニメ変更#WALK_L",
"移動#self,-32,0,4,0",
"行動アニメ",
"アクターアニメ変更#STAND_L",
"遠距離アニメ",
"対象アニメ",
"アクターアニメ変更#WALK_L",
"移動#self,0,0,4,2",
"終了"
],
"远距离発動" => [
"閃きアニメ",
"アクターアニメ変更#WALK_L",
"移動#self,-32,0,4,0",
"アクターアニメ変更#MAGIC",
"行動アニメ",
"アクターアニメ変更#ATTACK",
"遠距離アニメ",
"対象アニメ",
"アクターアニメ変更#WALK_L",
"移動#self,0,0,4,2",
"終了"
],
"回旋発動" => [
"閃きアニメ",
"アクターアニメ変更#WALK_L",
"移動#self,-32,0,4,0",
"アクターアニメ変更#MAGIC",
"行動アニメ",
"アクターアニメ変更#STAND_L",
"遠距離アニメ",
"対象アニメ",
"アクターアニメ変更#WALK_L",
"移動#self,0,0,4,2",
"終了"
],
} # ここで終わり 消さないでください
end
module RPG
class Weapon
#--------------------------------------------------------------------------
# ● アクション設定
#--------------------------------------------------------------------------
def battle_actions
case @id
when 17,18,19,20,21,22,23,24 # 远程武器的id回旋攻撃
return BattleActions::Actions["弓箭攻撃"]
when 34 # 回旋武器的id
return BattleActions::Actions["回旋攻撃"]
end
else
return BattleActions::Actions["通常攻撃"]
end
end
class Skill
#--------------------------------------------------------------------------
# ● アクション設定
#--------------------------------------------------------------------------
def battle_actions
case @id
when 73,74,75,76,77,78,79,80 # 远程技能的id
return BattleActions::Actions["远距离発動"]
when 82 # 回旋技能的id
return BattleActions::Actions["回旋発動"]
end
else
if self.magic?
return BattleActions::Actions["術発動"]
else
return BattleActions::Actions["払い抜け"]
end
end
end
class Item
#--------------------------------------------------------------------------
# ● アクション設定
#--------------------------------------------------------------------------
def battle_actions
return BattleActions::Actions["アイテム使用"]
end
end
end
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# ● アクション設定
#--------------------------------------------------------------------------
def battle_actions
return BattleActions::Actions["エネミー攻撃"]
end
end
=begin
#--------------------------------------------------------------------------
# ● 遠距離アニメーション
#--------------------------------------------------------------------------
☆ 説明
行動者から対象者にアニメを飛ばします。
飛ばすアニメを データベース‐アニメーション で作ります。
[アニメーションID, スピード, 往復するか?,直線(false)or曲線(true)] で指定します。
● カスタマイズ方法
case @id
when 17,18,19,20
return [101,32,false,false]
when 21,22,23,24
return [102,32,false,false]
end
return 0
のように描くとID別に指定可能です。
● アニメーションID
飛ばすアニメーションIDです。短い場合は繰り返しで表示されます。
● スピード
大きいほうが早い(0だとアニメは移動しません)
1 = 1フレームで1ドット進むと考えてください。
● 往復するか?
true とした場合、ブーメランのようにアニメが戻ります。
● 直線(false)or曲線(true)
true = 対象に向かって曲線で、アニメが飛びます。(修正の余地ありですが・・・)
false = 対象に向かって直線で、アニメが飛びます。
=end
module RPG
class Weapon
#--------------------------------------------------------------------------
# ● 遠距離アニメーション
#--------------------------------------------------------------------------
def flying_anime
# ID 指定 の例(武器的id,分类是根据飞行武器的动画id)
case @id
when 34 #回旋武器(类似回力镖)的id
return [103,32,true,true]
when 17,18,19,20 #远程武器1(弓箭类)的id
return [101,32,false,false]
when 21,22,23,24 #远程武器2(铳类)的id
return [102,32,false,false]
end
return [0,0,false,false]
end
end
class Skill
#--------------------------------------------------------------------------
# ● 遠距離アニメーション
#--------------------------------------------------------------------------
def flying_anime
# ID 指定 の例(技能的id,分类是根据飞行武器的动画id)
case @id
when 82 #回旋技能(类似回力镖)的id
return [103,32,true,true]
when 73,74,75,76 #远程技能1(弓箭类)的id
return [101,32,false,false]
when 77,78,79,80 #远程技能2(铳类)的id
return [102,32,false,false]
end
return [0,0,false,false]
end
end
class Item
#--------------------------------------------------------------------------
# ● 遠距離アニメーション
#--------------------------------------------------------------------------
def flying_anime
case @id
when 34 #抛击类道具(如炸弹一类)的id
return [104,32,false,true]
end
return [0,0,false,false]
end
end
end
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# ● 遠距離アニメーション
#--------------------------------------------------------------------------
def flying_anime
return [0,0,false,false]
end
end
#==============================================================================
# ■ Game_Battler
#==============================================================================
class Game_Battler
include Side_view
#--------------------------------------------------------------------------
# ● 追加・公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :height # 画像の高さ
attr_accessor :real_x # X座標補正
attr_accessor :real_y # Y座標補正
attr_accessor :real_zoom # 拡大率
attr_accessor :wait_count # アニメーション 待ち時間
attr_accessor :wait_count2 # アニメーション 待ち時間2
attr_accessor :pattern # アニメーション カウント(キャラ)
attr_accessor :shake # シェイク開始フラッグ
attr_accessor :reverse # 左右反転フラッグ
attr_accessor :shadow # 残像フラッグ
attr_accessor :flash_flag # 閃きフラッグ
attr_reader :ox # X座標補正
attr_reader :oy # Y座標補正
attr_reader :flying_x # 遠距離アニメX座標
attr_reader :flying_y # 遠距離アニメY座標
attr_reader :flying_anime # 遠距離アニメ
attr_reader :animation1_on # 行動アニメ開始フラッグ
attr_reader :animation2_on # 対象アニメ開始フラッグ
#--------------------------------------------------------------------------
# ● デフォルトのアニメーション待ち時間を取得
#--------------------------------------------------------------------------
def animation_duration=(animation_duration)
@_animation_duration = animation_duration
end
#--------------------------------------------------------------------------
# ● バトル開始時のセットアップ
#--------------------------------------------------------------------------
def start_battle
[url=home.php?mod=space&uid=291977]@height[/url] = 0
@real_x = 0
@real_y = 0
@real_zoom = 1.0
@battler_condition = ""
@action = nil
@battle_actions = []
@battler_action = false
[url=home.php?mod=space&uid=2129346]@step[/url] = 0
@anime_on = false
@wait_count = 0
@wait_count2 = 0
@ox = 0
@oy = 0
@pattern = 0
@pattern_log = true
@pattern_freeze = false
@condition_freeze = false
@active = false
@move_distance = nil
@move_wait = 0
@move_coordinates = [0,0,0,0]
@flying_distance = nil
@flying_wait = 0
@flying_x = 0
@flying_y = 0
@flash_flag = {}
self.flying_clear
end
#--------------------------------------------------------------------------
# ● 移動中判定
#--------------------------------------------------------------------------
def moving?
# X座標補正または、Y座標補正が0でなければ、移動中
return (@ox != 0 or @oy != 0)
end
#--------------------------------------------------------------------------
# ● 移動終了判定
#--------------------------------------------------------------------------
def move_end?
return (@ox == @move_coordinates[0] and @oy == @move_coordinates[1])
end
#--------------------------------------------------------------------------
# ● アクション開始設定
#--------------------------------------------------------------------------
def action(flag = true)
@battler_action = flag
@animation1_on = false
@animation2_on = false
@step = "setup"
end
#--------------------------------------------------------------------------
# ● アクション中判定
#--------------------------------------------------------------------------
def action?
return @battler_action
end
#--------------------------------------------------------------------------
# ● 閃き判定
#--------------------------------------------------------------------------
def flash?
return @flash_flg
end
#--------------------------------------------------------------------------
# ● 戦闘不能判定
#--------------------------------------------------------------------------
def anime_dead?
if $game_temp.in_battle and !RTAB
if [2,3,4,5].include?($scene.phase4_step)
return @last_dead
end
end
return @last_dead = self.dead?
end
#--------------------------------------------------------------------------
# ● ピンチ状態判定
#--------------------------------------------------------------------------
def crisis?
if $game_temp.in_battle and !RTAB
if [2,3,4,5].include?($scene.phase4_step)
return @last_crisis
end
end
return @last_crisis = (self.hp <= self.maxhp / 4 or badstate?)
end
#--------------------------------------------------------------------------
# ● バッドステート判定
#--------------------------------------------------------------------------
def badstate?
for i in @states
unless $data_states[i].nonresistance
return true
end
end
return false
end
#--------------------------------------------------------------------------
# ● 飛行
#--------------------------------------------------------------------------
def fly
if @fly != nil
return @fly
end
for id in @states
if FLY_STATES.include?($data_states[id].name)
return 60
end
end
return 0
end
#--------------------------------------------------------------------------
# ● 遠距離アニメ目標座標の計算
#--------------------------------------------------------------------------
def flying_setup
# 二度目は実行しない
return if @flying_distance != nil && !camera_correctness
if RTAB
targets = @target
else
targets = $scene.target_battlers
end
# 目的座標を計算
@f_target_x = 0
@f_target_y = 0
for t in targets
@f_target_x += t.screen_x
@f_target_y += t.screen_y
end
if targets != []
@f_target_x /= targets.size
@f_target_y /= targets.size
else
@flying_distance = 0
return
end
# 距離の計算
@flying_distance = (self.screen_x - @f_target_x).abs + (self.screen_y - @f_target_y).abs
end
#--------------------------------------------------------------------------
# ● 遠距離アニメ
#--------------------------------------------------------------------------
def flying_animation
# 戻る
if @step != "flying" or @flying_distance.nil?
return [false,true]
end
# あらかじめ計算
self_x = self.screen_x
self_y = self.screen_y
@flying_distance = @flying_distance == 0 ? 1 : @flying_distance
n1 = @flying_wait / @flying_distance.to_f
if @flying_distance - @flying_wait > @flying_distance / 2
n2 = 1.0 + 10.0 * @flying_wait / @flying_distance.to_f
else
n2 = 1.0 + 10.0 * (@flying_distance - @flying_wait) / @flying_distance.to_f
end
if !@flying_anime[4]
# 直線移動
x = (self_x + 1.0 * (@f_target_x - self_x) * n1).to_i
y = (self_y + 1.0 * (@f_target_y - self_y) * n1).to_i
else
# 曲線移動
if !@flying_proceed_end
x = (self_x + 1.0 * (@f_target_x - self_x) * n1).to_i
y = (self_y + 1.0 * (@f_target_y - self_y) * n1 - n2**2).to_i
else
x = (self_x + 1.0 * (@f_target_x - self_x) * n1).to_i
y = (self_y + 1.0 * (@f_target_y - self_y) * n1 + n2**2).to_i
end
end
# 座標代入
@flying_x = x
@flying_y = y
# ウエイト
if !@flying_proceed_end
# 開始
@flying_proceed_start = @flying_wait == 0
@flying_wait += @flying_anime[1]
@flying_wait = [@flying_wait,@flying_distance].min
@flying_proceed_end = @flying_wait == @flying_distance
else
# 開始
@flying_return_start = @flying_wait == @flying_distance
@flying_wait -= @flying_anime[1]
@flying_wait = [@flying_wait,0].max
@flying_return_end = @flying_wait == 0
end
if @flying_anime[1] == 0
@flying_end = true
elsif !@flying_anime[2]
@flying_end = @flying_proceed_end
else
@flying_end = @flying_return_end
end
# 値を返す(アニメ開始,アニメ終了)
return [@flying_proceed_start,@flying_end]
end
#--------------------------------------------------------------------------
# ● 遠距離アニメ初期化
#--------------------------------------------------------------------------
def flying_clear
@flying_proceed_start = false
@flying_proceed_end = false
@flying_return_start = false
@flying_return_end = false
@flying_end = false
@flying_anime = [0,0,false]
end
#--------------------------------------------------------------------------
# ● 移動
#--------------------------------------------------------------------------
def move
# 距離の計算
@move_distance = (@move_coordinates[2] - @move_coordinates[0]).abs +
(@move_coordinates[3] - @move_coordinates[1]).abs
if @move_distance > 0
return if @ox == @move_coordinates[0] and @oy == @move_coordinates[1]
array = @move_coordinates
# ジャンプ補正値の計算
if @move_distance - @move_wait > @move_distance / 2
jump = (@move_action[4] * @move_wait / @move_distance.to_f)**2
else
jump = (@move_action[4] * (@move_distance - @move_wait) / @move_distance.to_f)**2
end
jump = @move_action[4] > 0 ? -jump : jump
@ox = (array[2] + 1.0 * (array[0] - array[2]) * (@move_distance - @move_wait) / @move_distance.to_f).to_i
@oy = (array[3] + 1.0 * (array[1] - array[3]) * (@move_distance - @move_wait) / @move_distance.to_f + jump).to_i
# ウエイト
@move_wait -= @move_action[3]
@move_wait = [@move_wait,0].max
end
end
#--------------------------------------------------------------------------
# ● 移動アクションの取得
#--------------------------------------------------------------------------
def get_move_action
string = @action.split(/#/)[1]
string = string.split(/,/)
@move_action = [string[0],string[1].to_i,string[2].to_i,string[3].to_i,string[4].to_i,string[5].to_i]
end
#--------------------------------------------------------------------------
# ● アクションの取得
#--------------------------------------------------------------------------
def get_step
if @action.nil?
@step = "finish"
return
end
string = @action.split(/#/)[0]
if string =~ "移動"
@step = "moving_setup"
elsif string =~ "アクターアニメ実行"
@step = "action"
elsif string =~ "遠距離アニメ"
@step = "flying"
elsif string =~ "アクターアニメ変更"
@step = "change"
elsif string =~ "行動アニメ"
@step = "animation1"
elsif string =~ "対象アニメ"
@step = "animation2"
elsif string =~ "ウエイト"
@step = "wait"
elsif string =~ "左右反転"
@step = "reverse"
elsif string =~ "閃きアニメ"
@step = "flash"
elsif string =~ "残像表示"
@step = "shadow_on"
elsif string =~ "残像消去"
@step = "shadow_off"
elsif string =~ "アクターアニメ固定"
@step = "freeze"
elsif string =~ "アニメ固定解除"
@step = "freeze_lifting"
elsif string =~ "アニメーションの表示"
@step = "animation_start"
elsif string =~ "SEの演奏"
@step = "play_se"
else
@step = "finish"
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (次のアクションへ)
#--------------------------------------------------------------------------
def update_next
@action = @battle_actions.shift
@step = get_step
end
#--------------------------------------------------------------------------
# ● フレーム更新 (動作取得)
#--------------------------------------------------------------------------
def update_setup
# アクションの取得
self.get_actions
@action = @battle_actions.shift
@step = get_step
end
#--------------------------------------------------------------------------
# ● フレーム更新 (移動取得)
#--------------------------------------------------------------------------
def update_moving_setup
# 移動アクションの取得
self.get_move_action
# 移動目標の設定
self.move_setup
@step = "moving"
end
#--------------------------------------------------------------------------
# ● フレーム更新 (移動)
#--------------------------------------------------------------------------
def update_moving
# 移動
self.move
self.condition = @battler_condition
# 移動完了したら次のステップへ
if move_end?
@wait_count = 2
@action = @battle_actions.shift
@step = get_step
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (アニメ実行)
#--------------------------------------------------------------------------
def update_action
con = @action.split(/#/)[1]
# 右手・左手を分ける
if DUAL_WEAPONS_ANIME.include?(con)
if !@first_weapon and @second_weapon
con = con + "_L"
else
con = con + "_R"
end
end
# アニメ変更
self.condition = con
# ループか否か
if !ANIME[@battler_condition][1]
self.anime_on
end
@action = @battle_actions.shift
@step = get_step
end
#--------------------------------------------------------------------------
# ● フレーム更新 (遠距離アニメ)
#--------------------------------------------------------------------------
def update_flying
# 目標の設定
self.flying_setup
# 遠距離アニメ終了
if @flying_end
self.flying_clear
@action = @battle_actions.shift
@step = get_step
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (アニメ変更)
#--------------------------------------------------------------------------
def update_change
con = @action.split(/#/)[1]
# 右手・左手を分ける
if DUAL_WEAPONS_ANIME.include?(con)
if !@first_weapon and @second_weapon
con = con + "_L"
else
con = con + "_R"
end
end
# アニメ変更
self.condition = con
# ループか否か
if !ANIME[@battler_condition][1]
self.anime_on
end
@action = @battle_actions.shift
@step = get_step
end
#--------------------------------------------------------------------------
# ● フレーム更新 (行動アニメ)
#--------------------------------------------------------------------------
def update_animation1
@animation1_on = true
# 行動アニメの後に行動を開始する
if $scene.phase4_step == 3
id = RTAB ? @anime1 : $scene.animation1_id
animation = $data_animations[id]
frame_max = animation != nil ? animation.frame_max : 0
@wait_count2 = frame_max * 2
return
end
@action = @battle_actions.shift
@step = get_step
end
#--------------------------------------------------------------------------
# ● フレーム更新 (対象アニメ)
#--------------------------------------------------------------------------
def update_animation2
@animation2_on = true
# 行動アニメの後に行動を開始する
if $scene.phase4_step == 4
id = RTAB ? @anime2 : $scene.animation2_id
animation = $data_animations[id]
frame_max = animation != nil ? animation.frame_max : 0
@wait_count2 = frame_max * 2
return
end
@action = @battle_actions.shift
@step = get_step
end
#--------------------------------------------------------------------------
# ● フレーム更新 (ウエイト)
#--------------------------------------------------------------------------
def update_wait
@wait_count2 = @action.split(/#/)[1].to_i
@action = @battle_actions.shift
@step = get_step
end
#--------------------------------------------------------------------------
# ● フレーム更新 (残像表示)
#--------------------------------------------------------------------------
def update_shadow_on
@shadow = true
@action = @battle_actions.shift
@step = get_step
end
#--------------------------------------------------------------------------
# ● フレーム更新 (残像消去)
#--------------------------------------------------------------------------
def update_shadow_off
@shadow = false
@action = @battle_actions.shift
@step = get_step
end
#--------------------------------------------------------------------------
# ● フレーム更新 (左右反転)
#--------------------------------------------------------------------------
def update_reverse
@reverse = @reverse ? false : true
@action = @battle_actions.shift
@step = get_step
end
#--------------------------------------------------------------------------
# ● フレーム更新 (閃きアニメ)
#--------------------------------------------------------------------------
def update_flash
# 閃きアニメの後に行動を開始する
if @flash_flag["normal"]
@wait_count = $scene.flash_duration
@flash_flag["normal"] = false
return
end
@action = @battle_actions.shift
@step = get_step
end
#--------------------------------------------------------------------------
# ● フレーム更新 (SEの演奏)
#--------------------------------------------------------------------------
def update_play_se
data = @action.split(/#/)[1]
data = data.split(/,/)
# SE を演奏
Audio.se_play("Audio/SE/" + data[0], data[1].to_i, data[2].to_i)
@action = @battle_actions.shift
@step = get_step
end
#--------------------------------------------------------------------------
# ● フレーム更新 (アクターアニメ固定)
#--------------------------------------------------------------------------
def update_freeze
con = @action.split(/#/)[1]
# 右手・左手を分ける
if DUAL_WEAPONS_ANIME.include?(con)
if !@first_weapon and @second_weapon
con = con + "_L"
else
con = con + "_R"
end
end
# アニメ変更
self.condition = con
@pattern = @action.split(/#/)[2].to_i
@pattern_freeze = true
@condition_freeze = true
@action = @battle_actions.shift
@step = get_step
end
#--------------------------------------------------------------------------
# ● フレーム更新 (アクターアニメ固定解除)
#--------------------------------------------------------------------------
def update_freeze_lifting
@pattern_freeze = false
@condition_freeze = false
@action = @battle_actions.shift
@step = get_step
end
#--------------------------------------------------------------------------
# ● フレーム更新 (アニメーションの表示)
#--------------------------------------------------------------------------
def update_animation_start
data = @action.split(/#/)[1]
data = data.split(/,/)
target = data[0]
animation_id = data[1].to_i
if RTAB
case target
when "self"
@animation.push([animation_id,true])
when "target"
for tar in @target
tar.animation.push([animation_id, true])
end
end
else
case target
when "self"
@animation_id = animation_id
@animation_hit = true
when "target"
for tar in $scene.target_battlers
tar.animation_id = animation_id
tar.animation_hit = true
end
end
end
@action = @battle_actions.shift
@step = get_step
end
#--------------------------------------------------------------------------
# ● フレーム更新 (動作終了)
#--------------------------------------------------------------------------
def update_finish
# 動作終了
@battler_action = false
@step = "setup"
end
#--------------------------------------------------------------------------
# ● バトラーの状態 変更(バトラーグラフィックのタイプ)
#--------------------------------------------------------------------------
def condition=(condition)
return if @condition_freeze
@battler_condition = condition
@wait_count = ANIME[condition][2]
end
#--------------------------------------------------------------------------
# ● バトラーの状態(バトラーグラフィックのタイプ)
#--------------------------------------------------------------------------
def condition
return @battler_condition
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
# ウェイト中の場合
if @wait_count > 0
return
end
# パターン更新
self.char_animation
# ウェイト中の場合
if @wait_count2 > 0
return
end
# 行動アニメーション
if @battler_action
method("update_" + @step).call
return
end
# データ初期化
@animation1_on = false
@animation2_on = false
@action = nil
@battle_actions = []
@move_wait = 0
@move_distance = nil
@flying_wait = 0
@flying_distance = nil
@flash = false
# RTAB対応
# 通常・待機
return self.condition = NORMAL
end
#--------------------------------------------------------------------------
# ● アクションの取得
#--------------------------------------------------------------------------
def get_actions
skill = $data_skills[self.current_action.skill_id]
item = $data_items[self.current_action.item_id]
kind = self.current_action.kind
# 動作取得
@battle_actions = []
# スキル
if skill != nil && kind == 1
@battle_actions = skill.battle_actions.dup
@flying_anime = skill.flying_anime
# アイテム
elsif item != nil && kind == 2
@battle_actions = item.battle_actions.dup
@flying_anime = item.flying_anime
# 左手攻撃
elsif !@first_weapon and @second_weapon and self.is_a?(Game_Actor)
@battle_actions = self.battle_actions2.dup
@flying_anime = self.flying_anime2
# 右手攻撃
elsif self.current_action.basic == 0 and
self.is_a?(Game_Actor) and self.current_action.kind == 0
@battle_actions = self.battle_actions1.dup
@flying_anime = self.flying_anime1
# 通常攻撃
elsif self.current_action.basic == 0 and self.current_action.kind == 0
@battle_actions = self.battle_actions.dup
@flying_anime = self.flying_anime
else
@battle_actions = ["終了"]
@flying_anime = [0,0,false,false]
end
end
#--------------------------------------------------------------------------
# ● ループしないアニメのセット
#--------------------------------------------------------------------------
def anime_on
@pattern = 0
@pattern_log = true
return
end
#--------------------------------------------------------------------------
# ● パターン更新
#--------------------------------------------------------------------------
def char_animation
# パタン固定の場合もどる
return if @pattern_freeze
# ループしないアニメの場合 1234 で止まる
if !ANIME[@battler_condition][1] && @pattern == 3
return
end
# アニメさせない場合 1 で止まる
if ANIME[@battler_condition][4]
@pattern = 0
return
end
@pattern = (@pattern + 1) % 4
end
#--------------------------------------------------------------------------
# ● アニメタイプ
#--------------------------------------------------------------------------
def anime_type
return ANIME[self.condition] != nil ? ANIME[self.condition][0] : 0
end
end
#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
include Side_view
#--------------------------------------------------------------------------
# ● セットアップ
#--------------------------------------------------------------------------
alias side_view_setup setup
def setup(actor_id)
side_view_setup(actor_id)
start_battle
end
#--------------------------------------------------------------------------
# ● 二刀武器のID取得 ※エラー回避用
#--------------------------------------------------------------------------
def weapon2_id
return @weapon2_id != nil ? @weapon2_id : 0
end
#--------------------------------------------------------------------------
# ● X方向 ポジション 取得 (陣形スクリプト拡張用)
#--------------------------------------------------------------------------
def position
return $data_classes[@class_id].position
end
#--------------------------------------------------------------------------
# ● Y方向 ポジション 取得 (陣形スクリプト拡張用)
#--------------------------------------------------------------------------
def position2
return self.index
end
#--------------------------------------------------------------------------
# ● 武器アニメタイプ
#--------------------------------------------------------------------------
def weapon_anime_type(type)
file_name = weapon_anime_type0(type)
visible = weapon_anime_type1(type)
z = weapon_anime_type2(type)
return [file_name,visible,z]
end
# 武器アイコン取得
def weapon_anime_type0(type)
type = ANIME[type][5]
return weapon_anime1 if type == "右手"
return weapon_anime2 if type == "左手"
return nil
end
# 表示・非表示の取得
def weapon_anime_type1(type)
return ANIME[type][3]
end
# バトラーより上に表示するかどうか
def weapon_anime_type2(type)
type = ANIME[type][5]
return true if type == "左手"
return false
end
#--------------------------------------------------------------------------
# ● バトル画面 X 座標の取得(カメラ補正無し)
#--------------------------------------------------------------------------
def true_x
return PARTY_X + position * FORMATION_X + @ox
end
#--------------------------------------------------------------------------
# ● バトル画面 Y 座標の取得(カメラ補正無し)
#--------------------------------------------------------------------------
def true_y
# パーティ内の並び順から Y 座標を計算して返す
if self.index != nil
y = position2 * FORMATION_Y + PARTY_Y + @oy - @height / 2
return y
else
return 0
end
end
#--------------------------------------------------------------------------
# ● バトル画面 X 座標の取得
#--------------------------------------------------------------------------
def screen_x(true_x = self.true_x)
return 320 + (true_x - 320) * @real_zoom + @real_x
end
#--------------------------------------------------------------------------
# ● バトル画面 Y 座標の取得
#--------------------------------------------------------------------------
def screen_y(true_y = self.true_y)
return true_y * @real_zoom + @real_y
end
#--------------------------------------------------------------------------
# ● バトル画面 Z 座標の取得
#--------------------------------------------------------------------------
def screen_z
return screen_y + 1000
end
#--------------------------------------------------------------------------
# ● バトル画面 X 座標の取得(移動などしていない場合)
#--------------------------------------------------------------------------
def base_x
return 320 + (true_x - @ox - 320) * @real_zoom + @real_x
end
#--------------------------------------------------------------------------
# ● バトル画面 Y 座標の取得
#--------------------------------------------------------------------------
def base_y
return (true_y - @oy) * @real_zoom + @real_y
end
#--------------------------------------------------------------------------
# ● バトル画面 拡大率の取得
#--------------------------------------------------------------------------
def zoom
return ($scene.zoom_rate[1] - $scene.zoom_rate[0]) *
(true_x + @fly) / 480 + $scene.zoom_rate[0]
end
#--------------------------------------------------------------------------
# ● 攻撃用、バトル画面 X 座標の取得
#--------------------------------------------------------------------------
def attack_x(z)
return (320 - true_x) * z * 0.75
end
#--------------------------------------------------------------------------
# ● 攻撃用、バトル画面 Y 座標の取得
#--------------------------------------------------------------------------
def attack_y(z)
return (160 - (true_y + fly / 4) * z + @height * zoom * z / 2) * 0.75
end
#--------------------------------------------------------------------------
# ● 閃き待ち時間
#--------------------------------------------------------------------------
def flash_duration
return $scene.flash_duration
end
#--------------------------------------------------------------------------
# ● アニメーション取得
#--------------------------------------------------------------------------
def battle_actions1
weapon = $data_weapons[@weapon_id]
return weapon != nil ? weapon.battle_actions : BattleActions::Actions["通常攻撃"]
end
#--------------------------------------------------------------------------
# ● アニメーション取得
#--------------------------------------------------------------------------
def battle_actions2
weapon = $data_weapons[@weapon2_id]
return weapon != nil ? weapon.battle_actions : BattleActions::Actions["通常攻撃"]
end
#--------------------------------------------------------------------------
# ● 武器アニメーション取得
#--------------------------------------------------------------------------
def weapon_anime1
weapon = $data_weapons[@weapon_id]
return weapon != nil ? weapon.icon_name : ""
end
#--------------------------------------------------------------------------
# ● 武器アニメーション取得
#--------------------------------------------------------------------------
def weapon_anime2
weapon = $data_weapons[@weapon2_id]
return weapon != nil ? weapon.icon_name : ""
end
#--------------------------------------------------------------------------
# ● 遠距離アニメーション取得
#--------------------------------------------------------------------------
def flying_anime1
weapon = $data_weapons[@weapon_id]
return weapon != nil ? weapon.flying_anime : [0,0,false,false]
end
#--------------------------------------------------------------------------
# ● 遠距離アニメーション取得
#--------------------------------------------------------------------------
def flying_anime2
weapon = $data_weapons[@weapon2_id]
return weapon != nil ? weapon.flying_anime : [0,0,false,false]
end
#--------------------------------------------------------------------------
# ● 移動目標座標の計算
#--------------------------------------------------------------------------
def move_setup
if RTAB
targets = @target
else
targets = $scene.target_battlers
end
case @move_action[0]
when "self" # 自分
@target_x = self.base_x
@target_y = self.base_y
when "target_near" # 一番近くのターゲット
targets.sort!{|a,b| a.screen_x<=>b.screen_x }
targets.reverse!
if targets != []
@target_x = targets[0].screen_x
@target_y = targets[0].screen_y
else
@target_x = self.base_x
@target_y = self.base_y
end
when "target_far" # 一番遠くのターゲット
targets.sort!{|a,b| a.screen_x<=>b.screen_x }
if targets != []
@target_x = targets[0].screen_x
@target_y = targets[0].screen_y
else
@target_x = self.base_x
@target_y = self.base_y
end
when "target" # ターゲット中央
@target_x = 0
@target_y = 0
for t in targets
@target_x += t.screen_x
@target_y += t.screen_y
end
if targets != []
@target_x /= targets.size
@target_y /= targets.size
end
when "troop" # "トループ中央"
@target_x = 0
@target_y = 0
for t in $game_troop.enemies
@target_x += t.screen_x
@target_y += t.screen_y
end
if $game_troop.enemies != []
@target_x /= $game_troop.enemies.size
@target_y /= $game_troop.enemies.size
end
when "party" # "パーティ中央"
@target_x = 0
@target_y = 0
for t in $game_party.actors
@target_x += t.screen_x
@target_y += t.screen_y
end
if $game_party.actors != []
@target_x /= $game_party.actors.size
@target_y /= $game_party.actors.size
end
when "screen" # "画面"
@target_x = self.base_x
@target_y = self.base_y
end
# 補正
@target_x += @move_action[1] - self.base_x
@target_y += @move_action[2] - self.base_y
# 移動目標の座標をセット
@move_coordinates = [@target_x.to_i,@target_y.to_i,@move_coordinates[0],@move_coordinates[1]]
# 距離の計算(ウエイトの設定)
@move_wait = (@move_coordinates[2] - @move_coordinates[0]).abs +
(@move_coordinates[3] - @move_coordinates[1]).abs
end
end
#==============================================================================
# ■ Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# ● セットアップ
#--------------------------------------------------------------------------
alias side_view_initialize initialize
def initialize(troop_id, member_index)
side_view_initialize(troop_id, member_index)
start_battle
end
#--------------------------------------------------------------------------
# ● 移動
#--------------------------------------------------------------------------
def move
# 距離の計算
@move_distance = (@move_coordinates[2] - @move_coordinates[0]).abs +
(@move_coordinates[3] - @move_coordinates[1]).abs
if @move_distance > 0
return if @ox == @move_coordinates[0] and @oy == @move_coordinates[1]
array = @move_coordinates
# ジャンプ補正値の計算
if @move_distance - @move_wait > @move_distance / 2
jump = (@move_action[4] * @move_wait / @move_distance.to_f)**2
else
jump = (@move_action[4] * (@move_distance - @move_wait) / @move_distance.to_f)**2
end
jump = @move_action[4] > 0 ? -jump : jump
@ox = (array[2] + 1.0 * (array[0] - array[2]) * (@move_distance - @move_wait) / @move_distance.to_f).to_i
@oy = (array[3] + 1.0 * (array[1] - array[3]) * (@move_distance - @move_wait) / @move_distance.to_f + jump).to_i
# ウエイト
@move_wait -= @move_action[3]
@move_wait = [@move_wait,0].max
end
end
#--------------------------------------------------------------------------
# ● 移動目標座標の計算
#--------------------------------------------------------------------------
def move_setup
if RTAB
targets = @target
else
targets = $scene.target_battlers
end
case @move_action[0]
when "self" # 自分
@target_x = self.base_x
@target_y = self.base_y
when "target_near" # 一番近くのターゲット
targets.sort!{|a,b| a.screen_x<=>b.screen_x }
if targets != []
@target_x = targets[0].screen_x
@target_y = targets[0].screen_y
else
@target_x = self.base_x
@target_y = self.base_y
end
when "target_far" # 一番遠くのターゲット
targets.sort!{|a,b| a.screen_x<=>b.screen_x }
targets.reverse!
if targets != []
@target_x = targets[0].screen_x
@target_y = targets[0].screen_y
else
@target_x = self.base_x
@target_y = self.base_y
end
when "target" # ターゲット中央
@target_x = 0
@target_y = 0
for t in targets
@target_x += t.screen_x
@target_y += t.screen_y
end
if targets != []
@target_x /= targets.size
@target_y /= targets.size
end
when "party" # "トループ中央"
@target_x = 0
@target_y = 0
for t in $game_troop.enemies
@target_x += t.screen_x
@target_y += t.screen_y
end
if $game_troop.enemies != []
@target_x /= $game_troop.enemies.size
@target_y /= $game_troop.enemies.size
end
when "troop" # "パーティ中央"
@target_x = 0
@target_y = 0
for t in $game_party.actors
@target_x += t.screen_x
@target_y += t.screen_y
end
if $game_party.actors != []
@target_x /= $game_party.actors.size
@target_y /= $game_party.actors.size
end
when "screen" # "画面"
@target_x = self.base_x
@target_y = self.base_y
end
# 補正
@target_x -= @move_action[1] + self.base_x
@target_y -= @move_action[2] + self.base_y
# 移動目標の座標をセット
@move_coordinates = [@target_x.to_i,@target_y.to_i,@move_coordinates[0],@move_coordinates[1]]
# 距離の計算(ウエイトの設定)
@move_wait = (@move_coordinates[2] - @move_coordinates[0]).abs +
(@move_coordinates[3] - @move_coordinates[1]).abs
end
if RTAB
alias original_x true_x
alias original_y true_y
else
alias original_x screen_x
alias original_y screen_y
end
#--------------------------------------------------------------------------
# ● バトル画面 X 座標の取得(カメラ補正無し)
#--------------------------------------------------------------------------
def true_x
return original_x + @ox
end
#--------------------------------------------------------------------------
# ● バトル画面 Y 座標の取得(カメラ補正無し)
#--------------------------------------------------------------------------
def true_y
return original_y - @height / 2 + @oy
end
#--------------------------------------------------------------------------
# ● バトル画面 X 座標の取得
#--------------------------------------------------------------------------
def screen_x(true_x = self.true_x)
return true_x * @real_zoom + @real_x
end
#--------------------------------------------------------------------------
# ● バトル画面 Y 座標の取得
#--------------------------------------------------------------------------
def screen_y(true_y = self.true_y)
return true_y * @real_zoom + @real_y
end
#--------------------------------------------------------------------------
# ● バトル画面 X 座標の取得(移動などしていない場合)
#--------------------------------------------------------------------------
def base_x(true_x = self.true_x)
return (true_x - @ox) * @real_zoom + @real_x
end
#--------------------------------------------------------------------------
# ● バトル画面 Y 座標の取得(移動などしていない場合)
#--------------------------------------------------------------------------
def base_y(true_y = self.true_y)
return (true_y - @oy) * @real_zoom + @real_y
end
end
#==============================================================================
# ■ Game_Party
#==============================================================================
class Game_Party
#--------------------------------------------------------------------------
# ● アクターを加える
# actor_id : アクター ID
#--------------------------------------------------------------------------
alias side_view_add_actor add_actor
def add_actor(actor_id)
# アクターを取得
actor = $game_actors[actor_id]
# サイドビューデータの初期化
actor.start_battle
# 戻す
side_view_add_actor(actor_id)
end
end
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle
include Side_view
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_reader :phase # フェーズ
attr_reader :phase4_step # フェーズ4ステップ
attr_reader :active_battler # 対象の配列
attr_reader :target_battlers # 対象の配列
attr_reader :animation1_id # 行動アニメID
attr_reader :animation2_id # 対象アニメID
#--------------------------------------------------------------------------
# ● メイン処理
#--------------------------------------------------------------------------
alias side_view_main main
def main
# バトラー初期化
for battler in $game_party.actors + $game_troop.enemies
battler.start_battle
end
# 戻す
side_view_main
end
#--------------------------------------------------------------------------
# ● 閃き判定
#--------------------------------------------------------------------------
def flash?
return @flash_flag ? true : false
end
#--------------------------------------------------------------------------
# ● 閃きアニメ待ち時間取得
#--------------------------------------------------------------------------
def flash_duration
animation = nil
if FLASH_ANIME
animation = $data_animations[FLASH_ANIMATION_ID]
end
return animation != nil ? animation.frame_max * 2 + 2 : 0
end
#--------------------------------------------------------------------------
# ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)
#--------------------------------------------------------------------------
alias side_view_update_phase4_step2 update_phase4_step2
def update_phase4_step2(*arg)
battler = convert_battler2(*arg)
battler.action
side_view_update_phase4_step2(*arg)
end
#--------------------------------------------------------------------------
# ● フレーム更新 (メインフェーズ ステップ 3 : 行動側アニメーション)
#--------------------------------------------------------------------------
alias side_view_update_phase4_step3 update_phase4_step3
def update_phase4_step3(*arg)
battler = convert_battler2(*arg)
return if !battler.animation1_on and battler.action? and !battler.flash?
if battler.flash? and FLASH_ANIME
battler.flash_flag["normal"] = true
end
side_view_update_phase4_step3(*arg)
end
#--------------------------------------------------------------------------
# ● フレーム更新 (メインフェーズ ステップ 4 : 対象側アニメーション)
#--------------------------------------------------------------------------
alias side_view_update_phase4_step4 update_phase4_step4
def update_phase4_step4(*arg)
battler = convert_battler2(*arg)
targets = RTAB ? battler.target : @target_battlers
return if !battler.animation2_on and battler.action?
side_view_update_phase4_step4(*arg)
for target in targets
if RTAB
value = nil
if target.damage_sp.include?(battler)
value = target.damage_sp[battler]
end
if target.damage.include?(battler)
if value == nil or value == "Miss"
value = target.damage[battler]
elsif value.is_a?(Numeric) && value > 0
value = target.damage[battler] == "Miss" ? value : target.damage[battler]
end
end
else
value = target.damage
end
if target.is_a?(Game_Actor)
# ダメージの場合
if value.is_a?(Numeric) && value > 0
# シェイクを開始
target.shake = true
end
elsif target.is_a?(Game_Enemy)
# ダメージの場合
if value.is_a?(Numeric) && value > 0
# シェイクを開始
target.shake = true
end
end
end
end
#--------------------------------------------------------------------------
# ● プレバトルフェーズ開始
#--------------------------------------------------------------------------
alias start_phase1_correct start_phase1
def start_phase1
# カメラの設定
# 元々フロントビュー向けの数値になっているため
@zoom_rate = [1.0, 1.0]
start_phase1_correct
end
#--------------------------------------------------------------------------
# ● アクターコマンドフェーズ開始
#--------------------------------------------------------------------------
alias start_phase3_correct start_phase3
def start_phase3
battler = convert_battler
start_phase3_correct
if RTAB
# カメラの設定
# 元々フロントビュー向けの数値になっているため
@camera = "command"
@spriteset.screen_target(0, 0, 1.0)
end
end
end
class Spriteset_Battle
include Side_view
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias side_veiw_initialize initialize
def initialize
side_veiw_initialize
# アクタースプライトを解放
for sprite in @actor_sprites
sprite.dispose
end
# アクタースプライトを作成
@actor_sprites = []
for i in 1..Party_max
@actor_sprites.push(Sprite_Battler.new(@viewport1))
end
update
end
#--------------------------------------------------------------------------
# ● 画面のスクロール
#--------------------------------------------------------------------------
if method_defined?("screen_scroll")
alias side_view_screen_scroll screen_scroll
def screen_scroll
side_view_screen_scroll
# アクターの位置補正
for actor in $game_party.actors
actor.real_x = @real_x
actor.real_y = @real_y
actor.real_zoom = @real_zoom
end
end
end
end
class Sprite_Battler < RPG::Sprite
include Side_view
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# viewport : ビューポート
# battler : バトラー (Game_Battler)
#--------------------------------------------------------------------------
def initialize(viewport, battler = nil)
super(viewport)
@battler = battler
@battler_visible = false
@weapon = Sprite_Weapon.new(viewport, battler)
@flying = Sprite_Flying.new(viewport, battler)
@shadow = []
@fly = 0
@fly_direction = 1
@rand = rand(10)
self.effect_clear
end
#--------------------------------------------------------------------------
# ● 解放
#--------------------------------------------------------------------------
alias side_view_dispose dispose
def dispose
side_view_dispose
@weapon.dispose
@flying.dispose
if @_target_sprite != nil
@_target_sprite.bitmap.dispose
@_target_sprite.dispose
@_target_sprite = nil
end
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
super
# バトラーが nil の場合
if @battler == nil
self.bitmap = nil
@weapon.bitmap = nil
loop_animation(nil)
return
end
# バトラー更新
@battler.update
# バトラーアニメのデータ取得
@anime_type = @battler.anime_type
# ファイル名か色相が現在のものと異なる場合
if @battler.is_a?(Game_Actor)
change = (@battler.character_name != @battler_name or @battler.character_hue != @battler_hue)
elsif @battler.is_a?(Game_Enemy)
change = (@battler.battler_name != @battler_name or @battler.battler_hue != @battler_hue)
else
return
end
if change
# ビットマップを取得、設定
if @battler.is_a?(Game_Actor)
@battler_name = @battler.character_name
@battler_hue = @battler.character_hue
self.bitmap = RPG::Cache.character(@battler_name, @battler_hue)
@width = bitmap.width / 4
@height = bitmap.height / 4
else
@battler_name = @battler.battler_name
@battler_hue = @battler.battler_hue
self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
@width = bitmap.width
@height = bitmap.height
end
self.ox = @width / 2
self.oy = @height / 2
@battler.height = @height
@flag = true
# 戦闘不能または隠れ状態なら不透明度を 0 にする
if @battler.dead? or @battler.hidden
self.opacity = 0
end
end
if @battler.is_a?(Game_Actor) and
(@battler.anime_type != @anime_type or @battler.pattern != @pattern or @flag)
# ビットマップを取得、設定
@pattern = @battler.pattern
self.ox = @width / 2
self.oy = @height / 2
@sx = @pattern * @width
@sy = @anime_type % 4 * @height
self.src_rect.set(@sx, @sy, @width, @height)
self.zoom_x = CHAR_ZOOM
self.zoom_y = CHAR_ZOOM
@battler.height = @height
@flag = false
end
# 飛行
update_fly
# シェイク
update_shake
# 回転
update_turning
# 反転
update_reverse
# 移動
update_moving
# 追加アニメ
update_add_anime
# エフェクト効果の適用
update_effect
# アニメーション ID が現在のものと異なる場合
flag = RTAB ? true : @battler.damage == nil
if flag and @battler.state_animation_id != @state_animation_id
@state_animation_id = @battler.state_animation_id
loop_animation($data_animations[@state_animation_id])
end
# シェイク
if @battler.shake
self.start_shake(5, 5, 5)
@battler.shake = false
end
# 明滅
if @battler.blink
blink_on
else
blink_off
end
# 不可視の場合
unless @battler_visible
flag = RTAB ? (@battler.damage.size < 2 or @battler.damage_pop.size < 2) :
(@battler.damage == nil or @battler.damage_pop)
# 出現
if not @battler.hidden and not @battler.dead? and flag
appear
@battler_visible = true
end
end
if RTAB
# ダメージ
for battler in @battler.damage_pop
if battler[0].class == Array
if battler[0][1] >= 0
$scene.skill_se
else
$scene.levelup_se
end
damage(@battler.damage[battler[0]], false, 2)
else
damage(@battler.damage[battler[0]], @battler.critical[battler[0]])
end
if @battler.damage_sp.include?(battler[0])
damage(@battler.damage_sp[battler[0]],
@battler.critical[battler[0]], 1)
@battler.damage_sp.delete(battler[0])
end
@battler.damage_pop.delete(battler[0])
@battler.damage.delete(battler[0])
@battler.critical.delete(battler[0])
end
end
# 可視の場合
if @battler_visible
# 武器アニメ
@weapon.battler = @battler
@weapon.update
# 遠距離アニメ
@flying.battler = @battler
@flying.update
# 逃走
if @battler.hidden
$game_system.se_play($data_system.escape_se)
escape
@battler_visible = false
end
# 白フラッシュ
if @battler.white_flash
whiten
@battler.white_flash = false
end
if RTAB
# アニメーション
if !@battler.animation.empty?
for animation in @battler.animation.reverse
if animation[2]
animation($data_animations[animation[0]], animation[1], true)
else
animation($data_animations[animation[0]], animation[1])
end
@battler.animation.delete(animation)
end
end
else
# アニメーション
if @battler.animation_id != 0
animation = $data_animations[@battler.animation_id]
animation(animation, @battler.animation_hit)
@battler.animation_id = 0
end
end
# ダメージ
if !RTAB and @battler.damage_pop
damage(@battler.damage, @battler.critical)
@battler.damage = nil
@battler.critical = false
@battler.damage_pop = false
end
flag = RTAB ? (@battler.damage.empty? and $scene.dead_ok?(@battler)) :
@battler.damage == nil
# コラプス
if flag and @battler.dead?
if @battler.is_a?(Game_Actor)
$game_system.se_play($data_system.actor_collapse_se)
elsif @battler.is_a?(Game_Enemy)
$game_system.se_play($data_system.enemy_collapse_se)
end
collapse
@battler_visible = false
end
end
# スプライトの座標を設定
self.x = @battler.screen_x + @effect_ox
self.y = @battler.screen_y + @effect_oy
self.z = @battler.screen_z
self.zoom_x = @battler.real_zoom
self.zoom_y = @battler.real_zoom
# ウェイトカウントを減らす
@battler.wait_count -= 1
@battler.wait_count2 -= 1
# アニメーション待ち時間取得
@battler.animation_duration = @_animation_duration
if @battler.is_a?(Game_Actor)
self.zoom_x *= CHAR_ZOOM
self.zoom_y *= CHAR_ZOOM
@weapon.x = self.x + 2
@weapon.y = self.y + 6
@weapon.angle = 75 - (4 - @battler.pattern) * 45
if self.mirror
@weapon.angle += @weapon.angle - 180
end
end
# 残像
if @battler.shadow
if Graphics.frame_count % 2 == 0
shadow = ::Sprite.new(self.viewport)
shadow.bitmap = self.bitmap.dup
shadow.x = self.x
shadow.y = self.y
shadow.ox = self.ox
shadow.oy = self.oy
shadow.mirror = self.mirror
shadow.angle = self.angle
shadow.opacity = 160
shadow.zoom_x = self.zoom_x
shadow.zoom_y = self.zoom_y
if @battler.is_a?(Game_Actor)
shadow.src_rect.set(@sx, @sy, @width, @height)
else
shadow.src_rect.set(0, 0, @width, @height)
end
@shadow.push([shadow,duration = 10,@battler.true_x + @effect_ox,@battler.true_y + @effect_oy])
end
end
for s in @shadow
if !s[0].disposed?
s[0].update
s[1] -= 1
if s[1] < 1
if s[0].bitmap != nil
s[0].bitmap.dispose
end
s[0].dispose
else
s[0].x = @battler.screen_x(s[2])
s[0].y = @battler.screen_y(s[3])
end
else
s = nil
end
end
@shadow.compact!
end
#--------------------------------------------------------------------------
# ● エフェクトによる座標系の更新
#--------------------------------------------------------------------------
def update_effect
# 角度の修正
if @_upside_down
self.angle = (@_turning + 180) % 360
else
self.angle = @_turning
end
# X 座標の修正値
@effect_ox = @_shake + @_moving[0]
# Y 座標の修正値
@effect_oy = -@fly + @_moving[1]
if @_animation == nil or (RTAB and @_animation.empty?)
self.effect_clear
end
end
#--------------------------------------------------------------------------
# ● シェイク更新
#--------------------------------------------------------------------------
def update_shake
if @_shake_duration >= 1 or @_shake != 0
delta = (@_shake_power * @_shake_speed * @_shake_direction) / 10.0
if @_shake_duration <= 1 and @_shake * (@_shake + delta) < 0
@_shake = 0
else
@_shake += delta
end
if @_shake > @_shake_power * 2
@_shake_direction = -1
end
if @_shake < - @_shake_power * 2
@_shake_direction = 1
end
if @_shake_duration >= 1
@_shake_duration -= 1
end
end
end
#--------------------------------------------------------------------------
# ● 飛行更新
#--------------------------------------------------------------------------
def update_fly
if @rand > 0
@rand -= 1
return
end
if @battler.fly != 0
if @fly < @battler.fly / 4
@fly_direction = 1
elsif @fly > @battler.fly / 2
@fly_direction = -1
end
@fly += 0.5 * @fly_direction
end
end
#--------------------------------------------------------------------------
# ● 回転更新
#--------------------------------------------------------------------------
def update_turning
if @_turning_duration > 0 or @_turning != 0
@_turning += @_turning_direction * @_turning_speed / 2.0
# 残り回転数を減らす
if @_turning_direction == -1
if @_turning_duration > 0 and @_turning < 0
@_turning_duration -= 1
end
elsif @_turning_direction == 1
if @_turning_duration > 0 and @_turning >= 360
@_turning_duration -= 1
end
end
# 以下補正
while @_turning < 0
@_turning += 360
end
if @_turning_duration <= 0
@_turning = 0
end
@_turning %= 360
end
end
#--------------------------------------------------------------------------
# ● 左右反転更新
#--------------------------------------------------------------------------
def update_reverse
if @last_reverse != (@_reverse or @battler.reverse)
self.mirror = (@_reverse or @battler.reverse)
@last_reverse = (@_reverse or @battler.reverse)
end
end
#--------------------------------------------------------------------------
# ● 移動更新
#--------------------------------------------------------------------------
def update_moving
@move_distance = (@_move_coordinates[2] - @_move_coordinates[0]).abs +
(@_move_coordinates[3] - @_move_coordinates[1]).abs
if @move_distance > 0
return if @_moving[0] == @_move_coordinates[0] and @_moving[1] == @_move_coordinates[1]
array = @_move_coordinates
x = (array[2] + 1.0 * (array[0] - array[2]) * (@move_distance - @_move_duration) / @move_distance.to_f).to_i
y = (array[3] + 1.0 * (array[1] - array[3]) * (@move_distance - @_move_duration) / @move_distance.to_f).to_i
@_moving = [x, y]
if @_move_quick_return and @_move_duration == 0
@_move_coordinates = [0,0,array[0],array[1]]
@_move_duration = @move_distance
end
@_move_duration -= @_move_speed
@_move_duration = [@_move_duration, 0].max
end
end
#--------------------------------------------------------------------------
# ● 追加アニメ更新 (RTAB限定機能)
#--------------------------------------------------------------------------
def update_add_anime
if RTAB
# アニメーション
if @_add_anime_id != 0
animation = $data_animations[@_add_anime_id]
animation(animation, true)
@_add_anime_id = 0
end
end
end
#--------------------------------------------------------------------------
# ● エフェクト初期化
#--------------------------------------------------------------------------
def effect_clear
@_effect_ox = 0
@_effect_oy = 0
@_shake_power = 0
@_shake_speed = 0
@_shake_duration = 0
@_shake_direction = 1
@_shake = 0
@_upside_down = false
@_reverse = false
@_turning_direction = 1
@_turning_speed = 0
@_turning_duration = 0
@_turning = 0
@_move_quick_return = true
@_move_speed = 0
@_move_coordinates = [0,0,0,0]
@_move_jump = false
@_move_duration = 0
@_moving = [0,0]
@_add_anime_id = 0
end
#--------------------------------------------------------------------------
# ● シェイクの開始
# power : 強さ
# speed : 速さ
# duration : 時間
#--------------------------------------------------------------------------
def start_shake(power, speed, duration)
@_shake_power = power
@_shake_speed = speed
@_shake_duration = duration
end
#--------------------------------------------------------------------------
# ● 上下反転を開始
#--------------------------------------------------------------------------
def start_upside_down
@_upside_down = @_upside_down ? false : true
end
#--------------------------------------------------------------------------
# ● 左右反転を開始
#--------------------------------------------------------------------------
def start_reverse
@_reverse = @_reverse ? false : true
end
#--------------------------------------------------------------------------
# ● 回転を開始
# direction: 方向
# speed : 速さ
# duration : 時間
#--------------------------------------------------------------------------
def start_turning(direction, speed, duration)
@_turning_direction = direction
@_turning_speed = speed
@_turning_duration = duration
@_turning = @_turning_direction == 1 ? 0 : 360
end
#--------------------------------------------------------------------------
# ● 移動を開始
# quick_return : 戻るかどうか
# speed : 速さ
# x : X 座標
# y : Y 座標
#--------------------------------------------------------------------------
def start_moving(quick_return, speed, x, y)
@_move_quick_return = quick_return == 0 ? false : true
@_move_speed = speed
@_move_coordinates = [x,y,@_move_coordinates[0],@_move_coordinates[1]]
distance = (@_move_coordinates[2] - @_move_coordinates[0]).abs +
(@_move_coordinates[3] - @_move_coordinates[1]).abs
@_move_duration = distance
end
#--------------------------------------------------------------------------
# ● アニメ追加を開始
# id : ID
# hit : 命中フラッグ
#--------------------------------------------------------------------------
def start_add_anime(id)
@_add_anime_id = id
end
#--------------------------------------------------------------------------
# ● 各種エフェクトの開始判定
#--------------------------------------------------------------------------
if !method_defined?("side_view_animation_process_timing")
alias side_view_animation_process_timing animation_process_timing
end
def animation_process_timing(timing, hit)
side_view_animation_process_timing(timing, hit)
if (timing.condition == 0) or
(timing.condition == 1 and hit == true) or
(timing.condition == 2 and hit == false)
if timing.se.name =~ SHAKE_FILE
names = timing.se.name.split(/#/)
power = names[1].nil? ? SHAKE_POWER : names[1].to_i
speed = names[2].nil? ? SHAKE_SPEED : names[2].to_i
duration = names[3].nil? ? SHAKE_DURATION : names[3].to_i
# シェイクを開始
self.start_shake(power, speed, duration)
end
if timing.se.name == UPSIDE_DOWN_FILE
# 上下反転を開始
self.start_upside_down
end
if timing.se.name == REVERSE_FILE
# 左右反転を開始
self.start_reverse
end
if timing.se.name =~ TURNING_FILE
names = timing.se.name.split(/#/)
direction = names[1].nil? ? TURNING_DIRECTION : names[1].to_i
speed = names[2].nil? ? TURNING_SPEED : names[2].to_i
duration = names[3].nil? ? TURNING_DURATION : names[3].to_i
# 回転を開始
self.start_turning(direction, speed, duration)
end
if timing.se.name =~ MOVE_FILE
names = timing.se.name.split(/#/)
quick_return= names[1].nil? ? MOVE_RETURN : names[1].to_i
speed = names[2].nil? ? MOVE_SPEED : names[2].to_i
x = names[3].nil? ? MOVE_COORDINATES[0] : names[3].to_i
y = names[3].nil? ? MOVE_COORDINATES[1] : names[4].to_i
# 移動を開始
self.start_moving(quick_return, speed, x, y)
end
if timing.se.name =~ ADD_ANIME_FILE
names = timing.se.name.split(/#/)
id = names[1].nil? ? ADD_ANIME_ID : names[1].to_i
# アニメ追加を開始
self.start_add_anime(id)
end
end
end
end
#==============================================================================
# ■ Sprite_Weapon
#------------------------------------------------------------------------------
# バトラー表示用のスプライトです。Game_Battler クラスのインスタンスを監視し、
# スプライトの状態を自動的に変化させます。
#==============================================================================
class Sprite_Weapon < RPG::Sprite
include Side_view
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :battler # バトラー
attr_reader :cw # グラフィックの幅
attr_reader :ch # グラフィックの高さ
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# viewport : ビューポート
# battler : バトラー (Game_Battler)
#--------------------------------------------------------------------------
def initialize(viewport, battler = nil)
super(viewport)
@battler = battler
@battler_visible = false
end
#--------------------------------------------------------------------------
# ● 解放
#--------------------------------------------------------------------------
def dispose
if self.bitmap != nil
self.bitmap.dispose
end
super
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
super
# バトラーが nil の場合
if @battler == nil or !@battler.is_a?(Game_Actor)
self.bitmap = nil
return
end
# ウエポンアニメのデータ取得
@weapon_anime_type = @battler.weapon_anime_type(@battler.condition)
# 設定が「非表示」の場合
if !@weapon_anime_type[1] or @weapon_anime_type[0].nil?
self.visible = false
return
else
self.visible = true
end
# ファイル名が現在のものと異なる場合
if @weapon_anime_type[0] != @weapon_name
@weapon_name = @weapon_anime_type[0]
# ビットマップを取得、設定
self.bitmap = RPG::Cache.icon(@weapon_name)
@width = bitmap.width
@height = bitmap.height
@flag = true
end
# 現在アニメパターンが現在のものと異なる場合
if @pattern != @battler.pattern or @flag or @condition != @battler.condition
@pattern = @battler.pattern
@condition = @battler.condition
self.ox = @width
self.oy = @height
self.z = battler.screen_z
self.zoom_x = @battler.real_zoom * CHAR_ZOOM
self.zoom_y = @battler.real_zoom * CHAR_ZOOM
self.src_rect.set(0, 0, @width, @height)
self.opacity = 255
# バトラーより手前に表示
if @weapon_anime_type[2]
self.z += 10
# バトラーより奥に表示
else
self.z -= 10
end
@flag = false
end
end
end
#==============================================================================
# ■ Sprite_Flying
#------------------------------------------------------------------------------
# バトラー表示用のスプライトです。Game_Battler クラスのインスタンスを監視し、
# スプライトの状態を自動的に変化させます。
#==============================================================================
class Sprite_Flying < RPG::Sprite
include Side_view
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :battler # バトラー
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# viewport : ビューポート
# battler : バトラー (Game_Battler)
#--------------------------------------------------------------------------
def initialize(viewport, battler = nil)
super(viewport)
@battler = battler
@battler_visible = false
end
#--------------------------------------------------------------------------
# ● 解放
#--------------------------------------------------------------------------
def dispose
if self.bitmap != nil
self.bitmap.dispose
end
super
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
super
# バトラーが nil の場合
if @battler == nil
self.bitmap = nil
loop_animation(nil)
return
end
# 遠距離アニメ
flying_animation = @battler.flying_animation
flying_start = flying_animation[0]
flying_end = flying_animation[1]
# アニメーション ID が現在のものと異なる場合
if @anime_id != @battler.flying_anime[0]
@anime_id = @battler.flying_anime[0]
@animation = $data_animations[@anime_id]
end
# アニメーション 開始
if flying_start
loop_animation(@animation)
elsif flying_end
loop_animation(nil)
end
self.x = @battler.flying_x
self.y = @battler.flying_y
self.z = @battler.screen_z + 1000
end
end
module RPG
class Skill
#--------------------------------------------------------------------------
# ● 魔法かどうかの判断
#--------------------------------------------------------------------------
def magic?
if @atk_f == 0
return true
else
return false
end
end
end
end
# アローカーソルの位置修正
class Arrow_Actor < Arrow_Base
include Side_view
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
alias side_view_update update
def update
side_view_update
# スプライトの座標を設定
if self.actor != nil && (self.x != self.actor.screen_x + ARROW_OX or self.y != self.actor.screen_y + ARROW_OY)
self.x = self.actor.screen_x + ARROW_OX
self.y = self.actor.screen_y + ARROW_OY
end
end
end
class Arrow_Enemy < Arrow_Base
include Side_view
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
alias side_view_update update
def update
side_view_update
# スプライトの座標を設定
if self.enemy != nil && self.y != self.enemy.screen_y + self.enemy.height/2
self.x = self.enemy.screen_x
self.y = self.enemy.screen_y + self.enemy.height/2
end
end
end