Project1
标题:
强化装备脚本怎么使用啊??
[打印本页]
作者:
木讷
时间:
2014-2-4 16:24
标题:
强化装备脚本怎么使用啊??
本帖最后由 铃仙·优昙华院·因幡 于 2014-2-21 10:41 编辑
就是这个!!
#=============================================================================
# (测试)vx复杂装备系统之 装备升级功能 by 沉影不器
# protosssonny修改版
#-----------------------------------------------------------------------------
# 此版本侧重于捕捉bug,欢迎反馈.
#=============================================================================
# 参数设定如下
#=============================================================================
module Game_Equip
## 能力升级基数(倍数)
BaseAbility = 0.2
## 每级价格提高基数(倍数)
BasePrice = 0.3
## 是否保证成功
UpGrade_Absoluteness = false
## 每级成功率基数(百分比,用于逐级下降)
BaseSucceed = 0.85
## 最大等级
MaxLevel = 10
## 需金钱基数(与本身价格的倍数)
GoldNeed = 1.9
end
#=============================================================================
# 复杂装备模块
#=============================================================================
module Game_Equip
#--------------------------------------------------------------------------
# ● 处理价格
#--------------------------------------------------------------------------
def self.setup_price(item, price)
equip_price = item.price
item.price += [(equip_price * BasePrice).round, 1].max
item.price += price
end
#--------------------------------------------------------------------------
# ● 升级是否成功?
#--------------------------------------------------------------------------
def self.upgradesucceed?(lv)
return true if UpGrade_Absoluteness
new_lv = lv.nil? ? 1 : lv + 1
return false if new_lv > MaxLevel
return true if $item_s == 1
$item_x = 0 if $item_x == nil
return BaseSucceed ** new_lv + 0.05 * $item_x > rand(0)
end
#--------------------------------------------------------------------------
# ● 装备重生
# equip: 装备
#--------------------------------------------------------------------------
def self.reini(equip)
return if equip.nil?
result = Marshal.load(Marshal.dump(equip))
result.base_id = equip.id
setup_price(result, 0)
case result
when RPG::Weapon
result.id = $data_weapons.size
$data_weapons.push result
when RPG::Armor
result.id = $data_armors.size
$data_armors.push result
end
return result
end
#--------------------------------------------------------------------------
# ● 直接指定装备等级
# equip: 装备
# lv: 等级
#--------------------------------------------------------------------------
def self.level(equip, lv)
equip.level = 0 if equip.level.nil?
n = lv - equip.level
## 等级更低时返回
return if n < 0
n.times{equip = self.upgrade(equip, true)}
return equip
end
#--------------------------------------------------------------------------
# ● 装备升级
# equip: 装备
#--------------------------------------------------------------------------
def self.upgrade(equip, abs = false)
unless abs || upgradesucceed?(equip.level)
$game_party.gain_item(equip, 1)
return
end
equip.none_upgrade_name = equip.name if equip.level == nil or equip.level == 0
equip.level = equip.level + 1 rescue 1
case equip
when RPG::Weapon
return if equip.level == MaxLevel
equip.atk += [($base_weapons[equip.base_id].atk * BaseAbility).round, 1].max if $base_weapons[equip.base_id].atk > 0
equip.def += [($base_weapons[equip.base_id].def * BaseAbility).round, 1].max if $base_weapons[equip.base_id].def > 0
equip.spi += [($base_weapons[equip.base_id].spi * BaseAbility).round, 1].max if $base_weapons[equip.base_id].spi > 0
equip.agi += [($base_weapons[equip.base_id].agi * BaseAbility).round, 1].max if $base_weapons[equip.base_id].agi > 0
setup_price(equip, 0)
equip.name = equip.none_upgrade_name + " +" + equip.level.to_s
when RPG::Armor
return if equip.level == MaxLevel
equip.atk += [($base_armors[equip.base_id].atk * BaseAbility).round, 1].max if $base_armors[equip.base_id].atk > 0
equip.def += [($base_armors[equip.base_id].def * BaseAbility).round, 1].max if $base_armors[equip.base_id].def > 0
equip.spi += [($base_armors[equip.base_id].spi * BaseAbility).round, 1].max if $base_armors[equip.base_id].spi > 0
equip.agi += [($base_armors[equip.base_id].agi * BaseAbility).round, 1].max if $base_armors[equip.base_id].agi > 0
setup_price(equip, 0)
equip.name = equip.none_upgrade_name + " +" + equip.level.to_s
end
return equip
end
end
#==============================================================================
# ■ RPG::BaseItem
#==============================================================================
module RPG
class BaseItem
def initialize
@id = 0
@name = ""
@icon_index = 0
@description = ""
@note = ""
@base_id = 0
[url=home.php?mod=space&uid=22147]@level[/url] = 1
end
attr_accessor :id
attr_accessor :name
attr_accessor :icon_index
attr_accessor :description
attr_accessor :note
attr_accessor :base_id
attr_accessor :level
end
end
#==============================================================================
# ■ RPG::Weapon
#==============================================================================
module RPG
class Weapon < BaseItem
attr_accessor :none_upgrade_name
end
class Armor < BaseItem
attr_accessor :none_upgrade_name
end
end
#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● 装备重设
#--------------------------------------------------------------------------
def reset_equip_id
if @weapon_id != 0
item = Game_Equip.reini($base_weapons[@weapon_id])
unless item.nil?
$data_weapons.push item
@weapon_id = item.id
end
end
if @armor1_id != 0
if two_swords_style
item = Game_Equip.reini($base_weapons[@armor1_id])
unless item.nil?
$data_weapons.push item
@armor1_id = item.id
end
else
item = Game_Equip.reini($base_armors[@armor1_id])
unless item.nil?
$data_armors.push item
@armor1_id = item.id
end
end
end
if @armor2_id != 0
item = $base_armors[@armor2_id]
unless item.nil?
item = Game_Equip.reini(item)
$data_armors.push item
@armor2_id = item.id
end
end
if @armor3_id != 0
item = $base_armors[@armor3_id]
unless item.nil?
item = Game_Equip.reini(item)
$data_armors.push item
@armor3_id = item.id
end
end
if @armor4_id != 0
item = $base_armors[@armor4_id]
unless item.nil?
item = Game_Equip.reini(item)
$data_armors.push item
@armor4_id = item.id
end
end
end
end
#==============================================================================
# ■ Window_ScrEquip
#==============================================================================
class Window_ScrEquip < Window_Selectable
include Game_Equip
attr_accessor :equip_only
#--------------------------------------------------------------------------
# ● 初始化对象
# x : 窗口的 X 坐标
# y : 窗口的 Y 坐标
# width : 窗口的宽
# height : 窗口的高
#--------------------------------------------------------------------------
def initialize(x, y, width, height)
super(x, y, width, height)
@column_max = 1
@equip_only = true
refresh
end
#--------------------------------------------------------------------------
# ● 取得物品
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● 显示是否可以使用物品
# item : 物品
#--------------------------------------------------------------------------
def enable?(item)
return true
end
#--------------------------------------------------------------------------
# ● 列表中包含的物品
# item : 物品
#--------------------------------------------------------------------------
def include?(item)
return true if item == nil
if @equip_only
if item.is_a?(RPG::Item)
return false
else
return false if item.is_a?(RPG::Armor) and item.base_id == PA::CRYSTAL
return false if item.level == MaxLevel - 1
end
else
return false unless item.is_a?(RPG::Item) and [PA::SMHS,PA::XYC,PA::OLS,PA::BLS,PA::GLS,PA::YLS,PA::CLS,PA::PLS,PA::FLS].include?(item.id)
end
return true
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.index = 0
@data = []
for item in $game_party.items
next unless include?(item)
@data.push(item)
end
@data.push(nil) if include?(nil)
@item_max = @data.size
create_contents
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# ● 描绘项目
# index : 项目编号
#--------------------------------------------------------------------------
def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
item = @data[index]
if item != nil
number = $game_party.item_number(item)
rect.width -= 4
draw_item_name(item, rect.x, rect.y)
self.contents.draw_text(rect, sprintf(":%2d", number), 2)
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)
@help_window.x = 72
end
end
#==============================================================================
# ■ Window_DestEquip #equip add clear items
#==============================================================================
class Window_DestEquip < Window_Base
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_reader :equip
attr_reader :items
attr_accessor :index
#--------------------------------------------------------------------------
# ● 初始化对象
# x : 窗口的 X 坐标
# y : 窗口的 Y 坐标
# width : 窗口的宽
# height : 窗口的高
#--------------------------------------------------------------------------
def initialize(x, y, width, height)
super(x, y, width, height)
clear
end
#--------------------------------------------------------------------------
# ● 添加物品
#--------------------------------------------------------------------------
def add(item, n = 1)
$game_party.lose_item(item, n)
if [url=home.php?mod=space&uid=370741]@Index[/url] == -1
@equip = item
else
number = @items[item].to_i
@items[item] = [[number + n, 0].max, 9999].min
end
@index += 1
draw_item(item, n)
end
#--------------------------------------------------------------------------
# ● 清除物品
#--------------------------------------------------------------------------
def clear
@equip = nil
@items = {}
@index = -1
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(0,0,self.contents.width-16,WLH,"升级装备:")
self.contents.draw_text(0,WLH*2,self.contents.width-16,WLH,"炼制材料:")
end
#--------------------------------------------------------------------------
# ● 归还物品
#--------------------------------------------------------------------------
def revert
$game_party.gain_item(@equip, 1)
@items.each{|i,n| $game_party.gain_item(i, n)}
clear
end
#--------------------------------------------------------------------------
# ● 描绘项目
# index : 项目编号
#--------------------------------------------------------------------------
def draw_item(item, n)
rect = Rect.new(4,WLH+WLH*@index,self.contents.width-8, WLH)
rect.y += WLH if @index >0
if item != nil
draw_item_name(item, rect.x, rect.y)
self.contents.draw_text(rect, sprintf(":%2d", n), 2)
end
end
#--------------------------------------------------------------------------
# ● 更新帮助文本
#--------------------------------------------------------------------------
def update_help
@help_window_another.set_text(item == nil ? "" : item.description)
end
end
#==============================================================================
# ■ Window_EquipNumber
#==============================================================================
class Window_EquipNumber < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对象
# x : 窗口的 X 坐标
# y : 窗口的 Y 坐标
#--------------------------------------------------------------------------
def initialize(x, y)
super(x, y, 272, 112)
@item = nil
[url=home.php?mod=space&uid=25307]@Max[/url] = 1
[url=home.php?mod=space&uid=27178]@Number[/url] = 1
end
#--------------------------------------------------------------------------
# ● 设置物品、最大个数
#--------------------------------------------------------------------------
def set(item, max)
@item = item
@max = max
@number = 1
refresh
end
#--------------------------------------------------------------------------
# ● 设置输入个数
#--------------------------------------------------------------------------
def number
return @number
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
y = 32
self.z = 1000
self.contents.clear
draw_item_name(@item, 0, y)
self.contents.font.color = normal_color
self.contents.draw_text(212-32, y, 20, WLH, "×")
self.contents.draw_text(248-32, y, 20, WLH, @number, 2)
self.cursor_rect.set(244-32, y, 28, WLH)
end
#--------------------------------------------------------------------------
# ● 更新画面
#--------------------------------------------------------------------------
def update
super
if self.active
last_number = @number
if Input.repeat?(Input::RIGHT) and @number < @max
if @item.id == PA::XYC #幸运草
if @number < 3
@number += 1
end
elsif @item.id == PA::SMHS #神秘红石
@number += 1 if @number == 0
else
@number += 1
end
end
if Input.repeat?(Input::LEFT) and @number > 1
@number -= 1
end
if Input.repeat?(Input::UP) and @number < @max
if @item.id == PA::XYC #幸运草
if @number < 3
@number = [3, @max].min
end
elsif @item.id == PA::SMHS #神秘红石
@number = 1 if @max > 0
else
@number = [@number + 10, @max].min
end
end
if Input.repeat?(Input::DOWN) and @number > 1
@number = [@number - 10, 1].max
end
if @number != last_number
Sound.play_cursor
refresh
end
end
end
end
#==============================================================================
# ■ Window_Gold_Need
#==============================================================================
class Window_Gold_Need < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
super(272,360, 272, 56)
end
#--------------------------------------------------------------------------
# ● 设置文字
# text : 显示于窗口内的字符串
# align : 对其 (0..靠左对齐, 1..居中对齐, 2..靠右对齐)
#--------------------------------------------------------------------------
def set_text(gold = 0)
if gold != @gold
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, 100, 24, "总计费用:", 0)
draw_icon(205, 100, 0)
self.contents.font.color = Color.new(255,255,0,255)
self.contents.draw_text(140,0,100,24,"G", 2)
self.contents.draw_text(102, 0, 120, 24, gold.to_s, 2)
[url=home.php?mod=space&uid=236945]@gold[/url] = gold
end
end
end
#==============================================================================
# ■ Window_EquipNumber
#==============================================================================
class Window_Success < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
super(272, 304, 272, 56)
end
#--------------------------------------------------------------------------
# ● 设置文字
# text : 显示于窗口内的字符串
# align : 对其 (0..靠左对齐, 1..居中对齐, 2..靠右对齐)
#--------------------------------------------------------------------------
def set_text(equip = nil, lv = 1)
@success = nil
success = 0
success = 100 if Game_Equip::UpGrade_Absoluteness
new_lv = lv.nil? ? 1 : lv + 1
$item_x = 0 if $item_x == nil
$item_s = 0 if $item_s == nil
if equip == nil
success = 0
elsif $item_s > 0 and $item_x == 0
success = 100
elsif $item_s == 0 and $item_x > 0
number = $item_x
number = 3 if number > 3
success = ((Game_Equip::BaseSucceed ** new_lv) * 1000).round / 10.0 + 5 * number
elsif $item_s == 0 and $item_x == 0
success = ((Game_Equip::BaseSucceed ** new_lv) * 1000).round / 10.0
else
success = 0
end
success = 0 if new_lv > Game_Equip::MaxLevel
if success != @success
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, 120, 24, "升级成功率:", 0)
self.contents.draw_text(120, 0, 120, 24, success.to_s + "%", 2)
@success = success
end
end
end
#==============================================================================
# ■ Scene_UpEquip
#==============================================================================
class Scene_UpEquip < Scene_Base
include Game_Equip
#--------------------------------------------------------------------------
# ● 开始处理
#--------------------------------------------------------------------------
def start
super
create_menu_background
create_command_window
@name_window = Window_Base.new(0,0,512-128,56)
@name_window.contents.draw_text(4,0,544,24,"装备升级",0)
@gold_need_window = Window_Gold_Need.new
@gold_need_window.set_text(0)
$item_x = 0
$item_s = 0
@success_window = Window_Success.new
@success_window.set_text(nil, 1)
@help_window_another = Window_Process_Help.new
@help_window_another.x = 0
@help_window_another.y = 56
@help_window = Window_Help.new
@gold_window = Window_Gold.new(384,0)
@scr_window = Window_ScrEquip.new(0,168,272,248)
@scr_window.active = true
@scr_window.help_window = @help_window
@dest_window = Window_DestEquip.new(272,112,272,248-56)
@number_window = Window_EquipNumber.new(272,304)
@number_window.active = false
@number_window.visible = false
@result_window = Window_Base.new(118,112,308,56)
@result_window.active = false
@result_window.visible = false
@material_enough_text = "炼制材料放置有误!"
@gold_enough_text = "升级费用不足!"
end
#--------------------------------------------------------------------------
# ● 结束处理
#--------------------------------------------------------------------------
def terminate
super
dispose_menu_background
dispose_command_window
@name_window.dispose
@gold_need_window.dispose
@success_window.dispose
@help_window.dispose
@help_window_another.dispose
@gold_window.dispose
@scr_window.dispose
@dest_window.dispose
@number_window.dispose
end
#--------------------------------------------------------------------------
# ● 更新画面
#--------------------------------------------------------------------------
def update
super
update_menu_background
@help_window.update
@help_window_another.update
@command_window.update
@gold_window.update
@scr_window.update
@dest_window.update
@number_window.update
if @command_window.active
@scr_window.contents_opacity = 128
@command_window.contents_opacity = 255
update_command_selection
elsif @scr_window.active
@scr_window.contents_opacity = 255
@command_window.contents_opacity = 128
update_item_selection
elsif @number_window.active
update_number_input
elsif @result_window.active
update_result_window
end
end
#--------------------------------------------------------------------------
# ● 生成指令窗口
#--------------------------------------------------------------------------
def create_command_window
s1 = "升级"
s2 = "重来"
s3 = "退出"
@command_window = Window_Command.new(272, [s1, s2 ,s3], 3, 0, 8)
@command_window.x = 0
@command_window.y = 112
@command_window.active = false
@command_window.contents_opacity = 128
end
#--------------------------------------------------------------------------
# ● 释放指令窗口
#--------------------------------------------------------------------------
def dispose_command_window
@command_window.dispose
end
#--------------------------------------------------------------------------
# ● 是否满足装备升级条件?
#--------------------------------------------------------------------------
def upgradeable?(equip)
return false if equip.nil?
if equip.is_a?(RPG::Weapon) || equip.is_a?(RPG::Armor) and equip.level.nil?
equip.level = 0
end
price = (equip.price * (GoldNeed ** (equip.level + 1))).round
if $game_party.gold < price
@gold_enough_text = "升级费用不足!"
else
@gold_enough_text = ""
end
@material_enough_text = "炼制材料放置有误!"
if equip.gifts != [] and equip.gifts != nil
if @dest_window.items[$data_items[PA::XYC]] != nil
return false if @dest_window.items[$data_items[PA::XYC]] > 3
end
if @dest_window.items[$data_items[PA::SMHS]] != nil
return false if @dest_window.items[$data_items[PA::SMHS]] > 1
end
case equip.gifts.size
when 1
if @dest_window.items[$data_items[PA::XYC]].nil? and @dest_window.items[$data_items[PA::SMHS]].nil?
return false if @dest_window.items.size != 1
else
return false if @dest_window.items.size != 2
end
return false if @dest_window.items[$data_items[PA::BLS]].nil?
return false if @dest_window.items[$data_items[PA::BLS]] != 1
when 2
if @dest_window.items[$data_items[PA::XYC]].nil? and @dest_window.items[$data_items[PA::SMHS]].nil?
return false if @dest_window.items.size != 1
else
return false if @dest_window.items.size != 2
end
return false if @dest_window.items[$data_items[PA::GLS]].nil?
return false if @dest_window.items[$data_items[PA::GLS]] != 1
when 3
if @dest_window.items[$data_items[PA::XYC]].nil? and @dest_window.items[$data_items[PA::SMHS]].nil?
return false if @dest_window.items.size != 1
else
return false if @dest_window.items.size != 2
end
return false if @dest_window.items[$data_items[PA::YLS]].nil?
return false if @dest_window.items[$data_items[PA::YLS]] != 1
when 4
if @dest_window.items[$data_items[PA::XYC]].nil? and @dest_window.items[$data_items[PA::SMHS]].nil?
return false if @dest_window.items.size != 1
else
return false if @dest_window.items.size != 2
end
return false if @dest_window.items[$data_items[PA::CLS]].nil?
return false if @dest_window.items[$data_items[PA::CLS]] != 1
when 5
if @dest_window.items[$data_items[PA::XYC]].nil? and @dest_window.items[$data_items[PA::SMHS]].nil?
return false if @dest_window.items.size != 1
else
return false if @dest_window.items.size != 2
end
return false if @dest_window.items[$data_items[PA::PLS]].nil?
return false if @dest_window.items[$data_items[PA::PLS]] != 1
when 6
if @dest_window.items[$data_items[PA::XYC]].nil? and @dest_window.items[$data_items[PA::SMHS]].nil?
return false if @dest_window.items.size != 1
else
return false if @dest_window.items.size != 2
end
return false if @dest_window.items[$data_items[PA::FLS]].nil?
return false if @dest_window.items[$data_items[PA::FLS]] != 1
end
elsif equip.is_a?(RPG::Armor) and equip.base_id == PA::CRYSTAL
return false
else
if @dest_window.items[$data_items[PA::XYC]].nil? and @dest_window.items[$data_items[PA::SMHS]].nil?
return false if @dest_window.items.size != 1
else
return false if @dest_window.items.size != 2
end
return false if @dest_window.items[$data_items[PA::OLS]].nil?
return false if @dest_window.items[$data_items[PA::OLS]] != 1
end
@material_enough_text = ""
return false if $game_party.gold < price
## 扣钱
$game_party.lose_gold(price)
@gold_window.refresh
return true
end
#--------------------------------------------------------------------------
# ● 显示结果(包括处理金钱物品)
#--------------------------------------------------------------------------
def show_result
@result_window.active = true
@result_window.visible = true
unless upgradeable?(@dest_window.equip)
if @material_enough_text != "" and @gold_enough_text == ""
@result_window.contents.clear
@result_window.contents.draw_text(0,0,352,24,@material_enough_text, 0)
elsif @material_enough_text == "" and @gold_enough_text != ""
@result_window.contents.clear
@result_window.contents.draw_text(0,0,352,24,@gold_enough_text, 0)
elsif @material_enough_text != "" and @gold_enough_text != ""
@result_window.contents.clear
@result_window.contents.draw_text(0,0,352,24,@material_enough_text, 0)
@result_window.contents.draw_text(0,24,352,24,@gold_enough_text, 0)
end
@dest_window.revert
Sound.play_actor_collapse
## 直接返回
return
end
msg = Game_Equip.upgrade(@dest_window.equip)
@gold_window.refresh
case msg
when RPG::Weapon
@result_window.contents.clear
@result_window.contents.draw_text(0, 0, 352, 24, "升级成功!")
$game_party.gain_item(msg, 1)
Audio.se_play("Audio/SE/" + "Heal7", 100, 100)
Sound.play_shop
when RPG::Armor
@result_window.contents.clear
@result_window.contents.draw_text(0, 0, 352, 24, "升级成功!")
$game_party.gain_item(msg, 1)
Audio.se_play("Audio/SE/" + "Heal7", 100, 100)
Sound.play_shop
else
@result_window.contents.clear
@result_window.contents.draw_text(0, 0, 352, 24, "升级失败!")
Sound.play_actor_collapse
end
@dest_window.clear
end
#--------------------------------------------------------------------------
# ● 更新帮助文本
#--------------------------------------------------------------------------
def update_help(text)
@help_window_another.set_text2(text)
end
#--------------------------------------------------------------------------
# ● 更新指令窗口
#--------------------------------------------------------------------------
def update_command_selection
case @command_window.index
when 0
update_help("确定键执行装备升级。")
when 1
update_help("返回升级界面的最初状态。")
when 2
update_help("退出升级界面。")
end
if Input.trigger?(Input::B)
## 重来
Sound.play_cancel
@scr_window.active = true
@command_window.active = false
@gold_need_window.set_text(0)
$item_x = 0
$item_s = 0
@success_window.set_text(nil, 1)
elsif Input.trigger?(Input::C)
case @command_window.index
when 0 # 升级
Sound.play_decision
@command_window.active = false
@scr_window.active = false
######### 显示升级结果,归还物品
show_result
@gold_need_window.set_text(0)
$item_x = 0
$item_s = 0
@success_window.set_text(nil, 1)
when 1 # 重来
@command_window.active = false
@scr_window.active = false
@dest_window.revert
update_result_window
@gold_need_window.set_text(0)
$item_x = 0
$item_s = 0
@success_window.set_text(nil, 1)
when 2 # 退出
Sound.play_decision
@dest_window.revert
$scene = Scene_Map.new
end
end
end
#--------------------------------------------------------------------------
# ● 更新选择物品
#--------------------------------------------------------------------------
def update_item_selection
equip = @dest_window.equip
if equip.is_a?(RPG::Weapon) || equip.is_a?(RPG::Armor) and equip.level.nil?
@dest_window.equip.level = 0
end
material = PA::MATERIAL
if @scr_window.equip_only
update_help("请选择需要升级的装备,或按Q取消。")
else
number = equip.gifts.size rescue 0
update_help("请放置1个#{material[number]}和成功率提升材料,按W确认或按Q重来")
price = (equip.price * (GoldNeed ** (equip.level + 1))).round
@gold_need_window.set_text(price)
@success_window.set_text(equip, equip.level)
end
if Input.trigger?(Input::R)
if @dest_window.index > 0
Sound.play_decision
@command_window.active = true
@scr_window.active = false
else
Sound.play_buzzer
end
return
end
if Input.trigger?(Input::L)
if @scr_window.equip_only
Sound.play_cancel
@dest_window.revert
$scene = Scene_Map.new
else
@scr_window.equip_only = true
Sound.play_cancel
@dest_window.revert
@scr_window.active = true
@scr_window.refresh
@command_window.active = false
@gold_need_window.set_text(0)
$item_x = 0
$item_s = 0
@success_window.set_text(nil, 1)
return
end
end
if Input.trigger?(Input::C)
@item = @scr_window.item
number = $game_party.item_number(@item)
if @item == nil or number == 0
Sound.play_buzzer
else
##### 传递物品给容器栏
if number > 1
Sound.play_decision
@scr_window.active = false
@number_window.set(@item, number)
@number_window.active = true
@number_window.visible = true
else
Sound.play_shop
@dest_window.add(@scr_window.item, 1)
@scr_window.equip_only = false
@scr_window.refresh
end
end
end
end
#--------------------------------------------------------------------------
# ● 更新输入个数
#--------------------------------------------------------------------------
def update_number_input
if Input.trigger?(Input::B)
cancel_number_input
elsif Input.trigger?(Input::C)
decide_number_input
end
end
#--------------------------------------------------------------------------
# ● 更新结果窗体
#--------------------------------------------------------------------------
def update_result_window
if Input.trigger?(Input::B) or Input.trigger?(Input::C)
Sound.play_decision
@scr_window.equip_only = true
@scr_window.refresh
@scr_window.active = true
@result_window.active = false
@result_window.visible = false
end
end
#--------------------------------------------------------------------------
# ● 取消输入个数
#--------------------------------------------------------------------------
def cancel_number_input
Sound.play_cancel
@number_window.active = false
@number_window.visible = false
@scr_window.active = true
@scr_window.visible = true
end
#--------------------------------------------------------------------------
# ● 确定输入个数
#--------------------------------------------------------------------------
def decide_number_input
Sound.play_shop
@number_window.active = false
@number_window.visible = false
@dest_window.add(@item, @number_window.number)
$item_x = @dest_window.items[$data_items[PA::XYC]] #放置幸运草的数量
$item_s = @dest_window.items[$data_items[PA::SMHS]] #放置神秘红石数量(数量为1个)
$item_x = 0 if $item_x == nil
$item_s = 0 if $item_s == nil
@success_window.set_text(@dest_window.equip, @dest_window.equip.level)
@scr_window.equip_only = false
@scr_window.refresh
@scr_window.active = true
end
end
复制代码
作者:
正太君
时间:
2014-2-4 19:55
据说这个不能单独使用的
作者:
木讷
时间:
2014-2-13 13:20
正太君 发表于 2014-2-4 19:55
据说这个不能单独使用的
额······
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1