class Window_Help2 < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
def initialize(line_number = 0)
super(0, 0, 255, 0)
self.z = 150
contents.font.size = 12
hide
end
#--------------------------------------------------------------------------
# ● 设置内容
#--------------------------------------------------------------------------
def set_text(text)
@text = text
refresh
end
#--------------------------------------------------------------------------
# ● 清除
#--------------------------------------------------------------------------
def clear
set_text("")
end
#--------------------------------------------------------------------------
# ● 更新帮助位置
#--------------------------------------------------------------------------
def uppos(index,rect,window)
self.height = fitting_height2(Equipplus.getline(@xtext,13))
create_contents
contents.font.size = 15
rect.x -= window.ox
rect.y -= window.oy
ax = rect.x + rect.width + 10
ax = rect.x - self.width + 10 if ax + self.width > window.width + 10
ax += window.x
ax = 0 if ax < 0
ay = rect.y + rect.height
ay = rect.y - self.height if ay + self.height > window.height
ay += window.y
ay = 0 if ay < 0
self.x = ax
self.y = ay
set_text(@xtext)
show
end
#--------------------------------------------------------------------------
# ● 设置物品
# item : 技能、物品等
#--------------------------------------------------------------------------
def set_item(item)
if item == nil
set_text("")
return
end
@xtext = ""
@xtext = "名称:" + item.name + "\n"
@xtext += "介绍:" + item.description + "\n"
@xtext += "价格:" + item.price.to_s + "\n" if item.is_a?(RPG::EquipItem) || item.is_a?(RPG::Item)
@xtext += "持有:" + $game_party.item_number(item).to_s + "\n" if item.is_a?(RPG::EquipItem) || item.is_a?(RPG::Item)
@xtext += Equipplus.getequiphelp(item) if item.is_a?(RPG::EquipItem)
@xtext = @xtext[0,@text.size - 2] if @xtext[@xtext.size - 2,2] == "\n"
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
contents.clear
hide if @text == ""
draw_text_ex(4, 0, @text,width,40,false)
end
end
class Window_Base < Window
#--------------------------------------------------------------------------
# ● 计算窗口显示指定行数时的应用高度2*************************
#--------------------------------------------------------------------------
def fitting_height2(line_number)
line_number * contents.font.size + standard_padding * 2
end
# draw_text_ex的增强,使其可以自动换行 原作者:叶子 修改:wyongcan
#--------------------------------------------------------------------------
# ● 绘制带有控制符的文本内容
# 如果传递了width参数的话,会自动换行
#--------------------------------------------------------------------------
def draw_text_ex(x, y, text, width = nil,textwidth = nil,normalfont = true)
reset_font_settings if normalfont == true
text = convert_escape_characters(text)
pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
if width != nil
pos[:height] = contents.font.size
pos[:width] = width
pos[:textwidth] = textwidth
end
process_character(text.slice!(0, 1), text, pos) until text.empty?
end
#--------------------------------------------------------------------------
# ● 文字的处理
# c : 文字
# text : 绘制处理中的字符串缓存(字符串可能会被修改)
# pos : 绘制位置 {:x, :y, :new_x, :height}
#--------------------------------------------------------------------------
def process_character(c, text, pos)
case c
when "\r" # 回车
return
when "\n" # 换行
process_new_line(text, pos)
when "\f" # 翻页
process_new_page(text, pos)
when "\e" # 控制符
process_escape_character(obtain_escape_code(text), text, pos)
else # 普通文字
pos[:textwidth] == nil ?text_width = text_size(c).width : text_width = pos[:textwidth]
if pos[:width] != nil && pos[:x] - pos[:new_x] +text_width > pos[:width]
process_new_line(text, pos)
end
process_normal_character(c, pos)
end
end
end
class Window_ItemList < Window_Selectable
#--------------------------------------------------------------------------
# ● 更新帮助内容
#--------------------------------------------------------------------------
def update_help
@help_window.set_item(item)
@help_window.uppos(index,item_rect(index),self) if index != -1 && item != nil
end
end
class Window_SkillList < Window_Selectable
#--------------------------------------------------------------------------
# ● 更新帮助内容
#--------------------------------------------------------------------------
def update_help
@help_window.set_item(item)
@help_window.uppos(index,item_rect(index),self) if index != -1 && item != nil
end
end
class Window_ShopBuy < Window_Selectable
#--------------------------------------------------------------------------
# ● 更新帮助内容
#--------------------------------------------------------------------------
def update_help
@help_window.set_item(item) if @help_window
@help_window.uppos(index,item_rect(index),self) if index != -1 && item != nil && @help_window
@status_window.item = item if @status_window
end
end
class Window_EquipSlot < Window_Selectable
#--------------------------------------------------------------------------
# ● 更新帮助内容
#--------------------------------------------------------------------------
def update_help
super
@help_window.set_item(item) if @help_window
@help_window.uppos(index,item_rect(index),self) if index != -1 && item != nil && @help_window
@status_window.set_temp_actor(nil) if @status_window
end
end
class Scene_Shop < Scene_MenuBase
alias on_sell_ok_old on_sell_ok
def on_sell_ok
on_sell_ok_old
@help_window.hide
end
alias on_buy_ok_old on_buy_ok
def on_buy_ok
on_buy_ok_old
@help_window.hide
end
alias on_number_ok_old on_number_ok
def on_number_ok
on_number_ok_old
@help_window.refresh
@help_window.show
end
alias on_number_cancel_old on_number_cancel
def on_number_cancel
on_number_cancel_old
@help_window.refresh
@help_window.show
end
end
class Scene_Title < Scene_Base
alias start_old start
def start
start_old
Equipplus.equiphelpready
end
end
class Scene_ItemBase < Scene_MenuBase
alias old_on_actor_cancel on_actor_cancel
def on_actor_cancel
old_on_actor_cancel
@help_window.refresh
end
alias old_on_actor_ok on_actor_ok
def on_actor_ok
old_on_actor_ok
@help_window.refresh
end
end
class Window_Base < Window
alias old_process_new_line process_new_line
def process_new_line(text, pos)
old_process_new_line(text, pos)
pos[:height] = contents.font.size if pos[:width] != nil
end
end
class Scene_MenuBase < Scene_Base
def create_help_window
@help_window = Window_Help2.new
@help_window.viewport = @viewport
end
end
class Scene_Battle < Scene_Base
def create_help_window
@help_window = Window_Help2.new
@help_window.visible = false
end
end
#==============================================================================
# ■ Scene_Item
#------------------------------------------------------------------------------
# 选项重新定义
#==============================================================================
class Window_ItemCommand < Window_Command
#--------------------------------------------------------------------------
# ● 添加指令
# color : 指令字体颜色
# icon_index: 指令图标
# name : 指令名称
# symbol : 对应的符号
# enabled : 有效状态的标志
# ext : 任意的扩展数据
#--------------------------------------------------------------------------
def add_command(name, symbol, enabled = true, color = Color.new(128, 255, 128) ,icon_index = 0 ,ext = nil)
@list.push({:color=>color, :icon_index=>icon_index, :name=>name, :symbol=>symbol, :enabled=>enabled, :ext=>ext})
end
#--------------------------------------------------------------------------
# ● 获取指令字体颜色
#--------------------------------------------------------------------------
def command_color(index)
@list[index][:color]
end
#--------------------------------------------------------------------------
# ● 获取指令图标
#--------------------------------------------------------------------------
def command_icon_index(index)
@list[index][:icon_index]
end
def draw_text_in_rect(rect, str,icon_index,enabled = true, align = 0)
draw_icon(icon_index, rect.x, rect.y, enabled)
if icon_index > 0
draw_text(rect.x + 24, rect.y, rect.width - 28, line_height,str)
else
draw_text(rect.x, rect.y, rect.width - 8, line_height,str)
end
end
#--------------------------------------------------------------------------
# ● 绘制项目
#--------------------------------------------------------------------------
def draw_item(index)
change_color(command_color(index), command_enabled?(index))
draw_text_in_rect(item_rect_for_text(index), command_name(index),command_icon_index(index))
end
end
#==============================================================================
# ■ Window_ItemCommand
#------------------------------------------------------------------------------
# 物品画面中,显示装备选项的窗口。
#==============================================================================
class Window_ItemCommand < Window_Command
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
def initialize(item)
@item = item
super(0,0)
end
#--------------------------------------------------------------------------
# ● 获取窗口的宽度
#--------------------------------------------------------------------------
def window_width
return 160
end
#--------------------------------------------------------------------------
# ● 获取列数
#--------------------------------------------------------------------------
def visible_line_number
return 4
end
def enable?
$game_party.usable?(@item)
end
#--------------------------------------------------------------------------
# ● 生成指令列表
#--------------------------------------------------------------------------
def make_command_list
add_command("使用物品", :use_item , enable?,Color.new(11,168,3) ,121)
add_command("卖出物品", :sell_item , true ,Color.new(252,236,15) ,361)
add_command("丢弃物品", :giveup_item, true ,Color.new(242,119,14) ,227)
add_command("返回上一层", :cancel , true ,Color.new(173,164,156))
end
#--------------------------------------------------------------------------
# ● 更新帮助位置
#--------------------------------------------------------------------------
def uppos(index,rect,window)
create_contents
clear_command_list
make_command_list
rect.x -= window.ox
rect.y -= window.oy
ax = rect.x + rect.width + 10
ax = rect.x - self.width + 10 if ax + self.width > window.width + 10
ax += window.x
ax = 0 if ax < 0
ay = rect.y + rect.height
ay = rect.y - self.height if ay + self.height > window.height
ay += window.y
ay = 0 if ay < 0
self.x = ax
self.y = ay
refresh
show
end
end
#==============================================================================
# ■ Window_ItemCategory
#------------------------------------------------------------------------------
# 物品画面和商店画面中,显示装备、所持物品等项目列表的窗口。
#==============================================================================
class Window_New_ItemCategory < Window_Command
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_reader :item_window
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
def initialize
super(0,72)
end
#--------------------------------------------------------------------------
# ● 获取窗口的宽度
#--------------------------------------------------------------------------
def window_width
return 168
end
#--------------------------------------------------------------------------
# ● 获取窗口的高度
#--------------------------------------------------------------------------
def window_height
return Graphics.height - 72
end
#--------------------------------------------------------------------------
# ● 更新画面
#--------------------------------------------------------------------------
def update
super
@item_window.category = current_symbol if @item_window
end
#--------------------------------------------------------------------------
# ● 生成指令列表
#--------------------------------------------------------------------------
def make_command_list
add_command("全部道具", :none)
add_command("全部物品", :item)
add_command("全部武器", :weapon)
add_command("全部防具", :armor)
add_command("消耗品", :use_item)
for i in 0 ... $kind_of_item.size
add_command($kind_of_item[i],("kind_"+i.to_s).to_sym)
end
add_command(Vocab::key_item, :key_item)
end
#--------------------------------------------------------------------------
# ● 设置物品窗口
#--------------------------------------------------------------------------
def item_window=(item_window)
@item_window = item_window
update
end
end
#==============================================================================
# ■ Window_ItemList
#------------------------------------------------------------------------------
# 物品画面中,显示持有物品的窗口。
#==============================================================================
class Window_ItemList2 < Window_ItemList
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
def initialize(x, y, width, height)
super
@category = :none
@data = []
end
#--------------------------------------------------------------------------
# ● 获取列数
#--------------------------------------------------------------------------
def col_max
return 12
end
#--------------------------------------------------------------------------
# ● 项目间隔
#--------------------------------------------------------------------------
def spacing
return 4
end
#--------------------------------------------------------------------------
# ● 获取选择项目的有效状态
#--------------------------------------------------------------------------
def current_item_enabled?
true
end
#--------------------------------------------------------------------------
# ● 查询列表中是否含有此物品
#--------------------------------------------------------------------------
def include?(item)
case @category
when :none
true if item
when :item
item.is_a?(RPG::Item) && !item.key_item?
when :use_item
item.is_a?(RPG::Item) && !item.key_item? && item.consumable
when :weapon
item.is_a?(RPG::Weapon)
when :armor
item.is_a?(RPG::Armor)
when :key_item
item.is_a?(RPG::Item) && item.key_item?
else
if item.is_a?(RPG::Item)
a = @category.to_s[5,2]
return true if item.class_id == a.to_i
else
false
end
end
end
#--------------------------------------------------------------------------
# ● 生成物品列表
#--------------------------------------------------------------------------
def make_item_list
@data = $game_party.all_items.select {|item| include?(item) }
@data.push(nil) if include?(nil)
end
#--------------------------------------------------------------------------
# ● 绘制项目
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
if item
rect = item_rect(index)
rect.width -= 4
draw_icon(item.icon_index, rect.x, rect.y, enable?(item))
end
end
end
#==============================================================================
# ■ Window_Control_Number
#------------------------------------------------------------------------------
# 物品选择数量画面
#==============================================================================
class Window_Control_Number < Window_ShopNumber
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_reader :number # 数量
#--------------------------------------------------------------------------
# ● 初始化
#--------------------------------------------------------------------------
def initialize(x,y,w,h)
@window_w = w
super(x,y,h)
end
#--------------------------------------------------------------------------
# ● 获取窗口的宽度
#--------------------------------------------------------------------------
def window_width
return @window_w
end
#--------------------------------------------------------------------------
# ● 计算窗口内容的宽度
#--------------------------------------------------------------------------
def contents_width
width - standard_padding * 2
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
contents.clear
draw_item_name(@item, 4, 0)
draw_number
draw_total_price
end
#--------------------------------------------------------------------------
# ● 绘制数量
#--------------------------------------------------------------------------
def draw_number
change_color(normal_color) # x = cursor_x - 28
draw_text(4, fitting_height(1)-12, 22, line_height, "×")
draw_text(32, fitting_height(1)-12, cursor_width - 4, line_height, @number, 2)
end
#--------------------------------------------------------------------------
# ● 绘制总价
#--------------------------------------------------------------------------
def draw_total_price
width = contents_width - 60
draw_currency_value(@price * @number, @currency_unit, 4, price_y + 8, width)
end
#--------------------------------------------------------------------------
# ● 更新光标
#--------------------------------------------------------------------------
def update_cursor
cursor_rect.set(32, fitting_height(1)-12, cursor_width - 4, line_height)
end
end
#==============================================================================
# ■ Scene_Item
#------------------------------------------------------------------------------
# 物品画面
#==============================================================================
class Scene_Item < Scene_ItemBase
#--------------------------------------------------------------------------
# ● 开始处理
#--------------------------------------------------------------------------
def start
super
@control_kind = :none
create_help_window
create_category_window
create_item_window
create_item_logo
end
#--------------------------------------------------------------------------
# ● 生成Logo
#--------------------------------------------------------------------------
def create_item_logo
@logo_window = Window_Base.new(0,0,@category_window.width,Graphics.height - @category_window.height)
@logo_window.draw_icon(264,4,0)
@logo_window.draw_text(28,0,@logo_window.width - 28,@logo_window.line_height,"我的包裹")
@logo_window.make_font_smaller
@logo_window.draw_text(4,26,@logo_window.width - 4,@logo_window.line_height,"道具数:"+$game_party.all_items.size.to_s)
@logo_window.make_font_bigger
@logo_window.viewport = @viewport
end
#--------------------------------------------------------------------------
# ● 刷新Logo
#--------------------------------------------------------------------------
def refresh_item_logo
@logo_window.contents.clear
@logo_window.draw_icon(264,4,0)
@logo_window.draw_text(28,0,@logo_window.width - 28,@logo_window.line_height,"我的包裹")
@logo_window.make_font_smaller
@logo_window.draw_text(4,26,@logo_window.width - 4,@logo_window.line_height,"道具数:"+$game_party.all_items.size.to_s)
@logo_window.make_font_bigger
@logo_window.viewport = @viewport
end
#--------------------------------------------------------------------------
# ● 生成控制数量
#--------------------------------------------------------------------------
def create_item_control_amount
x = 145
y = 140
w = Graphics.width - x * 2
h = Graphics.height - y * 2
@control_amount = Window_Control_Number.new(x,y,w,h)
@control_amount.viewport = @viewport
@control_amount.set_handler(:ok, method(:on_item_control))
@control_amount.set_handler(:cancel, method(:back_to_choose_item))
end
#--------------------------------------------------------------------------
# ● 生成物品控制窗口
#--------------------------------------------------------------------------
def create_item_control
@item_control = Window_ItemCommand.new(item)
@item_control.viewport = @viewport
@item_control.set_handler(:use_item, method(:on_item_use))
@item_control.set_handler(:sell_item, method(:sell_item))
@item_control.set_handler(:giveup_item,method(:giveup_item))
@item_control.set_handler(:cancel, method(:back_to_choose_item))
end
#--------------------------------------------------------------------------
# ● 生成物品分类窗口
#--------------------------------------------------------------------------
def create_category_window
@category_window = Window_New_ItemCategory.new
@category_window.viewport = @viewport
@category_window.help_window = @help_window
@category_window.set_handler(:ok, method(:on_category_ok))
@category_window.set_handler(:cancel, method(:return_scene))
@category_window.activate
end
#--------------------------------------------------------------------------
# ● 生成物品窗口
#--------------------------------------------------------------------------
def create_item_window
@item_window = Window_ItemList2.new(@category_window.width, 0, Graphics.width - @category_window.width, Graphics.height)
@item_window.help_window = @help_window
@item_window.viewport = @viewport
@item_window.set_handler(:ok, method(:on_item_ok))
@item_window.set_handler(:cancel, method(:on_item_cancel))
@category_window.item_window = @item_window
@item_window.refresh
end
#--------------------------------------------------------------------------
# ● 分类“确定”
#--------------------------------------------------------------------------
def on_category_ok
@item_window.activate
@item_window.select_last
end
#--------------------------------------------------------------------------
# ● 物品“确定”
#--------------------------------------------------------------------------
def on_item_ok
@help_window.hide
create_item_control
@item_control.uppos(@item_window.index,@item_window.item_rect(@item_window.index),@item_window)
@item_control.activate
end
#--------------------------------------------------------------------------
# ● 返回选择物品
#--------------------------------------------------------------------------
def back_to_choose_item
@control_amount.hide if @control_amount
@item_control.hide
@item_window.activate
end
#--------------------------------------------------------------------------
# ● 物品“取消”
#--------------------------------------------------------------------------
def on_item_cancel
@item_window.unselect
@category_window.activate
end
#--------------------------------------------------------------------------
# ● 播放使用物品声效
#--------------------------------------------------------------------------
def play_se_for_item
Sound.play_use_item
end
#--------------------------------------------------------------------------
# ● 卖出物品(选择数量)
#--------------------------------------------------------------------------
def sell_item
create_item_control_amount
@control_amount.set(item, max_sell, selling_price, currency_unit)
@control_amount.activate
@control_kind = :sell
end
#--------------------------------------------------------------------------
# ● 丢弃物品(选择数量)
#--------------------------------------------------------------------------
def giveup_item
create_item_control_amount
@control_amount.set(item, max_sell, 0, currency_unit)
@control_amount.activate
@control_kind = :giveup
end
#--------------------------------------------------------------------------
# ● 结束选择数量
#--------------------------------------------------------------------------
def on_item_control
case @control_kind
when :sell
do_sell(@control_amount.number)
when :giveup
do_giveup(@control_amount.number)
end
refresh_item_logo
@item_window.refresh
back_to_choose_item
end
#--------------------------------------------------------------------------
# ● 执行卖出
#--------------------------------------------------------------------------
def do_sell(number)
$game_party.gain_gold(number * selling_price)
$game_party.lose_item(item, number)
end
#--------------------------------------------------------------------------
# ● 执行丢弃
#--------------------------------------------------------------------------
def do_giveup(number)
$game_party.lose_item(item, number)
end
#--------------------------------------------------------------------------
# ● 获取货币单位
#--------------------------------------------------------------------------
def currency_unit
Vocab::currency_unit
end
#--------------------------------------------------------------------------
# ● 获取可以卖出的最大值
#--------------------------------------------------------------------------
def max_sell
$game_party.item_number(item)
end
#--------------------------------------------------------------------------
# ● 获取卖出价格
#--------------------------------------------------------------------------
def selling_price
item.price / 2
end
#--------------------------------------------------------------------------
# ● 使用物品(选择角色)
#--------------------------------------------------------------------------
def on_item_use
@item_control.hide
$game_party.last_item.object = item
determine_item
end
#--------------------------------------------------------------------------
# ● 使用物品
#--------------------------------------------------------------------------
def use_item
super
@item_window.redraw_current_item
refresh_item_logo
end
end 作者: 魔力的觉醒 时间: 2013-5-31 11:40
截图 就是把红色框子那你颜色调下 改成紫色 大神们 求帮忙啊!!!
还有……本人英文水平不好 开始写的时候才刚初二 有许多单词拼写不规范(如:饰品 写成 earring)
=end
#==============================================================================
# ■ MakeEquip
#------------------------------------------------------------------------------
# 模块:开发装备
#==============================================================================
module MakeEquip
# 子类型(可自由修改)
$weapon = ["刀刃","钝器","弓箭","拳套","法杖","其它"] # 武器
$armor = ["头盔","铠甲","魔甲","护腕","战靴","盾牌"] # 防具
$earring = ["头巾","耳环","项链","手鞠","戒指","腰饰","其它"] # 饰品
# 物品类别
$kind_of_item = ["普通布料","魔法布料","岩石","木料","金属","重金属","魔法金属","羽","宝石","其他"]
# 人气值(用途:开发成功后增加售价)(百分比)
$weapon_hot = [45,23,34,18,39,0 ,17]
$armor_hot = [21,51,43,37,19,30,0,9]
$earring_hot = [21,18,27,21,38,13,0,19]
# 设置相性(不会修改者可无视)
$weapon_xx = {
# 类 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ……
"刀刃" => [25 ,20 ,110 ,110 ,135 ,160 ,125 ,15 ,150 ,120 ,140 ,85 ,25 ,30 ],
"钝器" => [10 ,5 ,120 ,130 ,140 ,180 ,120 ,5 ,160 ,105 ,200 ,100 ,50 ,60 ],
"弓箭" => [50 ,50 ,30 ,120 ,45 ,40 ,60 ,140 ,145 ,150 ,135 ,145 ,120 ,140 ],
"拳套" => [105 ,110 ,120 ,72 ,120 ,145 ,140 ,35 ,165 ,175 ,125 ,35 ,15 ,25 ],
"法杖" => [10 ,20 ,30 ,120 ,25 ,15 ,150 ,65 ,180 ,70 ,100 ,135 ,135 ,165 ],
"其它" => [50 ,50 ,120 ,100 ,100 ,95 ,125 ,150 ,200 ,115 ,125 ,120 ,70 ,100 ],
#如需增加子类型
#从这里增加(格式:"子类型名称" => [相性1,2,3...15,16(或更多)])
#相性:对于物品的类型的相性
#例如:相性1 = 对1类别的物品的相性度 如此类推
#注意:"子类型名称" 要与 $weapon 同步
#下同:$armor_xx、$earring_xx 分别是“防具的相性”、“饰品的相性”
}
$armor_xx = {
# 类 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ……
"头盔" => [120 ,40 ,60 ,100 ,140 ,155 ,145 ,40 ,180 ,15 ,70 ,55 ,20 ,20 ],
"铠甲" => [110 ,85 ,50 ,90 ,150 ,160 ,165 ,5 ,200 ,10 ,75 ,50 ,15 ,20 ],
"魔甲" => [150 ,100 ,30 ,45 ,50 ,45 ,180 ,65 ,200 ,20 ,75 ,60 ,20 ,30 ],
"护腕" => [145 ,70 ,60 ,80 ,115 ,135 ,140 ,25 ,175 ,25 ,75 ,40 ,15 ,25 ],
"战靴" => [150 ,90 ,10 ,50 ,65 ,15 ,120 ,110 ,175 ,30 ,105 ,30 ,50 ,55 ],
"盾牌" => [25 ,5 ,50 ,60 ,140 ,180 ,125 ,5 ,160 ,5 ,115 ,100 ,110,125],
}
$earring_xx = {
# 类 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ……
"头巾" => [105,110,15 ,20 ,50 ,35 ,55 ,140 ,135 ,70 ,60 ,40 ,20 ,15 ],
"耳环" => [5 ,15 ,20 ,60 ,80 ,70 ,100,100 ,180 ,70 ,125 ,110,20 ,25 ],
"项链" => [10 ,15 ,10 ,50 ,120 ,115 ,150,115 ,170 ,60 ,100 ,95 ,25 ,20 ],
"手鞠" => [30 ,40 ,15 ,80 ,115 ,140 ,145,75 ,180 ,55 ,105 ,80 ,25 ,25 ],
"戒指" => [25 ,40 ,10 ,35 ,100 ,135 ,145,95 ,200 ,35 ,125 ,55 ,30 ,35 ],
"腰饰" => [70 ,80 ,20 ,50 ,70 ,45 ,90 ,155 ,135 ,30 ,120 ,60 ,35 ,35 ],
"其它" => [40 ,40 ,10 ,35 ,90 ,75 ,115,120 ,150 ,25 ,115 ,50 ,10 ,20 ],
}
@class = 0
@classes = 0
@item = nil
@equip = nil
UP_FLAG = 32 # 能力上升标志图片
ADDNAME = "name"
CLASS = "class"
USEABLE = "useable"
NEED_EXP = "exp"
ADD_EXP = "add"
NEXT_LEVEL = "next"
LOCK = "lock"
BASIC = "BASIC"
ADDPARAM = ["mhp","mmp","atk","def","mat","mdf","agi","luk"]
# 每个能力的名称(可修改)
ParamName = ["血量上限","魔法上限","物理破坏力","物理防御力","魔法破坏力","魔法防御力","灵巧值","幸运值"]
def self.get_or_save_ie(type=true,item,equip)
if type
ie = [@item,@equip]
return ie
else
@item = item
@equip = equip
return
end
end
def self.save_class(value)
@class = value
end
def self.get_class
return @class
end
def self.save_classes(value)
@classes = value
end
def self.get_classes
return @classes
end
end
class Scene_Title < Scene_Base
#--------------------------------------------------------------------------
# ● 指令“开始游戏”
#--------------------------------------------------------------------------
alias old command_new_game
def command_new_game
old
for i in 1...$data_weapons.size
$game_party.gain_item($data_weapons,-99,true)
end
for i in 1...$data_armors.size
$game_party.gain_item($data_armors,-99,true)
end
end
end
#==============================================================================
# ■ Scene_Make_Item
#------------------------------------------------------------------------------
# 开发装备
#==============================================================================
class Scene_Make_Item < Scene_MenuBase
include MakeEquip
attr_reader :equip
attr_reader :item
#--------------------------------------------------------------------------
# ● 开始
#--------------------------------------------------------------------------
def start
super
create_window
end
#--------------------------------------------------------------------------
# ● 生成指令窗口
#--------------------------------------------------------------------------
def create_window
create_make_choose_window
end
#--------------------------------------------------------------------------
# ● 帮助窗口
#--------------------------------------------------------------------------
def create_help_window
@help_window = Window_equip_imformation.new(@make_item_window.x,@make_choose_window.height,@make_item_window.width,Graphics.height - @make_choose_window.height - @make_item_window.height)
@help_window.viewport = @viewport
@make_item_window.help_window = @help_window
end
#--------------------------------------------------------------------------
# ● 选择类型窗口
#--------------------------------------------------------------------------
def create_make_choose_window
@make_choose_window = Window_make_choose.new(0,0)
@make_choose_window.height = 48
@make_choose_window.set_handler(:weapon ,method(:makeweapon))
@make_choose_window.set_handler(:armor ,method(:makearmor))
@make_choose_window.set_handler(:earring,method(:makeearring))
@make_choose_window.set_handler(:cancel ,method(:return_scene))
end
#--------------------------------------------------------------------------
# ● 选择子类型窗口
#--------------------------------------------------------------------------
def create_make_weapon_window
@make_window = Window_make_weapon.new(0,@make_choose_window.height,@make_item_window.x,Graphics.height - @make_choose_window.height)
@make_window.set_handler(:ok ,method(:choose_sonkind))
@make_window.set_handler(:cancel ,method(:return_to_choose_mainkind))
@make_window.help_window = @make_item_window
end
def create_make_armor_window
@make_window = Window_make_armor.new(0,@make_choose_window.height,@make_item_window.x,Graphics.height - @make_choose_window.height)
@make_window.set_handler(:ok ,method(:choose_sonkind))
@make_window.set_handler(:cancel ,method(:return_to_choose_mainkind))
@make_window.help_window = @make_item_window
end
def create_make_earring_window
@make_window = Window_make_earring.new(0,@make_choose_window.height,@make_item_window.x,Graphics.height - @make_choose_window.height)
@make_window.set_handler(:ok ,method(:choose_sonkind))
@make_window.set_handler(:cancel ,method(:return_to_choose_mainkind))
@make_window.help_window = @make_item_window
end
#--------------------------------------------------------------------------
# ● 装备列表
#--------------------------------------------------------------------------
def create_make_item_window # 装备列表
@make_item_window = Window_make_item.new#(@actor)
@make_item_window.x = 135 #@make_window.width #Graphics.width - @make_item_window.width
@make_item_window.y = Graphics.height - @make_item_window.height
@make_item_window.set_handler(:ok ,method(:make_item))
@make_item_window.set_handler(:cancel ,method(:close_make_item))
end
#--------------------------------------------------------------------------
# ● 物品列表
#--------------------------------------------------------------------------
def create_item_window # 物品列表
@item_window_help_text = Window_Text_Help.new(325,0,219,48)
@item_window_help_text.draw_help_text("选择材料开发装备")
@item_window = Window_item.new(325,48,219,368)#(@actor)
@item_window.set_handler(:ok ,method(:call_sure_make))
@item_window.set_handler(:cancel ,method(:back_to_equip_list))
@item_window.activate
end
#--------------------------------------------------------------------------
# ● 钱不够了
#--------------------------------------------------------------------------
def create_no_enough_gold
@no_gold_window = Window_Text_Help.new(162,182,220,48)
@no_gold_window.draw_help_text(" 金钱不足! ")
@no_gold_window.set_handler(:ok ,method(:return_scene))
@no_gold_window.set_handler(:cancel ,method(:return_scene))
@no_gold_window.activate
end
#--------------------------------------------------------------------------
# ● 确认框(是 则Call 另一场景)
#--------------------------------------------------------------------------
def create_sure_make_window # 确认
@sure_make_window = Window_sure_make.new#(@actor)
@sure_make_window.set_handler(:yes_make,method(:sure_make))
@sure_make_window.set_handler(:no_make ,method(:back_to_choose_item))
@sure_make_window.set_handler(:cancel ,method(:back_to_choose_item))
@sure_make_window.activate
end
#--------------------------------------------------------------------------
# ● 相性及详细窗口
#--------------------------------------------------------------------------
def create_make_imformation_window # 相性及详细窗口
@make_imformation_window = Window_make_imformation.new#(@actor)
@item_window.help_window = @make_imformation_window
@item_window.equip = @make_item_window.get_item
end
#--------------------------------------------------------------------------
# ● 关闭所有类型窗口
#--------------------------------------------------------------------------
def all_close
@make_window.hide
@make_window.deactivate
@make_choose_window.hide
@make_choose_window.deactivate
end
#--------------------------------------------------------------------------
# ● 选择类型
#--------------------------------------------------------------------------
def makeweapon
MakeEquip::save_classes(1)
@make_window.hide if @make_window
makeoneitem
create_make_weapon_window
@make_window.activate
end
def makearmor
MakeEquip::save_classes(2)
@make_window.hide if @make_window
makeoneitem
create_make_armor_window
@make_window.activate
end
def makeearring
MakeEquip::save_classes(3)
@make_window.hide if @make_window
makeoneitem
create_make_earring_window
@make_window.activate
end
#--------------------------------------------------------------------------
# ● 进入选择装备
#--------------------------------------------------------------------------
def makeoneitem
create_make_item_window
create_help_window
end
#--------------------------------------------------------------------------
# ● 选择装备
#--------------------------------------------------------------------------
def choose_sonkind
@make_item_window.activate
@make_item_window.index = 0
end
#--------------------------------------------------------------------------
# ● 选择父类型
#--------------------------------------------------------------------------
def return_to_choose_mainkind
@make_window.hide
@make_item_window.hide
@help_window.hide
@make_choose_window.activate
end
#--------------------------------------------------------------------------
# ● 关闭选择装备窗口?
#--------------------------------------------------------------------------
def close_make_item
@make_window.activate
end
#--------------------------------------------------------------------------
# ● 确认MakeItem?
#--------------------------------------------------------------------------
def make_item # 确认MakeItem
if @make_item_window.get_item
equip = @make_item_window.get_item
if equip.price > $game_party.gold
create_no_enough_gold
@help_window.hide
else
all_close
create_item_window
create_make_imformation_window
@help_window.hide
@make_item_window.hide
end
else
@make_item_window.activate
end
end
#--------------------------------------------------------------------------
# ● 选择好装备以及物品,call
#--------------------------------------------------------------------------
def call_sure_make
item = @item_window.item
if item
equip = @make_item_window.get_item
if equip.price + item.price > $game_party.gold
create_no_enough_gold
else
create_sure_make_window
end
else
$data_system.sounds[3].play
@item_window.activate
end
end
#--------------------------------------------------------------------------
# ● goto : Scene_Making_Imformation
#--------------------------------------------------------------------------
def sure_make
@item = @item_window.item
@equip = @item_window.equip
MakeEquip::get_or_save_ie(false,@item,@equip)
@make_item_window.deactivate
@make_item_window.close
@help_window.close
@sure_make_window.close
@make_window.close
@make_choose_window.close
SceneManager.goto(Scene_Making_Imformation)
end
#--------------------------------------------------------------------------
# ● 看英文
#--------------------------------------------------------------------------
def back_to_choose_item
@sure_make_window.deactivate
@sure_make_window.hide
@item_window.activate
end
#--------------------------------------------------------------------------
# ● 继续看英文
#--------------------------------------------------------------------------
def back_to_equip_list
@item_window.deactivate
@item_window.hide
@item_window_help_text.hide
@make_imformation_window.hide
@help_window.show
@make_item_window.show
@make_window.show
@make_choose_window.show
@make_item_window.activate
end
#--------------------------------------------------------------------------
# ● ???(貌似作废)
#--------------------------------------------------------------------------
def make_new_equip(equip_id, equip_kind)
if /<#{LOCK}>/i =~ equip_id.note
eid = equip_id.data_id
case equip_kind
when 1
return if @unluckw[eid] = false
when 2
return if @unlucka[eid] = false
end
end
return equip_id
end
end
#==============================================================================
# ■ Get_Item_P
#------------------------------------------------------------------------------
# 获取道具信息
#==============================================================================
class RPG::Item < RPG::UsableItem
include MakeEquip
def addname
if @note =~ /<#{ADDNAME}\s*(\S+?)>/i
return $1 ? $1.to_s : @name[0,1]
end
return @name[0,1]
end
def add_params(param_id)
if @note =~ /<#{ADDPARAM[param_id]} (\d+)\>/i
return $1 ? $1.to_i : 0
elsif @note =~ /<#{ADDPARAM[param_id]} -(\d+)\>/i
i = $1 ? $1.to_i : 0
return -i
end
return 0
end
def class_id
if @note =~ /<#{CLASS} (\d+)\>/i
return $1 ? $1.to_i : -1
end
return -1
end
def is_useable?
return true if @note =~ /<#{USEABLE}>/i
return false
end
end
#==============================================================================
# ■ Get_Weapon_P
#------------------------------------------------------------------------------
# 获取武器信息
#==============================================================================
class RPG::Weapon < RPG::EquipItem
include MakeEquip
attr_accessor :lock
attr_accessor :exp
alias old initialize
def initialize
old
is_lock? @exp = 0
end
def is_lock?
if @note =~ /<#{BASIC}>/i && @note !~ /<#{LOCK}>/i @lock = false
else
@lock = true
end
return @lock
end
def need_exp
if @note =~ /<#{NEED_EXP} (\d+)\>/i
return $1 ? $1.to_i : 1
end
return 0
end
def add_exp
if @note =~ /<#{ADD_EXP} (\d+)\>/i
return $1 ? $1.to_i : 1
end
return 0
end
def next_level
unlock_level = []
if @note =~ /<#{NEXT_LEVEL} (\d+)\>/i or @note =~ /<#{NEXT_LEVEL} (\d+)\, (\d+)>/i
unlock_level[0] = $1.to_i if $1
unlock_level[1] = $2.to_i if $2
elsif @note =~ /<#{NEXT_LEVEL} (\d+)\, (\d+)\, (\d+)\>/i or @note =~ /<#{NEXT_LEVEL} (\d+)\, (\d+), (\d+), (\d+)>/i
unlock_level[0] = $1.to_i if $1
unlock_level[1] = $2.to_i if $2
unlock_level[2] = $3.to_i if $3
unlock_level[3] = $4.to_i if $4
end
return unlock_level
end
def class_id
if @note =~ /<#{CLASS} (\d+)\>/i
return $1 ? $1.to_i : -1
elsif /@etype\[(.+?)\]/ =~ @note
return $1 ? $1.to_i : -1
end
return -1
end
end
#==============================================================================
# ■ Get_Armor_P
#------------------------------------------------------------------------------
# 获取防具信息
#==============================================================================
class RPG::Armor < RPG::EquipItem
include MakeEquip
attr_accessor :lock
attr_accessor :exp
alias old initialize
def initialize
old
@etype_id = class_id
is_lock?
@exp = 0
end
def is_lock?
if @note =~ /<#{BASIC}>/i && @note !~ /<#{LOCK}>/i
@lock = false
else
@lock = true
end
return @lock
end
def need_exp
if @note =~ /<#{NEED_EXP} (\d+)\>/i
return $1 ? $1.to_i : 1
end
return 0
end
def add_exp
if @note =~ /<#{ADD_EXP} (\d+)\>/i
return $1 ? $1.to_i : 1
end
return 0
end
def next_level
unlock_level = []
if @note =~ /<#{NEXT_LEVEL} (\d+)\>/i or @note =~ /<#{NEXT_LEVEL} (\d+)\, (\d+)>/i
unlock_level[0] = $1.to_i if $1
unlock_level[1] = $2.to_i if $2
elsif @note =~ /<#{NEXT_LEVEL} (\d+)\, (\d+)\, (\d+)\>/i or @note =~ /<#{NEXT_LEVEL} (\d+)\, (\d+), (\d+), (\d+)>/i
unlock_level[0] = $1.to_i if $1
unlock_level[1] = $2.to_i if $2
unlock_level[2] = $3.to_i if $3
unlock_level[3] = $4.to_i if $4
end
return unlock_level
end
def class_id
if @note =~ /<#{CLASS} (\d+)\>/i
return $1 ? $1.to_i : @etype_id
elsif /@etype\[(.+?)\]/ =~ @note
return $1 ? $1.to_i : @etype_id
end
return @etype_id
end
end
class Window_make_choose < Window_HorzCommand
def window_width
return Graphics.width
end
def col_max
return 3
end
#--------------------------------------------------------------------------
# ● 生成指令列表
#--------------------------------------------------------------------------
def make_command_list
add_command("开发武器", :weapon)
add_command("开发防具", :armor)
add_command("开发饰品", :earring)
end
end
class Window_make_weapon < Window_Selectable
def initialize(x, y, width, height)
super(x, y, width, height)
refresh
end
#--------------------------------------------------------------------------
# ● 获取项目数
#--------------------------------------------------------------------------
def item_max
return $weapon.size
end
#--------------------------------------------------------------------------
# ● 生成指令列表
#--------------------------------------------------------------------------
def draw_item(index)
draw_text(item_rect(index),$weapon[index],1)
end
#--------------------------------------------------------------------------
# ● 更新帮助内容
#--------------------------------------------------------------------------
def update_help
@help_window.contents.clear
@help_window.make_command_list(@index)
@help_window.update_help
end
end
class Window_make_armor < Window_Selectable
def initialize(x, y, width, height)
super(x, y, width, height)
refresh
end
#--------------------------------------------------------------------------
# ● 获取项目数
#--------------------------------------------------------------------------
def item_max
return $armor.size
end
#--------------------------------------------------------------------------
# ● 生成指令列表
#--------------------------------------------------------------------------
def draw_item(index)
draw_text(item_rect(index),$armor[index],1)
end
#--------------------------------------------------------------------------
# ● 更新帮助内容
#--------------------------------------------------------------------------
def update_help
@help_window.contents.clear
@help_window.make_command_list(@index)
@help_window.update_help
end
end
class Window_make_earring < Window_Selectable
def initialize(x, y, width, height)
super(x, y, width, height)
refresh
end
#--------------------------------------------------------------------------
# ● 获取项目数
#--------------------------------------------------------------------------
def item_max
return $earring.size
end
#--------------------------------------------------------------------------
# ● 生成指令列表
#--------------------------------------------------------------------------
def draw_item(index)
draw_text(item_rect(index),$earring[index],1)
end
#--------------------------------------------------------------------------
# ● 更新帮助内容
#--------------------------------------------------------------------------
def update_help
@help_window.contents.clear
@help_window.make_command_list(@index)
@help_window.update_help
end
end
class Window_make_item < Window_Selectable
include MakeEquip
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
def initialize
super(0, 0,window_width,fitting_height(3))
@itemkind = 0
@itemid = []
@item_max = 0
@hot = 0
make_command_list
end
def visible_line_number
return 3
end
def clear_data
@itemkind = 0
@itemid = []
@item_max = 0
@hot = 0
end
def item_max
if @item_max
return @item_max
else
return 0
end
end
def row_max
[(item_max + col_max - 1) / col_max, 1].max
end
def col_max
return 2
end
#--------------------------------------------------------------------------
# ● 获取窗口的宽度
#--------------------------------------------------------------------------
def window_width
return Graphics.width - 135
end
#--------------------------------------------------------------------------
# ● 获取装备
#--------------------------------------------------------------------------
def get_item
if item
return @itemkind == 0 ? $data_weapons[item] : $data_armors[item]
end
return nil
end
def item
@itemid && self.index >= 0 ? @itemid[self.index] : nil
end
#--------------------------------------------------------------------------
# ● 获取道具
#--------------------------------------------------------------------------
def make_command_list(kind_class = MakeEquip::get_class - 1)
MakeEquip::save_class(kind_class + 1)
clear_data
case MakeEquip::get_classes
when 1
@hot = $weapon_hot[MakeEquip::get_class - 1]
a = 0
for i in 1...$data_weapons.size
di = $data_weapons
if di.class_id == MakeEquip::get_class - 1
next if di.lock
@itemid[a] = i
a += 1
@itemkind = 0
@item_max = a
draw_item(a - 1)
end
end
if item_max != 0
@index = 0
end
when 2
@hot = $armor_hot[MakeEquip::get_class - 1]
a = 0
for i in 1...$data_armors.size
di = $data_armors
if di.etype_id == MakeEquip::get_class && di.etype_id <= HzhjEquip::ETYPE_ADD_NAME.size
next if di.lock
@itemid[a] = i
a += 1
@itemkind = 1
@item_max = a
draw_item(a - 1)
end
end
if item_max != 0
@index = 0
end
when 3
@hot = $earring_hot[MakeEquip::get_class - 1]
a = 0
for i in 1...$data_armors.size
di = $data_armors
if di.etype_id == MakeEquip::get_class + $earring.size && di.etype_id > HzhjEquip::ETYPE_ADD_NAME2.size
next if di.lock
@itemid[a] = i
a += 1
@itemkind = 1
@item_max = a
draw_item(a - 1)
end
end
if item_max != 0
@index = 0
end
end
end
#--------------------------------------------------------------------------
# ● 更新帮助
#--------------------------------------------------------------------------
def update_help
@help_window.contents.clear
@help_window.draw_item_imformation(@itemid[self.index] ,@itemkind, 4, 0,@hot)#, window_width - 150)
end
#--------------------------------------------------------------------------
# ● 绘制项目
#--------------------------------------------------------------------------
def draw_item(index)
item = @itemid[index]
if item
rect = item_rect(index)
rect.width -= 4
if @itemkind == 0
draw_item_name($data_weapons[item], rect.x, rect.y, true,item_width)
else
draw_item_name($data_armors[item], rect.x, rect.y, true,item_width)
end
end
end
end
#==============================================================================
# ■ Window_equip_imformation
#------------------------------------------------------------------------------
# 装备资料画面
#==============================================================================
class Window_equip_imformation < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
def initialize(x, y,width,height)
super(x, y, width, height)
end
#--------------------------------------------------------------------------
# ● 获取窗口的宽度
#--------------------------------------------------------------------------
def window_width
return Graphics.width - 135
end
#--------------------------------------------------------------------------
# ● 获取窗口的高度
#--------------------------------------------------------------------------
def window_height
return Graphics.height - 172
end
#--------------------------------------------------------------------------
# ● 绘制装备资料
#--------------------------------------------------------------------------
def draw_item_imformation(itemid ,itemkind, x, y,hot)
draw_item_all(itemid ,itemkind, x, y,width,hot)
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
end
#--------------------------------------------------------------------------
# ● 打开窗口
#--------------------------------------------------------------------------
def open
refresh
super
end
end
#==============================================================================
# ■ Window_item
#------------------------------------------------------------------------------
# 选择用来开发的材料
#==============================================================================
class Window_item < Window_ItemList
attr_accessor :equip
def initialize(x, y, width, height)
super
@category = :item
@data = []
refresh
end
#--------------------------------------------------------------------------
# ● 获取列数
#--------------------------------------------------------------------------
def col_max
return 1
end
#--------------------------------------------------------------------------
# ● 获取间隔
#--------------------------------------------------------------------------
def spacing
return 32
end
#--------------------------------------------------------------------------
# ● 能否使用?
#--------------------------------------------------------------------------
def current_item_enabled?
return true
end
#--------------------------------------------------------------------------
# ● 获取道具
#--------------------------------------------------------------------------
def make_item_list
@data = $game_party.all_items.select {|item| include?(item) } # 获取某类型的持有道具
@data.push(nil) if include?(nil)
@data = @data.select {|item| item.is_useable? } # 获取能用的道具
end
#--------------------------------------------------------------------------
# ● 绘制项目
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
if item
show
rect = item_rect(index)
rect.width -= 4
draw_item_name(item, rect.x, rect.y, true,172)
draw_item_number(rect, item)
else
hide
end
end
#--------------------------------------------------------------------------
# ● 更新帮助
#--------------------------------------------------------------------------
def update_help
@help_window.contents.clear
@help_window.set_item(item,@equip)
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
make_item_list
create_contents
draw_all_items
end
end
#==============================================================================
# ■ Window_Text_Help
#------------------------------------------------------------------------------
# 帮助文本
#==============================================================================
class Window_Text_Help < Window_Selectable
def initialize(x, y, width, height)
super
refresh
end
#--------------------------------------------------------------------------
# ● 设置文本
#--------------------------------------------------------------------------
def draw_help_text(text = "")
draw_text_ex(2,0,text,width - 4)
end
def refresh
draw_help_text
end
end
#==============================================================================
# ■ Window_make_imformation
#------------------------------------------------------------------------------
# 选择道具窗口帮助
#==============================================================================
class Window_make_imformation < Window_Base
def initialize
super(0,0,325,416)
refresh
end
#--------------------------------------------------------------------------
# ● 设置物品
# item : 技能、物品等
#--------------------------------------------------------------------------
def set_item(item,equip)
draw_ie_imformation(item,equip)
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
end
end
#==============================================================================
# ■ Window_sure_make
#------------------------------------------------------------------------------
# 开发装备(选择角色开发)
#==============================================================================
class Window_sure_make < Window_Command
def initialize
super(0, 0)
update_placement
self.openness = 0
open
end
#--------------------------------------------------------------------------
# ● 获取窗口的宽度
#--------------------------------------------------------------------------
def window_width
return 140
end
#--------------------------------------------------------------------------
# ● 更新窗口的位置
#--------------------------------------------------------------------------
def update_placement
self.x = 544 - window_width
self.y = 416 - window_height
end
#--------------------------------------------------------------------------
# ● 生成指令列表
#--------------------------------------------------------------------------
def make_command_list
add_command("开发装备",:yes_make)
add_command(" 返回 ",:no_make)
end
end
第二个 作者: 魔力的觉醒 时间: 2013-5-31 17:47
#==============================================================================
# ■ Scene_Making_Imformation
#------------------------------------------------------------------------------
# 开发装备(子类)
#==============================================================================
class Scene_Making_Imformation < Scene_Make_Item
#--------------------------------------------------------------------------
# ● 开始
#--------------------------------------------------------------------------
def start
get_ie
super
@choosed = 0
@makers = []
end
#--------------------------------------------------------------------------
# ● 添加窗口
#--------------------------------------------------------------------------
def create_window
create_making_scroll
create_making_window
create_actorimformation_window
create_choose_actor_to_make
end
#--------------------------------------------------------------------------
# ● 获取父类选定好的装备武器
#--------------------------------------------------------------------------
def get_ie
s1 = MakeEquip::get_or_save_ie(true,nil,nil)
@item = s1[0]
@equip = s1[1]
end
#--------------------------------------------------------------------------
# ● 开发进度条(我的英文水平很无语)
#--------------------------------------------------------------------------
def create_making_scroll
@scroll_window = Window_Making_Scroll.new
end
#--------------------------------------------------------------------------
# ● 选择角色
#--------------------------------------------------------------------------
def create_choose_actor_to_make
@choose_actor_window = Window_Choose_Actor.new(0,0)
@choose_actor_window.help_window = @actorimformation_window
@choose_actor_window.set_handler(:ok , method(:begin_to_make))
@choose_actor_window.set_handler(:cancel, method(:return_scene))
@choose_actor_window.activate
end
#--------------------------------------------------------------------------
# ● 开发窗口
#--------------------------------------------------------------------------
def create_making_window
@making_window = Window_Making.new(160,0,384,371,item,equip)
@making_window.hide
end
#--------------------------------------------------------------------------
# ● 承接Makers的窗口
#--------------------------------------------------------------------------
def create_makers_window
@makers_window = Window_Makers.new(@makers)
@begin_make = Window_sure_make.new
@begin_make.x = 14
@begin_make.y = 291
@begin_make.set_handler(:yes_make ,method(:honton_to_make))
@begin_make.set_handler(:no_make, method(:return_scene))
@begin_make.set_handler(:cancel, method(:return_scene))
end
#--------------------------------------------------------------------------
# ● 成功开发窗口
#--------------------------------------------------------------------------
def create_succeed_to_make_window(equip,item,new_name,new_params)
@succeed_to_make = Window_Succeed_Make.new(100,0,item,equip,new_name,new_params,@makers)
@succeed_to_make.set_handler(:ok , method(:return_scene))
@succeed_to_make.set_handler(:cancel, method(:return_scene))
end
#--------------------------------------------------------------------------
# ● 角色资料
#--------------------------------------------------------------------------
def create_actorimformation_window
@actorimformation_window = Window_Actor_Imformation.new(160,0,384,371)
end
#--------------------------------------------------------------------------
# ● 貌似没用,但别删
#--------------------------------------------------------------------------
def on_actor_change
@actorimformation_window.actor = @actor
end
#--------------------------------------------------------------------------
# ● 开始开发
#--------------------------------------------------------------------------
def begin_to_make
if @makers.include?(@choose_actor_window.item)
@choosed -= 1
@makers.delete(@choose_actor_window.item)
@choose_actor_window.clear_item(@choose_actor_window.index)
@choose_actor_window.draw_item(@choose_actor_window.index)
@making_window.del_actor(@choose_actor_window.item)
else
@choosed += 1
@makers.push(@choose_actor_window.item)
@choose_actor_window.draw_item_background(@choose_actor_window.index)
@making_window.actor = @choose_actor_window.item
end
@choose_actor_window.activate
if @choosed == $game_make_item.max_maker
@actorimformation_window.close
@choose_actor_window.close
@making_window.show
create_makers_window
@making_window.refresh
end
end
#--------------------------------------------------------------------------
# ● 真的要开始开发了!!!(我用了日文……)
#--------------------------------------------------------------------------
def honton_to_make
@begin_make.close
@begin_make.hide
@making_window.activate
$game_party.lose_gold(@equip.price + @item.price)
$game_party.gain_item(@item,-1)
i = 0
while i < 100
@making_window.up_param
i += 1
@scroll_window.stime = i
Graphics.wait(6)
end
@making_window.finish_up
Graphics.wait(90)
hot = @making_window.get_hot(@equip)
new_params = @making_window.params
new_name = @making_window.add_name
new_equip = @equip.dup
if new_equip.is_a?(RPG::Weapon)
new_equip.id = $data_weapons.size
$data_weapons.insert $data_weapons.size,new_equip
$data_weapons[new_equip.id].name = new_name + @equip.name
$data_weapons[new_equip.id].params = new_params
$data_weapons[new_equip.id].note = make_note(@equip)
$data_weapons[new_equip.id].lock = true
$data_weapons[new_equip.id].exp = 0
$data_weapons[new_equip.id].price *= 1 + hot * 0.01
$data_weapons[new_equip.id].price += @item.price * hot * 0.01 * 1.5
$data_weapons[new_equip.id].price = $data_weapons[new_equip.id].price.to_i
else
new_equip.id = $data_armors.size
$data_armors.insert $data_armors.size,new_equip
$data_armors[new_equip.id].name = new_name + @equip.name
$data_armors[new_equip.id].params = new_params
$data_armors[new_equip.id].note = make_note(@equip)
$data_armors[new_equip.id].lock = true
$data_armors[new_equip.id].exp = 0
$data_armors[new_equip.id].price *= 1 + hot * 0.01
$data_armors[new_equip.id].price += @item.price * hot * 0.01 * 1.5
$data_armors[new_equip.id].price = $data_armors[new_equip.id].price.to_i
end
$game_party.gain_item(new_equip,1)
create_succeed_to_make_window(@equip,@item,new_name,new_params)
@succeed_to_make.show
@succeed_to_make.activate
end
#--------------------------------------------------------------------------
# ● 生成新备注
#--------------------------------------------------------------------------
include MakeEquip
def make_note(equip)
note = "<"+CLASS+" "+equip.class_id.to_s+">"
return note
end
end
#==============================================================================
# ■ Window_Making_Scroll
#------------------------------------------------------------------------------
# 开发进度条
#==============================================================================
class Window_Making_Scroll < Window_Base
def initialize
super(0,371,window_width,window_height)
@stime = 0
refresh
end
def window_width
return 544
end
def window_height
return 45
end
def stime=(stime)
@stime = stime
refresh
end
def draw_scroll(stime)
contents.clear
rate = stime.to_f / 100
make_font_smaller
draw_gauge(90, -7, 412, rate, tp_cost_color, tp_cost_color)
draw_text(4, 0, 200, line_height, "开发进度:")
make_font_bigger
end
def refresh
draw_scroll(@stime)
end
end
#==============================================================================
# ■ (懒得打了)
#------------------------------------------------------------------------------
# 选择角色
#==============================================================================
class Window_Choose_Actor < Window_MenuStatus
def initialize(x,y)
super(x,y)
refresh
end
def window_width
return 160
end
def window_height
return 371
end
#--------------------------------------------------------------------------
# ● 获取项目的高度
#--------------------------------------------------------------------------
def item_height
(height - standard_padding * 2) / 4
end
#--------------------------------------------------------------------------
# ● 获取显示行数
#--------------------------------------------------------------------------
def visible_line_number
return 4
end
def item
$game_party.members[index]
end
def draw_item(index)
actor = $game_party.members[index]
enabled = $game_party.battle_members.include?(actor)
rect = item_rect(index)
draw_actor_graphic(actor, rect.x+15, rect.y+45)
draw_simple_status(actor, rect.x + 35, rect.y + line_height / 6)
end
def draw_item_background(index)
contents.fill_rect(item_rect(index), pending_color)
draw_item(index)
end
def update_help
@help_window.actor = $game_party.members[index]
end
def refresh
contents.clear
draw_all_items
self.index = 0
end
end
#==============================================================================
# ■ (懒得打了)
#------------------------------------------------------------------------------
# 角色资料
#==============================================================================
class Window_Actor_Imformation < Window_Status
def initialize(x,y,width,height)
super(nil)
self.x = x
self.y = y
self.width = width
self.height = height @actor = nil
refresh
end
def actor=(actor)
@actor = actor
refresh
end
def refresh
if @actor
show
contents.clear
draw_block1 (line_height * 0)
draw_horz_line(line_height * 1)
draw_block2 (line_height * 2)
draw_horz_line(line_height * 6)
draw_block3 (line_height * 7)
else
hide
end
end
#--------------------------------------------------------------------------
# ● 绘制区域 1
#--------------------------------------------------------------------------
def draw_block1(y)
draw_actor_name(@actor, 4, y)
draw_actor_class(@actor, 128, y) # 职业
end
#--------------------------------------------------------------------------
# ● 绘制区域 2
#--------------------------------------------------------------------------
def draw_block2(y)
draw_actor_face(@actor, 4, y)
draw_basic_info(120, y)
draw_exp_info(150, y+line_height * 5)
end
#--------------------------------------------------------------------------
# ● 绘制区域 3
#--------------------------------------------------------------------------
def draw_block3(y)
draw_parameters(4, y)
end
end
#==============================================================================
# ■ (懒得打了)
#------------------------------------------------------------------------------
# 开发装备窗口
#==============================================================================
class Window_Making < Window_Selectable
include MakeEquip
attr_writer :equip
attr_writer :item
attr_reader :params
attr_reader :add_name
#--------------------------------------------------------------------------
# ● 初始化
#--------------------------------------------------------------------------
def initialize(x,y,width,height,item=nil,equip=nil)
super(x,y,width,height)
@item = item # 获取用来开发的物品
@equip = equip # 获取被开发的武器
@params = [] # 属性(武器)
@add_params = [] # 道具增加属性
@add_name = "" # 名称前缀
@sum_params = [0,0,0,0,0,0] # 总计属性(角色)
@avg_params = [0,0,0,0,0,0] # 平均属性(角色)
@actor = [] # 角色们
if @equip && @item
init_imformation # 初始化资料
refresh
end
end
include MakeEquip
#--------------------------------------------------------------------------
# ● 设置角色
#--------------------------------------------------------------------------
def actor=(actor)
@actor.push(actor)
end
def del_actor(actor)
@actor.delete(actor)
end
#--------------------------------------------------------------------------
# ● 初始化资料
#--------------------------------------------------------------------------
def init_imformation
for i in 0..7
@params = @equip.params
end
for i in 0..7
@add_params = @item.add_params(i)
end
@add_name = @item.addname
end
#--------------------------------------------------------------------------
# ● 行高
#--------------------------------------------------------------------------
def line_height
return 19
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
contents.clear
draw_ie_icon(4,0)
draw_horz_line(line_height)
draw_params(4,line_height)
draw_horz_line(line_height * 9)
draw_actors_imformation(4,line_height * 10)
end
#--------------------------------------------------------------------------
# ● 描绘物品装备图片
#--------------------------------------------------------------------------
def draw_ie_icon(x,y)
make_font_smaller
draw_icon(@equip.icon_index,x,y)
draw_text(x+25, y+2, 100, line_height, @equip.name)
draw_text(x+125, y+2, 100, line_height, "开发材料:")
draw_icon(@item.icon_index,x+225,y)
draw_text(x+250, y+2, 100, line_height, @item.name)
make_font_bigger
end
#--------------------------------------------------------------------------
# ● 描绘能力值
#--------------------------------------------------------------------------
def draw_params(x,y)
if @equip && @item
make_font_smaller
for i in 0..7
s2 = i < 2? $game_make_item.hmp_max : $game_make_item.params_max
draw_gauge(x+88, y+18 * i+5, 265, @params / s2.to_f, text_color(14), text_color(11),true)
change_color(system_color)
draw_text(x, y+18 *i+5, 100, 32, ParamName)
change_color(normal_color)
draw_text(x+250, y+18 * i+5, 80, 32, @params.to_s+"/"+s2.to_s)
end
make_font_bigger
end
end
#--------------------------------------------------------------------------
# ● 描绘参与角色能力值
#--------------------------------------------------------------------------
def draw_actors_imformation(x,y)
if @actor != []
@sum_params = [0,0,0,0,0,0]
@avg_params = [0,0,0,0,0,0]
make_font_smaller
change_color(system_color)
draw_text(x, y, 80, line_height,"参与角色")
change_color(normal_color)
for i in 0 ... @actor.size
for a in 0 .. 5
@sum_params[a] += @actor.param(a+2)
@avg_params[a] = @actor.param(a+2)
end
draw_text(x, y+18 * (i+1), 100, line_height, @actor.name)
end
for i in 0 ... @avg_params.size
@avg_params = @sum_params / @actor.size
change_color(text_color(i*2+1))
draw_text(x+210, y+18 * (i+1), 50, line_height, @avg_params.to_s)
end
change_color(system_color)
draw_text(x+150, y, 60, line_height,"总计:")
for i in 0 ... @sum_params.size
change_color(system_color)
draw_text(x+80, y+18 * (i+1), 70, line_height, Vocab::param(i+2))
change_color(text_color(i*2+1))
draw_text(x+155, y+18 * (i+1), 50, line_height, @sum_params.to_s)
end
change_color(system_color)
draw_text(x+205, y, 60, line_height,"平均:")
change_color(normal_color)
make_font_bigger
end
end
#--------------------------------------------------------------------------
# ● 获取装备类型
#--------------------------------------------------------------------------
def equip_kind
case MakeEquip::get_classes
when 1
if MakeEquip::get_class != 4 then
kind = 0
else
kind = 2
end
when 2
if MakeEquip::get_class != 2 then
kind = 1
else
kind = 3
end
when 3
kind = 4
else
kind = nil
end
return kind
end
#--------------------------------------------------------------------------
# ● 计算能力提升
#--------------------------------------------------------------------------
def up_param
kind = equip_kind
# 获取增加几率
i = rand(1000)
i *= [1.0 + @sum_params[kind] * 0.001, 0.0].max
i *= [1.0 + @avg_params[kind] * 0.001, 0.0].max
a = 800 * [@avg_params[5] * 0.001, 0.0].max
if i >= 850 - a
# 获取增加的属性
sum = 0
new_params = Array.new(@add_params)
for i in 0..7
new_params = -new_params if new_params < 0
sum += new_params
end
a = 100.0 / sum
for i in 0 .. 7
new_params *= a
new_params += new_params[i-1] if i > 0
end
s = rand(100)
ap = -1
for i in 0 .. 7
if i == 0
if s >= 0 && s < new_params[0]
ap = 0
end
else
if s >= new_params[i-1] && s < new_params
ap = i
end
end
end
ap = rand(7) if ap == -1
# 获取增加点数
相性度 = get_xx(@equip,@item)
amount = @add_params[ap] / 5.0
amount = 1 if amount < 1 && amount > 0
amount = -1 if amount > -1 && amount < 0
amount *= [1.0 + 相性度 * 0.001, 0.0].max
amount *= [1.0 + @avg_params[kind] * 0.001, 0.0].max
draw_params_levelup(ap,amount.to_i)
end
refresh
end
#--------------------------------------------------------------------------
# ● 描绘能力提升图样
#--------------------------------------------------------------------------
def draw_params_levelup(paramid,amount,show = true)
s1 = paramid < 2? $game_make_item.hmp_max : $game_make_item.params_max
case amount
when 0..50
icon_model = 0
when 51..10000
icon_model = 1
when -20..-1
icon_model = 2
when -10000..-20
icon_model = 3
end
@params[paramid] += amount
@params[paramid] = s1 if @params[paramid] > s1
if show
for i in 0 .. 10
refresh
case icon_model
when 0
draw_icon(UP_FLAG+paramid,200,18 * (paramid+1) +5-i)
when 1
draw_icon(UP_FLAG+paramid+8,200,18 * (paramid+1) +5-i)
when 2
draw_icon(UP_FLAG+paramid+16,200,18 * (paramid+1) +5+i)
when 3
draw_icon(UP_FLAG+paramid+24,200,18 * (paramid+1) +5+i)
end
Graphics.wait(1)
end
else
refresh
end
end
#--------------------------------------------------------------------------
# ● 完成开发(收尾工序)
#--------------------------------------------------------------------------
def finish_up
相性度 = get_xx(@equip,@item)
相性度 -= 100
相性度 /= 100.0
for i in 0 .. 7
amount = @params * 相性度 if @params >= 0
r = rand(1000)
if r <= @avg_params[5]
amount += 1
amount *= (1.5 + @avg_params[5] * 0.01)
end
draw_params_levelup(i,amount.to_i,false)
end
end
end
#==============================================================================
# ■ (懒得打了)
#------------------------------------------------------------------------------
# 参与者窗口
#==============================================================================
class Window_Makers < Window_Choose_Actor
def initialize(makers)
super(0,0)
@actor = makers
refresh
end
def item_max
return 3
end
def draw_item(index)
if @actor && @actor[index]
actor = @actor[index]
enabled = $game_party.battle_members.include?(actor)
rect = item_rect(index)
draw_actor_graphic(actor, rect.x+15, rect.y+45)
draw_simple_status(actor, rect.x + 35, rect.y + line_height / 6)
end
end
def draw_item_background(index)
end
def update_help
end
def refresh
contents.clear
draw_all_items
self.index = -1
end
end
#==============================================================================
# ■ (懒得打了)
#------------------------------------------------------------------------------
# 成功开发窗口
#==============================================================================
class Window_Succeed_Make < Window_Selectable
def initialize(x, y, item, equip, new_name,new_params,makers)
super(x, y, window_width, window_height)
@item = item
@equip = equip
@new_name = new_name
@params = new_params
@makers = makers @exp = []
refresh
end
def window_width
return 444
end
def window_height
return 416
end
include MakeEquip
#--------------------------------------------------------------------------
# ● 绘制信息
#--------------------------------------------------------------------------
def draw_imformation
draw_text(4,0,400,line_height,"开发装备成功:")
draw_icon(@equip.icon_index,4,line_height+5)
draw_text(27,line_height+5,200,line_height,@equip.name)
draw_icon(@item.icon_index,210,line_height+5)
draw_text(235,line_height+5,200,line_height,@item.name)
draw_text(4,line_height*2+10,400,line_height,"开发为:")
draw_icon(@equip.icon_index,4,line_height*3+10)
draw_text(27,line_height*3+10,400,line_height,@[email protected])
make_font_smaller
for i in 0..7
s2 = i < 2? $game_make_item.hmp_max : $game_make_item.params_max
draw_gauge(95, line_height*4+8+18 * i, 275, @params / s2.to_f, text_color(14), text_color(11),true)
change_color(system_color)
draw_text(4, line_height*4+8+18 *i, 100, 32, ParamName)
change_color(normal_color)
s1 = @params - @equip.params
s1 = "+"+s1.to_s if s1 >= 0
if @params > 0
s3 = -(@equip.params-@params) / @params.to_f * 100
s3 = s3.to_i
else
s3 = "-- "
end
draw_text(250, line_height*4+8+18 * i, 60, 32, s1.to_s)
draw_text(315, line_height*4+8+18 * i, 60, 32, s3.to_s+"%")
end
change_color(normal_color)
draw_text(4,line_height*6+133,300,32,"花费:" + cost.to_s + Vocab::currency_unit)
draw_text(4,line_height*5+133,200,32,"熟练度增加:"+add_exp.to_s)
if @equip.need_exp == 0
change_color(text_color(2))
draw_text(190, line_height*5+133, 180, 32, "已是最高级!")
else
for i in 0...add_exp
a += 1
draw_gauge(125, line_height*5+132, 245, a.to_f / @equip.need_exp, text_color(14), text_color(11))
break if a >= @equip.need_exp
Graphics.wait(2)
end
draw_text(300, line_height*5+133, 60, 32, a.to_s + "/" + @equip.need_exp.to_s)
if a >= @equip.need_exp
change_color(text_color(2))
draw_text(168, line_height*5+133, 100, 32, "解锁新装备!")
s_last = @equip.next_level
kind = 0 if @equip.is_a?(RPG::Weapon)
kind = 1 if @equip.is_a?(RPG::Armor)
for i in 0...s_last.size
n = s_last
kind == 0 ? $data_weapons[n].lock = false : $data_armors[n].lock = false
end
end
@equip.exp = a
end
make_font_bigger
change_color(normal_color)
end
#--------------------------------------------------------------------------
# ● 绘制增加经验
#--------------------------------------------------------------------------
def draw_addexp(exp)
make_font_smaller
change_color(system_color)
draw_text(4, line_height*7+133, 300, 32, "增加经验:")
change_color(normal_color)
for i in 0 ... @makers.size
draw_text(4, line_height*7+133+18 * (i+1), 100, 32, @makers.name)
change_color(text_color(11))
s1 = @makers.max_level? ? nil : @makers.exp
s2 = @makers.max_level? ? nil : @makers.next_level_exp - @makers.exp
s3 = @makers.max_level? ? nil : @makers.next_level_exp
if s1 && s2
a = 0
while a < exp
if exp <= 360
add = 1
elsif exp > 360 && exp <= 999
add = 3
elsif exp >= 1000 && exp < 5000
add = 10
elsif exp >= 5000 && exp <= 20000
add = 50
elsif exp > 20000 && exp <= 50000
add = 100
elsif exp > 50000
add = 500
end
if (a + add) <= exp
a += add
@makers.change_exp(@makers.exp + add, false)
else
s = exp - a
a = exp
@makers.change_exp(@makers.exp + s, false)
end
draw_gauge(110, line_height*7+133+18 * (i+1), 265, @makers.exp / @makers.next_level_exp.to_f, text_color(10), text_color(11))
Graphics.wait(1)
end
if @makers.exp >= s3
draw_text(280, line_height*7+133+18 * (i+1), 100, 32, "Level UP!!")
end
else
draw_gauge(110, line_height*7+133+18 * (i+1), 265, 1.0, text_color(10), text_color(11))
change_color(text_color(2))
draw_text(280, line_height*7+133+18 * (i+1), 100, 32, "Max Level")
change_color(text_color(11))
end
draw_text(110, line_height*7+133+18 * (i+1), 50, 32, "+" + @exp.to_s)
change_color(normal_color)
end
make_font_bigger
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
contents.clear
相性度 = get_xx(@equip,@item)
sum_exp = rand(200) * 相性度 - @makers.size * rand(100)
for i in 0 ... @makers.size
@exp = @makers.level * sum_exp / 90 + rand(10)
end
draw_imformation
draw_addexp(@exp)
end
end
module DataManager
#--------------------------------------------------------------------------
# ● 生成存档内容
#--------------------------------------------------------------------------
def self.make_save_contents
contents = {}
contents[:system] = $game_system
contents[:timer] = $game_timer
contents[:message] = $game_message
contents[:switches] = $game_switches
contents[:variables] = $game_variables
contents[:self_switches] = $game_self_switches
contents[:actors] = $game_actors
contents[:party] = $game_party
contents[:troop] = $game_troop
contents[:map] = $game_map
contents[:player] = $game_player
contents[:make_item] = $game_make_item
contents[:weapons] = $data_weapons
contents[:armors] = $data_armors
contents
end
#--------------------------------------------------------------------------
# ● 展开存档内容
#--------------------------------------------------------------------------
def self.extract_save_contents(contents)
$game_system = contents[:system]
$game_timer = contents[:timer]
$game_message = contents[:message]
$game_switches = contents[:switches]
$game_variables = contents[:variables]
$game_self_switches = contents[:self_switches]
$game_actors = contents[:actors]
$game_party = contents[:party]
$game_troop = contents[:troop]
$game_map = contents[:map]
$game_player = contents[:player]
$game_make_item = contents[:make_item]
$data_weapons = contents[:weapons]
$data_armors = contents[:armors]
end
end
第三个 作者: 魔力的觉醒 时间: 2013-5-31 17:47
=begin
================================================
道具提示系统 版本 1.01 By 804173948 QQ:同上
================================================
修正BUG:
1.读取游戏后获取道具错误
更新:
1.添加音效(本人觉得很难听)
使用方法:
在事件-脚本里输入
1、获得/失去物品
获得:
get_item($data_items[物品id],数量)
失去:
lost_item($data_items[物品id],数量)
例如:
get_item($data_items[10],4) 获得10号物品 4个
lost_item($data_items[1],3) 丢失1号物品 3个
2、获得/失去武器
获得:
get_item($data_weapons[物品id],数量)
失去:
lost_item($data_weapons[物品id],数量,是否包括装备)
是否包括装备:是则 True 否则 false 或不写 下同
3、获得/失去防具
获得:
get_item($data_armors[物品id],数量)
失去:
lost_item($data_armors[物品id],数量,是否包括装备)
注意:最后要加一句 show_window 否则不显示提示窗口
详情看范例……
有疑问或BUG之类的 欢迎提出
=end
class Game_Interpreter
alias old_initialize initialize
def initialize(depth = 0)
old_initialize
@get_item_var =[]
@get_amount =[]
end
def show_window
Audio.se_play("Audio/SE/Shop",80,100)
SceneManager.call(Scene_Get_Item)
SceneManager.scene.show_window(@get_item_var,@get_amount)
@get_item_var =[]
@get_amount =[]
end
def get_item(item,amount)
amount = 99 if amount > 99
@get_item_var = [] if @get_item_var == nil
@get_amount = [] if @get_amount == nil
@get_item_var.push(item)
@get_amount.push(amount)
$game_party.gain_item(item,amount)
end
def lost_item(item,amount,include_equip = false)
amount = 99 if amount > 99
@get_item_var = [] if @get_item_var == nil
@get_amount = [] if @get_amount == nil
@get_item_var.push(item)
@get_amount.push(-amount)
$game_party.gain_item(item,-amount,include_equip)
end
end
class Scene_Get_Item < Scene_MenuBase
def start
super
@get_item_var = []
@get_amount = []
end
def show_window(get_item_var,get_amount)
@get_item_var = get_item_var
@get_amount = get_amount
create_show_get_window
create_category_window
end
def create_show_get_window
@show_get_window = Window_Show_GetItem.new(120,88,300,200,@get_item_var,@get_amount) #窗口位置
@show_get_window.set_handler(:ok, method(:return_scene))
@show_get_window.set_handler(:cancel, method(:on_item_cancel))
end
def create_category_window
@show_getItem_category = Window_GetItem_Category.new(120,40,300,48)
@show_getItem_category.item_window = @show_get_window
@show_getItem_category.set_handler(:ok, method(:on_category_ok))
@show_getItem_category.set_handler(:cancel, method(:return_scene))
end
def on_category_ok
@show_get_window.activate
end
def on_item_cancel
@show_getItem_category.activate
end
end
class Window_GetItem_Category < Window_HorzCommand
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_reader :item_window
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
def initialize(x,y,width,height)
super(x, y)
self.width = width
self.height = height
end
#--------------------------------------------------------------------------
# ● 窗口宽度
#--------------------------------------------------------------------------
def window_width
return 300
end
#--------------------------------------------------------------------------
# ● 获取列数
#--------------------------------------------------------------------------
def col_max
return 2
end
#--------------------------------------------------------------------------
# ● 更新画面
#--------------------------------------------------------------------------
def update
super
@item_window.category = current_symbol if @item_window
end
#--------------------------------------------------------------------------
# ● 生成指令列表
#--------------------------------------------------------------------------
def make_command_list
add_command(" 获得物品", :get)
add_command(" 失去物品", :lost)
end
#--------------------------------------------------------------------------
# ● 设置物品窗口
#--------------------------------------------------------------------------
def item_window=(item_window)
@item_window = item_window
update
end
end
class Window_Show_GetItem < Window_ItemList
def initialize(x, y, width, height,data,amount)
super(x, y, width, height)
@category = :get
@data_save = data
@amount_save = amount
refresh
end
def col_max
return 1
end
def spacing
return 32
end
def include?(index)
if index
case @category
when :get
if index >= 0
true
else
false
end
when :lost
if index < 0
true
else
false
end
else
false
end
end
end
def draw_item(index)
item = @data[index]
if item
rect = item_rect(index)
rect.width -= 4
draw_item_name(item, rect.x, rect.y)
draw_item_number(rect, index)
end
end
def draw_item_number(rect, item)
if @amount[item] < 0
s1 = -@amount[item]
else
s1 = @amount[item]
end
draw_text(rect, sprintf(":%2d", s1), 2)
end
#--------------------------------------------------------------------------
# ● 查询此物品是否可用
#--------------------------------------------------------------------------
def enable?(item)
return true
end
#--------------------------------------------------------------------------
# ● 生成物品列表
#--------------------------------------------------------------------------
def make_item_list
@data = Array.new(@data_save)
@amount = Array.new(@amount_save)
for i in 0 ... @data.size
@data[i] = nil if include?(@amount_save[i]) == false
@amount[i] = nil if include?(@amount_save[i]) == false
end
@data.delete(nil)
@amount.delete(nil)
end
end