#shopmenu
#created by rpgmaker
#edited by Diego
#==============================================================================
# ■ Window_Base
#------------------------------------------------------------------------------
# ゲ?ム中のすべてのウィンドウのス?パ?クラスです。
#==============================================================================
class Window_Base < Window
# --------------------------------
def up_color
return Color.new(74, 210, 74)
end
# --------------------------------
def down_color
return Color.new(170, 170, 170)
end
end
#==============================================================================
# | Window_ShopCommand
#------------------------------------------------------------------------------
# ???????????????????????
#==============================================================================
class Window_ShopCommand < Window_Selectable
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def initialize
super(0, 64, 428, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 130
@item_max = 4
@column_max = 4
@commands = ["Buy", "Sell", "Equip", "Cancel"]
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# ? ?????
# index : ????
#--------------------------------------------------------------------------
def draw_item(index)
x = 4 + index * 107
self.contents.draw_text(x, 0, 128, 32, @commands[index])
end
end
#==============================================================================
# ■ Window_Help
#------------------------------------------------------------------------------
# スキルやアイテムの?明、アクタ?のステ?タスなどを表示するウィンドウです。
#==============================================================================
class Window_Help2 < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(80, 70, 480, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.size = 17
self.opacity = 130
end
#--------------------------------------------------------------------------
# ● テキスト設定
# text : ウィンドウに表示する文字列
# align : アラインメント (0..左?え、1..中央?え、2..右?え)
#--------------------------------------------------------------------------
def set_text(text, align = 0)
# テキストとアラインメントの少なくとも一方が前回と違っている場合
if text != @text or align != @align
# テキストを再描?
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
@text = text
@align = align
@actor = nil
end
self.visible = true
end
#--------------------------------------------------------------------------
# ● アクタ?設定
# actor : ステ?タスを表示するアクタ?
#--------------------------------------------------------------------------
def set_actor(actor)
if actor != @actor
self.contents.clear
draw_actor_name(actor, 4, 0)
draw_actor_state(actor, 140, 0)
draw_actor_hp(actor, 284, 0)
draw_actor_sp(actor, 460, 0)
@actor = actor
@text = nil
self.visible = true
end
end
#--------------------------------------------------------------------------
# ● エネミ?設定
# enemy : 名前とステ?トを表示するエネミ?
#--------------------------------------------------------------------------
def set_enemy(enemy)
text = enemy.name
state_text = make_battler_state_text(enemy, 112, false)
if state_text != ""
text += " " + state_text
end
set_text(text, 1)
end
end
#==============================================================================
# ■ Window_Gold
#------------------------------------------------------------------------------
# ゴ?ルドを表示するウィンドウです。
#==============================================================================
class Window_Gold2 < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 130
refresh
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
self.contents.clear
cx = contents.text_size($data_system.words.gold).width
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, 120-cx-2, 32, $game_party.gold.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(124-cx, 0, cx, 32, $data_system.words.gold, 2)
end
end
#==============================================================================
# ■ Window_Equipment
#------------------------------------------------------------------------------
# ゴ?ルドを表示するウィンドウです。
#==============================================================================
class Window_Equipment < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(240, 8, 160, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.size = 17
self.opacity = 130
refresh
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(28, 0, 96, 32, " Equipment")
end
end
class Window_EquipLeft2 < Window_Base
# --------------------------------
attr_accessor :mode
attr_accessor :changes
# --------------------------------
def initialize(actor)
super(0, 130, 320, 260)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.size = 17
self.opacity = 130
self.z += 100
@actor = actor
@mode = 0
@changes = [0, 0, 0, 0, 0, 0, 0, 0]
@elem_text = ""
@stat_text = ""
refresh
end
# --------------------------------
def refresh
self.contents.clear
draw_actor_name(@actor, 4, 0)
draw_actor_level(@actor, 140, 0)
draw_actor_parameter(@actor, 4, 18, 0)
draw_actor_parameter(@actor, 4, 36, 1)
draw_actor_parameter(@actor, 4, 54, 2)
draw_actor_parameter(@actor, 4, 72, 3)
draw_actor_parameter(@actor, 4, 90, 4)
draw_actor_parameter(@actor, 4, 108, 5)
draw_actor_parameter(@actor, 4, 126, 6)
if @mode == 0
self.contents.font.color = up_color
self.contents.draw_text(4, 144, 200, 32, "Elemental Attack:")
self.contents.draw_text(4, 180, 200, 32, "Status Attack:")
end
if @mode == 1
self.contents.font.color = up_color
self.contents.draw_text(4, 144, 200, 32, "Elemental Defense:")
self.contents.draw_text(4, 180, 200, 32, "Status Defense:")
end
self.contents.font.color = normal_color
self.contents.draw_text(12, 162, 220, 32, @elem_text)
self.contents.draw_text(12, 198, 220, 32, @stat_text)
if @new_atk != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 18, 40, 32, " =", 1)
if @changes[0] == 0
self.contents.font.color = normal_color
elsif @changes[0] == -1
self.contents.font.color = down_color
else
self.contents.font.color = up_color
end
self.contents.draw_text(200, 18, 36, 32, @new_atk.to_s, 2)
end
if @new_pdef != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 36, 40, 32, " =", 1)
if @changes[1] == 0
self.contents.font.color = normal_color
elsif @changes[1] == -1
self.contents.font.color = down_color
else
self.contents.font.color = up_color
end
self.contents.draw_text(200, 36, 36, 32, @new_pdef.to_s, 2)
end
if @new_mdef != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 54, 40, 32, " =", 1)
if @changes[2] == 0
self.contents.font.color = normal_color
elsif @changes[2] == -1
self.contents.font.color = down_color
else
self.contents.font.color = up_color
end
self.contents.draw_text(200, 54, 36, 32, @new_mdef.to_s, 2)
end
if @new_str != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 72, 40, 32, " =", 1)
if @changes[3] == 0
self.contents.font.color = normal_color
elsif @changes[3] == -1
self.contents.font.color = down_color
else
self.contents.font.color = up_color
end
self.contents.draw_text(200, 72, 36, 32, @new_str.to_s, 2)
end
if @new_dex != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 90, 40, 32, " =", 1)
if @changes[4] == 0
self.contents.font.color = normal_color
elsif @changes[4] == -1
self.contents.font.color = down_color
else
self.contents.font.color = up_color
end
self.contents.draw_text(200, 90, 36, 32, @new_dex.to_s, 2)
end
if @new_agi != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 108, 40, 32, " =", 1)
if @changes[5] == 0
self.contents.font.color = normal_color
elsif @changes[5] == -1
self.contents.font.color = down_color
else
self.contents.font.color = up_color
end
self.contents.draw_text(200, 108, 36, 32, @new_agi.to_s, 2)
end
if @new_int != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 126, 40, 32, " =", 1)
if @changes[6] == 0
self.contents.font.color = normal_color
elsif @changes[6] == -1
self.contents.font.color = down_color
else
self.contents.font.color = up_color
end
self.contents.draw_text(200, 126, 36, 32, @new_int.to_s, 2)
end
end
# --------------------------------
def set_new_parameters(new_atk, new_pdef, new_mdef, new_str, new_dex,
new_agi, new_int, new_eva, elem_text, stat_text)
flag = false
if new_atk != @new_atk || new_pdef != @new_pdef || new_mdef != @new_mdef
flag = true
end
if new_str != @new_str || new_dex != @new_dex || new_agi != @new_agi
flag = true
end
if new_eva != @new_eva || elem_text != @elem_text || stat_text != @stat_text
flag = true
end
@new_atk = new_atk
@new_pdef = new_pdef
@new_mdef = new_mdef
@new_str = new_str
@new_dex = new_dex
@new_agi = new_agi
@new_int = new_int
@new_eva = new_eva
@elem_text = elem_text
@stat_text = stat_text
if flag
refresh
end
end
end
#==============================================================================
# ■ Window_EquipRight
#------------------------------------------------------------------------------
# ?備?面で、アクタ?が現在?備しているアイテムを表示するウィンドウです。
#==============================================================================
class Window_EquipRight2 < Window_Selectable
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# actor : アクタ?
#--------------------------------------------------------------------------
def initialize(actor)
super(320, 130, 320, 260)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.size = 17
self.opacity = 130
@actor = actor
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# ● アイテムの取得
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@data = []
@data.push($data_weapons[@actor.weapon_id])
@data.push($data_armors[@actor.armor1_id])
@data.push($data_armors[@actor.armor2_id])
@data.push($data_armors[@actor.armor3_id])
@data.push($data_armors[@actor.armor4_id])
@item_max = @data.size
self.contents.font.color = system_color
self.contents.draw_text(4, 32 * 0, 92, 32, $data_system.words.weapon)
self.contents.draw_text(4, 32 * 1, 92, 32, $data_system.words.armor1)
self.contents.draw_text(4, 32 * 2, 92, 32, $data_system.words.armor2)
self.contents.draw_text(4, 32 * 3, 92, 32, $data_system.words.armor3)
self.contents.draw_text(5, 32 * 4, 92, 32, $data_system.words.armor4)
draw_item_name(@data[0], 92, 32 * 0)
draw_item_name(@data[1], 92, 32 * 1)
draw_item_name(@data[2], 92, 32 * 2)
draw_item_name(@data[3], 92, 32 * 3)
draw_item_name(@data[4], 92, 32 * 4)
end
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.descript-xion)
end
end
class Window_EquipItem2 < Window_Selectable
# --------------------------------
def initialize(actor, equip_type)
super(100, 390, 428, 64)
self.opacity = 130
@actor = actor
@equip_type = equip_type
@column_max = 2
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# ● アイテムの取得
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
# ?備可能な武器を追加
if @equip_type == 0
weapon_set = $data_classes[@actor.class_id].weapon_set
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0 and weapon_set.include?(i)
@data.push($data_weapons[i])
end
end
end
# ?備可能な防具を追加
if @equip_type != 0
armor_set = $data_classes[@actor.class_id].armor_set
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0 and armor_set.include?(i)
if $data_armors[i].kind == @equip_type-1
@data.push($data_armors[i])
end
end
end
end
# 空白を追加
@data.push(nil)
# ビットマップを作成し、全項目を描?
@item_max = @data.size
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.font.size = 17
for i in 0...@item_max-1
draw_item(i)
end
end
#--------------------------------------------------------------------------
# ● 項目の描?
# index : 項目番?
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
x = 4 + index % 2 * (182 + 32)
y = index / 2 * 32
case item
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.font.color = normal_color
self.contents.font.size = 17
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 132, y, 16, 32, ":", 1)
self.contents.draw_text(x + 140, y, 24, 32, number.to_s, 2)
end
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.descript-xion)
end
end
#==============================================================================
# | Window_ShopBuy
#------------------------------------------------------------------------------
# ???????????????????????????????
#==============================================================================
class Window_ShopBuy < Window_Selectable
#--------------------------------------------------------------------------
# ? ?????????
# shop_goods : ??
#--------------------------------------------------------------------------
def initialize(shop_goods)
super(0, 130, 320, 260)
self.opacity = 130
@shop_goods = shop_goods
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# ? ???????
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for goods_item in @shop_goods
case goods_item[0]
when 0
item = $data_items[goods_item[1]]
when 1
item = $data_weapons[goods_item[1]]
when 2
item = $data_armors[goods_item[1]]
end
if item != nil
@data.push(item)
end
end
# ???? 0 ??????????????????????
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# ? ?????
# index : ????
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
# ???????????
case item
when RPG::Item
number = $game_party.item_number(item.id)
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
# ??????????????? 99 ????????????
# ???????????????
if item.price <= $game_party.gold and number < 99
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4
y = index * 32
rect = Rect.new(x, y, self.width - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 190, y, 88, 32, item.price.to_s, 2)
end
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.descript-xion)
end
end
#==============================================================================
# | Window_ShopSell
#------------------------------------------------------------------------------
# ????????????????????????????????????
#==============================================================================
class Window_ShopSell < Window_Selectable
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def initialize
super(320, 130, 320, 260)
self.opacity = 130
@column_max = 1
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# ? ???????
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 1...$data_items.size
if $game_party.item_number(i) > 0
@data.push($data_items[i])
end
end
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0
@data.push($data_weapons[i])
end
end
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0
@data.push($data_armors[i])
end
end
# ???? 0 ??????????????????????
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# ? ?????
# index : ????
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
case item
when RPG::Item
number = $game_party.item_number(item.id)
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
# ????????????????????????????
if item.price > 0
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4 + index % 1 * (288 + 32)
y = index / 1 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
end
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.descript-xion)
end
end
#==============================================================================
# | Window_ShopNumber
#------------------------------------------------------------------------------
# ?????????????????????????????????????
#==============================================================================
class Window_ShopNumber < Window_Base
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def initialize
super(0, 130, 320, 260)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 130
@item = nil
@max = 1
@price = 0
@number = 1
end
#--------------------------------------------------------------------------
# ? ???????????????
#--------------------------------------------------------------------------
def set(item, max, price)
@item = item
@max = max
@price = price
@number = 1
refresh
end
#--------------------------------------------------------------------------
# ? ??????????
#--------------------------------------------------------------------------
def number
return @number
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_item_name(@item, 4, 96)
self.contents.font.color = normal_color
self.contents.draw_text(182, 128, 32, 32, "×")
self.contents.draw_text(154, 128, 24, 32, @number.to_s, 2)
self.cursor_rect.set(304, 96, 32, 32)
# ????????????
domination = $data_system.words.gold
cx = contents.text_size(domination).width
total_price = @price * @number
self.contents.font.color = normal_color
self.contents.draw_text(-50, 160, 328-cx-2, 32, total_price.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(282-cx, 160, cx, 32, domination, 2)
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def update
super
if self.active
# ????? (+1)
if Input.repeat?(Input::RIGHT) and @number < @max
$game_system.se_play($data_system.cursor_se)
@number += 1
refresh
end
# ????? (-1)
if Input.repeat?(Input::LEFT) and @number > 1
$game_system.se_play($data_system.cursor_se)
@number -= 1
refresh
end
# ????? (+10)
if Input.repeat?(Input::UP) and @number < @max
$game_system.se_play($data_system.cursor_se)
@number = [@number + 10, @max].min
refresh
end
# ????? (-10)
if Input.repeat?(Input::DOWN) and @number > 1
$game_system.se_play($data_system.cursor_se)
@number = [@number - 10, 1].max
refresh
end
end
end
end
#==============================================================================
# | Window_ShopStatus
#------------------------------------------------------------------------------
# ?????????????????????????????????????
#==============================================================================
class Window_ShopStatus < Window_Base
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def initialize
super(320, 130, 320, 260)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 130
@sprite1 = nil
@sprite2 = nil
@sprite3 = nil
@sprite4 = nil
@walk = [false, false, false, false]
@count = 0
@item = nil
refresh
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def refresh
self.contents.clear
if @sprite1 != nil
@sprite1.dispose
@sprite1 = nil
end
if @sprite2 != nil
@sprite2.dispose
@sprite2 = nil
end
if @sprite3 != nil
@sprite3.dispose
@sprite3 = nil
end
if @sprite4 != nil
@sprite4.dispose
@sprite4 = nil
end
if @item == nil
return
end
case @item
when RPG::Item
number = $game_party.item_number(@item.id)
when RPG::Weapon
number = $game_party.weapon_number(@item.id)
when RPG::Armor
number = $game_party.armor_number(@item.id)
end
self.contents.font.color = system_color
self.contents.draw_text(4, -8, 200, 32, "Owned:")
self.contents.font.color = normal_color
self.contents.draw_text(204, -8, 32, 32, number.to_s, 2)
if @item.is_a?(RPG::Item)
@walk = [false, false, false, false]
return
end
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
if @item.is_a?(RPG::Weapon)
item1 = $data_weapons[actor.weapon_id]
elsif @item.kind == 0
item1 = $data_armors[actor.armor1_id]
elsif @item.kind == 1
item1 = $data_armors[actor.armor2_id]
elsif @item.kind == 2
item1 = $data_armors[actor.armor3_id]
else
item1 = $data_armors[actor.armor4_id]
end
if not actor.equippable?(@item)
@walk[i] = false
draw_actor_graphic(actor, 330, 194 + 64 * i, i, 0)
self.contents.font.color = normal_color
self.contents.draw_text(32, 26 + (54 * i), 150, 32, "Cannot Equip")
end
if actor.equippable?(@item)
@walk[i] = true
draw_actor_graphic(actor, 330, 144 + 64 * i, i, 1)
atk1 = 0
atk2 = 0
eva1 = 0
eva2 = 0
str1 = 0
str2 = 0
dex1 = 0
dex2 = 0
agi1 = 0
agi2 = 0
int1 = 0
int2 = 0
pdf1 = 0
pdf2 = 0
mdf1 = 0
mdf2 = 0
eva1 = 0
eva2 = 0
str1 = item1 != nil ? item1.str_plus : 0
str2 = @item != nil ? @item.str_plus : 0
dex1 = item1 != nil ? item1.dex_plus : 0
dex2 = @item != nil ? @item.dex_plus : 0
agi1 = item1 != nil ? item1.agi_plus : 0
agi2 = @item != nil ? @item.agi_plus : 0
int1 = item1 != nil ? item1.int_plus : 0
int2 = @item != nil ? @item.int_plus : 0
pdf1 = item1 != nil ? item1.pdef : 0
pdf2 = @item != nil ? @item.pdef : 0
mdf1 = item1 != nil ? item1.mdef : 0
mdf2 = @item != nil ? @item.mdef : 0
if @item.is_a?(RPG::Weapon)
atk1 = item1 != nil ? item1.atk : 0
atk2 = @item != nil ? @item.atk : 0
end
if @item.is_a?(RPG::Armor)
eva1 = item1 != nil ? item1.eva : 0
eva2 = @item != nil ? @item.eva : 0
end
str_change = str2 - str1
dex_change = dex2 - dex1
agi_change = agi2 - agi1
int_change = int2 - int1
pdf_change = pdf2 - pdf1
mdf_change = mdf2 - mdf1
atk_change = atk2 - atk1
eva_change = eva2 - eva1
if item1 == nil
name1 = ""
else
name1 = item1.name
end
if @item == nil
name2 = ""
else
name2 = @item.name
end
if str_change == 0 && dex_change == 0 && agi_change == 0 &&
pdf_change == 0 && mdf_change == 0 && atk_change == 0 &&
eva_change == 0 && name1 != name2
self.contents.font.color = normal_color
self.contents.draw_text(32, 26 + (54 * i), 150, 32, "No Change")
end
if name1 == name2
self.contents.font.color = normal_color
self.contents.draw_text(32, 26 + (54 * i), 200, 32, "Currently Equipped")
end
self.contents.font.size = 16
self.contents.font.color = normal_color
if @item.is_a?(RPG::Weapon) && atk_change != 0
self.contents.draw_text(32, 10 + (54 * i), 32, 32, "ATK")
end
if @item.is_a?(RPG::Armor) && eva_change != 0
self.contents.draw_text(32, 10 + (54 * i), 32, 32, "EVA")
end
if pdf_change != 0
self.contents.draw_text(32, 26 + (54 * i), 32, 32, "PDF")
end
if mdf_change != 0
self.contents.draw_text(32, 42 + (54 * i), 32, 32, "MDF")
end
if str_change != 0
self.contents.draw_text(112, 10 + (54 * i), 32, 32, "STR")
end
if dex_change != 0
self.contents.draw_text(112, 26 + (54 * i), 32, 32, "DEX")
end
if agi_change != 0
self.contents.draw_text(112, 42 + (54 * i), 32, 32, "AGI")
end
if str_change != 0
self.contents.draw_text(192, 10 + (54 * i), 32, 32, "INT")
end
if @item.is_a?(RPG::Weapon) && atk_change > 0
self.contents.font.color = up_color
s = atk_change.abs.to_s
self.contents.draw_text(60, 10 + (54 * i), 4, 32, "+")
self.contents.draw_text(62, 10 + (54 * i), 24, 32, s, 2)
end
if @item.is_a?(RPG::Weapon) && atk_change < 0
self.contents.font.color = down_color
s = atk_change.abs.to_s
self.contents.draw_text(60, 10 + (54 * i), 4, 32, "-")
self.contents.draw_text(62, 10 + (54 * i), 24, 32, s, 2)
end
if @item.is_a?(RPG::Armor) && eva_change > 0
self.contents.font.color = up_color
s = eva_change.abs.to_s
self.contents.draw_text(60, 10 + (54 * i), 4, 32, "+")
self.contents.draw_text(62, 10 + (54 * i), 24, 32, s, 2)
end
if @item.is_a?(RPG::Armor) && eva_change < 0
self.contents.font.color = down_color
s = eva_change.abs.to_s
self.contents.draw_text(60, 10 + (54 * i), 4, 32, "-")
self.contents.draw_text(62, 10 + (54 * i), 24, 32, s, 2)
end
if pdf_change > 0
self.contents.font.color = up_color
s = pdf_change.abs.to_s
self.contents.draw_text(60, 26 + (54 * i), 4, 32, "+")
self.contents.draw_text(62, 26 + (54 * i), 24, 32, s, 2)
end
if pdf_change < 0
self.contents.font.color = down_color
s = pdf_change.abs.to_s
self.contents.draw_text(60, 26 + (54 * i), 4, 32, "-")
self.contents.draw_text(62, 26 + (54 * i), 24, 32, s, 2)
end
if mdf_change > 0
self.contents.font.color = up_color
s = mdf_change.abs.to_s
self.contents.draw_text(60, 42 + (54 * i), 4, 32, "+")
self.contents.draw_text(62, 42 + (54 * i), 24, 32, s, 2)
end
if mdf_change < 0
self.contents.font.color = down_color
s = mdf_change.abs.to_s
self.contents.draw_text(60, 42 + (54 * i), 4, 32, "-")
self.contents.draw_text(62, 42 + (54 * i), 24, 32, s, 2)
end
if str_change > 0
self.contents.font.color = up_color
s = str_change.abs.to_s
self.contents.draw_text(140, 10 + (54 * i), 4, 32, "+")
self.contents.draw_text(142, 10 + (54 * i), 24, 32, s, 2)
end
if str_change < 0
self.contents.font.color = down_color
s = str_change.abs.to_s
self.contents.draw_text(140, 10 + (54 * i), 4, 32, "-")
self.contents.draw_text(142, 10 + (54 * i), 24, 32, s, 2)
end
if dex_change > 0
self.contents.font.color = up_color
s = dex_change.abs.to_s
self.contents.draw_text(140, 26 + (54 * i), 4, 32, "+")
self.contents.draw_text(142, 26 + (54 * i), 24, 32, s, 2)
end
if dex_change < 0
self.contents.font.color = down_color
s = dex_change.abs.to_s
self.contents.draw_text(140, 26 + (54 * i), 4, 32, "-")
self.contents.draw_text(142, 26 + (54 * i), 24, 32, s, 2)
end
if agi_change > 0
self.contents.font.color = up_color
s = agi_change.abs.to_s
self.contents.draw_text(140, 42 + (54 * i), 4, 32, "+")
self.contents.draw_text(142, 42 + (54 * i), 24, 32, s, 2)
end
if agi_change < 0
self.contents.font.color = down_color
s = agi_change.abs.to_s
self.contents.draw_text(140, 42 + (54 * i), 4, 32, "-")
self.contents.draw_text(142, 42 + (54 * i), 24, 32, s, 2)
end
if int_change > 0
self.contents.font.color = up_color
s = int_change.abs.to_s
self.contents.draw_text(220, 10 + (54 * i), 4, 32, "+")
self.contents.draw_text(222, 10 + (54 * i), 24, 32, s, 2)
end
if int_change < 0
self.contents.font.color = down_color
s = int_change.abs.to_s
self.contents.draw_text(220, 10 + (54 * i), 4, 32, "-")
self.contents.draw_text(222, 10 + (54 * i), 24, 32, s, 2)
end
end
end
end
# ---------------------------------------
def item=(item)
if @item != item
@item = item
refresh
end
end
# ---------------------------------------
def draw_actor_graphic(actor, x, y, id, tone_id)
if id == 0
@v1 = Viewport.new(330, 164, 32, 48)
@v1.z = 9998
@sprite1 = Sprite.new(@v1)
@sprite1.bitmap = RPG::Cache.character(actor.character_name,
actor.character_hue)
if tone_id == 0
@sprite1.tone = Tone.new(0, 0, 0, 255)
else
@sprite1.tone = Tone.new(0, 0, 0, 0)
end
@sprite1.visible = true
end
if id == 1
@v2 = Viewport.new(330, 218, 32, 48)
@v2.z = 9999
@sprite2 = Sprite.new(@v2)
@sprite2.bitmap = RPG::Cache.character(actor.character_name,
actor.character_hue)
if tone_id == 0
@sprite2.tone = Tone.new(0, 0, 0, 255)
else
@sprite2.tone = Tone.new(0, 0, 0, 0)
end
@sprite2.visible = true
end
if id == 2
@v3 = Viewport.new(330, 272, 32, 48)
@v3.z = 9999
@sprite3 = Sprite.new(@v3)
@sprite3.bitmap = RPG::Cache.character(actor.character_name,
actor.character_hue)
if tone_id == 0
@sprite3.tone = Tone.new(0, 0, 0, 255)
else
@sprite3.tone = Tone.new(0, 0, 0, 0)
end
@sprite3.visible = true
end
if id == 3
@v4 = Viewport.new(330, 326, 32, 48)
@v4.z = 9999
@sprite4 = Sprite.new(@v4)
@sprite4.bitmap = RPG::Cache.character(actor.character_name,
actor.character_hue)
if tone_id == 0
@sprite4.tone = Tone.new(0, 0, 0, 255)
else
@sprite4.tone = Tone.new(0, 0, 0, 0)
end
@sprite4.visible = true
end
end
# ---------------------------------------
def update
super
@count += 1
for i in 0..@walk.size
if @walk[i] == false
case i
when 0
if @sprite1 != nil
@sprite1.ox = 0
end
when 1
if @sprite2 != nil
@sprite2.ox = 0
end
when 2
if @sprite3 != nil
@sprite3.ox = 0
end
when 3
if @sprite4 != nil
@sprite4.ox = 0
end
end
end
end
if @count == 0
for i in 0..@walk.size
if @walk[i] == true
case i
when 0
if @sprite1 != nil
@sprite1.ox = 0
end
when 1
if @sprite2 != nil
@sprite2.ox = 0
end
when 2
if @sprite3 != nil
@sprite3.ox = 0
end
when 3
if @sprite4 != nil
@sprite4.ox = 0
end
end
end
end
end
if @count == 5
for i in 0..@walk.size
if @walk[i] == true
case i
when 0
if @sprite1 != nil
@sprite1.ox = 32
end
when 1
if @sprite2 != nil
@sprite2.ox = 32
end
when 2
if @sprite3 != nil
@sprite3.ox = 32
end
when 3
if @sprite4 != nil
@sprite4.ox = 32
end
end
end
end
end
if @count == 10
for i in 0..@walk.size
if @walk[i] == true
case i
when 0
if @sprite1 != nil
@sprite1.ox = 64
end
when 1
if @sprite2 != nil
@sprite2.ox = 64
end
when 2
if @sprite3 != nil
@sprite3.ox = 64
end
when 3
if @sprite4 != nil
@sprite4.ox = 64
end
end
end
end
end
if @count == 15
@count = 0
end
end
end
#==============================================================================
# | Window_Help
#------------------------------------------------------------------------------
# ?????????????????????????????????????
#==============================================================================
class Window_HelpShop < Window_Base
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def initialize
super(80, 70, 480, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 130
end
#--------------------------------------------------------------------------
# ? ??????
# text : ?????????????
# align : ??????? (0..????1..?????2..???)
#--------------------------------------------------------------------------
def set_text(text, align = 1)
# ???????????????????????????????
if text != @text or align != @align
# ????????
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
@text = text
@align = align
@actor = nil
end
self.visible = true
end
#--------------------------------------------------------------------------
# ? ??????
# actor : ??????????????
#--------------------------------------------------------------------------
def set_actor(actor)
if actor != @actor
self.contents.clear
draw_actor_name(actor, 4, 0)
draw_actor_state(actor, 140, 0)
draw_actor_hp(actor, 284, 0)
draw_actor_sp(actor, 460, 0)
@actor = actor
@text = nil
self.visible = true
end
end
#--------------------------------------------------------------------------
# ? ??????
# enemy : ????????????????
#--------------------------------------------------------------------------
def set_enemy(enemy)
text = enemy.name
state_text = make_battler_state_text(enemy, 112, false)
if state_text != ""
text += " " + state_text
end
set_text(text, 1)
end
end
#class scene_shop
#==============================================================================
# | Scene_Shop
#------------------------------------------------------------------------------
# ??????????????????
#==============================================================================
class Scene_Shop
#--------------------------------------------------------------------------
# ? ?????
#--------------------------------------------------------------------------
def main
@spriteset = Spriteset_Map.new
# ???????????
@help_window = Window_HelpShop.new
# ????????????
@command_window = Window_ShopCommand.new
@command_window. x = 100
@command_window. y = 390
# ????????????
@gold_window = Window_Gold2.new
@gold_window.x = 240
@gold_window.y = 8
# ???????????
# ??????????
@buy_window = Window_ShopBuy.new($game_temp.shop_goods)
@buy_window.active = false
@buy_window.visible = false
@buy_window.help_window = @help_window
# ??????????
@sell_window = Window_ShopSell.new
@sell_window.active = false
@sell_window.visible = false
@sell_window.help_window = @help_window
# ????????????
@number_window = Window_ShopNumber.new
@number_window.active = false
@number_window.visible = false
# ?????????????
@status_window = Window_ShopStatus.new
@status_window.visible = false
#command
# ?????????
Graphics.transition
# ??????
loop do
# ????????
Graphics.update
# ???????
Input.update
# ??????
update
# ????????????????
if $scene != self
break
end
end
# ?????????
Graphics.freeze
@spriteset.dispose
@help_window.dispose
@command_window.dispose
@gold_window.dispose
@buy_window.dispose
@sell_window.dispose
@number_window.dispose
@status_window.dispose
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def update
@help_window.update
@command_window.update
@gold_window.update
@buy_window.update
@sell_window.update
@number_window.update
@status_window.update
# ??????????????????: update_command ???
if @command_window.active
update_command
return
end
# ????????????????: update_buy ???
if @buy_window.active
update_buy
return
end
# ????????????????: update_sell ???
if @sell_window.active
update_sell
return
end
# ??????????????????: update_number ???
if @number_window.active
update_number
return
end
end
#--------------------------------------------------------------------------
# ? ?????? (??????????????????)
#--------------------------------------------------------------------------
def update_command
# B ??????????
if Input.trigger?(Input::B)
# ????? SE ???
$game_system.se_play($data_system.cancel_se)
# ??????????
$scene = Scene_Map.new
return
end
# C ??????????
if Input.trigger?(Input::C)
# ???????????????????
case @command_window.index
when 0 # ????
# ?? SE ???
$game_system.se_play($data_system.decision_se)
# ???????????????
@command_window.active = false
@buy_window.active = true
@buy_window.visible = true
@buy_window.refresh
@status_window.visible = true
when 1 # ????
# ?? SE ???
$game_system.se_play($data_system.decision_se)
# ???????????????
@command_window.active = false
@sell_window.active = true
@sell_window.visible = true
@sell_window.refresh
when 2 # ???
# ?? SE ???
$game_system.se_play($data_system.decision_se)
# ??????????
$scene = Scene_Equip2.new
when 3 # ???
# ?? SE ???
$game_system.se_play($data_system.decision_se)
# ??????????
$scene = Scene_Map.new
end
return
end
end
#--------------------------------------------------------------------------
# ? ?????? (????????????????)
#--------------------------------------------------------------------------
def update_buy
# ??????????????????
@status_window.item = @buy_window.item
# B ??????????
if Input.trigger?(Input::B)
# ????? SE ???
$game_system.se_play($data_system.cancel_se)
# ???????????????
@command_window.active = true
@buy_window.active = false
@buy_window.visible = false
@status_window.visible = false
@status_window.item = nil
# ??????????
@help_window.set_text("")
return
end
# C ??????????
if Input.trigger?(Input::C)
# ???????
@item = @buy_window.item
# ??????????????????????????
if @item == nil or @item.price > $game_party.gold
# ??? SE ???
$game_system.se_play($data_system.buzzer_se)
return
end
# ???????????
case @item
when RPG::Item
number = $game_party.item_number(@item.id)
when RPG::Weapon
number = $game_party.weapon_number(@item.id)
when RPG::Armor
number = $game_party.armor_number(@item.id)
end
# ??? 99 ?????????
if number == 99
# ??? SE ???
$game_system.se_play($data_system.buzzer_se)
return
end
# ?? SE ???
$game_system.se_play($data_system.decision_se)
# ???????????
max = @item.price == 0 ? 99 : $game_party.gold / @item.price
max = [max, 99 - number].min
# ?????????????????
@buy_window.active = false
@buy_window.visible = false
@number_window.set(@item, max, @item.price)
@number_window.active = true
@number_window.visible = true
end
end
#--------------------------------------------------------------------------
# ? ?????? (????????????????)
#--------------------------------------------------------------------------
def update_sell
# B ボタンが押された場合
if Input.trigger?(Input::B)
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
# ウィンドウの?態を初期モ?ドへ
@command_window.active = true
@sell_window.active = false
@sell_window.visible = false
@status_window.item = nil
#@status_window.visible = false
# ヘルプテキストを消去
@help_window.set_text("")
return
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
# アイテムを取得
@item = @sell_window.item
# ステ?タスウィンドウのアイテムを設定
@status_window.item = @item
# アイテムが無?の場合、または?格が 0 (?却不可) の場合
if @item == nil or @item.price == 0
# ブザ? SE を演奏
$game_system.se_play($data_system.buzzer_se)
@status_window.item = nil
@status_window.item = @item
return
end
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
# アイテムの所持?を取得
case @item
when RPG::Item
number = $game_party.item_number(@item.id)
when RPG::Weapon
number = $game_party.weapon_number(@item.id)
when RPG::Armor
number = $game_party.armor_number(@item.id)
end
# 最大?却個? = アイテムの所持?
max = number
# ウィンドウの?態を個?入力モ?ドへ
@sell_window.active = false
@sell_window.visible = false
@number_window.set(@item, max, @item.price / 2)
@number_window.active = true
@number_window.visible = true
@status_window.visible = true
end
end
#--------------------------------------------------------------------------
# ● フレ?ム更新 (個?入力ウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_number
# B ボタンが押された場合
if Input.trigger?(Input::B)
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
# 個?入力ウィンドウを非アクティブ?不可視に設定
@number_window.active = false
@number_window.visible = false
# コマンドウィンドウのカ?ソル位置で分岐
case @command_window.index
when 0 # 購入する
# ウィンドウの?態を購入モ?ドへ
@buy_window.active = true
@buy_window.visible = true
when 1 # ?却する
# ウィンドウの?態を?却モ?ドへ
@sell_window.active = true
@sell_window.visible = true
@status_window.visible = false
@status_window.item = nil
end
return
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
# ショップ SE を演奏
$game_system.se_play($data_system.shop_se)
# 個?入力ウィンドウを非アクティブ?不可視に設定
@number_window.active = false
@number_window.visible = false
# コマンドウィンドウのカ?ソル位置で分岐
case @command_window.index
when 0 # 購入する
# 購入?理
$game_party.lose_gold(@number_window.number * @item.price)
case @item
when RPG::Item
$game_party.gain_item(@item.id, @number_window.number)
when RPG::Weapon
$game_party.gain_weapon(@item.id, @number_window.number)
when RPG::Armor
$game_party.gain_armor(@item.id, @number_window.number)
end
# 各ウィンドウをリフレッシュ
@gold_window.refresh
@buy_window.refresh
@status_window.refresh
# ウィンドウの?態を購入モ?ドへ
@buy_window.active = true
@buy_window.visible = true
when 1 # ?却する
# ?却?理
$game_party.gain_gold(@number_window.number * (@item.price / 2))
case @item
when RPG::Item
$game_party.lose_item(@item.id, @number_window.number)
when RPG::Weapon
$game_party.lose_weapon(@item.id, @number_window.number)
when RPG::Armor
$game_party.lose_armor(@item.id, @number_window.number)
end
# 各ウィンドウをリフレッシュ
@gold_window.refresh
@sell_window.refresh
@status_window.refresh
# ウィンドウの?態を?却モ?ドへ
@sell_window.active = true
@sell_window.visible = true
@status_window.visible = false
@status_window.item = nil
end
return
end
end
end
#==============================================================================
# ■ Scene_Equip2
#------------------------------------------------------------------------------
# ?備?面の?理を行うクラスです。
#==============================================================================
class Scene_Equip2
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# actor_index : アクタ?インデックス
# equip_index : ?備インデックス
#--------------------------------------------------------------------------
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
@equip_index = equip_index
end
#--------------------------------------------------------------------------
# ● メイン?理
#--------------------------------------------------------------------------
def main
@spriteset = Spriteset_Map.new
# アクタ?を取得
@actor = $game_party.actors[@actor_index]
# ウィンドウを作成
@equipment_window = Window_Equipment.new
@help_window = Window_Help2.new
@left_window = Window_EquipLeft2.new(@actor)
@right_window = Window_EquipRight2.new(@actor)
@item_window1 = Window_EquipItem2.new(@actor, 0)
@item_window2 = Window_EquipItem2.new(@actor, 1)
@item_window3 = Window_EquipItem2.new(@actor, 2)
@item_window4 = Window_EquipItem2.new(@actor, 3)
@item_window5 = Window_EquipItem2.new(@actor, 4)
# ヘルプウィンドウを?連付け
@right_window.help_window = @help_window
@item_window1.help_window = @help_window
@item_window2.help_window = @help_window
@item_window3.help_window = @help_window
@item_window4.help_window = @help_window
@item_window5.help_window = @help_window
# カ?ソル位置を設定
@right_window.index = @equip_index
refresh
# トランジション?行
Graphics.transition
# メインル?プ
loop do
# ゲ?ム?面を更新
Graphics.update
# 入力情報を更新
Input.update
# フレ?ム更新
update
# ?面が切り替わったらル?プを中?
if $scene != self
break
end
end
# トランジション準備
Graphics.freeze
# ウィンドウを解放
@spriteset.dispose
@equipment_window.dispose
@help_window.dispose
@left_window.dispose
@right_window.dispose
@item_window1.dispose
@item_window2.dispose
@item_window3.dispose
@item_window4.dispose
@item_window5.dispose
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
# --------------------------------
def refresh
@item_window1.visible = (@right_window.index == 0)
@item_window2.visible = (@right_window.index == 1)
@item_window3.visible = (@right_window.index == 2)
@item_window4.visible = (@right_window.index == 3)
@item_window5.visible = (@right_window.index == 4)
item1 = @right_window.item
case @right_window.index
when 0
@item_window = @item_window1
newmode = 0
when 1
@item_window = @item_window2
newmode = 1
when 2
@item_window = @item_window3
newmode = 1
when 3
@item_window = @item_window4
newmode = 1
when 4
@item_window = @item_window5
newmode = 1
end
if newmode != @left_window.mode
@left_window.mode = newmode
@left_window.refresh
end
if @right_window.active
@left_window.set_new_parameters(nil, nil, nil, nil, nil, nil, nil, nil,
"", "")
end
if @item_window.active
item2 = @item_window.item
last_hp = @actor.hp
last_sp = @actor.sp
old_atk = @actor.atk
old_pdef = @actor.pdef
old_mdef = @actor.mdef
old_str = @actor.str
old_dex = @actor.dex
old_agi = @actor.agi
old_int = @actor.int
old_eva = @actor.eva
@actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
new_atk = @actor.atk
new_pdef = @actor.pdef
new_mdef = @actor.mdef
new_str = @actor.str
new_dex = @actor.dex
new_agi = @actor.agi
new_int = @actor.int
new_eva = @actor.eva
@left_window.changes = [0, 0, 0, 0, 0, 0, 0, 0]
if new_atk > old_atk
@left_window.changes[0] = 1
end
if new_atk < old_atk
@left_window.changes[0] = -1
end
if new_pdef > old_pdef
@left_window.changes[1] = 1
end
if new_pdef < old_pdef
@left_window.changes[1] = -1
end
if new_mdef > old_mdef
@left_window.changes[2] = 1
end
if new_mdef < old_mdef
@left_window.changes[2] = -1
end
if new_str > old_str
@left_window.changes[3] = 1
end
if new_str < old_str
@left_window.changes[3] = -1
end
if new_dex > old_dex
@left_window.changes[4] = 1
end
if new_dex < old_dex
@left_window.changes[4] = -1
end
if new_agi > old_agi
@left_window.changes[5] = 1
end
if new_agi < old_agi
@left_window.changes[5] = -1
end
if new_int > old_int
@left_window.changes[6] = 1
end
if new_int < old_int
@left_window.changes[6] = -1
end
if new_eva > old_eva
@left_window.changes[7] = 1
end
if new_eva < old_eva
@left_window.changes[7] = -1
end
elem_text = make_elem_text(item2)
stat_text = make_stat_text(item2)
@actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
@actor.hp = last_hp
@actor.sp = last_sp
@left_window.set_new_parameters(new_atk, new_pdef, new_mdef, new_str,
new_dex, new_agi, new_int, new_eva, elem_text, stat_text)
end
end
# --------------------------------
def make_elem_text(item)
text = ""
flag = false
if item.is_a?(RPG::Weapon)
for i in item.element_set
if flag
text += ", "
end
text += $data_system.elements[i]
flag = true
end
end
if item.is_a?(RPG::Armor)
for i in item.guard_element_set
if flag
text += ", "
end
text += $data_system.elements[i]
flag = true
end
end
return text
end
# --------------------------------
def make_stat_text(item)
text = ""
flag = false
if item.is_a?(RPG::Weapon)
for i in item.plus_state_set
if flag
text += ", "
end
text += $data_states[i].name
flag = true
end
end
if item.is_a?(RPG::Armor)
for i in item.guard_state_set
if flag
text += ", "
end
text += $data_states[i].name
flag = true
end
end
return text
end
#--------------------------------------------------------------------------
# ● フレ?ム更新
#--------------------------------------------------------------------------
def update
# ウィンドウを更新
@equipment_window.update
@left_window.update
@right_window.update
@item_window.update
refresh
# ライトウィンドウがアクティブの場合: update_right を呼ぶ
if @right_window.active
update_right
return
end
# アイテムウィンドウがアクティブの場合: update_item を呼ぶ
if @item_window.active
update_item
return
end
end
#--------------------------------------------------------------------------
# ● フレ?ム更新 (ライトウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_right
# B ボタンが押された場合
if Input.trigger?(Input::B)
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
# メニュ??面に切り替え
$scene = Scene_Shop.new
return
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
# ?備固定の場合
if @actor.equip_fix?(@right_window.index)
# ブザ? SE を演奏
$game_system.se_play($data_system.buzzer_se)
return
end
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
# アイテムウィンドウをアクティブ化
@right_window.active = false
@item_window.active = true
@item_window.index = 0
return
end
# R ボタンが押された場合
if Input.trigger?(Input::R)
# カ?ソル SE を演奏
$game_system.se_play($data_system.cursor_se)
# 次のアクタ?へ
@actor_index += 1
@actor_index %= $game_party.actors.size
# 別の?備?面に切り替え
$scene = Scene_Equip2.new(@actor_index, @right_window.index)
return
end
# L ボタンが押された場合
if Input.trigger?(Input::L)
# カ?ソル SE を演奏
$game_system.se_play($data_system.cursor_se)
# 前のアクタ?へ
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
# 別の?備?面に切り替え
$scene = Scene_Equip2.new(@actor_index, @right_window.index)
return
end
end
#--------------------------------------------------------------------------
# ● フレ?ム更新 (アイテムウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_item
# B ボタンが押された場合
if Input.trigger?(Input::B)
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
# ライトウィンドウをアクティブ化
@right_window.active = true
@item_window.active = false
@item_window.index = -1
return
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
# ?備 SE を演奏
$game_system.se_play($data_system.equip_se)
# アイテムウィンドウで現在選?されているデ?タを取得
item = @item_window.item
# ?備を?更
@actor.equip(@right_window.index, item == nil ? 0 : item.id)
# ライトウィンドウをアクティブ化
@right_window.active = true
@item_window.active = false
@item_window.index = -1
# ライトウィンドウ、アイテムウィンドウの?容を再作成
@right_window.refresh
@item_window.refresh
return
end
end
end
출처: 게임공작소
오류뜹니다.
buy 버튼 누르면 그러네요