Auteur: Yukihiro matsumoto
#============================================
# ‘ Scene_Equip
#----------------------------------------------
# @υζΚΜπs€NXΕ·B
#============================================
class Scene_Equip
#------------------------------------------
# IuWFNgϊ»
# actor_index : AN^[CfbNX
# equip_index : υCfbNX
#------------------------------------------
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
@equip_index = equip_index
end
#------------------------------------------
# C
#------------------------------------------
def main
# AN^[πζΎ
@actor = $game_party.actors[@actor_index]
# EBhEπμ¬
@help_window = Window_Help.new
@left_window = Window_EquipLeft.new(@actor)
@right_window = Window_EquipRight.new(@actor)
@item_window1 = Window_EquipItem.new(@actor, 0)
@item_window2 = Window_EquipItem.new(@actor, 1)
@item_window3 = Window_EquipItem.new(@actor, 2)
@item_window4 = Window_EquipItem.new(@actor, 3)
@item_window5 = Window_EquipItem.new(@actor, 4)
# wvEBhEπΦAt―
@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
# J[Κuπέθ
@right_window.index = @equip_index
refresh
# gWVΐs
Graphics.transition
# C[v
loop do
# Q[ζΚπXV
Graphics.update
# όΝξρπXV
Input.update
# t[XV
update
# ζΚͺΨθΦνΑ½η[vπf
if $scene != self
break
end
end
# gWVυ
Graphics.freeze
# EBhEππϊ
@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
#------------------------------------------
# tbV
#------------------------------------------
def refresh
# ACeEBhEΜΒσΤέθ
@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)
# »έυΜACeπζΎ
item1 = @right_window.item
# »έΜACeEBhEπ @item_window Ιέθ
case @right_window.index
when 0
@item_window = @item_window1
when 1
@item_window = @item_window2
when 2
@item_window = @item_window3
when 3
@item_window = @item_window4
when 4
@item_window = @item_window5
end
# CgEBhEͺANeBuΜκ
if @right_window.active
# υΟXγΜp[^πΑ
@left_window.set_new_parameters(nil, nil, nil)
end
# ACeEBhEͺANeBuΜκ
if @item_window.active
# »έIπΜACeπζΎ
item2 = @item_window.item
# υπΟX
last_hp = @actor.hp
last_sp = @actor.sp
@actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
# υΟXγΜp[^πζΎ
new_atk = @actor.atk
new_pdef = @actor.pdef
new_mdef = @actor.mdef
# υπί·
@actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
@actor.hp = last_hp
@actor.sp = last_sp
# tgEBhEΙ`ζ
@left_window.set_new_parameters(new_atk, new_pdef, new_mdef)
end
end
#------------------------------------------
# t[XV
#------------------------------------------
def update
# EBhEπXV
@left_window.update
@right_window.update
@item_window.update
refresh
# CgEBhEͺANeBuΜκ: update_right πΔΤ
if @right_window.active
update_right
return
end
# ACeEBhEͺANeBuΜκ: update_item πΔΤ
if @item_window.active
update_item
return
end
end
#------------------------------------------
# t[XV (CgEBhEͺANeBuΜκ)
#------------------------------------------
def update_right
# B {^ͺ³κ½κ
if Input.trigger?(Input::B)
# LZ SE πt
$game_system.se_play($data_system.cancel_se)
# j
[ζΚΙΨθΦ¦
$scene = Scene_Menu.new(2)
return
end
# C {^ͺ³κ½κ
if Input.trigger?(Input::C)
# υΕθΜκ
if @actor.equip_fix?(@right_window.index)
# uU[ SE πt
$game_system.se_play($data_system.buzzer_se)
return
end
# θ SE πt
$game_system.se_play($data_system.decision_se)
# ACeEBhEπANeBu»
@right_window.active = false
@item_window.active = true
@item_window.index = 0
return
end
# R {^ͺ³κ½κ
if Input.trigger?(Input::R)
# J[ SE πt
$game_system.se_play($data_system.cursor_se)
# ΜAN^[Φ
@actor_index += 1
@actor_index %= $game_party.actors.size
# ΚΜυζΚΙΨθΦ¦
$scene = Scene_Equip.new(@actor_index, @right_window.index)
return
end
# L {^ͺ³κ½κ
if Input.trigger?(Input::L)
# J[ SE πt
$game_system.se_play($data_system.cursor_se)
# OΜAN^[Φ
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
# ΚΜυζΚΙΨθΦ¦
$scene = Scene_Equip.new(@actor_index, @right_window.index)
return
end
end
#------------------------------------------
# t[XV (ACeEBhEͺANeBuΜκ)
#------------------------------------------
def update_item
# B {^ͺ³κ½κ
if Input.trigger?(Input::B)
# LZ SE πt
$game_system.se_play($data_system.cancel_se)
# CgEBhEπANeBu»
@right_window.active = true
@item_window.active = false
@item_window.index = -1
return
end
# C {^ͺ³κ½κ
if Input.trigger?(Input::C)
# υ SE πt
$game_system.se_play($data_system.equip_se)
# ACeEBhEΕ»έIπ³κΔ’ιf[^πζΎ
item = @item_window.item
# υπΟX
@actor.equip(@right_window.index, item == nil ? 0 : item.id)
# CgEBhEπANeBu»
@right_window.active = true
@item_window.active = false
@item_window.index = -1
# CgEBhEAACeEBhEΜΰeπΔμ¬
@right_window.refresh
@item_window.refresh
return
end
end
end |
|