#==============================================================================
# Menu Remodeling Script
#==============================================================================
#==============#
# Ver 1.03 #
#==============#
# Distribution Original Support URL
#
http://members.jcom.home.ne.jp/cogwheel/
# English translation by: Absoli
#==============================================================================
# * Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# â— Acquisition in battle picture X coordinate
#--------------------------------------------------------------------------
alias :screen_x_original :screen_x
def screen_x
# Calculating X coordinate from line order inside the party, (it returns)
if $game_temp.in_battle
return screen_x_original
else
if self.index != nil
return (self.index / 2 + 1) * 128 + (self.index % 2) * 264
else
return 0
end
end
end
#--------------------------------------------------------------------------
# â— Acquisition in battle picture Y coordinate
#--------------------------------------------------------------------------
alias :screen_y_original :screen_y
def screen_y
if $game_temp.in_battle
return screen_y_original
else
return 360 +(self.index / 2) * 104
end
end
end
#==============================================================================
# * Window_Help
#==============================================================================
class Window_Help2 < Window_Base
#--------------------------------------------------------------------------
# â— Object initialization
#--------------------------------------------------------------------------
def initialize
super(20, 42, 600, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.z = 6110
self.back_opacity = 192
end
#--------------------------------------------------------------------------
# â— Text setting
# text : The character string which is indicated in the window
# align : Alignment (0..The left arranging, 1..Central arranging, 2..The right arranging )
#--------------------------------------------------------------------------
def set_text(text, align = 0)
# When at least one side of the text and the alignment it is different from the last time,
if text != @text or align != @align
# Redrawing the text
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 setting
# actor : The actor who indicates status
#--------------------------------------------------------------------------
def set_actor(actor)
if actor != @actor
self.contents.clear
draw_actor_name(actor, 0, 0)
draw_actor_state(actor, 144, 0, 100)
draw_actor_hp(@actor, 256, 0)
draw_actor_sp(@actor, 424, 0)
@actor = actor
@text = nil
self.visible = true
end
end
#--------------------------------------------------------------------------
# â— Enemy setting
# enemy : The enemy which indicates name and the state
#--------------------------------------------------------------------------
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_Base
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# â— Drawing of name
# actor : Actor
# x : Ahead drawing X coordinate
# y : Ahead drawing Y coordinate
#--------------------------------------------------------------------------
def draw_actor_name(actor, x, y)
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 120, 32, actor.name)
end
#--------------------------------------------------------------------------
# â— Drawing of class
# actor : Actor
# x : Ahead drawing X coordinate
# y : Ahead drawing Y coordinate
#--------------------------------------------------------------------------
def draw_actor_class(actor, x, y)
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 120, 32, actor.class_name)
end
#--------------------------------------------------------------------------
# â— Drawing of graphics
# actor : Actor
# x : Ahead drawing X coordinate
# y : Ahead drawing Y coordinate
#--------------------------------------------------------------------------
def draw_actor_battler(actor, x, y)
bitmap = RPG::Cache.battler(actor.battler_name, actor.battler_hue)
cw = bitmap.width / 2
ch = bitmap.height
self.contents.blt(x - cw, y - ch, bitmap, bitmap.rect, 150)
end
#--------------------------------------------------------------------------
# â— Drawing of item name
# item : Item
# x : Ahead drawing X coordinate
# y : Ahead drawing Y coordinate
#--------------------------------------------------------------------------
def draw_item_name(item, x, y, width = 240)
if item == nil
return
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.draw_text(x + 28, y, width - 28, 32, item.name)
end
end
#==============================================================================
# * Window_Command2
#==============================================================================
class Window_MenuCommand < Window_Selectable
#--------------------------------------------------------------------------
# â— Object initialization
# width : Width of window
# commands : Arrangement in command character string
#--------------------------------------------------------------------------
def initialize(width, commands)
# Calculating the height of the window from the quantity of command
super(0, 0, width, 160)
@item_max = commands.size
@commands = commands
@column_max = 2
self.contents = Bitmap.new(width - 32, height - 32)
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# â— Refreshment
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i, normal_color)
end
end
#--------------------------------------------------------------------------
# â— Rectangle renewal of cursor
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set((index % 2) * 128, 32 * (index / 2), 128, 32)
end
end
#--------------------------------------------------------------------------
# â— Drawing of item
# index : Item number
# color : Letter color
#--------------------------------------------------------------------------
def draw_item(index, color)
self.contents.font.color = color
rect = Rect.new(4 + (index % 2) * 128, 32 * (index / 2), 128, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index])
end
#--------------------------------------------------------------------------
# â— Nullfication of item
# index : Item number
#--------------------------------------------------------------------------
def disable_item(index)
draw_item(index, disabled_color)
end
end
#==============================================================================
# * Window_MenuStatus
#==============================================================================
class Window_MenuStatus < Window_Selectable
#--------------------------------------------------------------------------
# â— Open instance variable
#--------------------------------------------------------------------------
attr_accessor
ut_window # Present window
#--------------------------------------------------------------------------
# â— Object initialization
#--------------------------------------------------------------------------
def initialize
super(40, 0, 560, 480)
self.z = 6100
self.opacity = 0
self.back_opacity = 0
@out_window = Window_Base.new(40, 220, 560, 240)
@out_window.z = 6100
@out_window.back_opacity = 192
@column_max = 2
self.contents = Bitmap.new(width - 32, height - 32)
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# â— Release
#--------------------------------------------------------------------------
def dispose
@out_window.dispose
super
end
#--------------------------------------------------------------------------
# â— Refreshment
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
x = (i % 2) * 264
y = (i / 2) * 104 + 220
actor = $game_party.actors
draw_actor_battler(actor, x + (2 - i / 2) * 88, y + 104)
draw_actor_name(actor, x + 12, y)
draw_actor_class(actor, x + 132, y)
draw_actor_level(actor, x + 12, y + 24)
draw_actor_state(actor, x + 12, y + 48, 100)
draw_actor_exp(actor, x + 30, y + 72)
draw_actor_hp(actor, x + 108, y + 24)
draw_actor_sp(actor, x + 108, y + 48)
end
end
#--------------------------------------------------------------------------
# â— Rectangle renewal of cursor
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < 0
if @index == -2
self.cursor_rect.set(0, 220, 528, 208)
elsif @index < -2
self.cursor_rect.set(((@index + 10) % 2) * 264,
((@index + 10) / 2) * 104 + 220, 264, 104)
else
self.cursor_rect.empty
end
else
self.cursor_rect.set((@index % 2) * 264, (@index / 2) * 104 + 220,
264, 104)
end
end
#--------------------------------------------------------------------------
# â— Frame renewal
#--------------------------------------------------------------------------
def update
@out_window.update
super
end
end
#==============================================================================
# * Scene_Menu
#==============================================================================
class Scene_Menu
#--------------------------------------------------------------------------
# â— Open instance variable
#--------------------------------------------------------------------------
attr_accessor :menu # Present window
attr_accessor :command_window # Command window
attr_accessor :status_window # Target window
#--------------------------------------------------------------------------
# â— Object initialization
# menu_index : Cursor initial position of command
#--------------------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
end
#--------------------------------------------------------------------------
# â— Main processing
#--------------------------------------------------------------------------
def main
# Drawing up sprite set
@spriteset = Spriteset_Map.new
# Drawing up the command window
s1 = $data_system.words.item
s2 = $data_system.words.skill
s3 = $data_system.words.equip
s4 = "Status"
s5 = "Party"
s6 = "Lost Ones"
s7 = "Bestiary"
s8 = "Quit"
@command_window = Window_MenuCommand.new(288, [s1, s2, s3, s4, s5, s6, s7, s8])
@command_window.index = @menu_index
@command_window.x = 40
@command_window.y = 20
@command_window.z = 6100
@command_window.back_opacity = 192
# When party number of people 0 is,
if $game_party.actors.size == 0
# Nullifying the item, skill, equipment and status
@command_window.disable_item(0)
@command_window.disable_item(1)
@command_window.disable_item(2)
@command_window.disable_item(3)
end
# In case of saving prohibition
if $game_system.save_disabled
# Saving is made invalid
@command_window.disable_item(4)
end
# Drawing up the gold window
@gold_window = Window_Gold.new
@gold_window.x = 440
@gold_window.y = 20
@gold_window.z = 6100
@gold_window.back_opacity = 192
# Drawing up the status window
@status_window = Window_MenuStatus.new
@menu = nil
# Transition execution
Graphics.transition
# Main loop
loop do
# Renewing the game picture
Graphics.update
# Updating the information of input
Input.update
# Frame renewal
update
if @menu != nil
@menu.update
end
# When the picture changes, discontinuing the loop
if $scene != self
break
end
end
# Transition preparation
Graphics.freeze
# Releasing sprite set
@spriteset.dispose
# Releasing the window
@command_window.dispose
@gold_window.dispose
@status_window.dispose
end
#--------------------------------------------------------------------------
# â— Frame renewal
#--------------------------------------------------------------------------
def update
# Renewing the window
@command_window.update
@gold_window.update
@status_window.update
# When the command window is active: update_command is called
if @command_window.active and @menu == nil
update_command
return
end
# When the status window is active: update_status is called
if @status_window.active and @menu == nil
update_status
return
end
end
#--------------------------------------------------------------------------
# â— Frame renewal (When the command window is active)
#--------------------------------------------------------------------------
def update_command
# When the B button is pushed,
if Input.trigger?(Input::B)
# Performing cancellation SE
$game_system.se_play($data_system.cancel_se)
# Change to map picture
$scene = Scene_Map.new
return
end
# When C button is pushed,
if Input.trigger?(Input::C)
# When party number of people with 0, it is command other than saving and game end,
if $game_party.actors.size == 0 and @command_window.index < 4
# Performing buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# It diverges at cursor position of the command window
case @command_window.index
when 0 # Item
Input.update
# Performing decision SE
$game_system.se_play($data_system.decision_se)
# Change to item picture
@menu = Scene_Item.new
when 1 # Skill
# Performing decision SE
$game_system.se_play($data_system.decision_se)
# The status window is made active
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 2 # Equipment
# Performing decision SE
$game_system.se_play($data_system.decision_se)
# The status window is made active
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 3 # Status
# Performing decision SE
$game_system.se_play($data_system.decision_se)
# The status window is made active
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 4
$game_system.se_play($data_system.decision_se)
$scene = PXMod::Scene_PartyManager.new
when 5
# Performing decision SE
$game_system.se_play($data_system.decision_se)
# Change to saving picture
$scene = Scene_Esper.new
when 6 # Load
$game_system.se_play($data_system.decision_se)
# Change to saving picture
$scene = Scene_MonsterGuide.new(true)
when 7 # Game end or what is by default Shutdown
# Performing decision SE
$game_system.se_play($data_system.decision_se)
# Change to game end picture
$scene = Scene_End.new
end
return
end
end
#--------------------------------------------------------------------------
# â— When frame renewal (the status window is active,)
#--------------------------------------------------------------------------
def update_status
# The B when button is pushed,
if Input.trigger?(Input::B)
# Performing cancellation SE
$game_system.se_play($data_system.cancel_se)
# The command window is made active
@command_window.active = true
@status_window.active = false
@status_window.index = -1
return
end
# When C button is pushed,
if Input.trigger?(Input::C)
# It diverges at cursor position of the command window
case @command_window.index
when 1 # Skill
# When conduct restriction of this actor is 2 or more,
if $game_party.actors[@status_window.index].restriction >= 2
# Performing buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
Input.update
# Performing decision SE
$game_system.se_play($data_system.decision_se)
# Change to skill picture
@menu = Scene_Skill.new(@status_window.index)
when 2 # Equipment
Input.update
# Performing decision SE
$game_system.se_play($data_system.decision_se)
# Change to equipment picture
@menu = Scene_Equip.new(@status_window.index)
when 3 # Status
Input.update
# Performing decision SE
$game_system.se_play($data_system.decision_se)
# Change to status picture
@menu = Scene_Status.new(@status_window.index)
end
return
end
end
end
#--------------------------------------------------------------------------
# â— When frame renewal (the status window is active,)
#--------------------------------------------------------------------------
def update_status
# The B when button is pushed,
if Input.trigger?(Input::B)
# Performing cancellation SE
$game_system.se_play($data_system.cancel_se)
# The command window is made active
@command_window.active = true
@status_window.active = false
@status_window.index = -1
return
end
# When C button is pushed,
if Input.trigger?(Input::C)
# It diverges at cursor position of the command window
case @command_window.index
when 1 # Skill
# When conduct restriction of this actor is 2 or more,
if $game_party.actors[@status_window.index].restriction >= 2
# Performing buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
Input.update
# Performing decision SE
$game_system.se_play($data_system.decision_se)
# Change to skill picture
@menu = Scene_Skill.new(@status_window.index)
when 2 # Equipment
Input.update
# Performing decision SE
$game_system.se_play($data_system.decision_se)
# Change to equipment picture
@menu = Scene_Equip.new(@status_window.index)
when 3 # Status
Input.update
# Performing decision SE
$game_system.se_play($data_system.decision_se)
# Change to status picture
@menu = Scene_Status.new(@status_window.index)
end
return
end
end
#==============================================================================
# * Window_Item
#==============================================================================
class Window_Item < Window_Selectable
#--------------------------------------------------------------------------
# â— Object initialization
#--------------------------------------------------------------------------
def initialize
super(20, 106, 600, 320)
self.index = 0
self.back_opacity = 192
@column_max = 2
# When it is in the midst of fighting, it moves the window to the picture center, makes translucent
if $game_temp.in_battle
self.x = 0
self.y = 64
self.width = 640
self.height = 256
else
self.z = 6110
end
refresh
end
#--------------------------------------------------------------------------
# â— Drawing of item
# index : Item number
#--------------------------------------------------------------------------
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.is_a?(RPG::Item) and
$game_party.item_can_use?(item.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
if $game_temp.in_battle
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 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)
else
x = 4 + index % 2 * 284
y = index / 2 * 32
rect = Rect.new(x, y, 280, 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, 208, 32, item.name, 0)
self.contents.draw_text(x + 236, y, 16, 32, ":", 1)
self.contents.draw_text(x + 252, y, 24, 32, number.to_s, 2)
end
end
#--------------------------------------------------------------------------
# â— Rectangle renewal of cursor
#--------------------------------------------------------------------------
def update_cursor_rect
if $game_temp.in_battle
super
else
# Acquiring present line
row = @index / @column_max
# When present line, it is before from the first line which is indicated,
if row < self.top_row
# Way present line becomes the first, the scroll
self.top_row = row
end
# When present line, it is rear from line of the last tail which is indicated,
if row > self.top_row + (self.page_row_max - 1)
# Way present line becomes the last tail, the scroll
self.top_row = row - (self.page_row_max - 1)
end
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set((index % 2) * 284,
@index / @column_max * 32 - self.oy, 284, 32)
end
end
end
end
#==============================================================================
# * Scene_Item
#==============================================================================
class Scene_Item
#--------------------------------------------------------------------------
# â— Object initialization
#--------------------------------------------------------------------------
def initialize
# Drawing up the help window and the item window
@help_window = Window_Help2.new
@item_window = Window_Item.new
# Help window association
@item_window.help_window = @help_window
$scene.command_window.active = false
end
#--------------------------------------------------------------------------
# â— Release
#--------------------------------------------------------------------------
def dispose
# Releasing the window
@help_window.dispose
@item_window.dispose
$scene.menu = nil
$scene.command_window.active = true
end
#--------------------------------------------------------------------------
# â— Frame renewal
#--------------------------------------------------------------------------
def update
# Renewing the window
@help_window.update
@item_window.update
# When the item window is active: update_item is called,
if @item_window.active
update_item
return
end
# When the target window is active: update_target is called,
if $scene.status_window.active
update_target
return
end
end
#--------------------------------------------------------------------------
# â— When frame renewal (the item window is active)
#--------------------------------------------------------------------------
def update_item
# When B button is pushed,
if Input.trigger?(Input::B)
# Performing cancellation SE
$game_system.se_play($data_system.cancel_se)
dispose
return
end
# When C button is pushed,
if Input.trigger?(Input::C)
# Acquiring the data which presently is selected in the item window
@item = @item_window.item
# When it is not the use item,
unless @item.is_a?(RPG::Item)
# Performing buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# When you cannot use,
unless $game_party.item_can_use?(@item.id)
# Performing buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Performing decision SE
$game_system.se_play($data_system.decision_se)
# When the effective range takes part,
if @item.scope >= 3
# Active conversion target window
@item_window.active = false
$scene.status_window.z = 6120
$scene.status_window.out_window.z = 6120
$scene.status_window.active = true
# Setting cursor position the effective range (the single unit/the whole) according to
if @item.scope == 4 || @item.scope == 6
$scene.status_window.index = -2
else
$scene.status_window.index = 0
end
# When the effective range is other than taking part,
else
# When common event ID is effective,
if @item.common_event_id > 0
# Common event call reservation
$game_temp.common_event_id = @item.common_event_id
# When using the item performing SE
$game_system.se_play(@item.menu_se)
# In case of consumable
if @item.consumable
# The item which you use is decreased 1
$game_party.lose_item(@item.id, 1)
# Redrawing the item of the item window
@item_window.draw_item(@item_window.index)
end
# Change to map picture
dispose
$scene = Scene_Map.new
return
end
end
return
end
end
#--------------------------------------------------------------------------
# â— When frame renewal (the target window is active,)
#--------------------------------------------------------------------------
def update_target
# The B when button is pushed,
if Input.trigger?(Input::B)
# Performing cancellation SE
$game_system.se_play($data_system.cancel_se)
# When with the item and so on is cut off and it becomes not be able to use,
unless $game_party.item_can_use?(@item.id)
# Rewriting the contents of the item window
@item_window.refresh
end
# Eliminating the target window
@item_window.active = true
$scene.status_window.index = -1
$scene.status_window.z = 6100
$scene.status_window.out_window.z = 6100
$scene.status_window.active = false
return
end
# When C button is pushed,
if Input.trigger?(Input::C)
# When the item is consumed,
if $game_party.item_number(@item.id) == 0
# Performing buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# When the target is the whole,
if $scene.status_window.index < 0
# Applying the use effect of the item to the whole party
used = false
for i in $game_party.actors
used |= i.item_effect(@item)
end
end
# When the target is the single unit,
if $scene.status_window.index >= 0
# Applying the use effect of the item to the actor of the target
target = $game_party.actors[$scene.status_window.index]
used = target.item_effect(@item)
end
# When the item was used,
if used
# When using the item performing SE
$game_system.se_play(@item.menu_se)
# In case of consumable
if @item.consumable
# The item which you use is decreased 1
$game_party.lose_item(@item.id, 1)
# Redrawing the item of the item window
@item_window.draw_item(@item_window.index)
end
# Rewriting the contents of the target window
$scene.status_window.refresh
# In case of total destruction
if $game_party.all_dead?
# Change to game over picture
dispose
$scene = Scene_Gameover.new
return
end
# When common event ID is effective,
if @item.common_event_id > 0
# Common event call reservation
$game_temp.common_event_id = @item.common_event_id
# Change to map picture
dispose
$scene = Scene_Map.new
return
end
end
# When the item was not used,
unless used
# Performing buzzer SE
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
end
#==============================================================================
# * Window_SkillStatus
#==============================================================================
class Window_SkillStatus < Window_Base
#--------------------------------------------------------------------------
# â— Object initialization
# actor : Actor
#--------------------------------------------------------------------------
def initialize(actor)
super(20, 106, 600, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.z = 6110
self.back_opacity = 192
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# â— Refreshment
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_actor_name(@actor, 4, 0)
draw_actor_state(@actor, 148, 0, 100)
draw_actor_hp(@actor, 260, 0)
draw_actor_sp(@actor, 420, 0)
end
end
#==============================================================================
# * Window_Skill
#==============================================================================
class Window_Skill < Window_Selectable
#--------------------------------------------------------------------------
# â— Object initialization
# actor : Actor
#--------------------------------------------------------------------------
def initialize(actor)
super(20, 170, 600, 256)
self.back_opacity = 192
self.index = 0
@actor = actor
@column_max = 2
# When it is in the midst of fighting, it moves the window to the picture center, makes translucent
if $game_temp.in_battle
self.x = 0
self.y = 64
self.width = 640
self.height = 256
else
self.z = 6110
end
refresh
end
#--------------------------------------------------------------------------
# â— Drawing of item
# index : Item number
#--------------------------------------------------------------------------
def draw_item(index)
skill = @data[index]
if @actor.skill_can_use?(skill.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
if $game_temp.in_battle
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 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(skill.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, 204, 32, skill.name, 0)
self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
else
x = 4 + index % 2 * 284
y = index / 2 * 32
rect = Rect.new(x, y, 280, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(skill.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, 200, 32, skill.name, 0)
self.contents.draw_text(x + 228, y, 48, 32, skill.sp_cost.to_s, 2)
end
end
#--------------------------------------------------------------------------
# â— Help text renewal
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.skill == nil ? "" : self.skill.description)
end
#--------------------------------------------------------------------------
# â— Rectangle renewal of cursor
#--------------------------------------------------------------------------
def update_cursor_rect
if $game_temp.in_battle
super
else
# Acquiring present line
row = @index / @column_max
# When present line, it is before from the first line which is indicated,
if row < self.top_row
# Way present line becomes the first, the scroll
self.top_row = row
end
# When present line, it is rear from line of the last tail which is indicated,
if row > self.top_row + (self.page_row_max - 1)
# Way present line becomes the last tail, the scroll
self.top_row = row - (self.page_row_max - 1)
end
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set((index % 2) * 284,
@index / @column_max * 32 - self.oy, 284, 32)
end
end
end
end
#==============================================================================
# * Scene_Skill
#==============================================================================
class Scene_Skill
#--------------------------------------------------------------------------
# â— Object initialization
# actor_index : Actor index
#--------------------------------------------------------------------------
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
# Acquiring the actor
@actor = $game_party.actors[@actor_index]
# Drawing up the help window, the status window and the skill window
@help_window = Window_Help2.new
@status_window = Window_SkillStatus.new(@actor)
@skill_window = Window_Skill.new(@actor)
@skill_window.z = 6110
@skill_window.back_opacity = 160
# Help window association
@skill_window.help_window = @help_window
$scene.command_window.active = false
$scene.status_window.active = false
end
#--------------------------------------------------------------------------
# â— Release
#--------------------------------------------------------------------------
def dispose
# Releasing the window
@help_window.dispose
@status_window.dispose
@skill_window.dispose
$scene.menu = nil
$scene.status_window.index = -1
$scene.command_window.active = true
end
#--------------------------------------------------------------------------
# â— Frame renewal
#--------------------------------------------------------------------------
def update
# Renewing the window
@help_window.update
@status_window.update
@skill_window.update
# When the skill window is active: update_skill is called
if @skill_window.active
update_skill
return
end
# When the target window is active: update_target is called
if $scene.status_window.active
update_target
return
end
end
#--------------------------------------------------------------------------
# â— When frame renewal (the skill window is active)
#--------------------------------------------------------------------------
def update_skill
# The B when button is pushed,
if Input.trigger?(Input::B)
# Performing cancellation SE
$game_system.se_play($data_system.cancel_se)
# Change to menu screen
dispose
return
end
# When C button is pushed,
if Input.trigger?(Input::C)
# Acquiring the data which presently is selected in the skill window
@skill = @skill_window.skill
# When you cannot use,
if @skill == nil or not @actor.skill_can_use?(@skill.id)
# Performing buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Performing decision SE
$game_system.se_play($data_system.decision_se)
# When the effective range takes part,
if @skill.scope >= 3
# Active conversion target window
@skill_window.active = false
$scene.status_window.z = 6120
$scene.status_window.out_window.z = 6120
$scene.status_window.active = true
# Setting cursor position the effective range (the single unit/the whole) according to
if @skill.scope == 4 || @skill.scope == 6
$scene.status_window.index = -2
elsif @skill.scope == 7
$scene.status_window.index = @actor_index - 10
else
$scene.status_window.index = 0
end
# When the effective range is other than taking part,
else
# When common event ID is effective,
if @skill.common_event_id > 0
# Common event call reservation
$game_temp.common_event_id = @skill.common_event_id
# When using the skill performing SE
$game_system.se_play(@skill.menu_se)
# SP consumption
@actor.sp -= @skill.sp_cost
# Rewriting the contents of each window
@status_window.refresh
@skill_window.refresh
$scene.status_window.refresh
# Change to each map picture
dispose
$scene = Scene_Map.new
return
end
end
return
end
# The R when button is pushed,
if Input.trigger?(Input::R)
# Performing cursor SE
$game_system.se_play($data_system.cursor_se)
# To the following actor
@actor_index += 1
@actor_index %= $game_party.actors.size
@actor = $game_party.actors[@actor_index]
dispose
$scene.status_window.index = @actor.index
$scene.menu = Scene_Skill.new(@actor.index)
return
end
# The L when button is pushed,
if Input.trigger?(Input::L)
# Performing cursor SE
$game_system.se_play($data_system.cursor_se)
# To actor before
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
@actor = $game_party.actors[@actor_index]
dispose
$scene.status_window.index = @actor.index
$scene.menu = Scene_Skill.new(@actor.index)
return
end
end
#--------------------------------------------------------------------------
# â— When frame renewal (the target window is active,)
#--------------------------------------------------------------------------
def update_target
# The B when button is pushed,
if Input.trigger?(Input::B)
# Performing cancellation SE
$game_system.se_play($data_system.cancel_se)
# Eliminating the target window
@skill_window.active = true
$scene.status_window.index = @actor.index
$scene.status_window.z = 6100
$scene.status_window.out_window.z = 6100
$scene.status_window.active = false
return
end
# When C button is pushed,
if Input.trigger?(Input::C)
# When with SP and so on is cut off and it becomes not be able to use,
unless @actor.skill_can_use?(@skill.id)
# Performing buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# When the target is the whole,
if $scene.status_window.index == -2
# Applying the use effect of skill to the whole party
used = false
for i in $game_party.actors
used |= i.skill_effect(@actor, @skill)
end
end
# When the target is the user,
if $scene.status_window.index < -2
# Applying the use effect of skill to the actor of the target
target = $game_party.actors[$scene.status_window.index + 10]
used = target.skill_effect(@actor, @skill)
end
# When the target is the single unit,
if $scene.status_window.index >= 0
# Applying the use effect of skill to the actor of the target
target = $game_party.actors[$scene.status_window.index]
used = target.skill_effect(@actor, @skill)
end
# When skill was used,
if used
# When using the skill performing SE
$game_system.se_play(@skill.menu_se)
# SP consumption
@actor.sp -= @skill.sp_cost
# Rewriting the contents of each window
@status_window.refresh
@skill_window.refresh
$scene.status_window.refresh
# In case of total destruction
if $game_party.all_dead?
# Change to game over picture
$scene = Scene_Gameover.new
return
end
# When common event ID is effective,
if @skill.common_event_id > 0
# Common event call reservation
$game_temp.common_event_id = @skill.common_event_id
# Change to map picture
dispose
$scene = Scene_Map.new
return
end
end
# When skill was not used,
unless used
# Performing buzzer SE
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
end
#==============================================================================
# * Window_Status
#==============================================================================
class Window_Status < Window_Base
#--------------------------------------------------------------------------
# â— Object initialization
# actor : Actor
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 0, 640, 480)
self.z = 6110
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = 192
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# â— Refreshment
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_actor_graphic(@actor, 44, 96)
draw_actor_battler(@actor, 426, 368)
draw_actor_name(@actor, 24, 0)
draw_actor_class(@actor, 24 + 144, 0)
draw_actor_level(@actor, 320, 16)
draw_actor_state(@actor, 320, 48)
draw_actor_hp(@actor, 68, 32, 172)
draw_actor_sp(@actor, 68, 64, 172)
draw_actor_parameter(@actor, 68, 112, 0)
draw_actor_parameter(@actor, 68, 144, 1)
draw_actor_parameter(@actor, 68, 176, 2)
draw_actor_parameter(@actor, 68, 224, 3)
draw_actor_parameter(@actor, 68, 256, 4)
draw_actor_parameter(@actor, 68, 288, 5)
draw_actor_parameter(@actor, 68, 320, 6)
self.contents.font.color = system_color
self.contents.draw_text(304, 96, 80, 32, "EXP")
self.contents.draw_text(304, 128, 80, 32, "NEXT")
self.contents.font.color = normal_color
self.contents.draw_text(304 + 80, 96, 84, 32, @actor.exp_s, 2)
self.contents.draw_text(304 + 80, 128, 84, 32, @actor.next_rest_exp_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(304, 176, 96, 32, "Lv")
draw_item_name($data_weapons[@actor.weapon_id], 304 + 16, 208)
draw_item_name($data_armors[@actor.armor1_id], 304 + 16, 240)
draw_item_name($data_armors[@actor.armor2_id], 304 + 16, 272)
draw_item_name($data_armors[@actor.armor3_id], 304 + 16, 304)
draw_item_name($data_armors[@actor.armor4_id], 304 + 16, 336)
end
end
#==============================================================================
# â– Scene_Status
#------------------------------------------------------------------------------
#  It is the class which processes the status picture. #==============================================================================
class Scene_Status
#--------------------------------------------------------------------------
# â— Object initialization
# actor_index : Actor index
#--------------------------------------------------------------------------
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
# Acquiring the actor
@actor = $game_party.actors[@actor_index]
# Drawing up the status window
@status_window = Window_Status.new(@actor)
$scene.command_window.active = false
$scene.status_window.active = false
end
#--------------------------------------------------------------------------
# â— Release
#--------------------------------------------------------------------------
def dispose
# Releasing the window
@status_window.dispose
$scene.menu = nil
$scene.status_window.index = -1
$scene.command_window.active = true
end
#--------------------------------------------------------------------------
# â— Frame renewal
#--------------------------------------------------------------------------
def update
# The B when button is pushed,
if Input.trigger?(Input::B)
# Performing cancellation SE
$game_system.se_play($data_system.cancel_se)
# Change to menu screen
dispose
return
end
# The R when button is pushed,
if Input.trigger?(Input::RIGHT) or Input.trigger?(Input::R)
# Performing cursor SE
$game_system.se_play($data_system.cursor_se)
# To the following actor
@actor_index += 1
@actor_index %= $game_party.actors.size
@actor = $game_party.actors[@actor_index]
dispose
# Change to another status picture
$scene.status_window.index = @actor.index
$scene.menu = Scene_Status.new(@actor.index)
return
end
# The L when button is pushed,
if Input.trigger?(Input::LEFT) or Input.trigger?(Input::L)
# Performing cursor SE
$game_system.se_play($data_system.cursor_se)
# To actor before
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
@actor = $game_party.actors[@actor_index]
dispose
# Change to another status picture
$scene.status_window.index = @actor.index
$scene.menu = Scene_Status.new(@actor.index)
return
end
end
end
#==============================================================================
# * Window_EquipLeft
#==============================================================================
class Window_EquipLeft < Window_Base
#--------------------------------------------------------------------------
# â— Object initialization
# actor : Actor
#--------------------------------------------------------------------------
def initialize(actor)
super(20, 106, 264, 192)
self.z = 6110
self.back_opacity = 192
self.contents = Bitmap.new(width - 32, height - 32)
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# â— Refreshment
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_actor_graphic(@actor, 28, 64)
draw_actor_name(@actor, 52, 0)
draw_actor_level(@actor, 68, 32)
draw_actor_parameter(@actor, 4, 64, 0)
draw_actor_parameter(@actor, 4, 96, 1)
draw_actor_parameter(@actor, 4, 128, 2)
if @new_atk != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 64, 40, 32, "→", 1)
self.contents.font.color = normal_color
self.contents.draw_text(192, 64, 36, 32, @new_atk.to_s, 2)
end
if @new_pdef != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 96, 40, 32, "→", 1)
self.contents.font.color = normal_color
self.contents.draw_text(192, 96, 36, 32, @new_pdef.to_s, 2)
end
if @new_mdef != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 128, 40, 32, "→", 1)
self.contents.font.color = normal_color
self.contents.draw_text(192, 128, 36, 32, @new_mdef.to_s, 2)
end
end
end
#==============================================================================
# * Window_EquipRight
#==============================================================================
class Window_EquipRight < Window_Selectable
#--------------------------------------------------------------------------
# â— Object initialization
# actor : Actor
#--------------------------------------------------------------------------
def initialize(actor)
super(284, 106, 336, 192)
self.z = 6110
self.back_opacity = 192
self.contents = Bitmap.new(width - 32, height - 32)
@actor = actor
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# â— Refreshment
#--------------------------------------------------------------------------
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, 202)
draw_item_name(@data[1], 92, 32 * 1, 202)
draw_item_name(@data[2], 92, 32 * 2, 202)
draw_item_name(@data[3], 92, 32 * 3, 202)
draw_item_name(@data[4], 92, 32 * 4, 202)
end
end
#==============================================================================
# * Window_EquipItem
#==============================================================================
class Window_EquipItem < Window_Selectable
#--------------------------------------------------------------------------
# â— Object initialization
# actor : Actor
# equip_type : Equipment region (0~3)
#--------------------------------------------------------------------------
def initialize(actor, equip_type)
super(20, 298, 600, 128)
self.z = 6110
self.back_opacity = 192
@actor = actor
@equip_type = equip_type
@column_max = 2
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# â— Drawing of item
# index : Item number
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
x = 4 + index % 2 * 281
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.draw_text(x + 28, y, 208, 32, item.name, 0)
self.contents.draw_text(x + 236, y, 16, 32, ":", 1)
self.contents.draw_text(x + 252, y, 24, 32, number.to_s, 2)
end
#--------------------------------------------------------------------------
# â— Rectangle renewal of cursor
#--------------------------------------------------------------------------
def update_cursor_rect
if $game_temp.in_battle
super
else
# Acquiring present line
row = @index / @column_max
# When present line, it is before from the first line which is indicated,
if row < self.top_row
# Way present line becomes the first, the scroll
self.top_row = row
end
# When present line, it is rear from line of the last tail which is indicated,
if row > self.top_row + (self.page_row_max - 1)
# Way present line becomes the last tail, the scroll
self.top_row = row - (self.page_row_max - 1)
end
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set((index % 2) * 284,
@index / @column_max * 32 - self.oy, 284, 32)
end
end
end
end
#==============================================================================
# * Scene_Equip
#==============================================================================
class Scene_Equip
#--------------------------------------------------------------------------
# â— Object initialization
# actor_index : Actor index
# equip_index : Equipment index
#--------------------------------------------------------------------------
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
@equip_index = equip_index
# Acquiring the actor
@actor = $game_party.actors[@actor_index]
# Drawing up the window
@help_window = Window_Help2.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)
# Help window association
@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
# Setting cursor position
@right_window.index = @equip_index
$scene.command_window.active = false
$scene.status_window.active = false
refresh
end
#--------------------------------------------------------------------------
# â— Release
#--------------------------------------------------------------------------
def dispose
# Releasing the window
@help_window.dispose
@left_window.dispose
@right_window.dispose
@item_window1.dispose
@item_window2.dispose
@item_window3.dispose
@item_window4.dispose
@item_window5.dispose
$scene.menu = nil
$scene.status_window.index = -1
$scene.command_window.active = true
end
#--------------------------------------------------------------------------
# â— Refreshment
#--------------------------------------------------------------------------
def refresh
# Visible state setting of item window
@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)
# Acquiring the item which presently is in the midst of equipping
item1 = @right_window.item
# Setting the present item window to @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
# When the light/write window is active,
if @right_window.active
# Eliminating the parameter after the modifying the equipment
@left_window.set_new_parameters(nil, nil, nil)
end
# When the item window is active,
if @item_window.active
# Acquiring the item which presently is in the midst of selecting
item2 = @item_window.item
# Modifying equipment
last_hp = @actor.hp
last_sp = @actor.sp
@actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
# Acquiring the parameter after the modifying the equipment
new_atk = @actor.atk
new_pdef = @actor.pdef
new_mdef = @actor.mdef
# Equipment is reset
@actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
@actor.hp = last_hp
@actor.sp = last_sp
# Drawing to left window
@left_window.set_new_parameters(new_atk, new_pdef, new_mdef)
end
end
#--------------------------------------------------------------------------
# â— Frame renewal
#--------------------------------------------------------------------------
def update
# Renewing the window
@left_window.update
@right_window.update
@item_window.update
refresh
# When the light/write window is active: update_right is called
if @right_window.active
update_right
return
end
# When the item window is active: update_item is called
if @item_window.active
update_item
return
end
end
#--------------------------------------------------------------------------
# â— When frame renewal (the light/write window is active)
#--------------------------------------------------------------------------
def update_right
# The B when button is pushed,
if Input.trigger?(Input::B)
# Performing cancellation SE
$game_system.se_play($data_system.cancel_se)
# Change to menu screen
dispose
return
end
# When C button is pushed,
if Input.trigger?(Input::C)
# In case of equipment fixing
if @actor.equip_fix?(@right_window.index)
# Performing buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Performing decision SE
$game_system.se_play($data_system.decision_se)
# Active conversion item window
@right_window.active = false
@item_window.active = true
@item_window.index = 0
return
end
# The R when button is pushed,
if Input.trigger?(Input::RIGHT) or Input.trigger?(Input::R)
# Performing cursor SE
$game_system.se_play($data_system.cursor_se)
# To the following actor
@actor_index += 1
@actor_index %= $game_party.actors.size
@actor = $game_party.actors[@actor_index]
dispose
# Change to another equipment picture
$scene.status_window.index = @actor.index
$scene.menu = Scene_Equip.new(@actor_index, @right_window.index)
return
end
# The L when button is pushed,
if Input.trigger?(Input::LEFT) or Input.trigger?(Input::L)
# Performing cursor SE
$game_system.se_play($data_system.cursor_se)
# To actor before
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
@actor = $game_party.actors[@actor_index]
dispose
# Change to another equipment picture
$scene.status_window.index = @actor.index
$scene.menu = Scene_Equip.new(@actor_index, @right_window.index)
return
end
end
#--------------------------------------------------------------------------
# â— When frame renewal (the item window is active)
#--------------------------------------------------------------------------
def update_item
# The B when button is pushed,
if Input.trigger?(Input::B)
# Performing cancellation SE
$game_system.se_play($data_system.cancel_se)
# Active conversion light/write window
@right_window.active = true
@item_window.active = false
@item_window.index = -1
return
end
# When C button is pushed,
if Input.trigger?(Input::C)
# Performing equipment SE
$game_system.se_play($data_system.equip_se)
# Acquiring the data which presently is selected in the item window
item = @item_window.item
# Modifying equipment
@actor.equip(@right_window.index, item == nil ? 0 : item.id)
# Active conversion light/write window
@right_window.active = true
@item_window.active = false
@item_window.index = -1
# Rewriting the contents of the light/write window and the item window
@right_window.refresh
@item_window.refresh
$scene.status_window.refresh
return
end
end
end
#==============================================================================
# * Scene_Title
#==============================================================================
class Scene_Title
#--------------------------------------------------------------------------
# â— Open instance variable
#--------------------------------------------------------------------------
attr_accessor :menu # Present window
attr_accessor :command_window # Command window
#--------------------------------------------------------------------------
# â— Object initialization
#--------------------------------------------------------------------------
def initialize
@menu = nil
end
#--------------------------